From d3c9b9d123514742f1b5bed5d0ed9f379147b84b Mon Sep 17 00:00:00 2001 From: "ben.chen2@quanta.corp-partner.google.com" Date: Thu, 25 Jul 2019 11:23:09 +0800 Subject: Hatch: Enable CBI info of board sku This patch enables get board sku BUG=b:138326244 BRANCH=master TEST=None Change-Id: I489de71c75804dd460bda98fa1c49b94c91c8a12 Signed-off-by: ben.chen2@quanta.corp-partner.google.com Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1716674 Reviewed-by: Furquan Shaikh Tested-by: David Huang Commit-Queue: Tim Wawrzynczak --- baseboard/hatch/baseboard.c | 24 ++++++++++++++++++++++++ baseboard/hatch/baseboard.h | 1 - 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/baseboard/hatch/baseboard.c b/baseboard/hatch/baseboard.c index 83b57a04a9..fbd793a46c 100644 --- a/baseboard/hatch/baseboard.c +++ b/baseboard/hatch/baseboard.c @@ -10,6 +10,7 @@ #include "charge_state_v2.h" #include "chipset.h" #include "console.h" +#include "cros_board_info.h" #include "driver/ppc/sn5s330.h" #include "driver/tcpm/anx7447.h" #include "driver/tcpm/ps8xxx.h" @@ -342,3 +343,26 @@ void lid_angle_peripheral_enable(int enable) keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE); } #endif + +static uint8_t sku_id; + +uint8_t get_board_sku(void) +{ + return sku_id; +} + +/* Read CBI from i2c eeprom and initialize variables for board variants */ +static void cbi_init(void) +{ + uint32_t val; + + if (cbi_get_sku_id(&val) != EC_SUCCESS || val > UINT8_MAX) { + CPRINTS("Read SKU Error value :%d", val); + return; + } + + sku_id = val; + + CPRINTS("SKU: %d", sku_id); +} +DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1); diff --git a/baseboard/hatch/baseboard.h b/baseboard/hatch/baseboard.h index 17f82f9167..b9832b1c06 100644 --- a/baseboard/hatch/baseboard.h +++ b/baseboard/hatch/baseboard.h @@ -188,7 +188,6 @@ enum mst_source { void board_reset_pd_mcu(void); void baseboard_mst_enable_control(enum mst_source, int level); - /* Check with variant about battery presence. */ enum battery_present variant_battery_present(void); -- cgit v1.2.1