From 2b2f744a8d68e4e820e84f7c4c4cbdff928fb3de Mon Sep 17 00:00:00 2001 From: Sham Muthayyan Date: Thu, 8 Aug 2019 17:01:13 +0530 Subject: [PATCH] ipq807x: Add delay for Get descriptor REQUEST SUMMARY Setup Data 8006000200000900 Direction Device-to-host Type Standard Recipient Device bRequest GET_DESCRIPTOR wValue CONFIGURATION, Index 0 wIndex 0x0000 wLength 0x0009 DECODING INFORMATION Field Length(bits) Offset(bits) Decoded HexValue Description bRequest 8 8 GET_DESCRIPTOR 0x06 bRequest HexVal: 0x06 wValue 16 16 CONFIGURATION type, Index 0 0x0200 Type of Descriptor wIndex 16 32 0x0000 0x0000 index info DEVICE_QUALIFIER Descriptor(128 bytes) Field Length(bits) Offset(bits) Decoded HexValue Description bLength 8 0 0x80 0x80 Descriptor size is 128 bytes bDescriptorType 8 8 0x06 0x06 DEVICE_QUALIFIER Descriptor Type bcdUSB 16 16 0x0200 0x0200 USB Specification version 2.00 bDeviceClass 8 32 0x00 0x00 Each interface specifies its own class information bDeviceSubClass 8 40 0x00 0x00 Each interface specifies its own Subclass information bDeviceProtocol 8 48 0x09 0x09 Protocol code = 9 bMaxPacketSize0 8 56 0x00 0x00 The Maximum packet size 0 for endpoint zero is invalid! (Only 8,16,32,or 64 are valid) bNumConfigurations 8 64 0x09 0x09 The device has 9 possible other-speed configurations The Transcend device fails for get configuration descriptor length. Adding a delay fixes the issue. Change-Id: Ic337e94e6342163e57e652781544709d0c32edcc Signed-off-by: Sham Muthayyan --- common/usb.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/common/usb.c b/common/usb.c index 9f67cc1e8e..b3aff89724 100644 --- a/common/usb.c +++ b/common/usb.c @@ -43,6 +43,9 @@ #define USB_BUFSIZ 512 +#define TRANSCEND_USB_VENDOR_ID 0x8564 +#define TRANSCEND_USB_PRODUCT_ID 0x1000 + static int asynch_allowed; char usb_started; /* flag for the started/stopped USB status */ @@ -1088,8 +1091,20 @@ int usb_select_config(struct usb_device *dev) le16_to_cpus(&dev->descriptor.idProduct); le16_to_cpus(&dev->descriptor.bcdDevice); + /*The Transcend device fails for get configuration length. Adding + delay about 10 micro secs to fix this.*/ + if (dev->descriptor.idVendor == TRANSCEND_USB_VENDOR_ID && + dev->descriptor.idProduct == TRANSCEND_USB_PRODUCT_ID) + udelay(10); /* only support for one config for now */ err = usb_get_configuration_len(dev, 0); + + /*The Transcend device fails for get configuration number. Adding + delay about 10 micro secs to fix this.*/ + if (dev->descriptor.idVendor == TRANSCEND_USB_VENDOR_ID && + dev->descriptor.idProduct == TRANSCEND_USB_PRODUCT_ID) + udelay(10); + if (err >= 0) { tmpbuf = (unsigned char *)malloc_cache_aligned(err); if (!tmpbuf)