]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/ide/mips/au1xxx-ide.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[mv-sheeva.git] / drivers / ide / mips / au1xxx-ide.c
index 54323ab64def61ff9e44ca5a01fd7fc0020bf7e7..1a6c27b324983cc989e4c228b2be6cbd6e9a3027 100644 (file)
@@ -48,8 +48,6 @@
 
 static _auide_hwif auide_hwif;
 
-static int auide_ddma_init(_auide_hwif *auide);
-
 #if defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA)
 
 void auide_insw(unsigned long port, void *addr, u32 count)
@@ -88,6 +86,17 @@ void auide_outsw(unsigned long port, void *addr, u32 count)
        ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp);
 }
 
+static void au1xxx_input_data(ide_drive_t *drive, struct request *rq,
+                             void *buf, unsigned int len)
+{
+       auide_insw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
+}
+
+static void au1xxx_output_data(ide_drive_t *drive, struct request *rq,
+                              void *buf, unsigned int len)
+{
+       auide_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
+}
 #endif
 
 static void au1xxx_set_pio_mode(ide_drive_t *drive, const u8 pio)
@@ -359,35 +368,45 @@ static void auide_ddma_rx_callback(int irq, void *param)
 static void auide_init_dbdma_dev(dbdev_tab_t *dev, u32 dev_id, u32 tsize, u32 devwidth, u32 flags)
 {
        dev->dev_id          = dev_id;
-       dev->dev_physaddr    = (u32)AU1XXX_ATA_PHYS_ADDR;
+       dev->dev_physaddr    = (u32)IDE_PHYS_ADDR;
        dev->dev_intlevel    = 0;
        dev->dev_intpolarity = 0;
        dev->dev_tsize       = tsize;
        dev->dev_devwidth    = devwidth;
        dev->dev_flags       = flags;
 }
-  
-#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA)
 
+#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 (hwif->ide_dma_test_irq(drive))
+       if (auide_dma_test_irq(drive))
                return;
 
-       hwif->ide_dma_end(drive);
+       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,
+       .dma_exec_cmd           = auide_dma_exec_cmd,
+       .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,
+};
+
 static int auide_ddma_init(ide_hwif_t *hwif, const struct ide_port_info *d)
 {
        _auide_hwif *auide = (_auide_hwif *)hwif->hwif_data;
        dbdev_tab_t source_dev_tab, target_dev_tab;
        u32 dev_id, tsize, devwidth, flags;
 
-       dev_id   = AU1XXX_ATA_DDMA_REQ;
+       dev_id   = IDE_DDMA_REQ;
 
        tsize    =  8; /*  1 */
        devwidth = 32; /* 16 */
@@ -492,15 +511,14 @@ static int auide_ddma_init(ide_hwif_t *hwif, const struct ide_port_info *d)
 static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif)
 {
        int i;
-       unsigned long *ata_regs = hw->io_ports;
+       unsigned long *ata_regs = hw->io_ports_array;
 
        /* FIXME? */
-       for (i = 0; i < IDE_CONTROL_OFFSET; i++) {
-               *ata_regs++ = ahwif->regbase + (i << AU1XXX_ATA_REG_OFFSET);
-       }
+       for (i = 0; i < 8; i++)
+               *ata_regs++ = ahwif->regbase + (i << IDE_REG_SHIFT);
 
        /* set the Alternative Status register */
-       *ata_regs = ahwif->regbase + (14 << AU1XXX_ATA_REG_OFFSET);
+       *ata_regs = ahwif->regbase + (14 << IDE_REG_SHIFT);
 }
 
 static const struct ide_port_ops au1xxx_port_ops = {
@@ -511,6 +529,9 @@ static const struct ide_port_ops au1xxx_port_ops = {
 static const struct ide_port_info au1xxx_port_info = {
        .init_dma               = auide_ddma_init,
        .port_ops               = &au1xxx_port_ops,
+#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
+       .dma_ops                = &au1xxx_dma_ops,
+#endif
        .host_flags             = IDE_HFLAG_POST_SET_MODE |
                                  IDE_HFLAG_NO_IO_32BIT |
                                  IDE_HFLAG_UNMASK_IRQS,
@@ -586,18 +607,8 @@ static int au_ide_probe(struct device *dev)
        */
 
 #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA     
-       hwif->INSW                      = auide_insw;
-       hwif->OUTSW                     = auide_outsw;
-#endif
-#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
-       hwif->dma_timeout               = &auide_dma_timeout;
-       hwif->dma_host_set              = &auide_dma_host_set;
-       hwif->dma_exec_cmd              = &auide_dma_exec_cmd;
-       hwif->dma_start                 = &auide_dma_start;
-       hwif->ide_dma_end               = &auide_dma_end;
-       hwif->dma_setup                 = &auide_dma_setup;
-       hwif->ide_dma_test_irq          = &auide_dma_test_irq;
-       hwif->dma_lost_irq              = &auide_dma_lost_irq;
+       hwif->input_data  = au1xxx_input_data;
+       hwif->output_data = au1xxx_output_data;
 #endif
        hwif->select_data               = 0;    /* no chipset-specific code */
        hwif->config_data               = 0;    /* no chipset-specific code */
@@ -624,7 +635,7 @@ static int au_ide_remove(struct device *dev)
        ide_hwif_t *hwif = dev_get_drvdata(dev);
        _auide_hwif *ahwif = &auide_hwif;
 
-       ide_unregister(hwif->index);
+       ide_unregister(hwif);
 
        iounmap((void *)ahwif->regbase);