summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut+renesas@gmail.com>2019-10-05 19:18:38 +0200
committerMarek Vasut <marek.vasut+renesas@gmail.com>2019-10-31 12:13:40 +0100
commitda3d1c499fbb7cfe1c1dc1bc47699a2f30df4384 (patch)
tree0a444d2d03b34a97440efd236450e3979da19972 /common
parent7d6fd7f0ba71cd93d94079132f958d9630f27a89 (diff)
downloadu-boot-da3d1c499fbb7cfe1c1dc1bc47699a2f30df4384.tar.gz
u-boot-da3d1c499fbb7cfe1c1dc1bc47699a2f30df4384.tar.bz2
u-boot-da3d1c499fbb7cfe1c1dc1bc47699a2f30df4384.zip
usb: storage: Only clear READY flag on error
Clear the USB_READY flag in the storage driver only in case there is an error, otherwise usb_stor_BBB_transport() waits 5 mS before doing anything every single time. This is because the USB_READY flag is only ever set in usb_test_unit_ready(), which is called only upon storage device probe, not between each and every request. However, the device cannot move out of USB_READY state once it was initialized. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Bin Meng <bmeng.cn@gmail.com> Cc: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/usb_storage.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/common/usb_storage.c b/common/usb_storage.c
index 337c4e1fbd..097b6729c1 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -1180,6 +1180,7 @@ retry_it:
srb->pdata = (unsigned char *)buf_addr;
if (usb_read_10(srb, ss, start, smallblks)) {
debug("Read ERROR\n");
+ ss->flags &= ~USB_READY;
usb_request_sense(srb, ss);
if (retry--)
goto retry_it;
@@ -1190,7 +1191,6 @@ retry_it:
blks -= smallblks;
buf_addr += srb->datalen;
} while (blks != 0);
- ss->flags &= ~USB_READY;
debug("usb_read: end startblk " LBAF ", blccnt %x buffer %lx\n",
start, smallblks, buf_addr);
@@ -1265,6 +1265,7 @@ retry_it:
srb->pdata = (unsigned char *)buf_addr;
if (usb_write_10(srb, ss, start, smallblks)) {
debug("Write ERROR\n");
+ ss->flags &= ~USB_READY;
usb_request_sense(srb, ss);
if (retry--)
goto retry_it;
@@ -1275,7 +1276,6 @@ retry_it:
blks -= smallblks;
buf_addr += srb->datalen;
} while (blks != 0);
- ss->flags &= ~USB_READY;
debug("usb_write: end startblk " LBAF ", blccnt %x buffer %lx\n",
start, smallblks, buf_addr);
@@ -1470,10 +1470,10 @@ int usb_stor_get_info(struct usb_device *dev, struct us_data *ss,
memset(pccb->pdata, 0, 8);
if (usb_read_capacity(pccb, ss) != 0) {
printf("READ_CAP ERROR\n");
+ ss->flags &= ~USB_READY;
cap[0] = 2880;
cap[1] = 0x200;
}
- ss->flags &= ~USB_READY;
debug("Read Capacity returns: 0x%08x, 0x%08x\n", cap[0], cap[1]);
#if 0
if (cap[0] > (0x200000 * 10)) /* greater than 10 GByte */