]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ata/pata_qdi.c
[ARM] 4753/1: [AT91] Use DMA_BIT_MASK
[linux-2.6-omap-h63xx.git] / drivers / ata / pata_qdi.c
index fb8c9e14b8d48d808740739df9772b044ade57ad..9f308ed76cc83fc3070469d491033d9f4ef92299 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/platform_device.h>
 
 #define DRV_NAME "pata_qdi"
-#define DRV_VERSION "0.3.0"
+#define DRV_VERSION "0.3.1"
 
 #define NR_HOST 4      /* Two 6580s */
 
@@ -124,31 +124,33 @@ static unsigned int qdi_qc_issue_prot(struct ata_queued_cmd *qc)
        return ata_qc_issue_prot(qc);
 }
 
-static void qdi_data_xfer(struct ata_device *adev, unsigned char *buf, unsigned int buflen, int write_data)
+static unsigned int qdi_data_xfer(struct ata_device *dev, unsigned char *buf,
+                                 unsigned int buflen, int rw)
 {
-       struct ata_port *ap = adev->ap;
-       int slop = buflen & 3;
+       if (ata_id_has_dword_io(dev->id)) {
+               struct ata_port *ap = dev->link->ap;
+               int slop = buflen & 3;
 
-       if (ata_id_has_dword_io(adev->id)) {
-               if (write_data)
-                       iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
-               else
+               if (rw == READ)
                        ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
+               else
+                       iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
 
                if (unlikely(slop)) {
                        u32 pad;
-                       if (write_data) {
-                               memcpy(&pad, buf + buflen - slop, slop);
-                               pad = le32_to_cpu(pad);
-                               iowrite32(pad, ap->ioaddr.data_addr);
-                       } else {
-                               pad = ioread32(ap->ioaddr.data_addr);
-                               pad = cpu_to_le32(pad);
+                       if (rw == READ) {
+                               pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr));
                                memcpy(buf + buflen - slop, &pad, slop);
+                       } else {
+                               memcpy(&pad, buf + buflen - slop, slop);
+                               iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr);
                        }
+                       buflen += 4 - slop;
                }
        } else
-               ata_data_xfer(adev, buf, buflen, write_data);
+               buflen = ata_data_xfer(dev, buf, buflen, rw);
+
+       return buflen;
 }
 
 static struct scsi_host_template qdi_sht = {
@@ -170,7 +172,6 @@ static struct scsi_host_template qdi_sht = {
 };
 
 static struct ata_port_operations qdi6500_port_ops = {
-       .port_disable   = ata_port_disable,
        .set_piomode    = qdi6500_set_piomode,
 
        .tf_load        = ata_tf_load,
@@ -192,13 +193,11 @@ static struct ata_port_operations qdi6500_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 struct ata_port_operations qdi6580_port_ops = {
-       .port_disable   = ata_port_disable,
        .set_piomode    = qdi6580_set_piomode,
 
        .tf_load        = ata_tf_load,
@@ -220,9 +219,8 @@ static struct ata_port_operations qdi6580_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,
 };
 
 /**
@@ -238,6 +236,7 @@ static struct ata_port_operations qdi6580_port_ops = {
 
 static __init int qdi_init_one(unsigned long port, int type, unsigned long io, int irq, int fast)
 {
+       unsigned long ctl = io + 0x206;
        struct platform_device *pdev;
        struct ata_host *host;
        struct ata_port *ap;
@@ -254,7 +253,7 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i
 
        ret = -ENOMEM;
        io_addr = devm_ioport_map(&pdev->dev, io, 8);
-       ctl_addr = devm_ioport_map(&pdev->dev, io + 0x206, 1);
+       ctl_addr = devm_ioport_map(&pdev->dev, ctl, 1);
        if (!io_addr || !ctl_addr)
                goto fail;
 
@@ -279,6 +278,8 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i
        ap->ioaddr.ctl_addr = ctl_addr;
        ata_std_ports(&ap->ioaddr);
 
+       ata_port_desc(ap, "cmd %lx ctl %lx", io, ctl);
+
        /*
         *      Hook in a private data structure per channel
         */