diff options
Diffstat (limited to 'drivers/ide/pci/via82cxxx.c')
-rw-r--r-- | drivers/ide/pci/via82cxxx.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index c10203a32159..378feb491ec4 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * Version 3.47 | 3 | * Version 3.48 |
4 | * | 4 | * |
5 | * VIA IDE driver for Linux. Supported southbridges: | 5 | * VIA IDE driver for Linux. Supported southbridges: |
6 | * | 6 | * |
@@ -158,7 +158,7 @@ static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing) | |||
158 | * by upper layers. | 158 | * by upper layers. |
159 | */ | 159 | */ |
160 | 160 | ||
161 | static int via_set_drive(ide_drive_t *drive, u8 speed) | 161 | static int via_set_drive(ide_drive_t *drive, const u8 speed) |
162 | { | 162 | { |
163 | ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1); | 163 | ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1); |
164 | struct via82cxxx_dev *vdev = pci_get_drvdata(drive->hwif->pci_dev); | 164 | struct via82cxxx_dev *vdev = pci_get_drvdata(drive->hwif->pci_dev); |
@@ -195,19 +195,16 @@ static int via_set_drive(ide_drive_t *drive, u8 speed) | |||
195 | } | 195 | } |
196 | 196 | ||
197 | /** | 197 | /** |
198 | * via82cxxx_tune_drive - PIO setup | 198 | * via_set_pio_mode - PIO setup |
199 | * @drive: drive to set up | 199 | * @drive: drive |
200 | * @pio: mode to use (255 for 'best possible') | 200 | * @pio: PIO mode number |
201 | * | 201 | * |
202 | * A callback from the upper layers for PIO-only tuning. | 202 | * A callback from the upper layers for PIO-only tuning. |
203 | */ | 203 | */ |
204 | 204 | ||
205 | static void via82cxxx_tune_drive(ide_drive_t *drive, u8 pio) | 205 | static void via_set_pio_mode(ide_drive_t *drive, const u8 pio) |
206 | { | 206 | { |
207 | if (pio == 255) | 207 | via_set_drive(drive, XFER_PIO_0 + pio); |
208 | pio = ide_get_best_pio_mode(drive, 255, 5); | ||
209 | |||
210 | via_set_drive(drive, XFER_PIO_0 + min_t(u8, pio, 5)); | ||
211 | } | 208 | } |
212 | 209 | ||
213 | /** | 210 | /** |
@@ -220,18 +217,11 @@ static void via82cxxx_tune_drive(ide_drive_t *drive, u8 pio) | |||
220 | 217 | ||
221 | static int via82cxxx_ide_dma_check (ide_drive_t *drive) | 218 | static int via82cxxx_ide_dma_check (ide_drive_t *drive) |
222 | { | 219 | { |
223 | u8 speed = ide_max_dma_mode(drive); | 220 | if (ide_tune_dma(drive)) |
224 | |||
225 | if (speed == 0) { | ||
226 | via82cxxx_tune_drive(drive, 255); | ||
227 | return -1; | ||
228 | } | ||
229 | |||
230 | via_set_drive(drive, speed); | ||
231 | |||
232 | if (drive->autodma) | ||
233 | return 0; | 221 | return 0; |
234 | 222 | ||
223 | ide_set_max_pio(drive); | ||
224 | |||
235 | return -1; | 225 | return -1; |
236 | } | 226 | } |
237 | 227 | ||
@@ -465,7 +455,7 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) | |||
465 | 455 | ||
466 | hwif->autodma = 0; | 456 | hwif->autodma = 0; |
467 | 457 | ||
468 | hwif->tuneproc = &via82cxxx_tune_drive; | 458 | hwif->set_pio_mode = &via_set_pio_mode; |
469 | hwif->speedproc = &via_set_drive; | 459 | hwif->speedproc = &via_set_drive; |
470 | 460 | ||
471 | 461 | ||