This is an automated email from the ASF dual-hosted git repository. GUIDINGLI pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 087d6dc37bac22b7db350e9dcd5362293d2126bb Author: raiden00pl <[email protected]> AuthorDate: Wed Nov 25 10:14:10 2026 +0100 arch/arm/stm32n6: Add DMA2D support. Use the common DMA2D driver on the STM32N6, with its layers as LTDC framebuffer overlays. The DMA2D gets its AHB5 clock and Secure, privileged CID 1 RIF attributes. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: raiden00pl <[email protected]> --- Documentation/guides/chip-specific/stm32_ports.rst | 1 + Documentation/platforms/arm/stm32n6/index.rst | 2 ++ arch/arm/src/stm32n6/Kconfig | 2 ++ arch/arm/src/stm32n6/hardware/stm32n6xxx_memorymap.h | 1 + arch/arm/src/stm32n6/hardware/stm32n6xxx_rifsc.h | 1 + arch/arm/src/stm32n6/stm32_rif.c | 7 +++++++ arch/arm/src/stm32n6/stm32n6xx_rcc.c | 4 ++++ 7 files changed, 18 insertions(+) diff --git a/Documentation/guides/chip-specific/stm32_ports.rst b/Documentation/guides/chip-specific/stm32_ports.rst index c15647bd93f..86b0040f097 100644 --- a/Documentation/guides/chip-specific/stm32_ports.rst +++ b/Documentation/guides/chip-specific/stm32_ports.rst @@ -773,6 +773,7 @@ Peripheral Core version Driver ADC to be done not supported CAN/FDCAN to be done not supported DAC to be done not supported +DMA2D v1 arch/arm/src/common/stm32/stm32_dma2d_v1.c ETH v2 arch/arm/src/common/stm32/stm32_eth_v2.c EXTI M33M55 v1 arch/arm/src/common/stm32/stm32_exti_gpio_m33m55_v1.c GPIO M33M55 v1 arch/arm/src/common/stm32/stm32_gpio_m33m55_v1.c diff --git a/Documentation/platforms/arm/stm32n6/index.rst b/Documentation/platforms/arm/stm32n6/index.rst index 23bbe3ba859..9e6554f61ed 100644 --- a/Documentation/platforms/arm/stm32n6/index.rst +++ b/Documentation/platforms/arm/stm32n6/index.rst @@ -35,6 +35,8 @@ EXTI Yes GPIO interrupts through the common driver. ETH Yes ETH1 through the common Ethernet v2 driver, MII, RMII or RGMII up to 1000 Mbps. DMA Yes GPDMA1 and HPDMA1 through the common GPDMA driver. +DMA2D Yes Common DMA2D driver as LTDC framebuffer overlays + (fill, blit, blend). PWR Yes Supply configuration, VOS, I/O supply validity. RCC Yes HSI/HSE, PLL1-4, IC1-20, bus prescalers and kernel clock selection from board.h. diff --git a/arch/arm/src/stm32n6/Kconfig b/arch/arm/src/stm32n6/Kconfig index 5a945ddf055..37075474177 100644 --- a/arch/arm/src/stm32n6/Kconfig +++ b/arch/arm/src/stm32n6/Kconfig @@ -32,6 +32,7 @@ config STM32_N6_PERIPHERALS bool default y select STM32_HAVE_IP_DMA_GPDMA + select STM32_HAVE_IP_DMA2D_V1 select STM32_HAVE_IP_EXTI_M33M55_V1 select STM32_HAVE_IP_GPIO_M33M55_V1 select STM32_HAVE_GPIO_DELAY @@ -49,6 +50,7 @@ config STM32_N6_PERIPHERALS select STM32_HAVE_IP_WDG_V3 select STM32_HAVE_DMA1 select STM32_HAVE_DMA2 + select STM32_HAVE_DMA2D select STM32_HAVE_ETHERNET select STM32_HAVE_ETH_AXI select STM32_HAVE_ETH_RGMII diff --git a/arch/arm/src/stm32n6/hardware/stm32n6xxx_memorymap.h b/arch/arm/src/stm32n6/hardware/stm32n6xxx_memorymap.h index 853967e5c53..f12fed7231d 100644 --- a/arch/arm/src/stm32n6/hardware/stm32n6xxx_memorymap.h +++ b/arch/arm/src/stm32n6/hardware/stm32n6xxx_memorymap.h @@ -194,6 +194,7 @@ #define STM32_DMA1_BASE STM32_GPDMA1_BASE #define STM32_DMA2_BASE STM32_HPDMA1_BASE +#define STM32_DMA2D_BASE 0x58021000 /* DMA2D (AHB5, Secure) */ #define STM32_SDMMC2_BASE 0x58026800 /* SDMMC2 (AHB5, Secure) */ #define STM32_SDMMC1_BASE 0x58027000 /* SDMMC1 (AHB5, Secure) */ #define STM32_XSPI2_BASE 0x5802A000 /* XSPI2 controller (AHB5, Secure) */ diff --git a/arch/arm/src/stm32n6/hardware/stm32n6xxx_rifsc.h b/arch/arm/src/stm32n6/hardware/stm32n6xxx_rifsc.h index 12a936ff8d7..ea461e0198e 100644 --- a/arch/arm/src/stm32n6/hardware/stm32n6xxx_rifsc.h +++ b/arch/arm/src/stm32n6/hardware/stm32n6xxx_rifsc.h @@ -93,6 +93,7 @@ #define RIFSC_PERIPH_OTG1HS (1 * 32 + 24) #define RIFSC_PERIPH_OTG2HS (1 * 32 + 25) #define RIFSC_PERIPH_ETH1 (1 * 32 + 28) +#define RIFSC_PERIPH_DMA2D (3 * 32 + 5) #define RIFSC_PERIPH_LTDC (3 * 32 + 6) #define RIFSC_PERIPH_LTDCL1 (3 * 32 + 7) #define RIFSC_PERIPH_LTDCL2 (3 * 32 + 8) diff --git a/arch/arm/src/stm32n6/stm32_rif.c b/arch/arm/src/stm32n6/stm32_rif.c index d4ca686a7d1..4c4297bc113 100644 --- a/arch/arm/src/stm32n6/stm32_rif.c +++ b/arch/arm/src/stm32n6/stm32_rif.c @@ -100,6 +100,13 @@ void stm32_rifconfig(void) rif_setslave_secpriv(RIFSC_PERIPH_LTDCL2); #endif +#ifdef CONFIG_STM32_DMA2D + /* The DMA2D reads and writes the overlays in Secure AXISRAM */ + + rif_setmaster(RIFSC_MASTER_DMA2D, RIF_MASTER_CID1_SEC_PRIV); + rif_setslave_secpriv(RIFSC_PERIPH_DMA2D); +#endif + #ifdef CONFIG_STM32_SDMMC1 /* The SDMMC IDMA reads and writes buffers in Secure AXISRAM */ diff --git a/arch/arm/src/stm32n6/stm32n6xx_rcc.c b/arch/arm/src/stm32n6/stm32n6xx_rcc.c index 6d2bb21b5b9..ee3df3d3347 100644 --- a/arch/arm/src/stm32n6/stm32n6xx_rcc.c +++ b/arch/arm/src/stm32n6/stm32n6xx_rcc.c @@ -318,6 +318,10 @@ static inline void rcc_enableahb5(void) regval |= RCC_AHB5ENR_HPDMA1EN; #endif +#ifdef CONFIG_STM32_DMA2D + regval |= RCC_AHB5ENR_DMA2DEN; +#endif + #ifdef CONFIG_STM32_SDMMC1 regval |= RCC_AHB5ENR_SDMMC1EN; #endif
