aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-16 16:29:55 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-16 16:29:55 -0400
commit0ae2e178652753ae1797d407755a3505f7c1d2a7 (patch)
treefa725edcfb4b9752ebf2aa49a3e42e158537d4ed /drivers
parentb8b739d3361c16773a30fe5c0360336bbc19f435 (diff)
ide: remove ->ide_dma_check (take 2)
* Add IDE_HFLAG_TRUST_BIOS_FOR_DMA host flag for host drivers that depend on BIOS for programming device/controller for DMA. Set it in cy82c693, generic, ns87415, opti621 and trm290 host drivers. * Add IDE_HFLAG_VDMA host flag for host drivers using VDMA. Set it in cs5520 host driver. * Teach ide_tune_dma() about IDE_HFLAG_TRUST_BIOS_FOR_DMA flag. * Add generic ide_dma_check() helper and remove all open coded ->ide_dma_check implementations. Fix all places checking for presence of ->ide_dma_check hook to check for ->ide_dma_on instead. * Remove no longer needed code from config_drive_for_dma(). * Make ide_tune_dma() static. v2: * Fix config_drive_for_dma() return values. * Fix ide-dma.c build for CONFIG_BLK_DEV_IDEDMA_PCI=n by adding dummy config_drive_for_dma() inline. * Fix IDE_HFLAG_TRUST_BIOS_FOR_DMA handling in ide_dma_check(). * Fix init_hwif_it8213() comment. There should be no functionality changes caused by this patch. Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/arm/icside.c9
-rw-r--r--drivers/ide/cris/ide-cris.c12
-rw-r--r--drivers/ide/ide-dma.c75
-rw-r--r--drivers/ide/ide-io.c4
-rw-r--r--drivers/ide/ide-iops.c4
-rw-r--r--drivers/ide/ide-probe.c2
-rw-r--r--drivers/ide/ide.c3
-rw-r--r--drivers/ide/mips/au1xxx-ide.c11
-rw-r--r--drivers/ide/pci/aec62xx.c11
-rw-r--r--drivers/ide/pci/alim15x3.c19
-rw-r--r--drivers/ide/pci/amd74xx.c11
-rw-r--r--drivers/ide/pci/atiixp.c20
-rw-r--r--drivers/ide/pci/cmd64x.c12
-rw-r--r--drivers/ide/pci/cs5520.c13
-rw-r--r--drivers/ide/pci/cs5530.c20
-rw-r--r--drivers/ide/pci/cs5535.c12
-rw-r--r--drivers/ide/pci/cy82c693.c2
-rw-r--r--drivers/ide/pci/generic.c15
-rw-r--r--drivers/ide/pci/hpt34x.c11
-rw-r--r--drivers/ide/pci/hpt366.c12
-rw-r--r--drivers/ide/pci/it8213.c26
-rw-r--r--drivers/ide/pci/it821x.c22
-rw-r--r--drivers/ide/pci/jmicron.c20
-rw-r--r--drivers/ide/pci/ns87415.c1
-rw-r--r--drivers/ide/pci/opti621.c2
-rw-r--r--drivers/ide/pci/pdc202xx_new.c12
-rw-r--r--drivers/ide/pci/pdc202xx_old.c11
-rw-r--r--drivers/ide/pci/piix.c19
-rw-r--r--drivers/ide/pci/sc1200.c16
-rw-r--r--drivers/ide/pci/scc_pata.c22
-rw-r--r--drivers/ide/pci/serverworks.c11
-rw-r--r--drivers/ide/pci/sgiioc4.c15
-rw-r--r--drivers/ide/pci/siimage.c22
-rw-r--r--drivers/ide/pci/sis5513.c12
-rw-r--r--drivers/ide/pci/sl82c105.c16
-rw-r--r--drivers/ide/pci/slc90e66.c12
-rw-r--r--drivers/ide/pci/tc86c001.c11
-rw-r--r--drivers/ide/pci/triflex.c11
-rw-r--r--drivers/ide/pci/trm290.c1
-rw-r--r--drivers/ide/pci/via82cxxx.c19
-rw-r--r--drivers/ide/ppc/pmac.c16
41 files changed, 76 insertions, 499 deletions
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
index bd1f5b670378..0c6ce2faf8f5 100644
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -309,14 +309,6 @@ static int icside_dma_on(ide_drive_t *drive)
309 return 0; 309 return 0;
310} 310}
311 311
312static int icside_dma_check(ide_drive_t *drive)
313{
314 if (ide_tune_dma(drive))
315 return 0;
316
317 return -1;
318}
319
320static int icside_dma_end(ide_drive_t *drive) 312static int icside_dma_end(ide_drive_t *drive)
321{ 313{
322 ide_hwif_t *hwif = HWIF(drive); 314 ide_hwif_t *hwif = HWIF(drive);
@@ -434,7 +426,6 @@ static void icside_dma_init(ide_hwif_t *hwif)
434 hwif->set_dma_mode = icside_set_dma_mode; 426 hwif->set_dma_mode = icside_set_dma_mode;
435 hwif->autodma = 1; 427 hwif->autodma = 1;
436 428
437 hwif->ide_dma_check = icside_dma_check;
438 hwif->dma_host_off = icside_dma_host_off; 429 hwif->dma_host_off = icside_dma_host_off;
439 hwif->dma_off_quietly = icside_dma_off_quietly; 430 hwif->dma_off_quietly = icside_dma_off_quietly;
440 hwif->dma_host_on = icside_dma_host_on; 431 hwif->dma_host_on = icside_dma_host_on;
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c
index 303f26559db8..1ee078d43dbf 100644
--- a/drivers/ide/cris/ide-cris.c
+++ b/drivers/ide/cris/ide-cris.c
@@ -664,7 +664,6 @@ cris_ide_inb(unsigned long reg)
664 return (unsigned char)cris_ide_inw(reg); 664 return (unsigned char)cris_ide_inw(reg);
665} 665}
666 666
667static int cris_dma_check (ide_drive_t *drive);
668static int cris_dma_end (ide_drive_t *drive); 667static int cris_dma_end (ide_drive_t *drive);
669static int cris_dma_setup (ide_drive_t *drive); 668static int cris_dma_setup (ide_drive_t *drive);
670static void cris_dma_exec_cmd (ide_drive_t *drive, u8 command); 669static void cris_dma_exec_cmd (ide_drive_t *drive, u8 command);
@@ -792,7 +791,6 @@ init_e100_ide (void)
792 hwif->ata_output_data = &cris_ide_output_data; 791 hwif->ata_output_data = &cris_ide_output_data;
793 hwif->atapi_input_bytes = &cris_atapi_input_bytes; 792 hwif->atapi_input_bytes = &cris_atapi_input_bytes;
794 hwif->atapi_output_bytes = &cris_atapi_output_bytes; 793 hwif->atapi_output_bytes = &cris_atapi_output_bytes;
795 hwif->ide_dma_check = &cris_dma_check;
796 hwif->ide_dma_end = &cris_dma_end; 794 hwif->ide_dma_end = &cris_dma_end;
797 hwif->dma_setup = &cris_dma_setup; 795 hwif->dma_setup = &cris_dma_setup;
798 hwif->dma_exec_cmd = &cris_dma_exec_cmd; 796 hwif->dma_exec_cmd = &cris_dma_exec_cmd;
@@ -1020,16 +1018,6 @@ static ide_startstop_t cris_dma_intr (ide_drive_t *drive)
1020 * the caller should revert to PIO for the current request. 1018 * the caller should revert to PIO for the current request.
1021 */ 1019 */
1022 1020
1023static int cris_dma_check(ide_drive_t *drive)
1024{
1025 if (ide_tune_dma(drive))
1026 return 0;
1027
1028 ide_set_max_pio(drive);
1029
1030 return -1;
1031}
1032
1033static int cris_dma_end(ide_drive_t *drive) 1021static int cris_dma_end(ide_drive_t *drive)
1034{ 1022{
1035 drive->waiting_for_dma = 0; 1023 drive->waiting_for_dma = 0;
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index a4cbbbaccde9..716a4fdcc0b5 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -338,35 +338,30 @@ static int config_drive_for_dma (ide_drive_t *drive)
338 ide_hwif_t *hwif = drive->hwif; 338 ide_hwif_t *hwif = drive->hwif;
339 struct hd_driveid *id = drive->id; 339 struct hd_driveid *id = drive->id;
340 340
341 /* consult the list of known "bad" drives */
342 if (__ide_dma_bad_drive(drive))
343 return -1;
344
345 if (drive->media != ide_disk && hwif->atapi_dma == 0) 341 if (drive->media != ide_disk && hwif->atapi_dma == 0)
346 return -1; 342 return 0;
347 343
348 if ((id->capability & 1) && drive->autodma) { 344 /*
349 /* 345 * Enable DMA on any drive that has
350 * Enable DMA on any drive that has 346 * UltraDMA (mode 0/1/2/3/4/5/6) enabled
351 * UltraDMA (mode 0/1/2/3/4/5/6) enabled 347 */
352 */ 348 if ((id->field_valid & 4) && ((id->dma_ultra >> 8) & 0x7f))
353 if ((id->field_valid & 4) && ((id->dma_ultra >> 8) & 0x7f)) 349 return 1;
354 return 0; 350
355 /* 351 /*
356 * Enable DMA on any drive that has mode2 DMA 352 * Enable DMA on any drive that has mode2 DMA
357 * (multi or single) enabled 353 * (multi or single) enabled
358 */ 354 */
359 if (id->field_valid & 2) /* regular DMA */ 355 if (id->field_valid & 2) /* regular DMA */
360 if ((id->dma_mword & 0x404) == 0x404 || 356 if ((id->dma_mword & 0x404) == 0x404 ||
361 (id->dma_1word & 0x404) == 0x404) 357 (id->dma_1word & 0x404) == 0x404)
362 return 0; 358 return 1;
363
364 /* Consult the list of known "good" drives */
365 if (ide_dma_good_drive(drive))
366 return 0;
367 }
368 359
369 return -1; 360 /* Consult the list of known "good" drives */
361 if (ide_dma_good_drive(drive))
362 return 1;
363
364 return 0;
370} 365}
371 366
372/** 367/**
@@ -627,6 +622,8 @@ static int __ide_dma_test_irq(ide_drive_t *drive)
627 drive->name, __FUNCTION__); 622 drive->name, __FUNCTION__);
628 return 0; 623 return 0;
629} 624}
625#else
626static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; }
630#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ 627#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */
631 628
632int __ide_dma_bad_drive (ide_drive_t *drive) 629int __ide_dma_bad_drive (ide_drive_t *drive)
@@ -758,7 +755,7 @@ u8 ide_find_dma_mode(ide_drive_t *drive, u8 req_mode)
758 755
759EXPORT_SYMBOL_GPL(ide_find_dma_mode); 756EXPORT_SYMBOL_GPL(ide_find_dma_mode);
760 757
761int ide_tune_dma(ide_drive_t *drive) 758static int ide_tune_dma(ide_drive_t *drive)
762{ 759{
763 u8 speed; 760 u8 speed;
764 761
@@ -769,6 +766,9 @@ int ide_tune_dma(ide_drive_t *drive)
769 if (__ide_dma_bad_drive(drive)) 766 if (__ide_dma_bad_drive(drive))
770 return 0; 767 return 0;
771 768
769 if (drive->hwif->host_flags & IDE_HFLAG_TRUST_BIOS_FOR_DMA)
770 return config_drive_for_dma(drive);
771
772 speed = ide_max_dma_mode(drive); 772 speed = ide_max_dma_mode(drive);
773 773
774 if (!speed) 774 if (!speed)
@@ -785,6 +785,23 @@ int ide_tune_dma(ide_drive_t *drive)
785 785
786EXPORT_SYMBOL_GPL(ide_tune_dma); 786EXPORT_SYMBOL_GPL(ide_tune_dma);
787 787
788static int ide_dma_check(ide_drive_t *drive)
789{
790 ide_hwif_t *hwif = drive->hwif;
791 int vdma = (hwif->host_flags & IDE_HFLAG_VDMA)? 1 : 0;
792
793 if (!vdma && ide_tune_dma(drive))
794 return 0;
795
796 /* TODO: always do PIO fallback */
797 if (hwif->host_flags & IDE_HFLAG_TRUST_BIOS_FOR_DMA)
798 return -1;
799
800 ide_set_max_pio(drive);
801
802 return vdma ? 0 : -1;
803}
804
788void ide_dma_verbose(ide_drive_t *drive) 805void ide_dma_verbose(ide_drive_t *drive)
789{ 806{
790 struct hd_driveid *id = drive->id; 807 struct hd_driveid *id = drive->id;
@@ -842,7 +859,7 @@ int ide_set_dma(ide_drive_t *drive)
842 ide_hwif_t *hwif = drive->hwif; 859 ide_hwif_t *hwif = drive->hwif;
843 int rc; 860 int rc;
844 861
845 rc = hwif->ide_dma_check(drive); 862 rc = ide_dma_check(drive);
846 863
847 switch(rc) { 864 switch(rc) {
848 case -1: /* DMA needs to be disabled */ 865 case -1: /* DMA needs to be disabled */
@@ -1019,8 +1036,6 @@ void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_p
1019 hwif->ide_dma_on = &__ide_dma_on; 1036 hwif->ide_dma_on = &__ide_dma_on;
1020 if (!hwif->dma_host_on) 1037 if (!hwif->dma_host_on)
1021 hwif->dma_host_on = &ide_dma_host_on; 1038 hwif->dma_host_on = &ide_dma_host_on;
1022 if (!hwif->ide_dma_check)
1023 hwif->ide_dma_check = &config_drive_for_dma;
1024 if (!hwif->dma_setup) 1039 if (!hwif->dma_setup)
1025 hwif->dma_setup = &ide_dma_setup; 1040 hwif->dma_setup = &ide_dma_setup;
1026 if (!hwif->dma_exec_cmd) 1041 if (!hwif->dma_exec_cmd)
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 04273d3c147c..ec835e37e729 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -219,11 +219,11 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *
219 219
220 case ide_pm_restore_dma: /* Resume step 3 (restore DMA) */ 220 case ide_pm_restore_dma: /* Resume step 3 (restore DMA) */
221 /* 221 /*
222 * Right now, all we do is call hwif->ide_dma_check(drive), 222 * Right now, all we do is call ide_set_dma(drive),
223 * we could be smarter and check for current xfer_speed 223 * we could be smarter and check for current xfer_speed
224 * in struct drive etc... 224 * in struct drive etc...
225 */ 225 */
226 if (drive->hwif->ide_dma_check == NULL) 226 if (drive->hwif->ide_dma_on == NULL)
227 break; 227 break;
228 drive->hwif->dma_off_quietly(drive); 228 drive->hwif->dma_off_quietly(drive);
229 /* 229 /*
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index aa738833bed5..d4d790f91f91 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -776,7 +776,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
776// msleep(50); 776// msleep(50);
777 777
778#ifdef CONFIG_BLK_DEV_IDEDMA 778#ifdef CONFIG_BLK_DEV_IDEDMA
779 if (hwif->ide_dma_check) /* check if host supports DMA */ 779 if (hwif->ide_dma_on) /* check if host supports DMA */
780 hwif->dma_host_off(drive); 780 hwif->dma_host_off(drive);
781#endif 781#endif
782 782
@@ -830,7 +830,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
830#ifdef CONFIG_BLK_DEV_IDEDMA 830#ifdef CONFIG_BLK_DEV_IDEDMA
831 if (speed >= XFER_SW_DMA_0) 831 if (speed >= XFER_SW_DMA_0)
832 hwif->dma_host_on(drive); 832 hwif->dma_host_on(drive);
833 else if (hwif->ide_dma_check) /* check if host supports DMA */ 833 else if (hwif->ide_dma_on) /* check if host supports DMA */
834 hwif->dma_off_quietly(drive); 834 hwif->dma_off_quietly(drive);
835#endif 835#endif
836 836
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 34b1fb65bc79..c2d69d2d3044 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -844,7 +844,7 @@ static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))
844 * Move here to prevent module loading clashing. 844 * Move here to prevent module loading clashing.
845 */ 845 */
846 // drive->autodma = hwif->autodma; 846 // drive->autodma = hwif->autodma;
847 if (hwif->ide_dma_check) { 847 if (hwif->ide_dma_on) {
848 /* 848 /*
849 * Force DMAing for the beginning of the check. 849 * Force DMAing for the beginning of the check.
850 * Some chipsets appear to do interesting 850 * Some chipsets appear to do interesting
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 5c0e4078b5cb..4834cca5cb31 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -418,7 +418,6 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif)
418 hwif->dma_exec_cmd = tmp_hwif->dma_exec_cmd; 418 hwif->dma_exec_cmd = tmp_hwif->dma_exec_cmd;
419 hwif->dma_start = tmp_hwif->dma_start; 419 hwif->dma_start = tmp_hwif->dma_start;
420 hwif->ide_dma_end = tmp_hwif->ide_dma_end; 420 hwif->ide_dma_end = tmp_hwif->ide_dma_end;
421 hwif->ide_dma_check = tmp_hwif->ide_dma_check;
422 hwif->ide_dma_on = tmp_hwif->ide_dma_on; 421 hwif->ide_dma_on = tmp_hwif->ide_dma_on;
423 hwif->dma_off_quietly = tmp_hwif->dma_off_quietly; 422 hwif->dma_off_quietly = tmp_hwif->dma_off_quietly;
424 hwif->ide_dma_test_irq = tmp_hwif->ide_dma_test_irq; 423 hwif->ide_dma_test_irq = tmp_hwif->ide_dma_test_irq;
@@ -823,7 +822,7 @@ int set_using_dma(ide_drive_t *drive, int arg)
823 if (!drive->id || !(drive->id->capability & 1)) 822 if (!drive->id || !(drive->id->capability & 1))
824 goto out; 823 goto out;
825 824
826 if (hwif->ide_dma_check == NULL) 825 if (hwif->ide_dma_on == NULL)
827 goto out; 826 goto out;
828 827
829 err = -EBUSY; 828 err = -EBUSY;
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c
index 1c4732958fb2..cd00081fb278 100644
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -380,16 +380,6 @@ static u8 auide_mdma_filter(ide_drive_t *drive)
380 return drive->hwif->mwdma_mask; 380 return drive->hwif->mwdma_mask;
381} 381}
382 382
383static int auide_dma_check(ide_drive_t *drive)
384{
385 if (ide_tune_dma(drive))
386 return 0;
387
388 ide_set_max_pio(drive);
389
390 return -1;
391}
392
393static int auide_dma_test_irq(ide_drive_t *drive) 383static int auide_dma_test_irq(ide_drive_t *drive)
394{ 384{
395 if (drive->waiting_for_dma == 0) 385 if (drive->waiting_for_dma == 0)
@@ -700,7 +690,6 @@ static int au_ide_probe(struct device *dev)
700 690
701 hwif->mdma_filter = &auide_mdma_filter; 691 hwif->mdma_filter = &auide_mdma_filter;
702 692
703 hwif->ide_dma_check = &auide_dma_check;
704 hwif->dma_exec_cmd = &auide_dma_exec_cmd; 693 hwif->dma_exec_cmd = &auide_dma_exec_cmd;
705 hwif->dma_start = &auide_dma_start; 694 hwif->dma_start = &auide_dma_start;
706 hwif->ide_dma_end = &auide_dma_end; 695 hwif->ide_dma_end = &auide_dma_end;
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
index 91bf5beba5ce..97b39cebe63a 100644
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -141,16 +141,6 @@ static void aec_set_pio_mode(ide_drive_t *drive, const u8 pio)
141 drive->hwif->set_dma_mode(drive, pio + XFER_PIO_0); 141 drive->hwif->set_dma_mode(drive, pio + XFER_PIO_0);
142} 142}
143 143
144static int aec62xx_config_drive_xfer_rate (ide_drive_t *drive)
145{
146 if (ide_tune_dma(drive))
147 return 0;
148
149 ide_set_max_pio(drive);
150
151 return -1;
152}
153
154static void aec62xx_dma_lost_irq (ide_drive_t *drive) 144static void aec62xx_dma_lost_irq (ide_drive_t *drive)
155{ 145{
156 switch (HWIF(drive)->pci_dev->device) { 146 switch (HWIF(drive)->pci_dev->device) {
@@ -214,7 +204,6 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif)
214 hwif->ultra_mask = hwif->cds->udma_mask; 204 hwif->ultra_mask = hwif->cds->udma_mask;
215 hwif->mwdma_mask = 0x07; 205 hwif->mwdma_mask = 0x07;
216 206
217 hwif->ide_dma_check = &aec62xx_config_drive_xfer_rate;
218 hwif->dma_lost_irq = &aec62xx_dma_lost_irq; 207 hwif->dma_lost_irq = &aec62xx_dma_lost_irq;
219 208
220 if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) { 209 if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) {
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index 9582794eb65a..64b28cadb2b4 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -437,24 +437,6 @@ static void ali_set_dma_mode(ide_drive_t *drive, const u8 speed)
437} 437}
438 438
439/** 439/**
440 * ali15x3_config_drive_for_dma - configure for DMA
441 * @drive: drive to configure
442 *
443 * Configure a drive for DMA operation. If DMA is not possible we
444 * drop the drive into PIO mode instead.
445 */
446
447static int ali15x3_config_drive_for_dma(ide_drive_t *drive)
448{
449 if (ide_tune_dma(drive))
450 return 0;
451
452 ide_set_max_pio(drive);
453
454 return -1;
455}
456
457/**
458 * ali15x3_dma_setup - begin a DMA phase 440 * ali15x3_dma_setup - begin a DMA phase
459 * @drive: target device 441 * @drive: target device
460 * 442 *
@@ -713,7 +695,6 @@ static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif)
713 hwif->mwdma_mask = 0x07; 695 hwif->mwdma_mask = 0x07;
714 hwif->swdma_mask = 0x07; 696 hwif->swdma_mask = 0x07;
715 697
716 hwif->ide_dma_check = &ali15x3_config_drive_for_dma;
717 hwif->dma_setup = &ali15x3_dma_setup; 698 hwif->dma_setup = &ali15x3_dma_setup;
718 699
719 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 700 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c
index 6ff4089a2379..6fa5b3f87b8f 100644
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -264,16 +264,6 @@ static void amd_set_pio_mode(ide_drive_t *drive, const u8 pio)
264 amd_set_drive(drive, XFER_PIO_0 + pio); 264 amd_set_drive(drive, XFER_PIO_0 + pio);
265} 265}
266 266
267static int amd74xx_ide_dma_check(ide_drive_t *drive)
268{
269 if (ide_tune_dma(drive))
270 return 0;
271
272 ide_set_max_pio(drive);
273
274 return -1;
275}
276
277/* 267/*
278 * The initialization callback. Here we determine the IDE chip type 268 * The initialization callback. Here we determine the IDE chip type
279 * and initialize its drive independent registers. 269 * and initialize its drive independent registers.
@@ -415,7 +405,6 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
415 hwif->cbl = ATA_CBL_PATA40; 405 hwif->cbl = ATA_CBL_PATA40;
416 } 406 }
417 407
418 hwif->ide_dma_check = &amd74xx_ide_dma_check;
419 if (!noautodma) 408 if (!noautodma)
420 hwif->autodma = 1; 409 hwif->autodma = 1;
421 hwif->drives[0].autodma = hwif->autodma; 410 hwif->drives[0].autodma = hwif->autodma;
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c
index b457df883dcb..1dfd068daf76 100644
--- a/drivers/ide/pci/atiixp.c
+++ b/drivers/ide/pci/atiixp.c
@@ -159,24 +159,6 @@ static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed)
159} 159}
160 160
161/** 161/**
162 * atiixp_dma_check - set up an IDE device
163 * @drive: IDE drive to configure
164 *
165 * Set up the ATIIXP interface for the best available speed on this
166 * interface, preferring DMA to PIO.
167 */
168
169static int atiixp_dma_check(ide_drive_t *drive)
170{
171 if (ide_tune_dma(drive))
172 return 0;
173
174 ide_set_max_pio(drive);
175
176 return -1;
177}
178
179/**
180 * init_hwif_atiixp - fill in the hwif for the ATIIXP 162 * init_hwif_atiixp - fill in the hwif for the ATIIXP
181 * @hwif: IDE interface 163 * @hwif: IDE interface
182 * 164 *
@@ -215,7 +197,7 @@ static void __devinit init_hwif_atiixp(ide_hwif_t *hwif)
215 197
216 hwif->dma_host_on = &atiixp_dma_host_on; 198 hwif->dma_host_on = &atiixp_dma_host_on;
217 hwif->dma_host_off = &atiixp_dma_host_off; 199 hwif->dma_host_off = &atiixp_dma_host_off;
218 hwif->ide_dma_check = &atiixp_dma_check; 200
219 if (!noautodma) 201 if (!noautodma)
220 hwif->autodma = 1; 202 hwif->autodma = 1;
221 203
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index 52790cb6bce4..5f421deb3f3e 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -330,16 +330,6 @@ static void cmd64x_set_dma_mode(ide_drive_t *drive, const u8 speed)
330 (void) pci_write_config_byte(dev, pciU, regU); 330 (void) pci_write_config_byte(dev, pciU, regU);
331} 331}
332 332
333static int cmd64x_config_drive_for_dma (ide_drive_t *drive)
334{
335 if (ide_tune_dma(drive))
336 return 0;
337
338 ide_set_max_pio(drive);
339
340 return -1;
341}
342
343static int cmd648_ide_dma_end (ide_drive_t *drive) 333static int cmd648_ide_dma_end (ide_drive_t *drive)
344{ 334{
345 ide_hwif_t *hwif = HWIF(drive); 335 ide_hwif_t *hwif = HWIF(drive);
@@ -546,8 +536,6 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif)
546 if (dev->device == PCI_DEVICE_ID_CMD_646 && rev < 5) 536 if (dev->device == PCI_DEVICE_ID_CMD_646 && rev < 5)
547 hwif->ultra_mask = 0x00; 537 hwif->ultra_mask = 0x00;
548 538
549 hwif->ide_dma_check = &cmd64x_config_drive_for_dma;
550
551 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 539 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
552 hwif->cbl = ata66_cmd64x(hwif); 540 hwif->cbl = ata66_cmd64x(hwif);
553 541
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
index fbce90048aec..74c3e6048ff2 100644
--- a/drivers/ide/pci/cs5520.c
+++ b/drivers/ide/pci/cs5520.c
@@ -105,15 +105,6 @@ static void cs5520_set_dma_mode(ide_drive_t *drive, const u8 speed)
105 cs5520_set_pio_mode(drive, 0); 105 cs5520_set_pio_mode(drive, 0);
106} 106}
107 107
108static int cs5520_config_drive_xfer_rate(ide_drive_t *drive)
109{
110 /* Tune the drive for PIO modes up to PIO 4 */
111 ide_set_max_pio(drive);
112
113 /* Then tell the core to use DMA operations */
114 return 0;
115}
116
117/* 108/*
118 * We provide a callback for our nonstandard DMA location 109 * We provide a callback for our nonstandard DMA location
119 */ 110 */
@@ -148,7 +139,6 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif)
148 return; 139 return;
149 } 140 }
150 141
151 hwif->ide_dma_check = &cs5520_config_drive_xfer_rate;
152 hwif->ide_dma_on = &cs5520_dma_on; 142 hwif->ide_dma_on = &cs5520_dma_on;
153 143
154 /* ATAPI is harder so leave it for now */ 144 /* ATAPI is harder so leave it for now */
@@ -171,7 +161,8 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif)
171 .init_hwif = init_hwif_cs5520, \ 161 .init_hwif = init_hwif_cs5520, \
172 .autodma = AUTODMA, \ 162 .autodma = AUTODMA, \
173 .bootable = ON_BOARD, \ 163 .bootable = ON_BOARD, \
174 .host_flags = IDE_HFLAG_ISA_PORTS, \ 164 .host_flags = IDE_HFLAG_ISA_PORTS | \
165 IDE_HFLAG_VDMA, \
175 .pio_mask = ATA_PIO4, \ 166 .pio_mask = ATA_PIO4, \
176 } 167 }
177 168
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
index 1c82cd51f6d5..d37db0d7547c 100644
--- a/drivers/ide/pci/cs5530.c
+++ b/drivers/ide/pci/cs5530.c
@@ -104,24 +104,6 @@ out:
104 return mask; 104 return mask;
105} 105}
106 106
107/**
108 * cs5530_config_dma - set DMA/UDMA mode
109 * @drive: drive to tune
110 *
111 * cs5530_config_dma() handles setting of DMA/UDMA mode
112 * for both the chipset and drive.
113 */
114
115static int cs5530_config_dma(ide_drive_t *drive)
116{
117 if (ide_tune_dma(drive))
118 return 0;
119
120 ide_set_max_pio(drive);
121
122 return -1;
123}
124
125static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode) 107static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode)
126{ 108{
127 unsigned long basereg; 109 unsigned long basereg;
@@ -288,7 +270,7 @@ static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif)
288 hwif->mwdma_mask = 0x07; 270 hwif->mwdma_mask = 0x07;
289 271
290 hwif->udma_filter = cs5530_udma_filter; 272 hwif->udma_filter = cs5530_udma_filter;
291 hwif->ide_dma_check = &cs5530_config_dma; 273
292 if (!noautodma) 274 if (!noautodma)
293 hwif->autodma = 1; 275 hwif->autodma = 1;
294 hwif->drives[0].autodma = hwif->autodma; 276 hwif->drives[0].autodma = hwif->autodma;
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c
index 2a72b4f22ddf..4692c39c6996 100644
--- a/drivers/ide/pci/cs5535.c
+++ b/drivers/ide/pci/cs5535.c
@@ -157,16 +157,6 @@ static void cs5535_set_pio_mode(ide_drive_t *drive, const u8 pio)
157 cs5535_set_speed(drive, XFER_PIO_0 + pio); 157 cs5535_set_speed(drive, XFER_PIO_0 + pio);
158} 158}
159 159
160static int cs5535_dma_check(ide_drive_t *drive)
161{
162 if (ide_tune_dma(drive))
163 return 0;
164
165 ide_set_max_pio(drive);
166
167 return -1;
168}
169
170static u8 __devinit cs5535_cable_detect(struct pci_dev *dev) 160static u8 __devinit cs5535_cable_detect(struct pci_dev *dev)
171{ 161{
172 u8 bit; 162 u8 bit;
@@ -197,8 +187,6 @@ static void __devinit init_hwif_cs5535(ide_hwif_t *hwif)
197 if (hwif->dma_base == 0) 187 if (hwif->dma_base == 0)
198 return; 188 return;
199 189
200 hwif->ide_dma_check = &cs5535_dma_check;
201
202 hwif->atapi_dma = 1; 190 hwif->atapi_dma = 1;
203 hwif->ultra_mask = 0x1F; 191 hwif->ultra_mask = 0x1F;
204 hwif->mwdma_mask = 0x07; 192 hwif->mwdma_mask = 0x07;
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c
index dc278025d318..b8f98426e3e1 100644
--- a/drivers/ide/pci/cy82c693.c
+++ b/drivers/ide/pci/cy82c693.c
@@ -469,7 +469,7 @@ static ide_pci_device_t cy82c693_chipset __devinitdata = {
469 .init_hwif = init_hwif_cy82c693, 469 .init_hwif = init_hwif_cy82c693,
470 .autodma = AUTODMA, 470 .autodma = AUTODMA,
471 .bootable = ON_BOARD, 471 .bootable = ON_BOARD,
472 .host_flags = IDE_HFLAG_SINGLE, 472 .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_TRUST_BIOS_FOR_DMA,
473 .pio_mask = ATA_PIO4, 473 .pio_mask = ATA_PIO4,
474}; 474};
475 475
diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c
index 48caa468b762..e8156c1ba63d 100644
--- a/drivers/ide/pci/generic.c
+++ b/drivers/ide/pci/generic.c
@@ -97,77 +97,92 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = {
97 .init_hwif = init_hwif_generic, 97 .init_hwif = init_hwif_generic,
98 .autodma = AUTODMA, 98 .autodma = AUTODMA,
99 .bootable = ON_BOARD, 99 .bootable = ON_BOARD,
100 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
100 },{ /* 1 */ 101 },{ /* 1 */
101 .name = "NS87410", 102 .name = "NS87410",
102 .init_hwif = init_hwif_generic, 103 .init_hwif = init_hwif_generic,
103 .autodma = AUTODMA, 104 .autodma = AUTODMA,
104 .enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}}, 105 .enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}},
105 .bootable = ON_BOARD, 106 .bootable = ON_BOARD,
107 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
106 },{ /* 2 */ 108 },{ /* 2 */
107 .name = "SAMURAI", 109 .name = "SAMURAI",
108 .init_hwif = init_hwif_generic, 110 .init_hwif = init_hwif_generic,
109 .autodma = AUTODMA, 111 .autodma = AUTODMA,
110 .bootable = ON_BOARD, 112 .bootable = ON_BOARD,
113 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
111 },{ /* 3 */ 114 },{ /* 3 */
112 .name = "HT6565", 115 .name = "HT6565",
113 .init_hwif = init_hwif_generic, 116 .init_hwif = init_hwif_generic,
114 .autodma = AUTODMA, 117 .autodma = AUTODMA,
115 .bootable = ON_BOARD, 118 .bootable = ON_BOARD,
119 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
116 },{ /* 4 */ 120 },{ /* 4 */
117 .name = "UM8673F", 121 .name = "UM8673F",
118 .init_hwif = init_hwif_generic, 122 .init_hwif = init_hwif_generic,
119 .autodma = NODMA, 123 .autodma = NODMA,
120 .bootable = ON_BOARD, 124 .bootable = ON_BOARD,
125 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
121 },{ /* 5 */ 126 },{ /* 5 */
122 .name = "UM8886A", 127 .name = "UM8886A",
123 .init_hwif = init_hwif_generic, 128 .init_hwif = init_hwif_generic,
124 .autodma = NODMA, 129 .autodma = NODMA,
125 .bootable = ON_BOARD, 130 .bootable = ON_BOARD,
131 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
126 },{ /* 6 */ 132 },{ /* 6 */
127 .name = "UM8886BF", 133 .name = "UM8886BF",
128 .init_hwif = init_hwif_generic, 134 .init_hwif = init_hwif_generic,
129 .autodma = NODMA, 135 .autodma = NODMA,
130 .bootable = ON_BOARD, 136 .bootable = ON_BOARD,
137 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
131 },{ /* 7 */ 138 },{ /* 7 */
132 .name = "HINT_IDE", 139 .name = "HINT_IDE",
133 .init_hwif = init_hwif_generic, 140 .init_hwif = init_hwif_generic,
134 .autodma = AUTODMA, 141 .autodma = AUTODMA,
135 .bootable = ON_BOARD, 142 .bootable = ON_BOARD,
143 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
136 },{ /* 8 */ 144 },{ /* 8 */
137 .name = "VIA_IDE", 145 .name = "VIA_IDE",
138 .init_hwif = init_hwif_generic, 146 .init_hwif = init_hwif_generic,
139 .autodma = NOAUTODMA, 147 .autodma = NOAUTODMA,
140 .bootable = ON_BOARD, 148 .bootable = ON_BOARD,
149 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
141 },{ /* 9 */ 150 },{ /* 9 */
142 .name = "OPTI621V", 151 .name = "OPTI621V",
143 .init_hwif = init_hwif_generic, 152 .init_hwif = init_hwif_generic,
144 .autodma = NOAUTODMA, 153 .autodma = NOAUTODMA,
145 .bootable = ON_BOARD, 154 .bootable = ON_BOARD,
155 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
146 },{ /* 10 */ 156 },{ /* 10 */
147 .name = "VIA8237SATA", 157 .name = "VIA8237SATA",
148 .init_hwif = init_hwif_generic, 158 .init_hwif = init_hwif_generic,
149 .autodma = AUTODMA, 159 .autodma = AUTODMA,
150 .bootable = OFF_BOARD, 160 .bootable = OFF_BOARD,
161 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
151 },{ /* 11 */ 162 },{ /* 11 */
152 .name = "Piccolo0102", 163 .name = "Piccolo0102",
153 .init_hwif = init_hwif_generic, 164 .init_hwif = init_hwif_generic,
154 .autodma = NOAUTODMA, 165 .autodma = NOAUTODMA,
155 .bootable = ON_BOARD, 166 .bootable = ON_BOARD,
167 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
156 },{ /* 12 */ 168 },{ /* 12 */
157 .name = "Piccolo0103", 169 .name = "Piccolo0103",
158 .init_hwif = init_hwif_generic, 170 .init_hwif = init_hwif_generic,
159 .autodma = NOAUTODMA, 171 .autodma = NOAUTODMA,
160 .bootable = ON_BOARD, 172 .bootable = ON_BOARD,
173 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
161 },{ /* 13 */ 174 },{ /* 13 */
162 .name = "Piccolo0105", 175 .name = "Piccolo0105",
163 .init_hwif = init_hwif_generic, 176 .init_hwif = init_hwif_generic,
164 .autodma = NOAUTODMA, 177 .autodma = NOAUTODMA,
165 .bootable = ON_BOARD, 178 .bootable = ON_BOARD,
179 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
166 },{ /* 14 */ 180 },{ /* 14 */
167 .name = "Revolution", 181 .name = "Revolution",
168 .init_hwif = init_hwif_generic, 182 .init_hwif = init_hwif_generic,
169 .autodma = AUTODMA, 183 .autodma = AUTODMA,
170 .bootable = OFF_BOARD, 184 .bootable = OFF_BOARD,
185 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
171 } 186 }
172}; 187};
173 188
diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c
index 69724887225c..449132583bb4 100644
--- a/drivers/ide/pci/hpt34x.c
+++ b/drivers/ide/pci/hpt34x.c
@@ -80,16 +80,6 @@ static void hpt34x_set_pio_mode(ide_drive_t *drive, const u8 pio)
80 hpt34x_set_mode(drive, XFER_PIO_0 + pio); 80 hpt34x_set_mode(drive, XFER_PIO_0 + pio);
81} 81}
82 82
83static int hpt34x_config_drive_xfer_rate (ide_drive_t *drive)
84{
85 if (ide_tune_dma(drive))
86 return -1;
87
88 ide_set_max_pio(drive);
89
90 return -1;
91}
92
93/* 83/*
94 * If the BIOS does not set the IO base addaress to XX00, 343 will fail. 84 * If the BIOS does not set the IO base addaress to XX00, 343 will fail.
95 */ 85 */
@@ -156,7 +146,6 @@ static void __devinit init_hwif_hpt34x(ide_hwif_t *hwif)
156 hwif->swdma_mask = 0x07; 146 hwif->swdma_mask = 0x07;
157#endif 147#endif
158 148
159 hwif->ide_dma_check = &hpt34x_config_drive_xfer_rate;
160 if (!noautodma) 149 if (!noautodma)
161 hwif->autodma = (pcicmd & PCI_COMMAND_MEMORY) ? 1 : 0; 150 hwif->autodma = (pcicmd & PCI_COMMAND_MEMORY) ? 1 : 0;
162 hwif->drives[0].autodma = hwif->autodma; 151 hwif->drives[0].autodma = hwif->autodma;
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index 992b60eeee3f..8cb6b74f0148 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -713,16 +713,6 @@ static void hpt3xx_maskproc(ide_drive_t *drive, int mask)
713 IDE_CONTROL_REG); 713 IDE_CONTROL_REG);
714} 714}
715 715
716static int hpt366_config_drive_xfer_rate(ide_drive_t *drive)
717{
718 if (ide_tune_dma(drive))
719 return 0;
720
721 ide_set_max_pio(drive);
722
723 return -1;
724}
725
726/* 716/*
727 * This is specific to the HPT366 UDMA chipset 717 * This is specific to the HPT366 UDMA chipset
728 * by HighPoint|Triones Technologies, Inc. 718 * by HighPoint|Triones Technologies, Inc.
@@ -1346,8 +1336,6 @@ static void __devinit init_hwif_hpt366(ide_hwif_t *hwif)
1346 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 1336 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
1347 hwif->cbl = (scr1 & ata66) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; 1337 hwif->cbl = (scr1 & ata66) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;
1348 1338
1349 hwif->ide_dma_check = &hpt366_config_drive_xfer_rate;
1350
1351 if (chip_type >= HPT374) { 1339 if (chip_type >= HPT374) {
1352 hwif->ide_dma_test_irq = &hpt374_ide_dma_test_irq; 1340 hwif->ide_dma_test_irq = &hpt374_ide_dma_test_irq;
1353 hwif->ide_dma_end = &hpt374_ide_dma_end; 1341 hwif->ide_dma_end = &hpt374_ide_dma_end;
diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c
index 6dab0daf4943..069152dd4697 100644
--- a/drivers/ide/pci/it8213.c
+++ b/drivers/ide/pci/it8213.c
@@ -158,32 +158,10 @@ static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed)
158} 158}
159 159
160/** 160/**
161 * it8213_configure_drive_for_dma - set up for DMA transfers
162 * @drive: drive we are going to set up
163 *
164 * Set up the drive for DMA, tune the controller and drive as
165 * required. If the drive isn't suitable for DMA or we hit
166 * other problems then we will drop down to PIO and set up
167 * PIO appropriately
168 */
169
170static int it8213_config_drive_for_dma (ide_drive_t *drive)
171{
172 if (ide_tune_dma(drive))
173 return 0;
174
175 ide_set_max_pio(drive);
176
177 return -1;
178}
179
180/**
181 * init_hwif_it8213 - set up hwif structs 161 * init_hwif_it8213 - set up hwif structs
182 * @hwif: interface to set up 162 * @hwif: interface to set up
183 * 163 *
184 * We do the basic set up of the interface structure. The IT8212 164 * We do the basic set up of the interface structure.
185 * requires several custom handlers so we override the default
186 * ide DMA handlers appropriately
187 */ 165 */
188 166
189static void __devinit init_hwif_it8213(ide_hwif_t *hwif) 167static void __devinit init_hwif_it8213(ide_hwif_t *hwif)
@@ -208,8 +186,6 @@ static void __devinit init_hwif_it8213(ide_hwif_t *hwif)
208 186
209 pci_read_config_byte(hwif->pci_dev, 0x42, &reg42h); 187 pci_read_config_byte(hwif->pci_dev, 0x42, &reg42h);
210 188
211 hwif->ide_dma_check = &it8213_config_drive_for_dma;
212
213 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 189 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
214 hwif->cbl = (reg42h & 0x02) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; 190 hwif->cbl = (reg42h & 0x02) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;
215 191
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c
index 1b69d82478c6..25595acc299f 100644
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -416,26 +416,6 @@ static void it821x_set_dma_mode(ide_drive_t *drive, const u8 speed)
416} 416}
417 417
418/** 418/**
419 * it821x_configure_drive_for_dma - set up for DMA transfers
420 * @drive: drive we are going to set up
421 *
422 * Set up the drive for DMA, tune the controller and drive as
423 * required. If the drive isn't suitable for DMA or we hit
424 * other problems then we will drop down to PIO and set up
425 * PIO appropriately
426 */
427
428static int it821x_config_drive_for_dma (ide_drive_t *drive)
429{
430 if (ide_tune_dma(drive))
431 return 0;
432
433 ide_set_max_pio(drive);
434
435 return -1;
436}
437
438/**
439 * ata66_it821x - check for 80 pin cable 419 * ata66_it821x - check for 80 pin cable
440 * @hwif: interface to check 420 * @hwif: interface to check
441 * 421 *
@@ -615,8 +595,6 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
615 hwif->ultra_mask = 0x7f; 595 hwif->ultra_mask = 0x7f;
616 hwif->mwdma_mask = 0x07; 596 hwif->mwdma_mask = 0x07;
617 597
618 hwif->ide_dma_check = &it821x_config_drive_for_dma;
619
620 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 598 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
621 hwif->cbl = ata66_it821x(hwif); 599 hwif->cbl = ata66_it821x(hwif);
622 600
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c
index 582b4cae2b53..e4a4f1fb5be7 100644
--- a/drivers/ide/pci/jmicron.c
+++ b/drivers/ide/pci/jmicron.c
@@ -100,24 +100,6 @@ static void jmicron_set_dma_mode(ide_drive_t *drive, const u8 mode)
100} 100}
101 101
102/** 102/**
103 * jmicron_configure_drive_for_dma - set up for DMA transfers
104 * @drive: drive we are going to set up
105 *
106 * As the JMicron snoops for timings all we actually need to do is
107 * make sure we don't set an invalid mode.
108 */
109
110static int jmicron_config_drive_for_dma (ide_drive_t *drive)
111{
112 if (ide_tune_dma(drive))
113 return 0;
114
115 ide_set_max_pio(drive);
116
117 return -1;
118}
119
120/**
121 * init_hwif_jmicron - set up hwif structs 103 * init_hwif_jmicron - set up hwif structs
122 * @hwif: interface to set up 104 * @hwif: interface to set up
123 * 105 *
@@ -139,8 +121,6 @@ static void __devinit init_hwif_jmicron(ide_hwif_t *hwif)
139 hwif->ultra_mask = 0x7f; 121 hwif->ultra_mask = 0x7f;
140 hwif->mwdma_mask = 0x07; 122 hwif->mwdma_mask = 0x07;
141 123
142 hwif->ide_dma_check = &jmicron_config_drive_for_dma;
143
144 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 124 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
145 hwif->cbl = ata66_jmicron(hwif); 125 hwif->cbl = ata66_jmicron(hwif);
146 126
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
index 465c935fdf25..422c234d6c98 100644
--- a/drivers/ide/pci/ns87415.c
+++ b/drivers/ide/pci/ns87415.c
@@ -274,6 +274,7 @@ static ide_pci_device_t ns87415_chipset __devinitdata = {
274 .init_hwif = init_hwif_ns87415, 274 .init_hwif = init_hwif_ns87415,
275 .autodma = AUTODMA, 275 .autodma = AUTODMA,
276 .bootable = ON_BOARD, 276 .bootable = ON_BOARD,
277 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
277}; 278};
278 279
279static int __devinit ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id) 280static int __devinit ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id)
diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c
index 9fa06393469a..38f8a4cb91d2 100644
--- a/drivers/ide/pci/opti621.c
+++ b/drivers/ide/pci/opti621.c
@@ -355,6 +355,7 @@ static ide_pci_device_t opti621_chipsets[] __devinitdata = {
355 .enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}}, 355 .enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}},
356 .bootable = ON_BOARD, 356 .bootable = ON_BOARD,
357 .pio_mask = ATA_PIO3, 357 .pio_mask = ATA_PIO3,
358 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
358 },{ /* 1 */ 359 },{ /* 1 */
359 .name = "OPTI621X", 360 .name = "OPTI621X",
360 .init_hwif = init_hwif_opti621, 361 .init_hwif = init_hwif_opti621,
@@ -362,6 +363,7 @@ static ide_pci_device_t opti621_chipsets[] __devinitdata = {
362 .enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}}, 363 .enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}},
363 .bootable = ON_BOARD, 364 .bootable = ON_BOARD,
364 .pio_mask = ATA_PIO3, 365 .pio_mask = ATA_PIO3,
366 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
365 } 367 }
366}; 368};
367 369
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index 9767232e2f8a..65e460dbe8b6 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -223,16 +223,6 @@ static u8 pdcnew_cable_detect(ide_hwif_t *hwif)
223 return ATA_CBL_PATA80; 223 return ATA_CBL_PATA80;
224} 224}
225 225
226static int pdcnew_config_drive_xfer_rate(ide_drive_t *drive)
227{
228 if (ide_tune_dma(drive))
229 return 0;
230
231 ide_set_max_pio(drive);
232
233 return -1;
234}
235
236static int pdcnew_quirkproc(ide_drive_t *drive) 226static int pdcnew_quirkproc(ide_drive_t *drive)
237{ 227{
238 const char **list, *model = drive->id->model; 228 const char **list, *model = drive->id->model;
@@ -499,8 +489,6 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)
499 hwif->ultra_mask = hwif->cds->udma_mask; 489 hwif->ultra_mask = hwif->cds->udma_mask;
500 hwif->mwdma_mask = 0x07; 490 hwif->mwdma_mask = 0x07;
501 491
502 hwif->ide_dma_check = &pdcnew_config_drive_xfer_rate;
503
504 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 492 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
505 hwif->cbl = pdcnew_cable_detect(hwif); 493 hwif->cbl = pdcnew_cable_detect(hwif);
506 494
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
index b2c7b6e3edd5..4efc758c7638 100644
--- a/drivers/ide/pci/pdc202xx_old.c
+++ b/drivers/ide/pci/pdc202xx_old.c
@@ -179,16 +179,6 @@ static void pdc_old_disable_66MHz_clock(ide_hwif_t *hwif)
179 outb(clock & ~(hwif->channel ? 0x08 : 0x02), clock_reg); 179 outb(clock & ~(hwif->channel ? 0x08 : 0x02), clock_reg);
180} 180}
181 181
182static int pdc202xx_config_drive_xfer_rate (ide_drive_t *drive)
183{
184 if (ide_tune_dma(drive))
185 return 0;
186
187 ide_set_max_pio(drive);
188
189 return -1;
190}
191
192static int pdc202xx_quirkproc (ide_drive_t *drive) 182static int pdc202xx_quirkproc (ide_drive_t *drive)
193{ 183{
194 const char **list, *model = drive->id->model; 184 const char **list, *model = drive->id->model;
@@ -344,7 +334,6 @@ static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif)
344 hwif->swdma_mask = 0x07; 334 hwif->swdma_mask = 0x07;
345 hwif->atapi_dma = 1; 335 hwif->atapi_dma = 1;
346 336
347 hwif->ide_dma_check = &pdc202xx_config_drive_xfer_rate;
348 hwif->dma_lost_irq = &pdc202xx_dma_lost_irq; 337 hwif->dma_lost_irq = &pdc202xx_dma_lost_irq;
349 hwif->dma_timeout = &pdc202xx_dma_timeout; 338 hwif->dma_timeout = &pdc202xx_dma_timeout;
350 339
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
index dcb0701f10b5..d5a31e9f5727 100644
--- a/drivers/ide/pci/piix.c
+++ b/drivers/ide/pci/piix.c
@@ -255,24 +255,6 @@ static void piix_set_dma_mode(ide_drive_t *drive, const u8 speed)
255} 255}
256 256
257/** 257/**
258 * piix_config_drive_xfer_rate - set up an IDE device
259 * @drive: IDE drive to configure
260 *
261 * Set up the PIIX interface for the best available speed on this
262 * interface, preferring DMA to PIO.
263 */
264
265static int piix_config_drive_xfer_rate (ide_drive_t *drive)
266{
267 if (ide_tune_dma(drive))
268 return 0;
269
270 ide_set_max_pio(drive);
271
272 return -1;
273}
274
275/**
276 * piix_is_ichx - check if ICHx 258 * piix_is_ichx - check if ICHx
277 * @dev: PCI device to check 259 * @dev: PCI device to check
278 * 260 *
@@ -432,7 +414,6 @@ static void __devinit init_hwif_piix(ide_hwif_t *hwif)
432 if (no_piix_dma) 414 if (no_piix_dma)
433 hwif->ultra_mask = hwif->mwdma_mask = hwif->swdma_mask = 0; 415 hwif->ultra_mask = hwif->mwdma_mask = hwif->swdma_mask = 0;
434 416
435 hwif->ide_dma_check = &piix_config_drive_xfer_rate;
436 if (!noautodma) 417 if (!noautodma)
437 hwif->autodma = 1; 418 hwif->autodma = 1;
438 419
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
index 184249ed125b..38cfc8c2ea58 100644
--- a/drivers/ide/pci/sc1200.c
+++ b/drivers/ide/pci/sc1200.c
@@ -199,21 +199,6 @@ static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode)
199 } 199 }
200} 200}
201 201
202/*
203 * sc1200_config_dma() handles selection/setting of DMA/UDMA modes
204 * for both the chipset and drive.
205 */
206static int sc1200_config_dma (ide_drive_t *drive)
207{
208 if (ide_tune_dma(drive))
209 return 0;
210
211 ide_set_max_pio(drive);
212
213 return -1;
214}
215
216
217/* Replacement for the standard ide_dma_end action in 202/* Replacement for the standard ide_dma_end action in
218 * dma_proc. 203 * dma_proc.
219 * 204 *
@@ -391,7 +376,6 @@ static void __devinit init_hwif_sc1200 (ide_hwif_t *hwif)
391 return; 376 return;
392 377
393 hwif->udma_filter = sc1200_udma_filter; 378 hwif->udma_filter = sc1200_udma_filter;
394 hwif->ide_dma_check = &sc1200_config_dma;
395 hwif->ide_dma_end = &sc1200_ide_dma_end; 379 hwif->ide_dma_end = &sc1200_ide_dma_end;
396 380
397 if (!noautodma) 381 if (!noautodma)
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c
index f839bdeb903b..977b48e95ba4 100644
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -284,27 +284,6 @@ static void scc_set_dma_mode(ide_drive_t *drive, const u8 speed)
284} 284}
285 285
286/** 286/**
287 * scc_configure_drive_for_dma - set up for DMA transfers
288 * @drive: drive we are going to set up
289 *
290 * Set up the drive for DMA, tune the controller and drive as
291 * required.
292 * If the drive isn't suitable for DMA or we hit other problems
293 * then we will drop down to PIO and set up PIO appropriately.
294 * (return -1)
295 */
296
297static int scc_config_drive_for_dma(ide_drive_t *drive)
298{
299 if (ide_tune_dma(drive))
300 return 0;
301
302 ide_set_max_pio(drive);
303
304 return -1;
305}
306
307/**
308 * scc_ide_dma_setup - begin a DMA phase 287 * scc_ide_dma_setup - begin a DMA phase
309 * @drive: target device 288 * @drive: target device
310 * 289 *
@@ -701,7 +680,6 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif)
701 hwif->ide_dma_end = scc_ide_dma_end; 680 hwif->ide_dma_end = scc_ide_dma_end;
702 hwif->set_pio_mode = scc_set_pio_mode; 681 hwif->set_pio_mode = scc_set_pio_mode;
703 hwif->set_dma_mode = scc_set_dma_mode; 682 hwif->set_dma_mode = scc_set_dma_mode;
704 hwif->ide_dma_check = scc_config_drive_for_dma;
705 hwif->ide_dma_test_irq = scc_dma_test_irq; 683 hwif->ide_dma_test_irq = scc_dma_test_irq;
706 hwif->udma_filter = scc_udma_filter; 684 hwif->udma_filter = scc_udma_filter;
707 685
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
index 4666e4c1597b..c0d82d290587 100644
--- a/drivers/ide/pci/serverworks.c
+++ b/drivers/ide/pci/serverworks.c
@@ -196,16 +196,6 @@ static void svwks_set_dma_mode(ide_drive_t *drive, const u8 speed)
196 pci_write_config_byte(dev, 0x54, ultra_enable); 196 pci_write_config_byte(dev, 0x54, ultra_enable);
197} 197}
198 198
199static int svwks_config_drive_xfer_rate (ide_drive_t *drive)
200{
201 if (ide_tune_dma(drive))
202 return 0;
203
204 ide_set_max_pio(drive);
205
206 return -1;
207}
208
209static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const char *name) 199static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const char *name)
210{ 200{
211 unsigned int reg; 201 unsigned int reg;
@@ -392,7 +382,6 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
392 if (!hwif->dma_base) 382 if (!hwif->dma_base)
393 return; 383 return;
394 384
395 hwif->ide_dma_check = &svwks_config_drive_xfer_rate;
396 if (hwif->pci_dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { 385 if (hwif->pci_dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) {
397 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 386 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
398 hwif->cbl = ata66_svwks(hwif); 387 hwif->cbl = ata66_svwks(hwif);
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index c74fef6bbc91..210f32d1e93c 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -296,20 +296,6 @@ static void sgiioc4_set_dma_mode(ide_drive_t *drive, const u8 speed)
296{ 296{
297} 297}
298 298
299static int sgiioc4_ide_dma_check(ide_drive_t *drive)
300{
301 if (ide_tune_dma(drive))
302 return 0;
303
304 /*
305 * ->set_pio_mode is not implemented currently
306 * so this is just for the completness
307 */
308 ide_set_max_pio(drive);
309
310 return -1;
311}
312
313/* returns 1 if dma irq issued, 0 otherwise */ 299/* returns 1 if dma irq issued, 0 otherwise */
314static int 300static int
315sgiioc4_ide_dma_test_irq(ide_drive_t * drive) 301sgiioc4_ide_dma_test_irq(ide_drive_t * drive)
@@ -612,7 +598,6 @@ ide_init_sgiioc4(ide_hwif_t * hwif)
612 hwif->dma_setup = &sgiioc4_ide_dma_setup; 598 hwif->dma_setup = &sgiioc4_ide_dma_setup;
613 hwif->dma_start = &sgiioc4_ide_dma_start; 599 hwif->dma_start = &sgiioc4_ide_dma_start;
614 hwif->ide_dma_end = &sgiioc4_ide_dma_end; 600 hwif->ide_dma_end = &sgiioc4_ide_dma_end;
615 hwif->ide_dma_check = &sgiioc4_ide_dma_check;
616 hwif->ide_dma_on = &sgiioc4_ide_dma_on; 601 hwif->ide_dma_on = &sgiioc4_ide_dma_on;
617 hwif->dma_off_quietly = &sgiioc4_dma_off_quietly; 602 hwif->dma_off_quietly = &sgiioc4_dma_off_quietly;
618 hwif->ide_dma_test_irq = &sgiioc4_ide_dma_test_irq; 603 hwif->ide_dma_test_irq = &sgiioc4_ide_dma_test_irq;
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index 8be36f3b69a8..9e03bc7c8665 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -311,26 +311,6 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed)
311 } 311 }
312} 312}
313 313
314/**
315 * siimage_configure_drive_for_dma - set up for DMA transfers
316 * @drive: drive we are going to set up
317 *
318 * Set up the drive for DMA, tune the controller and drive as
319 * required. If the drive isn't suitable for DMA or we hit
320 * other problems then we will drop down to PIO and set up
321 * PIO appropriately
322 */
323
324static int siimage_config_drive_for_dma (ide_drive_t *drive)
325{
326 if (ide_tune_dma(drive))
327 return 0;
328
329 ide_set_max_pio(drive);
330
331 return -1;
332}
333
334/* returns 1 if dma irq issued, 0 otherwise */ 314/* returns 1 if dma irq issued, 0 otherwise */
335static int siimage_io_ide_dma_test_irq (ide_drive_t *drive) 315static int siimage_io_ide_dma_test_irq (ide_drive_t *drive)
336{ 316{
@@ -924,8 +904,6 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
924 if (!is_sata(hwif)) 904 if (!is_sata(hwif))
925 hwif->atapi_dma = 1; 905 hwif->atapi_dma = 1;
926 906
927 hwif->ide_dma_check = &siimage_config_drive_for_dma;
928
929 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 907 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
930 hwif->cbl = ata66_siimage(hwif); 908 hwif->cbl = ata66_siimage(hwif);
931 909
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index 5458c56e69b0..45666b45231a 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -601,16 +601,6 @@ static void sis_set_dma_mode(ide_drive_t *drive, const u8 speed)
601 } 601 }
602} 602}
603 603
604static int sis5513_config_xfer_rate(ide_drive_t *drive)
605{
606 if (ide_tune_dma(drive))
607 return 0;
608
609 ide_set_max_pio(drive);
610
611 return -1;
612}
613
614static u8 sis5513_ata133_udma_filter(ide_drive_t *drive) 604static u8 sis5513_ata133_udma_filter(ide_drive_t *drive)
615{ 605{
616 struct pci_dev *dev = drive->hwif->pci_dev; 606 struct pci_dev *dev = drive->hwif->pci_dev;
@@ -847,8 +837,6 @@ static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif)
847 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 837 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
848 hwif->cbl = ata66_sis5513(hwif); 838 hwif->cbl = ata66_sis5513(hwif);
849 839
850 hwif->ide_dma_check = &sis5513_config_xfer_rate;
851
852 if (!noautodma) 840 if (!noautodma)
853 hwif->autodma = 1; 841 hwif->autodma = 1;
854 842
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
index 245eac05ab1b..c9090faf49bd 100644
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -145,21 +145,6 @@ static void sl82c105_set_dma_mode(ide_drive_t *drive, const u8 speed)
145} 145}
146 146
147/* 147/*
148 * Check to see if the drive and chipset are capable of DMA mode.
149 */
150static int sl82c105_ide_dma_check(ide_drive_t *drive)
151{
152 DBG(("sl82c105_ide_dma_check(drive:%s)\n", drive->name));
153
154 if (ide_tune_dma(drive))
155 return 0;
156
157 ide_set_max_pio(drive);
158
159 return -1;
160}
161
162/*
163 * The SL82C105 holds off all IDE interrupts while in DMA mode until 148 * The SL82C105 holds off all IDE interrupts while in DMA mode until
164 * all DMA activity is completed. Sometimes this causes problems (eg, 149 * all DMA activity is completed. Sometimes this causes problems (eg,
165 * when the drive wants to report an error condition). 150 * when the drive wants to report an error condition).
@@ -406,7 +391,6 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif)
406 hwif->atapi_dma = 1; 391 hwif->atapi_dma = 1;
407 hwif->mwdma_mask = 0x07; 392 hwif->mwdma_mask = 0x07;
408 393
409 hwif->ide_dma_check = &sl82c105_ide_dma_check;
410 hwif->ide_dma_on = &sl82c105_ide_dma_on; 394 hwif->ide_dma_on = &sl82c105_ide_dma_on;
411 hwif->dma_off_quietly = &sl82c105_dma_off_quietly; 395 hwif->dma_off_quietly = &sl82c105_dma_off_quietly;
412 hwif->dma_lost_irq = &sl82c105_dma_lost_irq; 396 hwif->dma_lost_irq = &sl82c105_dma_lost_irq;
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
index 41c5c571f6bd..bf21f1dfb7b5 100644
--- a/drivers/ide/pci/slc90e66.c
+++ b/drivers/ide/pci/slc90e66.c
@@ -130,16 +130,6 @@ static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed)
130 slc90e66_set_pio_mode(drive, pio); 130 slc90e66_set_pio_mode(drive, pio);
131} 131}
132 132
133static int slc90e66_config_drive_xfer_rate (ide_drive_t *drive)
134{
135 if (ide_tune_dma(drive))
136 return 0;
137
138 ide_set_max_pio(drive);
139
140 return -1;
141}
142
143static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) 133static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif)
144{ 134{
145 u8 reg47 = 0; 135 u8 reg47 = 0;
@@ -170,8 +160,6 @@ static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif)
170 /* bit[0(1)]: 0:80, 1:40 */ 160 /* bit[0(1)]: 0:80, 1:40 */
171 hwif->cbl = (reg47 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; 161 hwif->cbl = (reg47 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;
172 162
173 hwif->ide_dma_check = &slc90e66_config_drive_xfer_rate;
174
175 if (!noautodma) 163 if (!noautodma)
176 hwif->autodma = 1; 164 hwif->autodma = 1;
177 hwif->drives[0].autodma = hwif->autodma; 165 hwif->drives[0].autodma = hwif->autodma;
diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c
index e66e7883ebe2..7df57d4f7894 100644
--- a/drivers/ide/pci/tc86c001.c
+++ b/drivers/ide/pci/tc86c001.c
@@ -162,16 +162,6 @@ static int tc86c001_busproc(ide_drive_t *drive, int state)
162 return 0; 162 return 0;
163} 163}
164 164
165static int tc86c001_config_drive_xfer_rate(ide_drive_t *drive)
166{
167 if (ide_tune_dma(drive))
168 return 0;
169
170 ide_set_max_pio(drive);
171
172 return -1;
173}
174
175static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif) 165static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif)
176{ 166{
177 unsigned long sc_base = pci_resource_start(hwif->pci_dev, 5); 167 unsigned long sc_base = pci_resource_start(hwif->pci_dev, 5);
@@ -212,7 +202,6 @@ static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif)
212 hwif->ultra_mask = 0x1f; 202 hwif->ultra_mask = 0x1f;
213 hwif->mwdma_mask = 0x07; 203 hwif->mwdma_mask = 0x07;
214 204
215 hwif->ide_dma_check = &tc86c001_config_drive_xfer_rate;
216 hwif->dma_start = &tc86c001_dma_start; 205 hwif->dma_start = &tc86c001_dma_start;
217 206
218 if (hwif->cbl != ATA_CBL_PATA40_SHORT) { 207 if (hwif->cbl != ATA_CBL_PATA40_SHORT) {
diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c
index 54e411d4e56c..921c41006df9 100644
--- a/drivers/ide/pci/triflex.c
+++ b/drivers/ide/pci/triflex.c
@@ -96,16 +96,6 @@ static void triflex_set_pio_mode(ide_drive_t *drive, const u8 pio)
96 triflex_set_mode(drive, XFER_PIO_0 + pio); 96 triflex_set_mode(drive, XFER_PIO_0 + pio);
97} 97}
98 98
99static int triflex_config_drive_xfer_rate(ide_drive_t *drive)
100{
101 if (ide_tune_dma(drive))
102 return 0;
103
104 ide_set_max_pio(drive);
105
106 return -1;
107}
108
109static void __devinit init_hwif_triflex(ide_hwif_t *hwif) 99static void __devinit init_hwif_triflex(ide_hwif_t *hwif)
110{ 100{
111 hwif->set_pio_mode = &triflex_set_pio_mode; 101 hwif->set_pio_mode = &triflex_set_pio_mode;
@@ -117,7 +107,6 @@ static void __devinit init_hwif_triflex(ide_hwif_t *hwif)
117 hwif->atapi_dma = 1; 107 hwif->atapi_dma = 1;
118 hwif->mwdma_mask = 0x07; 108 hwif->mwdma_mask = 0x07;
119 hwif->swdma_mask = 0x07; 109 hwif->swdma_mask = 0x07;
120 hwif->ide_dma_check = &triflex_config_drive_xfer_rate;
121 110
122 if (!noautodma) 111 if (!noautodma)
123 hwif->autodma = 1; 112 hwif->autodma = 1;
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c
index dc4f4e298e00..f227a05420ee 100644
--- a/drivers/ide/pci/trm290.c
+++ b/drivers/ide/pci/trm290.c
@@ -329,6 +329,7 @@ static ide_pci_device_t trm290_chipset __devinitdata = {
329 .init_hwif = init_hwif_trm290, 329 .init_hwif = init_hwif_trm290,
330 .autodma = NOAUTODMA, 330 .autodma = NOAUTODMA,
331 .bootable = ON_BOARD, 331 .bootable = ON_BOARD,
332 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
332}; 333};
333 334
334static int __devinit trm290_init_one(struct pci_dev *dev, const struct pci_device_id *id) 335static int __devinit trm290_init_one(struct pci_dev *dev, const struct pci_device_id *id)
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index 479e49661032..c199f88c420f 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -197,24 +197,6 @@ static void via_set_pio_mode(ide_drive_t *drive, const u8 pio)
197 via_set_drive(drive, XFER_PIO_0 + pio); 197 via_set_drive(drive, XFER_PIO_0 + pio);
198} 198}
199 199
200/**
201 * via82cxxx_ide_dma_check - set up for DMA if possible
202 * @drive: IDE drive to set up
203 *
204 * Set up the drive for the highest supported speed considering the
205 * driver, controller and cable
206 */
207
208static int via82cxxx_ide_dma_check (ide_drive_t *drive)
209{
210 if (ide_tune_dma(drive))
211 return 0;
212
213 ide_set_max_pio(drive);
214
215 return -1;
216}
217
218static struct via_isa_bridge *via_config_find(struct pci_dev **isa) 200static struct via_isa_bridge *via_config_find(struct pci_dev **isa)
219{ 201{
220 struct via_isa_bridge *via_config; 202 struct via_isa_bridge *via_config;
@@ -473,7 +455,6 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif)
473 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 455 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
474 hwif->cbl = via82cxxx_cable_detect(hwif); 456 hwif->cbl = via82cxxx_cable_detect(hwif);
475 457
476 hwif->ide_dma_check = &via82cxxx_ide_dma_check;
477 if (!noautodma) 458 if (!noautodma)
478 hwif->autodma = 1; 459 hwif->autodma = 1;
479 hwif->drives[0].autodma = hwif->autodma; 460 hwif->drives[0].autodma = hwif->autodma;
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index e0859385732e..dac66b851085 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1579,21 +1579,6 @@ pmac_ide_destroy_dmatable (ide_drive_t *drive)
1579} 1579}
1580 1580
1581/* 1581/*
1582 * Check what is the best DMA timing setting for the drive and
1583 * call appropriate functions to apply it.
1584 */
1585static int
1586pmac_ide_dma_check(ide_drive_t *drive)
1587{
1588 if (ide_tune_dma(drive))
1589 return 0;
1590
1591 ide_set_max_pio(drive);
1592
1593 return -1;
1594}
1595
1596/*
1597 * Prepare a DMA transfer. We build the DMA table, adjust the timings for 1582 * Prepare a DMA transfer. We build the DMA table, adjust the timings for
1598 * a read on KeyLargo ATA/66 and mark us as waiting for DMA completion 1583 * a read on KeyLargo ATA/66 and mark us as waiting for DMA completion
1599 */ 1584 */
@@ -1790,7 +1775,6 @@ pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1790 1775
1791 hwif->dma_off_quietly = &ide_dma_off_quietly; 1776 hwif->dma_off_quietly = &ide_dma_off_quietly;
1792 hwif->ide_dma_on = &__ide_dma_on; 1777 hwif->ide_dma_on = &__ide_dma_on;
1793 hwif->ide_dma_check = &pmac_ide_dma_check;
1794 hwif->dma_setup = &pmac_ide_dma_setup; 1778 hwif->dma_setup = &pmac_ide_dma_setup;
1795 hwif->dma_exec_cmd = &pmac_ide_dma_exec_cmd; 1779 hwif->dma_exec_cmd = &pmac_ide_dma_exec_cmd;
1796 hwif->dma_start = &pmac_ide_dma_start; 1780 hwif->dma_start = &pmac_ide_dma_start;