usb: storage: add support for write cache quirk
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / usb / storage / scsiglue.c
index a324a5d..a3d5436 100644 (file)
@@ -202,6 +202,12 @@ static int slave_configure(struct scsi_device *sdev)
                if (us->fflags & US_FL_NO_READ_CAPACITY_16)
                        sdev->no_read_capacity_16 = 1;
 
+               /*
+                * Many devices do not respond properly to READ_CAPACITY_16.
+                * Tell the SCSI layer to try READ_CAPACITY_10 first.
+                */
+               sdev->try_rc_10_first = 1;
+
                /* assume SPC3 or latter devices support sense size > 18 */
                if (sdev->scsi_level > SCSI_SPC_2)
                        us->fflags |= US_FL_SANE_SENSE;
@@ -230,6 +236,11 @@ static int slave_configure(struct scsi_device *sdev)
                                        US_FL_SCM_MULT_TARG)) &&
                                us->protocol == USB_PR_BULK)
                        us->use_last_sector_hacks = 1;
+
+               /* Check if write cache default on flag is set or not */
+               if (us->fflags & US_FL_WRITE_CACHE)
+                       sdev->wce_default_on = 1;
+
        } else {
 
                /* Non-disk-type devices don't need to blacklist any pages