aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2008-04-08 11:36:44 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-04-17 15:44:25 -0400
commitb93fda12357b3f1aa55cf69d8e088372788ea9ea (patch)
treebd7b68da74f8e2948c818891e8d45098bfbac802
parentf792068e43a3a156139569304b29ec8fc5dec4e3 (diff)
libata: Be a bit more slack about early devices
We have a certain number of 'ATA' emulations often on CF or other flash devices that are at best "loosely based" on the CF 1.1 standard. These devices report themselves as disk but don't support the ATA minimal command set only the CF 1.1 set. Relax the PIO checking for devices reporting ATA rev 0, or no iordy support, or CFA. Rework the code a bit as it was already messy and this made it quite ugly. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
-rw-r--r--drivers/ata/libata-core.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 2556ea29defb..733eb94d055e 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3132,16 +3132,21 @@ static int ata_dev_set_mode(struct ata_device *dev)
3132 if (rc) 3132 if (rc)
3133 return rc; 3133 return rc;
3134 3134
3135 /* Old CFA may refuse this command, which is just fine */ 3135 if (dev->xfer_shift == ATA_SHIFT_PIO) {
3136 if (dev->xfer_shift == ATA_SHIFT_PIO && ata_id_is_cfa(dev->id)) 3136 /* Old CFA may refuse this command, which is just fine */
3137 ign_dev_err = 1; 3137 if (ata_id_is_cfa(dev->id))
3138 3138 ign_dev_err = 1;
3139 /* Some very old devices and some bad newer ones fail any kind of 3139 /* Catch several broken garbage emulations plus some pre
3140 SET_XFERMODE request but support PIO0-2 timings and no IORDY */ 3140 ATA devices */
3141 if (dev->xfer_shift == ATA_SHIFT_PIO && !ata_id_has_iordy(dev->id) && 3141 if (ata_id_major_version(dev->id) == 0 &&
3142 dev->pio_mode <= XFER_PIO_2) 3142 dev->pio_mode <= XFER_PIO_2)
3143 ign_dev_err = 1; 3143 ign_dev_err = 1;
3144 3144 /* Some very old devices and some bad newer ones fail
3145 any kind of SET_XFERMODE request but support PIO0-2
3146 timings and no IORDY */
3147 if (!ata_id_has_iordy(dev->id) && dev->pio_mode <= XFER_PIO_2)
3148 ign_dev_err = 1;
3149 }
3145 /* Early MWDMA devices do DMA but don't allow DMA mode setting. 3150 /* Early MWDMA devices do DMA but don't allow DMA mode setting.
3146 Don't fail an MWDMA0 set IFF the device indicates it is in MWDMA0 */ 3151 Don't fail an MWDMA0 set IFF the device indicates it is in MWDMA0 */
3147 if (dev->xfer_shift == ATA_SHIFT_MWDMA && 3152 if (dev->xfer_shift == ATA_SHIFT_MWDMA &&