From mboxrd@z Thu Jan 1 00:00:00 1970 From: Puneet Saxena Date: Thu, 23 Feb 2012 19:55:26 +0530 Subject: [U-Boot] [PATCH 2/2] usb: Add quirk "USB_QUIRK_STRING_FETCH_255" In-Reply-To: <201202171224.00086.vapier@gentoo.org> References: <201202171224.00086.vapier@gentoo.org> Message-ID: <1330007126-16481-2-git-send-email-puneets@nvidia.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- 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