diff options
author | Philip Chen <philipchen@google.com> | 2021-07-01 17:03:20 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-07-14 18:06:31 +0000 |
commit | c97cb76b816fc8e02fe3de0652794e85fe38f4c6 (patch) | |
tree | e0f3cad98aa4e6f1093374bc7f6fe5dd9e84eadd /include | |
parent | 5236e3b1af983a46fe79a14d353354640c0e89cc (diff) | |
download | chrome-ec-c97cb76b816fc8e02fe3de0652794e85fe38f4c6.tar.gz |
cbi: Introduce CONFIG_CBI_GPIO
For the boards where SKU_ID/BRD_ID comes from the strapping pins on EC,
this new config enables AP to ask EC for those hardware configs using
the CBI host command `EC_CMD_GET_CROS_BOARD_INFO`.
BRANCH=None
BUG=b:186264627
TEST=make buildall -j
TEST=Enabled CONFIG_CBI_GPIO for lazor and manually verified with
`ectool cbi get`.
Change-Id: I7ec9097bab96d2076d9d42db2d003460db000113
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3002452
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/config.h | 7 | ||||
-rw-r--r-- | include/cros_board_info.h | 12 |
2 files changed, 19 insertions, 0 deletions
diff --git a/include/config.h b/include/config.h index 32ba1b71aa..3136dd18fe 100644 --- a/include/config.h +++ b/include/config.h @@ -5167,6 +5167,9 @@ */ #undef CONFIG_CBI_EEPROM +/* Define this to support Cros Board Info from GPIO. */ +#undef CONFIG_CBI_GPIO + /*****************************************************************************/ /* * ISH config defaults @@ -6365,6 +6368,10 @@ "are mutually exclusive. " #endif /* CONFIG_BOARD_VERSION_CBI && CONFIG_BOARD_VERSION_GPIO */ +#if defined(CONFIG_CBI_EEPROM) && defined(CONFIG_CBI_GPIO) +#error "CONFIG_CBI_EEPROM and CONFIG_CBI_GPIO are mutually exclusive." +#endif + #if !defined(CONFIG_ZEPHYR) && !defined(CONFIG_ACCELGYRO_ICM_COMM_SPI) && \ !defined(CONFIG_ACCELGYRO_ICM_COMM_I2C) #ifdef I2C_PORT_ACCEL diff --git a/include/cros_board_info.h b/include/cros_board_info.h index 6f2871916e..ee5a717ee5 100644 --- a/include/cros_board_info.h +++ b/include/cros_board_info.h @@ -12,7 +12,18 @@ #define CBI_VERSION_MAJOR 0 #define CBI_VERSION_MINOR 0 + +#ifdef CONFIG_CBI_GPIO +/* + * if CBI is sourced from GPIO, the CBI cache only needs to accomondate + * BOARD_VERSION and SKU_ID + */ +#define CBI_IMAGE_SIZE (sizeof(struct cbi_header) + (2 * \ + (sizeof(struct cbi_data) + sizeof(uint32_t)))) +#else #define CBI_IMAGE_SIZE 256 +#endif + static const uint8_t cbi_magic[] = { 0x43, 0x42, 0x49 }; /* 'C' 'B' 'I' */ struct cbi_header { @@ -48,6 +59,7 @@ enum cbi_cache_status { enum cbi_storage_type { CBI_STORAGE_TYPE_EEPROM = 0, + CBI_STORAGE_TYPE_GPIO = 1 }; /* |