diff options
Diffstat (limited to 'drivers/ide/pci/atiixp.c')
-rw-r--r-- | drivers/ide/pci/atiixp.c | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c index 982ac31fa995..2d48af32e3f4 100644 --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c | |||
@@ -101,7 +101,7 @@ static u8 atiixp_dma_2_pio(u8 xfer_rate) { | |||
101 | } | 101 | } |
102 | } | 102 | } |
103 | 103 | ||
104 | static int atiixp_ide_dma_host_on(ide_drive_t *drive) | 104 | static void atiixp_dma_host_on(ide_drive_t *drive) |
105 | { | 105 | { |
106 | struct pci_dev *dev = drive->hwif->pci_dev; | 106 | struct pci_dev *dev = drive->hwif->pci_dev; |
107 | unsigned long flags; | 107 | unsigned long flags; |
@@ -118,10 +118,10 @@ static int atiixp_ide_dma_host_on(ide_drive_t *drive) | |||
118 | 118 | ||
119 | spin_unlock_irqrestore(&atiixp_lock, flags); | 119 | spin_unlock_irqrestore(&atiixp_lock, flags); |
120 | 120 | ||
121 | return __ide_dma_host_on(drive); | 121 | ide_dma_host_on(drive); |
122 | } | 122 | } |
123 | 123 | ||
124 | static int atiixp_ide_dma_host_off(ide_drive_t *drive) | 124 | static void atiixp_dma_host_off(ide_drive_t *drive) |
125 | { | 125 | { |
126 | struct pci_dev *dev = drive->hwif->pci_dev; | 126 | struct pci_dev *dev = drive->hwif->pci_dev; |
127 | unsigned long flags; | 127 | unsigned long flags; |
@@ -135,7 +135,7 @@ static int atiixp_ide_dma_host_off(ide_drive_t *drive) | |||
135 | 135 | ||
136 | spin_unlock_irqrestore(&atiixp_lock, flags); | 136 | spin_unlock_irqrestore(&atiixp_lock, flags); |
137 | 137 | ||
138 | return __ide_dma_host_off(drive); | 138 | ide_dma_host_off(drive); |
139 | } | 139 | } |
140 | 140 | ||
141 | /** | 141 | /** |
@@ -235,11 +235,8 @@ static int atiixp_config_drive_for_dma(ide_drive_t *drive) | |||
235 | { | 235 | { |
236 | u8 speed = ide_dma_speed(drive, atiixp_ratemask(drive)); | 236 | u8 speed = ide_dma_speed(drive, atiixp_ratemask(drive)); |
237 | 237 | ||
238 | /* If no DMA speed was available then disable DMA and use PIO. */ | 238 | if (!speed) |
239 | if (!speed) { | 239 | return 0; |
240 | u8 tspeed = ide_get_best_pio_mode(drive, 255, 5, NULL); | ||
241 | speed = atiixp_dma_2_pio(XFER_PIO_0 + tspeed) + XFER_PIO_0; | ||
242 | } | ||
243 | 240 | ||
244 | (void) atiixp_speedproc(drive, speed); | 241 | (void) atiixp_speedproc(drive, speed); |
245 | return ide_dma_enable(drive); | 242 | return ide_dma_enable(drive); |
@@ -255,30 +252,20 @@ static int atiixp_config_drive_for_dma(ide_drive_t *drive) | |||
255 | 252 | ||
256 | static int atiixp_dma_check(ide_drive_t *drive) | 253 | static int atiixp_dma_check(ide_drive_t *drive) |
257 | { | 254 | { |
258 | ide_hwif_t *hwif = HWIF(drive); | ||
259 | struct hd_driveid *id = drive->id; | ||
260 | u8 tspeed, speed; | 255 | u8 tspeed, speed; |
261 | 256 | ||
262 | drive->init_speed = 0; | 257 | drive->init_speed = 0; |
263 | 258 | ||
264 | if ((id->capability & 1) && drive->autodma) { | 259 | if (ide_use_dma(drive) && atiixp_config_drive_for_dma(drive)) |
265 | 260 | return 0; | |
266 | if (ide_use_dma(drive)) { | ||
267 | if (atiixp_config_drive_for_dma(drive)) | ||
268 | return hwif->ide_dma_on(drive); | ||
269 | } | ||
270 | |||
271 | goto fast_ata_pio; | ||
272 | 261 | ||
273 | } else if ((id->capability & 8) || (id->field_valid & 2)) { | 262 | if (ide_use_fast_pio(drive)) { |
274 | fast_ata_pio: | ||
275 | tspeed = ide_get_best_pio_mode(drive, 255, 5, NULL); | 263 | tspeed = ide_get_best_pio_mode(drive, 255, 5, NULL); |
276 | speed = atiixp_dma_2_pio(XFER_PIO_0 + tspeed) + XFER_PIO_0; | 264 | speed = atiixp_dma_2_pio(XFER_PIO_0 + tspeed) + XFER_PIO_0; |
277 | hwif->speedproc(drive, speed); | 265 | atiixp_speedproc(drive, speed); |
278 | return hwif->ide_dma_off_quietly(drive); | ||
279 | } | 266 | } |
280 | /* IORDY not supported */ | 267 | |
281 | return 0; | 268 | return -1; |
282 | } | 269 | } |
283 | 270 | ||
284 | /** | 271 | /** |
@@ -318,8 +305,8 @@ static void __devinit init_hwif_atiixp(ide_hwif_t *hwif) | |||
318 | else | 305 | else |
319 | hwif->udma_four = 0; | 306 | hwif->udma_four = 0; |
320 | 307 | ||
321 | hwif->ide_dma_host_on = &atiixp_ide_dma_host_on; | 308 | hwif->dma_host_on = &atiixp_dma_host_on; |
322 | hwif->ide_dma_host_off = &atiixp_ide_dma_host_off; | 309 | hwif->dma_host_off = &atiixp_dma_host_off; |
323 | hwif->ide_dma_check = &atiixp_dma_check; | 310 | hwif->ide_dma_check = &atiixp_dma_check; |
324 | if (!noautodma) | 311 | if (!noautodma) |
325 | hwif->autodma = 1; | 312 | hwif->autodma = 1; |