From 2ddd0700191c795adf0853866978a5ddd2a88327 Mon Sep 17 00:00:00 2001 From: YH Lin Date: Tue, 12 Mar 2019 20:58:23 -0700 Subject: flapjack: get board version from CBI With CBI in place there's no need to get the board version via ADC strapping. BUG=b:123676982 BRANCH=none TEST=Provision CBI board version and check the board version after reboot. Change-Id: If1e5185d9d5c72b9244516141bfa68ffc1f9ad14 Signed-off-by: YH Lin Reviewed-on: https://chromium-review.googlesource.com/1519811 Reviewed-by: Daisuke Nojiri --- board/flapjack/board.c | 73 -------------------------------------------------- board/flapjack/board.h | 2 -- 2 files changed, 75 deletions(-) (limited to 'board/flapjack') diff --git a/board/flapjack/board.c b/board/flapjack/board.c index 2077ff6b31..bcf1dbe98e 100644 --- a/board/flapjack/board.c +++ b/board/flapjack/board.c @@ -285,81 +285,8 @@ void board_config_pre_init(void) (3 << 20) | (3 << 24); } -enum kukui_board_version { - BOARD_VERSION_UNKNOWN = -1, - BOARD_VERSION_REV0 = 0, - BOARD_VERSION_REV1 = 1, - BOARD_VERSION_REV2 = 2, - BOARD_VERSION_REV3 = 3, - BOARD_VERSION_REV4 = 4, - BOARD_VERSION_REV5 = 5, - BOARD_VERSION_REV6 = 6, - BOARD_VERSION_REV7 = 7, - BOARD_VERSION_REV8 = 8, - BOARD_VERSION_REV9 = 9, - BOARD_VERSION_REV10 = 10, - BOARD_VERSION_REV11 = 11, - BOARD_VERSION_REV12 = 12, - BOARD_VERSION_REV13 = 13, - BOARD_VERSION_REV14 = 14, - BOARD_VERSION_REV15 = 15, - BOARD_VERSION_COUNT, -}; - -struct { - enum kukui_board_version version; - int expect_mv; -} const kukui_boards[] = { - { BOARD_VERSION_REV0, 109 }, /* 51.1K , 2.2K(gru 3.3K) ohm */ - { BOARD_VERSION_REV1, 211 }, /* 51.1k , 6.8K ohm */ - { BOARD_VERSION_REV2, 319 }, /* 51.1K , 11K ohm */ - { BOARD_VERSION_REV3, 427 }, /* 56K , 17.4K ohm */ - { BOARD_VERSION_REV4, 542 }, /* 51.1K , 22K ohm */ - { BOARD_VERSION_REV5, 666 }, /* 51.1K , 30K ohm */ - { BOARD_VERSION_REV6, 781 }, /* 51.1K , 39.2K ohm */ - { BOARD_VERSION_REV7, 900 }, /* 56K , 56K ohm */ - { BOARD_VERSION_REV8, 1023 }, /* 47K , 61.9K ohm */ - { BOARD_VERSION_REV9, 1137 }, /* 47K , 80.6K ohm */ - { BOARD_VERSION_REV10, 1240 }, /* 56K , 124K ohm */ - { BOARD_VERSION_REV11, 1343 }, /* 51.1K , 150K ohm */ - { BOARD_VERSION_REV12, 1457 }, /* 47K , 200K ohm */ - { BOARD_VERSION_REV13, 1576 }, /* 47K , 330K ohm */ - { BOARD_VERSION_REV14, 1684 }, /* 47K , 680K ohm */ - { BOARD_VERSION_REV15, 1800 }, /* 56K , NC */ -}; -BUILD_ASSERT(ARRAY_SIZE(kukui_boards) == BOARD_VERSION_COUNT); - #define THRESHOLD_MV 56 /* Simply assume 1800/16/2 */ -int board_get_version(void) -{ - static int version = BOARD_VERSION_UNKNOWN; - int mv; - int i; - - if (version != BOARD_VERSION_UNKNOWN) - return version; - - gpio_set_level(GPIO_EC_BOARD_ID_EN_L, 0); - /* Wait to allow cap charge */ - msleep(10); - mv = adc_read_channel(ADC_BOARD_ID); - - if (mv == ADC_READ_ERROR) - mv = adc_read_channel(ADC_BOARD_ID); - - gpio_set_level(GPIO_EC_BOARD_ID_EN_L, 1); - - for (i = 0; i < BOARD_VERSION_COUNT; ++i) { - if (mv < kukui_boards[i].expect_mv + THRESHOLD_MV) { - version = kukui_boards[i].version; - break; - } - } - - return version; -} - /* Motion sensors */ /* Mutexes */ #ifdef SECTION_IS_RW diff --git a/board/flapjack/board.h b/board/flapjack/board.h index acdce43d54..fc40c4b399 100644 --- a/board/flapjack/board.h +++ b/board/flapjack/board.h @@ -46,7 +46,6 @@ /* Optional features */ #define CONFIG_BOARD_PRE_INIT -#define CONFIG_BOARD_VERSION_CUSTOM #define CONFIG_BUTTON_TRIGGERED_RECOVERY #define CONFIG_CHARGER_ILIM_PIN_DISABLED #define CONFIG_FORCE_CONSOLE_RESUME @@ -253,7 +252,6 @@ void emmc_cmd_interrupt(enum gpio_signal signal); #endif void board_reset_pd_mcu(void); -int board_get_version(void); #endif /* !__ASSEMBLER__ */ -- cgit v1.2.1