mb/google/rauru: Implement SKU ID
Retrieve the SKU ID for Rauru via CBI interface. If that failed (or no data found), fall back to ADC channels for SKU ID. TEST=Build pass, boot ok, log show: SKU Code: 0x2 BUG=b:317009620 Change-Id: I49ba6f428f55d3aae1b84a4d5ce06bec765caece Signed-off-by: Jarried Lin <jarried.lin@mediatek.corp-partner.google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/85666 Reviewed-by: Yu-Ping Wu <yupingso@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yidi Lin <yidilin@google.com>
This commit is contained in:
parent
b470b48718
commit
b3edaa7b10
2 changed files with 25 additions and 0 deletions
|
|
@ -26,6 +26,7 @@ config BOARD_SPECIFIC_OPTIONS
|
|||
select CHROMEOS_USE_EC_WATCHDOG_FLAG if CHROMEOS
|
||||
select EC_GOOGLE_CHROMEEC
|
||||
select EC_GOOGLE_CHROMEEC_BOARDID
|
||||
select EC_GOOGLE_CHROMEEC_SKUID
|
||||
select EC_GOOGLE_CHROMEEC_SPI
|
||||
select I2C_TPM if VBOOT
|
||||
select MAINBOARD_HAS_TPM2 if VBOOT
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include <assert.h>
|
||||
#include <boardid.h>
|
||||
#include <console/console.h>
|
||||
#include <device/mmio.h>
|
||||
#include <ec/google/chromeec/ec.h>
|
||||
#include <soc/mt6363_sdmadc.h>
|
||||
|
||||
|
|
@ -10,6 +11,10 @@
|
|||
|
||||
#define ADC_LEVELS 8
|
||||
|
||||
DEFINE_BITFIELD(STORAGE_TYPE, 11, 9);
|
||||
DEFINE_BITFIELD(CPU_TYPE, 8, 8);
|
||||
DEFINE_BITFIELD(PANEL_TYPE, 7, 0);
|
||||
|
||||
enum {
|
||||
/* Storage IDs */
|
||||
STORAGE_ID_LOW_CHANNEL = AUXADC_CHAN_VIN1,
|
||||
|
|
@ -75,3 +80,22 @@ enum ufs_type storage_type(uint32_t index)
|
|||
}
|
||||
return UFS_UNKNOWN;
|
||||
}
|
||||
|
||||
uint32_t sku_id(void)
|
||||
{
|
||||
static uint32_t cached_sku_code = BOARD_ID_INIT;
|
||||
|
||||
if (cached_sku_code == BOARD_ID_INIT) {
|
||||
cached_sku_code = google_chromeec_get_board_sku();
|
||||
|
||||
if (cached_sku_code == CROS_SKU_UNKNOWN ||
|
||||
cached_sku_code == CROS_SKU_UNPROVISIONED) {
|
||||
printk(BIOS_WARNING, "Failed to get SKU code from EC\n");
|
||||
cached_sku_code = CROS_SKU_UNPROVISIONED;
|
||||
SET32_BITFIELDS(&cached_sku_code, STORAGE_TYPE, storage_id());
|
||||
}
|
||||
printk(BIOS_DEBUG, "SKU Code: %#02x\n", cached_sku_code);
|
||||
}
|
||||
|
||||
return cached_sku_code;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue