diff options
author | Philip Chen <philipchen@google.com> | 2018-04-06 18:03:12 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-04-09 01:34:49 -0700 |
commit | eab54036ea8fbd01fd5a7ebdea9b42b0ea08547c (patch) | |
tree | eb5d3d618f969dfd3410df2b25a3f2dbc5d543b6 | |
parent | 45fbc3b938849122d2a7f9d5614e7c5b78714fde (diff) | |
download | chrome-ec-eab54036ea8fbd01fd5a7ebdea9b42b0ea08547c.tar.gz |
nautilus: Support tristate board id strapping pin
With 3 binary strapping pins, we only have 7 available board ids:
000, 001, 010, 011, 100, 101, 110, 111.
Let's make the MSB of board id tristate. So we can have 4 more
board ids to use:
Z00, Z01, Z10, Z11.
BUG=b:77731277
BRANCH=poppy
TEST=build nautilus
Change-Id: I7aebb89437d2ccb9eea6c477155b25d964983232
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1000875
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
-rw-r--r-- | board/nautilus/board.c | 28 | ||||
-rw-r--r-- | board/nautilus/board.h | 1 |
2 files changed, 29 insertions, 0 deletions
diff --git a/board/nautilus/board.c b/board/nautilus/board.c index fcf0c3c7ab..dc8cb0094f 100644 --- a/board/nautilus/board.c +++ b/board/nautilus/board.c @@ -580,6 +580,34 @@ void board_hibernate(void) ; } +int board_get_version(void) +{ + static int ver = -1; + uint8_t id3; + + if (ver != -1) + return ver; + + ver = 0; + + /* First 2 strappings are binary. */ + if (gpio_get_level(GPIO_BOARD_VERSION1)) + ver |= 0x01; + if (gpio_get_level(GPIO_BOARD_VERSION2)) + ver |= 0x02; + + /* + * The 3rd strapping pin is tristate. + * id3 = 2 if Hi-Z, id3 = 1 if high, and id3 = 0 if low. + */ + id3 = gpio_get_ternary(GPIO_BOARD_VERSION3); + ver |= id3 * 0x04; + + CPRINTS("Board ID = %d", ver); + + return ver; +} + /* Lid Sensor mutex */ static struct mutex g_lid_mutex; static struct mutex g_base_mutex; diff --git a/board/nautilus/board.h b/board/nautilus/board.h index 1c4ed8cadd..de63c5a6cb 100644 --- a/board/nautilus/board.h +++ b/board/nautilus/board.h @@ -18,6 +18,7 @@ #define CONFIG_ADC #define CONFIG_BACKLIGHT_LID #define CONFIG_BOARD_VERSION +#define CONFIG_BOARD_SPECIFIC_VERSION #define CONFIG_BOARD_FORCE_RESET_PIN #define CONFIG_CASE_CLOSED_DEBUG_EXTERNAL #define CONFIG_DPTF |