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 /drivers/ide/legacy | |
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>
Diffstat (limited to 'drivers/ide/legacy')
-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 |
3 files changed, 18 insertions, 17 deletions
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); |