diff options
Diffstat (limited to 'drivers/ide/pci/alim15x3.c')
-rw-r--r-- | drivers/ide/pci/alim15x3.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 37ecd726aa40..005402ab748b 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c | |||
@@ -283,17 +283,14 @@ static int ali_get_info (char *buffer, char **addr, off_t offset, int count) | |||
283 | #endif /* defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_IDE_PROC_FS) */ | 283 | #endif /* defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_IDE_PROC_FS) */ |
284 | 284 | ||
285 | /** | 285 | /** |
286 | * ali15x3_tune_pio - set up chipset for PIO mode | 286 | * ali_tune_pio - set host controller for PIO mode |
287 | * @drive: drive to tune | 287 | * @drive: drive |
288 | * @pio: desired mode | 288 | * @pio: PIO mode number |
289 | * | ||
290 | * Select the best PIO mode for the drive in question. | ||
291 | * Then program the controller for this mode. | ||
292 | * | 289 | * |
293 | * Returns the PIO mode programmed. | 290 | * Program the controller for the given PIO mode. |
294 | */ | 291 | */ |
295 | 292 | ||
296 | static u8 ali15x3_tune_pio (ide_drive_t *drive, u8 pio) | 293 | static void ali_tune_pio(ide_drive_t *drive, const u8 pio) |
297 | { | 294 | { |
298 | ide_hwif_t *hwif = HWIF(drive); | 295 | ide_hwif_t *hwif = HWIF(drive); |
299 | struct pci_dev *dev = hwif->pci_dev; | 296 | struct pci_dev *dev = hwif->pci_dev; |
@@ -306,7 +303,6 @@ static u8 ali15x3_tune_pio (ide_drive_t *drive, u8 pio) | |||
306 | u8 cd_dma_fifo = 0; | 303 | u8 cd_dma_fifo = 0; |
307 | int unit = drive->select.b.unit & 1; | 304 | int unit = drive->select.b.unit & 1; |
308 | 305 | ||
309 | pio = ide_get_best_pio_mode(drive, pio, 5); | ||
310 | s_time = ide_pio_timings[pio].setup_time; | 306 | s_time = ide_pio_timings[pio].setup_time; |
311 | a_time = ide_pio_timings[pio].active_time; | 307 | a_time = ide_pio_timings[pio].active_time; |
312 | if ((s_clc = (s_time * bus_speed + 999) / 1000) >= 8) | 308 | if ((s_clc = (s_time * bus_speed + 999) / 1000) >= 8) |
@@ -359,22 +355,20 @@ static u8 ali15x3_tune_pio (ide_drive_t *drive, u8 pio) | |||
359 | * { 25, 70, 25 }, PIO Mode 4 with IORDY ns | 355 | * { 25, 70, 25 }, PIO Mode 4 with IORDY ns |
360 | * { 20, 50, 30 } PIO Mode 5 with IORDY (nonstandard) | 356 | * { 20, 50, 30 } PIO Mode 5 with IORDY (nonstandard) |
361 | */ | 357 | */ |
362 | |||
363 | return pio; | ||
364 | } | 358 | } |
365 | 359 | ||
366 | /** | 360 | /** |
367 | * ali15x3_tune_drive - set up drive for PIO mode | 361 | * ali_set_pio_mode - set up drive for PIO mode |
368 | * @drive: drive to tune | 362 | * @drive: drive to tune |
369 | * @pio: desired mode | 363 | * @pio: desired mode |
370 | * | 364 | * |
371 | * Program the controller with the best PIO timing for the given drive. | 365 | * Program the controller with the desired PIO timing for the given drive. |
372 | * Then set up the drive itself. | 366 | * Then set up the drive itself. |
373 | */ | 367 | */ |
374 | 368 | ||
375 | static void ali15x3_tune_drive (ide_drive_t *drive, u8 pio) | 369 | static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio) |
376 | { | 370 | { |
377 | pio = ali15x3_tune_pio(drive, pio); | 371 | ali_tune_pio(drive, pio); |
378 | (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); | 372 | (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); |
379 | } | 373 | } |
380 | 374 | ||
@@ -437,7 +431,7 @@ static int ali15x3_tune_chipset(ide_drive_t *drive, const u8 speed) | |||
437 | pci_write_config_byte(dev, m5229_udma, tmpbyte); | 431 | pci_write_config_byte(dev, m5229_udma, tmpbyte); |
438 | 432 | ||
439 | if (speed < XFER_SW_DMA_0) | 433 | if (speed < XFER_SW_DMA_0) |
440 | (void) ali15x3_tune_pio(drive, speed - XFER_PIO_0); | 434 | ali_tune_pio(drive, speed - XFER_PIO_0); |
441 | } else { | 435 | } else { |
442 | pci_read_config_byte(dev, m5229_udma, &tmpbyte); | 436 | pci_read_config_byte(dev, m5229_udma, &tmpbyte); |
443 | tmpbyte &= (0x0f << ((1-unit) << 2)); | 437 | tmpbyte &= (0x0f << ((1-unit) << 2)); |
@@ -470,7 +464,7 @@ static int ali15x3_config_drive_for_dma(ide_drive_t *drive) | |||
470 | if (ide_tune_dma(drive)) | 464 | if (ide_tune_dma(drive)) |
471 | return 0; | 465 | return 0; |
472 | 466 | ||
473 | ali15x3_tune_drive(drive, 255); | 467 | ide_set_max_pio(drive); |
474 | 468 | ||
475 | return -1; | 469 | return -1; |
476 | } | 470 | } |
@@ -700,7 +694,7 @@ static u8 __devinit ata66_ali15x3(ide_hwif_t *hwif) | |||
700 | static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif) | 694 | static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif) |
701 | { | 695 | { |
702 | hwif->autodma = 0; | 696 | hwif->autodma = 0; |
703 | hwif->tuneproc = &ali15x3_tune_drive; | 697 | hwif->set_pio_mode = &ali_set_pio_mode; |
704 | hwif->speedproc = &ali15x3_tune_chipset; | 698 | hwif->speedproc = &ali15x3_tune_chipset; |
705 | hwif->udma_filter = &ali_udma_filter; | 699 | hwif->udma_filter = &ali_udma_filter; |
706 | 700 | ||