From a79d6e76b852e5e5a4667818722388f1a07497df Mon Sep 17 00:00:00 2001 From: Hung-Te Lin Date: Thu, 11 Mar 2021 16:45:54 +0800 Subject: [PATCH] mb/google/asurada: get SKU ID from AP strapping pins The SKU ID for Asurada should come from AP ADC channel 5 and 6. BUG=None TEST=make; boots on asurada Change-Id: I6a00c555f20aca4cd7f8bcee46ee81c17ef6ca3c Signed-off-by: Hung-Te Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/51405 Tested-by: build bot (Jenkins) Reviewed-by: Yu-Ping Wu --- src/mainboard/google/asurada/boardid.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/mainboard/google/asurada/boardid.c b/src/mainboard/google/asurada/boardid.c index 06c21ec36e..c026a6b85e 100644 --- a/src/mainboard/google/asurada/boardid.c +++ b/src/mainboard/google/asurada/boardid.c @@ -10,8 +10,12 @@ #define ADC_LEVELS 15 enum { + /* RAM IDs */ RAM_ID_HIGH_CHANNEL = 4, RAM_ID_LOW_CHANNEL = 3, + /* SKU IDs */ + SKU_ID_HIGH_CHANNEL = 6, + SKU_ID_LOW_CHANNEL = 5, }; static const unsigned int ram_voltages[ADC_LEVELS] = { @@ -58,7 +62,15 @@ static uint32_t get_adc_index(unsigned int channel) uint32_t sku_id(void) { - return 0; + static uint32_t cached_sku_code = BOARD_ID_INIT; + + if (cached_sku_code == BOARD_ID_INIT) { + cached_sku_code = (get_adc_index(SKU_ID_HIGH_CHANNEL) << 4 | + get_adc_index(SKU_ID_LOW_CHANNEL)); + printk(BIOS_DEBUG, "SKU Code: %#02x\n", cached_sku_code); + } + + return cached_sku_code; } uint32_t ram_code(void)