[PATCH] usb: Fix USB read configuration error on some devices

Ronan Dalton ronan.dalton at alliedtelesis.co.nz
Fri Feb 20 05:47:09 CET 2026


The following error sometimes occurs on PNY USB sticks:

  => usb start
  starting USB...
  USB XHCI 1.00
  WARN endpoint is halted
  WARN endpoint is halted
  usb_new_device: Cannot read configuration, skipping device 154b:6000
  Bus usb3 at 500000: 1 USB Device(s) found
         scanning usb for storage devices... 0 Storage Device(s) found

Note that this USB stick works correctly in Linux but not in u-boot.

Work around this quirk by adding a small delay before calling
usb_get_configuration_no, which it would fail in otherwise (with the
error code -EINVAL).

Signed-off-by: Ronan Dalton <ronan.dalton at alliedtelesis.co.nz>
Cc: Marek Vasut <marex at denx.de>
Cc: Philip Oberfichtner <pro at denx.de>
---
 common/usb.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/common/usb.c b/common/usb.c
index 6a4ad346f4b..00d051edec5 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -1197,10 +1197,17 @@ int usb_select_config(struct usb_device *dev)
 	err = usb_get_configuration_len(dev, 0);
 	if (err >= 0) {
 		tmpbuf = (unsigned char *)malloc_cache_aligned(err);
-		if (!tmpbuf)
+		if (!tmpbuf) {
 			err = -ENOMEM;
-		else
+		} else {
+			/*
+			 * PNY 32GB USB 2.0 flash drives seem to require an
+			 * additional delay before getting the next descriptor.
+			 */
+			mdelay(1);
+
 			err = usb_get_configuration_no(dev, 0, tmpbuf, err);
+		}
 	}
 	if (err < 0) {
 		printf("usb_new_device: Cannot read configuration, " \
-- 
2.53.0



More information about the U-Boot mailing list