summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2015-10-01 11:54:09 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-10-05 12:30:20 -0700
commit5d82dbc4910fcbcfceb8911864790c146a461684 (patch)
tree368a365096808c085d4c58218330e843f8f1f21e
parente498de6ad69e94d4de4bf3d3c69d0568047f65be (diff)
downloadchrome-ec-5d82dbc4910fcbcfceb8911864790c146a461684.tar.gz
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. 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>
-rw-r--r--board/ryu/board.h2
-rw-r--r--common/system.c4
-rw-r--r--include/config.h2
3 files changed, 8 insertions, 0 deletions
diff --git a/board/ryu/board.h b/board/ryu/board.h
index cad44bc3dd..f765d1258c 100644
--- a/board/ryu/board.h
+++ b/board/ryu/board.h
@@ -21,6 +21,8 @@
/* Optional features */
#undef CONFIG_CMD_HASH
+#define CONFIG_BOARD_VERSION
+#define CONFIG_BOARD_SPECIFIC_VERSION
#define CONFIG_CHARGE_MANAGER
#define CONFIG_CHARGE_MANAGER_DRP_CHARGING
#define CONFIG_CHARGE_MANAGER_EXTERNAL_POWER_LIMIT
diff --git a/common/system.c b/common/system.c
index fa79b909a1..4e06d7abc2 100644
--- a/common/system.c
+++ b/common/system.c
@@ -597,6 +597,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))
@@ -604,6 +607,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 9f0a10faf1..7dfd2779e1 100644
--- a/include/config.h
+++ b/include/config.h
@@ -251,6 +251,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