Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
[pandora-kernel.git] / drivers / ata / pata_bf54x.c
index 02c81f1..9cae65d 100644 (file)
@@ -820,6 +820,18 @@ static void bfin_dev_select(struct ata_port *ap, unsigned int device)
        ata_sff_pause(ap);
 }
 
+/**
+ *     bfin_set_devctl - Write device control reg
+ *     @ap: port where the device is
+ *     @ctl: value to write
+ */
+
+static u8 bfin_set_devctl(struct ata_port *ap, u8 ctl)
+{
+       void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr;
+       write_atapi_register(base, ATA_REG_CTRL, ctl);
+}
+
 /**
  *     bfin_bmdma_setup - Set up IDE DMA transaction
  *     @qc: Info associated with this ATA transaction.
@@ -1202,7 +1214,7 @@ static unsigned int bfin_data_xfer(struct ata_device *dev, unsigned char *buf,
  *     bfin_irq_clear - Clear ATAPI interrupt.
  *     @ap: Port associated with this ATA transaction.
  *
- *     Note: Original code is ata_sff_irq_clear().
+ *     Note: Original code is ata_bmdma_irq_clear().
  */
 
 static void bfin_irq_clear(struct ata_port *ap)
@@ -1215,56 +1227,6 @@ static void bfin_irq_clear(struct ata_port *ap)
                | MULTI_TERM_INT | UDMAIN_TERM_INT | UDMAOUT_TERM_INT);
 }
 
-/**
- *     bfin_irq_on - Enable interrupts on a port.
- *     @ap: Port on which interrupts are enabled.
- *
- *     Note: Original code is ata_sff_irq_on().
- */
-
-static unsigned char bfin_irq_on(struct ata_port *ap)
-{
-       void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr;
-       u8 tmp;
-
-       dev_dbg(ap->dev, "in atapi irq on\n");
-       ap->ctl &= ~ATA_NIEN;
-       ap->last_ctl = ap->ctl;
-
-       write_atapi_register(base, ATA_REG_CTRL, ap->ctl);
-       tmp = ata_wait_idle(ap);
-
-       bfin_irq_clear(ap);
-
-       return tmp;
-}
-
-/**
- *     bfin_freeze - Freeze DMA controller port
- *     @ap: port to freeze
- *
- *     Note: Original code is ata_sff_freeze().
- */
-
-static void bfin_freeze(struct ata_port *ap)
-{
-       void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr;
-
-       dev_dbg(ap->dev, "in atapi dma freeze\n");
-       ap->ctl |= ATA_NIEN;
-       ap->last_ctl = ap->ctl;
-
-       write_atapi_register(base, ATA_REG_CTRL, ap->ctl);
-
-       /* Under certain circumstances, some controllers raise IRQ on
-        * ATA_NIEN manipulation.  Also, many controllers fail to mask
-        * previously pending IRQ on ATA_NIEN assertion.  Clear it.
-        */
-       ap->ops->sff_check_status(ap);
-
-       bfin_irq_clear(ap);
-}
-
 /**
  *     bfin_thaw - Thaw DMA controller port
  *     @ap: port to thaw
@@ -1276,7 +1238,7 @@ void bfin_thaw(struct ata_port *ap)
 {
        dev_dbg(ap->dev, "in atapi dma thaw\n");
        bfin_check_status(ap);
-       bfin_irq_on(ap);
+       ata_sff_irq_on(ap);
 }
 
 /**
@@ -1293,7 +1255,7 @@ static void bfin_postreset(struct ata_link *link, unsigned int *classes)
        void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr;
 
        /* re-enable interrupts */
-       bfin_irq_on(ap);
+       ata_sff_irq_on(ap);
 
        /* is double-select really necessary? */
        if (classes[0] != ATA_DEV_NONE)
@@ -1438,18 +1400,12 @@ static irqreturn_t bfin_ata_interrupt(int irq, void *dev_instance)
        spin_lock_irqsave(&host->lock, flags);
 
        for (i = 0; i < host->n_ports; i++) {
-               struct ata_port *ap;
+               struct ata_port *ap = host->ports[i];
+               struct ata_queued_cmd *qc;
 
-               ap = host->ports[i];
-               if (ap &&
-                   !(ap->flags & ATA_FLAG_DISABLED)) {
-                       struct ata_queued_cmd *qc;
-
-                       qc = ata_qc_from_tag(ap, ap->link.active_tag);
-                       if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) &&
-                           (qc->flags & ATA_QCFLAG_ACTIVE))
-                               handled |= bfin_ata_host_intr(ap, qc);
-               }
+               qc = ata_qc_from_tag(ap, ap->link.active_tag);
+               if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)))
+                       handled |= bfin_ata_host_intr(ap, qc);
        }
 
        spin_unlock_irqrestore(&host->lock, flags);
@@ -1465,7 +1421,7 @@ static struct scsi_host_template bfin_sht = {
 };
 
 static struct ata_port_operations bfin_pata_ops = {
-       .inherits               = &ata_sff_port_ops,
+       .inherits               = &ata_bmdma_port_ops,
 
        .set_piomode            = bfin_set_piomode,
        .set_dmamode            = bfin_set_dmamode,
@@ -1476,6 +1432,7 @@ static struct ata_port_operations bfin_pata_ops = {
        .sff_check_status       = bfin_check_status,
        .sff_check_altstatus    = bfin_check_altstatus,
        .sff_dev_select         = bfin_dev_select,
+       .sff_set_devctl         = bfin_set_devctl,
 
        .bmdma_setup            = bfin_bmdma_setup,
        .bmdma_start            = bfin_bmdma_start,
@@ -1485,13 +1442,11 @@ static struct ata_port_operations bfin_pata_ops = {
 
        .qc_prep                = ata_noop_qc_prep,
 
-       .freeze                 = bfin_freeze,
        .thaw                   = bfin_thaw,
        .softreset              = bfin_softreset,
        .postreset              = bfin_postreset,
 
        .sff_irq_clear          = bfin_irq_clear,
-       .sff_irq_on             = bfin_irq_on,
 
        .port_start             = bfin_port_start,
        .port_stop              = bfin_port_stop,