[Bug] usb: dwc2: Add functions to set and clear force mode

Caesar Wang caesar.upstream at gmail.com
Tue Feb 2 17:10:48 PST 2016



在 2016年02月03日 09:08, John Youn 写道:
> On 2/2/2016 4:36 PM, Caesar Wang wrote:
>> Hi John,
>>
>> 在 2016年02月03日 08:03, John Youn 写道:
>>> On 2/1/2016 6:53 PM, Caesar Wang wrote:
>>>> John,
>>>>
>>>> I will suggest the msleep(25) delay should  put in
>>>> 'dwc2_force_dr_mode()' instead of the 'dwc2_clear_force_mode()'
>>>>
>>> Hi Caesar,
>>>
>>> Are you saying that just msleep(25) in that function like this solves
>>> your issue?
>>>
>>> diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
>>> index 39a0fa8..e8a9688 100644
>>> --- a/drivers/usb/dwc2/core.c
>>> +++ b/drivers/usb/dwc2/core.c
>>> @@ -625,6 +625,8 @@ void dwc2_force_dr_mode(struct dwc2_hsotg *hsotg)
>>>                            __func__, hsotg->dr_mode);
>>>                   break;
>>>           }
>>> +
>>> +       msleep(25);
>> Yep, that will solve this issue.
>>
> Ok thanks. Though that still seems strange since you should be getting
> the msleep(25) from either the dwc2_force_mode() or
> dwc2_clear_force_mode().
>
> Can you check if the following patch works?
>
> If so, I think we can go with that to fix the regression for
> now. Otherwise I'll just add the extra msleep(25) and revisit this
> later.
>
> Regards,
> John
>
> ---->8----
>
> diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
> index e991d55..13c060c 100644
> --- a/drivers/usb/dwc2/core.c
> +++ b/drivers/usb/dwc2/core.c
> @@ -576,7 +576,6 @@ static bool dwc2_force_mode(struct dwc2_hsotg *hsotg, bool host)
>          gusbcfg |= set;
>          dwc2_writel(gusbcfg, hsotg->regs + GUSBCFG);
>   
> -       msleep(25);
>          return true;
>   }
>   
> @@ -596,7 +595,6 @@ static void dwc2_clear_force_mode(struct dwc2_hsotg *hsotg)
>           * NOTE: This long sleep is _very_ important, otherwise the core will
>           * not stay in host mode after a connector ID change!
>           */
> -       msleep(25);
>   }
>   
>   /*
> @@ -619,6 +617,8 @@ void dwc2_force_dr_mode(struct dwc2_hsotg *hsotg)
>                           __func__, hsotg->dr_mode);
>                  break;
>          }
> +
> +       msleep(25);
>   }

Right, that works for me.




-- 
Thanks,
Caesar




More information about the Linux-rockchip mailing list