mfd: Add pm8xxx irq support
[linux-2.6.git] / drivers / ata / sata_vsc.c
index 8045a72..7c98737 100644 (file)
@@ -98,20 +98,22 @@ enum {
                              VSC_SATA_INT_PHY_CHANGE),
 };
 
-static int vsc_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
+static int vsc_sata_scr_read(struct ata_link *link,
+                            unsigned int sc_reg, u32 *val)
 {
        if (sc_reg > SCR_CONTROL)
                return -EINVAL;
-       *val = readl(ap->ioaddr.scr_addr + (sc_reg * 4));
+       *val = readl(link->ap->ioaddr.scr_addr + (sc_reg * 4));
        return 0;
 }
 
 
-static int vsc_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
+static int vsc_sata_scr_write(struct ata_link *link,
+                             unsigned int sc_reg, u32 val)
 {
        if (sc_reg > SCR_CONTROL)
                return -EINVAL;
-       writel(val, ap->ioaddr.scr_addr + (sc_reg * 4));
+       writel(val, link->ap->ioaddr.scr_addr + (sc_reg * 4));
        return 0;
 }
 
@@ -200,7 +202,7 @@ static void vsc_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
        struct ata_ioports *ioaddr = &ap->ioaddr;
        u16 nsect, lbal, lbam, lbah, feature;
 
-       tf->command = ata_check_status(ap);
+       tf->command = ata_sff_check_status(ap);
        tf->device = readw(ioaddr->device_addr);
        feature = readw(ioaddr->error_addr);
        nsect = readw(ioaddr->nsect_addr);
@@ -243,7 +245,7 @@ static void vsc_port_intr(u8 port_status, struct ata_port *ap)
 
        qc = ata_qc_from_tag(ap, ap->link.active_tag);
        if (qc && likely(!(qc->tf.flags & ATA_TFLAG_POLLING)))
-               handled = ata_host_intr(ap, qc);
+               handled = ata_bmdma_port_intr(ap, qc);
 
        /* We received an interrupt during a polled command,
         * or some other spurious condition.  Interrupt reporting
@@ -251,7 +253,7 @@ static void vsc_port_intr(u8 port_status, struct ata_port *ap)
         * simply clear the interrupt
         */
        if (unlikely(!handled))
-               ata_chk_status(ap);
+               ap->ops->sff_check_status(ap);
 }
 
 /*
@@ -282,14 +284,8 @@ static irqreturn_t vsc_sata_interrupt(int irq, void *dev_instance)
        for (i = 0; i < host->n_ports; i++) {
                u8 port_status = (status >> (8 * i)) & 0xff;
                if (port_status) {
-                       struct ata_port *ap = host->ports[i];
-
-                       if (ap && !(ap->flags & ATA_FLAG_DISABLED)) {
-                               vsc_port_intr(port_status, ap);
-                               handled++;
-                       } else
-                               dev_printk(KERN_ERR, host->dev,
-                                       "interrupt from disabled port %d\n", i);
+                       vsc_port_intr(port_status, host->ports[i]);
+                       handled++;
                }
        }
 
@@ -306,8 +302,11 @@ static struct scsi_host_template vsc_sata_sht = {
 
 static struct ata_port_operations vsc_sata_ops = {
        .inherits               = &ata_bmdma_port_ops,
-       .tf_load                = vsc_sata_tf_load,
-       .tf_read                = vsc_sata_tf_read,
+       /* The IRQ handling is not quite standard SFF behaviour so we
+          cannot use the default lost interrupt handler */
+       .lost_interrupt         = ATA_OP_NULL,
+       .sff_tf_load            = vsc_sata_tf_load,
+       .sff_tf_read            = vsc_sata_tf_read,
        .freeze                 = vsc_freeze,
        .thaw                   = vsc_thaw,
        .scr_read               = vsc_sata_scr_read,
@@ -341,10 +340,9 @@ static int __devinit vsc_sata_init_one(struct pci_dev *pdev,
                                       const struct pci_device_id *ent)
 {
        static const struct ata_port_info pi = {
-               .flags          = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
-                                 ATA_FLAG_MMIO,
-               .pio_mask       = 0x1f,
-               .mwdma_mask     = 0x07,
+               .flags          = ATA_FLAG_SATA,
+               .pio_mask       = ATA_PIO4,
+               .mwdma_mask     = ATA_MWDMA2,
                .udma_mask      = ATA_UDMA6,
                .port_ops       = &vsc_sata_ops,
        };
@@ -371,7 +369,7 @@ static int __devinit vsc_sata_init_one(struct pci_dev *pdev,
        if (pci_resource_len(pdev, 0) == 0)
                return -ENODEV;
 
-       /* map IO regions and intialize host accordingly */
+       /* map IO regions and initialize host accordingly */
        rc = pcim_iomap_regions(pdev, 1 << VSC_MMIO_BAR, DRV_NAME);
        if (rc == -EBUSY)
                pcim_pin_device(pdev);
@@ -394,10 +392,10 @@ static int __devinit vsc_sata_init_one(struct pci_dev *pdev,
        /*
         * Use 32 bit DMA mask, because 64 bit address support is poor.
         */
-       rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
+       rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
        if (rc)
                return rc;
-       rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
+       rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
        if (rc)
                return rc;