]> err.no Git - linux-2.6/blobdiff - drivers/ata/sata_sil.c
Pull bugzilla-9535 into release branch
[linux-2.6] / drivers / ata / sata_sil.c
index 802d679dc994654512f058f0b025586ad150bc58..f5119bf40c24f0e9e65219208e2fd65a47137e1f 100644 (file)
@@ -111,7 +111,7 @@ enum {
        SIL_QUIRK_UDMA5MAX      = (1 << 1),
 };
 
-static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
+static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
 #ifdef CONFIG_PM
 static int sil_pci_device_resume(struct pci_dev *pdev);
 #endif
@@ -138,7 +138,7 @@ static const struct pci_device_id sil_pci_tbl[] = {
 
 /* TODO firmware versions should be added - eric */
 static const struct sil_drivelist {
-       const char * product;
+       const char *product;
        unsigned int quirk;
 } sil_blacklist [] = {
        { "ST320012AS",         SIL_QUIRK_MOD15WRITE },
@@ -186,7 +186,6 @@ static struct scsi_host_template sil_sht = {
 };
 
 static const struct ata_port_operations sil_ops = {
-       .port_disable           = ata_port_disable,
        .dev_config             = sil_dev_config,
        .tf_load                = ata_tf_load,
        .tf_read                = ata_tf_read,
@@ -207,7 +206,6 @@ static const struct ata_port_operations sil_ops = {
        .post_internal_cmd      = ata_bmdma_post_internal_cmd,
        .irq_clear              = ata_bmdma_irq_clear,
        .irq_on                 = ata_irq_on,
-       .irq_ack                = ata_irq_ack,
        .scr_read               = sil_scr_read,
        .scr_write              = sil_scr_write,
        .port_start             = ata_port_start,
@@ -281,7 +279,7 @@ MODULE_LICENSE("GPL");
 MODULE_DEVICE_TABLE(pci, sil_pci_tbl);
 MODULE_VERSION(DRV_VERSION);
 
-static int slow_down = 0;
+static int slow_down;
 module_param(slow_down, int, 0444);
 MODULE_PARM_DESC(slow_down, "Sledgehammer used to work around random problems, by limiting commands to 15 sectors (0=off, 1=on)");
 
@@ -334,7 +332,8 @@ static int sil_set_mode(struct ata_link *link, struct ata_device **r_failed)
        return 0;
 }
 
-static inline void __iomem *sil_scr_addr(struct ata_port *ap, unsigned int sc_reg)
+static inline void __iomem *sil_scr_addr(struct ata_port *ap,
+                                        unsigned int sc_reg)
 {
        void __iomem *offset = ap->ioaddr.scr_addr;
 
@@ -391,23 +390,19 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
                sil_scr_read(ap, SCR_ERROR, &serror);
                sil_scr_write(ap, SCR_ERROR, serror);
 
-               /* Trigger hotplug and accumulate SError only if the
-                * port isn't already frozen.  Otherwise, PHY events
-                * during hardreset makes controllers with broken SIEN
-                * repeat probing needlessly.
+               /* Sometimes spurious interrupts occur, double check
+                * it's PHYRDY CHG.
                 */
-               if (!(ap->pflags & ATA_PFLAG_FROZEN)) {
-                       ata_ehi_hotplugged(&ap->link.eh_info);
+               if (serror & SERR_PHYRDY_CHG) {
                        ap->link.eh_info.serror |= serror;
+                       goto freeze;
                }
 
-               goto freeze;
+               if (!(bmdma2 & SIL_DMA_COMPLETE))
+                       return;
        }
 
-       if (unlikely(!qc))
-               goto freeze;
-
-       if (unlikely(qc->tf.flags & ATA_TFLAG_POLLING)) {
+       if (unlikely(!qc || (qc->tf.flags & ATA_TFLAG_POLLING))) {
                /* this sometimes happens, just clear IRQ */
                ata_chk_status(ap);
                return;
@@ -645,7 +640,7 @@ static void sil_init_controller(struct ata_host *host)
        }
 }
 
-static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
+static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
        static int printed_version;
        int board_id = ent->driver_data;
@@ -689,7 +684,8 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        mmio_base = host->iomap[SIL_MMIO_BAR];
 
        for (i = 0; i < host->n_ports; i++) {
-               struct ata_ioports *ioaddr = &host->ports[i]->ioaddr;
+               struct ata_port *ap = host->ports[i];
+               struct ata_ioports *ioaddr = &ap->ioaddr;
 
                ioaddr->cmd_addr = mmio_base + sil_port[i].tf;
                ioaddr->altstatus_addr =
@@ -697,6 +693,9 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
                ioaddr->bmdma_addr = mmio_base + sil_port[i].bmdma;
                ioaddr->scr_addr = mmio_base + sil_port[i].scr;
                ata_std_ports(ioaddr);
+
+               ata_port_pbar_desc(ap, SIL_MMIO_BAR, -1, "mmio");
+               ata_port_pbar_desc(ap, SIL_MMIO_BAR, sil_port[i].tf, "tf");
        }
 
        /* initialize and activate */