summaryrefslogtreecommitdiffstats
path: root/configs/platform-v7a/patches/barebox-2021.04.0/0001-usb-dwc2-increase-timeout-for-waiting-on-host-mode.patch
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2021-04-21 09:38:20 +0200
committerRobert Schwebel <r.schwebel@pengutronix.de>2021-04-23 12:57:52 +0200
commit18eaac17bf76f5b1cba0ee5ca42137b23047f476 (patch)
tree213c7c81840664057d7e4998f5963007d0ad92ab /configs/platform-v7a/patches/barebox-2021.04.0/0001-usb-dwc2-increase-timeout-for-waiting-on-host-mode.patch
parent22cf9785f7921ce59ec17c5efca219634fff12b3 (diff)
downloadDistroKit-18eaac17bf76f5b1cba0ee5ca42137b23047f476.tar.gz
DistroKit-18eaac17bf76f5b1cba0ee5ca42137b23047f476.tar.xz
v7a: barebox: version bump v2021.02.0 → v2021.04.0
Updating to v2021.04.0 lets us drop the patches we have, but unfortunately we need to import a new patch in return to fix a USB/Ethernet breakage on barebox-rpi2. Kconfig changes are those produced by oldconfig, except for the following: - BTHREAD: new feature that's not used by default, but could use some extra coverage. Enable it for all configuration, except for am335x-mlo, where we have a restrictive size limitation. - MACH_STM32MP15X_EV1: The EV1 is the full featured STM32MP1 evaluation kit. In preperation for supporting this, enable its newly added barebox support. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.pengutronix.de/20210421073820.1318-1-a.fatoum@pengutronix.de Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Diffstat (limited to 'configs/platform-v7a/patches/barebox-2021.04.0/0001-usb-dwc2-increase-timeout-for-waiting-on-host-mode.patch')
-rw-r--r--configs/platform-v7a/patches/barebox-2021.04.0/0001-usb-dwc2-increase-timeout-for-waiting-on-host-mode.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/configs/platform-v7a/patches/barebox-2021.04.0/0001-usb-dwc2-increase-timeout-for-waiting-on-host-mode.patch b/configs/platform-v7a/patches/barebox-2021.04.0/0001-usb-dwc2-increase-timeout-for-waiting-on-host-mode.patch
new file mode 100644
index 0000000..06908ca
--- /dev/null
+++ b/configs/platform-v7a/patches/barebox-2021.04.0/0001-usb-dwc2-increase-timeout-for-waiting-on-host-mode.patch
@@ -0,0 +1,67 @@
+From 91d5f4dfeaa72957bb8349c8af2da36a615b05a4 Mon Sep 17 00:00:00 2001
+From: Ahmad Fatoum <a.fatoum@pengutronix.de>
+Date: Wed, 21 Apr 2021 09:27:04 +0200
+Subject: [PATCH master] usb: dwc2: increase timeout for waiting on host mode
+
+Commit 26459ab7803a ("usb: dwc2: Rework wait for host mode during
+core reset") effectively reduced the timeout on switch to host mode
+from 200ms to 110 us, which is insufficient for the IP on the Raspberry
+Pi 3b, leading to:
+
+ dwc2 3f980000.usb@7e980000.of: dwc2_wait_for_mode: Couldn't set host mode
+
+and an unusable USB (and Ethernet) after.
+
+Bump up the timeout to 200ms and help future debugging by logging how
+much time it actually took. For the Raspberry 3b I got a value of 49ms.
+
+Note that this is also called from dwc2_force_mode, so worst case is
+that a stuck IP delays barebox startup by 200ms.
+An error message would alert to this fact, so it can be corrected.
+
+Fixes: 26459ab7803a ("usb: dwc2: Rework wait for host mode during core reset")
+Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
+Link: https://lore.pengutronix.de/20210421072704.520-1-a.fatoum@pengutronix.de
+---
+ drivers/usb/dwc2/core.c | 20 ++++++++++++--------
+ 1 file changed, 12 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
+index 5d04a07b0393..7813344ffa65 100644
+--- a/drivers/usb/dwc2/core.c
++++ b/drivers/usb/dwc2/core.c
+@@ -688,19 +688,23 @@ int dwc2_get_dr_mode(struct dwc2 *dwc2)
+ */
+ void dwc2_wait_for_mode(struct dwc2 *dwc2, bool host_mode)
+ {
+- unsigned int timeout = 110 * USECOND;
+- int ret;
++ unsigned int timeout = 200 * MSECOND;
++ uint64_t start;
+
+ dev_vdbg(dwc2->dev, "Waiting for %s mode\n",
+ host_mode ? "host" : "device");
+
+- ret = wait_on_timeout(timeout, dwc2_is_host_mode(dwc2) == host_mode);
+- if (ret)
+- dev_err(dwc2->dev, "%s: Couldn't set %s mode\n",
+- __func__, host_mode ? "host" : "device");
++ start = get_time_ns();
++ while (dwc2_is_host_mode(dwc2) != host_mode) {
++ if (is_timeout(start, timeout)) {
++ dev_err(dwc2->dev, "%s: Couldn't set %s mode\n",
++ __func__, host_mode ? "host" : "device");
++ return;
++ }
++ }
+
+- dev_vdbg(dwc2->dev, "%s mode set\n",
+- host_mode ? "Host" : "Device");
++ dev_vdbg(dwc2->dev, "%s mode set after %lluns\n",
++ host_mode ? "Host" : "Device", get_time_ns() - start);
+ }
+
+ /**
+--
+2.29.2
+