diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-07-19 19:11:56 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-07-19 19:11:56 -0400 |
commit | 7dd00083b1160b560fa2a0a486799b57baa5d035 (patch) | |
tree | 22e8cf2c740d55ff9b4fdf57b9593a357d0092b7 | |
parent | 31c4df441cce6b9ec541e7f722f50bfbc617dd76 (diff) |
ide: add ide_pio_cycle_time() helper (take 2)
* Add ide_pio_cycle_time() helper.
* Use it in ali14xx/ht6560b/qd65xx/cmd64{0,x}/sl82c105 and pmac host drivers
(previously cycle time given by the device was only used for "pio" == 255).
* Remove no longer needed ide_pio_data_t.cycle_time field.
v2:
* Fix "ata_" prefix (Noticed by Jeff).
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/ide-lib.c | 40 | ||||
-rw-r--r-- | drivers/ide/legacy/ali14xx.c | 5 | ||||
-rw-r--r-- | drivers/ide/legacy/ht6560b.c | 10 | ||||
-rw-r--r-- | drivers/ide/legacy/qd65xx.c | 20 | ||||
-rw-r--r-- | drivers/ide/pci/cmd640.c | 12 | ||||
-rw-r--r-- | drivers/ide/pci/cmd64x.c | 10 | ||||
-rw-r--r-- | drivers/ide/pci/sl82c105.c | 16 | ||||
-rw-r--r-- | drivers/ide/ppc/pmac.c | 15 | ||||
-rw-r--r-- | include/linux/ide.h | 2 |
9 files changed, 74 insertions, 56 deletions
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index d5cc96bb4298..6e85bee0bef7 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -249,6 +249,29 @@ static int ide_scan_pio_blacklist (char *model) | |||
249 | return -1; | 249 | return -1; |
250 | } | 250 | } |
251 | 251 | ||
252 | unsigned int ide_pio_cycle_time(ide_drive_t *drive, u8 pio) | ||
253 | { | ||
254 | struct hd_driveid *id = drive->id; | ||
255 | int cycle_time = 0; | ||
256 | |||
257 | if (id->field_valid & 2) { | ||
258 | if (id->capability & 8) | ||
259 | cycle_time = id->eide_pio_iordy; | ||
260 | else | ||
261 | cycle_time = id->eide_pio; | ||
262 | } | ||
263 | |||
264 | /* conservative "downgrade" for all pre-ATA2 drives */ | ||
265 | if (pio < 3) { | ||
266 | if (cycle_time && cycle_time < ide_pio_timings[pio].cycle_time) | ||
267 | cycle_time = 0; /* use standard timing */ | ||
268 | } | ||
269 | |||
270 | return cycle_time ? cycle_time : ide_pio_timings[pio].cycle_time; | ||
271 | } | ||
272 | |||
273 | EXPORT_SYMBOL_GPL(ide_pio_cycle_time); | ||
274 | |||
252 | /** | 275 | /** |
253 | * ide_get_best_pio_mode - get PIO mode from drive | 276 | * ide_get_best_pio_mode - get PIO mode from drive |
254 | * @drive: drive to consider | 277 | * @drive: drive to consider |
@@ -266,7 +289,6 @@ static int ide_scan_pio_blacklist (char *model) | |||
266 | u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d) | 289 | u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d) |
267 | { | 290 | { |
268 | int pio_mode; | 291 | int pio_mode; |
269 | int cycle_time = 0; | ||
270 | struct hd_driveid* id = drive->id; | 292 | struct hd_driveid* id = drive->id; |
271 | int overridden = 0; | 293 | int overridden = 0; |
272 | 294 | ||
@@ -284,7 +306,6 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p | |||
284 | } | 306 | } |
285 | if (id->field_valid & 2) { /* drive implements ATA2? */ | 307 | if (id->field_valid & 2) { /* drive implements ATA2? */ |
286 | if (id->capability & 8) { /* IORDY supported? */ | 308 | if (id->capability & 8) { /* IORDY supported? */ |
287 | cycle_time = id->eide_pio_iordy; | ||
288 | if (id->eide_pio_modes & 7) { | 309 | if (id->eide_pio_modes & 7) { |
289 | overridden = 0; | 310 | overridden = 0; |
290 | if (id->eide_pio_modes & 4) | 311 | if (id->eide_pio_modes & 4) |
@@ -294,8 +315,6 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p | |||
294 | else | 315 | else |
295 | pio_mode = 3; | 316 | pio_mode = 3; |
296 | } | 317 | } |
297 | } else { | ||
298 | cycle_time = id->eide_pio; | ||
299 | } | 318 | } |
300 | } | 319 | } |
301 | 320 | ||
@@ -310,18 +329,15 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p | |||
310 | pio_mode--; | 329 | pio_mode--; |
311 | printk(KERN_INFO "%s: applying conservative " | 330 | printk(KERN_INFO "%s: applying conservative " |
312 | "PIO \"downgrade\"\n", drive->name); | 331 | "PIO \"downgrade\"\n", drive->name); |
313 | if (cycle_time && cycle_time < ide_pio_timings[pio_mode].cycle_time) | ||
314 | cycle_time = 0; /* use standard timing */ | ||
315 | } | 332 | } |
316 | } | 333 | } |
317 | if (pio_mode > max_mode) { | 334 | |
335 | if (pio_mode > max_mode) | ||
318 | pio_mode = max_mode; | 336 | pio_mode = max_mode; |
319 | cycle_time = 0; | 337 | |
320 | } | 338 | if (d) |
321 | if (d) { | ||
322 | d->pio_mode = pio_mode; | 339 | d->pio_mode = pio_mode; |
323 | d->cycle_time = cycle_time ? cycle_time : ide_pio_timings[pio_mode].cycle_time; | 340 | |
324 | } | ||
325 | return pio_mode; | 341 | return pio_mode; |
326 | } | 342 | } |
327 | 343 | ||
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c index df17ed68c0bc..30aeb8750c00 100644 --- a/drivers/ide/legacy/ali14xx.c +++ b/drivers/ide/legacy/ali14xx.c | |||
@@ -115,13 +115,12 @@ static void ali14xx_tune_drive (ide_drive_t *drive, u8 pio) | |||
115 | int time1, time2; | 115 | int time1, time2; |
116 | u8 param1, param2, param3, param4; | 116 | u8 param1, param2, param3, param4; |
117 | unsigned long flags; | 117 | unsigned long flags; |
118 | ide_pio_data_t d; | ||
119 | int bus_speed = system_bus_clock(); | 118 | int bus_speed = system_bus_clock(); |
120 | 119 | ||
121 | pio = ide_get_best_pio_mode(drive, pio, ALI_MAX_PIO, &d); | 120 | pio = ide_get_best_pio_mode(drive, pio, ALI_MAX_PIO, NULL); |
122 | 121 | ||
123 | /* calculate timing, according to PIO mode */ | 122 | /* calculate timing, according to PIO mode */ |
124 | time1 = d.cycle_time; | 123 | time1 = ide_pio_cycle_time(drive, pio); |
125 | time2 = ide_pio_timings[pio].active_time; | 124 | time2 = ide_pio_timings[pio].active_time; |
126 | param3 = param1 = (time2 * bus_speed + 999) / 1000; | 125 | param3 = param1 = (time2 * bus_speed + 999) / 1000; |
127 | param4 = param2 = (time1 * bus_speed + 999) / 1000 - param1; | 126 | param4 = param2 = (time1 * bus_speed + 999) / 1000 - param1; |
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c index c8f353b1296f..85d16812d902 100644 --- a/drivers/ide/legacy/ht6560b.c +++ b/drivers/ide/legacy/ht6560b.c | |||
@@ -203,19 +203,21 @@ static u8 ht_pio2timings(ide_drive_t *drive, u8 pio) | |||
203 | { | 203 | { |
204 | int active_time, recovery_time; | 204 | int active_time, recovery_time; |
205 | int active_cycles, recovery_cycles; | 205 | int active_cycles, recovery_cycles; |
206 | ide_pio_data_t d; | ||
207 | int bus_speed = system_bus_clock(); | 206 | int bus_speed = system_bus_clock(); |
208 | 207 | ||
209 | if (pio) { | 208 | if (pio) { |
210 | pio = ide_get_best_pio_mode(drive, pio, 5, &d); | 209 | unsigned int cycle_time; |
211 | 210 | ||
211 | pio = ide_get_best_pio_mode(drive, pio, 5, NULL); | ||
212 | cycle_time = ide_pio_cycle_time(drive, pio); | ||
213 | |||
212 | /* | 214 | /* |
213 | * Just like opti621.c we try to calculate the | 215 | * Just like opti621.c we try to calculate the |
214 | * actual cycle time for recovery and activity | 216 | * actual cycle time for recovery and activity |
215 | * according system bus speed. | 217 | * according system bus speed. |
216 | */ | 218 | */ |
217 | active_time = ide_pio_timings[pio].active_time; | 219 | active_time = ide_pio_timings[pio].active_time; |
218 | recovery_time = d.cycle_time | 220 | recovery_time = cycle_time |
219 | - active_time | 221 | - active_time |
220 | - ide_pio_timings[pio].setup_time; | 222 | - ide_pio_timings[pio].setup_time; |
221 | /* | 223 | /* |
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 7783745dd167..233905b08e93 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c | |||
@@ -252,38 +252,38 @@ static void qd6500_tune_drive (ide_drive_t *drive, u8 pio) | |||
252 | 252 | ||
253 | static void qd6580_tune_drive (ide_drive_t *drive, u8 pio) | 253 | static void qd6580_tune_drive (ide_drive_t *drive, u8 pio) |
254 | { | 254 | { |
255 | ide_pio_data_t d; | ||
256 | int base = HWIF(drive)->select_data; | 255 | int base = HWIF(drive)->select_data; |
256 | unsigned int cycle_time; | ||
257 | int active_time = 175; | 257 | int active_time = 175; |
258 | int recovery_time = 415; /* worst case values from the dos driver */ | 258 | int recovery_time = 415; /* worst case values from the dos driver */ |
259 | 259 | ||
260 | if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time)) { | 260 | if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time)) { |
261 | pio = ide_get_best_pio_mode(drive, pio, 4, &d); | 261 | pio = ide_get_best_pio_mode(drive, pio, 4, NULL); |
262 | cycle_time = ide_pio_cycle_time(drive, pio); | ||
262 | 263 | ||
263 | switch (pio) { | 264 | switch (pio) { |
264 | case 0: break; | 265 | case 0: break; |
265 | case 3: | 266 | case 3: |
266 | if (d.cycle_time >= 110) { | 267 | if (cycle_time >= 110) { |
267 | active_time = 86; | 268 | active_time = 86; |
268 | recovery_time = d.cycle_time - 102; | 269 | recovery_time = cycle_time - 102; |
269 | } else | 270 | } else |
270 | printk(KERN_WARNING "%s: Strange recovery time !\n",drive->name); | 271 | printk(KERN_WARNING "%s: Strange recovery time !\n",drive->name); |
271 | break; | 272 | break; |
272 | case 4: | 273 | case 4: |
273 | if (d.cycle_time >= 69) { | 274 | if (cycle_time >= 69) { |
274 | active_time = 70; | 275 | active_time = 70; |
275 | recovery_time = d.cycle_time - 61; | 276 | recovery_time = cycle_time - 61; |
276 | } else | 277 | } else |
277 | printk(KERN_WARNING "%s: Strange recovery time !\n",drive->name); | 278 | printk(KERN_WARNING "%s: Strange recovery time !\n",drive->name); |
278 | break; | 279 | break; |
279 | default: | 280 | default: |
280 | if (d.cycle_time >= 180) { | 281 | if (cycle_time >= 180) { |
281 | active_time = 110; | 282 | active_time = 110; |
282 | recovery_time = d.cycle_time - 120; | 283 | recovery_time = cycle_time - 120; |
283 | } else { | 284 | } else { |
284 | active_time = ide_pio_timings[pio].active_time; | 285 | active_time = ide_pio_timings[pio].active_time; |
285 | recovery_time = d.cycle_time | 286 | recovery_time = cycle_time - active_time; |
286 | -active_time; | ||
287 | } | 287 | } |
288 | } | 288 | } |
289 | printk(KERN_INFO "%s: PIO mode%d\n", drive->name,pio); | 289 | printk(KERN_INFO "%s: PIO mode%d\n", drive->name,pio); |
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index dff21597e643..9f67ffc43421 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c | |||
@@ -633,9 +633,8 @@ static void cmd640_set_mode (unsigned int index, u8 pio_mode, unsigned int cycle | |||
633 | */ | 633 | */ |
634 | static void cmd640_tune_drive (ide_drive_t *drive, u8 mode_wanted) | 634 | static void cmd640_tune_drive (ide_drive_t *drive, u8 mode_wanted) |
635 | { | 635 | { |
636 | unsigned int index = 0, cycle_time; | ||
636 | u8 b; | 637 | u8 b; |
637 | ide_pio_data_t d; | ||
638 | unsigned int index = 0; | ||
639 | 638 | ||
640 | while (drive != cmd_drives[index]) { | 639 | while (drive != cmd_drives[index]) { |
641 | if (++index > 3) { | 640 | if (++index > 3) { |
@@ -662,13 +661,12 @@ static void cmd640_tune_drive (ide_drive_t *drive, u8 mode_wanted) | |||
662 | return; | 661 | return; |
663 | } | 662 | } |
664 | 663 | ||
665 | (void) ide_get_best_pio_mode (drive, mode_wanted, 5, &d); | 664 | mode_wanted = ide_get_best_pio_mode(drive, mode_wanted, 5, NULL); |
666 | cmd640_set_mode (index, d.pio_mode, d.cycle_time); | 665 | cycle_time = ide_pio_cycle_time(drive, mode_wanted); |
666 | cmd640_set_mode(index, mode_wanted, cycle_time); | ||
667 | 667 | ||
668 | printk("%s: selected cmd640 PIO mode%d (%dns)", | 668 | printk("%s: selected cmd640 PIO mode%d (%dns)", |
669 | drive->name, | 669 | drive->name, mode_wanted, cycle_time); |
670 | d.pio_mode, | ||
671 | d.cycle_time); | ||
672 | 670 | ||
673 | display_clocks(index); | 671 | display_clocks(index); |
674 | } | 672 | } |
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index 8150a023dd7a..c383f6dc67dd 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c | |||
@@ -221,16 +221,18 @@ static u8 cmd64x_tune_pio (ide_drive_t *drive, u8 mode_wanted) | |||
221 | { | 221 | { |
222 | ide_hwif_t *hwif = HWIF(drive); | 222 | ide_hwif_t *hwif = HWIF(drive); |
223 | struct pci_dev *dev = hwif->pci_dev; | 223 | struct pci_dev *dev = hwif->pci_dev; |
224 | ide_pio_data_t pio; | 224 | unsigned int cycle_time; |
225 | u8 pio_mode, setup_count, arttim = 0; | 225 | u8 pio_mode, setup_count, arttim = 0; |
226 | static const u8 setup_values[] = {0x40, 0x40, 0x40, 0x80, 0, 0xc0}; | 226 | static const u8 setup_values[] = {0x40, 0x40, 0x40, 0x80, 0, 0xc0}; |
227 | static const u8 arttim_regs[4] = {ARTTIM0, ARTTIM1, ARTTIM23, ARTTIM23}; | 227 | static const u8 arttim_regs[4] = {ARTTIM0, ARTTIM1, ARTTIM23, ARTTIM23}; |
228 | pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5, &pio); | 228 | |
229 | pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5, NULL); | ||
230 | cycle_time = ide_pio_cycle_time(drive, pio_mode); | ||
229 | 231 | ||
230 | cmdprintk("%s: PIO mode wanted %d, selected %d (%d ns)\n", | 232 | cmdprintk("%s: PIO mode wanted %d, selected %d (%d ns)\n", |
231 | drive->name, mode_wanted, pio_mode, pio.cycle_time); | 233 | drive->name, mode_wanted, pio_mode, cycle_time); |
232 | 234 | ||
233 | program_cycle_times(drive, pio.cycle_time, | 235 | program_cycle_times(drive, cycle_time, |
234 | ide_pio_timings[pio_mode].active_time); | 236 | ide_pio_timings[pio_mode].active_time); |
235 | 237 | ||
236 | setup_count = quantize_timing(ide_pio_timings[pio_mode].setup_time, | 238 | setup_count = quantize_timing(ide_pio_timings[pio_mode].setup_time, |
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index f4637d29aaf5..cc5f69b7514f 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c | |||
@@ -52,13 +52,13 @@ | |||
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_drive_t *drive, ide_pio_data_t *p) | 55 | static unsigned int get_pio_timings(ide_drive_t *drive, u8 pio) |
56 | { | 56 | { |
57 | unsigned int cmd_on, cmd_off; | 57 | unsigned int cmd_on, cmd_off; |
58 | u8 iordy = 0; | 58 | u8 iordy = 0; |
59 | 59 | ||
60 | cmd_on = (ide_pio_timings[p->pio_mode].active_time + 29) / 30; | 60 | cmd_on = (ide_pio_timings[pio].active_time + 29) / 30; |
61 | cmd_off = (p->cycle_time - 30 * cmd_on + 29) / 30; | 61 | cmd_off = (ide_pio_cycle_time(drive, pio) - 30 * cmd_on + 29) / 30; |
62 | 62 | ||
63 | if (cmd_on == 0) | 63 | if (cmd_on == 0) |
64 | cmd_on = 1; | 64 | cmd_on = 1; |
@@ -66,7 +66,7 @@ static unsigned int get_pio_timings(ide_drive_t *drive, ide_pio_data_t *p) | |||
66 | if (cmd_off == 0) | 66 | if (cmd_off == 0) |
67 | cmd_off = 1; | 67 | cmd_off = 1; |
68 | 68 | ||
69 | if (p->pio_mode > 2 || ide_dev_has_iordy(drive->id)) | 69 | if (pio > 2 || ide_dev_has_iordy(drive->id)) |
70 | iordy = 0x40; | 70 | iordy = 0x40; |
71 | 71 | ||
72 | return (cmd_on - 1) << 8 | (cmd_off - 1) | iordy; | 72 | return (cmd_on - 1) << 8 | (cmd_off - 1) | iordy; |
@@ -79,14 +79,13 @@ static u8 sl82c105_tune_pio(ide_drive_t *drive, u8 pio) | |||
79 | { | 79 | { |
80 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 80 | struct pci_dev *dev = HWIF(drive)->pci_dev; |
81 | int reg = 0x44 + drive->dn * 4; | 81 | int reg = 0x44 + drive->dn * 4; |
82 | ide_pio_data_t p; | ||
83 | u16 drv_ctrl; | 82 | u16 drv_ctrl; |
84 | 83 | ||
85 | DBG(("sl82c105_tune_pio(drive:%s, pio:%u)\n", drive->name, pio)); | 84 | DBG(("sl82c105_tune_pio(drive:%s, pio:%u)\n", drive->name, pio)); |
86 | 85 | ||
87 | pio = ide_get_best_pio_mode(drive, pio, 5, &p); | 86 | pio = ide_get_best_pio_mode(drive, pio, 5, NULL); |
88 | 87 | ||
89 | drv_ctrl = get_pio_timings(drive, &p); | 88 | drv_ctrl = get_pio_timings(drive, pio); |
90 | 89 | ||
91 | /* | 90 | /* |
92 | * Store the PIO timings so that we can restore them | 91 | * Store the PIO timings so that we can restore them |
@@ -105,7 +104,8 @@ static u8 sl82c105_tune_pio(ide_drive_t *drive, u8 pio) | |||
105 | } | 104 | } |
106 | 105 | ||
107 | printk(KERN_DEBUG "%s: selected %s (%dns) (%04X)\n", drive->name, | 106 | printk(KERN_DEBUG "%s: selected %s (%dns) (%04X)\n", drive->name, |
108 | ide_xfer_verbose(pio + XFER_PIO_0), p.cycle_time, drv_ctrl); | 107 | ide_xfer_verbose(pio + XFER_PIO_0), |
108 | ide_pio_cycle_time(drive, pio), drv_ctrl); | ||
109 | 109 | ||
110 | return pio; | 110 | return pio; |
111 | } | 111 | } |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index e46f47206542..669330521fc1 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -615,24 +615,25 @@ out: | |||
615 | static void | 615 | static void |
616 | pmac_ide_tuneproc(ide_drive_t *drive, u8 pio) | 616 | pmac_ide_tuneproc(ide_drive_t *drive, u8 pio) |
617 | { | 617 | { |
618 | ide_pio_data_t d; | ||
619 | u32 *timings; | 618 | u32 *timings; |
620 | unsigned accessTicks, recTicks; | 619 | unsigned accessTicks, recTicks; |
621 | unsigned accessTime, recTime; | 620 | unsigned accessTime, recTime; |
622 | pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; | 621 | pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; |
623 | 622 | unsigned int cycle_time; | |
623 | |||
624 | if (pmif == NULL) | 624 | if (pmif == NULL) |
625 | return; | 625 | return; |
626 | 626 | ||
627 | /* which drive is it ? */ | 627 | /* which drive is it ? */ |
628 | timings = &pmif->timings[drive->select.b.unit & 0x01]; | 628 | timings = &pmif->timings[drive->select.b.unit & 0x01]; |
629 | 629 | ||
630 | pio = ide_get_best_pio_mode(drive, pio, 4, &d); | 630 | pio = ide_get_best_pio_mode(drive, pio, 4, NULL); |
631 | cycle_time = ide_pio_cycle_time(drive, pio); | ||
631 | 632 | ||
632 | switch (pmif->kind) { | 633 | switch (pmif->kind) { |
633 | case controller_sh_ata6: { | 634 | case controller_sh_ata6: { |
634 | /* 133Mhz cell */ | 635 | /* 133Mhz cell */ |
635 | u32 tr = kauai_lookup_timing(shasta_pio_timings, d.cycle_time); | 636 | u32 tr = kauai_lookup_timing(shasta_pio_timings, cycle_time); |
636 | if (tr == 0) | 637 | if (tr == 0) |
637 | return; | 638 | return; |
638 | *timings = ((*timings) & ~TR_133_PIOREG_PIO_MASK) | tr; | 639 | *timings = ((*timings) & ~TR_133_PIOREG_PIO_MASK) | tr; |
@@ -641,7 +642,7 @@ pmac_ide_tuneproc(ide_drive_t *drive, u8 pio) | |||
641 | case controller_un_ata6: | 642 | case controller_un_ata6: |
642 | case controller_k2_ata6: { | 643 | case controller_k2_ata6: { |
643 | /* 100Mhz cell */ | 644 | /* 100Mhz cell */ |
644 | u32 tr = kauai_lookup_timing(kauai_pio_timings, d.cycle_time); | 645 | u32 tr = kauai_lookup_timing(kauai_pio_timings, cycle_time); |
645 | if (tr == 0) | 646 | if (tr == 0) |
646 | return; | 647 | return; |
647 | *timings = ((*timings) & ~TR_100_PIOREG_PIO_MASK) | tr; | 648 | *timings = ((*timings) & ~TR_100_PIOREG_PIO_MASK) | tr; |
@@ -649,7 +650,7 @@ pmac_ide_tuneproc(ide_drive_t *drive, u8 pio) | |||
649 | } | 650 | } |
650 | case controller_kl_ata4: | 651 | case controller_kl_ata4: |
651 | /* 66Mhz cell */ | 652 | /* 66Mhz cell */ |
652 | recTime = d.cycle_time - ide_pio_timings[pio].active_time | 653 | recTime = cycle_time - ide_pio_timings[pio].active_time |
653 | - ide_pio_timings[pio].setup_time; | 654 | - ide_pio_timings[pio].setup_time; |
654 | recTime = max(recTime, 150U); | 655 | recTime = max(recTime, 150U); |
655 | accessTime = ide_pio_timings[pio].active_time; | 656 | accessTime = ide_pio_timings[pio].active_time; |
@@ -665,7 +666,7 @@ pmac_ide_tuneproc(ide_drive_t *drive, u8 pio) | |||
665 | default: { | 666 | default: { |
666 | /* 33Mhz cell */ | 667 | /* 33Mhz cell */ |
667 | int ebit = 0; | 668 | int ebit = 0; |
668 | recTime = d.cycle_time - ide_pio_timings[pio].active_time | 669 | recTime = cycle_time - ide_pio_timings[pio].active_time |
669 | - ide_pio_timings[pio].setup_time; | 670 | - ide_pio_timings[pio].setup_time; |
670 | recTime = max(recTime, 150U); | 671 | recTime = max(recTime, 150U); |
671 | accessTime = ide_pio_timings[pio].active_time; | 672 | accessTime = ide_pio_timings[pio].active_time; |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 498dc57627fa..0afa52c14ffa 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -1379,9 +1379,9 @@ typedef struct ide_pio_timings_s { | |||
1379 | 1379 | ||
1380 | typedef struct ide_pio_data_s { | 1380 | typedef struct ide_pio_data_s { |
1381 | u8 pio_mode; | 1381 | u8 pio_mode; |
1382 | unsigned int cycle_time; | ||
1383 | } ide_pio_data_t; | 1382 | } ide_pio_data_t; |
1384 | 1383 | ||
1384 | unsigned int ide_pio_cycle_time(ide_drive_t *, u8); | ||
1385 | extern u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d); | 1385 | extern u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d); |
1386 | extern const ide_pio_timings_t ide_pio_timings[6]; | 1386 | extern const ide_pio_timings_t ide_pio_timings[6]; |
1387 | 1387 | ||