]> err.no Git - linux-2.6/blobdiff - drivers/ata/pata_scc.c
pata_ninja32: Cardbus ATA initial support
[linux-2.6] / drivers / ata / pata_scc.c
index 2153def3f345d0cb7d4646f0772076bfd6f68e7d..ea2ef9fc15be6e2aa131497cc387b613c9466066 100644 (file)
@@ -570,17 +570,8 @@ static unsigned int scc_bus_softreset(struct ata_port *ap, unsigned int devmask,
        udelay(20);
        out_be32(ioaddr->ctl_addr, ap->ctl);
 
-       /* spec mandates ">= 2ms" before checking status.
-        * We wait 150ms, because that was the magic delay used for
-        * ATAPI devices in Hale Landis's ATADRVR, for the period of time
-        * between when the ATA command register is written, and then
-        * status is checked.  Because waiting for "a while" before
-        * checking status is fine, post SRST, we perform this magic
-        * delay here as well.
-        *
-        * Old drivers/ide uses the 2mS rule and then waits for ready
-        */
-       msleep(150);
+       /* wait a while before checking status */
+       ata_wait_after_reset(ap, deadline);
 
        /* Before we perform post reset processing we want to see if
         * the bus shows 0xFF because the odd clown forgets the D7
@@ -603,16 +594,17 @@ static unsigned int scc_bus_softreset(struct ata_port *ap, unsigned int devmask,
  *     Note: Original code is ata_std_softreset().
  */
 
-static int scc_std_softreset (struct ata_port *ap, unsigned int *classes,
-                              unsigned long deadline)
+static int scc_std_softreset(struct ata_link *link, unsigned int *classes,
+                             unsigned long deadline)
 {
+       struct ata_port *ap = link->ap;
        unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS;
        unsigned int devmask = 0, err_mask;
        u8 err;
 
        DPRINTK("ENTER\n");
 
-       if (ata_link_offline(&ap->link)) {
+       if (ata_link_offline(link)) {
                classes[0] = ATA_DEV_NONE;
                goto out;
        }
@@ -636,9 +628,11 @@ static int scc_std_softreset (struct ata_port *ap, unsigned int *classes,
        }
 
        /* determine by signature whether we have ATA or ATAPI devices */
-       classes[0] = ata_dev_try_classify(ap, 0, &err);
+       classes[0] = ata_dev_try_classify(&ap->link.device[0],
+                                         devmask & (1 << 0), &err);
        if (slave_possible && err != 0x81)
-               classes[1] = ata_dev_try_classify(ap, 1, &err);
+               classes[1] = ata_dev_try_classify(&ap->link.device[1],
+                                                 devmask & (1 << 1), &err);
 
  out:
        DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
@@ -701,7 +695,7 @@ static void scc_bmdma_stop (struct ata_queued_cmd *qc)
                        printk(KERN_WARNING "%s: Internal Bus Error\n", DRV_NAME);
                        out_be32(bmid_base + SCC_DMA_INTST, INTSTS_BMSINT);
                        /* TBD: SW reset */
-                       scc_std_softreset(ap, &classes, deadline);
+                       scc_std_softreset(&ap->link, &classes, deadline);
                        continue;
                }
 
@@ -740,7 +734,7 @@ static u8 scc_bmdma_status (struct ata_port *ap)
        void __iomem *mmio = ap->ioaddr.bmdma_addr;
        u8 host_stat = in_be32(mmio + SCC_DMA_STATUS);
        u32 int_status = in_be32(mmio + SCC_DMA_INTST);
-       struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag);
+       struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->link.active_tag);
        static int retry = 0;
 
        /* return if IOS_SS is cleared */
@@ -869,10 +863,10 @@ static void scc_bmdma_freeze (struct ata_port *ap)
  *     @deadline: deadline jiffies for the operation
  */
 
-static int scc_pata_prereset(struct ata_port *ap, unsigned long deadline)
+static int scc_pata_prereset(struct ata_link *link, unsigned long deadline)
 {
-       ap->cbl = ATA_CBL_PATA80;
-       return ata_std_prereset(ap, deadline);
+       link->ap->cbl = ATA_CBL_PATA80;
+       return ata_std_prereset(link, deadline);
 }
 
 /**
@@ -883,8 +877,10 @@ static int scc_pata_prereset(struct ata_port *ap, unsigned long deadline)
  *     Note: Original code is ata_std_postreset().
  */
 
-static void scc_std_postreset (struct ata_port *ap, unsigned int *classes)
+static void scc_std_postreset(struct ata_link *link, unsigned int *classes)
 {
+       struct ata_port *ap = link->ap;
+
        DPRINTK("ENTER\n");
 
        /* is double-select really necessary? */