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 2c7707f07853660ade3cdb1d3e333f77ae3721fb Author: alexklimaj <[email protected]> AuthorDate: Thu Oct 22 17:13:43 2026 -0600 arch/arm/stm32: Report 4-bit SD bus capability. Since commit 975d99c3f61 ("drivers/mmcsd/mmcsd_sdio.c: Fix SD card 4-bit support"), mmcsd_sdinitialize() only switches an SD card to the 4-bit bus when the host reports SDIO_CAPS_4BIT. The STM32 SDIO and SDMMC drivers never report it, so SD cards on STM32 run on a 1-bit bus. On an STM32H743 this cut sequential write throughput from 1.9 MB/s to 1.1 MB/s with 4 KiB writes, and from 4.1 MB/s to 1.5 MB/s with 16 KiB writes. Report SDIO_CAPS_4BIT unless the slot is limited to 1-bit operation (CONFIG_STM32_SDIO_WIDTH_D1_ONLY on F1/F2/F4, the onebit flag on the SDMMC drivers). mmcsd_widebus() still checks the card's SCR before it selects the 4-bit bus. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: alexklimaj <[email protected]> --- arch/arm/src/common/stm32/stm32_sdio_m3m4_v1.c | 2 ++ arch/arm/src/stm32f7/stm32_sdmmc.c | 4 ++++ arch/arm/src/stm32h5/stm32_sdmmc.c | 4 ++++ arch/arm/src/stm32h7/stm32_sdmmc.c | 4 ++++ arch/arm/src/stm32l4/stm32l4_sdmmc.c | 4 ++++ 5 files changed, 18 insertions(+) diff --git a/arch/arm/src/common/stm32/stm32_sdio_m3m4_v1.c b/arch/arm/src/common/stm32/stm32_sdio_m3m4_v1.c index b0fc0701e80..3cc95599995 100644 --- a/arch/arm/src/common/stm32/stm32_sdio_m3m4_v1.c +++ b/arch/arm/src/common/stm32/stm32_sdio_m3m4_v1.c @@ -1689,6 +1689,8 @@ static sdio_capset_t stm32_capabilities(struct sdio_dev_s *dev) #ifdef CONFIG_STM32_SDIO_WIDTH_D1_ONLY caps |= SDIO_CAPS_1BIT_ONLY; +#else + caps |= SDIO_CAPS_4BIT; #endif #ifdef CONFIG_STM32_SDIO_DMA caps |= SDIO_CAPS_DMASUPPORTED; diff --git a/arch/arm/src/stm32f7/stm32_sdmmc.c b/arch/arm/src/stm32f7/stm32_sdmmc.c index 8be87aae602..68872d6fe0e 100644 --- a/arch/arm/src/stm32f7/stm32_sdmmc.c +++ b/arch/arm/src/stm32f7/stm32_sdmmc.c @@ -1948,6 +1948,10 @@ static sdio_capset_t stm32_capabilities(struct sdio_dev_s *dev) { caps |= SDIO_CAPS_1BIT_ONLY; } + else + { + caps |= SDIO_CAPS_4BIT; + } #ifdef CONFIG_STM32_SDMMC_DMA caps |= SDIO_CAPS_DMASUPPORTED; diff --git a/arch/arm/src/stm32h5/stm32_sdmmc.c b/arch/arm/src/stm32h5/stm32_sdmmc.c index e82be34f4b6..a9faa13e45c 100644 --- a/arch/arm/src/stm32h5/stm32_sdmmc.c +++ b/arch/arm/src/stm32h5/stm32_sdmmc.c @@ -2056,6 +2056,10 @@ static sdio_capset_t stm32_capabilities(struct sdio_dev_s *dev) { caps |= SDIO_CAPS_1BIT_ONLY; } + else + { + caps |= SDIO_CAPS_4BIT; + } caps |= SDIO_CAPS_DMABEFOREWRITE; diff --git a/arch/arm/src/stm32h7/stm32_sdmmc.c b/arch/arm/src/stm32h7/stm32_sdmmc.c index 433795e074b..45ba5e21ab4 100644 --- a/arch/arm/src/stm32h7/stm32_sdmmc.c +++ b/arch/arm/src/stm32h7/stm32_sdmmc.c @@ -2163,6 +2163,10 @@ static sdio_capset_t stm32_capabilities(struct sdio_dev_s *dev) { caps |= SDIO_CAPS_1BIT_ONLY; } + else + { + caps |= SDIO_CAPS_4BIT; + } caps |= SDIO_CAPS_DMABEFOREWRITE; diff --git a/arch/arm/src/stm32l4/stm32l4_sdmmc.c b/arch/arm/src/stm32l4/stm32l4_sdmmc.c index ef61898b6d0..ca252ba7e4a 100644 --- a/arch/arm/src/stm32l4/stm32l4_sdmmc.c +++ b/arch/arm/src/stm32l4/stm32l4_sdmmc.c @@ -1742,6 +1742,10 @@ static sdio_capset_t stm32_capabilities(struct sdio_dev_s *dev) { caps |= SDIO_CAPS_1BIT_ONLY; } + else + { + caps |= SDIO_CAPS_4BIT; + } #ifdef CONFIG_STM32_SDMMC_DMA caps |= SDIO_CAPS_DMASUPPORTED;
