aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-07-19 19:11:57 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-07-19 19:11:57 -0400
commite5fa4b2968ff0f32b5ecfa082fd6db50b731055e (patch)
tree096ecacb0c3b93c79f5a39899490acacbb2e11d7 /drivers
parent7dd00083b1160b560fa2a0a486799b57baa5d035 (diff)
ide: ide_find_best_pio_mode() fixes (take 2)
* Check IORDY bit for PIO modes > 2. * Some devices claim maximum PIO mode > 2 in id->tPIO, they were punished too severly for this by being limited to PIO_SLOW. Limit them to PIO2 instead. v2: * Fix PIO number being returned incorrectly instead of PIO mode (Noticed by Sergei). Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/ide-timing.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/ide/ide-timing.h b/drivers/ide/ide-timing.h
index e6cb8593b5ba..9b5afebafbf4 100644
--- a/drivers/ide/ide-timing.h
+++ b/drivers/ide/ide-timing.h
@@ -111,16 +111,14 @@ static short ide_find_best_pio_mode(ide_drive_t *drive)
111 struct hd_driveid *id = drive->id; 111 struct hd_driveid *id = drive->id;
112 short best = 0; 112 short best = 0;
113 113
114 if (id->field_valid & 2) { /* EIDE PIO modes */ 114 /* EIDE PIO modes */
115 115 if ((id->field_valid & 2) && (id->capability & 8)) {
116 if ((best = (drive->id->eide_pio_modes & 4) ? XFER_PIO_5 : 116 if ((best = (drive->id->eide_pio_modes & 4) ? XFER_PIO_5 :
117 (drive->id->eide_pio_modes & 2) ? XFER_PIO_4 : 117 (drive->id->eide_pio_modes & 2) ? XFER_PIO_4 :
118 (drive->id->eide_pio_modes & 1) ? XFER_PIO_3 : 0)) return best; 118 (drive->id->eide_pio_modes & 1) ? XFER_PIO_3 : 0)) return best;
119 } 119 }
120 120
121 return (drive->id->tPIO == 2) ? XFER_PIO_2 : 121 return XFER_PIO_0 + min_t(u8, id->tPIO, 2);
122 (drive->id->tPIO == 1) ? XFER_PIO_1 :
123 (drive->id->tPIO == 0) ? XFER_PIO_0 : XFER_PIO_SLOW;
124} 122}
125 123
126static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q, int T, int UT) 124static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q, int T, int UT)