diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-27 09:38:29 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-27 09:38:29 -0400 |
commit | bdffe5d2717c41945d75b488cfaa401d166cb3dd (patch) | |
tree | f89fcb95f720a3df77e47e4eead63e15a423806a /drivers | |
parent | 0d28ec7f213eee37855741410a95ec559f9fa87a (diff) |
cmd640: always auto-tune PIO
* Default to tuning PIO0 and disabling prefetch prior to probing
devices for CONFIG_BLK_DEV_CMD640_ENHANCED=y case.
* Always auto-tune PIO.
* Remove no longer used retrieve_drive_counts().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ide/pci/cmd640.c | 67 |
1 files changed, 12 insertions, 55 deletions
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index 6e7a6faa480e..812027ddaafa 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c | |||
@@ -380,6 +380,7 @@ static void cmd640_dump_regs(void) | |||
380 | } | 380 | } |
381 | #endif | 381 | #endif |
382 | 382 | ||
383 | #ifndef CONFIG_BLK_DEV_CMD640_ENHANCED | ||
383 | /* | 384 | /* |
384 | * Check whether prefetch is on for a drive, | 385 | * Check whether prefetch is on for a drive, |
385 | * and initialize the unmask flags for safe operation. | 386 | * and initialize the unmask flags for safe operation. |
@@ -400,9 +401,7 @@ static void __init check_prefetch(ide_drive_t *drive, unsigned int index) | |||
400 | drive->no_io_32bit = 0; | 401 | drive->no_io_32bit = 0; |
401 | } | 402 | } |
402 | } | 403 | } |
403 | 404 | #else | |
404 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED | ||
405 | |||
406 | /* | 405 | /* |
407 | * Sets prefetch mode for a drive. | 406 | * Sets prefetch mode for a drive. |
408 | */ | 407 | */ |
@@ -459,34 +458,6 @@ static inline u8 pack_nibbles(u8 upper, u8 lower) | |||
459 | } | 458 | } |
460 | 459 | ||
461 | /* | 460 | /* |
462 | * This routine retrieves the initial drive timings from the chipset. | ||
463 | */ | ||
464 | static void __init retrieve_drive_counts(unsigned int index) | ||
465 | { | ||
466 | u8 b; | ||
467 | |||
468 | /* | ||
469 | * Get the internal setup timing, and convert to clock count | ||
470 | */ | ||
471 | b = get_cmd640_reg(arttim_regs[index]) & ~0x3f; | ||
472 | switch (b) { | ||
473 | case 0x00: b = 4; break; | ||
474 | case 0x80: b = 3; break; | ||
475 | case 0x40: b = 2; break; | ||
476 | default: b = 5; break; | ||
477 | } | ||
478 | setup_counts[index] = b; | ||
479 | |||
480 | /* | ||
481 | * Get the active/recovery counts | ||
482 | */ | ||
483 | b = get_cmd640_reg(drwtim_regs[index]); | ||
484 | active_counts[index] = (b >> 4) ? (b >> 4) : 0x10; | ||
485 | recovery_counts[index] = (b & 0x0f) ? (b & 0x0f) : 0x10; | ||
486 | } | ||
487 | |||
488 | |||
489 | /* | ||
490 | * This routine writes the prepared setup/active/recovery counts | 461 | * This routine writes the prepared setup/active/recovery counts |
491 | * for a drive into the cmd640 chipset registers to active them. | 462 | * for a drive into the cmd640 chipset registers to active them. |
492 | */ | 463 | */ |
@@ -683,7 +654,6 @@ static const struct ide_port_info cmd640_port_info __initdata = { | |||
683 | .chipset = ide_cmd640, | 654 | .chipset = ide_cmd640, |
684 | .host_flags = IDE_HFLAG_SERIALIZE | | 655 | .host_flags = IDE_HFLAG_SERIALIZE | |
685 | IDE_HFLAG_NO_DMA | | 656 | IDE_HFLAG_NO_DMA | |
686 | IDE_HFLAG_NO_AUTOTUNE | | ||
687 | IDE_HFLAG_ABUSE_PREFETCH | | 657 | IDE_HFLAG_ABUSE_PREFETCH | |
688 | IDE_HFLAG_ABUSE_FAST_DEVSEL, | 658 | IDE_HFLAG_ABUSE_FAST_DEVSEL, |
689 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED | 659 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED |
@@ -866,29 +836,16 @@ static int __init cmd640x_init(void) | |||
866 | } | 836 | } |
867 | 837 | ||
868 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED | 838 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED |
869 | if (drive->autotune || ((index > 1) && second_port_toggled)) { | 839 | /* |
870 | /* | 840 | * Reset timing to the slowest speed and turn off prefetch. |
871 | * Reset timing to the slowest speed and turn off | 841 | * This way, the drive identify code has a better chance. |
872 | * prefetch. This way, the drive identify code has | 842 | */ |
873 | * a better chance. | 843 | setup_counts [index] = 4; /* max possible */ |
874 | */ | 844 | active_counts [index] = 16; /* max possible */ |
875 | setup_counts [index] = 4; /* max possible */ | 845 | recovery_counts [index] = 16; /* max possible */ |
876 | active_counts [index] = 16; /* max possible */ | 846 | program_drive_counts(drive, index); |
877 | recovery_counts [index] = 16; /* max possible */ | 847 | set_prefetch_mode(drive, index, 0); |
878 | program_drive_counts(drive, index); | 848 | printk("cmd640: drive%d timings/prefetch cleared\n", index); |
879 | set_prefetch_mode(drive, index, 0); | ||
880 | printk("cmd640: drive%d timings/prefetch cleared\n", index); | ||
881 | } else { | ||
882 | /* | ||
883 | * Record timings/prefetch without changing them. | ||
884 | * This preserves any prior BIOS setup. | ||
885 | */ | ||
886 | retrieve_drive_counts (index); | ||
887 | check_prefetch(drive, index); | ||
888 | printk("cmd640: drive%d timings/prefetch(%s) preserved", | ||
889 | index, drive->no_io_32bit ? "off" : "on"); | ||
890 | display_clocks(index); | ||
891 | } | ||
892 | #else | 849 | #else |
893 | /* | 850 | /* |
894 | * Set the drive unmask flags to match the prefetch setting | 851 | * Set the drive unmask flags to match the prefetch setting |