From 0c9970ebeab1810667f49ebe6d7f3a14c5c7fe71 Mon Sep 17 00:00:00 2001 From: Jett Rink Date: Thu, 17 Oct 2019 09:32:44 -0600 Subject: usb: Remove invalid data role from enum The data role as defined in the USB spec is 1 bit. Disconnected does not fit and no one is using it properly. All users of Disconnected value alias the value to DFP anyway. Just use DFP explicitly BRANCH=none BUG=none TEST=builds and runs new stack on hatch Change-Id: I5c7dddea8f34c8e3c524da8701913c87c23b42b2 Signed-off-by: Jett Rink Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1865984 --- common/usb_pd_protocol.c | 7 ++++--- common/usbc/usb_tc_drp_acc_trysrc_sm.c | 8 ++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'common') diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index e06d424c39..266c83788b 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -818,10 +818,11 @@ static inline void set_state(int port, enum pd_states next_state) pd_dfp_exit_mode(port, 0, 0); #endif /* - * Indicate that the port is disconnected so the board - * can restore state from any previous data swap. + * Indicate that the port is disconnected by setting role to + * DFP as SoCs have special signals when they are the UFP ports + * (e.g. OTG signals) */ - pd_execute_data_swap(port, PD_ROLE_DISCONNECTED); + pd_execute_data_swap(port, PD_ROLE_DFP); #ifdef CONFIG_USBC_SS_MUX usb_mux_set(port, TYPEC_MUX_NONE, USB_SWITCH_DISCONNECT, pd[port].polarity); diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c index 15cc1e1f09..310ed0d76f 100644 --- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c +++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c @@ -1649,8 +1649,10 @@ static void tc_unattached_snk_entry(const int port) /* * Indicate that the port is disconnected so the board * can restore state from any previous data swap. + * + * NOTE: This is no-op change. This is cleaned up further in a child CL */ - pd_execute_data_swap(port, PD_ROLE_DISCONNECTED); + pd_execute_data_swap(port, PD_ROLE_DFP); tc[port].next_role_swap = get_time().val + PD_T_DRP_SNK; if (IS_ENABLED(CONFIG_USB_PE_SM)) { @@ -2032,8 +2034,10 @@ static void tc_unattached_src_entry(const int port) /* * Indicate that the port is disconnected so the board * can restore state from any previous data swap. + * + * NOTE: This is no-op change. This is cleaned up further in a child CL */ - pd_execute_data_swap(port, PD_ROLE_DISCONNECTED); + pd_execute_data_swap(port, PD_ROLE_DFP); if (IS_ENABLED(CONFIG_USB_PE_SM)) { tc[port].flags = 0; -- cgit v1.2.1