aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2012-04-25 14:50:51 -0400
committerVinod Koul <vinod.koul@linux.intel.com>2012-05-11 02:34:38 -0400
commitcbb796ccd8c33c50249b876d9773dfa8e67d39cb (patch)
treee1384d10cf0cf86328a69c4f9bf6931dbe9250fe /drivers/dma
parent12366ad91adb41a193f93b3b0f2829ea06df1773 (diff)
dmaengine: Use sg_dma_address instead of sg_phys
dmaengine drivers should always use sg_dma_address instead of sg_phys to get the addresses for the transfer from a sg element. To quote Russel King: sg_phys(sg) of course has nothing to do with DMA addresses. It's the physical address _to the CPU_ of the memory associated with the scatterlist entry. That may, or may not have the same value for the DMA engine, particularly if IOMMUs are involved. And if these drivers are used on ARM, they must be fixed, sooner rather than later. There's patches in the works which will mean we will end up with IOMMU support in the DMA mapping later, which means everything I've said above will become reality. The patch has been generated using the following coccinelle patch: <smpl> @@ struct scatterlist *sg; @@ -sg_phys(sg) +sg_dma_address(sg) </smpl> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/amba-pl08x.c4
-rw-r--r--drivers/dma/coh901318_lli.c4
-rw-r--r--drivers/dma/dw_dmac.c4
-rw-r--r--drivers/dma/intel_mid_dma.c2
-rw-r--r--drivers/dma/pch_dma.c2
5 files changed, 8 insertions, 8 deletions
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index e7d5550266e0..003220a60bcb 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -1382,11 +1382,11 @@ static struct dma_async_tx_descriptor *pl08x_prep_slave_sg(
1382 1382
1383 dsg->len = sg_dma_len(sg); 1383 dsg->len = sg_dma_len(sg);
1384 if (direction == DMA_MEM_TO_DEV) { 1384 if (direction == DMA_MEM_TO_DEV) {
1385 dsg->src_addr = sg_phys(sg); 1385 dsg->src_addr = sg_dma_address(sg);
1386 dsg->dst_addr = slave_addr; 1386 dsg->dst_addr = slave_addr;
1387 } else { 1387 } else {
1388 dsg->src_addr = slave_addr; 1388 dsg->src_addr = slave_addr;
1389 dsg->dst_addr = sg_phys(sg); 1389 dsg->dst_addr = sg_dma_address(sg);
1390 } 1390 }
1391 } 1391 }
1392 1392
diff --git a/drivers/dma/coh901318_lli.c b/drivers/dma/coh901318_lli.c
index 6c0e2d4c6682..780e0429b38c 100644
--- a/drivers/dma/coh901318_lli.c
+++ b/drivers/dma/coh901318_lli.c
@@ -270,10 +270,10 @@ coh901318_lli_fill_sg(struct coh901318_pool *pool,
270 270
271 if (dir == DMA_MEM_TO_DEV) 271 if (dir == DMA_MEM_TO_DEV)
272 /* increment source address */ 272 /* increment source address */
273 src = sg_phys(sg); 273 src = sg_dma_address(sg);
274 else 274 else
275 /* increment destination address */ 275 /* increment destination address */
276 dst = sg_phys(sg); 276 dst = sg_dma_address(sg);
277 277
278 bytes_to_transfer = sg_dma_len(sg); 278 bytes_to_transfer = sg_dma_len(sg);
279 279
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 13b92983b241..e23dc82d43ac 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -743,7 +743,7 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
743 struct dw_desc *desc; 743 struct dw_desc *desc;
744 u32 len, dlen, mem; 744 u32 len, dlen, mem;
745 745
746 mem = sg_phys(sg); 746 mem = sg_dma_address(sg);
747 len = sg_dma_len(sg); 747 len = sg_dma_len(sg);
748 748
749 if (!((mem | len) & 7)) 749 if (!((mem | len) & 7))
@@ -810,7 +810,7 @@ slave_sg_todev_fill_desc:
810 struct dw_desc *desc; 810 struct dw_desc *desc;
811 u32 len, dlen, mem; 811 u32 len, dlen, mem;
812 812
813 mem = sg_phys(sg); 813 mem = sg_dma_address(sg);
814 len = sg_dma_len(sg); 814 len = sg_dma_len(sg);
815 815
816 if (!((mem | len) & 7)) 816 if (!((mem | len) & 7))
diff --git a/drivers/dma/intel_mid_dma.c b/drivers/dma/intel_mid_dma.c
index c900ca7aaec4..d0ef5937fbf6 100644
--- a/drivers/dma/intel_mid_dma.c
+++ b/drivers/dma/intel_mid_dma.c
@@ -398,7 +398,7 @@ static int midc_lli_fill_sg(struct intel_mid_dma_chan *midc,
398 desc->width, 398 desc->width,
399 midc->dma->block_size); 399 midc->dma->block_size);
400 /*Populate SAR and DAR values*/ 400 /*Populate SAR and DAR values*/
401 sg_phy_addr = sg_phys(sg); 401 sg_phy_addr = sg_dma_address(sg);
402 if (desc->dirn == DMA_MEM_TO_DEV) { 402 if (desc->dirn == DMA_MEM_TO_DEV) {
403 lli_bloc_desc->sar = sg_phy_addr; 403 lli_bloc_desc->sar = sg_phy_addr;
404 lli_bloc_desc->dar = mids->dma_slave.dst_addr; 404 lli_bloc_desc->dar = mids->dma_slave.dst_addr;
diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c
index 65c0495a6d40..987ab5cd2617 100644
--- a/drivers/dma/pch_dma.c
+++ b/drivers/dma/pch_dma.c
@@ -621,7 +621,7 @@ static struct dma_async_tx_descriptor *pd_prep_slave_sg(struct dma_chan *chan,
621 goto err_desc_get; 621 goto err_desc_get;
622 622
623 desc->regs.dev_addr = reg; 623 desc->regs.dev_addr = reg;
624 desc->regs.mem_addr = sg_phys(sg); 624 desc->regs.mem_addr = sg_dma_address(sg);
625 desc->regs.size = sg_dma_len(sg); 625 desc->regs.size = sg_dma_len(sg);
626 desc->regs.next = DMA_DESC_FOLLOW_WITHOUT_IRQ; 626 desc->regs.next = DMA_DESC_FOLLOW_WITHOUT_IRQ;
627 627