From 6c87853a83835c731808c90dc1e93315ee0cff40 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Tue, 27 May 2025 10:20:04 +0000 Subject: [PATCH] mb/google/bluey: Implement board and SKU ID retrieval This commit populates the `board_id()` and `sku_id()` functions for the Google Bluey mainboard, replacing the previous placeholder implementations. - The Board ID (`board_id()`) is now determined by reading a set of four GPIO pins (GPIO138 as MSB, GPIO137, GPIO136, GPIO135 as LSB) and interpreting their states as a base-3 encoded value using the `gpio_base3_value()` helper. - The SKU ID (`sku_id()`) is retrieved from the Google ChromeEC by calling `google_chromeec_get_board_sku()` when a ChromeEC is configured (`CONFIG(EC_GOOGLE_CHROMEEC)`). Both ID values are cached after their initial determination to avoid redundant reads. BUG=b:404985109 TEST=Able to build google/bluey Change-Id: Ic5a084e35b33a82fef76f33c2663aba7a48c16a7 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/87861 Tested-by: build bot (Jenkins) Reviewed-by: Kapil Porwal Reviewed-by: Pranava Y N --- src/mainboard/google/bluey/boardid.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/mainboard/google/bluey/boardid.c b/src/mainboard/google/bluey/boardid.c index b529ff1ec1..c893fdbea5 100644 --- a/src/mainboard/google/bluey/boardid.c +++ b/src/mainboard/google/bluey/boardid.c @@ -1,17 +1,35 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include +#include +#include uint32_t board_id(void) { static uint32_t id = UNDEFINED_STRAPPING_ID; - /* Placeholder */ + if (id != UNDEFINED_STRAPPING_ID) + return id; + + const gpio_t pins[] = { + [3] = GPIO(138), + [2] = GPIO(137), + [1] = GPIO(136), + [0] = GPIO(135) + }; + + id = gpio_base3_value(pins, ARRAY_SIZE(pins)); + return id; } uint32_t sku_id(void) { static uint32_t id = UNDEFINED_STRAPPING_ID; - /* Placeholder */ + if (id != UNDEFINED_STRAPPING_ID) + return id; + + if (CONFIG(EC_GOOGLE_CHROMEEC)) + id = google_chromeec_get_board_sku(); + return id; }