Skip to content

Commit 7d7d6f6

Browse files
committed
drivers: disk: sdmmc_stm32: Add compatibility macros for STM32F4 SDIO
Add compatibility macros to map SDMMC constants to SDIO equivalents for STM32F4 series MCUs. STM32F4 uses SDIO peripheral with SDIO_* constants while newer STM32F7/H7 series use SDMMC peripheral with SDMMC_* constants. This fixes compilation errors on STM32F4 platforms where SDMMC_* constants are undefined: - SDMMC_CLOCK_EDGE_RISING - SDMMC_CLOCK_BYPASS_ENABLE/DISABLE - SDMMC_CLOCK_POWER_SAVE_ENABLE/DISABLE - SDMMC_HARDWARE_FLOW_CONTROL_DISABLE Fixes Fixes #94896 Signed-off-by: Shan Pen <[email protected]>
1 parent 5945a3f commit 7d7d6f6

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

drivers/disk/sdmmc_stm32.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,22 @@ LOG_MODULE_REGISTER(stm32_sdmmc, CONFIG_SDMMC_LOG_LEVEL);
4747
#define SDMMC_BUS_WIDE_8B SDIO_BUS_WIDE_8B
4848
#endif
4949

50+
#ifndef SDMMC_CLOCK_EDGE_RISING
51+
#define SDMMC_CLOCK_EDGE_RISING SDIO_CLOCK_EDGE_RISING
52+
#endif
53+
54+
#ifndef SDMMC_CLOCK_POWER_SAVE_ENABLE
55+
#define SDMMC_CLOCK_POWER_SAVE_ENABLE SDIO_CLOCK_POWER_SAVE_ENABLE
56+
#endif
57+
58+
#ifndef SDMMC_CLOCK_POWER_SAVE_DISABLE
59+
#define SDMMC_CLOCK_POWER_SAVE_DISABLE SDIO_CLOCK_POWER_SAVE_DISABLE
60+
#endif
61+
62+
#ifndef SDMMC_HARDWARE_FLOW_CONTROL_DISABLE
63+
#define SDMMC_HARDWARE_FLOW_CONTROL_DISABLE SDIO_HARDWARE_FLOW_CONTROL_DISABLE
64+
#endif
65+
5066
typedef void (*irq_config_func_t)(const struct device *dev);
5167

5268
#if STM32_SDMMC_USE_DMA
@@ -881,6 +897,11 @@ static struct stm32_sdmmc_priv stm32_sdmmc_priv_1 = {
881897
.hsd = {
882898
.Instance = (MMC_TypeDef *)DT_INST_REG_ADDR(0),
883899
.Init.ClockEdge = SDMMC_CLOCK_EDGE_RISING,
900+
#ifdef SDIO_CLOCK_BYPASS_DISABLE
901+
.Init.ClockBypass = DT_INST_PROP(0, clk_bypass)
902+
? SDIO_CLOCK_BYPASS_ENABLE
903+
: SDIO_CLOCK_BYPASS_DISABLE,
904+
#endif
884905
#ifdef SDMMC_CLOCK_BYPASS_DISABLE
885906
.Init.ClockBypass = DT_INST_PROP(0, clk_bypass)
886907
? SDMMC_CLOCK_BYPASS_ENABLE

0 commit comments

Comments
 (0)