summaryrefslogtreecommitdiff
path: root/common/usb.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2012-07-20 09:12:43 +0200
committerWolfgang Denk <wd@denx.de>2012-07-20 09:12:43 +0200
commit3ec81d758c09d6887a77a1b1259d044a2905bc8e (patch)
treef86e0095994be54d6a94c01c7dd5d977d56e0fce /common/usb.c
parentad8439d4645200b5a4f230dd07b73ae956b88c1e (diff)
parent1b4bd0e66cd3b5124669c78bc968510b1040e9d9 (diff)
Merge branch 'master' of git://git.denx.de/u-boot-usb
* 'master' of git://git.denx.de/u-boot-usb: usb_storage: fix ehci driver max transfer size smsc95xx: align buffers to cache line size ehci-hcd: change debug() to printf() in case of errors usb: check return value of submit_{control, bulk}_msg usb: pass cache-aligned buffer to usb_get_descriptor() ehci-hcd: fix external buffer cache handling ehci-hcd.c, musb_core, usb.h: Add USB_DMA_MINALIGN define for cache alignment ehci-hcd: program asynclistaddr before every transfer common.h: Introduce DEFINE_CACHE_ALIGN_BUFFER ehci-omap: Do not call dcache_off from omap_ehci_hcd_init Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'common/usb.c')
-rw-r--r--common/usb.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/common/usb.c b/common/usb.c
index c80155ce762..1b40228b288 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -188,7 +188,8 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe,
request, requesttype, value, index, size);
dev->status = USB_ST_NOT_PROC; /*not yet processed */
- submit_control_msg(dev, pipe, data, size, setup_packet);
+ if (submit_control_msg(dev, pipe, data, size, setup_packet) < 0)
+ return -1;
if (timeout == 0)
return (int)size;
@@ -220,7 +221,8 @@ int usb_bulk_msg(struct usb_device *dev, unsigned int pipe,
if (len < 0)
return -1;
dev->status = USB_ST_NOT_PROC; /*not yet processed */
- submit_bulk_msg(dev, pipe, data, len);
+ if (submit_bulk_msg(dev, pipe, data, len) < 0)
+ return -1;
while (timeout--) {
if (!((volatile unsigned long)dev->status & USB_ST_NOT_PROC))
break;
@@ -799,12 +801,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 +896,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 +906,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);