Skip to content

Commit bd92d69

Browse files
etienne-lmskartben
authored andcommitted
drivers: spi: stm32: support DMA when CONFIG_MEM_ATTR=n
Allow STM32 SPI driver to operate with DMA support even when CONFIG_MEM_ATTR is disabled which happen when CONFIG_ARM_MPU is intentionally disabled despite the CPU supports MPU. By the way, remove some #ifdef directive on header files inclusion that add noise in the header file inclusion section without any benefit. Signed-off-by: Etienne Carriere <[email protected]>
1 parent 4e37a1b commit bd92d69

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/spi/spi_ll_stm32.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,9 @@ LOG_MODULE_REGISTER(spi_ll_stm32);
3030
#include <zephyr/drivers/clock_control.h>
3131
#include <zephyr/irq.h>
3232
#include <zephyr/mem_mgmt/mem_attr.h>
33-
34-
#ifdef CONFIG_DCACHE
3533
#include <zephyr/dt-bindings/memory-attr/memory-attr-arm.h>
36-
#endif /* CONFIG_DCACHE */
37-
38-
#ifdef CONFIG_NOCACHE_MEMORY
3934
#include <zephyr/linker/linker-defs.h>
40-
#elif defined(CONFIG_CACHE_MANAGEMENT)
4135
#include <zephyr/arch/cache.h>
42-
#endif /* CONFIG_NOCACHE_MEMORY */
4336

4437
#include "spi_ll_stm32.h"
4538

@@ -1082,7 +1075,7 @@ static int wait_dma_rx_tx_done(const struct device *dev)
10821075
}
10831076

10841077
#ifdef CONFIG_DCACHE
1085-
static bool buf_in_nocache(uintptr_t buf, size_t len_bytes)
1078+
static bool buf_in_nocache(uintptr_t buf __maybe_unused, size_t len_bytes __maybe_unused)
10861079
{
10871080
bool buf_within_nocache = false;
10881081

@@ -1095,9 +1088,11 @@ static bool buf_in_nocache(uintptr_t buf, size_t len_bytes)
10951088
}
10961089
#endif /* CONFIG_NOCACHE_MEMORY */
10971090

1091+
#ifdef CONFIG_MEM_ATTR
10981092
/* Check if buffer is in nocache memory region defined in DT */
10991093
buf_within_nocache = mem_attr_check_buf(
11001094
(void *)buf, len_bytes, DT_MEM_ARM(ATTR_MPU_RAM_NOCACHE)) == 0;
1095+
#endif /* CONFIG_MEM_ATTR */
11011096

11021097
return buf_within_nocache;
11031098
}

0 commit comments

Comments
 (0)