diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-07-19 19:11:54 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-07-19 19:11:54 -0400 |
commit | 485efc6cf507eae2b8e83b56e179c8fa3980641a (patch) | |
tree | 8295657535efaa740b38ac1e29fbbff7c3c177be /drivers | |
parent | 9702b5d5c26be12d376e1baf2a8e5b82e6c06b66 (diff) |
atiixp: PIO mode setup fixes
* Split off exisiting atiixp_tuneproc() into atiixp_tune_pio()
and then add setting device PIO mode to atiixp_tuneproc().
* Add missing ide_get_best_pio_mode() call to atiixp_tuneproc() so
"pio" == 255 (autotune) is handled correctly and "pio" values > 4 && < 255
are filtered to PIO4 (previously "pio" == 5 could result in wrong timings
being used and "pio" values > 4 && < 255 in an OOPS).
* Handle PIO modes early in atiixp_speedproc() so save_mdma_mode[]
doesn't get cleared.
* In atiixp_dma_check():
- fix max_mode argument for ide_get_best_pio_mode()
- don't call atiixp_dma_2_pio() so PIO1 doesn't get remapped to PIO0
- use atiixp_tuneproc() instead of atiixp_speedproc()
* Bump driver version.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ide/pci/atiixp.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c index 2761510309b3..bfdf086f4525 100644 --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c | |||
@@ -1,9 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/atiixp.c Version 0.01-bart2 Feb. 26, 2004 | 2 | * linux/drivers/ide/pci/atiixp.c Version 0.02 Jun 16 2007 |
3 | * | 3 | * |
4 | * Copyright (C) 2003 ATI Inc. <hyu@ati.com> | 4 | * Copyright (C) 2003 ATI Inc. <hyu@ati.com> |
5 | * Copyright (C) 2004 Bartlomiej Zolnierkiewicz | 5 | * Copyright (C) 2004,2007 Bartlomiej Zolnierkiewicz |
6 | * | ||
7 | */ | 6 | */ |
8 | 7 | ||
9 | #include <linux/types.h> | 8 | #include <linux/types.h> |
@@ -123,14 +122,14 @@ static void atiixp_dma_host_off(ide_drive_t *drive) | |||
123 | } | 122 | } |
124 | 123 | ||
125 | /** | 124 | /** |
126 | * atiixp_tune_drive - tune a drive attached to a ATIIXP | 125 | * atiixp_tune_pio - tune a drive attached to a ATIIXP |
127 | * @drive: drive to tune | 126 | * @drive: drive to tune |
128 | * @pio: desired PIO mode | 127 | * @pio: desired PIO mode |
129 | * | 128 | * |
130 | * Set the interface PIO mode. | 129 | * Set the interface PIO mode. |
131 | */ | 130 | */ |
132 | 131 | ||
133 | static void atiixp_tuneproc(ide_drive_t *drive, u8 pio) | 132 | static void atiixp_tune_pio(ide_drive_t *drive, u8 pio) |
134 | { | 133 | { |
135 | struct pci_dev *dev = drive->hwif->pci_dev; | 134 | struct pci_dev *dev = drive->hwif->pci_dev; |
136 | unsigned long flags; | 135 | unsigned long flags; |
@@ -154,6 +153,13 @@ static void atiixp_tuneproc(ide_drive_t *drive, u8 pio) | |||
154 | spin_unlock_irqrestore(&atiixp_lock, flags); | 153 | spin_unlock_irqrestore(&atiixp_lock, flags); |
155 | } | 154 | } |
156 | 155 | ||
156 | static void atiixp_tuneproc(ide_drive_t *drive, u8 pio) | ||
157 | { | ||
158 | pio = ide_get_best_pio_mode(drive, pio, 4, NULL); | ||
159 | atiixp_tune_pio(drive, pio); | ||
160 | (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); | ||
161 | } | ||
162 | |||
157 | /** | 163 | /** |
158 | * atiixp_tune_chipset - tune a ATIIXP interface | 164 | * atiixp_tune_chipset - tune a ATIIXP interface |
159 | * @drive: IDE drive to tune | 165 | * @drive: IDE drive to tune |
@@ -175,6 +181,11 @@ static int atiixp_speedproc(ide_drive_t *drive, u8 xferspeed) | |||
175 | 181 | ||
176 | speed = ide_rate_filter(drive, xferspeed); | 182 | speed = ide_rate_filter(drive, xferspeed); |
177 | 183 | ||
184 | if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) { | ||
185 | atiixp_tune_pio(drive, speed - XFER_PIO_0); | ||
186 | return ide_config_drive_speed(drive, speed); | ||
187 | } | ||
188 | |||
178 | spin_lock_irqsave(&atiixp_lock, flags); | 189 | spin_lock_irqsave(&atiixp_lock, flags); |
179 | 190 | ||
180 | save_mdma_mode[drive->dn] = 0; | 191 | save_mdma_mode[drive->dn] = 0; |
@@ -201,7 +212,7 @@ static int atiixp_speedproc(ide_drive_t *drive, u8 xferspeed) | |||
201 | else | 212 | else |
202 | pio = speed - XFER_PIO_0; | 213 | pio = speed - XFER_PIO_0; |
203 | 214 | ||
204 | atiixp_tuneproc(drive, pio); | 215 | atiixp_tune_pio(drive, pio); |
205 | 216 | ||
206 | return ide_config_drive_speed(drive, speed); | 217 | return ide_config_drive_speed(drive, speed); |
207 | } | 218 | } |
@@ -216,18 +227,13 @@ static int atiixp_speedproc(ide_drive_t *drive, u8 xferspeed) | |||
216 | 227 | ||
217 | static int atiixp_dma_check(ide_drive_t *drive) | 228 | static int atiixp_dma_check(ide_drive_t *drive) |
218 | { | 229 | { |
219 | u8 tspeed, speed; | ||
220 | |||
221 | drive->init_speed = 0; | 230 | drive->init_speed = 0; |
222 | 231 | ||
223 | if (ide_tune_dma(drive)) | 232 | if (ide_tune_dma(drive)) |
224 | return 0; | 233 | return 0; |
225 | 234 | ||
226 | if (ide_use_fast_pio(drive)) { | 235 | if (ide_use_fast_pio(drive)) |
227 | tspeed = ide_get_best_pio_mode(drive, 255, 5, NULL); | 236 | atiixp_tuneproc(drive, 255); |
228 | speed = atiixp_dma_2_pio(XFER_PIO_0 + tspeed) + XFER_PIO_0; | ||
229 | atiixp_speedproc(drive, speed); | ||
230 | } | ||
231 | 237 | ||
232 | return -1; | 238 | return -1; |
233 | } | 239 | } |