diff mbox

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

Message ID 56AF3D80.90807@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Caesar Wang Feb. 1, 2016, 11:12 a.m. UTC
Doug

? 2016?01?30? 03:11, Doug Anderson ??:
> Caesar,
>
> On Tue, Jan 26, 2016 at 6:12 PM, Caesar Wang <caesar.upstream@gmail.com> wrote:
>> Thanks Doug's reply.
>>
>> Cc: Wulf
>> ? 2016?01?27? 00:05, Doug Anderson ??:
>>> Hi,
>>>
>>> On Tue, Jan 26, 2016 at 4:02 AM, Caesar Wang <wxt@rock-chips.com> wrote:
>>>> Hi  John, Felipe
>>>>
>>>>
>>>> I'm no familiar with usb stuff.
>>>> then I found this patch will break usb working for rk3036 SoCs, maybe
>>>> more
>>>> SoCs.
>>>> Says, U disk can't work on usb host.
>>>>
>>>> The failure log:
>>>>
>>>>      32.645481] usb usb2-port1: connect-debounce failed
>>>>
>>>>
>>>> Tested by following branch:
>>>> https://github.com/Caesar-github/rockchip/tree/kylin/next   (kernel:
>>>> 4.5-rc1)
>>>>
>>>> Revert "usb: dwc2: Add functions to set and clear force mode" will work
>>>> for
>>>> it.
>>>>
>>>>
>>>> Maybe, someone have some suggestions or ideas?
>>> Can you check if this series helps you?
>>>
>>> http://marc.info/?l=linux-usb&m=145255851516121&w=2
>>
>> Unluckily, this series patches can't fix it on rk3036 SoCs.
>> I revert this CL ("usb: dwc2: Add functions to set and clear force mode") to
>> work firstly.
> You're 100% positive?  In particular you made sure you had this patch
> (one of the two in John's series I pointed at), which explicitly
> mentions fixing a problem with the patch you mention?

I'm 100% positive the John's patches can fix this issue.
As the following verified on
https://github.com/Caesar-github/rockchip/commits/for-usb-tests

Anyway, Meanwhile if we add the folllowing patch can work for me.  I 
will track it on tomorrow if you have other suggestions.

  }


>
> Author:     John Youn <John.Youn@synopsys.com>
> AuthorDate: Mon Jan 11 16:32:28 2016 -0800
>
>      usb: dwc2: Fix probe problem on bcm2835
>
>      Fixes an issue found on Raspberry PI platform that prevents probe. Don't
>      skip setting the force mode if it's already set.
>
>      Fixes: 09c96980dc72 ("usb: dwc2: Add functions to set and clear force mode")
>      Signed-off-by: John Youn <johnyoun@synopsys.com>
>      Reported-by: Stefan Wahren <stefan.wahren@i2se.com>
>      Reported-by: Remi Pommarel <repk@triplefau.lt>
>      Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
>      Tested-by: Remi Pommarel <repk@triplefau.lt>
>
>
> Maybe try again just in case there was some problem updating your
> kernel when you tested before?  If you're sure you can reproduce the
> problem even with John's two patches, perhaps you can give more
> details about what part of his patch broke things for you.
>
> -Doug
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip

Comments

Caesar Wang Feb. 1, 2016, 11:13 a.m. UTC | #1
? 2016?02?01? 19:12, Caesar Wang ??:
> Doug
>
> ? 2016?01?30? 03:11, Doug Anderson ??:
>> Caesar,
>>
>> On Tue, Jan 26, 2016 at 6:12 PM, Caesar Wang 
>> <caesar.upstream@gmail.com> wrote:
>>> Thanks Doug's reply.
>>>
>>> Cc: Wulf
>>> ? 2016?01?27? 00:05, Doug Anderson ??:
>>>> Hi,
>>>>
>>>> On Tue, Jan 26, 2016 at 4:02 AM, Caesar Wang <wxt@rock-chips.com> 
>>>> wrote:
>>>>> Hi  John, Felipe
>>>>>
>>>>>
>>>>> I'm no familiar with usb stuff.
>>>>> then I found this patch will break usb working for rk3036 SoCs, maybe
>>>>> more
>>>>> SoCs.
>>>>> Says, U disk can't work on usb host.
>>>>>
>>>>> The failure log:
>>>>>
>>>>>      32.645481] usb usb2-port1: connect-debounce failed
>>>>>
>>>>>
>>>>> Tested by following branch:
>>>>> https://github.com/Caesar-github/rockchip/tree/kylin/next (kernel:
>>>>> 4.5-rc1)
>>>>>
>>>>> Revert "usb: dwc2: Add functions to set and clear force mode" will 
>>>>> work
>>>>> for
>>>>> it.
>>>>>
>>>>>
>>>>> Maybe, someone have some suggestions or ideas?
>>>> Can you check if this series helps you?
>>>>
>>>> http://marc.info/?l=linux-usb&m=145255851516121&w=2
>>>
>>> Unluckily, this series patches can't fix it on rk3036 SoCs.
>>> I revert this CL ("usb: dwc2: Add functions to set and clear force 
>>> mode") to
>>> work firstly.
>> You're 100% positive?  In particular you made sure you had this patch
>> (one of the two in John's series I pointed at), which explicitly
>> mentions fixing a problem with the patch you mention?
>
> I'm 100% positive the John's patches can fix this issue

Sorry, John's patches can't fix this issue.


> As the following verified on
> https://github.com/Caesar-github/rockchip/commits/for-usb-tests
>
> Anyway, Meanwhile if we add the folllowing patch can work for me. I 
> will track it on tomorrow if you have other suggestions.
>
> diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
> index e991d55..90f4abf 100644
> --- a/drivers/usb/dwc2/core.c
> +++ b/drivers/usb/dwc2/core.c
> @@ -637,6 +637,13 @@ int dwc2_core_reset_and_force_dr_mode(struct 
> dwc2_hsotg *hsotg)
>                 return retval;
>
>         dwc2_force_dr_mode(hsotg);
> +
> +       /*
> +        * NOTE: This long sleep is _very_ important, otherwise the 
> core will
> +        * not stay in host mode after a connector ID change!
> +        */
> +        usleep_range(150000, 160000);
> +
>         return 0;
>  }
>
>
>>
>> Author:     John Youn <John.Youn@synopsys.com>
>> AuthorDate: Mon Jan 11 16:32:28 2016 -0800
>>
>>      usb: dwc2: Fix probe problem on bcm2835
>>
>>      Fixes an issue found on Raspberry PI platform that prevents 
>> probe. Don't
>>      skip setting the force mode if it's already set.
>>
>>      Fixes: 09c96980dc72 ("usb: dwc2: Add functions to set and clear 
>> force mode")
>>      Signed-off-by: John Youn <johnyoun@synopsys.com>
>>      Reported-by: Stefan Wahren <stefan.wahren@i2se.com>
>>      Reported-by: Remi Pommarel <repk@triplefau.lt>
>>      Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
>>      Tested-by: Remi Pommarel <repk@triplefau.lt>
>>
>>
>> Maybe try again just in case there was some problem updating your
>> kernel when you tested before?  If you're sure you can reproduce the
>> problem even with John's two patches, perhaps you can give more
>> details about what part of his patch broke things for you.
>>
>> -Doug
>>
>> _______________________________________________
>> Linux-rockchip mailing list
>> Linux-rockchip@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-rockchip
>
>
John Youn Feb. 1, 2016, 11:31 p.m. UTC | #2
On 2/1/2016 3:13 AM, Caesar Wang wrote:
> 
> 
> ? 2016?02?01? 19:12, Caesar Wang ??:
>> Doug
>>
>> ? 2016?01?30? 03:11, Doug Anderson ??:
>>> Caesar,
>>>
>>> On Tue, Jan 26, 2016 at 6:12 PM, Caesar Wang 
>>> <caesar.upstream@gmail.com> wrote:
>>>> Thanks Doug's reply.
>>>>
>>>> Cc: Wulf
>>>> ? 2016?01?27? 00:05, Doug Anderson ??:
>>>>> Hi,
>>>>>
>>>>> On Tue, Jan 26, 2016 at 4:02 AM, Caesar Wang <wxt@rock-chips.com> 
>>>>> wrote:
>>>>>> Hi  John, Felipe
>>>>>>
>>>>>>
>>>>>> I'm no familiar with usb stuff.
>>>>>> then I found this patch will break usb working for rk3036 SoCs, maybe
>>>>>> more
>>>>>> SoCs.
>>>>>> Says, U disk can't work on usb host.
>>>>>>
>>>>>> The failure log:
>>>>>>
>>>>>>      32.645481] usb usb2-port1: connect-debounce failed
>>>>>>
>>>>>>
>>>>>> Tested by following branch:
>>>>>> https://github.com/Caesar-github/rockchip/tree/kylin/next (kernel:
>>>>>> 4.5-rc1)
>>>>>>
>>>>>> Revert "usb: dwc2: Add functions to set and clear force mode" will 
>>>>>> work
>>>>>> for
>>>>>> it.
>>>>>>
>>>>>>
>>>>>> Maybe, someone have some suggestions or ideas?
>>>>> Can you check if this series helps you?
>>>>>
>>>>> http://marc.info/?l=linux-usb&m=145255851516121&w=2
>>>>
>>>> Unluckily, this series patches can't fix it on rk3036 SoCs.
>>>> I revert this CL ("usb: dwc2: Add functions to set and clear force 
>>>> mode") to
>>>> work firstly.
>>> You're 100% positive?  In particular you made sure you had this patch
>>> (one of the two in John's series I pointed at), which explicitly
>>> mentions fixing a problem with the patch you mention?
>>
>> I'm 100% positive the John's patches can fix this issue
> 
> Sorry, John's patches can't fix this issue.
> 
> 
>> As the following verified on
>> https://github.com/Caesar-github/rockchip/commits/for-usb-tests
>>
>> Anyway, Meanwhile if we add the folllowing patch can work for me. I 
>> will track it on tomorrow if you have other suggestions.
>>
>> diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
>> index e991d55..90f4abf 100644
>> --- a/drivers/usb/dwc2/core.c
>> +++ b/drivers/usb/dwc2/core.c
>> @@ -637,6 +637,13 @@ int dwc2_core_reset_and_force_dr_mode(struct 
>> dwc2_hsotg *hsotg)
>>                 return retval;
>>
>>         dwc2_force_dr_mode(hsotg);
>> +
>> +       /*
>> +        * NOTE: This long sleep is _very_ important, otherwise the 
>> core will
>> +        * not stay in host mode after a connector ID change!
>> +        */
>> +        usleep_range(150000, 160000);
>> +
>>         return 0;
>>  }

Hi Cesar,

On your platform, is the dwc2 controller OTG? If so, what mode is the
driver running in (dr_mode=HOST, PERIPHERAL, or OTG)?

The force mode only requires 25ms delay but maybe the sleep needs to
be longer on your system for some other reason. Which is unfortunate
because 150ms is very long.

Under what condition do you see the problem. Is it on connector ID
change? If so we might put the long delay in a more appropriate
location so as not to affect delay in probe.

Also, could you try *only* reverting the following:

commit 97e463886b873f62bea2293e7edf81fdb884b84f ("usb: dwc2: Reduce
delay when forcing mode in reset")

The original patch you referred to preserves the long delay at the
point it is used for OTG but then this later patch (97e46388)
decreased the value. So maybe we can just revert this later patch.

Regards,
John
diff mbox

Patch

diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
index e991d55..90f4abf 100644
--- a/drivers/usb/dwc2/core.c
+++ b/drivers/usb/dwc2/core.c
@@ -637,6 +637,13 @@  int dwc2_core_reset_and_force_dr_mode(struct 
dwc2_hsotg *hsotg)
                 return retval;

         dwc2_force_dr_mode(hsotg);
+
+       /*
+        * NOTE: This long sleep is _very_ important, otherwise the core 
will
+        * not stay in host mode after a connector ID change!
+        */
+        usleep_range(150000, 160000);
+
         return 0;