diff options
author | Aseda Aboagye <aaboagye@google.com> | 2018-03-05 10:01:35 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-03-05 18:34:33 -0800 |
commit | 38c86d9d1eb5388d0bac925387a23a5a793da7b1 (patch) | |
tree | affa49075e3049ec31536ca1b4488b8cbb5f4e6f | |
parent | 3d4db585fa751d0b480050003280df79f9a6f8da (diff) | |
download | chrome-ec-38c86d9d1eb5388d0bac925387a23a5a793da7b1.tar.gz |
meowth: Update board version reporting.
There's a new pin being added for board versions. Additionally, the
endianness is different than what was implemented.
BUG=b:73260349
BRANCH=stabilize-meowth-10444.B
TEST=Flash meowth; verify board version is as expected.
Change-Id: I97fb66f6c6aaf20d0ea4ed5994301490234ab812
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/949054
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
-rw-r--r-- | board/zoombini/board.c | 22 | ||||
-rw-r--r-- | board/zoombini/board.h | 5 | ||||
-rw-r--r-- | board/zoombini/gpio.inc | 1 |
3 files changed, 27 insertions, 1 deletions
diff --git a/board/zoombini/board.c b/board/zoombini/board.c index 8e11ec57dd..d8c8b11323 100644 --- a/board/zoombini/board.c +++ b/board/zoombini/board.c @@ -368,6 +368,28 @@ static void board_chipset_suspend(void) } DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); +#ifdef BOARD_MEOWTH +int board_get_version(void) +{ + static int board_version = -1; + + if (board_version == -1) { + board_version = 0; + /* BD_ID3 is LSb. */ + if (gpio_get_level(GPIO_BOARD_VERSION3)) + board_version |= 0x1; + if (gpio_get_level(GPIO_BOARD_VERSION2)) + board_version |= 0x2; + if (gpio_get_level(GPIO_BOARD_VERSION1)) + board_version |= 0x4; + if (gpio_get_level(GPIO_BOARD_VERSION0)) + board_version |= 0x8; + } + + return board_version; +} +#endif /* BOARD_MEOWTH */ + static void board_init(void) { #ifdef BOARD_ZOOMBINI diff --git a/board/zoombini/board.h b/board/zoombini/board.h index fac8f69db2..8da4f62b94 100644 --- a/board/zoombini/board.h +++ b/board/zoombini/board.h @@ -51,8 +51,8 @@ #define CONFIG_BATTERY_PRESENT_GPIO GPIO_BAT_PRESENT_L #define CONFIG_BOARD_VERSION - #ifdef BOARD_MEOWTH +#define CONFIG_BOARD_SPECIFIC_VERSION #define CONFIG_BUTTON_TRIGGERED_RECOVERY #endif /* defined(BOARD_MEOWTH) */ @@ -251,6 +251,9 @@ enum sensor_id { #define CONFIG_ACCEL_FORCE_MODE_MASK (1 << LID_ALS) +#ifdef BOARD_MEOWTH +int board_get_version(void); +#endif /* defined(BOARD_MEOWTH) */ /* Reset all TCPCs. */ void board_reset_pd_mcu(void); diff --git a/board/zoombini/gpio.inc b/board/zoombini/gpio.inc index 97ed24ab49..4cad17dd02 100644 --- a/board/zoombini/gpio.inc +++ b/board/zoombini/gpio.inc @@ -194,6 +194,7 @@ GPIO(I2C7_SDA, PIN(B, 2), GPIO_INPUT) GPIO(BAT_PRESENT_L, PIN(E, 5), GPIO_INPUT) GPIO(USB_PD_RST_L, PIN(6, 2), GPIO_ODR_HIGH) +GPIO(BOARD_VERSION0, PIN(4, 0), GPIO_INPUT) GPIO(BOARD_VERSION1, PIN(9, 6), GPIO_INPUT) GPIO(BOARD_VERSION2, PIN(9, 3), GPIO_INPUT) GPIO(BOARD_VERSION3, PIN(A, 2), GPIO_INPUT) |