diff options
Diffstat (limited to 'drivers/ide/pci')
| -rw-r--r-- | drivers/ide/pci/alim15x3.c | 35 | ||||
| -rw-r--r-- | drivers/ide/pci/cmd640.c | 1 | ||||
| -rw-r--r-- | drivers/ide/pci/cmd64x.c | 108 | ||||
| -rw-r--r-- | drivers/ide/pci/delkin_cb.c | 2 | ||||
| -rw-r--r-- | drivers/ide/pci/generic.c | 2 | ||||
| -rw-r--r-- | drivers/ide/pci/opti621.c | 3 | ||||
| -rw-r--r-- | drivers/ide/pci/piix.c | 49 | ||||
| -rw-r--r-- | drivers/ide/pci/rz1000.c | 2 | ||||
| -rw-r--r-- | drivers/ide/pci/siimage.c | 5 | ||||
| -rw-r--r-- | drivers/ide/pci/slc90e66.c | 38 |
10 files changed, 127 insertions, 118 deletions
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 4debd18d52f8..83e0aa65a431 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/drivers/ide/pci/alim15x3.c Version 0.17 2003/01/02 | 2 | * linux/drivers/ide/pci/alim15x3.c Version 0.21 2007/02/03 |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 1998-2000 Michel Aubry, Maintainer | 4 | * Copyright (C) 1998-2000 Michel Aubry, Maintainer |
| 5 | * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer | 5 | * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer |
| @@ -9,6 +9,7 @@ | |||
| 9 | * May be copied or modified under the terms of the GNU General Public License | 9 | * May be copied or modified under the terms of the GNU General Public License |
| 10 | * Copyright (C) 2002 Alan Cox <alan@redhat.com> | 10 | * Copyright (C) 2002 Alan Cox <alan@redhat.com> |
| 11 | * ALi (now ULi M5228) support by Clear Zhang <Clear.Zhang@ali.com.tw> | 11 | * ALi (now ULi M5228) support by Clear Zhang <Clear.Zhang@ali.com.tw> |
| 12 | * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com> | ||
| 12 | * | 13 | * |
| 13 | * (U)DMA capable version of ali 1533/1543(C), 1535(D) | 14 | * (U)DMA capable version of ali 1533/1543(C), 1535(D) |
| 14 | * | 15 | * |
| @@ -280,15 +281,17 @@ static int ali_get_info (char *buffer, char **addr, off_t offset, int count) | |||
| 280 | #endif /* defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_PROC_FS) */ | 281 | #endif /* defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_PROC_FS) */ |
| 281 | 282 | ||
| 282 | /** | 283 | /** |
| 283 | * ali15x3_tune_drive - set up a drive | 284 | * ali15x3_tune_pio - set up chipset for PIO mode |
| 284 | * @drive: drive to tune | 285 | * @drive: drive to tune |
| 285 | * @pio: unused | 286 | * @pio: desired mode |
| 286 | * | 287 | * |
| 287 | * Select the best PIO timing for the drive in question. Then | 288 | * Select the best PIO mode for the drive in question. |
| 288 | * program the controller for this drive set up | 289 | * Then program the controller for this mode. |
| 290 | * | ||
| 291 | * Returns the PIO mode programmed. | ||
| 289 | */ | 292 | */ |
| 290 | 293 | ||
| 291 | static void ali15x3_tune_drive (ide_drive_t *drive, u8 pio) | 294 | static u8 ali15x3_tune_pio (ide_drive_t *drive, u8 pio) |
| 292 | { | 295 | { |
| 293 | ide_pio_data_t d; | 296 | ide_pio_data_t d; |
| 294 | ide_hwif_t *hwif = HWIF(drive); | 297 | ide_hwif_t *hwif = HWIF(drive); |
| @@ -356,6 +359,22 @@ static void ali15x3_tune_drive (ide_drive_t *drive, u8 pio) | |||
| 356 | * { 20, 50, 30 } PIO Mode 5 with IORDY (nonstandard) | 359 | * { 20, 50, 30 } PIO Mode 5 with IORDY (nonstandard) |
| 357 | */ | 360 | */ |
| 358 | 361 | ||
| 362 | return pio; | ||
| 363 | } | ||
| 364 | |||
| 365 | /** | ||
| 366 | * ali15x3_tune_drive - set up drive for PIO mode | ||
| 367 | * @drive: drive to tune | ||
| 368 | * @pio: desired mode | ||
| 369 | * | ||
| 370 | * Program the controller with the best PIO timing for the given drive. | ||
| 371 | * Then set up the drive itself. | ||
| 372 | */ | ||
| 373 | |||
| 374 | static void ali15x3_tune_drive (ide_drive_t *drive, u8 pio) | ||
| 375 | { | ||
| 376 | pio = ali15x3_tune_pio(drive, pio); | ||
| 377 | (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); | ||
| 359 | } | 378 | } |
| 360 | 379 | ||
| 361 | /** | 380 | /** |
| @@ -430,7 +449,7 @@ static u8 ali15x3_ratemask (ide_drive_t *drive) | |||
| 430 | } | 449 | } |
| 431 | 450 | ||
| 432 | /** | 451 | /** |
| 433 | * ali15x3_tune_chipset - set up chiset for new speed | 452 | * ali15x3_tune_chipset - set up chipset/drive for new speed |
| 434 | * @drive: drive to configure for | 453 | * @drive: drive to configure for |
| 435 | * @xferspeed: desired speed | 454 | * @xferspeed: desired speed |
| 436 | * | 455 | * |
| @@ -461,7 +480,7 @@ static int ali15x3_tune_chipset (ide_drive_t *drive, u8 xferspeed) | |||
| 461 | pci_write_config_byte(dev, m5229_udma, tmpbyte); | 480 | pci_write_config_byte(dev, m5229_udma, tmpbyte); |
| 462 | 481 | ||
| 463 | if (speed < XFER_SW_DMA_0) | 482 | if (speed < XFER_SW_DMA_0) |
| 464 | ali15x3_tune_drive(drive, speed); | 483 | (void) ali15x3_tune_pio(drive, speed - XFER_PIO_0); |
| 465 | } else { | 484 | } else { |
| 466 | pci_read_config_byte(dev, m5229_udma, &tmpbyte); | 485 | pci_read_config_byte(dev, m5229_udma, &tmpbyte); |
| 467 | tmpbyte &= (0x0f << ((1-unit) << 2)); | 486 | tmpbyte &= (0x0f << ((1-unit) << 2)); |
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index 61b5f9c0b2f4..dc43f009acab 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c | |||
| @@ -98,7 +98,6 @@ | |||
| 98 | * (patch courtesy of Zoltan Hidvegi) | 98 | * (patch courtesy of Zoltan Hidvegi) |
| 99 | */ | 99 | */ |
| 100 | 100 | ||
| 101 | #undef REALLY_SLOW_IO /* most systems can safely undef this */ | ||
| 102 | #define CMD640_PREFETCH_MASKS 1 | 101 | #define CMD640_PREFETCH_MASKS 1 |
| 103 | 102 | ||
| 104 | //#define CMD640_DUMP_REGS | 103 | //#define CMD640_DUMP_REGS |
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index 49df27513da7..b0d4825c56a9 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* $Id: cmd64x.c,v 1.21 2000/01/30 23:23:16 | 1 | /* $Id: cmd64x.c,v 1.21 2000/01/30 23:23:16 |
| 2 | * | 2 | * |
| 3 | * linux/drivers/ide/pci/cmd64x.c Version 1.30 Sept 10, 2002 | 3 | * linux/drivers/ide/pci/cmd64x.c Version 1.41 Feb 3, 2007 |
| 4 | * | 4 | * |
| 5 | * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. | 5 | * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. |
| 6 | * Note, this driver is not used at all on other systems because | 6 | * Note, this driver is not used at all on other systems because |
| @@ -12,6 +12,7 @@ | |||
| 12 | * Copyright (C) 1998 David S. Miller (davem@redhat.com) | 12 | * Copyright (C) 1998 David S. Miller (davem@redhat.com) |
| 13 | * | 13 | * |
| 14 | * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org> | 14 | * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org> |
| 15 | * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com> | ||
| 15 | */ | 16 | */ |
| 16 | 17 | ||
| 17 | #include <linux/module.h> | 18 | #include <linux/module.h> |
| @@ -262,43 +263,25 @@ static void program_drive_counts (ide_drive_t *drive, int setup_count, int activ | |||
| 262 | } | 263 | } |
| 263 | 264 | ||
| 264 | /* | 265 | /* |
| 265 | * Attempts to set the interface PIO mode. | 266 | * This routine selects drive's best PIO mode, calculates setup/active/recovery |
| 266 | * The preferred method of selecting PIO modes (e.g. mode 4) is | 267 | * counts, and then writes them into the chipset registers. |
| 267 | * "echo 'piomode:4' > /proc/ide/hdx/settings". Special cases are | ||
| 268 | * 8: prefetch off, 9: prefetch on, 255: auto-select best mode. | ||
| 269 | * Called with 255 at boot time. | ||
| 270 | */ | 268 | */ |
| 271 | 269 | static u8 cmd64x_tune_pio (ide_drive_t *drive, u8 mode_wanted) | |
| 272 | static void cmd64x_tuneproc (ide_drive_t *drive, u8 mode_wanted) | ||
| 273 | { | 270 | { |
| 274 | int setup_time, active_time, recovery_time; | 271 | int setup_time, active_time, recovery_time; |
| 275 | int clock_time, pio_mode, cycle_time; | 272 | int clock_time, pio_mode, cycle_time; |
| 276 | u8 recovery_count2, cycle_count; | 273 | u8 recovery_count2, cycle_count; |
| 277 | int setup_count, active_count, recovery_count; | 274 | int setup_count, active_count, recovery_count; |
| 278 | int bus_speed = system_bus_clock(); | 275 | int bus_speed = system_bus_clock(); |
| 279 | /*byte b;*/ | ||
| 280 | ide_pio_data_t d; | 276 | ide_pio_data_t d; |
| 281 | 277 | ||
| 282 | switch (mode_wanted) { | 278 | pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5, &d); |
| 283 | case 8: /* set prefetch off */ | ||
| 284 | case 9: /* set prefetch on */ | ||
| 285 | mode_wanted &= 1; | ||
| 286 | /*set_prefetch_mode(index, mode_wanted);*/ | ||
| 287 | cmdprintk("%s: %sabled cmd640 prefetch\n", | ||
| 288 | drive->name, mode_wanted ? "en" : "dis"); | ||
| 289 | return; | ||
| 290 | } | ||
| 291 | |||
| 292 | mode_wanted = ide_get_best_pio_mode (drive, mode_wanted, 5, &d); | ||
| 293 | pio_mode = d.pio_mode; | ||
| 294 | cycle_time = d.cycle_time; | 279 | cycle_time = d.cycle_time; |
| 295 | 280 | ||
| 296 | /* | 281 | /* |
| 297 | * I copied all this complicated stuff from cmd640.c and made a few | 282 | * I copied all this complicated stuff from cmd640.c and made a few |
| 298 | * minor changes. For now I am just going to pray that it is correct. | 283 | * minor changes. For now I am just going to pray that it is correct. |
| 299 | */ | 284 | */ |
| 300 | if (pio_mode > 5) | ||
| 301 | pio_mode = 5; | ||
| 302 | setup_time = ide_pio_timings[pio_mode].setup_time; | 285 | setup_time = ide_pio_timings[pio_mode].setup_time; |
| 303 | active_time = ide_pio_timings[pio_mode].active_time; | 286 | active_time = ide_pio_timings[pio_mode].active_time; |
| 304 | recovery_time = cycle_time - (setup_time + active_time); | 287 | recovery_time = cycle_time - (setup_time + active_time); |
| @@ -320,22 +303,33 @@ static void cmd64x_tuneproc (ide_drive_t *drive, u8 mode_wanted) | |||
| 320 | if (active_count > 16) | 303 | if (active_count > 16) |
| 321 | active_count = 16; /* maximum allowed by cmd646 */ | 304 | active_count = 16; /* maximum allowed by cmd646 */ |
| 322 | 305 | ||
| 323 | /* | ||
| 324 | * In a perfect world, we might set the drive pio mode here | ||
| 325 | * (using WIN_SETFEATURE) before continuing. | ||
| 326 | * | ||
| 327 | * But we do not, because: | ||
| 328 | * 1) this is the wrong place to do it | ||
| 329 | * (proper is do_special() in ide.c) | ||
| 330 | * 2) in practice this is rarely, if ever, necessary | ||
| 331 | */ | ||
| 332 | program_drive_counts (drive, setup_count, active_count, recovery_count); | 306 | program_drive_counts (drive, setup_count, active_count, recovery_count); |
| 333 | 307 | ||
| 334 | cmdprintk("%s: selected cmd646 PIO mode%d : %d (%dns)%s, " | 308 | cmdprintk("%s: PIO mode wanted %d, selected %d (%dns)%s, " |
| 335 | "clocks=%d/%d/%d\n", | 309 | "clocks=%d/%d/%d\n", |
| 336 | drive->name, pio_mode, mode_wanted, cycle_time, | 310 | drive->name, mode_wanted, pio_mode, cycle_time, |
| 337 | d.overridden ? " (overriding vendor mode)" : "", | 311 | d.overridden ? " (overriding vendor mode)" : "", |
| 338 | setup_count, active_count, recovery_count); | 312 | setup_count, active_count, recovery_count); |
| 313 | |||
| 314 | return pio_mode; | ||
| 315 | } | ||
| 316 | |||
| 317 | /* | ||
| 318 | * Attempts to set drive's PIO mode. | ||
| 319 | * Special cases are 8: prefetch off, 9: prefetch on (both never worked), | ||
| 320 | * and 255: auto-select best mode (used at boot time). | ||
| 321 | */ | ||
| 322 | static void cmd64x_tune_drive (ide_drive_t *drive, u8 pio) | ||
| 323 | { | ||
| 324 | /* | ||
| 325 | * Filter out the prefetch control values | ||
| 326 | * to prevent PIO5 from being programmed | ||
| 327 | */ | ||
| 328 | if (pio == 8 || pio == 9) | ||
| 329 | return; | ||
| 330 | |||
| 331 | pio = cmd64x_tune_pio(drive, pio); | ||
| 332 | (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); | ||
| 339 | } | 333 | } |
| 340 | 334 | ||
| 341 | static u8 cmd64x_ratemask (ide_drive_t *drive) | 335 | static u8 cmd64x_ratemask (ide_drive_t *drive) |
| @@ -387,22 +381,6 @@ static u8 cmd64x_ratemask (ide_drive_t *drive) | |||
| 387 | return mode; | 381 | return mode; |
| 388 | } | 382 | } |
| 389 | 383 | ||
| 390 | static void config_cmd64x_chipset_for_pio (ide_drive_t *drive, u8 set_speed) | ||
| 391 | { | ||
| 392 | u8 speed = 0x00; | ||
| 393 | u8 set_pio = ide_get_best_pio_mode(drive, 4, 5, NULL); | ||
| 394 | |||
| 395 | cmd64x_tuneproc(drive, set_pio); | ||
| 396 | speed = XFER_PIO_0 + set_pio; | ||
| 397 | if (set_speed) | ||
| 398 | (void) ide_config_drive_speed(drive, speed); | ||
| 399 | } | ||
| 400 | |||
| 401 | static void config_chipset_for_pio (ide_drive_t *drive, u8 set_speed) | ||
| 402 | { | ||
| 403 | config_cmd64x_chipset_for_pio(drive, set_speed); | ||
| 404 | } | ||
| 405 | |||
| 406 | static int cmd64x_tune_chipset (ide_drive_t *drive, u8 xferspeed) | 384 | static int cmd64x_tune_chipset (ide_drive_t *drive, u8 xferspeed) |
| 407 | { | 385 | { |
| 408 | ide_hwif_t *hwif = HWIF(drive); | 386 | ide_hwif_t *hwif = HWIF(drive); |
| @@ -414,7 +392,7 @@ static int cmd64x_tune_chipset (ide_drive_t *drive, u8 xferspeed) | |||
| 414 | 392 | ||
| 415 | u8 speed = ide_rate_filter(cmd64x_ratemask(drive), xferspeed); | 393 | u8 speed = ide_rate_filter(cmd64x_ratemask(drive), xferspeed); |
| 416 | 394 | ||
| 417 | if (speed > XFER_PIO_4) { | 395 | if (speed >= XFER_SW_DMA_0) { |
| 418 | (void) pci_read_config_byte(dev, pciD, ®D); | 396 | (void) pci_read_config_byte(dev, pciD, ®D); |
| 419 | (void) pci_read_config_byte(dev, pciU, ®U); | 397 | (void) pci_read_config_byte(dev, pciU, ®U); |
| 420 | regD &= ~(unit ? 0x40 : 0x20); | 398 | regD &= ~(unit ? 0x40 : 0x20); |
| @@ -438,17 +416,20 @@ static int cmd64x_tune_chipset (ide_drive_t *drive, u8 xferspeed) | |||
| 438 | case XFER_SW_DMA_2: regD |= (unit ? 0x40 : 0x10); break; | 416 | case XFER_SW_DMA_2: regD |= (unit ? 0x40 : 0x10); break; |
| 439 | case XFER_SW_DMA_1: regD |= (unit ? 0x80 : 0x20); break; | 417 | case XFER_SW_DMA_1: regD |= (unit ? 0x80 : 0x20); break; |
| 440 | case XFER_SW_DMA_0: regD |= (unit ? 0xC0 : 0x30); break; | 418 | case XFER_SW_DMA_0: regD |= (unit ? 0xC0 : 0x30); break; |
| 441 | case XFER_PIO_4: cmd64x_tuneproc(drive, 4); break; | 419 | case XFER_PIO_5: |
| 442 | case XFER_PIO_3: cmd64x_tuneproc(drive, 3); break; | 420 | case XFER_PIO_4: |
| 443 | case XFER_PIO_2: cmd64x_tuneproc(drive, 2); break; | 421 | case XFER_PIO_3: |
| 444 | case XFER_PIO_1: cmd64x_tuneproc(drive, 1); break; | 422 | case XFER_PIO_2: |
| 445 | case XFER_PIO_0: cmd64x_tuneproc(drive, 0); break; | 423 | case XFER_PIO_1: |
| 424 | case XFER_PIO_0: | ||
| 425 | (void) cmd64x_tune_pio(drive, speed - XFER_PIO_0); | ||
| 426 | break; | ||
| 446 | 427 | ||
| 447 | default: | 428 | default: |
| 448 | return 1; | 429 | return 1; |
| 449 | } | 430 | } |
| 450 | 431 | ||
| 451 | if (speed > XFER_PIO_4) { | 432 | if (speed >= XFER_SW_DMA_0) { |
| 452 | (void) pci_write_config_byte(dev, pciU, regU); | 433 | (void) pci_write_config_byte(dev, pciU, regU); |
| 453 | regD |= (unit ? 0x40 : 0x20); | 434 | regD |= (unit ? 0x40 : 0x20); |
| 454 | (void) pci_write_config_byte(dev, pciD, regD); | 435 | (void) pci_write_config_byte(dev, pciD, regD); |
| @@ -461,8 +442,6 @@ static int config_chipset_for_dma (ide_drive_t *drive) | |||
| 461 | { | 442 | { |
| 462 | u8 speed = ide_dma_speed(drive, cmd64x_ratemask(drive)); | 443 | u8 speed = ide_dma_speed(drive, cmd64x_ratemask(drive)); |
| 463 | 444 | ||
| 464 | config_chipset_for_pio(drive, !speed); | ||
| 465 | |||
| 466 | if (!speed) | 445 | if (!speed) |
| 467 | return 0; | 446 | return 0; |
| 468 | 447 | ||
| @@ -478,7 +457,7 @@ static int cmd64x_config_drive_for_dma (ide_drive_t *drive) | |||
| 478 | return 0; | 457 | return 0; |
| 479 | 458 | ||
| 480 | if (ide_use_fast_pio(drive)) | 459 | if (ide_use_fast_pio(drive)) |
| 481 | config_chipset_for_pio(drive, 1); | 460 | cmd64x_tune_drive(drive, 255); |
| 482 | 461 | ||
| 483 | return -1; | 462 | return -1; |
| 484 | } | 463 | } |
| @@ -679,14 +658,13 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif) | |||
| 679 | pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev); | 658 | pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev); |
| 680 | class_rev &= 0xff; | 659 | class_rev &= 0xff; |
| 681 | 660 | ||
| 682 | hwif->tuneproc = &cmd64x_tuneproc; | 661 | hwif->tuneproc = &cmd64x_tune_drive; |
| 683 | hwif->speedproc = &cmd64x_tune_chipset; | 662 | hwif->speedproc = &cmd64x_tune_chipset; |
| 684 | 663 | ||
| 685 | if (!hwif->dma_base) { | 664 | hwif->drives[0].autotune = hwif->drives[1].autotune = 1; |
| 686 | hwif->drives[0].autotune = 1; | 665 | |
| 687 | hwif->drives[1].autotune = 1; | 666 | if (!hwif->dma_base) |
| 688 | return; | 667 | return; |
| 689 | } | ||
| 690 | 668 | ||
| 691 | hwif->atapi_dma = 1; | 669 | hwif->atapi_dma = 1; |
| 692 | 670 | ||
diff --git a/drivers/ide/pci/delkin_cb.c b/drivers/ide/pci/delkin_cb.c index e2672fc65d30..d4b753e70119 100644 --- a/drivers/ide/pci/delkin_cb.c +++ b/drivers/ide/pci/delkin_cb.c | |||
| @@ -122,7 +122,7 @@ static struct pci_driver driver = { | |||
| 122 | static int | 122 | static int |
| 123 | delkin_cb_init (void) | 123 | delkin_cb_init (void) |
| 124 | { | 124 | { |
| 125 | return pci_module_init(&driver); | 125 | return pci_register_driver(&driver); |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | static void | 128 | static void |
diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c index b408c6c517ea..f2c5a141ca10 100644 --- a/drivers/ide/pci/generic.c +++ b/drivers/ide/pci/generic.c | |||
| @@ -21,8 +21,6 @@ | |||
| 21 | * are deemed to be part of the source code. | 21 | * are deemed to be part of the source code. |
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | #undef REALLY_SLOW_IO /* most systems can safely undef this */ | ||
| 25 | |||
| 26 | #include <linux/types.h> | 24 | #include <linux/types.h> |
| 27 | #include <linux/module.h> | 25 | #include <linux/module.h> |
| 28 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c index 9ca60dd2185e..aede7eee9246 100644 --- a/drivers/ide/pci/opti621.c +++ b/drivers/ide/pci/opti621.c | |||
| @@ -57,7 +57,7 @@ | |||
| 57 | * There is a 25/33MHz switch in configuration | 57 | * There is a 25/33MHz switch in configuration |
| 58 | * register, but driver is written for use at any frequency which get | 58 | * register, but driver is written for use at any frequency which get |
| 59 | * (use idebus=xx to select PCI bus speed). | 59 | * (use idebus=xx to select PCI bus speed). |
| 60 | * Use ide0=autotune for automatical tune of the PIO modes. | 60 | * Use hda=autotune and hdb=autotune for automatical tune of the PIO modes. |
| 61 | * If you get strange results, do not use this and set PIO manually | 61 | * If you get strange results, do not use this and set PIO manually |
| 62 | * by hdparm. | 62 | * by hdparm. |
| 63 | * | 63 | * |
| @@ -87,7 +87,6 @@ | |||
| 87 | * 0.5 doesn't work. | 87 | * 0.5 doesn't work. |
| 88 | */ | 88 | */ |
| 89 | 89 | ||
| 90 | #undef REALLY_SLOW_IO /* most systems can safely undef this */ | ||
| 91 | #define OPTI621_DEBUG /* define for debug messages */ | 90 | #define OPTI621_DEBUG /* define for debug messages */ |
| 92 | 91 | ||
| 93 | #include <linux/types.h> | 92 | #include <linux/types.h> |
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index 569822f4cf55..061d300ab8be 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/drivers/ide/pci/piix.c Version 0.46 December 3, 2006 | 2 | * linux/drivers/ide/pci/piix.c Version 0.47 February 8, 2007 |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer | 4 | * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer |
| 5 | * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> | 5 | * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> |
| 6 | * Copyright (C) 2003 Red Hat Inc <alan@redhat.com> | 6 | * Copyright (C) 2003 Red Hat Inc <alan@redhat.com> |
| 7 | * Copyright (C) 2006 MontaVista Software, Inc. <source@mvista.com> | 7 | * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com> |
| 8 | * | 8 | * |
| 9 | * May be copied or modified under the terms of the GNU General Public License | 9 | * May be copied or modified under the terms of the GNU General Public License |
| 10 | * | 10 | * |
| @@ -205,14 +205,13 @@ static u8 piix_dma_2_pio (u8 xfer_rate) { | |||
| 205 | } | 205 | } |
| 206 | 206 | ||
| 207 | /** | 207 | /** |
| 208 | * piix_tune_drive - tune a drive attached to a PIIX | 208 | * piix_tune_pio - tune PIIX for PIO mode |
| 209 | * @drive: drive to tune | 209 | * @drive: drive to tune |
| 210 | * @pio: desired PIO mode | 210 | * @pio: desired PIO mode |
| 211 | * | 211 | * |
| 212 | * Set the interface PIO mode based upon the settings done by AMI BIOS | 212 | * Set the interface PIO mode based upon the settings done by AMI BIOS. |
| 213 | * (might be useful if drive is not registered in CMOS for any reason). | ||
| 214 | */ | 213 | */ |
| 215 | static void piix_tune_drive (ide_drive_t *drive, u8 pio) | 214 | static void piix_tune_pio (ide_drive_t *drive, u8 pio) |
| 216 | { | 215 | { |
| 217 | ide_hwif_t *hwif = HWIF(drive); | 216 | ide_hwif_t *hwif = HWIF(drive); |
| 218 | struct pci_dev *dev = hwif->pci_dev; | 217 | struct pci_dev *dev = hwif->pci_dev; |
| @@ -233,8 +232,6 @@ static void piix_tune_drive (ide_drive_t *drive, u8 pio) | |||
| 233 | { 2, 1 }, | 232 | { 2, 1 }, |
| 234 | { 2, 3 }, }; | 233 | { 2, 3 }, }; |
| 235 | 234 | ||
| 236 | pio = ide_get_best_pio_mode(drive, pio, 4, NULL); | ||
| 237 | |||
| 238 | /* | 235 | /* |
| 239 | * Master vs slave is synchronized above us but the slave register is | 236 | * Master vs slave is synchronized above us but the slave register is |
| 240 | * shared by the two hwifs so the corner case of two slave timeouts in | 237 | * shared by the two hwifs so the corner case of two slave timeouts in |
| @@ -253,19 +250,20 @@ static void piix_tune_drive (ide_drive_t *drive, u8 pio) | |||
| 253 | master_data |= 0x4000; | 250 | master_data |= 0x4000; |
| 254 | master_data &= ~0x0070; | 251 | master_data &= ~0x0070; |
| 255 | if (pio > 1) { | 252 | if (pio > 1) { |
| 256 | /* enable PPE, IE and TIME */ | 253 | /* Set PPE, IE and TIME */ |
| 257 | master_data = master_data | (control << 4); | 254 | master_data |= control << 4; |
| 258 | } | 255 | } |
| 259 | pci_read_config_byte(dev, slave_port, &slave_data); | 256 | pci_read_config_byte(dev, slave_port, &slave_data); |
| 260 | slave_data = slave_data & (hwif->channel ? 0x0f : 0xf0); | 257 | slave_data &= hwif->channel ? 0x0f : 0xf0; |
| 261 | slave_data = slave_data | (((timings[pio][0] << 2) | timings[pio][1]) << (hwif->channel ? 4 : 0)); | 258 | slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << |
| 259 | (hwif->channel ? 4 : 0); | ||
| 262 | } else { | 260 | } else { |
| 263 | master_data &= ~0x3307; | 261 | master_data &= ~0x3307; |
| 264 | if (pio > 1) { | 262 | if (pio > 1) { |
| 265 | /* enable PPE, IE and TIME */ | 263 | /* enable PPE, IE and TIME */ |
| 266 | master_data = master_data | control; | 264 | master_data |= control; |
| 267 | } | 265 | } |
| 268 | master_data = master_data | (timings[pio][0] << 12) | (timings[pio][1] << 8); | 266 | master_data |= (timings[pio][0] << 12) | (timings[pio][1] << 8); |
| 269 | } | 267 | } |
| 270 | pci_write_config_word(dev, master_port, master_data); | 268 | pci_write_config_word(dev, master_port, master_data); |
| 271 | if (is_slave) | 269 | if (is_slave) |
| @@ -274,6 +272,21 @@ static void piix_tune_drive (ide_drive_t *drive, u8 pio) | |||
| 274 | } | 272 | } |
| 275 | 273 | ||
| 276 | /** | 274 | /** |
| 275 | * piix_tune_drive - tune a drive attached to PIIX | ||
| 276 | * @drive: drive to tune | ||
| 277 | * @pio: desired PIO mode | ||
| 278 | * | ||
| 279 | * Set the drive's PIO mode (might be useful if drive is not registered | ||
| 280 | * in CMOS for any reason). | ||
| 281 | */ | ||
| 282 | static void piix_tune_drive (ide_drive_t *drive, u8 pio) | ||
| 283 | { | ||
| 284 | pio = ide_get_best_pio_mode(drive, pio, 4, NULL); | ||
| 285 | piix_tune_pio(drive, pio); | ||
| 286 | (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); | ||
| 287 | } | ||
| 288 | |||
| 289 | /** | ||
| 277 | * piix_tune_chipset - tune a PIIX interface | 290 | * piix_tune_chipset - tune a PIIX interface |
| 278 | * @drive: IDE drive to tune | 291 | * @drive: IDE drive to tune |
| 279 | * @xferspeed: speed to configure | 292 | * @xferspeed: speed to configure |
| @@ -348,8 +361,8 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed) | |||
| 348 | pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag); | 361 | pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag); |
| 349 | } | 362 | } |
| 350 | 363 | ||
| 351 | piix_tune_drive(drive, piix_dma_2_pio(speed)); | 364 | piix_tune_pio(drive, piix_dma_2_pio(speed)); |
| 352 | return (ide_config_drive_speed(drive, speed)); | 365 | return ide_config_drive_speed(drive, speed); |
| 353 | } | 366 | } |
| 354 | 367 | ||
| 355 | /** | 368 | /** |
| @@ -392,9 +405,7 @@ static int piix_config_drive_xfer_rate (ide_drive_t *drive) | |||
| 392 | return 0; | 405 | return 0; |
| 393 | 406 | ||
| 394 | if (ide_use_fast_pio(drive)) | 407 | if (ide_use_fast_pio(drive)) |
| 395 | /* Find best PIO mode. */ | 408 | piix_tune_drive(drive, 255); |
| 396 | piix_tune_chipset(drive, XFER_PIO_0 + | ||
| 397 | ide_get_best_pio_mode(drive, 255, 4, NULL)); | ||
| 398 | 409 | ||
| 399 | return -1; | 410 | return -1; |
| 400 | } | 411 | } |
diff --git a/drivers/ide/pci/rz1000.c b/drivers/ide/pci/rz1000.c index c1855311052b..f8c954690142 100644 --- a/drivers/ide/pci/rz1000.c +++ b/drivers/ide/pci/rz1000.c | |||
| @@ -15,8 +15,6 @@ | |||
| 15 | * Dunno if this fixes both ports, or only the primary port (?). | 15 | * Dunno if this fixes both ports, or only the primary port (?). |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #undef REALLY_SLOW_IO /* most systems can safely undef this */ | ||
| 19 | |||
| 20 | #include <linux/types.h> | 18 | #include <linux/types.h> |
| 21 | #include <linux/module.h> | 19 | #include <linux/module.h> |
| 22 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 7b4c189a9d99..71eccdf5f817 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c | |||
| @@ -26,6 +26,11 @@ | |||
| 26 | * If you have strange problems with nVidia chipset systems please | 26 | * If you have strange problems with nVidia chipset systems please |
| 27 | * see the SI support documentation and update your system BIOS | 27 | * see the SI support documentation and update your system BIOS |
| 28 | * if neccessary | 28 | * if neccessary |
| 29 | * | ||
| 30 | * The Dell DRAC4 has some interesting features including effectively hot | ||
| 31 | * unplugging/replugging the virtual CD interface when the DRAC is reset. | ||
| 32 | * This often causes drivers/ide/siimage to panic but is ok with the rather | ||
| 33 | * smarter code in libata. | ||
| 29 | */ | 34 | */ |
| 30 | 35 | ||
| 31 | #include <linux/types.h> | 36 | #include <linux/types.h> |
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c index ae7eb58d961c..852ccb36da1d 100644 --- a/drivers/ide/pci/slc90e66.c +++ b/drivers/ide/pci/slc90e66.c | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/drivers/ide/pci/slc90e66.c Version 0.13 December 30, 2006 | 2 | * linux/drivers/ide/pci/slc90e66.c Version 0.14 February 8, 2007 |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org> | 4 | * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org> |
| 5 | * Copyright (C) 2006 MontaVista Software, Inc. <source@mvista.com> | 5 | * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com> |
| 6 | * | 6 | * |
| 7 | * This is a look-alike variation of the ICH0 PIIX4 Ultra-66, | 7 | * This is a look-alike variation of the ICH0 PIIX4 Ultra-66, |
| 8 | * but this keeps the ISA-Bridge and slots alive. | 8 | * but this keeps the ISA-Bridge and slots alive. |
| @@ -57,11 +57,7 @@ static u8 slc90e66_dma_2_pio (u8 xfer_rate) { | |||
| 57 | } | 57 | } |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | /* | 60 | static void slc90e66_tune_pio (ide_drive_t *drive, u8 pio) |
| 61 | * Based on settings done by AMI BIOS | ||
| 62 | * (might be useful if drive is not registered in CMOS for any reason). | ||
| 63 | */ | ||
| 64 | static void slc90e66_tune_drive (ide_drive_t *drive, u8 pio) | ||
| 65 | { | 61 | { |
| 66 | ide_hwif_t *hwif = HWIF(drive); | 62 | ide_hwif_t *hwif = HWIF(drive); |
| 67 | struct pci_dev *dev = hwif->pci_dev; | 63 | struct pci_dev *dev = hwif->pci_dev; |
| @@ -80,7 +76,6 @@ static void slc90e66_tune_drive (ide_drive_t *drive, u8 pio) | |||
| 80 | { 2, 1 }, | 76 | { 2, 1 }, |
| 81 | { 2, 3 }, }; | 77 | { 2, 3 }, }; |
| 82 | 78 | ||
| 83 | pio = ide_get_best_pio_mode(drive, pio, 4, NULL); | ||
| 84 | spin_lock_irqsave(&ide_lock, flags); | 79 | spin_lock_irqsave(&ide_lock, flags); |
| 85 | pci_read_config_word(dev, master_port, &master_data); | 80 | pci_read_config_word(dev, master_port, &master_data); |
| 86 | 81 | ||
| @@ -94,19 +89,20 @@ static void slc90e66_tune_drive (ide_drive_t *drive, u8 pio) | |||
| 94 | master_data |= 0x4000; | 89 | master_data |= 0x4000; |
| 95 | master_data &= ~0x0070; | 90 | master_data &= ~0x0070; |
| 96 | if (pio > 1) { | 91 | if (pio > 1) { |
| 97 | /* enable PPE, IE and TIME */ | 92 | /* Set PPE, IE and TIME */ |
| 98 | master_data = master_data | (control << 4); | 93 | master_data |= control << 4; |
| 99 | } | 94 | } |
| 100 | pci_read_config_byte(dev, slave_port, &slave_data); | 95 | pci_read_config_byte(dev, slave_port, &slave_data); |
| 101 | slave_data = slave_data & (hwif->channel ? 0x0f : 0xf0); | 96 | slave_data &= hwif->channel ? 0x0f : 0xf0; |
| 102 | slave_data = slave_data | (((timings[pio][0] << 2) | timings[pio][1]) << (hwif->channel ? 4 : 0)); | 97 | slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << |
| 98 | (hwif->channel ? 4 : 0); | ||
| 103 | } else { | 99 | } else { |
| 104 | master_data &= ~0x3307; | 100 | master_data &= ~0x3307; |
| 105 | if (pio > 1) { | 101 | if (pio > 1) { |
| 106 | /* enable PPE, IE and TIME */ | 102 | /* enable PPE, IE and TIME */ |
| 107 | master_data = master_data | control; | 103 | master_data |= control; |
| 108 | } | 104 | } |
| 109 | master_data = master_data | (timings[pio][0] << 12) | (timings[pio][1] << 8); | 105 | master_data |= (timings[pio][0] << 12) | (timings[pio][1] << 8); |
| 110 | } | 106 | } |
| 111 | pci_write_config_word(dev, master_port, master_data); | 107 | pci_write_config_word(dev, master_port, master_data); |
| 112 | if (is_slave) | 108 | if (is_slave) |
| @@ -114,6 +110,13 @@ static void slc90e66_tune_drive (ide_drive_t *drive, u8 pio) | |||
| 114 | spin_unlock_irqrestore(&ide_lock, flags); | 110 | spin_unlock_irqrestore(&ide_lock, flags); |
| 115 | } | 111 | } |
| 116 | 112 | ||
| 113 | static void slc90e66_tune_drive (ide_drive_t *drive, u8 pio) | ||
| 114 | { | ||
| 115 | pio = ide_get_best_pio_mode(drive, pio, 4, NULL); | ||
| 116 | slc90e66_tune_pio(drive, pio); | ||
| 117 | (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); | ||
| 118 | } | ||
| 119 | |||
| 117 | static int slc90e66_tune_chipset (ide_drive_t *drive, u8 xferspeed) | 120 | static int slc90e66_tune_chipset (ide_drive_t *drive, u8 xferspeed) |
| 118 | { | 121 | { |
| 119 | ide_hwif_t *hwif = HWIF(drive); | 122 | ide_hwif_t *hwif = HWIF(drive); |
| @@ -162,8 +165,8 @@ static int slc90e66_tune_chipset (ide_drive_t *drive, u8 xferspeed) | |||
| 162 | pci_write_config_word(dev, 0x4a, reg4a & ~a_speed); | 165 | pci_write_config_word(dev, 0x4a, reg4a & ~a_speed); |
| 163 | } | 166 | } |
| 164 | 167 | ||
| 165 | slc90e66_tune_drive(drive, slc90e66_dma_2_pio(speed)); | 168 | slc90e66_tune_pio(drive, slc90e66_dma_2_pio(speed)); |
| 166 | return (ide_config_drive_speed(drive, speed)); | 169 | return ide_config_drive_speed(drive, speed); |
| 167 | } | 170 | } |
| 168 | 171 | ||
| 169 | static int slc90e66_config_drive_for_dma (ide_drive_t *drive) | 172 | static int slc90e66_config_drive_for_dma (ide_drive_t *drive) |
| @@ -185,8 +188,7 @@ static int slc90e66_config_drive_xfer_rate (ide_drive_t *drive) | |||
| 185 | return 0; | 188 | return 0; |
| 186 | 189 | ||
| 187 | if (ide_use_fast_pio(drive)) | 190 | if (ide_use_fast_pio(drive)) |
| 188 | (void)slc90e66_tune_chipset(drive, XFER_PIO_0 + | 191 | slc90e66_tune_drive(drive, 255); |
| 189 | ide_get_best_pio_mode(drive, 255, 4, NULL)); | ||
| 190 | 192 | ||
| 191 | return -1; | 193 | return -1; |
| 192 | } | 194 | } |
