mmc: core: Add power-off-delay-us support for slow RC discharge
v2 cover mmc: core: Add power-off-delay-us support for slow RC discharge
Add support for power-off-delay-us DT property to handle slow RC discharge on MMC VDD rails during power cycles. SD spec (section 6.4.1.3) requires VDD below 0.5V for minimum 1ms during power cycle. AM65x EVM requires a delay of 650ms after power-off to reach below 0.5V threshold and allow proper RC discharge.
AM65 EVM power cycle issue was exposed with [0]. An initial implementation was sent [1], but would have created binding mismatch with Linux so binding update was completed first on Linux side [2]. Now that binding is established and device tree updates in progress [3], add U-Boot power-off delay capability.
[0] https://lore.kernel.org/u-boot/[email protected]/
[2] https://lore.kernel.org/linux-mmc/[email protected]/
[3] https://lore.kernel.org/linux-devicetree/[email protected]/
Link to v1:
[1] https://lore.kernel.org/u-boot/[email protected]/
Changes since v1:
- Implement delay in MMC core instead of voltage regulator driver according to binding update [2]
Judith Mendez (1):
mmc: core: Add power-off-delay-us support for slow RC discharge
drivers/mmc/mmc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
Signature · 1 line
2.34.1
PATCH v2 1/1 mmc: core: Add power-off-delay-us support for slow RC discharge
Add support for power-off-delay-us property to allow additional delay after mmc_power_off(). Boards with slow RC discharge on MMC VDD rails can use this to fully discharge the card before power-on.
Default delay is 0 (no additional delay). Boards requiring longer discharge can override via DT property power-off-delay-us in microseconds.
--- drivers/mmc/mmc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/mmc/mmc.c +8 -0
@@ -2909,6 +2909,8 @@ static int mmc_power_on(struct mmc *mmc)static int mmc_power_off (struct mmc *mmc) { +u32 delay_us =0 ; +mmc_set_clock (mmc,0 ,MMC_CLK_DISABLE );#if CONFIG_IS_ENABLED (DM_MMC ) &&CONFIG_IS_ENABLED (DM_REGULATOR )if (mmc->vmmc_supply) {
@@ -2930,6 +2932,12 @@ static int mmc_power_off(struct mmc *mmc) return ret; } } + +if (mmc->dev) +dev_read_u32 (mmc->dev,"power-off-delay-us" , &delay_us); + +if (delay_us) +udelay (delay_us);#endif return 0 ; }
Signature · 1 line
2.34.1