aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/scc_pata.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 07:46:46 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 07:46:46 -0400
commit2298169418f43ba5e0919762a4bab95a1227872a (patch)
tree67cf3133c7bae747ad957c68a650534105a7d8e7 /drivers/ide/scc_pata.c
parent130e886708d6e11f3d54e5d27c266578de56f343 (diff)
ide: pass command to ide_map_sg()
* Set IDE_TFLAG_WRITE flag and ->rq also for ATA_CMD_PACKET commands. * Pass command to ->dma_setup method and update all its implementations accordingly. * Pass command instead of request to ide_build_sglist(), *_build_dmatable() and ide_map_sg(). While at it: * Fix scc_dma_setup() documentation + use ATA_DMA_WR define. * Rename sgiioc4_build_dma_table() to sgiioc4_build_dmatable(), change return value type to 'int' and drop unused 'ddir' argument. * Do some minor cleanups in [tx4939]ide_dma_setup(). There should be no functional changes caused by this patch. Acked-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/scc_pata.c')
-rw-r--r--drivers/ide/scc_pata.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c
index ada866744622..1f2805ce9889 100644
--- a/drivers/ide/scc_pata.c
+++ b/drivers/ide/scc_pata.c
@@ -303,8 +303,9 @@ static void scc_dma_host_set(ide_drive_t *drive, int on)
303} 303}
304 304
305/** 305/**
306 * scc_ide_dma_setup - begin a DMA phase 306 * scc_dma_setup - begin a DMA phase
307 * @drive: target device 307 * @drive: target device
308 * @cmd: command
308 * 309 *
309 * Build an IDE DMA PRD (IDE speak for scatter gather table) 310 * Build an IDE DMA PRD (IDE speak for scatter gather table)
310 * and then set up the DMA transfer registers. 311 * and then set up the DMA transfer registers.
@@ -313,21 +314,15 @@ static void scc_dma_host_set(ide_drive_t *drive, int on)
313 * is returned. 314 * is returned.
314 */ 315 */
315 316
316static int scc_dma_setup(ide_drive_t *drive) 317static int scc_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
317{ 318{
318 ide_hwif_t *hwif = drive->hwif; 319 ide_hwif_t *hwif = drive->hwif;
319 struct request *rq = hwif->rq; 320 u32 rw = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 0 : ATA_DMA_WR;
320 unsigned int reading;
321 u8 dma_stat; 321 u8 dma_stat;
322 322
323 if (rq_data_dir(rq))
324 reading = 0;
325 else
326 reading = 1 << 3;
327
328 /* fall back to pio! */ 323 /* fall back to pio! */
329 if (!ide_build_dmatable(drive, rq)) { 324 if (ide_build_dmatable(drive, cmd) == 0) {
330 ide_map_sg(drive, rq); 325 ide_map_sg(drive, cmd);
331 return 1; 326 return 1;
332 } 327 }
333 328
@@ -335,7 +330,7 @@ static int scc_dma_setup(ide_drive_t *drive)
335 out_be32((void __iomem *)(hwif->dma_base + 8), hwif->dmatable_dma); 330 out_be32((void __iomem *)(hwif->dma_base + 8), hwif->dmatable_dma);
336 331
337 /* specify r/w */ 332 /* specify r/w */
338 out_be32((void __iomem *)hwif->dma_base, reading); 333 out_be32((void __iomem *)hwif->dma_base, rw);
339 334
340 /* read DMA status for INTR & ERROR flags */ 335 /* read DMA status for INTR & ERROR flags */
341 dma_stat = scc_dma_sff_read_status(hwif); 336 dma_stat = scc_dma_sff_read_status(hwif);