diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-10-13 11:47:50 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-10-13 11:47:50 -0400 |
commit | 75d7d963e3dcf8a1410000ab246921709e276cd9 (patch) | |
tree | dec16e18a5848d351f8572d2418eea09312756c0 | |
parent | 0b46ff2ea2d817dc7883b80cd4e05ce41cce9158 (diff) |
icside: use ide_tune_dma()
* Add "good DMA drives" hack for icside to ide-dma.c::ide_find_dma_mode()
(in the long-term it should be either removed or generalized for all hosts).
* Use ide_tune_dma() in icside.c::icside_dma_check().
This results in the following changes in behavior:
- pre-EIDE SWDMA modes are now also respected
- drive->autodma is checked instead of hwif->autodma
(doesn't really matter as icside sets both to "1")
* Make ide-dma.c::__ide_dma_good_drive() static and drop "__" prefix.
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/arm/icside.c | 37 | ||||
-rw-r--r-- | drivers/ide/ide-dma.c | 23 | ||||
-rw-r--r-- | include/linux/ide.h | 1 |
3 files changed, 17 insertions, 44 deletions
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 7912a471f10d..110e52377c71 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c | |||
@@ -313,41 +313,10 @@ static int icside_dma_on(ide_drive_t *drive) | |||
313 | 313 | ||
314 | static int icside_dma_check(ide_drive_t *drive) | 314 | static int icside_dma_check(ide_drive_t *drive) |
315 | { | 315 | { |
316 | struct hd_driveid *id = drive->id; | 316 | if (ide_tune_dma(drive)) |
317 | ide_hwif_t *hwif = HWIF(drive); | 317 | return 0; |
318 | int xfer_mode = 0; | ||
319 | |||
320 | if (!(id->capability & 1) || !hwif->autodma) | ||
321 | goto out; | ||
322 | |||
323 | /* | ||
324 | * Consult the list of known "bad" drives | ||
325 | */ | ||
326 | if (__ide_dma_bad_drive(drive)) | ||
327 | goto out; | ||
328 | |||
329 | /* | ||
330 | * Enable DMA on any drive that has multiword DMA | ||
331 | */ | ||
332 | if (id->field_valid & 2) { | ||
333 | xfer_mode = ide_max_dma_mode(drive); | ||
334 | goto out; | ||
335 | } | ||
336 | |||
337 | /* | ||
338 | * Consult the list of known "good" drives | ||
339 | */ | ||
340 | if (__ide_dma_good_drive(drive)) { | ||
341 | if (id->eide_dma_time > 150) | ||
342 | goto out; | ||
343 | xfer_mode = XFER_MW_DMA_1; | ||
344 | } | ||
345 | |||
346 | out: | ||
347 | if (xfer_mode == 0) | ||
348 | return -1; | ||
349 | 318 | ||
350 | return icside_set_speed(drive, xfer_mode) ? -1 : 0; | 319 | return -1; |
351 | } | 320 | } |
352 | 321 | ||
353 | static int icside_dma_end(ide_drive_t *drive) | 322 | static int icside_dma_end(ide_drive_t *drive) |
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 6000c08f51ba..05781faaddd8 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -169,6 +169,11 @@ ide_startstop_t ide_dma_intr (ide_drive_t *drive) | |||
169 | 169 | ||
170 | EXPORT_SYMBOL_GPL(ide_dma_intr); | 170 | EXPORT_SYMBOL_GPL(ide_dma_intr); |
171 | 171 | ||
172 | static int ide_dma_good_drive(ide_drive_t *drive) | ||
173 | { | ||
174 | return ide_in_drive_list(drive->id, drive_whitelist); | ||
175 | } | ||
176 | |||
172 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | 177 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI |
173 | /** | 178 | /** |
174 | * ide_build_sglist - map IDE scatter gather for DMA I/O | 179 | * ide_build_sglist - map IDE scatter gather for DMA I/O |
@@ -357,7 +362,7 @@ static int config_drive_for_dma (ide_drive_t *drive) | |||
357 | return 0; | 362 | return 0; |
358 | 363 | ||
359 | /* Consult the list of known "good" drives */ | 364 | /* Consult the list of known "good" drives */ |
360 | if (__ide_dma_good_drive(drive)) | 365 | if (ide_dma_good_drive(drive)) |
361 | return 0; | 366 | return 0; |
362 | } | 367 | } |
363 | 368 | ||
@@ -639,14 +644,6 @@ int __ide_dma_bad_drive (ide_drive_t *drive) | |||
639 | 644 | ||
640 | EXPORT_SYMBOL(__ide_dma_bad_drive); | 645 | EXPORT_SYMBOL(__ide_dma_bad_drive); |
641 | 646 | ||
642 | int __ide_dma_good_drive (ide_drive_t *drive) | ||
643 | { | ||
644 | struct hd_driveid *id = drive->id; | ||
645 | return ide_in_drive_list(id, drive_whitelist); | ||
646 | } | ||
647 | |||
648 | EXPORT_SYMBOL(__ide_dma_good_drive); | ||
649 | |||
650 | static const u8 xfer_mode_bases[] = { | 647 | static const u8 xfer_mode_bases[] = { |
651 | XFER_UDMA_0, | 648 | XFER_UDMA_0, |
652 | XFER_MW_DMA_0, | 649 | XFER_MW_DMA_0, |
@@ -746,6 +743,14 @@ u8 ide_find_dma_mode(ide_drive_t *drive, u8 req_mode) | |||
746 | } | 743 | } |
747 | } | 744 | } |
748 | 745 | ||
746 | if (hwif->chipset == ide_acorn && mode == 0) { | ||
747 | /* | ||
748 | * is this correct? | ||
749 | */ | ||
750 | if (ide_dma_good_drive(drive) && drive->id->eide_dma_time < 150) | ||
751 | mode = XFER_MW_DMA_1; | ||
752 | } | ||
753 | |||
749 | printk(KERN_DEBUG "%s: selected mode 0x%x\n", drive->name, mode); | 754 | printk(KERN_DEBUG "%s: selected mode 0x%x\n", drive->name, mode); |
750 | 755 | ||
751 | return min(mode, req_mode); | 756 | return min(mode, req_mode); |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 6bb621203f30..a7d8b4bc7681 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -1296,7 +1296,6 @@ int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *); | |||
1296 | 1296 | ||
1297 | #ifdef CONFIG_BLK_DEV_IDEDMA | 1297 | #ifdef CONFIG_BLK_DEV_IDEDMA |
1298 | int __ide_dma_bad_drive(ide_drive_t *); | 1298 | int __ide_dma_bad_drive(ide_drive_t *); |
1299 | int __ide_dma_good_drive(ide_drive_t *); | ||
1300 | 1299 | ||
1301 | u8 ide_find_dma_mode(ide_drive_t *, u8); | 1300 | u8 ide_find_dma_mode(ide_drive_t *, u8); |
1302 | 1301 | ||