Add "CONFIG_USB_STRING_FETCH" to fetch first string descriptor length
and then pass this length to fetch string descriptor.

Signed-off-by: Puneet Saxena <pune...@nvidia.com>
---

Changes for V2:
   - Change existing config by "CONFIG_USB_STRING_FETCH"

Changes for V3:
    - Removed extra new line
    - Explained "CONFIG_USB_STRING_FETCH" in top level README

 README                          |    4 ++++
 common/usb.c                    |    4 ++++
 include/configs/tegra2-common.h |    2 ++
 3 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/README b/README
index 7adf7c7..c045a37 100644
--- a/README
+++ b/README
@@ -1138,6 +1138,10 @@ The following options need to be configured:
                CONFIG_USB_EHCI_TXFIFO_THRESH enables setting of the
                txfilltuning field in the EHCI controller on reset.
 
+               CONFIG_USB_STRING_FETCH
+               Enables settings to USB core to handle string issues which
+               few devices can not handle.
+
 - USB Device:
                Define the below if you wish to use the USB console.
                Once firmware is rebuilt from a serial console issue the
diff --git a/common/usb.c b/common/usb.c
index 191bc5b..a73cb60 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -658,9 +658,13 @@ static int usb_string_sub(struct usb_device *dev, unsigned 
int langid,
 {
        int rc;
 
+#ifdef CONFIG_USB_STRING_FETCH
+       rc = -1;
+#else
        /* Try to read the string descriptor by asking for the maximum
         * possible number of bytes */
        rc = usb_get_string(dev, langid, index, buf, 255);
+#endif
 
        /* If that failed try to read the descriptor length, then
         * ask for just that many bytes */
diff --git a/include/configs/tegra2-common.h b/include/configs/tegra2-common.h
index 266d0e5..d20b49c 100644
--- a/include/configs/tegra2-common.h
+++ b/include/configs/tegra2-common.h
@@ -93,6 +93,8 @@
 #define CONFIG_USB_EHCI_TXFIFO_THRESH  10
 #define CONFIG_EHCI_IS_TDI
 #define CONFIG_EHCI_DCACHE
+/* string descriptors must not be fetched using a 255-byte read */
+#define CONFIG_USB_STRING_FETCH
 
 /* include default commands */
 #include <config_cmd_default.h>
-- 
1.7.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to