[U-Boot] [PATCH 2/2] usb: Add quirk "USB_QUIRK_STRING_FETCH_255"

Puneet Saxena puneets at nvidia.com
Thu Feb 23 15:25:26 CET 2012


Add a quirk "USB_QUIRK_STRING_FETCH_255", borrowed from Linux
kernel to fetch string using descriptor length then fetch actual bytes
returned in descriptor buffer.

Signed-off-by: Puneet Saxena <puneets at nvidia.com>
---
Changes for v2:
   - Add quirk for fetching actual bytes

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

diff --git a/common/usb.c b/common/usb.c
index 75926aa..cd85c18 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -660,7 +660,11 @@ static int usb_string_sub(struct usb_device *dev, unsigned int langid,
 
 	/* Try to read the string descriptor by asking for the maximum
 	 * possible number of bytes */
+#ifdef USB_QUIRK_STRING_FETCH_255
+	rc = -4;
+#else
 	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..51cc200 100644
--- a/include/configs/tegra2-common.h
+++ b/include/configs/tegra2-common.h
@@ -172,4 +172,11 @@
 
 #define CONFIG_TEGRA2_GPIO
 #define CONFIG_CMD_GPIO
+
+/*
+ * Imported the quirk from Linux kernel
+ */
+/* string descriptors must not be fetched using a 255-byte read */
+#define USB_QUIRK_STRING_FETCH_255	0x00000001
+
 #endif /* __TEGRA2_COMMON_H */
-- 
1.7.1



More information about the U-Boot mailing list