[PATCH v2 05/19] accel: ethosu: Move DMA mode to src/dst struct

From: Rob Herring (Arm)

Date: Fri Sep 04 2026 - 20:45:41 EST


The DMA mode setting is independent for source and destination, so it
should be part of the src/dst struct dma rather than the global DMA
state.

Signed-off-by: Rob Herring (Arm) <robh@xxxxxxxxxx>
---
drivers/accel/ethosu/ethosu_gem.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/accel/ethosu/ethosu_gem.c b/drivers/accel/ethosu/ethosu_gem.c
index 9afe2549ec84..408b93350dd7 100644
--- a/drivers/accel/ethosu/ethosu_gem.c
+++ b/drivers/accel/ethosu/ethosu_gem.c
@@ -100,6 +100,7 @@ int ethosu_gem_create_with_handle(struct drm_file *file,

struct dma {
s8 region;
+ s8 mode;
u64 len;
u64 offset;
s64 stride[2];
@@ -108,7 +109,6 @@ struct dma {
struct dma_state {
u16 size0;
u16 size1;
- s8 mode;
struct dma src;
struct dma dst;
};
@@ -161,7 +161,7 @@ static u64 cmd_to_addr(u32 *cmd)
static u64 dma_length(struct ethosu_validated_cmdstream_info *info,
struct dma_state *dma_st, struct dma *dma)
{
- s8 mode = dma_st->mode;
+ s8 mode = dma->mode;
u64 len = dma->len;

if (len == U64_MAX)
@@ -654,13 +654,14 @@ static int ethosu_gem_cmdstream_copy_and_validate(struct drm_device *ddev,
st.dma.src.region = -1;
else
st.dma.src.region = param & 0x7;
- st.dma.mode = (param >> 9) & 0x3;
+ st.dma.src.mode = (param >> 9) & 0x3;
break;
case NPU_SET_DMA0_DST_REGION:
if (param & 0x100)
st.dma.dst.region = -1;
else
st.dma.dst.region = param & 0x7;
+ st.dma.dst.mode = (param >> 9) & 0x3;
break;
case NPU_SET_DMA0_SIZE0:
st.dma.size0 = param;

--
2.53.0