]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/ata/sata_sil.c
sata_sil: ignore and clear spurious IRQs while executing commands by polling
[karo-tx-linux.git] / drivers / ata / sata_sil.c
index c63dbabc0cd9637d73478a0044981660870c1498..baeb34404dbeb1e3caf69f0ee1d632616745d8ca 100644 (file)
@@ -116,20 +116,20 @@ static void sil_dev_config(struct ata_port *ap, struct ata_device *dev);
 static u32 sil_scr_read (struct ata_port *ap, unsigned int sc_reg);
 static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
 static void sil_post_set_mode (struct ata_port *ap);
-static irqreturn_t sil_interrupt(int irq, void *dev_instance,
-                                struct pt_regs *regs);
+static irqreturn_t sil_interrupt(int irq, void *dev_instance);
 static void sil_freeze(struct ata_port *ap);
 static void sil_thaw(struct ata_port *ap);
 
 
 static const struct pci_device_id sil_pci_tbl[] = {
-       { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 },
-       { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 },
-       { 0x1095, 0x3512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3512 },
-       { 0x1095, 0x3114, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3114 },
-       { 0x1002, 0x436e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 },
-       { 0x1002, 0x4379, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_no_sata_irq },
-       { 0x1002, 0x437a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_no_sata_irq },
+       { PCI_VDEVICE(CMD, 0x3112), sil_3112 },
+       { PCI_VDEVICE(CMD, 0x0240), sil_3112 },
+       { PCI_VDEVICE(CMD, 0x3512), sil_3512 },
+       { PCI_VDEVICE(CMD, 0x3114), sil_3114 },
+       { PCI_VDEVICE(ATI, 0x436e), sil_3112 },
+       { PCI_VDEVICE(ATI, 0x4379), sil_3112_no_sata_irq },
+       { PCI_VDEVICE(ATI, 0x437a), sil_3112_no_sata_irq },
+
        { }     /* terminate list */
 };
 
@@ -349,13 +349,14 @@ static u32 sil_scr_read (struct ata_port *ap, unsigned int sc_reg)
 
 static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
 {
-       void *mmio = (void __iomem *) sil_scr_addr(ap, sc_reg);
+       void __iomem *mmio = (void __iomem *) sil_scr_addr(ap, sc_reg);
        if (mmio)
                writel(val, mmio);
 }
 
 static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
 {
+       struct ata_eh_info *ehi = &ap->eh_info;
        struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag);
        u8 status;
 
@@ -382,9 +383,15 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
                goto freeze;
        }
 
-       if (unlikely(!qc || qc->tf.ctl & ATA_NIEN))
+       if (unlikely(!qc))
                goto freeze;
 
+       if (unlikely(qc->tf.flags & ATA_TFLAG_POLLING)) {
+               /* this sometimes happens, just clear IRQ */
+               ata_chk_status(ap);
+               return;
+       }
+
        /* Check whether we are expecting interrupt in this state */
        switch (ap->hsm_task_state) {
        case HSM_ST_FIRST:
@@ -428,6 +435,10 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
        /* kick HSM in the ass */
        ata_hsm_move(ap, qc, status, 0);
 
+       if (unlikely(qc->err_mask) && (qc->tf.protocol == ATA_PROT_DMA ||
+                                      qc->tf.protocol == ATA_PROT_ATAPI_DMA))
+               ata_ehi_push_desc(ehi, "BMDMA2 stat 0x%x", bmdma2);
+
        return;
 
  err_hsm:
@@ -436,8 +447,7 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
        ata_port_freeze(ap);
 }
 
-static irqreturn_t sil_interrupt(int irq, void *dev_instance,
-                                struct pt_regs *regs)
+static irqreturn_t sil_interrupt(int irq, void *dev_instance)
 {
        struct ata_host *host = dev_instance;
        void __iomem *mmio_base = host->mmio_base;
@@ -535,6 +545,7 @@ static void sil_thaw(struct ata_port *ap)
  */
 static void sil_dev_config(struct ata_port *ap, struct ata_device *dev)
 {
+       int print_info = ap->eh_context.i.flags & ATA_EHI_PRINTINFO;
        unsigned int n, quirks = 0;
        unsigned char model_num[41];
 
@@ -550,16 +561,18 @@ static void sil_dev_config(struct ata_port *ap, struct ata_device *dev)
        if (slow_down ||
            ((ap->flags & SIL_FLAG_MOD15WRITE) &&
             (quirks & SIL_QUIRK_MOD15WRITE))) {
-               ata_dev_printk(dev, KERN_INFO, "applying Seagate errata fix "
-                              "(mod15write workaround)\n");
+               if (print_info)
+                       ata_dev_printk(dev, KERN_INFO, "applying Seagate "
+                                      "errata fix (mod15write workaround)\n");
                dev->max_sectors = 15;
                return;
        }
 
        /* limit to udma5 */
        if (quirks & SIL_QUIRK_UDMA5MAX) {
-               ata_dev_printk(dev, KERN_INFO,
-                              "applying Maxtor errata fix %s\n", model_num);
+               if (print_info)
+                       ata_dev_printk(dev, KERN_INFO, "applying Maxtor "
+                                      "errata fix %s\n", model_num);
                dev->udma_mask &= ATA_UDMA5;
                return;
        }