Browse Source

drivers: dma: atcdmac300: add flush chain_block when Data cache is enabled

Add cache flush to ensure dma_chain is written back to memory
for DMA coherence

Signed-off-by: jacob kung <jacob.kung@egistec.com>
pull/89716/merge
jacob kung 1 month ago committed by Benjamin Cabé
parent
commit
2fe357a592
  1. 15
      drivers/dma/dma_andes_atcdmac300.c

15
drivers/dma/dma_andes_atcdmac300.c

@ -12,6 +12,12 @@ @@ -12,6 +12,12 @@
#include <zephyr/init.h>
#include <zephyr/drivers/dma.h>
#ifdef CONFIG_DCACHE
#ifdef CONFIG_CACHE_MANAGEMENT
#include <zephyr/cache.h>
#endif
#endif
#define DT_DRV_COMPAT andestech_atcdmac300
#define LOG_LEVEL CONFIG_DMA_LOG_LEVEL
@ -393,6 +399,15 @@ static int dma_atcdmac300_config(const struct device *dev, uint32_t channel, @@ -393,6 +399,15 @@ static int dma_atcdmac300_config(const struct device *dev, uint32_t channel,
sys_write32(0, DMA_CH_LL_PTR_H(dev, channel));
}
#ifdef CONFIG_DCACHE
#ifdef CONFIG_CACHE_MANAGEMENT
cache_data_flush_range((void *)&dma_chain, sizeof(dma_chain));
#else
#error "Data cache is enabled; please flush the cache after \
setting dma_chain to ensure memory coherence."
#endif
#endif
end:
return ret;
}

Loading…
Cancel
Save