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 <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87861
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Pranava Y N <pranavayn@google.com>
This commit is contained in:
Subrata Banik 2025-05-27 10:20:04 +00:00
commit 6c87853a83

View file

@ -1,17 +1,35 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <boardid.h>
#include <ec/google/chromeec/ec.h>
#include <gpio.h>
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;
}