public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
To: linux-usb@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: [PATCH] Set manage_start_stop for some USB storage devices by default
Date: Mon, 2 Mar 2009 14:43:19 -0300	[thread overview]
Message-ID: <20090302174240.GA22206@vespa.holoscopio.com> (raw)

Hello,

Some time ago, I've worked with a Sandisk storage device, which could
not resume properly. I've found out that it was timing out when
receiving requests. I could mount it right after resuming, but using a
mounted device was not possible. Since this device is the only storage
present in some mobile, it is used as the root device and cannot be
unmounted.

I've thought this was a bug in the device itself and not a problem in
the bus or host controller, since other devices worked pretty well.
After doing some tests, I've realized that doing a rescan in the device
before accessing it worked. And setting manage_start_stop as true does
this automatically when resuming for us.

Thus, the patch below. I would like some comments about this particular
issue and, if the solution is acceptable, I will send a proper commit
log.

Best regards,
Cascardo.

---
 drivers/usb/storage/scsiglue.c     |    6 ++++++
 drivers/usb/storage/unusual_devs.h |    5 +++++
 include/linux/usb_usual.h          |    5 ++++-
 3 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 8daaace..b7ed288 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -123,6 +123,12 @@ static int slave_configure(struct scsi_device *sdev)
 {
 	struct us_data *us = host_to_us(sdev->host);
 
+	/* Some devices require that manage_start_stop be set up so they
+	 * can resume properly
+	 */
+	if (us->fflags & US_FL_MANAGE_START_STOP)
+		sdev->manage_start_stop = 1;
+
 	/* Many devices have trouble transfering more than 32KB at a time,
 	 * while others have trouble with more than 64K. At this time we
 	 * are limiting both to 32K (64 sectores).
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 729a256..7332c4d 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -1015,6 +1015,11 @@ UNUSUAL_DEV(  0x0781, 0x0200, 0x0000, 0x9999,
 		0),
 #endif
 
+UNUSUAL_DEV(  0x0781, 0x6500, 0x0000, 0xffff,
+		"Sandisk",
+		"uSSD 5000",
+		US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_MANAGE_START_STOP),
+
 #ifdef CONFIG_USB_STORAGE_FREECOM
 UNUSUAL_DEV(  0x07ab, 0xfc01, 0x0000, 0x9999,
 		"Freecom",
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index bd414ec..8c56127 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -54,7 +54,10 @@
 	US_FLAG(BULK_IGNORE_TAG,0x00004000)			\
 		/* Ignore tag mismatch in bulk operations */	\
 	US_FLAG(CAPACITY_OK,	0x00010000)			\
-		/* READ CAPACITY response is correct */
+		/* READ CAPACITY response is correct */		\
+	US_FLAG(MANAGE_START_STOP,	0x00020000)		\
+		/* manage_start_stop for the SCSI device */
+
 
 #define US_FLAG(name, value)	US_FL_##name = value ,
 enum { US_DO_ALL_FLAGS };
-- 
1.6.2.rc0

             reply	other threads:[~2009-03-02 17:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-02 17:43 Thadeu Lima de Souza Cascardo [this message]
     [not found] ` <20090302174240.GA22206-StA3NKSgq9XYLCA8tIpKU1aTQe2KTcn/@public.gmane.org>
2009-03-02 19:42   ` [PATCH] Set manage_start_stop for some USB storage devices by default Alan Stern
2009-03-02 19:52     ` Thadeu Lima de Souza Cascardo
2009-03-02 19:57       ` Alan Stern
     [not found]         ` <Pine.LNX.4.44L0.0903021452570.12723-100000-pYrvlCTfrz9XsRXLowluHWD2FQJk+8+b@public.gmane.org>
2009-03-02 21:31           ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090302174240.GA22206@vespa.holoscopio.com \
    --to=cascardo@holoscopio.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox