summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-01-15 10:31:00 -0500
committerTom Rini <trini@konsulko.com>2023-01-15 10:31:00 -0500
commit3311e35081406df4912af4ccec57a83d7b0cc635 (patch)
treef1746b715fc024bbc76d9197c89bc9a3e0dab193
parentfe4c21de4fbf5756d354d2473ffc675e7596ccfb (diff)
parent2383e8f4aec7a5087526d501478c4ba8235da2b4 (diff)
downloadu-boot-3311e35081406df4912af4ccec57a83d7b0cc635.tar.gz
Merge https://source.denx.de/u-boot/custodians/u-boot-usb
-rw-r--r--common/Kconfig12
-rw-r--r--common/usb_hub.c2
-rw-r--r--drivers/usb/gadget/dwc2_udc_otg.c9
-rw-r--r--drivers/usb/gadget/f_fastboot.c2
4 files changed, 23 insertions, 2 deletions
diff --git a/common/Kconfig b/common/Kconfig
index 73e3fe3657..439b2198f6 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1099,3 +1099,15 @@ config FDT_SIMPLEFB
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 95f1449b5c..f7fd12c045 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 77988f78ab..2bf7ed8d60 100644
--- a/drivers/usb/gadget/dwc2_udc_otg.c
+++ b/drivers/usb/gadget/dwc2_udc_otg.c
@@ -236,6 +236,14 @@ static int udc_enable(struct dwc2_udc *dev)
return 0;
}
+static int dwc2_gadget_pullup(struct usb_gadget *g, int is_on)
+{
+ clrsetbits_le32(&reg->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 void dwc2_fifo_flush(struct usb_ep *_ep)
}
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 c6e7f42407..6d97b4bbdc 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -421,6 +421,7 @@ static int fastboot_tx_write_str(const char *buffer)
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 @@ static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
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))