diff options
-rw-r--r-- | drivers/ide/ide-lib.c | 7 | ||||
-rw-r--r-- | drivers/ide/pci/sl82c105.c | 10 | ||||
-rw-r--r-- | include/linux/ide.h | 6 |
3 files changed, 13 insertions, 10 deletions
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index d45bbad9ffe7..d5cc96bb4298 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -267,18 +267,15 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p | |||
267 | { | 267 | { |
268 | int pio_mode; | 268 | int pio_mode; |
269 | int cycle_time = 0; | 269 | int cycle_time = 0; |
270 | int use_iordy = 0; | ||
271 | struct hd_driveid* id = drive->id; | 270 | struct hd_driveid* id = drive->id; |
272 | int overridden = 0; | 271 | int overridden = 0; |
273 | 272 | ||
274 | if (mode_wanted != 255) { | 273 | if (mode_wanted != 255) { |
275 | pio_mode = mode_wanted; | 274 | pio_mode = mode_wanted; |
276 | use_iordy = (pio_mode > 2); | ||
277 | } else if (!drive->id) { | 275 | } else if (!drive->id) { |
278 | pio_mode = 0; | 276 | pio_mode = 0; |
279 | } else if ((pio_mode = ide_scan_pio_blacklist(id->model)) != -1) { | 277 | } else if ((pio_mode = ide_scan_pio_blacklist(id->model)) != -1) { |
280 | printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name); | 278 | printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name); |
281 | use_iordy = (pio_mode > 2); | ||
282 | } else { | 279 | } else { |
283 | pio_mode = id->tPIO; | 280 | pio_mode = id->tPIO; |
284 | if (pio_mode > 2) { /* 2 is maximum allowed tPIO value */ | 281 | if (pio_mode > 2) { /* 2 is maximum allowed tPIO value */ |
@@ -286,8 +283,7 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p | |||
286 | overridden = 1; | 283 | overridden = 1; |
287 | } | 284 | } |
288 | if (id->field_valid & 2) { /* drive implements ATA2? */ | 285 | if (id->field_valid & 2) { /* drive implements ATA2? */ |
289 | if (id->capability & 8) { /* drive supports use_iordy? */ | 286 | if (id->capability & 8) { /* IORDY supported? */ |
290 | use_iordy = 1; | ||
291 | cycle_time = id->eide_pio_iordy; | 287 | cycle_time = id->eide_pio_iordy; |
292 | if (id->eide_pio_modes & 7) { | 288 | if (id->eide_pio_modes & 7) { |
293 | overridden = 0; | 289 | overridden = 0; |
@@ -325,7 +321,6 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p | |||
325 | if (d) { | 321 | if (d) { |
326 | d->pio_mode = pio_mode; | 322 | d->pio_mode = pio_mode; |
327 | d->cycle_time = cycle_time ? cycle_time : ide_pio_timings[pio_mode].cycle_time; | 323 | d->cycle_time = cycle_time ? cycle_time : ide_pio_timings[pio_mode].cycle_time; |
328 | d->use_iordy = use_iordy; | ||
329 | } | 324 | } |
330 | return pio_mode; | 325 | return pio_mode; |
331 | } | 326 | } |
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index a7323d278c49..f2156ee7e2bd 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c | |||
@@ -52,9 +52,10 @@ | |||
52 | * Convert a PIO mode and cycle time to the required on/off times | 52 | * Convert a PIO mode and cycle time to the required on/off times |
53 | * for the interface. This has protection against runaway timings. | 53 | * for the interface. This has protection against runaway timings. |
54 | */ | 54 | */ |
55 | static unsigned int get_pio_timings(ide_pio_data_t *p) | 55 | static unsigned int get_pio_timings(ide_drive_t *drive, ide_pio_data_t *p) |
56 | { | 56 | { |
57 | unsigned int cmd_on, cmd_off; | 57 | unsigned int cmd_on, cmd_off; |
58 | u8 iordy = 0; | ||
58 | 59 | ||
59 | cmd_on = (ide_pio_timings[p->pio_mode].active_time + 29) / 30; | 60 | cmd_on = (ide_pio_timings[p->pio_mode].active_time + 29) / 30; |
60 | cmd_off = (p->cycle_time - 30 * cmd_on + 29) / 30; | 61 | cmd_off = (p->cycle_time - 30 * cmd_on + 29) / 30; |
@@ -65,7 +66,10 @@ static unsigned int get_pio_timings(ide_pio_data_t *p) | |||
65 | if (cmd_off == 0) | 66 | if (cmd_off == 0) |
66 | cmd_off = 1; | 67 | cmd_off = 1; |
67 | 68 | ||
68 | return (cmd_on - 1) << 8 | (cmd_off - 1) | (p->use_iordy ? 0x40 : 0x00); | 69 | if (p->pio_mode > 2 || ide_dev_has_iordy(drive->id)) |
70 | iordy = 0x40; | ||
71 | |||
72 | return (cmd_on - 1) << 8 | (cmd_off - 1) | iordy; | ||
69 | } | 73 | } |
70 | 74 | ||
71 | /* | 75 | /* |
@@ -82,7 +86,7 @@ static u8 sl82c105_tune_pio(ide_drive_t *drive, u8 pio) | |||
82 | 86 | ||
83 | pio = ide_get_best_pio_mode(drive, pio, 5, &p); | 87 | pio = ide_get_best_pio_mode(drive, pio, 5, &p); |
84 | 88 | ||
85 | drv_ctrl = get_pio_timings(&p); | 89 | drv_ctrl = get_pio_timings(drive, &p); |
86 | 90 | ||
87 | /* | 91 | /* |
88 | * Store the PIO timings so that we can restore them | 92 | * Store the PIO timings so that we can restore them |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 83a117d673c7..349c22a1fbc5 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -1363,6 +1363,11 @@ extern void ide_toggle_bounce(ide_drive_t *drive, int on); | |||
1363 | extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); | 1363 | extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); |
1364 | int ide_use_fast_pio(ide_drive_t *); | 1364 | int ide_use_fast_pio(ide_drive_t *); |
1365 | 1365 | ||
1366 | static inline int ide_dev_has_iordy(struct hd_driveid *id) | ||
1367 | { | ||
1368 | return ((id->field_valid & 2) && (id->capability & 8)) ? 1 : 0; | ||
1369 | } | ||
1370 | |||
1366 | u8 ide_dump_status(ide_drive_t *, const char *, u8); | 1371 | u8 ide_dump_status(ide_drive_t *, const char *, u8); |
1367 | 1372 | ||
1368 | typedef struct ide_pio_timings_s { | 1373 | typedef struct ide_pio_timings_s { |
@@ -1374,7 +1379,6 @@ typedef struct ide_pio_timings_s { | |||
1374 | 1379 | ||
1375 | typedef struct ide_pio_data_s { | 1380 | typedef struct ide_pio_data_s { |
1376 | u8 pio_mode; | 1381 | u8 pio_mode; |
1377 | u8 use_iordy; | ||
1378 | unsigned int cycle_time; | 1382 | unsigned int cycle_time; |
1379 | } ide_pio_data_t; | 1383 | } ide_pio_data_t; |
1380 | 1384 | ||