summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2015-05-05 23:56:04 +0200
committerSimon Glass <sjg@chromium.org>2015-05-06 08:46:56 -0600
commit2b338ef41127351089254b748de5cefd95c3e800 (patch)
tree10f3488e386e2832d68acd6bc133713862eb3945 /common
parentcb8a2c148a55adfd0f07e723eedbc4ef95e8226d (diff)
usb: Fix maxpacketsize for first descriptor read for low-speed usb devs
This fixes descriptor reading of lowspeed devices through ohci not working. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Marek Vasut <marex@denx.de>
Diffstat (limited to 'common')
-rw-r--r--common/usb.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/common/usb.c b/common/usb.c
index a4820d3e94..1b26bfab36 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -946,13 +946,18 @@ static int usb_setup_descriptor(struct usb_device *dev, bool do_read)
* send 64-byte GET-DEVICE-DESCRIPTOR request. Since the descriptor is
* only 18 bytes long, this will terminate with a short packet. But if
* the maxpacket size is 8 or 16 the device may be waiting to transmit
- * some more, or keeps on retransmitting the 8 byte header. */
+ * some more, or keeps on retransmitting the 8 byte header.
+ */
- dev->descriptor.bMaxPacketSize0 = 64; /* Start off at 64 bytes */
- /* Default to 64 byte max packet size */
- dev->maxpacketsize = PACKET_SIZE_64;
- dev->epmaxpacketin[0] = 64;
- dev->epmaxpacketout[0] = 64;
+ if (dev->speed == USB_SPEED_LOW) {
+ dev->descriptor.bMaxPacketSize0 = 8;
+ dev->maxpacketsize = PACKET_SIZE_8;
+ } else {
+ dev->descriptor.bMaxPacketSize0 = 64;
+ dev->maxpacketsize = PACKET_SIZE_64;
+ }
+ dev->epmaxpacketin[0] = dev->descriptor.bMaxPacketSize0;
+ dev->epmaxpacketout[0] = dev->descriptor.bMaxPacketSize0;
if (do_read) {
int err;