aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-dma.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:24 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:24 -0400
commit5e37bdc081a980dd0d669e6387bcf15ca9666f81 (patch)
treed842166c3bd23fbf3dfba0ccaa0f9ed5cc3096db /drivers/ide/ide-dma.c
parent1fd1890594bd355a4217f5658a34763e77decee3 (diff)
ide: add struct ide_dma_ops (take 3)
Add struct ide_dma_ops and convert core code + drivers to use it. While at it: * Drop "ide_" prefix from ->ide_dma_end and ->ide_dma_test_irq methods. * Drop "ide_" "infixes" from DMA methods. * au1xxx-ide.c: - use auide_dma_{test_irq,end}() directly in auide_dma_timeout() * pdc202xx_old.c: - drop "old_" "infixes" from DMA methods * siimage.c: - add siimage_dma_test_irq() helper - print SATA warning in siimage_init_one() * Remove no longer needed ->init_hwif implementations. v2: * Changes based on review from Sergei: - s/siimage_ide_dma_test_irq/siimage_dma_test_irq/ - s/drive->hwif/hwif/ in idefloppy_pc_intr(). - fix patch description w.r.t. au1xxx-ide changes - fix au1xxx-ide build - fix naming for cmd64*_dma_ops - drop "ide_" and "old_" infixes - s/hpt3xxx_dma_ops/hpt37x_dma_ops/ - s/hpt370x_dma_ops/hpt370_dma_ops/ - use correct DMA ops for HPT302/N, HPT371/N and HPT374 - s/it821x_smart_dma_ops/it821x_pass_through_dma_ops/ v3: * Two bugs slipped in v2 (noticed by Sergei): - use correct DMA ops for HPT374 (for real this time) - handle HPT370/HPT370A properly Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-dma.c')
-rw-r--r--drivers/ide/ide-dma.c59
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
400EXPORT_SYMBOL(ide_dma_off_quietly); 400EXPORT_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
811EXPORT_SYMBOL(ide_dma_timeout); 811EXPORT_SYMBOL(ide_dma_timeout);
@@ -839,8 +839,21 @@ int ide_allocate_dma_engine(ide_hwif_t *hwif)
839} 839}
840EXPORT_SYMBOL_GPL(ide_allocate_dma_engine); 840EXPORT_SYMBOL_GPL(ide_allocate_dma_engine);
841 841
842void ide_setup_dma(ide_hwif_t *hwif, unsigned long base) 842static 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
853void 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
875EXPORT_SYMBOL_GPL(ide_setup_dma); 890EXPORT_SYMBOL_GPL(ide_setup_dma);