summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@google.com>2019-02-20 13:48:42 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-03-06 06:51:01 -0800
commit50af447ed6ac7efb2776f97d6cb6920776272b29 (patch)
tree618e1a9b55042dfd80ba3e5ff386081775ee13ab
parent18ff0fd2603f8013b9b6798987fef5a8c3e53909 (diff)
downloadchrome-ec-50af447ed6ac7efb2776f97d6cb6920776272b29.tar.gz
cr50: add no ina support board property
Mistral also uses the ina pins as gpios. Add a board property for no ina support. Use that instead of the closed source set board property for the usb_i2c_enable code. BUG=b:124949444 BRANCH=cr50 TEST=flash on mistral. Make sure EN_PP3300_INA_L isn't asserted when ccd is enabled. Change-Id: If06a65bc4a1ef7b374a44fc53d65ea5daed336df Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1480711 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--board/cr50/board.c9
-rw-r--r--board/cr50/board.h6
-rw-r--r--board/cr50/scratch_reg1.h8
-rw-r--r--board/cr50/usb_i2c.c12
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()) {