Skip to content

Commit

Permalink
dmaengine: bcm2835: Use dma_map_resource
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
pelwell committed Feb 7, 2025
1 parent 480c9f0 commit d26d1a0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions drivers/dma/bcm2835-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
* Copyright 2012 Marvell International Ltd.
*/
#include <linux/dmaengine.h>
#include <linux/dma-direct.h>
#include <linux/dma-mapping.h>
#include <linux/dmapool.h>
#include <linux/err.h>
Expand Down Expand Up @@ -1024,12 +1023,14 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_slave_sg(
if (direction == DMA_DEV_TO_MEM) {
if (c->cfg.src_addr_width != DMA_SLAVE_BUSWIDTH_4_BYTES)
return NULL;
src = phys_to_dma(chan->device->dev, c->cfg.src_addr);
src = dma_map_resource(chan->device->dev, DMA_SLAVE_BUSWIDTH_4_BYTES,
c->cfg.src_addr, DMA_FROM_DEVICE, 0);
info |= BCM2835_DMA_S_DREQ | BCM2835_DMA_D_INC;
} else {
if (c->cfg.dst_addr_width != DMA_SLAVE_BUSWIDTH_4_BYTES)
return NULL;
dst = phys_to_dma(chan->device->dev, c->cfg.dst_addr);
dst = dma_map_resource(chan->device->dev, DMA_SLAVE_BUSWIDTH_4_BYTES,
c->cfg.dst_addr, DMA_TO_DEVICE, 0);
info |= BCM2835_DMA_D_DREQ | BCM2835_DMA_S_INC;
}

Expand Down Expand Up @@ -1099,13 +1100,15 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic(
if (direction == DMA_DEV_TO_MEM) {
if (c->cfg.src_addr_width != DMA_SLAVE_BUSWIDTH_4_BYTES)
return NULL;
src = phys_to_dma(chan->device->dev, c->cfg.src_addr);
src = dma_map_resource(chan->device->dev, DMA_SLAVE_BUSWIDTH_4_BYTES,
c->cfg.src_addr, DMA_FROM_DEVICE, 0);
dst = buf_addr;
info |= BCM2835_DMA_S_DREQ | BCM2835_DMA_D_INC;
} else {
if (c->cfg.dst_addr_width != DMA_SLAVE_BUSWIDTH_4_BYTES)
return NULL;
dst = phys_to_dma(chan->device->dev, c->cfg.dst_addr);
dst = dma_map_resource(chan->device->dev, DMA_SLAVE_BUSWIDTH_4_BYTES,
c->cfg.dst_addr, DMA_TO_DEVICE, 0);
src = buf_addr;
info |= BCM2835_DMA_D_DREQ | BCM2835_DMA_S_INC;

Expand Down

0 comments on commit d26d1a0

Please sign in to comment.