Merge git://oss.sgi.com:8090/xfs/xfs-2.6
[linux-drm-fsl-dcu.git] / drivers / ata / pata_qdi.c
index afc0d990e7d6debecea9da3768e39cdc5c2e8364..1b3b4ed8eb194b22a606007561e7bc6e0a2fab69 100644 (file)
@@ -131,22 +131,24 @@ static void qdi_data_xfer(struct ata_device *adev, unsigned char *buf, unsigned
 
        if (ata_id_has_dword_io(adev->id)) {
                if (write_data)
-                       outsl(ap->ioaddr.data_addr, buf, buflen >> 2);
+                       iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
                else
-                       insl(ap->ioaddr.data_addr, buf, buflen >> 2);
+                       ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
 
                if (unlikely(slop)) {
                        u32 pad;
                        if (write_data) {
                                memcpy(&pad, buf + buflen - slop, slop);
-                               outl(le32_to_cpu(pad), ap->ioaddr.data_addr);
+                               pad = le32_to_cpu(pad);
+                               iowrite32(pad, ap->ioaddr.data_addr);
                        } else {
-                               pad = cpu_to_le32(inl(ap->ioaddr.data_addr));
+                               pad = ioread32(ap->ioaddr.data_addr);
+                               pad = cpu_to_le32(pad);
                                memcpy(buf + buflen - slop, &pad, slop);
                        }
                }
        } else
-               ata_pio_data_xfer(adev, buf, buflen, write_data);
+               ata_data_xfer(adev, buf, buflen, write_data);
 }
 
 static struct scsi_host_template qdi_sht = {
@@ -189,10 +191,10 @@ static struct ata_port_operations qdi6500_port_ops = {
 
        .irq_handler    = ata_interrupt,
        .irq_clear      = ata_bmdma_irq_clear,
+       .irq_on         = ata_irq_on,
+       .irq_ack        = ata_irq_ack,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static struct ata_port_operations qdi6580_port_ops = {
@@ -217,10 +219,10 @@ static struct ata_port_operations qdi6580_port_ops = {
 
        .irq_handler    = ata_interrupt,
        .irq_clear      = ata_bmdma_irq_clear,
+       .irq_on         = ata_irq_on,
+       .irq_ack        = ata_irq_ack,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 /**
@@ -238,10 +240,9 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i
 {
        struct ata_probe_ent ae;
        struct platform_device *pdev;
+       void __iomem *io_addr, *ctl_addr;
        int ret;
 
-       unsigned long ctrl = io + 0x206;
-
        /*
         *      Fill in a probe structure first of all
         */
@@ -250,6 +251,12 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i
        if (IS_ERR(pdev))
                return PTR_ERR(pdev);
 
+       ret = -ENOMEM;
+       io_addr = devm_ioport_map(&pdev->dev, io, 8);
+       ctl_addr = devm_ioport_map(&pdev->dev, io + 0x206, 1);
+       if (!io_addr || !ctl_addr)
+               goto fail;
+
        memset(&ae, 0, sizeof(struct ata_probe_ent));
        INIT_LIST_HEAD(&ae.node);
        ae.dev = &pdev->dev;
@@ -267,9 +274,9 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i
        ae.irq = irq;
        ae.irq_flags = 0;
        ae.port_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST;
-       ae.port[0].cmd_addr = io;
-       ae.port[0].altstatus_addr = ctrl;
-       ae.port[0].ctl_addr =   ctrl;
+       ae.port[0].cmd_addr = io_addr;
+       ae.port[0].altstatus_addr = ctl_addr;
+       ae.port[0].ctl_addr = ctl_addr;
        ata_std_ports(&ae.port[0]);
 
        /*
@@ -282,14 +289,17 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i
        qdi_data[nr_qdi_host].platform_dev = pdev;
 
        printk(KERN_INFO DRV_NAME": qd%d at 0x%lx.\n", type, io);
-       ret = ata_device_add(&ae);
-       if (ret == 0) {
-               platform_device_unregister(pdev);
-               return -ENODEV;
-       }
+
+       ret = -ENODEV;
+       if (!ata_device_add(&ae))
+               goto fail;
 
        qdi_host[nr_qdi_host++] = dev_get_drvdata(&pdev->dev);
        return 0;
+
+ fail:
+       platform_device_unregister(pdev);
+       return ret;
 }
 
 /**
@@ -382,7 +392,7 @@ static __exit void qdi_exit(void)
        int i;
 
        for (i = 0; i < nr_qdi_host; i++) {
-               ata_host_remove(qdi_host[i]);
+               ata_host_detach(qdi_host[i]);
                /* Free the control resource. The 6580 dual channel has the resources
                 * claimed as a pair of 2 byte resources so we need no special cases...
                 */