[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250828231434.koacer62sx6hyagx@synopsys.com>
Date: Thu, 28 Aug 2025 23:14:35 +0000
From: Thinh Nguyen <Thinh.Nguyen@...opsys.com>
To: Sven Peter <sven@...nel.org>
CC: Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Felipe Balbi <balbi@...nel.org>,
Janne Grunau <j@...nau.net>, Alyssa Rosenzweig <alyssa@...enzweig.io>,
Neal Gompa <neal@...pa.dev>, Vinod Koul <vkoul@...nel.org>,
Kishon Vijay Abraham I <kishon@...nel.org>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Philipp Zabel <p.zabel@...gutronix.de>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"asahi@...ts.linux.dev" <asahi@...ts.linux.dev>,
"linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>,
"linux-phy@...ts.infradead.org" <linux-phy@...ts.infradead.org>
Subject: Re: [PATCH RFC 04/22] usb: dwc3: apple: Reset dwc3 during role
switches
On Sun, Aug 24, 2025, Sven Peter wrote:
> On 22.08.25 01:25, Thinh Nguyen wrote:
> >
> > > + (dwc->current_dr_role && ((DWC3_IP_IS(DWC3) ||
> > > DWC3_VER_IS_PRIOR(DWC31, 190A)) &&
> > > - desired_dr_role != DWC3_GCTL_PRTCAP_OTG)) {
> > > + desired_dr_role != DWC3_GCTL_PRTCAP_OTG))) {
> > > reg = dwc3_readl(dwc->regs, DWC3_GCTL);
> > > reg |= DWC3_GCTL_CORESOFTRESET;
> > > dwc3_writel(dwc->regs, DWC3_GCTL, reg);
> > > @@ -1372,6 +1394,9 @@ static int dwc3_core_init(struct dwc3 *dwc)
> > > if (ret)
> > > goto err_exit_phy;
> > > + if (dwc->role_switch_reset_quirk)
> > > + dwc3_enable_susphy(dwc, true);
> > > +
> >
> > Why do you need to enable susphy here?
>
> The only place we actually need it is when we shut down the Type-C PHY due
> some what I assume is some hardware quirk, i.e. just before dwc3_core_exit.
Not really hardware quirk. Some low level phy commands can only be
executed while the phy is in low power.
>
> The PHY will otherwise not be able to acquire some hardware lock (which they
> call PIPEHANDLER lock in debug strings) to switch from e.g. USB3 PHY to a
> dummy PHY for USB2 only. It then can't shut down cleanly anymore and will
> get stuck in a weird state where the port refuses to work until I reset
> everything.
> Originally it was added because we just undid some commit where susphy
> handling was made unconditional IIRC.
>
> I'll move this to the glue driver with a comment explaining why it's
> required.
>
>
Perhaps this patch can give you some clues:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/usb/dwc3/core.c?id=cc5bfc4e16fc1d1c520cd7bb28646e82b6e69217
BR,
Thinh
Powered by blists - more mailing lists