aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2007-03-03 11:48:53 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-03-03 11:48:53 -0500
commit81d368e0e2591497106b2543918c79dd6d78277b (patch)
tree7c0977499403ca7cc21ae70760399642abef9e2d /drivers/ide
parent07af427606667c304a2e965cd51d2c03642e8cae (diff)
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>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-lib.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index 8afce4ceea31..68719314df3f 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -345,16 +345,16 @@ static int ide_scan_pio_blacklist (char *model)
345 345
346/** 346/**
347 * ide_get_best_pio_mode - get PIO mode from drive 347 * ide_get_best_pio_mode - get PIO mode from drive
348 * @driver: drive to consider 348 * @drive: drive to consider
349 * @mode_wanted: preferred mode 349 * @mode_wanted: preferred mode
350 * @max_mode: highest allowed 350 * @max_mode: highest allowed mode
351 * @d: pio data 351 * @d: PIO data
352 * 352 *
353 * This routine returns the recommended PIO settings for a given drive, 353 * This routine returns the recommended PIO settings for a given drive,
354 * based on the drive->id information and the ide_pio_blacklist[]. 354 * based on the drive->id information and the ide_pio_blacklist[].
355 * This is used by most chipset support modules when "auto-tuning".
356 * 355 *
357 * Drive PIO mode auto selection 356 * Drive PIO mode is auto-selected if 255 is passed as mode_wanted.
357 * This is used by most chipset support modules when "auto-tuning".
358 */ 358 */
359 359
360u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d) 360u8 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
367 367
368 if (mode_wanted != 255) { 368 if (mode_wanted != 255) {
369 pio_mode = mode_wanted; 369 pio_mode = mode_wanted;
370 use_iordy = (pio_mode > 2);
370 } else if (!drive->id) { 371 } else if (!drive->id) {
371 pio_mode = 0; 372 pio_mode = 0;
372 } else if ((pio_mode = ide_scan_pio_blacklist(id->model)) != -1) { 373 } 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
396 } 397 }
397 } 398 }
398 399
399#if 0
400 if (drive->id->major_rev_num & 0x0004) printk("ATA-2 ");
401#endif
402
403 /* 400 /*
404 * Conservative "downgrade" for all pre-ATA2 drives 401 * Conservative "downgrade" for all pre-ATA2 drives
405 */ 402 */
406 if (pio_mode && pio_mode < 4) { 403 if (pio_mode && pio_mode < 4) {
407 pio_mode--; 404 pio_mode--;
408 overridden = 1; 405 overridden = 1;
409#if 0
410 use_iordy = (pio_mode > 2);
411#endif
412 if (cycle_time && cycle_time < ide_pio_timings[pio_mode].cycle_time) 406 if (cycle_time && cycle_time < ide_pio_timings[pio_mode].cycle_time)
413 cycle_time = 0; /* use standard timing */ 407 cycle_time = 0; /* use standard timing */
414 } 408 }