From: John Keeping <jkeeping@inmusicbrands.com>
To: linux-rockchip@lists.infradead.org
Cc: John Keeping <jkeeping@inmusicbrands.com>,
Vinod Koul <vkoul@kernel.org>,
Kishon Vijay Abraham I <kishon@kernel.org>,
Heiko Stuebner <heiko@sntech.de>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sebastian Reichel <sebastian.reichel@collabora.com>,
Nicolas Frattaroli <nicolas.frattaroli@collabora.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
linux-usb@vger.kernel.org, linux-phy@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [RFC/PATCH 1/2] usb: dwc3: disable for USB_ROLE_NONE
Date: Thu, 10 Jul 2025 16:22:49 +0100 [thread overview]
Message-ID: <20250710152252.2532020-2-jkeeping@inmusicbrands.com> (raw)
In-Reply-To: <20250710152252.2532020-1-jkeeping@inmusicbrands.com>
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@inmusicbrands.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
next prev parent reply other threads:[~2025-07-10 15:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-10 15:22 [RFC/PATCH 0/2] dwc3/rockchip orientation fixes John Keeping
2025-07-10 15:22 ` John Keeping [this message]
2025-07-12 0:11 ` [RFC/PATCH 1/2] usb: dwc3: disable for USB_ROLE_NONE Thinh Nguyen
2025-07-14 15:15 ` John Keeping
2025-07-29 22:10 ` Thinh Nguyen
2025-08-06 17:10 ` John Keeping
2025-08-07 0:58 ` Thinh Nguyen
2025-07-10 15:22 ` [RFC/PATCH 2/2] phy: rockchip: usbdp: implement .set_mode John Keeping
2025-07-15 10:35 ` Heiko Stuebner
2025-07-16 19:14 ` John Keeping
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250710152252.2532020-2-jkeeping@inmusicbrands.com \
--to=jkeeping@inmusicbrands.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=gregkh@linuxfoundation.org \
--cc=heiko@sntech.de \
--cc=kishon@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=nicolas.frattaroli@collabora.com \
--cc=sebastian.reichel@collabora.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox