Merge https://source.denx.de/u-boot/custodians/u-boot-usb
diff --git a/common/Kconfig b/common/Kconfig
index 73e3fe3..439b219 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1099,3 +1099,15 @@
config IO_TRACE
bool
+
+config USB_HUB_DEBOUNCE_TIMEOUT
+ int "Timeout in milliseconds for USB HUB connection"
+ depends on USB
+ default 1000
+ help
+ Value in milliseconds of the USB connection timeout, the max delay to
+ wait the hub port status to be connected steadily after being powered
+ off and powered on in the usb hub driver.
+ This define allows to increase the HUB_DEBOUNCE_TIMEOUT default
+ value = 1s because some usb device needs around 1.5s to be initialized
+ and a 2s value should solve detection issue on problematic USB keys.
diff --git a/common/usb_hub.c b/common/usb_hub.c
index 95f1449..f7fd12c 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -47,7 +47,7 @@
#define HUB_SHORT_RESET_TIME 20
#define HUB_LONG_RESET_TIME 200
-#define HUB_DEBOUNCE_TIMEOUT 1000
+#define HUB_DEBOUNCE_TIMEOUT CONFIG_USB_HUB_DEBOUNCE_TIMEOUT
#define PORT_OVERCURRENT_MAX_SCAN_COUNT 3
diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c
index 77988f7..2bf7ed8 100644
--- a/drivers/usb/gadget/dwc2_udc_otg.c
+++ b/drivers/usb/gadget/dwc2_udc_otg.c
@@ -236,6 +236,14 @@
return 0;
}
+static int dwc2_gadget_pullup(struct usb_gadget *g, int is_on)
+{
+ clrsetbits_le32(®->dctl, SOFT_DISCONNECT,
+ is_on ? 0 : SOFT_DISCONNECT);
+
+ return 0;
+}
+
#if !CONFIG_IS_ENABLED(DM_USB_GADGET)
/*
Register entry point for the peripheral controller driver.
@@ -805,6 +813,7 @@
}
static const struct usb_gadget_ops dwc2_udc_ops = {
+ .pullup = dwc2_gadget_pullup,
/* current versions must always be self-powered */
#if CONFIG_IS_ENABLED(DM_USB_GADGET)
.udc_start = dwc2_gadget_start,
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index c6e7f42..6d97b4b 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -421,6 +421,7 @@
static void compl_do_reset(struct usb_ep *ep, struct usb_request *req)
{
+ g_dnl_unregister();
do_reset(NULL, 0, 0, NULL);
}
@@ -542,7 +543,6 @@
case FASTBOOT_COMMAND_REBOOT_FASTBOOTD:
case FASTBOOT_COMMAND_REBOOT_RECOVERY:
fastboot_func->in_req->complete = compl_do_reset;
- g_dnl_trigger_detach();
break;
case FASTBOOT_COMMAND_ACMD:
if (CONFIG_IS_ENABLED(FASTBOOT_UUU_SUPPORT))