lantiq: 4.19: increase usb reset timeouts
[openwrt/staging/rmilecki.git] / target / linux / lantiq / patches-4.19 / 0002-usb-dwc2-use-a-longer-AHB-idle-timeout-in-dwc2_core_.patch
1 From bfe92b01cafebb10f0d7f38dceb37433687b7887 Mon Sep 17 00:00:00 2001
2 From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
3 Date: Thu, 20 Jun 2019 19:50:22 +0200
4 Subject: [PATCH] usb: dwc2: use a longer AHB idle timeout in dwc2_core_reset()
5
6 Use a 10000us AHB idle timeout in dwc2_core_reset() and make it
7 consistent with the other "wait for AHB master IDLE state" ocurrences.
8
9 This fixes a problem for me where dwc2 would not want to initialize when
10 updating to 4.19 on a MIPS Lantiq VRX200 SoC. dwc2 worked fine with
11 4.14.
12 Testing on my board shows that it takes 180us until AHB master IDLE
13 state is signalled. The very old vendor driver for this SoC (ifxhcd)
14 used a 1 second timeout.
15 Use the same timeout that is used everywhere when polling for
16 GRSTCTL_AHBIDLE instead of using a timeout that "works for one board"
17 (180us in my case) to have consistent behavior across the dwc2 driver.
18
19 Cc: linux-stable <stable@vger.kernel.org> # 4.19+
20 Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
21 ---
22 drivers/usb/dwc2/core.c | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
24
25 --- a/drivers/usb/dwc2/core.c
26 +++ b/drivers/usb/dwc2/core.c
27 @@ -531,7 +531,7 @@ int dwc2_core_reset(struct dwc2_hsotg *h
28 }
29
30 /* Wait for AHB master IDLE state */
31 - if (dwc2_hsotg_wait_bit_set(hsotg, GRSTCTL, GRSTCTL_AHBIDLE, 50)) {
32 + if (dwc2_hsotg_wait_bit_set(hsotg, GRSTCTL, GRSTCTL_AHBIDLE, 10000)) {
33 dev_warn(hsotg->dev, "%s: HANG! AHB Idle timeout GRSTCTL GRSTCTL_AHBIDLE\n",
34 __func__);
35 return -EBUSY;