usb: dwc2: Add small delay after reset
PATCH 1/1 usb: dwc2: Add small delay after reset
In Cyclone 5 SoC platform, the first USB probing is failed but second probing is success. DWC2 driver read gsnpsid register right after de-assert reset, but controller is not ready yet and it returns gsnpsid 0. Adding small delay after de-assert reset solve the issue.
Retry with this fix more than 10 times without issue.
=> usb reset
resetting USB...
Bus usb at ffb40000: usb probe
SNPSID invalid (not DWC2 OTG device): 00000000
Port not available.
=> usb reset
resetting USB...
Bus usb at ffb40000: usb probe
scanning bus usb at ffb40000 for devices... 2 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found
--- drivers/usb/host/dwc2.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/host/dwc2.c +5 -0
@@ -1153,6 +1153,11 @@ static int dwc2_reset(struct udevice *dev)return ret; } +/* Certain controller takes some time to complete the reset, +* add small delay before access it. +*/ +udelay (5 ); +return 0 ; }
Signature · 1 line
2.19.0
PATCH 1/1 usb: dwc2: Add small delay after reset
Quoted 7 lines · Ley Foon Tan
In Cyclone 5 SoC platform, the first USB probing is failed but second probing is success. DWC2 driver read gsnpsid register right after de-assert reset, but controller is not ready yet and it returns gsnpsid 0. Adding small delay after de-assert reset solve the issue.
Retry with this fix more than 10 times without issue.
Quoted 10 lines
=> usb reset
resetting USB...
Bus usb atffb40000: usb probe
SNPSID invalid (not DWC2 OTG device): 00000000
Port not available.
=> usb reset
resetting USB...
Bus usb atffb40000: usb probe
scanning bus usb atffb40000for devices... 2 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found
Can't you poll for the readiness of the IP somehow instead of using arbitrary delay ?
Tan
PATCH 1/1 usb: dwc2: Add small delay after reset
Quoted 28 lines
-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Monday, December 23, 2019 7:59 PM
To: Tan, Ley Foon <[email protected]>; u-boot at lists.denx.de
Cc: Ley Foon Tan <[email protected]>; See, Chin Liang <[email protected]>; Chee, Tien Fong <[email protected]>
Subject: Re: [PATCH] usb: dwc2: Add small delay after resetQuoted 7 lines · Ley Foon Tan
In Cyclone 5 SoC platform, the first USB probing is failed but second probing is success. DWC2 driver read gsnpsid register right after de-assert reset, but controller is not ready yet and it returns gsnpsid 0. Adding small delay after de-assert reset solve the issue.
Retry with this fix more than 10 times without issue.
Quoted 9 lines
=> usb reset
resetting USB...
Bus usb atffb40000: usb probe
SNPSID invalid (not DWC2 OTG device): 00000000 Port not available. => usb reset
resetting USB...
Bus usb atffb40000: usb probe
scanning bus usb atffb40000for devices... 2 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found
Quoted 2 lines
Can't you poll for the readiness of the IP somehow instead of using arbitrary delay ?
One way we can do is calling to reset_status() to read back reset status. Will change that.
Regards
Ley Foon