]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/mips/au1xxx-ide.c
ide: make ide_dma_timeout() available also for CONFIG_BLK_DEV_IDEDMA_SFF=n
[linux-2.6-omap-h63xx.git] / drivers / ide / mips / au1xxx-ide.c
index 48d57cae63c69c267f42d08339e8ec42d13fa85e..f9e88cfec827d5828a9dcb00a8ed9386ffbe8ab7 100644 (file)
@@ -322,11 +322,7 @@ static int auide_dma_setup(ide_drive_t *drive)
 }
 
 static int auide_dma_test_irq(ide_drive_t *drive)
-{      
-       if (drive->waiting_for_dma == 0)
-               printk(KERN_WARNING "%s: ide_dma_test_irq \
-                                     called while not waiting\n", drive->name);
-
+{
        /* If dbdma didn't execute the STOP command yet, the
         * active bit is still set
         */
@@ -344,11 +340,6 @@ static void auide_dma_host_set(ide_drive_t *drive, int on)
 {
 }
 
-static void auide_dma_lost_irq(ide_drive_t *drive)
-{
-       printk(KERN_ERR "%s: IRQ lost\n", drive->name);
-}
-
 static void auide_ddma_tx_callback(int irq, void *param)
 {
        _auide_hwif *ahwif = (_auide_hwif*)param;
@@ -375,18 +366,6 @@ static void auide_init_dbdma_dev(dbdev_tab_t *dev, u32 dev_id, u32 tsize, u32 de
 }
 
 #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
-static void auide_dma_timeout(ide_drive_t *drive)
-{
-       ide_hwif_t *hwif = HWIF(drive);
-
-       printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name);
-
-       if (auide_dma_test_irq(drive))
-               return;
-
-       auide_dma_end(drive);
-}
-
 static const struct ide_dma_ops au1xxx_dma_ops = {
        .dma_host_set           = auide_dma_host_set,
        .dma_setup              = auide_dma_setup,
@@ -394,8 +373,8 @@ static const struct ide_dma_ops au1xxx_dma_ops = {
        .dma_start              = auide_dma_start,
        .dma_end                = auide_dma_end,
        .dma_test_irq           = auide_dma_test_irq,
-       .dma_lost_irq           = auide_dma_lost_irq,
-       .dma_timeout            = auide_dma_timeout,
+       .dma_lost_irq           = ide_dma_lost_irq,
+       .dma_timeout            = ide_dma_timeout,
 };
 
 static int auide_ddma_init(ide_hwif_t *hwif, const struct ide_port_info *d)
@@ -519,6 +498,23 @@ static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif)
        *ata_regs = ahwif->regbase + (14 << IDE_REG_SHIFT);
 }
 
+#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA
+static const struct ide_tp_ops au1xxx_tp_ops = {
+       .exec_command           = ide_exec_command,
+       .read_status            = ide_read_status,
+       .read_altstatus         = ide_read_altstatus,
+       .read_sff_dma_status    = ide_read_sff_dma_status,
+
+       .set_irq                = ide_set_irq,
+
+       .tf_load                = ide_tf_load,
+       .tf_read                = ide_tf_read,
+
+       .input_data             = au1xxx_input_data,
+       .output_data            = au1xxx_output_data,
+};
+#endif
+
 static const struct ide_port_ops au1xxx_port_ops = {
        .set_pio_mode           = au1xxx_set_pio_mode,
        .set_dma_mode           = auide_set_dma_mode,
@@ -526,6 +522,9 @@ static const struct ide_port_ops au1xxx_port_ops = {
 
 static const struct ide_port_info au1xxx_port_info = {
        .init_dma               = auide_ddma_init,
+#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA
+       .tp_ops                 = &au1xxx_tp_ops,
+#endif
        .port_ops               = &au1xxx_port_ops,
 #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
        .dma_ops                = &au1xxx_dma_ops,
@@ -543,11 +542,10 @@ static int au_ide_probe(struct device *dev)
 {
        struct platform_device *pdev = to_platform_device(dev);
        _auide_hwif *ahwif = &auide_hwif;
-       ide_hwif_t *hwif;
        struct resource *res;
+       struct ide_host *host;
        int ret = 0;
-       u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
-       hw_regs_t hw;
+       hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
 
 #if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA)
        char *mode = "MWDMA2";
@@ -584,36 +582,19 @@ static int au_ide_probe(struct device *dev)
                goto out;
        }
 
-       hwif = ide_find_port();
-       if (hwif == NULL) {
-               ret = -ENOENT;
-               goto out;
-       }
-
        memset(&hw, 0, sizeof(hw));
        auide_setup_ports(&hw, ahwif);
        hw.irq = ahwif->irq;
        hw.dev = dev;
        hw.chipset = ide_au1xxx;
 
-       ide_init_port_hw(hwif, &hw);
-
-       /* If the user has selected DDMA assisted copies,
-          then set up a few local I/O function entry points 
-       */
-
-#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA     
-       hwif->input_data  = au1xxx_input_data;
-       hwif->output_data = au1xxx_output_data;
-#endif
-
-       auide_hwif.hwif                 = hwif;
-
-       idx[0] = hwif->index;
+       ret = ide_host_add(&au1xxx_port_info, hws, &host);
+       if (ret)
+               goto out;
 
-       ide_device_add(idx, &au1xxx_port_info);
+       auide_hwif.hwif = host->ports[0];
 
-       dev_set_drvdata(dev, hwif);
+       dev_set_drvdata(dev, host);
 
        printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode );
 
@@ -625,10 +606,10 @@ static int au_ide_remove(struct device *dev)
 {
        struct platform_device *pdev = to_platform_device(dev);
        struct resource *res;
-       ide_hwif_t *hwif = dev_get_drvdata(dev);
+       struct ide_host *host = dev_get_drvdata(dev);
        _auide_hwif *ahwif = &auide_hwif;
 
-       ide_unregister(hwif);
+       ide_host_remove(host);
 
        iounmap((void *)ahwif->regbase);