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 <phil@raspberrypi.com>
This commit is contained in:
Phil Elwell
2023-05-11 16:08:15 +01:00
committed by Dom Cobley
parent 4456ca6d58
commit e5ba34804e

View File

@@ -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>
@@ -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, c->cfg.src_addr,
DMA_SLAVE_BUSWIDTH_4_BYTES, 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, c->cfg.dst_addr,
DMA_SLAVE_BUSWIDTH_4_BYTES, DMA_TO_DEVICE, 0);
info |= BCM2835_DMA_D_DREQ | BCM2835_DMA_S_INC;
}
@@ -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, c->cfg.src_addr,
DMA_SLAVE_BUSWIDTH_4_BYTES, 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, c->cfg.dst_addr,
DMA_SLAVE_BUSWIDTH_4_BYTES, DMA_TO_DEVICE, 0);
src = buf_addr;
info |= BCM2835_DMA_D_DREQ | BCM2835_DMA_S_INC;