ide: ide_get_best_pio_mode() returns incorrect IORDY setting (take 2)
The function ide_get_best_pio_mode() fails to return the correct IORDY setting for the explicitly specified modes -- fix this along with the heading comment, and also remove the long commented out code. Also, while at it, correct the misliading comment about the PIO cycle time in <linux/ide.h> -- it actually consists of only the active and recovery periods, with only some chips also including the address setup time into equation... [ bart: sl82c105 seems to be currently the only driver affected by this fix ] Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
parent
07af427606
commit
81d368e0e2
@ -345,16 +345,16 @@ static int ide_scan_pio_blacklist (char *model)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ide_get_best_pio_mode - get PIO mode from drive
|
* ide_get_best_pio_mode - get PIO mode from drive
|
||||||
* @driver: drive to consider
|
* @drive: drive to consider
|
||||||
* @mode_wanted: preferred mode
|
* @mode_wanted: preferred mode
|
||||||
* @max_mode: highest allowed
|
* @max_mode: highest allowed mode
|
||||||
* @d: pio data
|
* @d: PIO data
|
||||||
*
|
*
|
||||||
* This routine returns the recommended PIO settings for a given drive,
|
* This routine returns the recommended PIO settings for a given drive,
|
||||||
* based on the drive->id information and the ide_pio_blacklist[].
|
* based on the drive->id information and the ide_pio_blacklist[].
|
||||||
* This is used by most chipset support modules when "auto-tuning".
|
|
||||||
*
|
*
|
||||||
* Drive PIO mode auto selection
|
* Drive PIO mode is auto-selected if 255 is passed as mode_wanted.
|
||||||
|
* This is used by most chipset support modules when "auto-tuning".
|
||||||
*/
|
*/
|
||||||
|
|
||||||
u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d)
|
u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d)
|
||||||
@ -367,6 +367,7 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p
|
|||||||
|
|
||||||
if (mode_wanted != 255) {
|
if (mode_wanted != 255) {
|
||||||
pio_mode = mode_wanted;
|
pio_mode = mode_wanted;
|
||||||
|
use_iordy = (pio_mode > 2);
|
||||||
} else if (!drive->id) {
|
} else if (!drive->id) {
|
||||||
pio_mode = 0;
|
pio_mode = 0;
|
||||||
} else if ((pio_mode = ide_scan_pio_blacklist(id->model)) != -1) {
|
} else if ((pio_mode = ide_scan_pio_blacklist(id->model)) != -1) {
|
||||||
@ -396,19 +397,12 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (drive->id->major_rev_num & 0x0004) printk("ATA-2 ");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Conservative "downgrade" for all pre-ATA2 drives
|
* Conservative "downgrade" for all pre-ATA2 drives
|
||||||
*/
|
*/
|
||||||
if (pio_mode && pio_mode < 4) {
|
if (pio_mode && pio_mode < 4) {
|
||||||
pio_mode--;
|
pio_mode--;
|
||||||
overridden = 1;
|
overridden = 1;
|
||||||
#if 0
|
|
||||||
use_iordy = (pio_mode > 2);
|
|
||||||
#endif
|
|
||||||
if (cycle_time && cycle_time < ide_pio_timings[pio_mode].cycle_time)
|
if (cycle_time && cycle_time < ide_pio_timings[pio_mode].cycle_time)
|
||||||
cycle_time = 0; /* use standard timing */
|
cycle_time = 0; /* use standard timing */
|
||||||
}
|
}
|
||||||
|
@ -1359,7 +1359,8 @@ u8 ide_dump_status(ide_drive_t *, const char *, u8);
|
|||||||
typedef struct ide_pio_timings_s {
|
typedef struct ide_pio_timings_s {
|
||||||
int setup_time; /* Address setup (ns) minimum */
|
int setup_time; /* Address setup (ns) minimum */
|
||||||
int active_time; /* Active pulse (ns) minimum */
|
int active_time; /* Active pulse (ns) minimum */
|
||||||
int cycle_time; /* Cycle time (ns) minimum = (setup + active + recovery) */
|
int cycle_time; /* Cycle time (ns) minimum = */
|
||||||
|
/* active + recovery (+ setup for some chips) */
|
||||||
} ide_pio_timings_t;
|
} ide_pio_timings_t;
|
||||||
|
|
||||||
typedef struct ide_pio_data_s {
|
typedef struct ide_pio_data_s {
|
||||||
|
Loading…
Reference in New Issue
Block a user