diff options
Diffstat (limited to 'drivers/ide/ide-lib.c')
-rw-r--r-- | drivers/ide/ide-lib.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index 957618849540..8400b1b4aa1b 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -325,6 +325,35 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode) | |||
325 | 325 | ||
326 | EXPORT_SYMBOL_GPL(ide_get_best_pio_mode); | 326 | EXPORT_SYMBOL_GPL(ide_get_best_pio_mode); |
327 | 327 | ||
328 | /* req_pio == "255" for auto-tune */ | ||
329 | void ide_set_pio(ide_drive_t *drive, u8 req_pio) | ||
330 | { | ||
331 | ide_hwif_t *hwif = drive->hwif; | ||
332 | u8 host_pio, pio; | ||
333 | |||
334 | if (hwif->set_pio_mode == NULL) | ||
335 | return; | ||
336 | |||
337 | BUG_ON(hwif->pio_mask == 0x00); | ||
338 | |||
339 | host_pio = fls(hwif->pio_mask) - 1; | ||
340 | |||
341 | pio = ide_get_best_pio_mode(drive, req_pio, host_pio); | ||
342 | |||
343 | /* | ||
344 | * TODO: | ||
345 | * - report device max PIO mode | ||
346 | * - check req_pio != 255 against device max PIO mode | ||
347 | */ | ||
348 | printk(KERN_DEBUG "%s: host max PIO%d wanted PIO%d%s selected PIO%d\n", | ||
349 | drive->name, host_pio, req_pio, | ||
350 | req_pio == 255 ? "(auto-tune)" : "", pio); | ||
351 | |||
352 | hwif->set_pio_mode(drive, pio); | ||
353 | } | ||
354 | |||
355 | EXPORT_SYMBOL_GPL(ide_set_pio); | ||
356 | |||
328 | /** | 357 | /** |
329 | * ide_toggle_bounce - handle bounce buffering | 358 | * ide_toggle_bounce - handle bounce buffering |
330 | * @drive: drive to update | 359 | * @drive: drive to update |