aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/it821x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pci/it821x.c')
-rw-r--r--drivers/ide/pci/it821x.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c
index 9286c99e2ff0..758a98230cc5 100644
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -274,9 +274,8 @@ static int it821x_tunepio(ide_drive_t *drive, u8 set_pio)
274 return ide_config_drive_speed(drive, XFER_PIO_0 + set_pio); 274 return ide_config_drive_speed(drive, XFER_PIO_0 + set_pio);
275} 275}
276 276
277static void it821x_tuneproc(ide_drive_t *drive, u8 pio) 277static void it821x_set_pio_mode(ide_drive_t *drive, const u8 pio)
278{ 278{
279 pio = ide_get_best_pio_mode(drive, pio, 4);
280 (void)it821x_tunepio(drive, pio); 279 (void)it821x_tunepio(drive, pio);
281} 280}
282 281
@@ -405,32 +404,19 @@ static int it821x_dma_end(ide_drive_t *drive)
405 return ret; 404 return ret;
406} 405}
407 406
408
409/** 407/**
410 * it821x_tune_chipset - set controller timings 408 * it821x_tune_chipset - set controller timings
411 * @drive: Drive to set up 409 * @drive: Drive to set up
412 * @xferspeed: speed we want to achieve 410 * @speed: speed we want to achieve
413 * 411 *
414 * Tune the ITE chipset for the desired mode. If we can't achieve 412 * Tune the ITE chipset for the desired mode.
415 * the desired mode then tune for a lower one, but ultimately
416 * make the thing work.
417 */ 413 */
418 414
419static int it821x_tune_chipset (ide_drive_t *drive, byte xferspeed) 415static int it821x_tune_chipset(ide_drive_t *drive, const u8 speed)
420{ 416{
421 417
422 ide_hwif_t *hwif = drive->hwif; 418 ide_hwif_t *hwif = drive->hwif;
423 struct it821x_dev *itdev = ide_get_hwifdata(hwif); 419 struct it821x_dev *itdev = ide_get_hwifdata(hwif);
424 u8 speed = ide_rate_filter(drive, xferspeed);
425
426 switch (speed) {
427 case XFER_PIO_4:
428 case XFER_PIO_3:
429 case XFER_PIO_2:
430 case XFER_PIO_1:
431 case XFER_PIO_0:
432 return it821x_tunepio(drive, speed - XFER_PIO_0);
433 }
434 420
435 if (itdev->smart == 0) { 421 if (itdev->smart == 0) {
436 switch (speed) { 422 switch (speed) {
@@ -477,7 +463,7 @@ static int it821x_config_drive_for_dma (ide_drive_t *drive)
477 if (ide_tune_dma(drive)) 463 if (ide_tune_dma(drive))
478 return 0; 464 return 0;
479 465
480 it821x_tuneproc(drive, 255); 466 ide_set_max_pio(drive);
481 467
482 return -1; 468 return -1;
483} 469}
@@ -644,7 +630,7 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
644 } 630 }
645 631
646 hwif->speedproc = &it821x_tune_chipset; 632 hwif->speedproc = &it821x_tune_chipset;
647 hwif->tuneproc = &it821x_tuneproc; 633 hwif->set_pio_mode = &it821x_set_pio_mode;
648 634
649 /* MWDMA/PIO clock switching for pass through mode */ 635 /* MWDMA/PIO clock switching for pass through mode */
650 if(!idev->smart) { 636 if(!idev->smart) {