diff options
author | Ayushee Shah <ayushee.shah@intel.com> | 2021-02-25 17:17:47 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-16 21:32:46 +0000 |
commit | 657c9f952da217d18e55fb139e5e59f3cd58c670 (patch) | |
tree | e84eaf8fd87505d6ba347061a6f1d25986adfd4f | |
parent | d49b7129f4cc10446cb8a4c6eebb2f87027d508a (diff) | |
download | chrome-ec-657c9f952da217d18e55fb139e5e59f3cd58c670.tar.gz |
USB4: Reset mux, retimer and USB4 SM on exit mode request
When exiting out of USB4 mode, reset the USB4 state machine and
set the retimer and the mux to disconnect state followed by
USB mode.
BUG=b:181286325
BRANCH=None
TEST=Able to re-enter into USB4 mode on warm reboot
Signed-off-by: Ayushee Shah <ayushee.shah@intel.com>
Change-Id: Icdc520aa221a9276466fafb885a6d86e893b7284
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2727628
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
-rw-r--r-- | common/usbc/usb_mode.c | 7 | ||||
-rw-r--r-- | common/usbc/usb_pd_dpm.c | 5 | ||||
-rw-r--r-- | include/usb_mode.h | 8 |
3 files changed, 20 insertions, 0 deletions
diff --git a/common/usbc/usb_mode.c b/common/usbc/usb_mode.c index bbdad46a05..6f8d4a7fe9 100644 --- a/common/usbc/usb_mode.c +++ b/common/usbc/usb_mode.c @@ -117,6 +117,13 @@ bool enter_usb_entry_is_done(int port) usb4_state[port] == USB4_INACTIVE; } +void usb4_exit_mode_request(int port) +{ + usb4_state[port] = USB4_START; + usb_mux_set_safe_mode_exit(port); + set_usb_mux_with_current_data_role(port); +} + void enter_usb_init(int port) { usb4_state[port] = USB4_START; diff --git a/common/usbc/usb_pd_dpm.c b/common/usbc/usb_pd_dpm.c index 7e7c002721..10748e67d5 100644 --- a/common/usbc/usb_pd_dpm.c +++ b/common/usbc/usb_pd_dpm.c @@ -355,6 +355,11 @@ static void dpm_attempt_mode_exit(int port) int vdo_count = 0; enum tcpm_transmit_type tx_type = TCPC_TX_SOP; + if (IS_ENABLED(CONFIG_USB_PD_USB4) && + enter_usb_entry_is_done(port)) { + CPRINTS("C%d: USB4 teardown", port); + usb4_exit_mode_request(port); + } if (IS_ENABLED(CONFIG_USB_PD_TBT_COMPAT_MODE) && tbt_is_active(port)) { /* diff --git a/include/usb_mode.h b/include/usb_mode.h index 001aadc38a..98157626aa 100644 --- a/include/usb_mode.h +++ b/include/usb_mode.h @@ -33,6 +33,14 @@ void enter_usb_init(int port); bool enter_usb_entry_is_done(int port); /* + * Requests the retimer and mux to exit USB4 mode and re-initalizes the USB4 + * state machine. + * + * @param port USB-C port number + */ +void usb4_exit_mode_request(int port); + +/* * Resets USB4 state and mux state. * * @param port USB-C port number |