summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2017-08-22 10:38:15 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-08-23 21:17:22 -0700
commit0aa4bfe9a3d906a210e27ee40c22e30b3658533a (patch)
tree2a608753818d97167b3dac5fa35a76ff16d587b6
parent6d286d157ca32f8c6a39e463ea26b01715b10750 (diff)
downloadchrome-ec-0aa4bfe9a3d906a210e27ee40c22e30b3658533a.tar.gz
tcpc: Move board level TCPC init to happen in pd_task init
When the board level TCPC run as an init hook it will frequently lead to an EC reset when we are trying to recovery a disconnected battery, potentially even a reboot loop with the most unlucky timing. If we instead call it from the pd_task before tcpc_init is called then the board init hook can stall the pd_task init until the battery is out of disconnect mode, or giving up after 2 seconds in case the battery never seems to recover. This accomplishes two goals: ensure the PD chips are not reset until the battery is out of disconnect and delay start of the pd_task (and PD negotiation) until the battery is out of disconnect state. This change was done in the Eve FW branch. Pulling it into TOT so it can be used for other boards that have the same issue. https://chromium-review.googlesource.com/c/592716. The change to wait for the battery to be out of disconnect mode is in the board specific board_tcpc_init() function and so will be in subsequent board specific CLs. BUG=b:63957122 BRANCH=none TEST=manual Verify that 'make buildall' is successful. Change-Id: I14c3dbb89cdc05fa9231fbe9db2e1de19fa941b6 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/627114 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--common/usb_pd_protocol.c5
-rw-r--r--include/config.h3
2 files changed, 8 insertions, 0 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 286a48aa87..4c882eae0c 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -1675,6 +1675,11 @@ void pd_task(void *u)
/* Ensure the power supply is in the default state */
pd_power_supply_reset(port);
+#ifdef CONFIG_USB_PD_TCPC_BOARD_INIT
+ /* Board specific TCPC init */
+ board_tcpc_init();
+#endif
+
/* Initialize TCPM driver and wait for TCPC to be ready */
res = tcpm_init(port);
diff --git a/include/config.h b/include/config.h
index 985cf91079..200dce82de 100644
--- a/include/config.h
+++ b/include/config.h
@@ -2521,6 +2521,9 @@
/* Use TCPC module (type-C port controller) */
#undef CONFIG_USB_PD_TCPC
+/* Board provides specific TCPC init function */
+#undef CONFIG_USB_PD_TCPC_BOARD_INIT
+
/* Enable TCPC to enter low power mode */
#undef CONFIG_USB_PD_TCPC_LOW_POWER