summaryrefslogtreecommitdiff
path: root/baseboard
diff options
context:
space:
mode:
authorben.chen2@quanta.corp-partner.google.com <ben.chen2@quanta.corp-partner.google.com>2019-07-25 11:23:09 +0800
committerCommit Bot <commit-bot@chromium.org>2019-08-06 16:27:44 +0000
commitd3c9b9d123514742f1b5bed5d0ed9f379147b84b (patch)
treef65976059a3de57485762e5f7f758f3c43819956 /baseboard
parent8e6cbfe9da81862da48c250737cb9e77d175b2b3 (diff)
downloadchrome-ec-d3c9b9d123514742f1b5bed5d0ed9f379147b84b.tar.gz
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 <furquan@chromium.org> Tested-by: David Huang <David.Huang@quantatw.com> Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'baseboard')
-rw-r--r--baseboard/hatch/baseboard.c24
-rw-r--r--baseboard/hatch/baseboard.h1
2 files changed, 24 insertions, 1 deletions
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);