aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/amd74xx.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-07-19 19:11:58 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-07-19 19:11:58 -0400
commit6a824c92db4d606c324272c4eed366fb71672440 (patch)
tree72b398062fd582b85507b665120f0a5315548eaf /drivers/ide/pci/amd74xx.c
parent2134758d2a5429325cee4d4ce8959af5314eeba1 (diff)
ide: remove ide_find_best_pio_mode()
* Add ->host_flags to ide_hwif_t to store ide_pci_device_t.host_flags, assign it in setup-pci.c:ide_pci_setup_ports(). * Add IDE_HFLAG_PIO_NO_{BLACKLIST,DOWNGRADE} to ide_pci_device_t.host_flags and teach ide_get_best_pio_mode() about them. Also remove needless !drive->id check while at it (drive->id is always present). * Convert amd74xx, via82cxxx and ide-timing.h to use ide_get_best_pio_mode() and then remove no longer needed ide_find_best_pio_mode(). There should be no functionality changes caused by this patch. Acked-by: Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/amd74xx.c')
-rw-r--r--drivers/ide/pci/amd74xx.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c
index 9c3ea90aeb8b..5ed1d485fc7e 100644
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Version 2.20 2 * Version 2.21
3 * 3 *
4 * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04 4 * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04
5 * IDE driver for Linux. 5 * IDE driver for Linux.
@@ -272,10 +272,8 @@ static int amd_set_drive(ide_drive_t *drive, u8 speed)
272 272
273static void amd74xx_tune_drive(ide_drive_t *drive, u8 pio) 273static void amd74xx_tune_drive(ide_drive_t *drive, u8 pio)
274{ 274{
275 if (pio == 255) { 275 if (pio == 255)
276 amd_set_drive(drive, ide_find_best_pio_mode(drive)); 276 pio = ide_get_best_pio_mode(drive, 255, 5);
277 return;
278 }
279 277
280 amd_set_drive(drive, XFER_PIO_0 + min_t(byte, pio, 5)); 278 amd_set_drive(drive, XFER_PIO_0 + min_t(byte, pio, 5));
281} 279}
@@ -284,12 +282,14 @@ static int amd74xx_ide_dma_check(ide_drive_t *drive)
284{ 282{
285 u8 speed = ide_max_dma_mode(drive); 283 u8 speed = ide_max_dma_mode(drive);
286 284
287 if (speed == 0) 285 if (speed == 0) {
288 speed = ide_find_best_pio_mode(drive); 286 amd74xx_tune_drive(drive, 255);
287 return -1;
288 }
289 289
290 amd_set_drive(drive, speed); 290 amd_set_drive(drive, speed);
291 291
292 if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) 292 if (drive->autodma)
293 return 0; 293 return 0;
294 294
295 return -1; 295 return -1;
@@ -451,6 +451,8 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
451 .autodma = AUTODMA, \ 451 .autodma = AUTODMA, \
452 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \ 452 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \
453 .bootable = ON_BOARD, \ 453 .bootable = ON_BOARD, \
454 .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST \
455 | IDE_HFLAG_PIO_NO_DOWNGRADE, \
454 } 456 }
455 457
456#define DECLARE_NV_DEV(name_str) \ 458#define DECLARE_NV_DEV(name_str) \
@@ -461,6 +463,8 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
461 .autodma = AUTODMA, \ 463 .autodma = AUTODMA, \
462 .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \ 464 .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \
463 .bootable = ON_BOARD, \ 465 .bootable = ON_BOARD, \
466 .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST \
467 | IDE_HFLAG_PIO_NO_DOWNGRADE, \
464 } 468 }
465 469
466static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { 470static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {