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 <hungte@chromium.org>
Reviewed-on: https://review.coreboot.org/c/30617
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: You-Cheng Syu <youcheng@google.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Hung-Te Lin 2019-01-03 14:31:04 +08:00 committed by Patrick Georgi
parent a2333c3935
commit e7184b0ad0
2 changed files with 14 additions and 3 deletions

View File

@ -14,6 +14,7 @@ config BOARD_SPECIFIC_OPTIONS
select FATAL_ASSERTS select FATAL_ASSERTS
select SPI_FLASH_INCLUDE_ALL_DRIVERS select SPI_FLASH_INCLUDE_ALL_DRIVERS
select EC_GOOGLE_CHROMEEC select EC_GOOGLE_CHROMEEC
select EC_GOOGLE_CHROMEEC_BOARDID
select EC_GOOGLE_CHROMEEC_SPI select EC_GOOGLE_CHROMEEC_SPI
select MAINBOARD_HAS_SPI_TPM_CR50 if VBOOT select MAINBOARD_HAS_SPI_TPM_CR50 if VBOOT
select MAINBOARD_HAS_TPM2 if VBOOT select MAINBOARD_HAS_TPM2 if VBOOT

View File

@ -58,10 +58,20 @@ static uint32_t get_index(unsigned int channel, uint32_t *cached_id)
return 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; static uint32_t cached_sku_id = BOARD_ID_INIT;
return get_index(4, &cached_board_id);
/* 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) uint32_t ram_code(void)