diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2015-10-01 11:54:09 -0700 |
---|---|---|
committer | ChromeOS bot <3su6n15k.default@developer.gserviceaccount.com> | 2016-01-14 17:38:34 +0000 |
commit | e30048ccd232d7a9f0439101d21cd6962b39ac78 (patch) | |
tree | f909eb6ef31ec4545bed37d82b17dec258172d64 | |
parent | c7144e6bf7cde18e4d0829ef4f35fe4c085539b6 (diff) | |
download | chrome-ec-e30048ccd232d7a9f0439101d21cd6962b39ac78.tar.gz |
CHERRY-PICK: ryu: export board version
Export the board version through the usual EC_CMD_GET_BOARD_VERSION.
Add an option to use the board-specific board_get_version() callback
rather than doing the generic GPIO binary decoding since here the
version is ternary encoded.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=smaug
BUG=none
TEST=execute 'ectool boardversion' on the AP and see the right number.
Original-Change-Id: I89c328573d09be02232756797ba3fdd5979b0292
Reviewed-on: https://chromium-review.googlesource.com/303368
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
(cherry picked from commit 6c620c51e5ab812b4e6751e4c630da2e6bee4b74)
Reviewed-on: https://chromium-review.googlesource.com/303803
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Change-Id: Id87d85c24befa59800931ce90a6b579e03b6a661
Reviewed-on: https://chromium-review.googlesource.com/322050
Reviewed-by: Shawn N <shawnn@chromium.org>
Tested-by: BoChao Jhan <james_chao@asus.com>
Commit-Queue: BoChao Jhan <james_chao@asus.com>
-rw-r--r-- | board/ryu/board.h | 2 | ||||
-rw-r--r-- | common/system.c | 4 | ||||
-rw-r--r-- | include/config.h | 2 | ||||
-rw-r--r-- | include/system.h | 4 |
4 files changed, 12 insertions, 0 deletions
diff --git a/board/ryu/board.h b/board/ryu/board.h index ad3bc17603..fa66564e98 100644 --- a/board/ryu/board.h +++ b/board/ryu/board.h @@ -20,6 +20,8 @@ /* Optional features */ #undef CONFIG_CMD_HASH +#define CONFIG_BOARD_VERSION +#define CONFIG_BOARD_SPECIFIC_VERSION #define CONFIG_CHARGE_MANAGER #define CONFIG_CHARGE_RAMP_HW #define CONFIG_FORCE_CONSOLE_RESUME diff --git a/common/system.c b/common/system.c index de15f62aa3..08de7e3dfa 100644 --- a/common/system.c +++ b/common/system.c @@ -607,6 +607,9 @@ int system_get_board_version(void) int v = 0; #ifdef CONFIG_BOARD_VERSION +#ifdef CONFIG_BOARD_SPECIFIC_VERSION + v = board_get_version(); +#else if (gpio_get_level(GPIO_BOARD_VERSION1)) v |= 0x01; if (gpio_get_level(GPIO_BOARD_VERSION2)) @@ -614,6 +617,7 @@ int system_get_board_version(void) if (gpio_get_level(GPIO_BOARD_VERSION3)) v |= 0x04; #endif +#endif return v; } diff --git a/include/config.h b/include/config.h index 6c76a819c5..7eff5078f8 100644 --- a/include/config.h +++ b/include/config.h @@ -213,6 +213,8 @@ /* EC has GPIOs attached to board version stuffing resistors */ #undef CONFIG_BOARD_VERSION +/* The decoding of the GPIOs defining board version is defined in board code */ +#undef CONFIG_BOARD_SPECIFIC_VERSION /* Permanent LM4 boot configuration */ #undef CONFIG_BOOTCFG_VALUE diff --git a/include/system.h b/include/system.h index 320410b160..b5bd2b093f 100644 --- a/include/system.h +++ b/include/system.h @@ -184,6 +184,10 @@ const char *system_get_version(enum system_image_copy_t copy); */ int system_get_board_version(void); +#ifdef CONFIG_BOARD_SPECIFIC_VERSION +int board_get_version(void); +#endif + /** * Return information about the build including the version, build date and * user/machine which performed the build. |