summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2019-03-26 15:27:12 -0600
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2019-04-16 15:34:09 +0000
commit2a245a3e1f301dfeca724a2e6132109ecfdd4783 (patch)
treea4de769b6c57beef28b225a0bbef1cf58a210097
parent290f16a3a0361e7e42938b4f17b63f57924d9c21 (diff)
downloadchrome-ec-2a245a3e1f301dfeca724a2e6132109ecfdd4783.tar.gz
USB PD: Suspend ports when resetting TCPCs during cold reboot
Currently, when EC cold reboots run, they reset the board's TCPC chips, but do not communicate this fact to the PD tasks. This may lead to the PD tasks reading register values with are incorrect or not yet initialized. Before resetting the TCPCs, put each port into suspend to prevent this. BUG=b:129092057 BRANCH=octopus TEST=Ran several EC resets as well as EC cold reboots with source and sink partners, verified we successfully maintained connection with the port partner without hitting contract disagreements Change-Id: I6d509c4c6b22400b6250e2740e7927be92373802 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1538751 Reviewed-by: Jett Rink <jettrink@chromium.org> (cherry picked from commit 28d6be82e967db846cbd2329a9dff48e55770cb6) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1568597
-rw-r--r--common/system.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/common/system.c b/common/system.c
index 6cd5702c30..d1ce75616d 100644
--- a/common/system.c
+++ b/common/system.c
@@ -937,7 +937,15 @@ static int handle_pending_reboot(enum ec_reboot_cmd cmd)
return system_run_image_copy(system_get_active_copy());
case EC_REBOOT_COLD:
#ifdef HAS_TASK_PDCMD
- /* Reboot the PD chip as well */
+ /*
+ * Reboot the PD chip(s) as well, but first suspend the ports
+ * if this board has PD tasks running so they don't query the
+ * TCPCs while they reset.
+ */
+#ifdef HAS_TASK_PD_C0
+ for (int port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++)
+ pd_set_suspend(port, 1);
+#endif
board_reset_pd_mcu();
#endif