]> git.sur5r.net Git - u-boot/blobdiff - common/usb_storage.c
sdhci: Add sdhci support for spear devices
[u-boot] / common / usb_storage.c
index 2d92ee1bb3e95c5af8e6cc66ddcfa1c4aa61bac8..c5db044165c0a452f62245e9a0fd644a1f1ea631 100644 (file)
@@ -970,6 +970,16 @@ static int usb_test_unit_ready(ccb *srb, struct us_data *ss)
                        return 0;
                }
                usb_request_sense(srb, ss);
+               /*
+                * Check the Key Code Qualifier, if it matches
+                * "Not Ready - medium not present"
+                * (the sense Key equals 0x2 and the ASC is 0x3a)
+                * return immediately as the medium being absent won't change
+                * unless there is a user action.
+                */
+               if ((srb->sense_buf[2] == 0x02) &&
+                   (srb->sense_buf[12] == 0x3a))
+                       return -1;
                mdelay(100);
        } while (retries--);
 
@@ -1420,6 +1430,7 @@ int usb_stor_get_info(struct usb_device *dev, struct us_data *ss,
                        *capacity, *blksz);
        dev_desc->lba = *capacity;
        dev_desc->blksz = *blksz;
+       dev_desc->log2blksz = LOG2(dev_desc->blksz);
        dev_desc->type = perq;
        USB_STOR_PRINTF(" address %d\n", dev_desc->target);
        USB_STOR_PRINTF("partype: %d\n", dev_desc->part_type);