aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-08-21 01:48:42 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-08-21 01:48:42 -0400
commit38f061c5714265fa8481cc0b7795aa8fe81b45be (patch)
treee145112bc2ddcbd1fdd8c7d582603f253e0ef3f4
parent09d4b9aa90ab7a0ce7c266d2ea18153bf79bba33 (diff)
parentb0244a00451c1ad64bf0a51f50679f7146786780 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: ide-disk: workaround for buggy HPA support on ST340823A (take 3) hpt34x: fix CONFIG_HPT34X_AUTODMA=n handling triflex: add missing ->dma_base check pdc202xx_old: add missing ->dma_base check pdc202xx_new: add missing ->dma_base check cs5530: add missing ->dma_base check ide: ide_config_drive_speed() bugfixes ide: add cable detection for early UDMA66 devices (take 3) ide-pmac: fix drive->init_speed reporting ide: config_drive_for_dma() fixes ide-cris: fix ->set_pio_mode method to set transfer mode on the device ide: fix hidden dependencies on CONFIG_IDE_GENERIC ide: make CONFIG_IDE_GENERIC default to N
-rw-r--r--arch/cris/arch-v10/drivers/Kconfig1
-rw-r--r--arch/cris/arch-v32/drivers/Kconfig1
-rw-r--r--drivers/ide/Kconfig12
-rw-r--r--drivers/ide/cris/ide-cris.c2
-rw-r--r--drivers/ide/ide-disk.c18
-rw-r--r--drivers/ide/ide-dma.c45
-rw-r--r--drivers/ide/ide-iops.c45
-rw-r--r--drivers/ide/pci/cs5530.c8
-rw-r--r--drivers/ide/pci/hpt34x.c6
-rw-r--r--drivers/ide/pci/ns87415.c9
-rw-r--r--drivers/ide/pci/pdc202xx_new.c10
-rw-r--r--drivers/ide/pci/pdc202xx_old.c9
-rw-r--r--drivers/ide/pci/triflex.c3
-rw-r--r--drivers/ide/ppc/pmac.c14
-rw-r--r--include/linux/ide.h4
15 files changed, 113 insertions, 74 deletions
diff --git a/arch/cris/arch-v10/drivers/Kconfig b/arch/cris/arch-v10/drivers/Kconfig
index e7e724bc0ba6..03e2e68f947d 100644
--- a/arch/cris/arch-v10/drivers/Kconfig
+++ b/arch/cris/arch-v10/drivers/Kconfig
@@ -548,6 +548,7 @@ config ETRAX_IDE
548 select BLK_DEV_IDEDISK 548 select BLK_DEV_IDEDISK
549 select BLK_DEV_IDECD 549 select BLK_DEV_IDECD
550 select BLK_DEV_IDEDMA 550 select BLK_DEV_IDEDMA
551 select IDE_GENERIC
551 help 552 help
552 Enable this to get support for ATA/IDE. 553 Enable this to get support for ATA/IDE.
553 You can't use parallel ports or SCSI ports 554 You can't use parallel ports or SCSI ports
diff --git a/arch/cris/arch-v32/drivers/Kconfig b/arch/cris/arch-v32/drivers/Kconfig
index 1d859c16931e..cc6ba5423754 100644
--- a/arch/cris/arch-v32/drivers/Kconfig
+++ b/arch/cris/arch-v32/drivers/Kconfig
@@ -592,6 +592,7 @@ config ETRAX_IDE
592 select BLK_DEV_IDEDISK 592 select BLK_DEV_IDEDISK
593 select BLK_DEV_IDECD 593 select BLK_DEV_IDECD
594 select BLK_DEV_IDEDMA 594 select BLK_DEV_IDEDMA
595 select IDE_GENERIC
595 help 596 help
596 Enables the ETRAX IDE driver. 597 Enables the ETRAX IDE driver.
597 598
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index e049f65bc3a2..7adb61bad6ad 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -304,9 +304,9 @@ comment "IDE chipset support/bugfixes"
304 304
305config IDE_GENERIC 305config IDE_GENERIC
306 tristate "generic/default IDE chipset support" 306 tristate "generic/default IDE chipset support"
307 default y 307 default H8300
308 help 308 help
309 If unsure, say Y. 309 If unsure, say N.
310 310
311config BLK_DEV_CMD640 311config BLK_DEV_CMD640
312 bool "CMD640 chipset bugfix/support" 312 bool "CMD640 chipset bugfix/support"
@@ -345,6 +345,7 @@ config BLK_DEV_CMD640_ENHANCED
345config BLK_DEV_IDEPNP 345config BLK_DEV_IDEPNP
346 bool "PNP EIDE support" 346 bool "PNP EIDE support"
347 depends on PNP 347 depends on PNP
348 select IDE_GENERIC
348 help 349 help
349 If you have a PnP (Plug and Play) compatible EIDE card and 350 If you have a PnP (Plug and Play) compatible EIDE card and
350 would like the kernel to automatically detect and activate 351 would like the kernel to automatically detect and activate
@@ -834,6 +835,7 @@ config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ
834 835
835config IDE_ARM 836config IDE_ARM
836 def_bool ARM && (ARCH_CLPS7500 || ARCH_RPC || ARCH_SHARK) 837 def_bool ARM && (ARCH_CLPS7500 || ARCH_RPC || ARCH_SHARK)
838 select IDE_GENERIC
837 839
838config BLK_DEV_IDE_ICSIDE 840config BLK_DEV_IDE_ICSIDE
839 tristate "ICS IDE interface support" 841 tristate "ICS IDE interface support"
@@ -867,6 +869,7 @@ config BLK_DEV_IDE_BAST
867config BLK_DEV_GAYLE 869config BLK_DEV_GAYLE
868 bool "Amiga Gayle IDE interface support" 870 bool "Amiga Gayle IDE interface support"
869 depends on AMIGA 871 depends on AMIGA
872 select IDE_GENERIC
870 help 873 help
871 This is the IDE driver for the Amiga Gayle IDE interface. It supports 874 This is the IDE driver for the Amiga Gayle IDE interface. It supports
872 both the `A1200 style' and `A4000 style' of the Gayle IDE interface, 875 both the `A1200 style' and `A4000 style' of the Gayle IDE interface,
@@ -898,6 +901,7 @@ config BLK_DEV_IDEDOUBLER
898config BLK_DEV_BUDDHA 901config BLK_DEV_BUDDHA
899 bool "Buddha/Catweasel/X-Surf IDE interface support (EXPERIMENTAL)" 902 bool "Buddha/Catweasel/X-Surf IDE interface support (EXPERIMENTAL)"
900 depends on ZORRO && EXPERIMENTAL 903 depends on ZORRO && EXPERIMENTAL
904 select IDE_GENERIC
901 help 905 help
902 This is the IDE driver for the IDE interfaces on the Buddha, 906 This is the IDE driver for the IDE interfaces on the Buddha,
903 Catweasel and X-Surf expansion boards. It supports up to two interfaces 907 Catweasel and X-Surf expansion boards. It supports up to two interfaces
@@ -910,6 +914,7 @@ config BLK_DEV_BUDDHA
910config BLK_DEV_FALCON_IDE 914config BLK_DEV_FALCON_IDE
911 bool "Falcon IDE interface support" 915 bool "Falcon IDE interface support"
912 depends on ATARI 916 depends on ATARI
917 select IDE_GENERIC
913 help 918 help
914 This is the IDE driver for the builtin IDE interface on the Atari 919 This is the IDE driver for the builtin IDE interface on the Atari
915 Falcon. Say Y if you have a Falcon and want to use IDE devices (hard 920 Falcon. Say Y if you have a Falcon and want to use IDE devices (hard
@@ -919,6 +924,7 @@ config BLK_DEV_FALCON_IDE
919config BLK_DEV_MAC_IDE 924config BLK_DEV_MAC_IDE
920 bool "Macintosh Quadra/Powerbook IDE interface support" 925 bool "Macintosh Quadra/Powerbook IDE interface support"
921 depends on MAC 926 depends on MAC
927 select IDE_GENERIC
922 help 928 help
923 This is the IDE driver for the builtin IDE interface on some m68k 929 This is the IDE driver for the builtin IDE interface on some m68k
924 Macintosh models. It supports both the `Quadra style' (used in 930 Macintosh models. It supports both the `Quadra style' (used in
@@ -932,6 +938,7 @@ config BLK_DEV_MAC_IDE
932config BLK_DEV_Q40IDE 938config BLK_DEV_Q40IDE
933 bool "Q40/Q60 IDE interface support" 939 bool "Q40/Q60 IDE interface support"
934 depends on Q40 940 depends on Q40
941 select IDE_GENERIC
935 help 942 help
936 Enable the on-board IDE controller in the Q40/Q60. This should 943 Enable the on-board IDE controller in the Q40/Q60. This should
937 normally be on; disable it only if you are running a custom hard 944 normally be on; disable it only if you are running a custom hard
@@ -940,6 +947,7 @@ config BLK_DEV_Q40IDE
940config BLK_DEV_MPC8xx_IDE 947config BLK_DEV_MPC8xx_IDE
941 bool "MPC8xx IDE support" 948 bool "MPC8xx IDE support"
942 depends on 8xx && IDE=y && BLK_DEV_IDE=y 949 depends on 8xx && IDE=y && BLK_DEV_IDE=y
950 select IDE_GENERIC
943 help 951 help
944 This option provides support for IDE on Motorola MPC8xx Systems. 952 This option provides support for IDE on Motorola MPC8xx Systems.
945 Please see 'Type of MPC8xx IDE interface' for details. 953 Please see 'Type of MPC8xx IDE interface' for details.
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c
index fbfea46a34f2..04636f7eaae7 100644
--- a/drivers/ide/cris/ide-cris.c
+++ b/drivers/ide/cris/ide-cris.c
@@ -718,6 +718,8 @@ static void tune_cris_ide(ide_drive_t *drive, u8 pio)
718 } 718 }
719 719
720 cris_ide_set_speed(TYPE_PIO, setup, strobe, hold); 720 cris_ide_set_speed(TYPE_PIO, setup, strobe, hold);
721
722 (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio);
721} 723}
722 724
723static int speed_cris_ide(ide_drive_t *drive, u8 speed) 725static int speed_cris_ide(ide_drive_t *drive, u8 speed)
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 5ce4216f72a2..eba1adbc1b6a 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -481,6 +481,15 @@ static inline int idedisk_supports_lba48(const struct hd_driveid *id)
481 && id->lba_capacity_2; 481 && id->lba_capacity_2;
482} 482}
483 483
484/*
485 * Some disks report total number of sectors instead of
486 * maximum sector address. We list them here.
487 */
488static const struct drive_list_entry hpa_list[] = {
489 { "ST340823A", NULL },
490 { NULL, NULL }
491};
492
484static void idedisk_check_hpa(ide_drive_t *drive) 493static void idedisk_check_hpa(ide_drive_t *drive)
485{ 494{
486 unsigned long long capacity, set_max; 495 unsigned long long capacity, set_max;
@@ -492,6 +501,15 @@ static void idedisk_check_hpa(ide_drive_t *drive)
492 else 501 else
493 set_max = idedisk_read_native_max_address(drive); 502 set_max = idedisk_read_native_max_address(drive);
494 503
504 if (ide_in_drive_list(drive->id, hpa_list)) {
505 /*
506 * Since we are inclusive wrt to firmware revisions do this
507 * extra check and apply the workaround only when needed.
508 */
509 if (set_max == capacity + 1)
510 set_max--;
511 }
512
495 if (set_max <= capacity) 513 if (set_max <= capacity)
496 return; 514 return;
497 515
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 5fe1d72ab451..ff644a5e12cd 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -135,25 +135,6 @@ static const struct drive_list_entry drive_blacklist [] = {
135}; 135};
136 136
137/** 137/**
138 * ide_in_drive_list - look for drive in black/white list
139 * @id: drive identifier
140 * @drive_table: list to inspect
141 *
142 * Look for a drive in the blacklist and the whitelist tables
143 * Returns 1 if the drive is found in the table.
144 */
145
146int ide_in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table)
147{
148 for ( ; drive_table->id_model ; drive_table++)
149 if ((!strcmp(drive_table->id_model, id->model)) &&
150 (!drive_table->id_firmware ||
151 strstr(id->fw_rev, drive_table->id_firmware)))
152 return 1;
153 return 0;
154}
155
156/**
157 * ide_dma_intr - IDE DMA interrupt handler 138 * ide_dma_intr - IDE DMA interrupt handler
158 * @drive: the drive the interrupt is for 139 * @drive: the drive the interrupt is for
159 * 140 *
@@ -349,9 +330,17 @@ EXPORT_SYMBOL_GPL(ide_destroy_dmatable);
349 330
350static int config_drive_for_dma (ide_drive_t *drive) 331static int config_drive_for_dma (ide_drive_t *drive)
351{ 332{
333 ide_hwif_t *hwif = drive->hwif;
352 struct hd_driveid *id = drive->id; 334 struct hd_driveid *id = drive->id;
353 335
354 if ((id->capability & 1) && drive->hwif->autodma) { 336 /* consult the list of known "bad" drives */
337 if (__ide_dma_bad_drive(drive))
338 return -1;
339
340 if (drive->media != ide_disk && hwif->atapi_dma == 0)
341 return -1;
342
343 if ((id->capability & 1) && drive->autodma) {
355 /* 344 /*
356 * Enable DMA on any drive that has 345 * Enable DMA on any drive that has
357 * UltraDMA (mode 0/1/2/3/4/5/6) enabled 346 * UltraDMA (mode 0/1/2/3/4/5/6) enabled
@@ -514,20 +503,6 @@ int __ide_dma_on (ide_drive_t *drive)
514EXPORT_SYMBOL(__ide_dma_on); 503EXPORT_SYMBOL(__ide_dma_on);
515 504
516/** 505/**
517 * __ide_dma_check - check DMA setup
518 * @drive: drive to check
519 *
520 * Don't use - due for extermination
521 */
522
523int __ide_dma_check (ide_drive_t *drive)
524{
525 return config_drive_for_dma(drive);
526}
527
528EXPORT_SYMBOL(__ide_dma_check);
529
530/**
531 * ide_dma_setup - begin a DMA phase 506 * ide_dma_setup - begin a DMA phase
532 * @drive: target device 507 * @drive: target device
533 * 508 *
@@ -1021,7 +996,7 @@ void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_p
1021 if (!hwif->dma_host_on) 996 if (!hwif->dma_host_on)
1022 hwif->dma_host_on = &ide_dma_host_on; 997 hwif->dma_host_on = &ide_dma_host_on;
1023 if (!hwif->ide_dma_check) 998 if (!hwif->ide_dma_check)
1024 hwif->ide_dma_check = &__ide_dma_check; 999 hwif->ide_dma_check = &config_drive_for_dma;
1025 if (!hwif->dma_setup) 1000 if (!hwif->dma_setup)
1026 hwif->dma_setup = &ide_dma_setup; 1001 hwif->dma_setup = &ide_dma_setup;
1027 if (!hwif->dma_exec_cmd) 1002 if (!hwif->dma_exec_cmd)
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 92578b6832e9..f4cd2700cae5 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -565,6 +565,36 @@ int ide_wait_stat (ide_startstop_t *startstop, ide_drive_t *drive, u8 good, u8 b
565 565
566EXPORT_SYMBOL(ide_wait_stat); 566EXPORT_SYMBOL(ide_wait_stat);
567 567
568/**
569 * ide_in_drive_list - look for drive in black/white list
570 * @id: drive identifier
571 * @drive_table: list to inspect
572 *
573 * Look for a drive in the blacklist and the whitelist tables
574 * Returns 1 if the drive is found in the table.
575 */
576
577int ide_in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table)
578{
579 for ( ; drive_table->id_model; drive_table++)
580 if ((!strcmp(drive_table->id_model, id->model)) &&
581 (!drive_table->id_firmware ||
582 strstr(id->fw_rev, drive_table->id_firmware)))
583 return 1;
584 return 0;
585}
586
587EXPORT_SYMBOL_GPL(ide_in_drive_list);
588
589/*
590 * Early UDMA66 devices don't set bit14 to 1, only bit13 is valid.
591 * We list them here and depend on the device side cable detection for them.
592 */
593static const struct drive_list_entry ivb_list[] = {
594 { "QUANTUM FIREBALLlct10 05" , "A03.0900" },
595 { NULL , NULL }
596};
597
568/* 598/*
569 * All hosts that use the 80c ribbon must use! 599 * All hosts that use the 80c ribbon must use!
570 * The name is derived from upper byte of word 93 and the 80c ribbon. 600 * The name is derived from upper byte of word 93 and the 80c ribbon.
@@ -573,11 +603,16 @@ u8 eighty_ninty_three (ide_drive_t *drive)
573{ 603{
574 ide_hwif_t *hwif = drive->hwif; 604 ide_hwif_t *hwif = drive->hwif;
575 struct hd_driveid *id = drive->id; 605 struct hd_driveid *id = drive->id;
606 int ivb = ide_in_drive_list(id, ivb_list);
576 607
577 if (hwif->cbl == ATA_CBL_PATA40_SHORT) 608 if (hwif->cbl == ATA_CBL_PATA40_SHORT)
578 return 1; 609 return 1;
579 610
580 if (hwif->cbl != ATA_CBL_PATA80) 611 if (ivb)
612 printk(KERN_DEBUG "%s: skipping word 93 validity check\n",
613 drive->name);
614
615 if (hwif->cbl != ATA_CBL_PATA80 && !ivb)
581 goto no_80w; 616 goto no_80w;
582 617
583 /* Check for SATA but only if we are ATA5 or higher */ 618 /* Check for SATA but only if we are ATA5 or higher */
@@ -587,11 +622,11 @@ u8 eighty_ninty_three (ide_drive_t *drive)
587 /* 622 /*
588 * FIXME: 623 * FIXME:
589 * - change master/slave IDENTIFY order 624 * - change master/slave IDENTIFY order
590 * - force bit13 (80c cable present) check 625 * - force bit13 (80c cable present) check also for !ivb devices
591 * (unless the slave device is pre-ATA3) 626 * (unless the slave device is pre-ATA3)
592 */ 627 */
593#ifndef CONFIG_IDEDMA_IVB 628#ifndef CONFIG_IDEDMA_IVB
594 if (id->hw_config & 0x4000) 629 if ((id->hw_config & 0x4000) || (ivb && (id->hw_config & 0x2000)))
595#else 630#else
596 if (id->hw_config & 0x6000) 631 if (id->hw_config & 0x6000)
597#endif 632#endif
@@ -795,7 +830,7 @@ int ide_config_drive_speed (ide_drive_t *drive, u8 speed)
795 hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG); 830 hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG);
796 hwif->OUTB(speed, IDE_NSECTOR_REG); 831 hwif->OUTB(speed, IDE_NSECTOR_REG);
797 hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG); 832 hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG);
798 hwif->OUTB(WIN_SETFEATURES, IDE_COMMAND_REG); 833 hwif->OUTBSYNC(drive, WIN_SETFEATURES, IDE_COMMAND_REG);
799 if ((IDE_CONTROL_REG) && (drive->quirk_list == 2)) 834 if ((IDE_CONTROL_REG) && (drive->quirk_list == 2))
800 hwif->OUTB(drive->ctl, IDE_CONTROL_REG); 835 hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
801 udelay(1); 836 udelay(1);
@@ -822,7 +857,7 @@ int ide_config_drive_speed (ide_drive_t *drive, u8 speed)
822 */ 857 */
823 for (i = 0; i < 10; i++) { 858 for (i = 0; i < 10; i++) {
824 udelay(1); 859 udelay(1);
825 if (OK_STAT((stat = hwif->INB(IDE_STATUS_REG)), DRIVE_READY, BUSY_STAT|DRQ_STAT|ERR_STAT)) { 860 if (OK_STAT((stat = hwif->INB(IDE_STATUS_REG)), drive->ready_stat, BUSY_STAT|DRQ_STAT|ERR_STAT)) {
826 error = 0; 861 error = 0;
827 break; 862 break;
828 } 863 }
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
index acaf71fd4c09..e5949b1d3fb0 100644
--- a/drivers/ide/pci/cs5530.c
+++ b/drivers/ide/pci/cs5530.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/cs5530.c Version 0.73 Mar 10 2007 2 * linux/drivers/ide/pci/cs5530.c Version 0.74 Jul 28 2007
3 * 3 *
4 * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2000 Mark Lord <mlord@pobox.com> 5 * Copyright (C) 2000 Mark Lord <mlord@pobox.com>
@@ -207,6 +207,9 @@ static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const ch
207 struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; 207 struct pci_dev *master_0 = NULL, *cs5530_0 = NULL;
208 unsigned long flags; 208 unsigned long flags;
209 209
210 if (pci_resource_start(dev, 4) == 0)
211 return -EFAULT;
212
210 dev = NULL; 213 dev = NULL;
211 while ((dev = pci_get_device(PCI_VENDOR_ID_CYRIX, PCI_ANY_ID, dev)) != NULL) { 214 while ((dev = pci_get_device(PCI_VENDOR_ID_CYRIX, PCI_ANY_ID, dev)) != NULL) {
212 switch (dev->device) { 215 switch (dev->device) {
@@ -325,6 +328,9 @@ static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif)
325 /* needs autotuning later */ 328 /* needs autotuning later */
326 } 329 }
327 330
331 if (hwif->dma_base == 0)
332 return;
333
328 hwif->atapi_dma = 1; 334 hwif->atapi_dma = 1;
329 hwif->ultra_mask = 0x07; 335 hwif->ultra_mask = 0x07;
330 hwif->mwdma_mask = 0x07; 336 hwif->mwdma_mask = 0x07;
diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c
index 19778c5fe711..cb8fe5643d3b 100644
--- a/drivers/ide/pci/hpt34x.c
+++ b/drivers/ide/pci/hpt34x.c
@@ -89,11 +89,7 @@ static int hpt34x_config_drive_xfer_rate (ide_drive_t *drive)
89 drive->init_speed = 0; 89 drive->init_speed = 0;
90 90
91 if (ide_tune_dma(drive)) 91 if (ide_tune_dma(drive))
92#ifndef CONFIG_HPT34X_AUTODMA
93 return -1; 92 return -1;
94#else
95 return 0;
96#endif
97 93
98 if (ide_use_fast_pio(drive)) 94 if (ide_use_fast_pio(drive))
99 hpt34x_tune_drive(drive, 255); 95 hpt34x_tune_drive(drive, 255);
@@ -160,9 +156,11 @@ static void __devinit init_hwif_hpt34x(ide_hwif_t *hwif)
160 if (!hwif->dma_base) 156 if (!hwif->dma_base)
161 return; 157 return;
162 158
159#ifdef CONFIG_HPT34X_AUTODMA
163 hwif->ultra_mask = 0x07; 160 hwif->ultra_mask = 0x07;
164 hwif->mwdma_mask = 0x07; 161 hwif->mwdma_mask = 0x07;
165 hwif->swdma_mask = 0x07; 162 hwif->swdma_mask = 0x07;
163#endif
166 164
167 hwif->ide_dma_check = &hpt34x_config_drive_xfer_rate; 165 hwif->ide_dma_check = &hpt34x_config_drive_xfer_rate;
168 if (!noautodma) 166 if (!noautodma)
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
index 09941f37d635..465c935fdf25 100644
--- a/drivers/ide/pci/ns87415.c
+++ b/drivers/ide/pci/ns87415.c
@@ -187,14 +187,6 @@ static int ns87415_ide_dma_setup(ide_drive_t *drive)
187 return 1; 187 return 1;
188} 188}
189 189
190static int ns87415_ide_dma_check (ide_drive_t *drive)
191{
192 if (drive->media != ide_disk)
193 return -1;
194
195 return __ide_dma_check(drive);
196}
197
198static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) 190static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
199{ 191{
200 struct pci_dev *dev = hwif->pci_dev; 192 struct pci_dev *dev = hwif->pci_dev;
@@ -266,7 +258,6 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
266 258
267 outb(0x60, hwif->dma_status); 259 outb(0x60, hwif->dma_status);
268 hwif->dma_setup = &ns87415_ide_dma_setup; 260 hwif->dma_setup = &ns87415_ide_dma_setup;
269 hwif->ide_dma_check = &ns87415_ide_dma_check;
270 hwif->ide_dma_end = &ns87415_ide_dma_end; 261 hwif->ide_dma_end = &ns87415_ide_dma_end;
271 262
272 if (!noautodma) 263 if (!noautodma)
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index 8a66a2871b3a..f6db2f37efad 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -378,6 +378,9 @@ static unsigned int __devinit init_chipset_pdcnew(struct pci_dev *dev, const cha
378 int f, r; 378 int f, r;
379 u8 pll_ctl0, pll_ctl1; 379 u8 pll_ctl0, pll_ctl1;
380 380
381 if (dma_base == 0)
382 return -EFAULT;
383
381#ifdef CONFIG_PPC_PMAC 384#ifdef CONFIG_PPC_PMAC
382 apple_kiwi_init(dev); 385 apple_kiwi_init(dev);
383#endif 386#endif
@@ -494,15 +497,18 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)
494 hwif->speedproc = &pdcnew_tune_chipset; 497 hwif->speedproc = &pdcnew_tune_chipset;
495 hwif->resetproc = &pdcnew_reset; 498 hwif->resetproc = &pdcnew_reset;
496 499
500 hwif->err_stops_fifo = 1;
501
497 hwif->drives[0].autotune = hwif->drives[1].autotune = 1; 502 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
498 503
504 if (hwif->dma_base == 0)
505 return;
506
499 hwif->atapi_dma = 1; 507 hwif->atapi_dma = 1;
500 508
501 hwif->ultra_mask = hwif->cds->udma_mask; 509 hwif->ultra_mask = hwif->cds->udma_mask;
502 hwif->mwdma_mask = 0x07; 510 hwif->mwdma_mask = 0x07;
503 511
504 hwif->err_stops_fifo = 1;
505
506 hwif->ide_dma_check = &pdcnew_config_drive_xfer_rate; 512 hwif->ide_dma_check = &pdcnew_config_drive_xfer_rate;
507 513
508 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 514 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
index fbcb0bb9c956..e19a891171cb 100644
--- a/drivers/ide/pci/pdc202xx_old.c
+++ b/drivers/ide/pci/pdc202xx_old.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/pdc202xx_old.c Version 0.50 Mar 3, 2007 2 * linux/drivers/ide/pci/pdc202xx_old.c Version 0.51 Jul 27, 2007
3 * 3 *
4 * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2006-2007 MontaVista Software, Inc. 5 * Copyright (C) 2006-2007 MontaVista Software, Inc.
@@ -337,15 +337,18 @@ static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif)
337 337
338 hwif->speedproc = &pdc202xx_tune_chipset; 338 hwif->speedproc = &pdc202xx_tune_chipset;
339 339
340 hwif->err_stops_fifo = 1;
341
340 hwif->drives[0].autotune = hwif->drives[1].autotune = 1; 342 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
341 343
344 if (hwif->dma_base == 0)
345 return;
346
342 hwif->ultra_mask = hwif->cds->udma_mask; 347 hwif->ultra_mask = hwif->cds->udma_mask;
343 hwif->mwdma_mask = 0x07; 348 hwif->mwdma_mask = 0x07;
344 hwif->swdma_mask = 0x07; 349 hwif->swdma_mask = 0x07;
345 hwif->atapi_dma = 1; 350 hwif->atapi_dma = 1;
346 351
347 hwif->err_stops_fifo = 1;
348
349 hwif->ide_dma_check = &pdc202xx_config_drive_xfer_rate; 352 hwif->ide_dma_check = &pdc202xx_config_drive_xfer_rate;
350 hwif->dma_lost_irq = &pdc202xx_dma_lost_irq; 353 hwif->dma_lost_irq = &pdc202xx_dma_lost_irq;
351 hwif->dma_timeout = &pdc202xx_dma_timeout; 354 hwif->dma_timeout = &pdc202xx_dma_timeout;
diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c
index 024bbfae0429..098692a6d615 100644
--- a/drivers/ide/pci/triflex.c
+++ b/drivers/ide/pci/triflex.c
@@ -115,6 +115,9 @@ static void __devinit init_hwif_triflex(ide_hwif_t *hwif)
115 hwif->tuneproc = &triflex_tune_drive; 115 hwif->tuneproc = &triflex_tune_drive;
116 hwif->speedproc = &triflex_tune_chipset; 116 hwif->speedproc = &triflex_tune_chipset;
117 117
118 if (hwif->dma_base == 0)
119 return;
120
118 hwif->atapi_dma = 1; 121 hwif->atapi_dma = 1;
119 hwif->mwdma_mask = 0x07; 122 hwif->mwdma_mask = 0x07;
120 hwif->swdma_mask = 0x07; 123 hwif->swdma_mask = 0x07;
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 33630ad3e794..4b13cd9a027d 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -604,6 +604,9 @@ out:
604 drive->id->dma_1word |= 0x0101; break; 604 drive->id->dma_1word |= 0x0101; break;
605 default: break; 605 default: break;
606 } 606 }
607 if (!drive->init_speed)
608 drive->init_speed = command;
609 drive->current_speed = command;
607 } 610 }
608 enable_irq(hwif->irq); 611 enable_irq(hwif->irq);
609 return result; 612 return result;
@@ -986,7 +989,6 @@ pmac_ide_tune_chipset (ide_drive_t *drive, byte speed)
986 return ret; 989 return ret;
987 990
988 pmac_ide_do_update_timings(drive); 991 pmac_ide_do_update_timings(drive);
989 drive->current_speed = speed;
990 992
991 return 0; 993 return 0;
992} 994}
@@ -1737,11 +1739,6 @@ pmac_ide_mdma_enable(ide_drive_t *drive, u16 mode)
1737 /* Apply timings to controller */ 1739 /* Apply timings to controller */
1738 *timings = timing_local[0]; 1740 *timings = timing_local[0];
1739 *timings2 = timing_local[1]; 1741 *timings2 = timing_local[1];
1740
1741 /* Set speed info in drive */
1742 drive->current_speed = mode;
1743 if (!drive->init_speed)
1744 drive->init_speed = mode;
1745 1742
1746 return 1; 1743 return 1;
1747} 1744}
@@ -1793,11 +1790,6 @@ pmac_ide_udma_enable(ide_drive_t *drive, u16 mode)
1793 *timings = timing_local[0]; 1790 *timings = timing_local[0];
1794 *timings2 = timing_local[1]; 1791 *timings2 = timing_local[1];
1795 1792
1796 /* Set speed info in drive */
1797 drive->current_speed = mode;
1798 if (!drive->init_speed)
1799 drive->init_speed = mode;
1800
1801 return 1; 1793 return 1;
1802} 1794}
1803 1795
diff --git a/include/linux/ide.h b/include/linux/ide.h
index d71d0121b7f9..c792b4fd1588 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1285,13 +1285,14 @@ void ide_init_sg_cmd(ide_drive_t *, struct request *);
1285#define BAD_DMA_DRIVE 0 1285#define BAD_DMA_DRIVE 0
1286#define GOOD_DMA_DRIVE 1 1286#define GOOD_DMA_DRIVE 1
1287 1287
1288#ifdef CONFIG_BLK_DEV_IDEDMA
1289struct drive_list_entry { 1288struct drive_list_entry {
1290 const char *id_model; 1289 const char *id_model;
1291 const char *id_firmware; 1290 const char *id_firmware;
1292}; 1291};
1293 1292
1294int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *); 1293int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *);
1294
1295#ifdef CONFIG_BLK_DEV_IDEDMA
1295int __ide_dma_bad_drive(ide_drive_t *); 1296int __ide_dma_bad_drive(ide_drive_t *);
1296int __ide_dma_good_drive(ide_drive_t *); 1297int __ide_dma_good_drive(ide_drive_t *);
1297u8 ide_max_dma_mode(ide_drive_t *); 1298u8 ide_max_dma_mode(ide_drive_t *);
@@ -1312,7 +1313,6 @@ void ide_dma_host_off(ide_drive_t *);
1312void ide_dma_off_quietly(ide_drive_t *); 1313void ide_dma_off_quietly(ide_drive_t *);
1313void ide_dma_host_on(ide_drive_t *); 1314void ide_dma_host_on(ide_drive_t *);
1314extern int __ide_dma_on(ide_drive_t *); 1315extern int __ide_dma_on(ide_drive_t *);
1315extern int __ide_dma_check(ide_drive_t *);
1316extern int ide_dma_setup(ide_drive_t *); 1316extern int ide_dma_setup(ide_drive_t *);
1317extern void ide_dma_start(ide_drive_t *); 1317extern void ide_dma_start(ide_drive_t *);
1318extern int __ide_dma_end(ide_drive_t *); 1318extern int __ide_dma_end(ide_drive_t *);