[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250710152252.2532020-2-jkeeping@inmusicbrands.com>
Date: Thu, 10 Jul 2025 16:22:49 +0100
From: John Keeping <jkeeping@...usicbrands.com>
To: linux-rockchip@...ts.infradead.org
Cc: John Keeping <jkeeping@...usicbrands.com>,
Vinod Koul <vkoul@...nel.org>,
Kishon Vijay Abraham I <kishon@...nel.org>,
Heiko Stuebner <heiko@...ech.de>,
Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Sebastian Reichel <sebastian.reichel@...labora.com>,
Nicolas Frattaroli <nicolas.frattaroli@...labora.com>,
Neil Armstrong <neil.armstrong@...aro.org>,
linux-usb@...r.kernel.org,
linux-phy@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: [RFC/PATCH 1/2] usb: dwc3: disable for USB_ROLE_NONE
When the phy is acting as a Type C mux, it may need to reset when the
cable direction changes. But this should not happen while DWC3 is
trying to use the USB connection.
In this case, there must be a connection manager to notify the phy of
the orientation change and tcpm_mux_set() ensures this happens before
DWC3's role switch is informed of a change.
It should not be possible to go directly from device->device or
host->host with a change in orientation without transitioning through
the "none" role as the cable is unplugged. So ensuring that DWC3 always
informs the phy of the new mode whenever a plug is detected should be
sufficient for the phy to safely reset itself at a time that is safe for
DWC3.
Lifting the special-case for desired_dr_mode==0 in __dwc3_set_mode() is
sufficient to allow using the unset mode for USB_ROLE_NONE. The
handling already disables the old mode and then simply does not enable a
new one.
If an external device is notifying USB role switches, then it is not
necessary to set the default role when USB_ROLE_NONE is passed.
Signed-off-by: John Keeping <jkeeping@...usicbrands.com>
---
drivers/usb/dwc3/core.c | 3 ---
drivers/usb/dwc3/drd.c | 5 +----
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 8002c23a5a02a..6573cca0eeaf5 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -177,9 +177,6 @@ static void __dwc3_set_mode(struct work_struct *work)
if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_OTG)
dwc3_otg_update(dwc, 0);
- if (!desired_dr_role)
- goto out;
-
if (desired_dr_role == dwc->current_dr_role)
goto out;
diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
index 7977860932b14..8f427afa8eb93 100644
--- a/drivers/usb/dwc3/drd.c
+++ b/drivers/usb/dwc3/drd.c
@@ -457,10 +457,7 @@ static int dwc3_usb_role_switch_set(struct usb_role_switch *sw,
mode = DWC3_GCTL_PRTCAP_DEVICE;
break;
default:
- if (dwc->role_switch_default_mode == USB_DR_MODE_HOST)
- mode = DWC3_GCTL_PRTCAP_HOST;
- else
- mode = DWC3_GCTL_PRTCAP_DEVICE;
+ mode = 0;
break;
}
--
2.50.0
Powered by blists - more mailing lists