Merge branches 'release', 'asus', 'sony-laptop' and 'thinkpad' into release
[pandora-kernel.git] / drivers / ata / pata_cs5520.c
index 6bf037d..7ed279b 100644 (file)
@@ -41,7 +41,7 @@
 #include <linux/libata.h>
 
 #define DRV_NAME       "pata_cs5520"
-#define DRV_VERSION    "0.6.5"
+#define DRV_VERSION    "0.6.6"
 
 struct pio_clocks
 {
@@ -158,7 +158,6 @@ static struct scsi_host_template cs5520_sht = {
 };
 
 static struct ata_port_operations cs5520_port_ops = {
-       .port_disable           = ata_port_disable,
        .set_piomode            = cs5520_set_piomode,
        .set_dmamode            = cs5520_set_dmamode,
 
@@ -184,13 +183,14 @@ static struct ata_port_operations cs5520_port_ops = {
 
        .irq_clear              = ata_bmdma_irq_clear,
        .irq_on                 = ata_irq_on,
-       .irq_ack                = ata_irq_ack,
 
-       .port_start             = ata_port_start,
+       .port_start             = ata_sff_port_start,
 };
 
 static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 {
+       static const unsigned int cmd_port[] = { 0x1F0, 0x170 };
+       static const unsigned int ctl_port[] = { 0x3F6, 0x376 };
        struct ata_port_info pi = {
                .flags          = ATA_FLAG_SLAVE_POSS,
                .pio_mask       = 0x1f,
@@ -198,7 +198,7 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
        };
        const struct ata_port_info *ppi[2];
        u8 pcicfg;
-       void *iomap[5];
+       void __iomem *iomap[5];
        struct ata_host *host;
        struct ata_ioports *ioaddr;
        int i, rc;
@@ -229,7 +229,7 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
                return -ENOMEM;
 
        /* Perform set up for DMA */
-       if (pci_enable_device_bars(pdev, 1<<2)) {
+       if (pci_enable_device_io(pdev)) {
                printk(KERN_ERR DRV_NAME ": unable to configure BAR2.\n");
                return -ENODEV;
        }
@@ -244,10 +244,10 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
        }
 
        /* Map IO ports and initialize host accordingly */
-       iomap[0] = devm_ioport_map(&pdev->dev, 0x1F0, 8);
-       iomap[1] = devm_ioport_map(&pdev->dev, 0x3F6, 1);
-       iomap[2] = devm_ioport_map(&pdev->dev, 0x170, 8);
-       iomap[3] = devm_ioport_map(&pdev->dev, 0x376, 1);
+       iomap[0] = devm_ioport_map(&pdev->dev, cmd_port[0], 8);
+       iomap[1] = devm_ioport_map(&pdev->dev, ctl_port[0], 1);
+       iomap[2] = devm_ioport_map(&pdev->dev, cmd_port[1], 8);
+       iomap[3] = devm_ioport_map(&pdev->dev, ctl_port[1], 1);
        iomap[4] = pcim_iomap(pdev, 2, 0);
 
        if (!iomap[0] || !iomap[1] || !iomap[2] || !iomap[3] || !iomap[4])
@@ -260,6 +260,10 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
        ioaddr->bmdma_addr = iomap[4];
        ata_std_ports(ioaddr);
 
+       ata_port_desc(host->ports[0],
+                     "cmd 0x%x ctl 0x%x", cmd_port[0], ctl_port[0]);
+       ata_port_pbar_desc(host->ports[0], 4, 0, "bmdma");
+
        ioaddr = &host->ports[1]->ioaddr;
        ioaddr->cmd_addr = iomap[2];
        ioaddr->ctl_addr = iomap[3];
@@ -267,6 +271,10 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
        ioaddr->bmdma_addr = iomap[4] + 8;
        ata_std_ports(ioaddr);
 
+       ata_port_desc(host->ports[1],
+                     "cmd 0x%x ctl 0x%x", cmd_port[1], ctl_port[1]);
+       ata_port_pbar_desc(host->ports[1], 4, 8, "bmdma");
+
        /* activate the host */
        pci_set_master(pdev);
        rc = ata_host_start(host);
@@ -275,7 +283,7 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
 
        for (i = 0; i < 2; i++) {
                static const int irq[] = { 14, 15 };
-               struct ata_port *ap = host->ports[0];
+               struct ata_port *ap = host->ports[i];
 
                if (ata_port_is_dummy(ap))
                        continue;
@@ -285,33 +293,12 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
                if (rc)
                        return rc;
 
-               if (i == 0)
-                       host->irq = irq[0];
-               else
-                       host->irq2 = irq[1];
+               ata_port_desc(ap, "irq %d", irq[i]);
        }
 
        return ata_host_register(host, &cs5520_sht);
 }
 
-/**
- *     cs5520_remove_one       -       device unload
- *     @pdev: PCI device being removed
- *
- *     Handle an unplug/unload event for a PCI device. Unload the
- *     PCI driver but do not use the default handler as we manage
- *     resources ourself and *MUST NOT* disable the device as it has
- *     other functions.
- */
-
-static void __devexit cs5520_remove_one(struct pci_dev *pdev)
-{
-       struct device *dev = pci_dev_to_dev(pdev);
-       struct ata_host *host = dev_get_drvdata(dev);
-
-       ata_host_detach(host);
-}
-
 #ifdef CONFIG_PM
 /**
  *     cs5520_reinit_one       -       device resume
@@ -368,7 +355,7 @@ static struct pci_driver cs5520_pci_driver = {
        .name           = DRV_NAME,
        .id_table       = pata_cs5520,
        .probe          = cs5520_init_one,
-       .remove         = cs5520_remove_one,
+       .remove         = ata_pci_remove_one,
 #ifdef CONFIG_PM
        .suspend        = cs5520_pci_device_suspend,
        .resume         = cs5520_reinit_one,