Skip to content

Commit 827da4a

Browse files
JordanYateskartben
authored andcommitted
disk: sdmmc_stm32: support clock bypass
Add support for the SDMMC clock bypass feature for those SoCs that have it. This provides a SDMMC bus speed double that of `clk-div = <0>`. Updated the `clk-div` documentation at the same time to be clearer on how the bus clock speed is determined. Signed-off-by: Jordan Yates <[email protected]>
1 parent deb24ef commit 827da4a

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

drivers/disk/sdmmc_stm32.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,9 @@ static struct stm32_sdmmc_priv stm32_sdmmc_priv_1 = {
874874
.Instance = (MMC_TypeDef *)DT_INST_REG_ADDR(0),
875875
.Init.ClockEdge = SDMMC_CLOCK_EDGE_RISING,
876876
#ifdef SDMMC_CLOCK_BYPASS_DISABLE
877-
.Init.ClockBypass = SDMMC_CLOCK_BYPASS_DISABLE,
877+
.Init.ClockBypass = DT_INST_PROP(0, clk_bypass)
878+
? SDMMC_CLOCK_BYPASS_ENABLE
879+
: SDMMC_CLOCK_BYPASS_DISABLE,
878880
#endif
879881
.Init.ClockPowerSave = SDMMC_CLOCK_POWER_SAVE_DISABLE,
880882
.Init.BusWide = SDMMC_BUS_WIDTH,

dts/bindings/mmc/st,stm32-sdmmc.yaml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ properties:
3838
type: int
3939
default: 1
4040
description: |
41-
bus width for SDMMC access, defaults to the minimum necessary
42-
number of bus lines
41+
bus width for SDMMC access, defaults to the minimum necessary
42+
number of bus lines
4343
enum:
4444
- 1
4545
- 4
@@ -49,8 +49,17 @@ properties:
4949
type: int
5050
default: 0
5151
description: |
52-
Clock division factor for SDMMC. Typically the clock operates at 25MHz so
53-
a division factor of 2 would be 25MHz / 2 = 12.5MHz.
52+
Clock division factor for SDMMC. The relationship between this value
53+
and the output bus frequency is FREQ_BUS = SDMMMC_CLK / [CLKDIV + 2].
54+
Therefore an input clock of 25MHz and a division factor of 0 would
55+
result in a bus frequency of 25MHz / [0 + 2] = 12.5MHz.
56+
57+
clk-bypass:
58+
type: boolean
59+
description: |
60+
Bypass the clock divider configured in `clk-div`, which results in the
61+
output bus frequency matching the input SDMMC_CLK. Not supported on
62+
all part numbers.
5463
5564
idma:
5665
type: boolean

0 commit comments

Comments
 (0)