Re: [PATCH RFC 04/22] usb: dwc3: apple: Reset dwc3 during role switches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux