Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0bc2a79a2002e3cc1b514c100b6c576983da6a90
Commit:     0bc2a79a2002e3cc1b514c100b6c576983da6a90
Parent:     e3667ebf857ba744b5211c90d46f6a17dd9a2479
Author:     Alan Cox <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 31 14:01:48 2007 +0100
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Fri Oct 12 14:55:32 2007 -0400

    libata: Correct IORDY handling
    
    Debugging a report of a problem with an ancient solid state disk showed
    up some problems in the IORDY handling
    
    1.  We check the wrong bit to see if the device has IORDY
    2.  Even then some ancient creaking piles of crap don't support
        SETXFER at all.
    
    The cases it fixes are obscure and the risk of side effects is slight
    but possible. This also moves us slightly closer to supporting original
    MFM/RLL disks with libata.
    
    Signed-off-by: Alan Cox <[EMAIL PROTECTED]>
    Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/ata/libata-core.c |    6 +++++-
 include/linux/ata.h       |    2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 8a79b97..02425e4 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2759,7 +2759,11 @@ static int ata_dev_set_mode(struct ata_device *dev)
        /* Old CFA may refuse this command, which is just fine */
        if (dev->xfer_shift == ATA_SHIFT_PIO && ata_id_is_cfa(dev->id))
                err_mask &= ~AC_ERR_DEV;
-
+       /* Some very old devices and some bad newer ones fail any kind of
+          SET_XFERMODE request but support PIO0-2 timings and no IORDY */
+       if (dev->xfer_shift == ATA_SHIFT_PIO && !ata_id_has_iordy(dev->id) &&
+                       dev->pio_mode <= XFER_PIO_2)
+               err_mask &= ~AC_ERR_DEV;
        if (err_mask) {
                ata_dev_printk(dev, KERN_ERR, "failed to set xfermode "
                               "(err_mask=0x%x)\n", err_mask);
diff --git a/include/linux/ata.h b/include/linux/ata.h
index c043c1c..40c7af0 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -358,7 +358,7 @@ struct ata_taskfile {
 #define ata_id_removeable(id)  ((id)[0] & (1 << 7))
 #define ata_id_has_dword_io(id)        ((id)[50] & (1 << 0))
 #define ata_id_iordy_disable(id) ((id)[49] & (1 << 10))
-#define ata_id_has_iordy(id) ((id)[49] & (1 << 9))
+#define ata_id_has_iordy(id) ((id)[49] & (1 << 11))
 #define ata_id_u32(id,n)       \
        (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)]))
 #define ata_id_u64(id,n)       \
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to