summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/usb_pd_policy.c405
-rw-r--r--common/usb_pd_protocol.c152
-rw-r--r--include/usb_pd.h1
3 files changed, 5 insertions, 553 deletions
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c
index dbea31bf6d..d39aaf4172 100644
--- a/common/usb_pd_policy.c
+++ b/common/usb_pd_policy.c
@@ -154,24 +154,6 @@ void reset_pd_cable(int port)
cable[port].last_sop_p_p_msg_id = INVALID_MSG_ID_COUNTER;
}
-bool should_enter_usb4_mode(int port)
-{
- return IS_ENABLED(CONFIG_USB_PD_USB4) &&
- cable[port].flags & CABLE_FLAGS_ENTER_USB_MODE;
-}
-
-void enable_enter_usb4_mode(int port)
-{
- if (IS_ENABLED(CONFIG_USB_PD_USB4))
- cable[port].flags |= CABLE_FLAGS_ENTER_USB_MODE;
-}
-
-void disable_enter_usb4_mode(int port)
-{
- if (IS_ENABLED(CONFIG_USB_PD_USB4))
- cable[port].flags &= ~CABLE_FLAGS_ENTER_USB_MODE;
-}
-
#ifdef CONFIG_USB_PD_ALT_MODE
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
@@ -181,168 +163,6 @@ static struct pd_discovery discovery[CONFIG_USB_PD_PORT_MAX_COUNT]
static struct partner_active_modes partner_amodes[CONFIG_USB_PD_PORT_MAX_COUNT]
[AMODE_TYPE_COUNT];
-static bool is_vdo_present(int cnt, int index)
-{
- return cnt > index;
-}
-
-static bool is_modal(int port, int cnt, const uint32_t *payload)
-{
- return is_vdo_present(cnt, VDO_INDEX_IDH) &&
- PD_IDH_IS_MODAL(payload[VDO_INDEX_IDH]);
-}
-
-static bool is_tbt_compat_mode(int port, int cnt, const uint32_t *payload)
-{
- /*
- * Ref: USB Type-C cable and connector specification
- * F.2.5 TBT3 Device Discover Mode Responses
- */
- return is_vdo_present(cnt, VDO_INDEX_IDH) &&
- PD_VDO_RESP_MODE_INTEL_TBT(payload[VDO_INDEX_IDH]);
-}
-
-static bool cable_supports_tbt_speed(int port)
-{
- enum tbt_compat_cable_speed tbt_cable_speed = get_tbt_cable_speed(port);
-
- return (tbt_cable_speed == TBT_SS_TBT_GEN3 ||
- tbt_cable_speed == TBT_SS_U32_GEN1_GEN2);
-}
-
-static bool is_tbt_compat_enabled(int port)
-{
- return (IS_ENABLED(CONFIG_USB_PD_TBT_COMPAT_MODE) &&
- (cable[port].flags & CABLE_FLAGS_TBT_COMPAT_ENABLE));
-}
-
-static void enable_tbt_compat_mode(int port)
-{
- if (IS_ENABLED(CONFIG_USB_PD_TBT_COMPAT_MODE))
- cable[port].flags |= CABLE_FLAGS_TBT_COMPAT_ENABLE;
-}
-
-static inline void disable_tbt_compat_mode(int port)
-{
- if (IS_ENABLED(CONFIG_USB_PD_TBT_COMPAT_MODE))
- cable[port].flags &= ~CABLE_FLAGS_TBT_COMPAT_ENABLE;
-}
-
-static inline void limit_tbt_cable_speed(int port)
-{
- /* Cable flags are cleared when cable reset is called */
- cable[port].flags |= CABLE_FLAGS_TBT_COMPAT_LIMIT_SPEED;
-}
-
-static inline bool is_limit_tbt_cable_speed(int port)
-{
- return !!(cable[port].flags & CABLE_FLAGS_TBT_COMPAT_LIMIT_SPEED);
-}
-
-static bool is_intel_svid(int port, enum tcpci_msg_type type)
-{
- int i;
-
- for (i = 0; i < discovery[port][type].svid_cnt; i++) {
- if (pd_get_svid(port, i, type) == USB_VID_INTEL)
- return true;
- }
-
- return false;
-}
-
-static inline bool is_usb4_mode_enabled(int port)
-{
- return (IS_ENABLED(CONFIG_USB_PD_USB4) &&
- (cable[port].flags & CABLE_FLAGS_USB4_CAPABLE));
-}
-
-static inline void enable_usb4_mode(int port)
-{
- if (IS_ENABLED(CONFIG_USB_PD_USB4))
- cable[port].flags |= CABLE_FLAGS_USB4_CAPABLE;
-}
-
-static inline void disable_usb4_mode(int port)
-{
- if (IS_ENABLED(CONFIG_USB_PD_USB4))
- cable[port].flags &= ~CABLE_FLAGS_USB4_CAPABLE;
-}
-
-/*
- * Ref: USB Type-C Cable and Connector Specification
- * Figure 5-1 USB4 Discovery and Entry Flow Model.
- *
- * Note: USB Type-C Cable and Connector Specification
- * doesn't include details for Revision 2 cables.
- *
- * Passive Cable
- * |
- * -----------------------------------
- * | |
- * Revision 2 Revision 3
- * USB Signalling USB Signalling
- * | |
- * ------------------ -------------------------
- * | | | | | | |
- * USB2.0 USB3.1 USB3.1 USB3.2 USB4 USB3.2 USB2
- * | Gen1 Gen1 Gen2 Gen2 Gen3 Gen1 |
- * | | | | | | Exit
- * -------- ------------ -------- USB4
- * | | | Discovery.
- * Exit Is DFP Gen3 Capable? Enter USB4
- * USB4 | with respective
- * Discovery. --- No ---|--- Yes --- cable speed.
- * | |
- * Enter USB4 with Is Cable TBT3
- * respective cable |
- * speed. --- No ---|--- Yes ---
- * | |
- * Enter USB4 with Enter USB4 with
- * TBT Gen2 passive TBT Gen3 passive
- * cable. cable.
- *
- */
-static bool is_cable_ready_to_enter_usb4(int port, int cnt)
-{
- /* TODO: USB4 enter mode for Active cables */
- struct pd_discovery *disc = &discovery[port][TCPCI_MSG_SOP_PRIME];
- if (IS_ENABLED(CONFIG_USB_PD_USB4) &&
- (get_usb_pd_cable_type(port) == IDH_PTYPE_PCABLE) &&
- is_vdo_present(cnt, VDO_INDEX_PTYPE_CABLE1)) {
- switch (cable[port].rev) {
- case PD_REV30:
- switch (disc->identity.product_t1.p_rev30.ss) {
- case USB_R30_SS_U40_GEN3:
- case USB_R30_SS_U32_U40_GEN1:
- return true;
- case USB_R30_SS_U32_U40_GEN2:
- /* Check if DFP is Gen 3 capable */
- if (IS_ENABLED(CONFIG_USB_PD_TBT_GEN3_CAPABLE))
- return false;
- return true;
- default:
- disable_usb4_mode(port);
- return false;
- }
- case PD_REV20:
- switch (disc->identity.product_t1.p_rev20.ss) {
- case USB_R20_SS_U31_GEN1_GEN2:
- /* Check if DFP is Gen 3 capable */
- if (IS_ENABLED(CONFIG_USB_PD_TBT_GEN3_CAPABLE))
- return false;
- return true;
- default:
- disable_usb4_mode(port);
- return false;
- }
- default:
- disable_usb4_mode(port);
- }
- }
- return false;
-}
-
void pd_dfp_discovery_init(int port)
{
memset(&discovery[port], 0, sizeof(struct pd_discovery));
@@ -353,12 +173,6 @@ void pd_dfp_mode_init(int port)
memset(&partner_amodes[port], 0, sizeof(partner_amodes[0]));
}
-static int dfp_discover_ident(uint32_t *payload)
-{
- payload[0] = VDO(USB_SID_PD, 1, CMD_DISCOVER_IDENT);
- return 1;
-}
-
static int dfp_discover_svids(uint32_t *payload)
{
payload[0] = VDO(USB_SID_PD, 1, CMD_DISCOVER_SVID);
@@ -410,23 +224,6 @@ static int dfp_discover_modes(int port, uint32_t *payload)
return 1;
}
-static bool is_usb4_vdo(int port, int cnt, uint32_t *payload)
-{
- enum idh_ptype ptype = PD_IDH_PTYPE(payload[VDO_I(IDH)]);
-
- if (IS_PD_IDH_UFP_PTYPE(ptype)) {
- /*
- * Ref: USB Type-C Cable and Connector Specification
- * Figure 5-1 USB4 Discovery and Entry Flow Model
- * Device USB4 VDO detection.
- */
- return IS_ENABLED(CONFIG_USB_PD_USB4) &&
- is_vdo_present(cnt, VDO_INDEX_PTYPE_UFP1_VDO) &&
- PD_PRODUCT_IS_USB4(payload[VDO_INDEX_PTYPE_UFP1_VDO]);
- }
- return false;
-}
-
static int process_am_discover_ident_sop(int port, int cnt, uint32_t head,
uint32_t *payload,
enum tcpci_msg_type *rtype)
@@ -435,29 +232,6 @@ static int process_am_discover_ident_sop(int port, int cnt, uint32_t head,
pd_dfp_mode_init(port);
dfp_consume_identity(port, TCPCI_MSG_SOP, cnt, payload);
- if (IS_ENABLED(CONFIG_USB_PD_DECODE_SOP) && is_sop_prime_ready(port) &&
- board_is_tbt_usb4_port(port)) {
- /* Enable USB4 mode if USB4 VDO present and port partner
- * supports USB Rev 3.0.
- */
- if (is_usb4_vdo(port, cnt, payload) &&
- PD_HEADER_REV(head) == PD_REV30)
- enable_usb4_mode(port);
-
- /*
- * Enable Thunderbolt-compatible mode if the modal operation is
- * supported.
- */
- if (is_modal(port, cnt, payload))
- enable_tbt_compat_mode(port);
-
- if (is_modal(port, cnt, payload) ||
- is_usb4_vdo(port, cnt, payload)) {
- *rtype = TCPCI_MSG_SOP_PRIME;
- return dfp_discover_ident(payload);
- }
- }
-
return dfp_discover_svids(payload);
}
@@ -467,31 +241,6 @@ static int process_am_discover_ident_sop_prime(int port, int cnt, uint32_t head,
dfp_consume_identity(port, TCPCI_MSG_SOP_PRIME, cnt, payload);
cable[port].rev = PD_HEADER_REV(head);
- /*
- * Enter USB4 mode if the cable supports USB4 operation and has USB4
- * VDO.
- */
- if (is_usb4_mode_enabled(port) &&
- is_cable_ready_to_enter_usb4(port, cnt)) {
- enable_enter_usb4_mode(port);
- usb_mux_set_safe_mode(port);
- /*
- * To change the mode of operation from USB4 the port needs to
- * be reconfigured.
- * Ref: USB Type-C Cable and Connectot Spec section 5.4.4.
- */
- disable_tbt_compat_mode(port);
- return 0;
- }
-
- /*
- * Disable Thunderbolt-compatible mode if the cable does not support
- * superspeed.
- */
- if (is_tbt_compat_enabled(port) &&
- get_tbt_cable_speed(port) < TBT_SS_U31_GEN1)
- disable_tbt_compat_mode(port);
-
return dfp_discover_svids(payload);
}
@@ -506,132 +255,8 @@ static int process_am_discover_svids(int port, int cnt, uint32_t *payload,
*/
dfp_consume_svids(port, sop, cnt, payload);
- /*
- * Ref: USB Type-C Cable and Connector Specification,
- * figure F-1: TBT3 Discovery Flow
- *
- * For USB4 mode if device or cable doesn't have Intel SVID,
- * disable Thunderbolt-Compatible mode directly enter USB4 mode
- * with USB3.2 Gen1/Gen2 speed.
- *
- * For Thunderbolt-compatible, check if 0x8087 is received for
- * Discover SVID SOP. If not, disable Thunderbolt-compatible mode
- *
- * If 0x8087 is not received for Discover SVID SOP' limit to TBT
- * passive Gen 2 cable.
- */
- if (is_tbt_compat_enabled(port)) {
- bool intel_svid = is_intel_svid(port, sop);
- if (!intel_svid) {
- if (is_usb4_mode_enabled(port)) {
- disable_tbt_compat_mode(port);
- cable[port].cable_mode_resp.tbt_cable_speed =
- TBT_SS_U32_GEN1_GEN2;
- enable_enter_usb4_mode(port);
- usb_mux_set_safe_mode(port);
- return 0;
- }
-
- if (sop == TCPCI_MSG_SOP_PRIME)
- limit_tbt_cable_speed(port);
- else
- disable_tbt_compat_mode(port);
- } else if (sop == TCPCI_MSG_SOP) {
- *rtype = TCPCI_MSG_SOP_PRIME;
- return dfp_discover_svids(payload);
- }
- }
-
return dfp_discover_modes(port, payload);
}
-
-static int process_tbt_compat_discover_modes(int port, enum tcpci_msg_type sop,
- uint32_t *payload,
- enum tcpci_msg_type *rtype)
-{
- int rsize;
-
- /* Initialize transmit type to SOP */
- *rtype = TCPCI_MSG_SOP;
-
- /*
- * For active cables, Enter mode: SOP', SOP'', SOP
- * Ref: USB Type-C Cable and Connector Specification, figure F-1: TBT3
- * Discovery Flow and Section F.2.7 TBT3 Cable Enter Mode Command.
- */
- if (sop == TCPCI_MSG_SOP_PRIME) {
- /* Store Discover Mode SOP' response */
- cable[port].cable_mode_resp.raw_value = payload[1];
-
- if (is_usb4_mode_enabled(port)) {
- /*
- * If Cable is not Thunderbolt Gen 3
- * capable or Thunderbolt Gen1_Gen2
- * capable, disable USB4 mode and
- * continue flow for
- * Thunderbolt-compatible mode
- */
- if (cable_supports_tbt_speed(port)) {
- enable_enter_usb4_mode(port);
- usb_mux_set_safe_mode(port);
- return 0;
- }
- disable_usb4_mode(port);
- }
-
- /*
- * Send TBT3 Cable Enter Mode (SOP') for active cables,
- * otherwise send TBT3 Device Enter Mode (SOP).
- */
- if (get_usb_pd_cable_type(port) == IDH_PTYPE_ACABLE)
- *rtype = TCPCI_MSG_SOP_PRIME;
-
- rsize = enter_tbt_compat_mode(port, *rtype, payload);
- } else {
- /* Store Discover Mode SOP response */
- cable[port].dev_mode_resp.raw_value = payload[1];
-
- if (is_limit_tbt_cable_speed(port)) {
- /*
- * Passive cable has Nacked for Discover SVID.
- * No need to do Discover modes of cable.
- * Enter into device Thunderbolt-compatible mode.
- */
- rsize = enter_tbt_compat_mode(port, *rtype, payload);
- } else {
- /* Discover modes for SOP' */
- discovery[port][TCPCI_MSG_SOP].svid_idx--;
- rsize = dfp_discover_modes(port, payload);
- *rtype = TCPCI_MSG_SOP_PRIME;
- }
- }
-
- return rsize;
-}
-
-static int obj_cnt_enter_tbt_compat_mode(int port, enum tcpci_msg_type sop,
- uint32_t *payload,
- enum tcpci_msg_type *rtype)
-{
- struct pd_discovery *disc = &discovery[port][TCPCI_MSG_SOP_PRIME];
-
- /* Enter mode SOP' for active cables */
- if (sop == TCPCI_MSG_SOP_PRIME) {
- /* Check if the cable has a SOP'' controller */
- if (disc->identity.product_t1.a_rev20.sop_p_p)
- *rtype = TCPCI_MSG_SOP_PRIME_PRIME;
- return enter_tbt_compat_mode(port, *rtype, payload);
- }
-
- /* Enter Mode SOP'' for active cables with SOP'' controller */
- if (sop == TCPCI_MSG_SOP_PRIME_PRIME)
- return enter_tbt_compat_mode(port, *rtype, payload);
-
- /* Update Mux state to Thunderbolt-compatible mode. */
- set_tbt_compat_mode_ready(port);
- /* No response once device (and cable) acks */
- return 0;
-}
#endif /* CONFIG_USB_PD_ALT_MODE_DFP */
int pd_svdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload,
@@ -732,22 +357,10 @@ int pd_svdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload,
break;
case CMD_DISCOVER_MODES:
dfp_consume_modes(port, sop, cnt, payload);
- if (is_tbt_compat_enabled(port) &&
- is_tbt_compat_mode(port, cnt, payload)) {
- rsize = process_tbt_compat_discover_modes(
- port, sop, payload, rtype);
- break;
- }
rsize = dfp_discover_modes(port, payload);
/* enter the default mode for DFP */
if (!rsize) {
- /*
- * Disabling Thunderbolt-Compatible mode if
- * discover mode response doesn't include Intel
- * SVID.
- */
- disable_tbt_compat_mode(port);
payload[0] = pd_dfp_enter_mode(
port, TCPCI_MSG_SOP, 0, 0);
if (payload[0])
@@ -755,14 +368,7 @@ int pd_svdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload,
}
break;
case CMD_ENTER_MODE:
- if (is_tbt_compat_enabled(port)) {
- rsize = obj_cnt_enter_tbt_compat_mode(
- port, sop, payload, rtype);
- /*
- * Continue with PD flow if
- * Thunderbolt-compatible mode is disabled.
- */
- } else if (!modep) {
+ if (!modep) {
rsize = 0;
} else {
if (!modep->opos)
@@ -848,14 +454,7 @@ int pd_svdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload,
}
} else if (cmd_type == CMDT_RSP_NAK) {
/* Passive cable Nacked for Discover SVID */
- if (cmd == CMD_DISCOVER_SVID && is_tbt_compat_enabled(port) &&
- sop == TCPCI_MSG_SOP_PRIME &&
- get_usb_pd_cable_type(port) == IDH_PTYPE_PCABLE) {
- limit_tbt_cable_speed(port);
- rsize = dfp_discover_modes(port, payload);
- } else {
- rsize = 0;
- }
+ rsize = 0;
#endif /* CONFIG_USB_PD_ALT_MODE_DFP */
} else {
CPRINTF("ERR:CMDT:%d\n", cmd);
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index ff78c55b13..780cd6ce34 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -331,7 +331,6 @@ static const char *const pd_state_names[] = {
"BIST_RX",
"BIST_TX",
"DRP_AUTO_TOGGLE",
- "ENTER_USB",
};
BUILD_ASSERT(ARRAY_SIZE(pd_state_names) == PD_STATE_COUNT);
#endif
@@ -1664,12 +1663,6 @@ static void handle_data_request(int port, uint32_t head, uint32_t *payload)
#ifdef CONFIG_USB_PD_REV30
case PD_DATA_BATTERY_STATUS:
break;
- /* TODO : Add case PD_DATA_RESET for exiting USB4 */
-
- /*
- * TODO : Add case PD_DATA_ENTER_USB to accept or reject
- * Enter_USB request from port partner.
- */
#endif
case PD_DATA_VENDOR_DEF:
handle_vdm_request(port, cnt, payload, head);
@@ -1835,21 +1828,6 @@ static void handle_ctrl_request(int port, uint32_t head, uint32_t *payload)
break;
#endif
case PD_CTRL_REJECT:
- if (pd[port].task_state == PD_STATE_ENTER_USB) {
- if (!IS_ENABLED(CONFIG_USBC_SS_MUX))
- break;
-
- /*
- * Since Enter USB sets the mux state to SAFE mode,
- * resetting the mux state back to USB mode on
- * recieveing a NACK.
- */
- usb_mux_set(port, USB_PD_MUX_USB_ENABLED,
- USB_SWITCH_CONNECT, pd[port].polarity);
-
- set_state(port, READY_RETURN_STATE(port));
- break;
- }
case PD_CTRL_WAIT:
if (pd[port].task_state == PD_STATE_DR_SWAP) {
if (type == PD_CTRL_WAIT) /* try again ... */
@@ -1912,20 +1890,7 @@ static void handle_ctrl_request(int port, uint32_t head, uint32_t *payload)
#endif
break;
case PD_CTRL_ACCEPT:
- if (pd[port].task_state == PD_STATE_ENTER_USB) {
- if (!IS_ENABLED(CONFIG_USBC_SS_MUX))
- break;
-
- /* Connect the SBU and USB lines to the connector */
- if (IS_ENABLED(CONFIG_USBC_PPC_SBU))
- ppc_set_sbu(port, 1);
-
- /* Set usb mux to USB4 mode */
- usb_mux_set(port, USB_PD_MUX_USB4_ENABLED,
- USB_SWITCH_CONNECT, pd[port].polarity);
-
- set_state(port, READY_RETURN_STATE(port));
- } else if (pd[port].task_state == PD_STATE_SOFT_RESET) {
+ if (pd[port].task_state == PD_STATE_SOFT_RESET) {
/*
* For the case that we sent soft reset in SNK_DISCOVERY
* on startup due to VBUS never low, clear the flag.
@@ -2172,45 +2137,6 @@ static uint64_t vdm_get_ready_timeout(uint32_t vdm_hdr)
return timeout;
}
-static void exit_tbt_mode_sop_prime(int port)
-{
- /* Exit Thunderbolt-Compatible mode SOP' */
- uint16_t header;
- int opos;
-
- if (!IS_ENABLED(CONFIG_USB_PD_TBT_COMPAT_MODE))
- return;
-
- opos = pd_alt_mode(port, TCPCI_MSG_SOP, USB_VID_INTEL);
- if (opos <= 0)
- return;
-
- CPRINTS("C%d Cable exiting TBT Compat mode", port);
- /*
- * Note: TCPMv2 contemplates separate discovery structures for each SOP
- * type. TCPMv1 only uses one discovery structure, so all accesses
- * specify TCPCI_MSG_SOP.
- */
- if (pd_dfp_exit_mode(port, TCPCI_MSG_SOP, USB_VID_INTEL, opos))
- usb_mux_set_safe_mode(port);
- else
- return;
-
- header = PD_HEADER(PD_DATA_VENDOR_DEF, pd[port].power_role,
- pd[port].data_role, pd[port].msg_id,
- (int)pd[port].vdo_count,
- pd_get_rev(port, TCPCI_MSG_SOP), 0);
-
- pd[port].vdo_data[0] =
- VDO(USB_VID_INTEL, 1, CMD_EXIT_MODE | VDO_OPOS(opos));
-
- pd_transmit(port, TCPCI_MSG_SOP_PRIME, header, pd[port].vdo_data,
- AMS_START);
-
- usb_mux_set(port, USB_PD_MUX_USB_ENABLED, USB_SWITCH_CONNECT,
- polarity_rm_dts(pd_get_polarity(port)));
-}
-
static void pd_vdm_send_state_machine(int port)
{
int res;
@@ -2273,15 +2199,8 @@ static void pd_vdm_send_state_machine(int port)
pd[port].data_role, pd[port].msg_id,
(int)pd[port].vdo_count,
pd_get_rev(port, TCPCI_MSG_SOP), 0);
-
- if ((msg_type == TCPCI_MSG_SOP_PRIME_PRIME) &&
- IS_ENABLED(CONFIG_USBC_SS_MUX)) {
- exit_tbt_mode_sop_prime(port);
- } else if (msg_type == TCPCI_MSG_SOP_PRIME) {
- pd[port].vdo_data[0] =
- VDO(USB_SID_PD, 1,
- CMD_DISCOVER_SVID);
- }
+ pd[port].vdo_data[0] =
+ VDO(USB_SID_PD, 1, CMD_DISCOVER_SVID);
res = pd_transmit(port, TCPCI_MSG_SOP, header,
pd[port].vdo_data, AMS_START);
reset_pd_cable(port);
@@ -2790,45 +2709,6 @@ static int pd_restart_tcpc(int port)
}
#endif
-static void pd_send_enter_usb(int port, int *timeout)
-{
- uint32_t usb4_payload;
- uint16_t header;
- int res;
-
- /*
- * TODO: Enable Enter USB for cables (SOP').
- * This is needed for active cables
- */
- if (!IS_ENABLED(CONFIG_USBC_SS_MUX) ||
- !IS_ENABLED(CONFIG_USB_PD_USB4) ||
- !IS_ENABLED(CONFIG_USB_PD_ALT_MODE_DFP))
- return;
-
- usb4_payload = get_enter_usb_msg_payload(port);
-
- header = PD_HEADER(PD_DATA_ENTER_USB, pd[port].power_role,
- pd[port].data_role, pd[port].msg_id, 1, PD_REV30, 0);
-
- res = pd_transmit(port, TCPCI_MSG_SOP, header, &usb4_payload,
- AMS_START);
- if (res < 0) {
- *timeout = 10 * MSEC;
- /*
- * If failed to get goodCRC, send soft reset, otherwise ignore
- * failure.
- */
- set_state(port, res == -1 ? PD_STATE_SOFT_RESET :
- READY_RETURN_STATE(port));
- return;
- }
-
- /* Disable Enter USB4 mode prevent re-entry */
- disable_enter_usb4_mode(port);
-
- set_state(port, PD_STATE_ENTER_USB);
-}
-
void pd_task(void *u)
{
uint32_t head;
@@ -3720,15 +3600,6 @@ void pd_task(void *u)
break;
}
- /*
- * Enter_USB if port partner and cable are
- * USB4 compatible.
- */
- if (should_enter_usb4_mode(port)) {
- pd_send_enter_usb(port, &timeout);
- break;
- }
-
if (!(pd[port].flags & PD_FLAGS_PING_ENABLED))
break;
@@ -4367,15 +4238,6 @@ void pd_task(void *u)
break;
}
- /*
- * Enter_USB if port partner and cable are
- * USB4 compatible.
- */
- if (should_enter_usb4_mode(port)) {
- pd_send_enter_usb(port, &timeout);
- break;
- }
-
/* Sent all messages, don't need to wake very often */
timeout = 200 * MSEC;
break;
@@ -4779,14 +4641,6 @@ void pd_task(void *u)
break;
}
#endif
- case PD_STATE_ENTER_USB:
- if (pd[port].last_state != pd[port].task_state) {
- set_state_timeout(port,
- get_time().val +
- PD_T_SENDER_RESPONSE,
- READY_RETURN_STATE(port));
- }
- break;
default:
break;
}
diff --git a/include/usb_pd.h b/include/usb_pd.h
index 6e7a14bc31..9bae4f73af 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -894,7 +894,6 @@ enum pd_states {
PD_STATE_BIST_RX, /* C36 */
PD_STATE_BIST_TX, /* C37 */
PD_STATE_DRP_AUTO_TOGGLE, /* C38 */
- PD_STATE_ENTER_USB, /* C39 */
/* Number of states. Not an actual state. */
PD_STATE_COUNT,
};