* [PATCH 0/2] USB Storage quirk for SMI SM3350
@ 2018-12-27 14:34 Icenowy Zheng
2018-12-27 14:34 ` [PATCH 1/2] USB: storage: don't insert sane sense for SPC3+ when bad sense specified Icenowy Zheng
2018-12-27 14:34 ` [PATCH 2/2] USB: storage: add quirk for SMI SM3350 Icenowy Zheng
0 siblings, 2 replies; 6+ messages in thread
From: Icenowy Zheng @ 2018-12-27 14:34 UTC (permalink / raw)
To: Alan Stern, Greg Kroah-Hartman, linux-usb, usb-storage, linux-kernel
Cc: Icenowy Zheng
SMI SM3350 UFS-USB bridge controller cannot handle REQUEST SENSE command
with long sense (96-bytes) well, and will even trap the controller into
a state that refuses to do read/write command.
Currently Linux uncondintionally set US_FL_SANE_SENSE for devices
claiming SPC3+, which makes simply add US_FL_BAD_SENSE for SM3350 fail
(as it claims SPC4).
Fix this conflicting quirk issue, and add the quirk for SM3350.
Icenowy Zheng (2):
USB: storage: don't insert sane sense for SPC3+ when bad sense
specified
USB: storage: add quirk for SMI SM3350
drivers/usb/storage/scsiglue.c | 3 ++-
drivers/usb/storage/unusual_devs.h | 12 ++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
--
2.18.1
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/2] USB: storage: don't insert sane sense for SPC3+ when bad sense specified 2018-12-27 14:34 [PATCH 0/2] USB Storage quirk for SMI SM3350 Icenowy Zheng @ 2018-12-27 14:34 ` Icenowy Zheng 2018-12-27 14:38 ` Icenowy Zheng 2018-12-28 16:00 ` Alan Stern 2018-12-27 14:34 ` [PATCH 2/2] USB: storage: add quirk for SMI SM3350 Icenowy Zheng 1 sibling, 2 replies; 6+ messages in thread From: Icenowy Zheng @ 2018-12-27 14:34 UTC (permalink / raw) To: Alan Stern, Greg Kroah-Hartman, linux-usb, usb-storage, linux-kernel Cc: Icenowy Zheng Currently the code will set US_FL_SANE_SENSE flag unconditionally if device claims SPC3+, however we should allow US_FL_BAD_SENSE flag to prevent this behavior, because SMI SM3350 UFS-USB bridge controller, which claims SPC4, will show strange behavior with 96-byte sense (put the chip into a wrong state that cannot read/write anything). Check the presence of US_FL_BAD_SENSE when assuming US_FL_SANE_SENSE on SPC4+ devices. Signed-off-by: Icenowy Zheng <icenowy@aosc.io> --- drivers/usb/storage/scsiglue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index fde2e71a6ade..699fe9557127 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -236,7 +236,8 @@ static int slave_configure(struct scsi_device *sdev) sdev->try_rc_10_first = 1; /* assume SPC3 or latter devices support sense size > 18 */ - if (sdev->scsi_level > SCSI_SPC_2) + if (sdev->scsi_level > SCSI_SPC_2 && + !(us->fflags & US_FL_BAD_SENSE)) us->fflags |= US_FL_SANE_SENSE; /* -- 2.18.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] USB: storage: don't insert sane sense for SPC3+ when bad sense specified 2018-12-27 14:34 ` [PATCH 1/2] USB: storage: don't insert sane sense for SPC3+ when bad sense specified Icenowy Zheng @ 2018-12-27 14:38 ` Icenowy Zheng 2018-12-28 16:00 ` Alan Stern 1 sibling, 0 replies; 6+ messages in thread From: Icenowy Zheng @ 2018-12-27 14:38 UTC (permalink / raw) To: Alan Stern, Greg Kroah-Hartman, linux-usb, usb-storage, linux-kernel Cc: stable 在 2018-12-27四的 22:34 +0800,Icenowy Zheng写道: > Currently the code will set US_FL_SANE_SENSE flag unconditionally if > device claims SPC3+, however we should allow US_FL_BAD_SENSE flag to > prevent this behavior, because SMI SM3350 UFS-USB bridge controller, > which claims SPC4, will show strange behavior with 96-byte sense > (put the chip into a wrong state that cannot read/write anything). > > Check the presence of US_FL_BAD_SENSE when assuming US_FL_SANE_SENSE > on > SPC4+ devices. > > Signed-off-by: Icenowy Zheng <icenowy@aosc.io> > --- I forgot to: Cc: stable@vger.kernel.org > drivers/usb/storage/scsiglue.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/storage/scsiglue.c > b/drivers/usb/storage/scsiglue.c > index fde2e71a6ade..699fe9557127 100644 > --- a/drivers/usb/storage/scsiglue.c > +++ b/drivers/usb/storage/scsiglue.c > @@ -236,7 +236,8 @@ static int slave_configure(struct scsi_device > *sdev) > sdev->try_rc_10_first = 1; > > /* assume SPC3 or latter devices support sense size > > 18 */ > - if (sdev->scsi_level > SCSI_SPC_2) > + if (sdev->scsi_level > SCSI_SPC_2 && > + !(us->fflags & US_FL_BAD_SENSE)) > us->fflags |= US_FL_SANE_SENSE; > > /* ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] USB: storage: don't insert sane sense for SPC3+ when bad sense specified 2018-12-27 14:34 ` [PATCH 1/2] USB: storage: don't insert sane sense for SPC3+ when bad sense specified Icenowy Zheng 2018-12-27 14:38 ` Icenowy Zheng @ 2018-12-28 16:00 ` Alan Stern 1 sibling, 0 replies; 6+ messages in thread From: Alan Stern @ 2018-12-28 16:00 UTC (permalink / raw) To: Icenowy Zheng; +Cc: Greg Kroah-Hartman, linux-usb, usb-storage, linux-kernel On Thu, 27 Dec 2018, Icenowy Zheng wrote: > Currently the code will set US_FL_SANE_SENSE flag unconditionally if > device claims SPC3+, however we should allow US_FL_BAD_SENSE flag to > prevent this behavior, because SMI SM3350 UFS-USB bridge controller, > which claims SPC4, will show strange behavior with 96-byte sense > (put the chip into a wrong state that cannot read/write anything). > > Check the presence of US_FL_BAD_SENSE when assuming US_FL_SANE_SENSE on > SPC4+ devices. > > Signed-off-by: Icenowy Zheng <icenowy@aosc.io> > --- > drivers/usb/storage/scsiglue.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c > index fde2e71a6ade..699fe9557127 100644 > --- a/drivers/usb/storage/scsiglue.c > +++ b/drivers/usb/storage/scsiglue.c > @@ -236,7 +236,8 @@ static int slave_configure(struct scsi_device *sdev) > sdev->try_rc_10_first = 1; > > /* assume SPC3 or latter devices support sense size > 18 */ > - if (sdev->scsi_level > SCSI_SPC_2) > + if (sdev->scsi_level > SCSI_SPC_2 && > + !(us->fflags & US_FL_BAD_SENSE)) > us->fflags |= US_FL_SANE_SENSE; Please update the comment so that it matches the new code. Alan Stern ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] USB: storage: add quirk for SMI SM3350 2018-12-27 14:34 [PATCH 0/2] USB Storage quirk for SMI SM3350 Icenowy Zheng 2018-12-27 14:34 ` [PATCH 1/2] USB: storage: don't insert sane sense for SPC3+ when bad sense specified Icenowy Zheng @ 2018-12-27 14:34 ` Icenowy Zheng 2018-12-27 14:38 ` Icenowy Zheng 1 sibling, 1 reply; 6+ messages in thread From: Icenowy Zheng @ 2018-12-27 14:34 UTC (permalink / raw) To: Alan Stern, Greg Kroah-Hartman, linux-usb, usb-storage, linux-kernel Cc: Icenowy Zheng The SMI SM3350 USB-UFS bridge controller cannot handle long sense request correctly and will make the chip refuse to do read/write when requested long sense. Add a bad sense quirk for it. Signed-off-by: Icenowy Zheng <icenowy@aosc.io> --- drivers/usb/storage/unusual_devs.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index f7f83b21dc74..ea0d27a94afe 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h @@ -1265,6 +1265,18 @@ UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff, USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_FIX_CAPACITY ), +/* + * Reported by Icenowy Zheng <icenowy@aosc.io> + * The SMI SM3350 USB-UFS bridge controller will enter a wrong state + * that do not process read/write command if a long sense is requested, + * so force to use 18-byte sense. + */ +UNUSUAL_DEV( 0x090c, 0x3350, 0x0000, 0xffff, + "SMI", + "SM3350 UFS-to-USB-Mass-Storage bridge", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_BAD_SENSE ), + /* * Reported by Paul Hartman <paul.hartman+linux@gmail.com> * This card reader returns "Illegal Request, Logical Block Address -- 2.18.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] USB: storage: add quirk for SMI SM3350 2018-12-27 14:34 ` [PATCH 2/2] USB: storage: add quirk for SMI SM3350 Icenowy Zheng @ 2018-12-27 14:38 ` Icenowy Zheng 0 siblings, 0 replies; 6+ messages in thread From: Icenowy Zheng @ 2018-12-27 14:38 UTC (permalink / raw) To: Alan Stern, Greg Kroah-Hartman, linux-usb, usb-storage, linux-kernel Cc: stable 在 2018-12-27四的 22:34 +0800,Icenowy Zheng写道: > The SMI SM3350 USB-UFS bridge controller cannot handle long sense > request > correctly and will make the chip refuse to do read/write when > requested > long sense. > > Add a bad sense quirk for it. > > Signed-off-by: Icenowy Zheng <icenowy@aosc.io> > --- I forgot to: Cc: stable@vger.kernel.org > drivers/usb/storage/unusual_devs.h | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/usb/storage/unusual_devs.h > b/drivers/usb/storage/unusual_devs.h > index f7f83b21dc74..ea0d27a94afe 100644 > --- a/drivers/usb/storage/unusual_devs.h > +++ b/drivers/usb/storage/unusual_devs.h > @@ -1265,6 +1265,18 @@ UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff, > USB_SC_DEVICE, USB_PR_DEVICE, NULL, > US_FL_FIX_CAPACITY ), > > +/* > + * Reported by Icenowy Zheng <icenowy@aosc.io> > + * The SMI SM3350 USB-UFS bridge controller will enter a wrong state > + * that do not process read/write command if a long sense is > requested, > + * so force to use 18-byte sense. > + */ > +UNUSUAL_DEV( 0x090c, 0x3350, 0x0000, 0xffff, > + "SMI", > + "SM3350 UFS-to-USB-Mass-Storage bridge", > + USB_SC_DEVICE, USB_PR_DEVICE, NULL, > + US_FL_BAD_SENSE ), > + > /* > * Reported by Paul Hartman <paul.hartman+linux@gmail.com> > * This card reader returns "Illegal Request, Logical Block Address ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-12-28 16:00 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-12-27 14:34 [PATCH 0/2] USB Storage quirk for SMI SM3350 Icenowy Zheng 2018-12-27 14:34 ` [PATCH 1/2] USB: storage: don't insert sane sense for SPC3+ when bad sense specified Icenowy Zheng 2018-12-27 14:38 ` Icenowy Zheng 2018-12-28 16:00 ` Alan Stern 2018-12-27 14:34 ` [PATCH 2/2] USB: storage: add quirk for SMI SM3350 Icenowy Zheng 2018-12-27 14:38 ` Icenowy Zheng
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®