summaryrefslogtreecommitdiff
path: root/driver/tcpm/it83xx.c
diff options
context:
space:
mode:
authorRuibin Chang <ruibin.chang@ite.com.tw>2020-02-03 17:39:01 +0800
committerCommit Bot <commit-bot@chromium.org>2020-02-05 09:50:16 +0000
commitf060100507d0d02a487e873a22c8ddfa8728d916 (patch)
tree34480d8ded9a2433726b4fa16e0314d22528c706 /driver/tcpm/it83xx.c
parent1e544609affc989a0b4bb75d69659d6a86291ec3 (diff)
downloadchrome-ec-f060100507d0d02a487e873a22c8ddfa8728d916.tar.gz
TCPMv1: Don't turn off pd module clock if rx enabled
Plug in type-c adapter in G3 power state. Because the SLEEP_MASK_USB_PD won't be set before we receive the SRC_Cap from SRC in SNK_Discovery state, but at waiting SRC_Cap this period time we will enter deep sleep mode and turns pd module clock off. This will cause TCPC miss the SRC_Cap message from SRC, then our PD_T_SINK_WAIT_CAP timer timeout and tx hard reset. So I add a configuration: SLEEP_MASK_USB_PD is set only by it83xx driver, so that SLEEP_MASK_USB_PD value won't be overwritten by set_state() function in usb_pd_prtocol.c. If one of the port TCPC Rx is enabled, chip will not go to deep sleep, but chip can go to doze mode that pd module clock won't be turned off only mcu core clock off. if all ports are nothing plug-in, the chip can go to deep sleep. BUG=none BRANCH=none TEST=TCPC doesn't miss any message from partner: -in SNK_DISCOVERY and power G3 state on board ampton. -in SRC_DISCOVERY and power S0 state on board it8xxx2_evb. Change-Id: I9639523e2ca180809f0f74f24321d06e7b3a04c2 Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1990935 Tested-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Ruibin Chang <Ruibin.Chang@ite.com.tw>
Diffstat (limited to 'driver/tcpm/it83xx.c')
-rw-r--r--driver/tcpm/it83xx.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/driver/tcpm/it83xx.c b/driver/tcpm/it83xx.c
index 3cad1ef4a7..22a0b0075d 100644
--- a/driver/tcpm/it83xx.c
+++ b/driver/tcpm/it83xx.c
@@ -571,10 +571,11 @@ static int it83xx_tcpm_set_rx_enable(int port, int enable)
USBPD_DISABLE_BMC_PHY(port);
}
- /* If any PD port is connected, then disable deep sleep */
- for (i = 0; i < board_get_usb_pd_port_count(); ++i)
- if (IT83XX_USBPD_GCR(i) | USBPD_REG_MASK_BMC_PHY)
+ /* If any PD port Rx is enabled, then disable deep sleep */
+ for (i = 0; i < board_get_usb_pd_port_count(); ++i) {
+ if (IT83XX_USBPD_GCR(i) & USBPD_REG_MASK_BMC_PHY)
break;
+ }
if (i == board_get_usb_pd_port_count())
enable_sleep(SLEEP_MASK_USB_PD);