diff options
author | Wai-Hong Tam <waihong@google.com> | 2018-08-22 13:52:25 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-08-23 17:42:52 -0700 |
commit | 17d8d87c9b5881f4ad3f8f4077f271698e741135 (patch) | |
tree | 377bdb635d4a07c58c20c2fa8a74c1195cff7f7f | |
parent | bb7cee5a6b9a160c9df6a073ce16d5595d1433b4 (diff) | |
download | chrome-ec-17d8d87c9b5881f4ad3f8f4077f271698e741135.tar.gz |
cheza: Configure ANX3429 interrupt as open-drain
This interrupt pin by default is a push-pull. It causes leak to EC VSPI
power during EC watchdog reset. As in our design, we use this interrupt
pin as open-drain. Should configure the register to make it open-drain.
BRANCH=none
BUG=b:112906111
TEST=Flashed the EC image to Cheza rev-2 board. Typed "reboot" command
and then EC reset properly.
Change-Id: Iee5db3cb5b5291778d97dee4fc70369d34344ce7
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1185871
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
-rw-r--r-- | board/cheza/board.c | 2 | ||||
-rw-r--r-- | driver/tcpm/anx74xx.c | 8 | ||||
-rw-r--r-- | driver/tcpm/anx74xx.h | 1 | ||||
-rw-r--r-- | include/usb_pd_tcpm.h | 6 |
4 files changed, 16 insertions, 1 deletions
diff --git a/board/cheza/board.c b/board/cheza/board.c index 89362459cd..12e4855f22 100644 --- a/board/cheza/board.c +++ b/board/cheza/board.c @@ -209,7 +209,7 @@ unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); /* TCPC mux configuration */ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { [USB_PD_PORT_ANX3429] = {I2C_PORT_TCPC0, 0x50, &anx74xx_tcpm_drv, - TCPC_ALERT_ACTIVE_LOW}, + TCPC_ALERT_ACTIVE_LOW, TCPC_ALERT_OPEN_DRAIN}, [USB_PD_PORT_PS8751] = {I2C_PORT_TCPC1, 0x16, &ps8xxx_tcpm_drv, TCPC_ALERT_ACTIVE_LOW}, }; diff --git a/driver/tcpm/anx74xx.c b/driver/tcpm/anx74xx.c index f892f05920..72694c8a43 100644 --- a/driver/tcpm/anx74xx.c +++ b/driver/tcpm/anx74xx.c @@ -1027,6 +1027,14 @@ static int anx74xx_tcpm_init(int port) rv |= tcpc_write(port, ANX74XX_REG_IRQ_EXT_MASK_1, ANX74XX_REG_CLEAR_SET_BITS); + /* Initialize interrupt open-drain */ + rv |= tcpc_read(port, ANX74XX_REG_INTP_VCONN_CTRL, ®); + if (tcpc_config[port].od == TCPC_ALERT_OPEN_DRAIN) + reg |= ANX74XX_REG_R_INTERRUPT_OPEN_DRAIN; + else + reg &= ~ANX74XX_REG_R_INTERRUPT_OPEN_DRAIN; + rv |= tcpc_write(port, ANX74XX_REG_INTP_VCONN_CTRL, reg); + /* Initialize interrupt polarity */ rv |= tcpc_write(port, ANX74XX_REG_IRQ_STATUS, tcpc_config[port].pol == TCPC_ALERT_ACTIVE_LOW ? diff --git a/driver/tcpm/anx74xx.h b/driver/tcpm/anx74xx.h index 95138540b2..9bdaadadcd 100644 --- a/driver/tcpm/anx74xx.h +++ b/driver/tcpm/anx74xx.h @@ -32,6 +32,7 @@ #define ANX74XX_REG_VCONN_DISABLE 0x0f #define ANX74XX_REG_VCONN_1_ENABLE (1 << 4) #define ANX74XX_REG_VCONN_2_ENABLE (1 << 5) +#define ANX74XX_REG_R_INTERRUPT_OPEN_DRAIN (1 << 2) #define ANX74XX_STANDBY_MODE (0) #define ANX74XX_NORMAL_MODE (1) diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h index be1139b0e1..08402dda07 100644 --- a/include/usb_pd_tcpm.h +++ b/include/usb_pd_tcpm.h @@ -263,11 +263,17 @@ enum tcpc_alert_polarity { TCPC_ALERT_ACTIVE_HIGH, }; +enum tcpc_alert_open_drain { + TCPC_ALERT_PUSH_PULL = 0, + TCPC_ALERT_OPEN_DRAIN, +}; + struct tcpc_config_t { int i2c_host_port; int i2c_slave_addr; const struct tcpm_drv *drv; enum tcpc_alert_polarity pol; + enum tcpc_alert_open_drain od; }; /** |