Skip to content

Commit 71e5e32

Browse files
committed
dmaengine: bcm2835: Use dma_map_resource
The commit titled "bcm2835-dma: Derive slave DMA addresses correctly" (now squashed into DMA roll-up) moved the responsibility for calculating DMA addresses to the DMA driver. Unfortunately it committed the sin of using phys_to_dma directly rather than using the approved API, i.e. dma_map_resource. Signed-off-by: Phil Elwell <[email protected]>
1 parent ee21c11 commit 71e5e32

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

drivers/dma/bcm2835-dma.c

+8-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
* Copyright 2012 Marvell International Ltd.
1919
*/
2020
#include <linux/dmaengine.h>
21-
#include <linux/dma-direct.h>
2221
#include <linux/dma-mapping.h>
2322
#include <linux/dmapool.h>
2423
#include <linux/err.h>
@@ -1024,12 +1023,14 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_slave_sg(
10241023
if (direction == DMA_DEV_TO_MEM) {
10251024
if (c->cfg.src_addr_width != DMA_SLAVE_BUSWIDTH_4_BYTES)
10261025
return NULL;
1027-
src = phys_to_dma(chan->device->dev, c->cfg.src_addr);
1026+
src = dma_map_resource(chan->device->dev, DMA_SLAVE_BUSWIDTH_4_BYTES,
1027+
c->cfg.src_addr, DMA_FROM_DEVICE, 0);
10281028
info |= BCM2835_DMA_S_DREQ | BCM2835_DMA_D_INC;
10291029
} else {
10301030
if (c->cfg.dst_addr_width != DMA_SLAVE_BUSWIDTH_4_BYTES)
10311031
return NULL;
1032-
dst = phys_to_dma(chan->device->dev, c->cfg.dst_addr);
1032+
dst = dma_map_resource(chan->device->dev, DMA_SLAVE_BUSWIDTH_4_BYTES,
1033+
c->cfg.dst_addr, DMA_TO_DEVICE, 0);
10331034
info |= BCM2835_DMA_D_DREQ | BCM2835_DMA_S_INC;
10341035
}
10351036

@@ -1099,13 +1100,15 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic(
10991100
if (direction == DMA_DEV_TO_MEM) {
11001101
if (c->cfg.src_addr_width != DMA_SLAVE_BUSWIDTH_4_BYTES)
11011102
return NULL;
1102-
src = phys_to_dma(chan->device->dev, c->cfg.src_addr);
1103+
src = dma_map_resource(chan->device->dev, DMA_SLAVE_BUSWIDTH_4_BYTES,
1104+
c->cfg.src_addr, DMA_FROM_DEVICE, 0);
11031105
dst = buf_addr;
11041106
info |= BCM2835_DMA_S_DREQ | BCM2835_DMA_D_INC;
11051107
} else {
11061108
if (c->cfg.dst_addr_width != DMA_SLAVE_BUSWIDTH_4_BYTES)
11071109
return NULL;
1108-
dst = phys_to_dma(chan->device->dev, c->cfg.dst_addr);
1110+
dst = dma_map_resource(chan->device->dev, DMA_SLAVE_BUSWIDTH_4_BYTES,
1111+
c->cfg.dst_addr, DMA_TO_DEVICE, 0);
11091112
src = buf_addr;
11101113
info |= BCM2835_DMA_D_DREQ | BCM2835_DMA_S_INC;
11111114

0 commit comments

Comments
 (0)