From e7184b0ad07b0d3fe3e2f58bacd5e10e3cd88a79 Mon Sep 17 00:00:00 2001 From: Hung-Te Lin Date: Thu, 3 Jan 2019 14:31:04 +0800 Subject: google/kukui: Correct boardid sources and add sku_id Kukui is going to use ADC#4 as SKU ID, and utilizing EC BoardID as global board_id (i.e., board revision). BUG=b:122060615 TEST=make; manually tested on Kukui P1 board. Change-Id: I7bba368c141a7ba6db11f24b8e8e7158f0fc729e Signed-off-by: Hung-Te Lin Reviewed-on: https://review.coreboot.org/c/30617 Tested-by: build bot (Jenkins) Reviewed-by: You-Cheng Syu Reviewed-by: Julius Werner --- src/mainboard/google/kukui/Kconfig | 1 + src/mainboard/google/kukui/boardid.c | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'src/mainboard') diff --git a/src/mainboard/google/kukui/Kconfig b/src/mainboard/google/kukui/Kconfig index 287fd0d1de..d8ad84bb0d 100644 --- a/src/mainboard/google/kukui/Kconfig +++ b/src/mainboard/google/kukui/Kconfig @@ -14,6 +14,7 @@ config BOARD_SPECIFIC_OPTIONS select FATAL_ASSERTS select SPI_FLASH_INCLUDE_ALL_DRIVERS select EC_GOOGLE_CHROMEEC + select EC_GOOGLE_CHROMEEC_BOARDID select EC_GOOGLE_CHROMEEC_SPI select MAINBOARD_HAS_SPI_TPM_CR50 if VBOOT select MAINBOARD_HAS_TPM2 if VBOOT diff --git a/src/mainboard/google/kukui/boardid.c b/src/mainboard/google/kukui/boardid.c index d4b4b3e748..2420e78f4f 100644 --- a/src/mainboard/google/kukui/boardid.c +++ b/src/mainboard/google/kukui/boardid.c @@ -58,10 +58,20 @@ static uint32_t get_index(unsigned int channel, uint32_t *cached_id) return id; } -uint32_t board_id(void) +/* board_id is provided by ec/google/chromeec/ec_boardid.c */ + +uint32_t sku_id(void) { - static uint32_t cached_board_id = BOARD_ID_INIT; - return get_index(4, &cached_board_id); + static uint32_t cached_sku_id = BOARD_ID_INIT; + + /* Quirk for KUKUI: All P1/SKU0 had incorrectly set SKU=1. */ + if (IS_ENABLED(CONFIG_BOARD_GOOGLE_KUKUI)) { + if (cached_sku_id == BOARD_ID_INIT && board_id() == 1) { + cached_sku_id = 0; + return cached_sku_id; + } + } + return get_index(4, &cached_sku_id); } uint32_t ram_code(void) -- cgit v1.2.3