Merge master.kernel.org:/home/rmk/linux-2.6-arm
[sfrench/cifs-2.6.git] / drivers / ata / pata_ixp4xx_cf.c
index 23b8aab3ebd8f876fff754736cb0b18bad8f1b7d..c6f0e192755156523ccb3cb93cf84e656c2833fe 100644 (file)
 #include <scsi/scsi_host.h>
 
 #define DRV_NAME       "pata_ixp4xx_cf"
-#define DRV_VERSION    "0.1.1ac1"
+#define DRV_VERSION    "0.1.2"
 
-static int ixp4xx_set_mode(struct ata_port *ap, struct ata_device *adev)
+static int ixp4xx_set_mode(struct ata_port *ap, struct ata_device **error)
 {
        int i;
 
        for (i = 0; i < ATA_MAX_DEVICES; i++) {
                struct ata_device *dev = &ap->device[i];
-               if (ata_dev_enabled(dev)) {
+               if (ata_dev_ready(dev)) {
+                       ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n");
                        dev->pio_mode = XFER_PIO_0;
                        dev->xfer_mode = XFER_PIO_0;
                        dev->xfer_shift = ATA_SHIFT_PIO;
@@ -95,14 +96,6 @@ static void ixp4xx_irq_clear(struct ata_port *ap)
 {
 }
 
-static void ixp4xx_host_stop (struct ata_host *host)
-{
-       struct ixp4xx_pata_data *data = host->dev->platform_data;
-
-       iounmap(data->cs0);
-       iounmap(data->cs1);
-}
-
 static struct scsi_host_template ixp4xx_sht = {
        .module                 = THIS_MODULE,
        .name                   = DRV_NAME,
@@ -139,10 +132,10 @@ static struct ata_port_operations ixp4xx_port_ops = {
 
        .irq_handler    = ata_interrupt,
        .irq_clear      = ixp4xx_irq_clear,
+       .irq_on         = ata_irq_on,
+       .irq_ack        = ata_irq_ack,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ixp4xx_host_stop,
 
        .phy_reset      = ixp4xx_phy_reset,
 };
@@ -150,9 +143,9 @@ static struct ata_port_operations ixp4xx_port_ops = {
 static void ixp4xx_setup_port(struct ata_ioports *ioaddr,
                                struct ixp4xx_pata_data *data)
 {
-       ioaddr->cmd_addr        = (unsigned long) data->cs0;
-       ioaddr->altstatus_addr  = (unsigned long) data->cs1 + 0x06;
-       ioaddr->ctl_addr        = (unsigned long) data->cs1 + 0x06;
+       ioaddr->cmd_addr        = data->cs0;
+       ioaddr->altstatus_addr  = data->cs1 + 0x06;
+       ioaddr->ctl_addr        = data->cs1 + 0x06;
 
        ata_std_ports(ioaddr);
 
@@ -162,19 +155,19 @@ static void ixp4xx_setup_port(struct ata_ioports *ioaddr,
         * ixp4xx in little endian mode.
         */
 
-       ioaddr->data_addr       ^= 0x02;
-       ioaddr->cmd_addr        ^= 0x03;
-       ioaddr->altstatus_addr  ^= 0x03;
-       ioaddr->ctl_addr        ^= 0x03;
-       ioaddr->error_addr      ^= 0x03;
-       ioaddr->feature_addr    ^= 0x03;
-       ioaddr->nsect_addr      ^= 0x03;
-       ioaddr->lbal_addr       ^= 0x03;
-       ioaddr->lbam_addr       ^= 0x03;
-       ioaddr->lbah_addr       ^= 0x03;
-       ioaddr->device_addr     ^= 0x03;
-       ioaddr->status_addr     ^= 0x03;
-       ioaddr->command_addr    ^= 0x03;
+       *(unsigned long *)&ioaddr->data_addr            ^= 0x02;
+       *(unsigned long *)&ioaddr->cmd_addr             ^= 0x03;
+       *(unsigned long *)&ioaddr->altstatus_addr       ^= 0x03;
+       *(unsigned long *)&ioaddr->ctl_addr             ^= 0x03;
+       *(unsigned long *)&ioaddr->error_addr           ^= 0x03;
+       *(unsigned long *)&ioaddr->feature_addr         ^= 0x03;
+       *(unsigned long *)&ioaddr->nsect_addr           ^= 0x03;
+       *(unsigned long *)&ioaddr->lbal_addr            ^= 0x03;
+       *(unsigned long *)&ioaddr->lbam_addr            ^= 0x03;
+       *(unsigned long *)&ioaddr->lbah_addr            ^= 0x03;
+       *(unsigned long *)&ioaddr->device_addr          ^= 0x03;
+       *(unsigned long *)&ioaddr->status_addr          ^= 0x03;
+       *(unsigned long *)&ioaddr->command_addr         ^= 0x03;
 #endif
 }
 
@@ -195,12 +188,12 @@ static __devinit int ixp4xx_pata_probe(struct platform_device *pdev)
 
        pdev->dev.coherent_dma_mask = DMA_32BIT_MASK;
 
-       data->cs0 = ioremap(cs0->start, 0x1000);
-       data->cs1 = ioremap(cs1->start, 0x1000);
+       data->cs0 = devm_ioremap(&pdev->dev, cs0->start, 0x1000);
+       data->cs1 = devm_ioremap(&pdev->dev, cs1->start, 0x1000);
 
        irq = platform_get_irq(pdev, 0);
        if (irq)
-               set_irq_type(irq, IRQT_HIGH);
+               set_irq_type(irq, IRQT_RISING);
 
        /* Setup expansion bus chip selects */
        *data->cs0_cfg = data->cs0_bits;
@@ -238,8 +231,7 @@ static __devexit int ixp4xx_pata_remove(struct platform_device *dev)
 {
        struct ata_host *host = platform_get_drvdata(dev);
 
-       ata_host_remove(host);
-       platform_set_drvdata(dev, NULL);
+       ata_host_detach(host);
 
        return 0;
 }