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 e230e12 commit 3f952af
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 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,12 @@ 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);

Check failure on line 1026 in drivers/dma/bcm2835-dma.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 123 exceeds 100 columns
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);

Check failure on line 1031 in drivers/dma/bcm2835-dma.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 121 exceeds 100 columns
info |= BCM2835_DMA_D_DREQ | BCM2835_DMA_S_INC;
}

Expand Down Expand Up @@ -1099,13 +1098,13 @@ 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);

Check failure on line 1101 in drivers/dma/bcm2835-dma.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 123 exceeds 100 columns
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);

Check failure on line 1107 in drivers/dma/bcm2835-dma.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 121 exceeds 100 columns
src = buf_addr;
info |= BCM2835_DMA_D_DREQ | BCM2835_DMA_S_INC;

Expand Down

0 comments on commit 3f952af

Please sign in to comment.