diff options
author | Ruibin Chang <Ruibin.Chang@ite.com.tw> | 2021-09-23 18:26:38 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-09-24 08:33:32 +0000 |
commit | 302db0bc69efac399632462083b2fe34a46da7be (patch) | |
tree | 3cac45a5a514147e6400b664a40c42fff67234d8 | |
parent | a146742ba762718659d6d71d831caa7b2d4a2396 (diff) | |
download | chrome-ec-302db0bc69efac399632462083b2fe34a46da7be.tar.gz |
driver/tcpm/it8xxx2: turn both cc pins off when disable Vconn
If the pd port has previous connection and supplies
Vconn, then RO jumping to RW reset the system,
we never know which cc is the previous Vconn pin,
so we always turn both cc pins off when disable
Vconn power switch.
This change is leveraged from it83xx (CL:3178341),
although Vconn is controlled by ppc on asurada series
and asurada series don't happen the bug, but we still
need this change for the future that if there is a
project control Vconn by GPIO.
BUG=none
BRANCH=none
TEST=make board hayato
Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
Change-Id: I66e7961d5ba412c18948a433103c17b79e7c5e08
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3180703
Reviewed-by: Eric Yilun Lin <yllin@google.com>
Commit-Queue: Eric Yilun Lin <yllin@google.com>
-rw-r--r-- | driver/tcpm/it8xxx2.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/driver/tcpm/it8xxx2.c b/driver/tcpm/it8xxx2.c index e3227a3ed8..dd5d1231fc 100644 --- a/driver/tcpm/it8xxx2.c +++ b/driver/tcpm/it8xxx2.c @@ -527,12 +527,21 @@ static int it8xxx2_tcpm_set_vconn(int port, int enable) /* Enable tcpc receive SOP' and SOP'' packet */ it8xxx2_tcpm_decode_sop_prime_enable(port, true); - } - /* Turn on/off vconn power switch. */ - board_pd_vconn_ctrl(port, - USBPD_GET_PULL_CC_SELECTION(port) ? - USBPD_CC_PIN_2 : USBPD_CC_PIN_1, enable); - if (!enable) { + /* Turn on Vconn power switch. */ + board_pd_vconn_ctrl(port, + USBPD_GET_PULL_CC_SELECTION(port) ? + USBPD_CC_PIN_2 : USBPD_CC_PIN_1, + enable); + } else { + /* + * If the pd port has previous connection and supplies + * Vconn, then RO jumping to RW reset the system, + * we never know which cc is the previous Vconn pin, + * so we always turn both cc pins off when disable + * Vconn power switch. + */ + board_pd_vconn_ctrl(port, USBPD_CC_PIN_1, enable); + board_pd_vconn_ctrl(port, USBPD_CC_PIN_2, enable); if (IS_ENABLED(CONFIG_USB_PD_DECODE_SOP)) /* Disable tcpc receive SOP' and SOP'' packet */ it8xxx2_tcpm_decode_sop_prime_enable(port, @@ -792,7 +801,7 @@ static void it8xxx2_init(enum usbpd_port port, int role) /* Set default power role and assert Rp/Rd */ it8xxx2_set_power_role(port, role); /* Disable vconn: connect cc analog module, disable cc 5v tolerant */ - it8xxx2_enable_vconn(port, 0); + it8xxx2_tcpm_set_vconn(port, 0); /* Enable tx done and hard reset detect interrupt */ IT83XX_USBPD_IMR(port) &= ~(USBPD_REG_MASK_MSG_TX_DONE | USBPD_REG_MASK_HARD_RESET_DETECT); |