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) <[email protected]>
---
v2:
 - new patch
---
 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 c046aee42687..2b9c98251c94 100644
--- a/drivers/accel/ethosu/ethosu_gem.c
+++ b/drivers/accel/ethosu/ethosu_gem.c
@@ -110,6 +110,7 @@ int ethosu_gem_create_with_handle(struct drm_file *file,
 
 struct dma {
        s8 region;
+       s8 mode;
        u64 len;
        u64 offset;
        s64 stride[2];
@@ -118,7 +119,6 @@ struct dma {
 struct dma_state {
        u16 size0;
        u16 size1;
-       s8 mode;
        struct dma src;
        struct dma dst;
 };
@@ -171,7 +171,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)
@@ -664,13 +664,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

Reply via email to