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: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 0d28ec7f
...@@ -380,6 +380,7 @@ static void cmd640_dump_regs(void) ...@@ -380,6 +380,7 @@ static void cmd640_dump_regs(void)
} }
#endif #endif
#ifndef CONFIG_BLK_DEV_CMD640_ENHANCED
/* /*
* Check whether prefetch is on for a drive, * Check whether prefetch is on for a drive,
* and initialize the unmask flags for safe operation. * 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,9 +401,7 @@ static void __init check_prefetch(ide_drive_t *drive, unsigned int index)
drive->no_io_32bit = 0; drive->no_io_32bit = 0;
} }
} }
#else
#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
/* /*
* Sets prefetch mode for a drive. * Sets prefetch mode for a drive.
*/ */
...@@ -458,34 +457,6 @@ static inline u8 pack_nibbles(u8 upper, u8 lower) ...@@ -458,34 +457,6 @@ static inline u8 pack_nibbles(u8 upper, u8 lower)
return ((upper & 0x0f) << 4) | (lower & 0x0f); return ((upper & 0x0f) << 4) | (lower & 0x0f);
} }
/*
* This routine retrieves the initial drive timings from the chipset.
*/
static void __init retrieve_drive_counts(unsigned int index)
{
u8 b;
/*
* Get the internal setup timing, and convert to clock count
*/
b = get_cmd640_reg(arttim_regs[index]) & ~0x3f;
switch (b) {
case 0x00: b = 4; break;
case 0x80: b = 3; break;
case 0x40: b = 2; break;
default: b = 5; break;
}
setup_counts[index] = b;
/*
* Get the active/recovery counts
*/
b = get_cmd640_reg(drwtim_regs[index]);
active_counts[index] = (b >> 4) ? (b >> 4) : 0x10;
recovery_counts[index] = (b & 0x0f) ? (b & 0x0f) : 0x10;
}
/* /*
* This routine writes the prepared setup/active/recovery counts * This routine writes the prepared setup/active/recovery counts
* for a drive into the cmd640 chipset registers to active them. * for a drive into the cmd640 chipset registers to active them.
...@@ -683,7 +654,6 @@ static const struct ide_port_info cmd640_port_info __initdata = { ...@@ -683,7 +654,6 @@ static const struct ide_port_info cmd640_port_info __initdata = {
.chipset = ide_cmd640, .chipset = ide_cmd640,
.host_flags = IDE_HFLAG_SERIALIZE | .host_flags = IDE_HFLAG_SERIALIZE |
IDE_HFLAG_NO_DMA | IDE_HFLAG_NO_DMA |
IDE_HFLAG_NO_AUTOTUNE |
IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_ABUSE_PREFETCH |
IDE_HFLAG_ABUSE_FAST_DEVSEL, IDE_HFLAG_ABUSE_FAST_DEVSEL,
#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
...@@ -866,29 +836,16 @@ static int __init cmd640x_init(void) ...@@ -866,29 +836,16 @@ static int __init cmd640x_init(void)
} }
#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
if (drive->autotune || ((index > 1) && second_port_toggled)) { /*
/* * Reset timing to the slowest speed and turn off prefetch.
* Reset timing to the slowest speed and turn off * This way, the drive identify code has a better chance.
* prefetch. This way, the drive identify code has */
* a better chance. setup_counts [index] = 4; /* max possible */
*/ active_counts [index] = 16; /* max possible */
setup_counts [index] = 4; /* max possible */ recovery_counts [index] = 16; /* max possible */
active_counts [index] = 16; /* max possible */ program_drive_counts(drive, index);
recovery_counts [index] = 16; /* max possible */ set_prefetch_mode(drive, index, 0);
program_drive_counts(drive, index); printk("cmd640: drive%d timings/prefetch cleared\n", index);
set_prefetch_mode(drive, index, 0);
printk("cmd640: drive%d timings/prefetch cleared\n", index);
} else {
/*
* Record timings/prefetch without changing them.
* This preserves any prior BIOS setup.
*/
retrieve_drive_counts (index);
check_prefetch(drive, index);
printk("cmd640: drive%d timings/prefetch(%s) preserved",
index, drive->no_io_32bit ? "off" : "on");
display_clocks(index);
}
#else #else
/* /*
* Set the drive unmask flags to match the prefetch setting * Set the drive unmask flags to match the prefetch setting
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment