Merge branch 'for-3.20/drivers' of git://git.kernel.dk/linux-block
[linux-drm-fsl-dcu.git] / drivers / ata / libata-scsi.c
index 59c9d721b347ca859b510da449bcf203e5baf6bf..b061ba2c31d8f51408a15f2e019a3c328e882815 100644 (file)
@@ -1995,8 +1995,8 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)
 
        VPRINTK("ENTER\n");
 
-       /* set scsi removeable (RMB) bit per ata bit */
-       if (ata_id_removeable(args->id))
+       /* set scsi removable (RMB) bit per ata bit */
+       if (ata_id_removable(args->id))
                hdr[1] |= (1 << 7);
 
        if (args->dev->class == ATA_DEV_ZAC) {
@@ -2532,13 +2532,15 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf)
                rbuf[15] = lowest_aligned;
 
                if (ata_id_has_trim(args->id)) {
-                       rbuf[14] |= 0x80; /* TPE */
+                       rbuf[14] |= 0x80; /* LBPME */
 
-                       if (ata_id_has_zero_after_trim(args->id))
-                               rbuf[14] |= 0x40; /* TPRZ */
+                       if (ata_id_has_zero_after_trim(args->id) &&
+                           dev->horkage & ATA_HORKAGE_ZERO_AFTER_TRIM) {
+                               ata_dev_info(dev, "Enabling discard_zeroes_data\n");
+                               rbuf[14] |= 0x40; /* LBPRZ */
+                       }
                }
        }
-
        return 0;
 }
 
@@ -4238,7 +4240,10 @@ int ata_sas_allocate_tag(struct ata_port *ap)
        unsigned int i, tag;
 
        for (i = 0, tag = ap->sas_last_tag + 1; i < max_queue; i++, tag++) {
-               tag = tag < max_queue ? tag : 0;
+               if (ap->flags & ATA_FLAG_LOWTAG)
+                       tag = 1;
+               else
+                       tag = tag < max_queue ? tag : 0;
 
                /* the last tag is reserved for internal command. */
                if (tag == ATA_TAG_INTERNAL)