U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/1] mmc: core: Add power-off-delay-us support for slow RC discharge
@ 2026-09-08 20:11 Judith Mendez
  2026-09-08 20:11 ` [PATCH v2 1/1] " Judith Mendez
  0 siblings, 1 reply; 2+ messages in thread
From: Judith Mendez @ 2026-09-08 20:11 UTC (permalink / raw)
  To: Judith Mendez, Peng Fan, Jaehoon Chung, Tom Rini; +Cc: Tanmay Kathpalia, u-boot

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/d17a810c-e2db-4a24-a37d-2d7e02466ce9@ti.com/
[2] https://lore.kernel.org/linux-mmc/20260806162202.657512-1-jm@ti.com/
[3] https://lore.kernel.org/linux-devicetree/20260908170635.238775-1-jm@ti.com/

Link to v1:
[1] https://lore.kernel.org/u-boot/20260710230409.147210-1-jm@ti.com/

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(+)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH v2 1/1] mmc: core: Add power-off-delay-us support for slow RC discharge
  2026-09-08 20:11 [PATCH v2 0/1] mmc: core: Add power-off-delay-us support for slow RC discharge Judith Mendez
@ 2026-09-08 20:11 ` Judith Mendez
  0 siblings, 0 replies; 2+ messages in thread
From: Judith Mendez @ 2026-09-08 20:11 UTC (permalink / raw)
  To: Judith Mendez, Peng Fan, Jaehoon Chung, Tom Rini; +Cc: Tanmay Kathpalia, u-boot

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.

Signed-off-by: Judith Mendez <jm@ti.com>
---
 drivers/mmc/mmc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 670e92ee12b..4adcf424195 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -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;
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-08 20:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-08 20:11 [PATCH v2 0/1] mmc: core: Add power-off-delay-us support for slow RC discharge Judith Mendez
2026-09-08 20:11 ` [PATCH v2 1/1] " Judith Mendez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox