From 6a824c92db4d606c324272c4eed366fb71672440 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 20 Jul 2007 01:11:58 +0200 Subject: 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 Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/amd74xx.c | 20 ++++++++++++-------- drivers/ide/pci/via82cxxx.c | 22 +++++++++++++--------- 2 files changed, 25 insertions(+), 17 deletions(-) (limited to 'drivers/ide/pci') diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c index 9c3ea90aeb8..5ed1d485fc7 100644 --- a/drivers/ide/pci/amd74xx.c +++ b/drivers/ide/pci/amd74xx.c @@ -1,5 +1,5 @@ /* - * Version 2.20 + * Version 2.21 * * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04 * IDE driver for Linux. @@ -272,10 +272,8 @@ static int amd_set_drive(ide_drive_t *drive, u8 speed) static void amd74xx_tune_drive(ide_drive_t *drive, u8 pio) { - if (pio == 255) { - amd_set_drive(drive, ide_find_best_pio_mode(drive)); - return; - } + if (pio == 255) + pio = ide_get_best_pio_mode(drive, 255, 5); amd_set_drive(drive, XFER_PIO_0 + min_t(byte, pio, 5)); } @@ -284,12 +282,14 @@ static int amd74xx_ide_dma_check(ide_drive_t *drive) { u8 speed = ide_max_dma_mode(drive); - if (speed == 0) - speed = ide_find_best_pio_mode(drive); + if (speed == 0) { + amd74xx_tune_drive(drive, 255); + return -1; + } amd_set_drive(drive, speed); - if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) + if (drive->autodma) return 0; return -1; @@ -451,6 +451,8 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) .autodma = AUTODMA, \ .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \ .bootable = ON_BOARD, \ + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST \ + | IDE_HFLAG_PIO_NO_DOWNGRADE, \ } #define DECLARE_NV_DEV(name_str) \ @@ -461,6 +463,8 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) .autodma = AUTODMA, \ .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \ .bootable = ON_BOARD, \ + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST \ + | IDE_HFLAG_PIO_NO_DOWNGRADE, \ } static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index bfc9b67f8c9..b107ee3588f 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c @@ -1,6 +1,6 @@ /* * - * Version 3.45 + * Version 3.46 * * VIA IDE driver for Linux. Supported southbridges: * @@ -203,10 +203,8 @@ static int via_set_drive(ide_drive_t *drive, u8 speed) static void via82cxxx_tune_drive(ide_drive_t *drive, u8 pio) { - if (pio == 255) { - via_set_drive(drive, ide_find_best_pio_mode(drive)); - return; - } + if (pio == 255) + pio = ide_get_best_pio_mode(drive, 255, 5); via_set_drive(drive, XFER_PIO_0 + min_t(u8, pio, 5)); } @@ -223,12 +221,14 @@ static int via82cxxx_ide_dma_check (ide_drive_t *drive) { u8 speed = ide_max_dma_mode(drive); - if (speed == 0) - speed = ide_find_best_pio_mode(drive); + if (speed == 0) { + via82cxxx_tune_drive(drive, 255); + return -1; + } via_set_drive(drive, speed); - if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) + if (drive->autodma) return 0; return -1; @@ -500,7 +500,9 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { .init_hwif = init_hwif_via82cxxx, .autodma = NOAUTODMA, .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, - .bootable = ON_BOARD + .bootable = ON_BOARD, + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST + | IDE_HFLAG_PIO_NO_DOWNGRADE, },{ /* 1 */ .name = "VP_IDE", .init_chipset = init_chipset_via82cxxx, @@ -508,6 +510,8 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { .autodma = AUTODMA, .enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, .bootable = ON_BOARD, + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST + | IDE_HFLAG_PIO_NO_DOWNGRADE, } }; -- cgit v1.2.3