From 840c97676086f0f1e25ab06ab2d30085a329c022 Mon Sep 17 00:00:00 2001 From: Maxmillion McLaughlin Date: Tue, 11 Apr 2023 18:37:38 -0600 Subject: [PATCH] drivers: disk: sdmmc_stm32 support for clock divisor Adds support for a devicetree property that controls the ClockDiv value provided to the SDIO during init. Signed-off-by: Maxmillion McLaughlin --- drivers/disk/sdmmc_stm32.c | 3 +++ dts/bindings/mmc/st,stm32-sdmmc.yaml | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/drivers/disk/sdmmc_stm32.c b/drivers/disk/sdmmc_stm32.c index ecc6182c21..b20887d883 100644 --- a/drivers/disk/sdmmc_stm32.c +++ b/drivers/disk/sdmmc_stm32.c @@ -689,6 +689,9 @@ static struct stm32_sdmmc_priv stm32_sdmmc_priv_1 = { .hsd = { .Instance = (MMC_TypeDef *)DT_INST_REG_ADDR(0), .Init.BusWide = SDMMC_BUS_WIDTH, +#if DT_INST_NODE_HAS_PROP(0, clk_div) + .Init.ClockDiv = DT_INST_PROP(0, clk_div), +#endif }, #if DT_INST_NODE_HAS_PROP(0, cd_gpios) .cd = GPIO_DT_SPEC_INST_GET(0, cd_gpios), diff --git a/dts/bindings/mmc/st,stm32-sdmmc.yaml b/dts/bindings/mmc/st,stm32-sdmmc.yaml index 615ec99f1d..7071b44be1 100644 --- a/dts/bindings/mmc/st,stm32-sdmmc.yaml +++ b/dts/bindings/mmc/st,stm32-sdmmc.yaml @@ -39,6 +39,13 @@ properties: - 4 - 8 + clk-div: + type: int + default: 0 + description: | + Clock division factor for SDMMC. Typically the clock operates at 25MHz so + a division factor of 2 would be 25MHz / 2 = 12.5MHz. + idma: type: boolean description: |