This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 368fa946041d9460b31b96b7138438aa99c7f3ad Author: raiden00pl <[email protected]> AuthorDate: Wed Nov 18 11:37:15 2026 +0100 arch/arm/stm32n6: Add SDMMC support. SDMMC1 and SDMMC2 use the common IDMA driver. Their IDMA masters get Secure, privileged RIF access to the AXISRAM. Boards that wire the VDDIO5 pads validate them with BOARD_PWR_VDDIO5. 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/common/stm32/Kconfig.have | 2 +- arch/arm/src/common/stm32/Kconfig.periph | 2 +- arch/arm/src/common/stm32/Kconfig.sdio | 10 +++--- arch/arm/src/stm32n6/Kconfig | 3 ++ .../src/stm32n6/hardware/stm32n6xxx_memorymap.h | 9 +++++ arch/arm/src/stm32n6/hardware/stm32n6xxx_pinmap.h | 40 ++++++++++++++++++++++ arch/arm/src/stm32n6/hardware/stm32n6xxx_rifsc.h | 2 ++ arch/arm/src/stm32n6/hardware/stm32n6xxx_syscfg.h | 2 ++ arch/arm/src/stm32n6/stm32.h | 1 + arch/arm/src/stm32n6/stm32_rif.c | 12 +++++++ .../src/stm32n6/{stm32.h => stm32_sdmmc_chip.h} | 32 ++++++++--------- arch/arm/src/stm32n6/stm32_start.c | 18 +++++++--- arch/arm/src/stm32n6/stm32n6xx_rcc.c | 8 +++++ 15 files changed, 115 insertions(+), 29 deletions(-) diff --git a/Documentation/guides/chip-specific/stm32_ports.rst b/Documentation/guides/chip-specific/stm32_ports.rst index 07fe1096eae..01a75fe6bd0 100644 --- a/Documentation/guides/chip-specific/stm32_ports.rst +++ b/Documentation/guides/chip-specific/stm32_ports.rst @@ -785,6 +785,7 @@ PWR n6 arch/arm/src/stm32n6/stm32_pwr.c RCC n6 arch/arm/src/stm32n6/stm32n6xx_rcc.c RNG v1 arch/arm/src/common/stm32/stm32_rng_v1.c RTC M33M55 v1 arch/arm/src/common/stm32/stm32_rtcc_m33m55_v1.c +SDMMC v2 arch/arm/src/common/stm32/stm32_sdmmc_v2.c SPI/I2S v5 arch/arm/src/common/stm32/stm32_spi_v5.c TIM v3 arch/arm/src/common/stm32/stm32_tim.c USART/LPUART M33M55 v3 arch/arm/src/common/stm32/stm32_serial_m33m55_v3.c diff --git a/Documentation/platforms/arm/stm32n6/index.rst b/Documentation/platforms/arm/stm32n6/index.rst index 1ca2c7c685e..75da5de92ee 100644 --- a/Documentation/platforms/arm/stm32n6/index.rst +++ b/Documentation/platforms/arm/stm32n6/index.rst @@ -41,6 +41,7 @@ RCC Yes HSI/HSE, PLL1-4, IC1-20, bus prescalers and kernel RNG Yes Through the common driver. RTC Yes Calendar, sub-seconds, Alarm A/B and wakeup timer through the common RTC driver. +SDMMC Yes SDMMC1-2 through the common IDMA SDMMC driver. SPI Yes SPI1-6 through the common SPI v5 driver, master mode, optional GPDMA. USART Yes USART1-3, UART4-5, USART6, UART7-9, USART10 and @@ -53,7 +54,6 @@ LPTIM No MPU No NPU No SAI No -SDMMC No TIM No USB No XSPI No diff --git a/arch/arm/src/common/stm32/Kconfig.have b/arch/arm/src/common/stm32/Kconfig.have index b2fe1c96eb2..a71368137e5 100644 --- a/arch/arm/src/common/stm32/Kconfig.have +++ b/arch/arm/src/common/stm32/Kconfig.have @@ -811,7 +811,7 @@ config STM32_HAVE_IP_SDIO_M3M4_V1 config STM32_HAVE_IP_SDMMC_V2 bool ---help--- - SDMMC with an internal DMA (IDMA) (STM32H7). + SDMMC with an internal DMA (IDMA) (STM32H7, STM32N6). # SECURITY capabilities diff --git a/arch/arm/src/common/stm32/Kconfig.periph b/arch/arm/src/common/stm32/Kconfig.periph index df373bdb9ac..648bfd93baa 100644 --- a/arch/arm/src/common/stm32/Kconfig.periph +++ b/arch/arm/src/common/stm32/Kconfig.periph @@ -1002,7 +1002,7 @@ config STM32_SDMMC1 select ARCH_HAVE_SDIO if !ARCH_CHIP_STM32U5 select ARCH_HAVE_SDIOWAIT_WRCOMPLETE if !ARCH_CHIP_STM32U5 select ARCH_HAVE_SDIO_PREFLIGHT if !ARCH_CHIP_STM32U5 - select SDIO_BLOCKSETUP if STM32_COMMON_F7_H7 + select SDIO_BLOCKSETUP if STM32_COMMON_F7_H7 || STM32_HAVE_IP_SDMMC_V2 select STM32_SAI1PLL if ARCH_CHIP_STM32L4 config STM32_SDMMC2 diff --git a/arch/arm/src/common/stm32/Kconfig.sdio b/arch/arm/src/common/stm32/Kconfig.sdio index f38fc8dd6fb..a1c8b9cc310 100644 --- a/arch/arm/src/common/stm32/Kconfig.sdio +++ b/arch/arm/src/common/stm32/Kconfig.sdio @@ -134,14 +134,14 @@ config SDMMC1_SD_HS_MODE config SDMMC1_SDIO_MODE bool "SDIO Card Support" - depends on STM32_COMMON_F7_H7_H5 && STM32_SDMMC && STM32_SDMMC1 + depends on (STM32_COMMON_F7_H7_H5 || STM32_HAVE_IP_SDMMC_V2) && STM32_SDMMC && STM32_SDMMC1 ---help--- Build in additional support needed only for SDIO cards (vs. SD memory cards) config SDMMC1_SDIO_PULLUP bool "Enable internal Pull-Ups" - depends on STM32_COMMON_F7_H7_H5 && STM32_SDMMC && STM32_SDMMC1 + depends on (STM32_COMMON_F7_H7_H5 || STM32_HAVE_IP_SDMMC_V2) && STM32_SDMMC && STM32_SDMMC1 ---help--- If you are using an external SDCard module that does not have the pull-up resistors for the SDIO interface (like the Gadgeteer SD Card @@ -150,7 +150,7 @@ config SDMMC1_SDIO_PULLUP config SDMMC2_WIDTH_D1_ONLY bool "Use D1 only on SDMMC2" - depends on STM32_COMMON_F7_H7_H5 && STM32_SDMMC && STM32_SDMMC2 + depends on (STM32_COMMON_F7_H7_H5 || STM32_HAVE_IP_SDMMC_V2) && STM32_SDMMC && STM32_SDMMC2 ---help--- Select 1-bit transfer mode. Default: 4-bit transfer mode. @@ -168,14 +168,14 @@ config SDMMC2_SD_HS_MODE config SDMMC2_SDIO_MODE bool "SDIO Card Support" - depends on STM32_COMMON_F7_H7_H5 && STM32_SDMMC && STM32_SDMMC2 + depends on (STM32_COMMON_F7_H7_H5 || STM32_HAVE_IP_SDMMC_V2) && STM32_SDMMC && STM32_SDMMC2 ---help--- Build in additional support needed only for SDIO cards (vs. SD memory cards) config SDMMC2_SDIO_PULLUP bool "Enable internal Pull-Ups" - depends on STM32_COMMON_F7_H7_H5 && STM32_SDMMC && STM32_SDMMC2 + depends on (STM32_COMMON_F7_H7_H5 || STM32_HAVE_IP_SDMMC_V2) && STM32_SDMMC && STM32_SDMMC2 ---help--- If you are using an external SDCard module that does not have the pull-up resistors for the SDIO interface (like the Gadgeteer SD Card diff --git a/arch/arm/src/stm32n6/Kconfig b/arch/arm/src/stm32n6/Kconfig index 508ba13920d..05433fb844d 100644 --- a/arch/arm/src/stm32n6/Kconfig +++ b/arch/arm/src/stm32n6/Kconfig @@ -43,6 +43,7 @@ config STM32_N6_PERIPHERALS select STM32_HAVE_IP_LTDC_V2 select STM32_HAVE_IP_RNG_V1 select STM32_HAVE_IP_RTCC_M33M55_V1 + select STM32_HAVE_IP_SDMMC_V2 select STM32_HAVE_IP_SPI_V5 select STM32_HAVE_IP_WDG_V3 select STM32_HAVE_DMA1 @@ -66,6 +67,8 @@ config STM32_N6_PERIPHERALS select STM32_HAVE_RTC select STM32_HAVE_RTC_MAGIC select STM32_HAVE_RTC_SUBSECONDS + select STM32_HAVE_SDMMC1 + select STM32_HAVE_SDMMC2 select STM32_HAVE_SPI1 select STM32_HAVE_SPI2 select STM32_HAVE_SPI3 diff --git a/arch/arm/src/stm32n6/hardware/stm32n6xxx_memorymap.h b/arch/arm/src/stm32n6/hardware/stm32n6xxx_memorymap.h index f979cfb2a12..853967e5c53 100644 --- a/arch/arm/src/stm32n6/hardware/stm32n6xxx_memorymap.h +++ b/arch/arm/src/stm32n6/hardware/stm32n6xxx_memorymap.h @@ -42,6 +42,13 @@ #define STM32_SRAM1_BASE 0x34000000 /* SRAM1 base */ #define STM32_SRAM2_BASE 0x34100000 /* SRAM2 base */ +/* AXISRAM1-6 and the CACHEAXI RAM (Secure aliases), reachable by bus + * masters such as the SDMMC IDMA + */ + +#define STM32_AXISRAM_BASE STM32_SRAM1_BASE +#define STM32_AXISRAM_SIZE 0x00400000 + /* External Memory **********************************************************/ #define STM32_XSPI1_BANK 0x90000000 /* XSPI1 memory-mapped region */ @@ -187,6 +194,8 @@ #define STM32_DMA1_BASE STM32_GPDMA1_BASE #define STM32_DMA2_BASE STM32_HPDMA1_BASE +#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) */ #define STM32_XSPIM_BASE 0x5802B400 /* XSPIM IO Manager (AHB5, Secure) */ #define STM32_EMAC_BASE 0x58036000 /* ETH1 MAC (AHB5, Secure) */ diff --git a/arch/arm/src/stm32n6/hardware/stm32n6xxx_pinmap.h b/arch/arm/src/stm32n6/hardware/stm32n6xxx_pinmap.h index ea2b340233e..c585cd901e1 100644 --- a/arch/arm/src/stm32n6/hardware/stm32n6xxx_pinmap.h +++ b/arch/arm/src/stm32n6/hardware/stm32n6xxx_pinmap.h @@ -206,6 +206,46 @@ #define GPIO_LTDC_VSYNC_3 (GPIO_ALT | GPIO_AF14 | GPIO_PUSHPULL | GPIO_PORTF | GPIO_PIN7) #define GPIO_LTDC_VSYNC_4 (GPIO_ALT | GPIO_AF10 | GPIO_PUSHPULL | GPIO_PORTG | GPIO_PIN0) +/* SDMMC1 */ + +#define GPIO_SDMMC1_CDIR_1 (GPIO_ALT | GPIO_AF12 | GPIO_PUSHPULL | GPIO_PORTC | GPIO_PIN1) +#define GPIO_SDMMC1_CK_1 (GPIO_ALT | GPIO_AF10 | GPIO_PUSHPULL | GPIO_PORTC | GPIO_PIN12) +#define GPIO_SDMMC1_CKIN_1 (GPIO_ALT | GPIO_AF12 | GPIO_PUSHPULL | GPIO_PORTH | GPIO_PIN9) +#define GPIO_SDMMC1_CMD_1 (GPIO_ALT | GPIO_AF10 | GPIO_PUSHPULL | GPIO_PORTH | GPIO_PIN2) +#define GPIO_SDMMC1_D0_1 (GPIO_ALT | GPIO_AF10 | GPIO_PUSHPULL | GPIO_PORTC | GPIO_PIN8) +#define GPIO_SDMMC1_D0_2 (GPIO_ALT | GPIO_AF10 | GPIO_PUSHPULL | GPIO_PORTD | GPIO_PIN11) +#define GPIO_SDMMC1_D0_3 (GPIO_ALT | GPIO_AF10 | GPIO_PUSHPULL | GPIO_PORTE | GPIO_PIN15) +#define GPIO_SDMMC1_D0DIR_1 (GPIO_ALT | GPIO_AF12 | GPIO_PUSHPULL | GPIO_PORTC | GPIO_PIN6) +#define GPIO_SDMMC1_D1_1 (GPIO_ALT | GPIO_AF10 | GPIO_PUSHPULL | GPIO_PORTC | GPIO_PIN9) +#define GPIO_SDMMC1_D123DIR_1 (GPIO_ALT | GPIO_AF12 | GPIO_PUSHPULL | GPIO_PORTC | GPIO_PIN7) +#define GPIO_SDMMC1_D2_1 (GPIO_ALT | GPIO_AF10 | GPIO_PUSHPULL | GPIO_PORTC | GPIO_PIN10) +#define GPIO_SDMMC1_D3_1 (GPIO_ALT | GPIO_AF10 | GPIO_PUSHPULL | GPIO_PORTC | GPIO_PIN11) +#define GPIO_SDMMC1_D4_1 (GPIO_ALT | GPIO_AF10 | GPIO_PUSHPULL | GPIO_PORTH | GPIO_PIN9) +#define GPIO_SDMMC1_D5_1 (GPIO_ALT | GPIO_AF10 | GPIO_PUSHPULL | GPIO_PORTC | GPIO_PIN1) +#define GPIO_SDMMC1_D6_1 (GPIO_ALT | GPIO_AF10 | GPIO_PUSHPULL | GPIO_PORTC | GPIO_PIN6) +#define GPIO_SDMMC1_D7_1 (GPIO_ALT | GPIO_AF10 | GPIO_PUSHPULL | GPIO_PORTC | GPIO_PIN7) + +/* SDMMC2 */ + +#define GPIO_SDMMC2_CK_1 (GPIO_ALT | GPIO_AF11 | GPIO_PUSHPULL | GPIO_PORTC | GPIO_PIN2) +#define GPIO_SDMMC2_CK_2 (GPIO_ALT | GPIO_AF11 | GPIO_PUSHPULL | GPIO_PORTD | GPIO_PIN2) +#define GPIO_SDMMC2_CMD_1 (GPIO_ALT | GPIO_AF11 | GPIO_PUSHPULL | GPIO_PORTA | GPIO_PIN0) +#define GPIO_SDMMC2_CMD_2 (GPIO_ALT | GPIO_AF11 | GPIO_PUSHPULL | GPIO_PORTC | GPIO_PIN3) +#define GPIO_SDMMC2_D0_1 (GPIO_ALT | GPIO_AF11 | GPIO_PUSHPULL | GPIO_PORTB | GPIO_PIN8) +#define GPIO_SDMMC2_D0_2 (GPIO_ALT | GPIO_AF11 | GPIO_PUSHPULL | GPIO_PORTC | GPIO_PIN4) +#define GPIO_SDMMC2_D1_1 (GPIO_ALT | GPIO_AF11 | GPIO_PUSHPULL | GPIO_PORTC | GPIO_PIN5) +#define GPIO_SDMMC2_D1_2 (GPIO_ALT | GPIO_AF11 | GPIO_PUSHPULL | GPIO_PORTG | GPIO_PIN8) +#define GPIO_SDMMC2_D2_1 (GPIO_ALT | GPIO_AF11 | GPIO_PUSHPULL | GPIO_PORTB | GPIO_PIN9) +#define GPIO_SDMMC2_D2_2 (GPIO_ALT | GPIO_AF11 | GPIO_PUSHPULL | GPIO_PORTC | GPIO_PIN0) +#define GPIO_SDMMC2_D3_1 (GPIO_ALT | GPIO_AF11 | GPIO_PUSHPULL | GPIO_PORTB | GPIO_PIN4) +#define GPIO_SDMMC2_D3_2 (GPIO_ALT | GPIO_AF11 | GPIO_PUSHPULL | GPIO_PORTE | GPIO_PIN4) +#define GPIO_SDMMC2_D4_1 (GPIO_ALT | GPIO_AF11 | GPIO_PUSHPULL | GPIO_PORTH | GPIO_PIN9) +#define GPIO_SDMMC2_D5_1 (GPIO_ALT | GPIO_AF11 | GPIO_PUSHPULL | GPIO_PORTC | GPIO_PIN1) +#define GPIO_SDMMC2_D6_1 (GPIO_ALT | GPIO_AF11 | GPIO_PUSHPULL | GPIO_PORTB | GPIO_PIN13) +#define GPIO_SDMMC2_D6_2 (GPIO_ALT | GPIO_AF11 | GPIO_PUSHPULL | GPIO_PORTC | GPIO_PIN6) +#define GPIO_SDMMC2_D7_1 (GPIO_ALT | GPIO_AF11 | GPIO_PUSHPULL | GPIO_PORTC | GPIO_PIN7) +#define GPIO_SDMMC2_D7_2 (GPIO_ALT | GPIO_AF11 | GPIO_PUSHPULL | GPIO_PORTD | GPIO_PIN5) + /* SPI1 */ #define GPIO_SPI1_MISO_1 (GPIO_ALT | GPIO_AF5 | GPIO_PORTA | GPIO_PIN6) diff --git a/arch/arm/src/stm32n6/hardware/stm32n6xxx_rifsc.h b/arch/arm/src/stm32n6/hardware/stm32n6xxx_rifsc.h index 90858d5d1dd..e9a9124d81b 100644 --- a/arch/arm/src/stm32n6/hardware/stm32n6xxx_rifsc.h +++ b/arch/arm/src/stm32n6/hardware/stm32n6xxx_rifsc.h @@ -88,6 +88,8 @@ #define RIFSC_PERIPH_REG(p) ((p) >> 5) #define RIFSC_PERIPH_BIT(p) (1 << ((p) & 31)) +#define RIFSC_PERIPH_SDMMC1 (1 * 32 + 21) +#define RIFSC_PERIPH_SDMMC2 (1 * 32 + 22) #define RIFSC_PERIPH_ETH1 (1 * 32 + 28) #define RIFSC_PERIPH_LTDC (3 * 32 + 6) #define RIFSC_PERIPH_LTDCL1 (3 * 32 + 7) diff --git a/arch/arm/src/stm32n6/hardware/stm32n6xxx_syscfg.h b/arch/arm/src/stm32n6/hardware/stm32n6xxx_syscfg.h index 69fae56af1c..98494990bc9 100644 --- a/arch/arm/src/stm32n6/hardware/stm32n6xxx_syscfg.h +++ b/arch/arm/src/stm32n6/hardware/stm32n6xxx_syscfg.h @@ -37,6 +37,7 @@ /* Register Offsets *********************************************************/ #define STM32_SYSCFG_INITSVTORCR_OFFSET 0x010 /* Secure vector table base address register */ +#define STM32_SYSCFG_VDDIO5CCCR_OFFSET 0x04c /* VDDIO5 compensation cell control register */ #define STM32_SYSCFG_VDDIO2CCCR_OFFSET 0x054 /* VDDIO2 compensation cell control register */ #define STM32_SYSCFG_VDDIO3CCCR_OFFSET 0x05c /* VDDIO3 compensation cell control register */ #define STM32_SYSCFG_VDDCCCR_OFFSET 0x064 /* VDD compensation cell control register */ @@ -44,6 +45,7 @@ /* Register Addresses *******************************************************/ #define STM32_SYSCFG_INITSVTORCR (STM32_SYSCFG_BASE + STM32_SYSCFG_INITSVTORCR_OFFSET) +#define STM32_SYSCFG_VDDIO5CCCR (STM32_SYSCFG_BASE + STM32_SYSCFG_VDDIO5CCCR_OFFSET) #define STM32_SYSCFG_VDDIO2CCCR (STM32_SYSCFG_BASE + STM32_SYSCFG_VDDIO2CCCR_OFFSET) #define STM32_SYSCFG_VDDIO3CCCR (STM32_SYSCFG_BASE + STM32_SYSCFG_VDDIO3CCCR_OFFSET) #define STM32_SYSCFG_VDDCCCR (STM32_SYSCFG_BASE + STM32_SYSCFG_VDDCCCR_OFFSET) diff --git a/arch/arm/src/stm32n6/stm32.h b/arch/arm/src/stm32n6/stm32.h index 1e97208baf5..2669e69236f 100644 --- a/arch/arm/src/stm32n6/stm32.h +++ b/arch/arm/src/stm32n6/stm32.h @@ -41,6 +41,7 @@ #include "stm32_lowputc.h" #include "stm32_pwr.h" #include "stm32_rcc.h" +#include "stm32_sdmmc.h" #include "stm32_spi.h" #include "stm32_uart.h" diff --git a/arch/arm/src/stm32n6/stm32_rif.c b/arch/arm/src/stm32n6/stm32_rif.c index 60935b7b98e..16a607de9e8 100644 --- a/arch/arm/src/stm32n6/stm32_rif.c +++ b/arch/arm/src/stm32n6/stm32_rif.c @@ -99,4 +99,16 @@ void stm32_rifconfig(void) rif_setslave_secpriv(RIFSC_PERIPH_LTDCL1); rif_setslave_secpriv(RIFSC_PERIPH_LTDCL2); #endif + +#ifdef CONFIG_STM32_SDMMC1 + /* The SDMMC IDMA reads and writes buffers in Secure AXISRAM */ + + rif_setmaster(RIFSC_MASTER_SDMMC1, RIF_MASTER_CID1_SEC_PRIV); + rif_setslave_secpriv(RIFSC_PERIPH_SDMMC1); +#endif + +#ifdef CONFIG_STM32_SDMMC2 + rif_setmaster(RIFSC_MASTER_SDMMC2, RIF_MASTER_CID1_SEC_PRIV); + rif_setslave_secpriv(RIFSC_PERIPH_SDMMC2); +#endif } diff --git a/arch/arm/src/stm32n6/stm32.h b/arch/arm/src/stm32n6/stm32_sdmmc_chip.h similarity index 66% copy from arch/arm/src/stm32n6/stm32.h copy to arch/arm/src/stm32n6/stm32_sdmmc_chip.h index 1e97208baf5..d5eb56c5c24 100644 --- a/arch/arm/src/stm32n6/stm32.h +++ b/arch/arm/src/stm32n6/stm32_sdmmc_chip.h @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/stm32n6/stm32.h + * arch/arm/src/stm32n6/stm32_sdmmc_chip.h * * SPDX-License-Identifier: Apache-2.0 * @@ -20,28 +20,26 @@ * ****************************************************************************/ -#ifndef __ARCH_ARM_SRC_STM32N6_STM32_H -#define __ARCH_ARM_SRC_STM32N6_STM32_H +#ifndef __ARCH_ARM_SRC_STM32N6_STM32_SDMMC_CHIP_H +#define __ARCH_ARM_SRC_STM32N6_STM32_SDMMC_CHIP_H /**************************************************************************** * Included Files ****************************************************************************/ #include <nuttx/config.h> -#include <sys/types.h> -#include <stdint.h> -#include <stdbool.h> -#include "arm_internal.h" +#include "chip.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ -/* Peripherals **************************************************************/ +/* Memory that the SDMMC IDMA can access: the AXI SRAM. board.h provides + * the kernel clock frequency STM32_SDMMC_CLK. + */ -#include "chip.h" -#include "stm32_gpio.h" -#include "stm32_lowputc.h" -#include "stm32_pwr.h" -#include "stm32_rcc.h" -#include "stm32_spi.h" -#include "stm32_uart.h" - -#endif /* __ARCH_ARM_SRC_STM32N6_STM32_H */ +#define STM32_SDMMC_IDMA_RAM_START STM32_AXISRAM_BASE +#define STM32_SDMMC_IDMA_RAM_END (STM32_AXISRAM_BASE + STM32_AXISRAM_SIZE) + +#endif /* __ARCH_ARM_SRC_STM32N6_STM32_SDMMC_CHIP_H */ diff --git a/arch/arm/src/stm32n6/stm32_start.c b/arch/arm/src/stm32n6/stm32_start.c index 1dfa2540200..e0bcd928227 100644 --- a/arch/arm/src/stm32n6/stm32_start.c +++ b/arch/arm/src/stm32n6/stm32_start.c @@ -320,15 +320,25 @@ void __start_c(void) stm32_pwr_enablevddio(BOARD_PWR_VDDIO); + /* VDDIO5 (SDMMC2 pads) is validated in PWR SVMCR2 when the board + * provides BOARD_PWR_VDDIO5 (PWR_SVMCR2_* bits). + */ + +#ifdef BOARD_PWR_VDDIO5 + modifyreg32(STM32_PWR_SVMCR2, 0, BOARD_PWR_VDDIO5); +#endif + /* Apply the ES0620 I/O-compensation mitigation (write 0x287) to the - * domains we use. Only VDDIO2 and VDDIO3 are touched: the other - * VDDIOxCCCR registers cannot be accessed without their VDDIOxSV bit - * set first (separate ES0620 erratum), and only VDDIO2/3 are declared - * supply-valid in BOARD_PWR_VDDIO above. + * domains we use. Only VDDIO2, VDDIO3 and the board's VDDIO5 are + * touched: the other VDDIOxCCCR registers cannot be accessed without + * their VDDIOxSV bit set first (separate ES0620 erratum). */ putreg32(SYSCFG_CCCR_ES0620_MANUAL, STM32_SYSCFG_VDDIO2CCCR); putreg32(SYSCFG_CCCR_ES0620_MANUAL, STM32_SYSCFG_VDDIO3CCCR); +#ifdef BOARD_PWR_VDDIO5 + putreg32(SYSCFG_CCCR_ES0620_MANUAL, STM32_SYSCFG_VDDIO5CCCR); +#endif putreg32(SYSCFG_CCCR_ES0620_MANUAL, STM32_SYSCFG_VDDCCCR); putreg32((uint32_t)_vectors, STM32_SYSCFG_INITSVTORCR); diff --git a/arch/arm/src/stm32n6/stm32n6xx_rcc.c b/arch/arm/src/stm32n6/stm32n6xx_rcc.c index ed197bd4bcf..164e97399f7 100644 --- a/arch/arm/src/stm32n6/stm32n6xx_rcc.c +++ b/arch/arm/src/stm32n6/stm32n6xx_rcc.c @@ -318,6 +318,14 @@ static inline void rcc_enableahb5(void) regval |= RCC_AHB5ENR_HPDMA1EN; #endif +#ifdef CONFIG_STM32_SDMMC1 + regval |= RCC_AHB5ENR_SDMMC1EN; +#endif + +#ifdef CONFIG_STM32_SDMMC2 + regval |= RCC_AHB5ENR_SDMMC2EN; +#endif + #ifdef CONFIG_STM32_ETHMAC /* ETH1 bus, MAC, TX and RX clocks */
