Skip to content

Commit 4e37a1b

Browse files
etienne-lmskartben
authored andcommitted
drivers: serial: uart_stm32: support DMA when CONFIG_MEM_ATTR=n
Allow STM32 UART 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 52d8903 commit 4e37a1b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/serial/uart_stm32.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,9 @@
3939
#include <stm32_ll_exti.h>
4040
#endif /* CONFIG_PM */
4141

42-
#ifdef CONFIG_DCACHE
4342
#include <zephyr/linker/linker-defs.h>
4443
#include <zephyr/mem_mgmt/mem_attr.h>
4544
#include <zephyr/dt-bindings/memory-attr/memory-attr-arm.h>
46-
#endif /* CONFIG_DCACHE */
4745

4846
#include <zephyr/logging/log.h>
4947
#include <zephyr/irq.h>
@@ -1395,11 +1393,13 @@ static bool buf_in_nocache(uintptr_t buf, size_t len_bytes)
13951393
}
13961394
#endif /* CONFIG_NOCACHE_MEMORY */
13971395

1396+
#ifdef CONFIG_MEM_ATTR
13981397
buf_within_nocache = mem_attr_check_buf(
13991398
(void *)buf, len_bytes, DT_MEM_ARM_MPU_RAM_NOCACHE) == 0;
14001399
if (buf_within_nocache) {
14011400
return true;
14021401
}
1402+
#endif /* CONFIG_MEM_ATTR */
14031403

14041404
buf_within_nocache = (buf >= ((uintptr_t)__rodata_region_start)) &&
14051405
((buf + len_bytes - 1) <= ((uintptr_t)__rodata_region_end));

0 commit comments

Comments
 (0)