From d26212bd39ec5893e28732da343f7a1dfe290a1f Mon Sep 17 00:00:00 2001 From: Tiago Medicci Serrano Date: Wed, 23 Aug 2023 16:44:54 -0300 Subject: [PATCH] esp32s3/dma: Fix loading the DMA descriptor address The macro `SET_BITS` only sets the bits according to the bit mask and, once it's being used to set the address field of the GDMA inlink/outlink register, it's necessary to clean all the bits corresponding to that field that were eventually setup previously to avoid messing with the bits that correspond to the current address being setup. --- arch/xtensa/src/esp32s3/esp32s3_dma.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/xtensa/src/esp32s3/esp32s3_dma.c b/arch/xtensa/src/esp32s3/esp32s3_dma.c index 1db65f1cb7..6381459c5f 100644 --- a/arch/xtensa/src/esp32s3/esp32s3_dma.c +++ b/arch/xtensa/src/esp32s3/esp32s3_dma.c @@ -242,6 +242,7 @@ uint32_t esp32s3_dma_setup(int chan, bool tx, /* Set the descriptor link base address for TX channel */ regval = (uint32_t)dmadesc & DMA_OUTLINK_ADDR_CH0; + CLR_BITS(DMA_OUT_LINK_CH0_REG, chan, DMA_OUTLINK_ADDR_CH0); SET_BITS(DMA_OUT_LINK_CH0_REG, chan, regval); } else @@ -254,6 +255,7 @@ uint32_t esp32s3_dma_setup(int chan, bool tx, /* Set the descriptor link base address for RX channel */ regval = (uint32_t)dmadesc & DMA_INLINK_ADDR_CH0; + CLR_BITS(DMA_IN_LINK_CH0_REG, chan, DMA_INLINK_ADDR_CH0); SET_BITS(DMA_IN_LINK_CH0_REG, chan, regval); }