Re: dwc3 stuck in U3 state on USB3-only link

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

 



Looks like our replies crossed paths...

On Thu, Feb 09, 2023 at 06:39:41PM -0800, Jerry Zhang wrote:
> ok I was actually able to get it working! setting
> snps,bus-suspend-enable; and adding this simple change
> 
> diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c
> index 801381de3769..09229d25b39a 100644
> --- a/drivers/usb/dwc3/dwc3-msm.c
> +++ b/drivers/usb/dwc3/dwc3-msm.c
> @@ -6331,11 +6331,11 @@ static void handle_state_peripheral(struct
> dwc3_msm *mdwc, bool *work)
> 
>  static void handle_state_peripheral_suspend(struct dwc3_msm *mdwc)
>  {
>         struct dwc3 *dwc = platform_get_drvdata(mdwc->dwc3);
> 
> -       if (!test_bit(B_SESS_VLD, &mdwc->inputs)) {
> +       if (test_bit(B_SESS_VLD, &mdwc->inputs)) {
>                 dev_dbg(mdwc->dev, "BSUSP: !bsv\n");
>                 mdwc->drd_state = DRD_STATE_IDLE;
>                 cancel_delayed_work_sync(&mdwc->sdp_check);
>                 dwc3_otg_start_peripheral(mdwc, 0);
>         } else if (!test_bit(B_SUSPEND, &mdwc->inputs)) {
> 
> allows the device to successfully enumerate after a host reboot. Can
> you provide some feedback on the correctness of this patch?

You're inverting the conditional logic of the if check here so it's
probably not correct.  But (treading carefully here as I just mentioned I
trying not to deep dive downstream...) in doing so you are forcing the
driver to call dwc3_otg_start_peripheral(0) call, and lo and behold it
would end up calling dwc3_overide_vbus_status(false).  The msm-dwc3
state machine then probably takes you back to call start_peripheral(1)
again.

Can you try to do this more directly by toggling
dwc3_override_vbus_status() off then on again as I suggested in my
other reply?

Thanks,
Jack



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

  Powered by Linux