diff options
Diffstat (limited to 'drivers/ide/ide-dma.c')
-rw-r--r-- | drivers/ide/ide-dma.c | 59 |
1 files changed, 37 insertions, 22 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 366bbc841fc9..a00d2598ec7f 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -102,7 +102,7 @@ ide_startstop_t ide_dma_intr (ide_drive_t *drive) | |||
102 | { | 102 | { |
103 | u8 stat = 0, dma_stat = 0; | 103 | u8 stat = 0, dma_stat = 0; |
104 | 104 | ||
105 | dma_stat = HWIF(drive)->ide_dma_end(drive); | 105 | dma_stat = drive->hwif->dma_ops->dma_end(drive); |
106 | stat = ide_read_status(drive); | 106 | stat = ide_read_status(drive); |
107 | 107 | ||
108 | if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) { | 108 | if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) { |
@@ -394,7 +394,7 @@ void ide_dma_off_quietly(ide_drive_t *drive) | |||
394 | drive->using_dma = 0; | 394 | drive->using_dma = 0; |
395 | ide_toggle_bounce(drive, 0); | 395 | ide_toggle_bounce(drive, 0); |
396 | 396 | ||
397 | drive->hwif->dma_host_set(drive, 0); | 397 | drive->hwif->dma_ops->dma_host_set(drive, 0); |
398 | } | 398 | } |
399 | 399 | ||
400 | EXPORT_SYMBOL(ide_dma_off_quietly); | 400 | EXPORT_SYMBOL(ide_dma_off_quietly); |
@@ -427,7 +427,7 @@ void ide_dma_on(ide_drive_t *drive) | |||
427 | drive->using_dma = 1; | 427 | drive->using_dma = 1; |
428 | ide_toggle_bounce(drive, 1); | 428 | ide_toggle_bounce(drive, 1); |
429 | 429 | ||
430 | drive->hwif->dma_host_set(drive, 1); | 430 | drive->hwif->dma_ops->dma_host_set(drive, 1); |
431 | } | 431 | } |
432 | 432 | ||
433 | #ifdef CONFIG_BLK_DEV_IDEDMA_SFF | 433 | #ifdef CONFIG_BLK_DEV_IDEDMA_SFF |
@@ -802,10 +802,10 @@ void ide_dma_timeout (ide_drive_t *drive) | |||
802 | 802 | ||
803 | printk(KERN_ERR "%s: timeout waiting for DMA\n", drive->name); | 803 | printk(KERN_ERR "%s: timeout waiting for DMA\n", drive->name); |
804 | 804 | ||
805 | if (hwif->ide_dma_test_irq(drive)) | 805 | if (hwif->dma_ops->dma_test_irq(drive)) |
806 | return; | 806 | return; |
807 | 807 | ||
808 | hwif->ide_dma_end(drive); | 808 | hwif->dma_ops->dma_end(drive); |
809 | } | 809 | } |
810 | 810 | ||
811 | EXPORT_SYMBOL(ide_dma_timeout); | 811 | EXPORT_SYMBOL(ide_dma_timeout); |
@@ -839,8 +839,21 @@ int ide_allocate_dma_engine(ide_hwif_t *hwif) | |||
839 | } | 839 | } |
840 | EXPORT_SYMBOL_GPL(ide_allocate_dma_engine); | 840 | EXPORT_SYMBOL_GPL(ide_allocate_dma_engine); |
841 | 841 | ||
842 | void ide_setup_dma(ide_hwif_t *hwif, unsigned long base) | 842 | static struct ide_dma_ops sff_dma_ops = { |
843 | .dma_host_set = ide_dma_host_set, | ||
844 | .dma_setup = ide_dma_setup, | ||
845 | .dma_exec_cmd = ide_dma_exec_cmd, | ||
846 | .dma_start = ide_dma_start, | ||
847 | .dma_end = __ide_dma_end, | ||
848 | .dma_test_irq = __ide_dma_test_irq, | ||
849 | .dma_timeout = ide_dma_timeout, | ||
850 | .dma_lost_irq = ide_dma_lost_irq, | ||
851 | }; | ||
852 | |||
853 | void ide_setup_dma(ide_hwif_t *hwif, unsigned long base, | ||
854 | const struct ide_port_info *d) | ||
843 | { | 855 | { |
856 | struct ide_dma_ops *dma_ops = d->dma_ops ? d->dma_ops : &sff_dma_ops; | ||
844 | hwif->dma_base = base; | 857 | hwif->dma_base = base; |
845 | 858 | ||
846 | if (!hwif->dma_command) | 859 | if (!hwif->dma_command) |
@@ -854,22 +867,24 @@ void ide_setup_dma(ide_hwif_t *hwif, unsigned long base) | |||
854 | if (!hwif->dma_prdtable) | 867 | if (!hwif->dma_prdtable) |
855 | hwif->dma_prdtable = hwif->dma_base + 4; | 868 | hwif->dma_prdtable = hwif->dma_base + 4; |
856 | 869 | ||
857 | if (!hwif->dma_host_set) | 870 | hwif->dma_ops = dma_ops; |
858 | hwif->dma_host_set = &ide_dma_host_set; | 871 | |
859 | if (!hwif->dma_setup) | 872 | if (dma_ops->dma_host_set == NULL) |
860 | hwif->dma_setup = &ide_dma_setup; | 873 | dma_ops->dma_host_set = ide_dma_host_set; |
861 | if (!hwif->dma_exec_cmd) | 874 | if (dma_ops->dma_setup == NULL) |
862 | hwif->dma_exec_cmd = &ide_dma_exec_cmd; | 875 | dma_ops->dma_setup = ide_dma_setup; |
863 | if (!hwif->dma_start) | 876 | if (dma_ops->dma_exec_cmd == NULL) |
864 | hwif->dma_start = &ide_dma_start; | 877 | dma_ops->dma_exec_cmd = ide_dma_exec_cmd; |
865 | if (!hwif->ide_dma_end) | 878 | if (dma_ops->dma_start == NULL) |
866 | hwif->ide_dma_end = &__ide_dma_end; | 879 | dma_ops->dma_start = ide_dma_start; |
867 | if (!hwif->ide_dma_test_irq) | 880 | if (dma_ops->dma_end == NULL) |
868 | hwif->ide_dma_test_irq = &__ide_dma_test_irq; | 881 | dma_ops->dma_end = __ide_dma_end; |
869 | if (!hwif->dma_timeout) | 882 | if (dma_ops->dma_test_irq == NULL) |
870 | hwif->dma_timeout = &ide_dma_timeout; | 883 | dma_ops->dma_test_irq = __ide_dma_test_irq; |
871 | if (!hwif->dma_lost_irq) | 884 | if (dma_ops->dma_timeout == NULL) |
872 | hwif->dma_lost_irq = &ide_dma_lost_irq; | 885 | dma_ops->dma_timeout = ide_dma_timeout; |
886 | if (dma_ops->dma_lost_irq == NULL) | ||
887 | dma_ops->dma_lost_irq = ide_dma_lost_irq; | ||
873 | } | 888 | } |
874 | 889 | ||
875 | EXPORT_SYMBOL_GPL(ide_setup_dma); | 890 | EXPORT_SYMBOL_GPL(ide_setup_dma); |