summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-01-21 14:59:48 -0700
committerCommit Bot <commit-bot@chromium.org>2021-02-04 17:58:15 +0000
commit93f6525f1e3ed79cd27156b842593e401009d6b3 (patch)
treeff329f3d98266d30ee9acc23ebe01be2c858535e
parent523b9bbe417451baf62a58f7a23f50d2df597b93 (diff)
downloadchrome-ec-93f6525f1e3ed79cd27156b842593e401009d6b3.tar.gz
zephyr: Add support for BOARD_VERSION
Add Kconfig options for this feature. At present system_get_board_version() is not built for Zephyr. We could split it out but it seems better to wait until we have the existing file brought into the build in toto. BUG=b:178124020 BRANCH=none TEST=make BOARD=volteer -j30 boot zephyr for volteer and see that the options are defined Change-Id: I100c8f3f65db437fbe654e0230e07f59c6e0c7b4 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2644177
-rw-r--r--zephyr/Kconfig53
-rw-r--r--zephyr/projects/kohaku/prj.conf3
-rw-r--r--zephyr/shim/include/config_chip.h15
3 files changed, 71 insertions, 0 deletions
diff --git a/zephyr/Kconfig b/zephyr/Kconfig
index 3051e0831c..06d1fa03db 100644
--- a/zephyr/Kconfig
+++ b/zephyr/Kconfig
@@ -118,6 +118,59 @@ config PLATFORM_EC_BRINGUP
- And more! You can search the codebase for CONFIG_BRINGUP
to see all of the features this flag will toggle.
+config PLATFORM_EC_BOARD_VERSION
+ bool "Support the notion of board version"
+ default y
+ help
+ Enable support for a board version, used to distinguish different
+ revisions of the same base design. Each board goes through a number
+ of development phases on the way to launch. Sometimes different boards
+ have different quirks and this version number can provide a way for
+ the EC to handle several board versions, avoiding the problem of
+ having to flash different images to different board versions.
+
+if PLATFORM_EC_BOARD_VERSION
+
+choice "Version source"
+ prompt "Select the source of the version number"
+ help
+ This allow selection of the source of the board version number
+ information. Several options are available, but BOARD_VERSION_CBI is
+ preferred for new boards, so long as the hardware supports it (i.e.
+ has an EEPROM).
+
+config PLATFORM_EC_BOARD_VERSION_CBI
+ bool "Chromium OS Board Info (CBI)"
+ depends on PLATFORM_EC_CBI
+ help
+ Choose this if the board version comes from Chromium Board Info
+ within the EEPROM. This is the recommended approach and is used on
+ newer boards. The version information is written into the EEPROM as
+ part of the factory process.
+
+config PLATFORM_EC_BOARD_VERSION_GPIO
+ bool "Strapping GPIOs"
+ help
+ Choose this if the board version is encoded with three GPIO signals
+ (GPIO_BOARD_VERSION1, GPIO_BOARD_VERSION2 and GPIO_BOARD_VERSION3)
+ forming the 3-digit binary number. GPIO_BOARD_VERSION1 is the LSB.
+ This provides 8 possible combinations.
+
+ The GPIOs should have external pull-up/pull-down resistors installed
+ at the factory to select the correct value.
+
+config PLATFORM_EC_BOARD_VERSION_CUSTOM
+ bool "Custom board-specific algortihm"
+ help
+ Choose this if none of the standard methods is available and you must
+ perform special logic to find the board version. If this is chosen,
+ then the system code will call board_get_version() to find out the
+ version, so you should implement this function in your board code.
+
+endchoice
+
+endif # PLATFORM_EC_BOARD_VERSION
+
config PLATFORM_EC_CBI
bool "CBI EEPROM support"
depends on PLATFORM_EC_I2C
diff --git a/zephyr/projects/kohaku/prj.conf b/zephyr/projects/kohaku/prj.conf
index ffb372b4e7..c87fd50403 100644
--- a/zephyr/projects/kohaku/prj.conf
+++ b/zephyr/projects/kohaku/prj.conf
@@ -27,3 +27,6 @@ CONFIG_PLATFORM_EC_LID_SWITCH=y
CONFIG_PLATFORM_EC_KEYBOARD=n
CONFIG_CROS_KB_RAW_NPCX=n
+
+# This is not yet supported
+CONFIG_PLATFORM_EC_BOARD_VERSION=n
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index f178447d25..4f73297762 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -914,4 +914,19 @@ enum battery_type {
#define CONFIG_HOSTCMD_RTC
#endif
+#undef CONFIG_BOARD_VERSION_CBI
+#ifdef CONFIG_PLATFORM_EC_BOARD_VERSION_CBI
+#define CONFIG_BOARD_VERSION_CBI
+#endif
+
+#undef CONFIG_BOARD_VERSION_GPIO
+#ifdef CONFIG_PLATFORM_EC_BOARD_VERSION_GPIO
+#define CONFIG_BOARD_VERSION_GPIO
+#endif
+
+#undef CONFIG_BOARD_VERSION_CUSTOM
+#ifdef CONFIG_PLATFORM_EC_BOARD_VERSION_CUSTOM
+#define CONFIG_BOARD_VERSION_CUSTOM
+#endif
+
#endif /* __CROS_EC_CONFIG_CHIP_H */