]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/ata/sata_fsl.c
Merge tag 'v2.6.37' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / drivers / ata / sata_fsl.c
index 7325f77480dcb77296d148f8566bd64148a4cf3e..b0214d00d50bb469de76b40fb8a4f81f70cbb161 100644 (file)
@@ -678,7 +678,7 @@ static void sata_fsl_port_stop(struct ata_port *ap)
        iowrite32(temp, hcr_base + HCONTROL);
 
        /* Poll for controller to go offline - should happen immediately */
-       ata_wait_register(hcr_base + HSTATUS, ONLINE, ONLINE, 1, 1);
+       ata_wait_register(ap, hcr_base + HSTATUS, ONLINE, ONLINE, 1, 1);
 
        ap->private_data = NULL;
        dma_free_coherent(dev, SATA_FSL_PORT_PRIV_DMA_SZ,
@@ -729,7 +729,8 @@ try_offline_again:
        iowrite32(temp, hcr_base + HCONTROL);
 
        /* Poll for controller to go offline */
-       temp = ata_wait_register(hcr_base + HSTATUS, ONLINE, ONLINE, 1, 500);
+       temp = ata_wait_register(ap, hcr_base + HSTATUS, ONLINE, ONLINE,
+                                1, 500);
 
        if (temp & ONLINE) {
                ata_port_printk(ap, KERN_ERR,
@@ -752,7 +753,7 @@ try_offline_again:
        /*
         * PHY reset should remain asserted for atleast 1ms
         */
-       msleep(1);
+       ata_msleep(ap, 1);
 
        /*
         * Now, bring the host controller online again, this can take time
@@ -766,7 +767,7 @@ try_offline_again:
        temp |= HCONTROL_PMP_ATTACHED;
        iowrite32(temp, hcr_base + HCONTROL);
 
-       temp = ata_wait_register(hcr_base + HSTATUS, ONLINE, 0, 1, 500);
+       temp = ata_wait_register(ap, hcr_base + HSTATUS, ONLINE, 0, 1, 500);
 
        if (!(temp & ONLINE)) {
                ata_port_printk(ap, KERN_ERR,
@@ -784,7 +785,7 @@ try_offline_again:
         * presence
         */
 
-       temp = ata_wait_register(hcr_base + HSTATUS, 0xFF, 0, 1, 500);
+       temp = ata_wait_register(ap, hcr_base + HSTATUS, 0xFF, 0, 1, 500);
        if ((!(temp & 0x10)) || ata_link_offline(link)) {
                ata_port_printk(ap, KERN_WARNING,
                                "No Device OR PHYRDY change,Hstatus = 0x%x\n",
@@ -797,7 +798,7 @@ try_offline_again:
         * Wait for the first D2H from device,i.e,signature update notification
         */
        start_jiffies = jiffies;
-       temp = ata_wait_register(hcr_base + HSTATUS, 0xFF, 0x10,
+       temp = ata_wait_register(ap, hcr_base + HSTATUS, 0xFF, 0x10,
                        500, jiffies_to_msecs(deadline - start_jiffies));
 
        if ((temp & 0xFF) != 0x18) {
@@ -880,7 +881,7 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
                iowrite32(pmp, CQPMP + hcr_base);
        iowrite32(1, CQ + hcr_base);
 
-       temp = ata_wait_register(CQ + hcr_base, 0x1, 0x1, 1, 5000);
+       temp = ata_wait_register(ap, CQ + hcr_base, 0x1, 0x1, 1, 5000);
        if (temp & 0x1) {
                ata_port_printk(ap, KERN_WARNING, "ATA_SRST issue failed\n");
 
@@ -896,7 +897,7 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
                goto err;
        }
 
-       msleep(1);
+       ata_msleep(ap, 1);
 
        /*
         * SATA device enters reset state after receving a Control register
@@ -915,7 +916,7 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
        if (pmp != SATA_PMP_CTRL_PORT)
                iowrite32(pmp, CQPMP + hcr_base);
        iowrite32(1, CQ + hcr_base);
-       msleep(150);            /* ?? */
+       ata_msleep(ap, 150);            /* ?? */
 
        /*
         * The above command would have signalled an interrupt on command
@@ -1137,17 +1138,13 @@ static void sata_fsl_host_intr(struct ata_port *ap)
                        ioread32(hcr_base + CE));
 
                for (i = 0; i < SATA_FSL_QUEUE_DEPTH; i++) {
-                       if (done_mask & (1 << i)) {
-                               qc = ata_qc_from_tag(ap, i);
-                               if (qc) {
-                                       ata_qc_complete(qc);
-                               }
+                       if (done_mask & (1 << i))
                                DPRINTK
                                    ("completing ncq cmd,tag=%d,CC=0x%x,CA=0x%x\n",
                                     i, ioread32(hcr_base + CC),
                                     ioread32(hcr_base + CA));
-                       }
                }
+               ata_qc_complete_multiple(ap, ap->qc_active ^ done_mask);
                return;
 
        } else if ((ap->qc_active & (1 << ATA_TAG_INTERNAL))) {