aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/via82cxxx.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-11 17:54:00 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-11 17:54:00 -0400
commit26bcb879c03254545a19c6700fe5bcef6f21e7b1 (patch)
treedc35f1a7d7860fe0de268ff92189ff0884b689d3 /drivers/ide/pci/via82cxxx.c
parent842c19ad6fc0dbd9ac9d2f8527466201802934cf (diff)
ide: add ide_set{_max}_pio() (take 4)
* Add IDE_HFLAG_ABUSE_{PREFETCH,FAST_DEVSEL,DMA_MODES} flags and set them in ht6560, cmd640, cmd64x and sc1200 host drivers. * Add set_pio_mode_abuse() for checking if host driver has a non-standard ->tuneproc() implementation and use it in do_special(). * Add ide_set_pio() for setting PIO mode (it uses hwif->pio_mask to find the maximum PIO mode supported by the host), also add ide_set_max_pio() wrapper for ide_set_pio() to use for auto-tuning. Convert users of ->tuneproc to use ide_set{_max}_pio() where possible. This leaves only do_special(), set_using_pio(), ide_hwif_restore() and ide_set_pio() as a direct users of ->tuneproc. * Remove no longer needed ide_get_best_pio_mode() calls and printk-s reporting PIO mode selected from ->tuneproc implementations. * Rename ->tuneproc hook to ->set_pio_mode and make 'pio' argument const. * Remove stale comment from ide_config_drive_speed(). v2: * Fix "ata_" prefix (Noticed by Jeff). v3: * Minor cleanups/fixups per Sergei's suggestions. v4: * Fix compile problem in drivers/ide/pci/cmd640.c (Noticed by Andrew Morton). * Improve some ->set_pio_mode comments. Reviewed-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/pci/via82cxxx.c')
-rw-r--r--drivers/ide/pci/via82cxxx.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index e3bf90736332..2fc4f8835f19 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -195,19 +195,16 @@ static int via_set_drive(ide_drive_t *drive, const u8 speed)
195} 195}
196 196
197/** 197/**
198 * via82cxxx_tune_drive - PIO setup 198 * via_set_pio_mode - PIO setup
199 * @drive: drive to set up 199 * @drive: drive
200 * @pio: mode to use (255 for 'best possible') 200 * @pio: PIO mode number
201 * 201 *
202 * A callback from the upper layers for PIO-only tuning. 202 * A callback from the upper layers for PIO-only tuning.
203 */ 203 */
204 204
205static void via82cxxx_tune_drive(ide_drive_t *drive, u8 pio) 205static void via_set_pio_mode(ide_drive_t *drive, const u8 pio)
206{ 206{
207 if (pio == 255) 207 via_set_drive(drive, XFER_PIO_0 + pio);
208 pio = ide_get_best_pio_mode(drive, 255, 5);
209
210 via_set_drive(drive, XFER_PIO_0 + min_t(u8, pio, 5));
211} 208}
212 209
213/** 210/**
@@ -223,7 +220,7 @@ static int via82cxxx_ide_dma_check (ide_drive_t *drive)
223 u8 speed = ide_max_dma_mode(drive); 220 u8 speed = ide_max_dma_mode(drive);
224 221
225 if (speed == 0) { 222 if (speed == 0) {
226 via82cxxx_tune_drive(drive, 255); 223 ide_set_max_pio(drive);
227 return -1; 224 return -1;
228 } 225 }
229 226
@@ -465,7 +462,7 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif)
465 462
466 hwif->autodma = 0; 463 hwif->autodma = 0;
467 464
468 hwif->tuneproc = &via82cxxx_tune_drive; 465 hwif->set_pio_mode = &via_set_pio_mode;
469 hwif->speedproc = &via_set_drive; 466 hwif->speedproc = &via_set_drive;
470 467
471 468