Make the timeout in musb_lowlevel_init() configurable from the 1s default.
Some USB memory sticks take longer than 1s to connect and so whilst
usable in Linux aren't usable in U-Boot. The default in Kconfig is still
1000ms, so this should be a non-change for any existing users.

Signed-off-by: Alex Kiernan <[email protected]>
---

 drivers/usb/musb-new/Kconfig      | 8 ++++++++
 drivers/usb/musb-new/musb_uboot.c | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/musb-new/Kconfig b/drivers/usb/musb-new/Kconfig
index f8f2205a62d3..5b9df5227961 100644
--- a/drivers/usb/musb-new/Kconfig
+++ b/drivers/usb/musb-new/Kconfig
@@ -54,6 +54,14 @@ config USB_MUSB_SUNXI
        Say y here to enable support for the sunxi OTG / DRC USB controller
        used on almost all sunxi boards.
 
+config USB_MUSB_INIT_TIMEOUT
+       int "Low level initialization timeout"
+       default 1000
+       help
+         The USB spec says it may take up to 1 second for a device to
+         connect. Some devices take longer than this to connect, so
+         you can increase the timeout here. The value here is in ms.
+
 endif
 
 config USB_MUSB_PIO_ONLY
diff --git a/drivers/usb/musb-new/musb_uboot.c 
b/drivers/usb/musb-new/musb_uboot.c
index d40772b1aa5c..82591ad8f6b5 100644
--- a/drivers/usb/musb-new/musb_uboot.c
+++ b/drivers/usb/musb-new/musb_uboot.c
@@ -214,7 +214,7 @@ int musb_lowlevel_init(struct musb_host_data *host)
 {
        void *mbase;
        /* USB spec says it may take up to 1 second for a device to connect */
-       unsigned long timeout = get_timer(0) + 1000;
+       unsigned long timeout = get_timer(0) + CONFIG_USB_MUSB_INIT_TIMEOUT;
        int ret;
 
        if (!host->host) {
-- 
2.17.1

_______________________________________________
U-Boot mailing list
[email protected]
https://lists.denx.de/listinfo/u-boot

Reply via email to