From: Ley Foon Tan Date: Mon, 23 Dec 2019 16:07:32 +0800 Subject: [PATCH] usb: dwc2: Add small delay after reset Message-ID: <1577088452-3684-1-git-send-email-ley.foon.tan@intel.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 Signed-off-by: Ley Foon Tan --- drivers/usb/host/dwc2.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c index b9c56f763b..cbbef19201 100644 --- a/drivers/usb/host/dwc2.c +++ b/drivers/usb/host/dwc2.c @@ -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; } -- 2.19.0