aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/alim15x3.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pci/alim15x3.c')
-rw-r--r--drivers/ide/pci/alim15x3.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index 4debd18d52f8..83e0aa65a431 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/alim15x3.c Version 0.17 2003/01/02 2 * linux/drivers/ide/pci/alim15x3.c Version 0.21 2007/02/03
3 * 3 *
4 * Copyright (C) 1998-2000 Michel Aubry, Maintainer 4 * Copyright (C) 1998-2000 Michel Aubry, Maintainer
5 * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer 5 * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer
@@ -9,6 +9,7 @@
9 * May be copied or modified under the terms of the GNU General Public License 9 * May be copied or modified under the terms of the GNU General Public License
10 * Copyright (C) 2002 Alan Cox <alan@redhat.com> 10 * Copyright (C) 2002 Alan Cox <alan@redhat.com>
11 * ALi (now ULi M5228) support by Clear Zhang <Clear.Zhang@ali.com.tw> 11 * ALi (now ULi M5228) support by Clear Zhang <Clear.Zhang@ali.com.tw>
12 * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com>
12 * 13 *
13 * (U)DMA capable version of ali 1533/1543(C), 1535(D) 14 * (U)DMA capable version of ali 1533/1543(C), 1535(D)
14 * 15 *
@@ -280,15 +281,17 @@ static int ali_get_info (char *buffer, char **addr, off_t offset, int count)
280#endif /* defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_PROC_FS) */ 281#endif /* defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_PROC_FS) */
281 282
282/** 283/**
283 * ali15x3_tune_drive - set up a drive 284 * ali15x3_tune_pio - set up chipset for PIO mode
284 * @drive: drive to tune 285 * @drive: drive to tune
285 * @pio: unused 286 * @pio: desired mode
286 * 287 *
287 * Select the best PIO timing for the drive in question. Then 288 * Select the best PIO mode for the drive in question.
288 * program the controller for this drive set up 289 * Then program the controller for this mode.
290 *
291 * Returns the PIO mode programmed.
289 */ 292 */
290 293
291static void ali15x3_tune_drive (ide_drive_t *drive, u8 pio) 294static u8 ali15x3_tune_pio (ide_drive_t *drive, u8 pio)
292{ 295{
293 ide_pio_data_t d; 296 ide_pio_data_t d;
294 ide_hwif_t *hwif = HWIF(drive); 297 ide_hwif_t *hwif = HWIF(drive);
@@ -356,6 +359,22 @@ static void ali15x3_tune_drive (ide_drive_t *drive, u8 pio)
356 * { 20, 50, 30 } PIO Mode 5 with IORDY (nonstandard) 359 * { 20, 50, 30 } PIO Mode 5 with IORDY (nonstandard)
357 */ 360 */
358 361
362 return pio;
363}
364
365/**
366 * ali15x3_tune_drive - set up drive for PIO mode
367 * @drive: drive to tune
368 * @pio: desired mode
369 *
370 * Program the controller with the best PIO timing for the given drive.
371 * Then set up the drive itself.
372 */
373
374static void ali15x3_tune_drive (ide_drive_t *drive, u8 pio)
375{
376 pio = ali15x3_tune_pio(drive, pio);
377 (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio);
359} 378}
360 379
361/** 380/**
@@ -430,7 +449,7 @@ static u8 ali15x3_ratemask (ide_drive_t *drive)
430} 449}
431 450
432/** 451/**
433 * ali15x3_tune_chipset - set up chiset for new speed 452 * ali15x3_tune_chipset - set up chipset/drive for new speed
434 * @drive: drive to configure for 453 * @drive: drive to configure for
435 * @xferspeed: desired speed 454 * @xferspeed: desired speed
436 * 455 *
@@ -461,7 +480,7 @@ static int ali15x3_tune_chipset (ide_drive_t *drive, u8 xferspeed)
461 pci_write_config_byte(dev, m5229_udma, tmpbyte); 480 pci_write_config_byte(dev, m5229_udma, tmpbyte);
462 481
463 if (speed < XFER_SW_DMA_0) 482 if (speed < XFER_SW_DMA_0)
464 ali15x3_tune_drive(drive, speed); 483 (void) ali15x3_tune_pio(drive, speed - XFER_PIO_0);
465 } else { 484 } else {
466 pci_read_config_byte(dev, m5229_udma, &tmpbyte); 485 pci_read_config_byte(dev, m5229_udma, &tmpbyte);
467 tmpbyte &= (0x0f << ((1-unit) << 2)); 486 tmpbyte &= (0x0f << ((1-unit) << 2));