[PATCH 3/3] dmaengine: pl330: Add DMA_2D capability

Aatif Mushtaq
2025-02-10T06:43:21Z

Add a capability to prepare DMA for 2D transfer and create a hook
between the DMA engine and the pl330 driver

Signed-off-by: Aatif Mushtaq <aatif4.m@samsung.com>
---
drivers/dma/pl330.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 546ea442044e..ac17657413b5 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -2847,6 +2847,23 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst,
return &desc->txd;
}

+static struct dma_async_tx_descriptor *
+pl330_prep_2d_dma_memcpy(struct dma_chan *chan, dma_addr_t dst,
+ dma_addr_t src, size_t len, u16 src_imm,
+ u16 dst_imm, unsigned long flags)
+{
+ struct dma_pl330_desc *desc;
+ struct dma_async_tx_descriptor *tx;
+
+ tx = pl330_prep_dma_memcpy(chan, dst, src, len, flags);
+ desc = to_desc(tx);
+
+ desc->px.src_imm = src_imm;
+ desc->px.dst_imm = dst_imm;
+
+ return tx;
+}
+
static void __pl330_giveback_desc(struct pl330_dmac *pl330,
struct dma_pl330_desc *first)
{
@@ -3157,6 +3174,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
pd->device_alloc_chan_resources = pl330_alloc_chan_resources;
pd->device_free_chan_resources = pl330_free_chan_resources;
pd->device_prep_dma_memcpy = pl330_prep_dma_memcpy;
+ pd->device_prep_2d_dma_memcpy = pl330_prep_2d_dma_memcpy;
pd->device_prep_dma_cyclic = pl330_prep_dma_cyclic;
pd->device_tx_status = pl330_tx_status;
pd->device_prep_slave_sg = pl330_prep_slave_sg;
--
2.17.1