aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ns87415.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-31 14:15:20 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-31 14:15:20 -0400
commita6d67ffa7dfe9515d8f2051a76b14c82b748475a (patch)
treee79ffe7fa609dce9d8ce27bf6c98aa970b5cca35 /drivers/ide/ns87415.c
parent5ae5412d9a23b05ab08461b202bad21ad8f6b66d (diff)
ns87415: use custom ->dma_{start,end} to handle ns87415_prepare_drive()
Use custom ->dma_{start,end} methods to handle ns87415_prepare_drive() there instead of in ->dma_setup method. Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ns87415.c')
-rw-r--r--drivers/ide/ns87415.c24
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
199static void ns87415_dma_start(ide_drive_t *drive)
200{
201 ns87415_prepare_drive(drive, 1);
202 ide_dma_start(drive);
203}
204
199static int ns87415_dma_end(ide_drive_t *drive) 205static 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
217static 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
228static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) 226static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
@@ -298,8 +296,8 @@ static const struct ide_port_ops ns87415_port_ops = {
298 296
299static const struct ide_dma_ops ns87415_dma_ops = { 297static 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,