diff options
-rw-r--r-- | board/cr50/board.c | 9 | ||||
-rw-r--r-- | board/cr50/board.h | 6 | ||||
-rw-r--r-- | board/cr50/scratch_reg1.h | 8 | ||||
-rw-r--r-- | board/cr50/usb_i2c.c | 12 |
4 files changed, 24 insertions, 11 deletions
diff --git a/board/cr50/board.c b/board/cr50/board.c index 8eb2303ee2..b65526c78c 100644 --- a/board/cr50/board.c +++ b/board/cr50/board.c @@ -169,6 +169,11 @@ int board_uses_closed_loop_reset(void) return !!(board_properties & BOARD_CLOSED_LOOP_RESET); } +int board_has_ina_support(void) +{ + return !(board_properties & BOARD_NO_INA_SUPPORT); +} + /* Get header address of the backup RW copy. */ const struct SignedHeader *get_other_rw_addr(void) { @@ -252,7 +257,7 @@ static struct board_cfg board_cfg_table[] = { { .strap_cfg = 0x0B, .board_properties = BOARD_SLAVE_CONFIG_SPI | - BOARD_USE_PLT_RESET, + BOARD_USE_PLT_RESET | BOARD_NO_INA_SUPPORT, }, /* I2C Variants: DIOA9 = 1M PD, DIOA1 = 1M PD */ /* Reef/Eve: DIOA12 = 5k PD, DIOA6 = 1M PU */ @@ -272,7 +277,7 @@ static struct board_cfg board_cfg_table[] = { .strap_cfg = 0x70, .board_properties = BOARD_SLAVE_CONFIG_I2C | BOARD_USE_PLT_RESET | BOARD_WP_DISABLE_DELAY | - BOARD_CLOSED_SOURCE_SET1, + BOARD_CLOSED_SOURCE_SET1 | BOARD_NO_INA_SUPPORT, }, }; diff --git a/board/cr50/board.h b/board/cr50/board.h index 4878090ab0..33135a0a1d 100644 --- a/board/cr50/board.h +++ b/board/cr50/board.h @@ -300,6 +300,12 @@ int board_uses_closed_source_set1(void); * @return 0 if option is not set, !=0 if option set. */ int board_uses_closed_loop_reset(void); +/** + * The board has all necessary I2C pins connected for INA support. + * + * @return 0 if option is not set, !=0 if option set. + */ +int board_has_ina_support(void); int board_id_is_mismatched(void); /* Allow for deep sleep to be enabled on AP shutdown */ int board_deep_sleep_allowed(void); diff --git a/board/cr50/scratch_reg1.h b/board/cr50/scratch_reg1.h index 36eb266712..8be7783afa 100644 --- a/board/cr50/scratch_reg1.h +++ b/board/cr50/scratch_reg1.h @@ -75,6 +75,12 @@ #define BOARD_CLOSED_LOOP_RESET (1 << 18) /* + * The board uses INA pins as GPIOs, so it can't support reading inas using usb + * i2c. + */ +#define BOARD_NO_INA_SUPPORT (1 << 19) + +/* * Macro to capture all properties related to board strapping pins. This must be * updated if additional strap related properties are added. */ @@ -82,6 +88,6 @@ | BOARD_NEEDS_SYS_RST_PULL_UP | BOARD_USE_PLT_RESET | \ BOARD_DEEP_SLEEP_DISABLED | BOARD_DETECT_AP_WITH_UART | \ BOARD_WP_DISABLE_DELAY | BOARD_CLOSED_SOURCE_SET1 | \ - BOARD_CLOSED_LOOP_RESET) + BOARD_CLOSED_LOOP_RESET | BOARD_NO_INA_SUPPORT) #endif /* ! __EC_BOARD_CR50_SCRATCH_REG1_H */ diff --git a/board/cr50/usb_i2c.c b/board/cr50/usb_i2c.c index b21c555858..0bc7408329 100644 --- a/board/cr50/usb_i2c.c +++ b/board/cr50/usb_i2c.c @@ -19,10 +19,8 @@ int usb_i2c_board_is_enabled(void) { - /* - * Closed source set1 board options use the INA pins as GPIOs - */ - if (board_uses_closed_source_set1()) + /* board options use the INA pins as GPIOs */ + if (!board_has_ina_support()) return 0; /* @@ -85,10 +83,8 @@ void usb_i2c_board_disable(void) int usb_i2c_board_enable(void) { - /* - * Closed source set1 board options use the INA pins as GPIOs - */ - if (board_uses_closed_source_set1()) + /* board options use the INA pins as GPIOs */ + if (!board_has_ina_support()) return EC_SUCCESS; if (servo_is_connected()) { |