summaryrefslogtreecommitdiff
path: root/common/usb_pd_protocol.c
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@google.com>2017-07-28 17:13:26 -0700
committerCommit Bot <commit-bot@chromium.org>2020-08-31 01:53:09 +0000
commitbd018841f6f2856c949dcf9b6dd462872cd18d7f (patch)
tree245d6874e54040b49d7cd3e166528f3939b513e9 /common/usb_pd_protocol.c
parentbd67306369e6141fefaf8d8a6ea814a03d02f88d (diff)
downloadchrome-ec-bd018841f6f2856c949dcf9b6dd462872cd18d7f.tar.gz
eve: 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. With this change I never see an EC reset when recovering from a disconnected battery state. BUG=b:63957122 BRANCH=eve TEST=manual testing on Eve with 50+ battery disconnect and battery cutoff cycles to ensure it never triggers an unexpected EC reset. Change-Id: Ie1604e82916ea203a32cbdde98f6697e344bba4c Signed-off-by: Duncan Laurie <dlaurie@google.com> Reviewed-on: https://chromium-review.googlesource.com/592716 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2320248 Commit-Queue: Patryk Duda <pdk@semihalf.com> Tested-by: Patryk Duda <pdk@semihalf.com> Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'common/usb_pd_protocol.c')
-rw-r--r--common/usb_pd_protocol.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 71343f1334..63c300b9ca 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -2955,6 +2955,11 @@ void pd_task(void *u)
set_vconn(port, 0);
#endif
+#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 = reset_device_and_notify(port);
invalidate_last_message_id(port);