aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-dma-sff.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-dma-sff.c')
-rw-r--r--drivers/ide/ide-dma-sff.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/ide/ide-dma-sff.c b/drivers/ide/ide-dma-sff.c
index 623a82d1535d..bcdadc777564 100644
--- a/drivers/ide/ide-dma-sff.c
+++ b/drivers/ide/ide-dma-sff.c
@@ -50,6 +50,17 @@ int config_drive_for_dma(ide_drive_t *drive)
50 return 0; 50 return 0;
51} 51}
52 52
53u8 ide_dma_sff_read_status(ide_hwif_t *hwif)
54{
55 unsigned long addr = hwif->dma_base + ATA_DMA_STATUS;
56
57 if (hwif->host_flags & IDE_HFLAG_MMIO)
58 return readb((void __iomem *)addr);
59 else
60 return inb(addr);
61}
62EXPORT_SYMBOL_GPL(ide_dma_sff_read_status);
63
53/** 64/**
54 * ide_dma_host_set - Enable/disable DMA on a host 65 * ide_dma_host_set - Enable/disable DMA on a host
55 * @drive: drive to control 66 * @drive: drive to control
@@ -62,7 +73,7 @@ void ide_dma_host_set(ide_drive_t *drive, int on)
62{ 73{
63 ide_hwif_t *hwif = drive->hwif; 74 ide_hwif_t *hwif = drive->hwif;
64 u8 unit = drive->dn & 1; 75 u8 unit = drive->dn & 1;
65 u8 dma_stat = hwif->tp_ops->read_sff_dma_status(hwif); 76 u8 dma_stat = hwif->dma_ops->dma_sff_read_status(hwif);
66 77
67 if (on) 78 if (on)
68 dma_stat |= (1 << (5 + unit)); 79 dma_stat |= (1 << (5 + unit));
@@ -200,7 +211,7 @@ int ide_dma_setup(ide_drive_t *drive)
200 outb(reading, hwif->dma_base + ATA_DMA_CMD); 211 outb(reading, hwif->dma_base + ATA_DMA_CMD);
201 212
202 /* read DMA status for INTR & ERROR flags */ 213 /* read DMA status for INTR & ERROR flags */
203 dma_stat = hwif->tp_ops->read_sff_dma_status(hwif); 214 dma_stat = hwif->dma_ops->dma_sff_read_status(hwif);
204 215
205 /* clear INTR & ERROR flags */ 216 /* clear INTR & ERROR flags */
206 if (mmio) 217 if (mmio)
@@ -232,7 +243,7 @@ EXPORT_SYMBOL_GPL(ide_dma_setup);
232static int dma_timer_expiry(ide_drive_t *drive) 243static int dma_timer_expiry(ide_drive_t *drive)
233{ 244{
234 ide_hwif_t *hwif = drive->hwif; 245 ide_hwif_t *hwif = drive->hwif;
235 u8 dma_stat = hwif->tp_ops->read_sff_dma_status(hwif); 246 u8 dma_stat = hwif->dma_ops->dma_sff_read_status(hwif);
236 247
237 printk(KERN_WARNING "%s: %s: DMA status (0x%02x)\n", 248 printk(KERN_WARNING "%s: %s: DMA status (0x%02x)\n",
238 drive->name, __func__, dma_stat); 249 drive->name, __func__, dma_stat);
@@ -305,7 +316,7 @@ int ide_dma_end(ide_drive_t *drive)
305 } 316 }
306 317
307 /* get DMA status */ 318 /* get DMA status */
308 dma_stat = hwif->tp_ops->read_sff_dma_status(hwif); 319 dma_stat = hwif->dma_ops->dma_sff_read_status(hwif);
309 320
310 if (mmio) 321 if (mmio)
311 /* clear the INTR & ERROR bits */ 322 /* clear the INTR & ERROR bits */
@@ -331,7 +342,7 @@ EXPORT_SYMBOL_GPL(ide_dma_end);
331int ide_dma_test_irq(ide_drive_t *drive) 342int ide_dma_test_irq(ide_drive_t *drive)
332{ 343{
333 ide_hwif_t *hwif = drive->hwif; 344 ide_hwif_t *hwif = drive->hwif;
334 u8 dma_stat = hwif->tp_ops->read_sff_dma_status(hwif); 345 u8 dma_stat = hwif->dma_ops->dma_sff_read_status(hwif);
335 346
336 return (dma_stat & ATA_DMA_INTR) ? 1 : 0; 347 return (dma_stat & ATA_DMA_INTR) ? 1 : 0;
337} 348}
@@ -346,5 +357,6 @@ const struct ide_dma_ops sff_dma_ops = {
346 .dma_test_irq = ide_dma_test_irq, 357 .dma_test_irq = ide_dma_test_irq,
347 .dma_timeout = ide_dma_timeout, 358 .dma_timeout = ide_dma_timeout,
348 .dma_lost_irq = ide_dma_lost_irq, 359 .dma_lost_irq = ide_dma_lost_irq,
360 .dma_sff_read_status = ide_dma_sff_read_status,
349}; 361};
350EXPORT_SYMBOL_GPL(sff_dma_ops); 362EXPORT_SYMBOL_GPL(sff_dma_ops);