diff options
-rw-r--r-- | drivers/ide/ns87415.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/ide/ns87415.c b/drivers/ide/ns87415.c index 9ad71a74f93f..6e0f372d2f09 100644 --- a/drivers/ide/ns87415.c +++ b/drivers/ide/ns87415.c | |||
@@ -196,6 +196,12 @@ static void ns87415_selectproc (ide_drive_t *drive) | |||
196 | !!(drive->dev_flags & IDE_DFLAG_USING_DMA)); | 196 | !!(drive->dev_flags & IDE_DFLAG_USING_DMA)); |
197 | } | 197 | } |
198 | 198 | ||
199 | static void ns87415_dma_start(ide_drive_t *drive) | ||
200 | { | ||
201 | ns87415_prepare_drive(drive, 1); | ||
202 | ide_dma_start(drive); | ||
203 | } | ||
204 | |||
199 | static int ns87415_dma_end(ide_drive_t *drive) | 205 | static int ns87415_dma_end(ide_drive_t *drive) |
200 | { | 206 | { |
201 | ide_hwif_t *hwif = drive->hwif; | 207 | ide_hwif_t *hwif = drive->hwif; |
@@ -210,19 +216,11 @@ static int ns87415_dma_end(ide_drive_t *drive) | |||
210 | /* from ERRATA: clear the INTR & ERROR bits */ | 216 | /* from ERRATA: clear the INTR & ERROR bits */ |
211 | dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD); | 217 | dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD); |
212 | outb(dma_cmd | 6, hwif->dma_base + ATA_DMA_CMD); | 218 | outb(dma_cmd | 6, hwif->dma_base + ATA_DMA_CMD); |
213 | /* verify good DMA status */ | ||
214 | return (dma_stat & 7) != 4; | ||
215 | } | ||
216 | 219 | ||
217 | static int ns87415_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) | ||
218 | { | ||
219 | /* select DMA xfer */ | ||
220 | ns87415_prepare_drive(drive, 1); | ||
221 | if (ide_dma_setup(drive, cmd) == 0) | ||
222 | return 0; | ||
223 | /* DMA failed: select PIO xfer */ | ||
224 | ns87415_prepare_drive(drive, 0); | 220 | ns87415_prepare_drive(drive, 0); |
225 | return 1; | 221 | |
222 | /* verify good DMA status */ | ||
223 | return (dma_stat & 7) != 4; | ||
226 | } | 224 | } |
227 | 225 | ||
228 | static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) | 226 | static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) |
@@ -298,8 +296,8 @@ static const struct ide_port_ops ns87415_port_ops = { | |||
298 | 296 | ||
299 | static const struct ide_dma_ops ns87415_dma_ops = { | 297 | static const struct ide_dma_ops ns87415_dma_ops = { |
300 | .dma_host_set = ide_dma_host_set, | 298 | .dma_host_set = ide_dma_host_set, |
301 | .dma_setup = ns87415_dma_setup, | 299 | .dma_setup = ide_dma_setup, |
302 | .dma_start = ide_dma_start, | 300 | .dma_start = ns87415_dma_start, |
303 | .dma_end = ns87415_dma_end, | 301 | .dma_end = ns87415_dma_end, |
304 | .dma_test_irq = ide_dma_test_irq, | 302 | .dma_test_irq = ide_dma_test_irq, |
305 | .dma_lost_irq = ide_dma_lost_irq, | 303 | .dma_lost_irq = ide_dma_lost_irq, |