Commit 21b82477 authored by Sergei Shtylyov's avatar Sergei Shtylyov Committed by Bartlomiej Zolnierkiewicz

alim15x3: fix PIO mode setup

The driver's tuneproc() method fails to set the drive's own speed -- fix this
by renaming the function to ali15x3_tune_pio() and "wrapping" the new tuneproc()
method around it and making it return the mode set, update the heading comment.

Also, setting PIO mode via the speedproc() method does not work due to passing 
to the tuneproc() method's a mode number not biased by XFER_PIO_0 -- fix this
along with a typo in the heading comment...
Signed-off-by: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent bb648a0d
/* /*
* linux/drivers/ide/pci/alim15x3.c Version 0.17 2003/01/02 * linux/drivers/ide/pci/alim15x3.c Version 0.21 2007/02/03
* *
* Copyright (C) 1998-2000 Michel Aubry, Maintainer * Copyright (C) 1998-2000 Michel Aubry, Maintainer
* Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* May be copied or modified under the terms of the GNU General Public License * May be copied or modified under the terms of the GNU General Public License
* Copyright (C) 2002 Alan Cox <alan@redhat.com> * Copyright (C) 2002 Alan Cox <alan@redhat.com>
* ALi (now ULi M5228) support by Clear Zhang <Clear.Zhang@ali.com.tw> * ALi (now ULi M5228) support by Clear Zhang <Clear.Zhang@ali.com.tw>
* Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com>
* *
* (U)DMA capable version of ali 1533/1543(C), 1535(D) * (U)DMA capable version of ali 1533/1543(C), 1535(D)
* *
...@@ -280,15 +281,17 @@ static int ali_get_info (char *buffer, char **addr, off_t offset, int count) ...@@ -280,15 +281,17 @@ static int ali_get_info (char *buffer, char **addr, off_t offset, int count)
#endif /* defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_PROC_FS) */ #endif /* defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_PROC_FS) */
/** /**
* ali15x3_tune_drive - set up a drive * ali15x3_tune_pio - set up chipset for PIO mode
* @drive: drive to tune * @drive: drive to tune
* @pio: unused * @pio: desired mode
* *
* Select the best PIO timing for the drive in question. Then * Select the best PIO mode for the drive in question.
* program the controller for this drive set up * Then program the controller for this mode.
*
* Returns the PIO mode programmed.
*/ */
static void ali15x3_tune_drive (ide_drive_t *drive, u8 pio) static u8 ali15x3_tune_pio (ide_drive_t *drive, u8 pio)
{ {
ide_pio_data_t d; ide_pio_data_t d;
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
...@@ -356,6 +359,22 @@ static void ali15x3_tune_drive (ide_drive_t *drive, u8 pio) ...@@ -356,6 +359,22 @@ static void ali15x3_tune_drive (ide_drive_t *drive, u8 pio)
* { 20, 50, 30 } PIO Mode 5 with IORDY (nonstandard) * { 20, 50, 30 } PIO Mode 5 with IORDY (nonstandard)
*/ */
return pio;
}
/**
* ali15x3_tune_drive - set up drive for PIO mode
* @drive: drive to tune
* @pio: desired mode
*
* Program the controller with the best PIO timing for the given drive.
* Then set up the drive itself.
*/
static void ali15x3_tune_drive (ide_drive_t *drive, u8 pio)
{
pio = ali15x3_tune_pio(drive, pio);
(void) ide_config_drive_speed(drive, XFER_PIO_0 + pio);
} }
/** /**
...@@ -430,7 +449,7 @@ static u8 ali15x3_ratemask (ide_drive_t *drive) ...@@ -430,7 +449,7 @@ static u8 ali15x3_ratemask (ide_drive_t *drive)
} }
/** /**
* ali15x3_tune_chipset - set up chiset for new speed * ali15x3_tune_chipset - set up chipset/drive for new speed
* @drive: drive to configure for * @drive: drive to configure for
* @xferspeed: desired speed * @xferspeed: desired speed
* *
...@@ -461,7 +480,7 @@ static int ali15x3_tune_chipset (ide_drive_t *drive, u8 xferspeed) ...@@ -461,7 +480,7 @@ static int ali15x3_tune_chipset (ide_drive_t *drive, u8 xferspeed)
pci_write_config_byte(dev, m5229_udma, tmpbyte); pci_write_config_byte(dev, m5229_udma, tmpbyte);
if (speed < XFER_SW_DMA_0) if (speed < XFER_SW_DMA_0)
ali15x3_tune_drive(drive, speed); (void) ali15x3_tune_pio(drive, speed - XFER_PIO_0);
} else { } else {
pci_read_config_byte(dev, m5229_udma, &tmpbyte); pci_read_config_byte(dev, m5229_udma, &tmpbyte);
tmpbyte &= (0x0f << ((1-unit) << 2)); tmpbyte &= (0x0f << ((1-unit) << 2));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment