summaryrefslogtreecommitdiff
path: root/common/system.c
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2020-06-30 12:44:57 -0600
committerCommit Bot <commit-bot@chromium.org>2020-07-09 14:19:13 +0000
commitbd4116995dc02b644d8ea7da840a79b69c94adac (patch)
treebfbae00b982f5acc96e123d7d75b875e672cdcf5 /common/system.c
parent5330a08fb0ccd325e02472722bbb355f2b56508d (diff)
downloadchrome-ec-bd4116995dc02b644d8ea7da840a79b69c94adac.tar.gz
usbc: ensure we are suspending USB-C ports on shutdown
After CL:2208221, the check for the PD_CMD task no longer trigger, so we end up not calling suspend on our TCPC ports. We want to continue to suspend, which will apply CC open in TCPMv2 for a cooperative shutdown Also, correct override keyword usage for board_get_usb_pd_port_count since I had to touch those definitions to make IS_ENABLE work BRANCH=none BUG=b:160243292 TEST=See that software sync reboot, applies CC open (and browns out system) Change-Id: I00bf08c7d347441d77834e2c5122a09ca2316280 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2276318 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'common/system.c')
-rw-r--r--common/system.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/common/system.c b/common/system.c
index 6a26161f67..333ca2d26e 100644
--- a/common/system.c
+++ b/common/system.c
@@ -872,23 +872,31 @@ static int handle_pending_reboot(enum ec_reboot_cmd cmd)
case EC_REBOOT_JUMP_RW:
return system_run_image_copy(system_get_active_copy());
case EC_REBOOT_COLD:
-#ifdef HAS_TASK_PDCMD
/*
* 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
- {
+ if (IS_ENABLED(HAS_TASK_PD_C0)) {
int port;
for (port = 0; port < board_get_usb_pd_port_count();
port++)
pd_set_suspend(port, 1);
+
+ /*
+ * Give enough time to apply CC Open and brown out if
+ * we are running with out a battery.
+ */
+ msleep(20 * MSEC);
}
-#endif
- board_reset_pd_mcu();
-#endif
+
+ /* Reset external PD chips. */
+ if (IS_ENABLED(HAS_TASK_PDCMD) ||
+ IS_ENABLED(HAS_TASK_PD_INT_C0) ||
+ IS_ENABLED(HAS_TASK_PD_INT_C1) ||
+ IS_ENABLED(HAS_TASK_PD_INT_C2))
+ board_reset_pd_mcu();
cflush();
system_reset(SYSTEM_RESET_HARD);