Skip to contentSkip to conversation

usb: dwc2: Add functions to set and clear force mode

Bug Doug Anderson 4 participants 13 messages Jan 26, 2016 – Feb 3, 2016 10 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi,

Quoted 17 lines · Caesar Wang

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)

Quoted 5 lines

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

I know USB on mainline was failing pretty badly for me for rk3288 until I applied those patches, though I didn't debug it further than just applying those patches.

-Doug

A message that is not in the archive (sent off-list or not yet received): CAD=FV=Xk4v=1QMYG9XmXh6hJLKU6i_wVakOArF1du-Z_4_+Neg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw

Thanks Doug's reply.

Cc: Wulf

Quoted 20 lines · Doug Anderson

Hi,

Quoted 17 lines · Caesar Wang

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)

Quoted 8 lines
Quoted 5 lines

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.

Quoted 4 lines

I know USB on mainline was failing pretty badly for me for rk3288 until I applied those patches, though I didn't debug it further than just applying those patches.

Quoted 8 lines

-Doug

Signature · 2 lines
Thanks,
Caesar

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

A message that is not in the archive (sent off-list or not yet received): [email protected]

author Tested-by Stefan Wahren Tested-by Remi Pommarel
#6 lore raw

Caesar,

Quoted 34 lines · Caesar Wang

Thanks Doug's reply.

Cc: Wulf

Quoted 30 lines · Doug Anderson

Hi,

Quoted 25 lines · Caesar Wang

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?

Quoted 8 lines
Quoted 3 lines

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?

Author:     John Youn <[email protected]>
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")

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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

A message that is not in the archive (sent off-list or not yet received): CAD=FV=Uab6H6sFVj_bPRs7H4HcBi2pqZK3HDCHQxC+EDk=inDA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#8 lore raw

Doug

Quoted 36 lines · Doug Anderson

Caesar,

Quoted 33 lines · Caesar Wang

Thanks Doug's reply.

Cc: Wulf

Quoted 29 lines · Doug Anderson

Hi,

Quoted 18 lines · Caesar Wang

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)

Quoted 6 lines

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?

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

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.

drivers/usb/dwc2/core.c +7 -0
index e991d55..90f4abf 100644
@@ -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;
 }
 
Quoted 28 lines
Author:     John Youn <[email protected]>
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")

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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

Signature · 8 lines
Thanks,
Caesar


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw
Quoted 41 lines · Caesar Wang

Doug

Quoted 38 lines · Doug Anderson

Caesar,

Quoted 35 lines · Caesar Wang

Thanks Doug's reply.

Cc: Wulf

Quoted 30 lines · Doug Anderson

Hi,

Quoted 18 lines · Caesar Wang

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)

Quoted 6 lines

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

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

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.

Quoted 58 lines

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.

drivers/usb/dwc2/core.c +3 -0
index e991d55..90f4abf 100644
@@ -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

drivers/usb/dwc2/core.c +4 -0
+        * not stay in host mode after a connector ID change!
+        */
+        usleep_range(150000, 160000);
+
        return 0;
 }
Quoted 32 lines


Author:     John Youn <[email protected]>
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")

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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

Signature · 8 lines
Thanks,
Caesar


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#11 lore raw
Quoted 74 lines · Caesar Wang
Quoted 48 lines · Caesar Wang

Doug

Quoted 45 lines · Doug Anderson

Caesar,

Quoted 41 lines · Caesar Wang

Thanks Doug's reply.

Cc: Wulf

Quoted 28 lines · Doug Anderson

Hi,

Quoted 24 lines · Caesar Wang

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.

Quoted 4 lines
Quoted 1 line

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.

Quoted 5 lines
Quoted 3 lines

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.

Quoted 14 lines

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.

drivers/usb/dwc2/core.c +0 -0
index e991d55..90f4abf 100644
@@ -637,6 +637,13 @@ int dwc2_core_reset_and_force_dr_mode(struct 
 dwc2_hsotg *hsotg)
                return retval;
 
Quoted 11 lines

drivers/usb/dwc2/core.c int dwc2_core_reset_and_force_dr_mode(struct dwc2_hsotg *hsotg) · line 648

Quoted 11 lines
drivers/usb/dwc2/core.c +3 -0
        dwc2_force_dr_mode(hsotg);
+
+       /*
+        * NOTE: This long sleep is _very_ important, otherwise the 

core will

drivers/usb/dwc2/core.c +4 -0
+        * 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
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

A message that is not in the archive (sent off-list or not yet received): 2B3535C5ECE8B5419E3ECBE30077290901DC42FD26-Yu2iAY70zvrYN67daEjeMPufCSb+aD3WLzEdoUbNIic@public.gmane.org

#13 lore raw

Hi John,

Quoted 95 lines · John Youn
Quoted 94 lines · Caesar Wang
Quoted 43 lines · Caesar Wang

Doug

Quoted 40 lines · Doug Anderson

Caesar,

Quoted 36 lines · Caesar Wang

Thanks Doug's reply.

Cc: Wulf

Quoted 32 lines · Doug Anderson

Hi,

Quoted 18 lines · Caesar Wang

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)

Quoted 7 lines

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

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

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.

Quoted 38 lines

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.

drivers/usb/dwc2/core.c +0 -0

index e991d55..90f4abf 100644

--- a/drivers/usb/dwc2/core.c

+++ b/drivers/usb/dwc2/core.c

drivers/usb/dwc2/core.c +3 -0
@@ -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

drivers/usb/dwc2/core.c +4 -0
+        * not stay in host mode after a connector ID change!
 
+        */
 
+        usleep_range(150000, 160000);
 
+
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
         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)?

It's the Host mode. ( USB_DR_MODE_HOST)

Quoted 5 lines

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.

Quoted 8 lines

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")

I'm sure can't work if we revert it.
log
...:
"[ 5.705971] usb usb2-port1: connect-debounce failed"

d4b3ff1 Revert "usb: dwc2: Reduce delay when forcing mode in reset" c69654f usb: dwc2: Fix probe problem on bcm283
b9da0ff Revert "usb: dwc2: Move reset into dwc2_get_hwparams()

--

Then, add the following patch can work.

drivers/usb/dwc2/core.c +7 -0
index e991d55..90f4abf 100644
@@ -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;
 }
 
Quoted 10 lines

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
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

A message that is not in the archive (sent off-list or not yet received): 56B01785.3030803-9Onoh4P/[email protected]

#15 lore raw

John,

I will suggest the msleep(25) delay should put in 'dwc2_force_dr_mode()' instead of the 'dwc2_clear_force_mode()'

Quoted 171 lines · Caesar Wang

Hi John,

Quoted 96 lines · John Youn
Quoted 95 lines · Caesar Wang
Quoted 43 lines · Caesar Wang

Doug

Quoted 40 lines · Doug Anderson

Caesar,

Quoted 36 lines · Caesar Wang

Thanks Doug's reply.

Cc: Wulf

Quoted 32 lines · Doug Anderson

Hi,

Quoted 18 lines · Caesar Wang

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)

Quoted 7 lines

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

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

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.

Quoted 39 lines

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.

drivers/usb/dwc2/core.c +0 -0

index e991d55..90f4abf 100644

--- a/drivers/usb/dwc2/core.c

+++ b/drivers/usb/dwc2/core.c

drivers/usb/dwc2/core.c +3 -0
@@ -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

drivers/usb/dwc2/core.c +4 -0
+        * not stay in host mode after a connector ID change!
 
+        */
 
+        usleep_range(150000, 160000);
 
+
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
         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)?

It's the Host mode. ( USB_DR_MODE_HOST)

Quoted 5 lines

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.

Quoted 8 lines

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")

I'm sure can't work if we revert it.
log
...:
"[ 5.705971] usb usb2-port1: connect-debounce failed"

d4b3ff1 Revert "usb: dwc2: Reduce delay when forcing mode in reset" c69654f usb: dwc2: Fix probe problem on bcm283
b9da0ff Revert "usb: dwc2: Move reset into dwc2_get_hwparams()

Signature · 1 line
Then, add the following patch can work.
drivers/usb/dwc2/core.c +3 -0
index e991d55..90f4abf 100644
@@ -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

drivers/usb/dwc2/core.c +4 -0
+        * not stay in host mode after a connector ID change!
+        */
+        usleep_range(150000, 160000);
+
        return 0;
 }
Quoted 11 lines

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
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

Signature · 8 lines
Thanks,
Caesar


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#16 lore raw
Quoted 5 lines · Caesar Wang

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?

drivers/usb/dwc2/core.c +2 -0
index 39a0fa8..e8a9688 100644
@@ -625,6 +625,8 @@ void dwc2_force_dr_mode(struct dwc2_hsotg *hsotg)
                         __func__, hsotg->dr_mode);
                break;
        }
+
+       msleep(25);
 }
 
 

Although that is still not ideal, it's better than the alternative.

Regards,
John

A message that is not in the archive (sent off-list or not yet received): 2B3535C5ECE8B5419E3ECBE30077290901DC431FDB-Yu2iAY70zvrYN67daEjeMPufCSb+aD3WLzEdoUbNIic@public.gmane.org

#18 lore raw

Hi John,

Quoted 16 lines · John Youn
Quoted 5 lines · Caesar Wang

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?

drivers/usb/dwc2/core.c +0 -0
index 39a0fa8..e8a9688 100644

drivers/usb/dwc2/core.c void dwc2_force_dr_mode(struct dwc2_hsotg *hsotg) · line 629

Quoted 5 lines
drivers/usb/dwc2/core.c +2 -0
@@ -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.

Quoted 4 lines
drivers/usb/dwc2/core.c +0 -0
  }
 
 
Quoted 8 lines

Although that is still not ideal, it's better than the alternative.

Regards,
John

Signature · 2 lines
Thanks,
Caesar

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#19 lore raw
Quoted 14 lines · Caesar Wang

Hi John,

Quoted 11 lines · John Youn
Quoted 5 lines · Caesar Wang

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?

Quoted 13 lines

drivers/usb/dwc2/core.c void dwc2_force_dr_mode(struct dwc2_hsotg *hsotg) · line 629

Quoted 10 lines
drivers/usb/dwc2/core.c +2 -0
index 39a0fa8..e8a9688 100644
@@ -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----

drivers/usb/dwc2/core.c +2 -2
index e991d55..13c060c 100644
@@ -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);
 }

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

A message that is not in the archive (sent off-list or not yet received): 2B3535C5ECE8B5419E3ECBE30077290901DC4322F0-Yu2iAY70zvrYN67daEjeMPufCSb+aD3WLzEdoUbNIic@public.gmane.org

#21 lore raw
Quoted 63 lines · John Youn
Quoted 14 lines · Caesar Wang

Hi John,

Quoted 11 lines · John Youn
Quoted 5 lines · Caesar Wang

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?

Quoted 12 lines

drivers/usb/dwc2/core.c void dwc2_force_dr_mode(struct dwc2_hsotg *hsotg) · line 629

Quoted 10 lines
drivers/usb/dwc2/core.c +2 -0
index 39a0fa8..e8a9688 100644
@@ -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----

drivers/usb/dwc2/core.c +0 -2
index e991d55..13c060c 100644
@@ -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);
  }
 
  /*

drivers/usb/dwc2/core.c void dwc2_force_dr_mode(struct dwc2_hsotg *hsotg) · line 622

Quoted 6 lines
drivers/usb/dwc2/core.c +2 -0
@@ -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.

Signature · 8 lines
Thanks,
Caesar


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#22 lore raw
Quoted 64 lines · Caesar Wang
Quoted 61 lines · John Youn
Quoted 14 lines · Caesar Wang

Hi John,

Quoted 11 lines · John Youn
Quoted 5 lines · Caesar Wang

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?

Quoted 12 lines

drivers/usb/dwc2/core.c void dwc2_force_dr_mode(struct dwc2_hsotg *hsotg) · line 629

Quoted 10 lines
drivers/usb/dwc2/core.c +2 -0
index 39a0fa8..e8a9688 100644
@@ -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----

drivers/usb/dwc2/core.c +0 -2
index e991d55..13c060c 100644
@@ -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);
  }
 
Quoted 11 lines

drivers/usb/dwc2/core.c void dwc2_force_dr_mode(struct dwc2_hsotg *hsotg) · line 622

Quoted 8 lines
drivers/usb/dwc2/core.c +2 -0
  /*
@@ -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.

Ok, interesting. Actually this won't work either since we need the separate msleeps when those functions are called from other contexts.

Is your controller by chance *not* OTG capable, i.e.

dwc2_hw_is_otg(hsotg) == false

Then the msleep in dwc2_force_mode() is skipped.

Then, for some reason, skipping it (even though nothing was forced) causes the failure on your platform.

Regards,
John

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip