summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Yanok <ilya.yanok@cogentembedded.com>2012-07-15 04:43:50 +0000
committerMarek Vasut <marex@denx.de>2012-07-18 14:43:42 +0200
commit80ab414afdc9543686d8258dd7b933a410df3c4e (patch)
tree8118f0f5f6563c28f82617333e5ed2c6b9bb3c5f
parent189a6956ebbd7820afe5fa45a64ca495e6cefd9c (diff)
downloadu-boot-imx-80ab414afdc9543686d8258dd7b933a410df3c4e.zip
u-boot-imx-80ab414afdc9543686d8258dd7b933a410df3c4e.tar.gz
u-boot-imx-80ab414afdc9543686d8258dd7b933a410df3c4e.tar.bz2
usb: pass cache-aligned buffer to usb_get_descriptor()
usb_get_descriptor passes it's buffer argument directly to usb_control_msg() so it has to be properly aligned/padded. Signed-off-by: Ilya Yanok <ilya.yanok@cogentembedded.com>
-rw-r--r--common/usb.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/usb.c b/common/usb.c
index c80155c..46f4741 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -799,12 +799,13 @@ int usb_new_device(struct usb_device *dev)
dev->epmaxpacketin[0] = 8;
dev->epmaxpacketout[0] = 8;
- err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor, 8);
+ err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, tmpbuf, 8);
if (err < 8) {
printf("\n USB device not responding, " \
"giving up (status=%lX)\n", dev->status);
return 1;
}
+ memcpy(&dev->descriptor, tmpbuf, 8);
#else
/* This is a Windows scheme of initialization sequence, with double
* reset of the device (Linux uses the same sequence)
@@ -893,7 +894,7 @@ int usb_new_device(struct usb_device *dev)
tmp = sizeof(dev->descriptor);
err = usb_get_descriptor(dev, USB_DT_DEVICE, 0,
- &dev->descriptor, sizeof(dev->descriptor));
+ tmpbuf, sizeof(dev->descriptor));
if (err < tmp) {
if (err < 0)
printf("unable to get device descriptor (error=%d)\n",
@@ -903,6 +904,7 @@ int usb_new_device(struct usb_device *dev)
"(expected %i, got %i)\n", tmp, err);
return 1;
}
+ memcpy(&dev->descriptor, tmpbuf, sizeof(dev->descriptor));
/* correct le values */
le16_to_cpus(&dev->descriptor.bcdUSB);
le16_to_cpus(&dev->descriptor.idVendor);