diff mbox series

Add quirk to support DJI CineSSD

Message ID 1533851734-3598-1-git-send-email-tsa@biglakesoftware.com (mailing list archive)
State New, archived
Headers show
Series Add quirk to support DJI CineSSD | expand

Commit Message

Tim Anderson Aug. 9, 2018, 9:55 p.m. UTC
This device does not correctly handle the LPM operations.

Also, the device cannot handle ATA pass-through commands
and locks up when attempted while running in super speed.

This patch adds the equivalent quirk logic as found in uas.

Signed-off-by: Tim Anderson <tsa@biglakesoftware.com>
---
 drivers/usb/core/quirks.c          | 3 +++
 drivers/usb/storage/scsiglue.c     | 9 +++++++++
 drivers/usb/storage/unusual_devs.h | 7 +++++++
 3 files changed, 19 insertions(+)

Comments

Alan Stern Aug. 10, 2018, 2:33 p.m. UTC | #1
On Thu, 9 Aug 2018, Tim Anderson wrote:

> This device does not correctly handle the LPM operations.
> 
> Also, the device cannot handle ATA pass-through commands
> and locks up when attempted while running in super speed.

In theory, we could allow ATA pass-through when running at high speed.  
But we don't currently have any way to express this, and I doubt it is 
worth the effort.

> This patch adds the equivalent quirk logic as found in uas.
> 
> Signed-off-by: Tim Anderson <tsa@biglakesoftware.com>
> ---
>  drivers/usb/core/quirks.c          | 3 +++
>  drivers/usb/storage/scsiglue.c     | 9 +++++++++
>  drivers/usb/storage/unusual_devs.h | 7 +++++++
>  3 files changed, 19 insertions(+)
> 
> diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
> index 097057d..560ce25 100644
> --- a/drivers/usb/core/quirks.c
> +++ b/drivers/usb/core/quirks.c
> @@ -406,6 +406,9 @@ static const struct usb_device_id usb_quirk_list[] = {
>  	{ USB_DEVICE(0x2040, 0x7200), .driver_info =
>  			USB_QUIRK_CONFIG_INTF_STRINGS },
>  
> +	/* DJI CineSSD */
> +	{ USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
> +
>  	/* INTEL VALUE SSD */
>  	{ USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
>  
> diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
> index c267f28..e227bb5 100644
> --- a/drivers/usb/storage/scsiglue.c
> +++ b/drivers/usb/storage/scsiglue.c
> @@ -376,6 +376,15 @@ static int queuecommand_lck(struct scsi_cmnd *srb,
>  		return 0;
>  	}
>  
> +	if ((us->fflags & US_FL_NO_ATA_1X) &&
> +			(srb->cmnd[0] == ATA_12 || srb->cmnd[0] == ATA_16)) {
> +		memcpy(srb->sense_buffer, usb_stor_sense_invalidCDB,
> +		       sizeof(usb_stor_sense_invalidCDB));
> +		srb->result = SAM_STAT_CHECK_CONDITION;
> +		done(srb);
> +		return 0;
> +	}
> +
>  	/* enqueue the command and wake up the control thread */
>  	srb->scsi_done = done;
>  	us->srb = srb;
> diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
> index 22fcfcc..f7f83b21 100644
> --- a/drivers/usb/storage/unusual_devs.h
> +++ b/drivers/usb/storage/unusual_devs.h
> @@ -2288,6 +2288,13 @@ UNUSUAL_DEV(  0x2735, 0x100b, 0x0000, 0x9999,
>  		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
>  		US_FL_GO_SLOW ),
>  
> +/* Reported-by: Tim Anderson <tsa@biglakesoftware.com> */
> +UNUSUAL_DEV(  0x2ca3, 0x0031, 0x0000, 0x9999,
> +		"DJI",
> +		"CineSSD",
> +		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
> +		US_FL_NO_ATA_1X),
> +
>  /*
>   * Reported by Frederic Marchal <frederic.marchal@wowcompany.com>
>   * Mio Moov 330

Acked-by: Alan Stern <stern@rowland.harvard.edu>
diff mbox series

Patch

diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index 097057d..560ce25 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -406,6 +406,9 @@  static const struct usb_device_id usb_quirk_list[] = {
 	{ USB_DEVICE(0x2040, 0x7200), .driver_info =
 			USB_QUIRK_CONFIG_INTF_STRINGS },
 
+	/* DJI CineSSD */
+	{ USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
+
 	/* INTEL VALUE SSD */
 	{ USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
 
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index c267f28..e227bb5 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -376,6 +376,15 @@  static int queuecommand_lck(struct scsi_cmnd *srb,
 		return 0;
 	}
 
+	if ((us->fflags & US_FL_NO_ATA_1X) &&
+			(srb->cmnd[0] == ATA_12 || srb->cmnd[0] == ATA_16)) {
+		memcpy(srb->sense_buffer, usb_stor_sense_invalidCDB,
+		       sizeof(usb_stor_sense_invalidCDB));
+		srb->result = SAM_STAT_CHECK_CONDITION;
+		done(srb);
+		return 0;
+	}
+
 	/* enqueue the command and wake up the control thread */
 	srb->scsi_done = done;
 	us->srb = srb;
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 22fcfcc..f7f83b21 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -2288,6 +2288,13 @@  UNUSUAL_DEV(  0x2735, 0x100b, 0x0000, 0x9999,
 		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
 		US_FL_GO_SLOW ),
 
+/* Reported-by: Tim Anderson <tsa@biglakesoftware.com> */
+UNUSUAL_DEV(  0x2ca3, 0x0031, 0x0000, 0x9999,
+		"DJI",
+		"CineSSD",
+		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+		US_FL_NO_ATA_1X),
+
 /*
  * Reported by Frederic Marchal <frederic.marchal@wowcompany.com>
  * Mio Moov 330