summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMadhusudanarao Amara <madhusudanarao.amara@intel.corp-partner.google.com>2021-03-25 23:27:25 +0530
committerCommit Bot <commit-bot@chromium.org>2021-04-01 17:59:56 +0000
commit9a34228e865a6567350e416f1877e885ed17d27b (patch)
tree34803890671af08b2d460f461b27cd075f01973d
parent83da34e9475b7983c820002fb9afe042066df93e (diff)
downloadchrome-ec-9a34228e865a6567350e416f1877e885ed17d27b.tar.gz
TCPMv2: Enter safe mode before entering TBT/USB4 mode for the cable.
Before sending Enter Mode/Enter USB to the cable plug (SOP' and SOP'') the usb mux and retimer should be configured to safe mode BUG=b:183781477 BRANCH=None TEST=TBT/USB4 device enumerates fine on coldboot, warmboot and hotplug with MBR and passive cables. Change-Id: Ia8fe95d9183f7febdb118bca51ea9a137870832c Signed-off-by: Madhusudanarao Amara <madhusudanarao.amara@intel.corp-partner.google.com> Signed-off-by: Ayushee Shah <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2786883 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2799920 Tested-by: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r--common/usb_pd_alt_mode_dfp.c9
-rw-r--r--common/usbc/usb_mode.c15
2 files changed, 15 insertions, 9 deletions
diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c
index c671616da6..700af4ea25 100644
--- a/common/usb_pd_alt_mode_dfp.c
+++ b/common/usb_pd_alt_mode_dfp.c
@@ -962,13 +962,18 @@ int enter_tbt_compat_mode(int port, enum tcpm_transmit_type sop,
VDO_CMDT(CMDT_INIT) |
VDO_SVDM_VERS(pd_get_vdo_ver(port, enter_mode_sop));
+ /*
+ * Enter safe mode before sending Enter mode SOP/SOP'/SOP''
+ * Ref: Tiger Lake Platform PD Controller Interface Requirements for
+ * Integrated USB C, section A.1.2 TBT as DFP.
+ */
+ usb_mux_set_safe_mode(port);
+
/* For TBT3 Cable Enter Mode Command, number of Objects is 1 */
if ((sop == TCPC_TX_SOP_PRIME) ||
(sop == TCPC_TX_SOP_PRIME_PRIME))
return 1;
- usb_mux_set_safe_mode(port);
-
dev_mode_resp.raw_value = pd_get_tbt_mode_vdo(port, TCPC_TX_SOP);
cable_mode_resp.raw_value =
pd_get_tbt_mode_vdo(port, TCPC_TX_SOP_PRIME);
diff --git a/common/usbc/usb_mode.c b/common/usbc/usb_mode.c
index 6f8d4a7fe9..54034c8f19 100644
--- a/common/usbc/usb_mode.c
+++ b/common/usbc/usb_mode.c
@@ -269,14 +269,20 @@ uint32_t enter_usb_setup_next_msg(int port, enum tcpm_transmit_type *type)
switch (usb4_state[port]) {
case USB4_START:
disc_sop_prime = pd_get_am_discovery(port, TCPC_TX_SOP_PRIME);
+ /*
+ * Ref: Tiger Lake Platform PD Controller Interface Requirements
+ * for Integrated USBC, section A.2.2: USB4 as DFP.
+ * Enter safe mode before sending Enter USB SOP/SOP'/SOP''
+ * TODO (b/156749387): Remove once data reset feature is in
+ * place.
+ */
+ usb_mux_set_safe_mode(port);
if (pd_get_vdo_ver(port, TCPC_TX_SOP_PRIME) < VDM_VER20 ||
disc_sop_prime->identity.product_t1.a_rev30.vdo_ver <
VDO_VERSION_1_3 ||
get_usb_pd_cable_type(port) == IDH_PTYPE_PCABLE) {
usb4_state[port] = USB4_ENTER_SOP;
- /* Ref: TBT4 PD Discover Flow */
- usb_mux_set_safe_mode(port);
} else {
usb4_state[port] = USB4_ENTER_SOP_PRIME;
*type = TCPC_TX_SOP_PRIME;
@@ -290,11 +296,6 @@ uint32_t enter_usb_setup_next_msg(int port, enum tcpm_transmit_type *type)
break;
case USB4_ENTER_SOP:
*type = TCPC_TX_SOP;
- /*
- * Set the USB mux to safe state to avoid damaging the mux pins,
- * since they are being re-purposed for USB4.
- */
- usb_mux_set_safe_mode(port);
break;
case USB4_ACTIVE:
return -1;