summaryrefslogtreecommitdiff
path: root/common/usb_storage.c
diff options
context:
space:
mode:
authorTom Wai-Hong Tam <waihong@chromium.org>2011-03-22 14:01:50 +0800
committerSimon Glass <sjg@chromium.org>2011-08-24 09:56:46 -0700
commit65bc17b32ce0906ff4d9cc5560b45269545a202c (patch)
treedf214711f1b411cc4fe8a49e2daeb5354925ac5a /common/usb_storage.c
parenteb8430bab0ce7af39642417923f93760f9828901 (diff)
No retry for USB storage to speed up the resume time.
In the scenario, a user inserts a USB storage and boots to recovery mode, we required the user to plug the USB out first. However, in the meantime that the system is scanning the USB, the user plugs it out. It may need ~50sec to resume because there are many retry there. This change makes it no retry such that it only takes <1sec to resume. R=clchiou@chromium.org,sjg@chromium.org BUG=chromium-os:10500 TEST=emerge-tegra2_seaboard chromeos-u-boot-next successfully. When the system is scanning the USB storage, plug the USB out. It takes <1sec to resume. Review URL: http://codereview.chromium.org/6685083 Change-Id: I7d002a879bc8f93ccc354b5fc4a28b55a88276d1 Reviewed-on: http://gerrit.chromium.org/gerrit/397 Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/usb_storage.c')
-rw-r--r--common/usb_storage.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/common/usb_storage.c b/common/usb_storage.c
index 9ecf165d1a..8f8c476e14 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -123,6 +123,12 @@ typedef struct {
} umass_bbb_csw_t;
#define UMASS_BBB_CSW_SIZE 13
+#ifdef CONFIG_USB_STOR_NO_RETRY
+#define RETRIES(x) 1
+#else
+#define RETRIES(x) (x)
+#endif
+
#define USB_MAX_STOR_DEV 5
static int usb_max_devs; /* number of highest available usb device */
@@ -902,8 +908,8 @@ do_retry:
static int usb_inquiry(ccb *srb, struct us_data *ss)
{
- int retry, i;
- retry = 5;
+ int retry = RETRIES(5), i;
+
do {
memset(&srb->cmd[0], 0, 12);
srb->cmd[0] = SCSI_INQUIRY;
@@ -946,7 +952,8 @@ static int usb_request_sense(ccb *srb, struct us_data *ss)
static int usb_test_unit_ready(ccb *srb, struct us_data *ss)
{
- int retries = 10;
+ int retry = RETRIES(10);
+ int result;
do {
memset(&srb->cmd[0], 0, 12);
@@ -958,16 +965,15 @@ static int usb_test_unit_ready(ccb *srb, struct us_data *ss)
return 0;
usb_request_sense(srb, ss);
wait_ms(100);
- } while (retries--);
+ } while (retry--);
return -1;
}
static int usb_read_capacity(ccb *srb, struct us_data *ss)
{
- int retry;
- /* XXX retries */
- retry = 3;
+ int retry = RETRIES(3);
+
do {
memset(&srb->cmd[0], 0, 12);
srb->cmd[0] = SCSI_RD_CAPAC;