U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Judith Mendez <jm@ti.com>
To: Judith Mendez <jm@ti.com>, Peng Fan <peng.fan@nxp.com>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Tom Rini <trini@konsulko.com>
Cc: Tanmay Kathpalia <tanmay.kathpalia@altera.com>,
	<u-boot@lists.u-boot-project.org>
Subject: [PATCH v2 1/1] mmc: core: Add power-off-delay-us support for slow RC discharge
Date: Tue, 8 Sep 2026 15:11:46 -0500	[thread overview]
Message-ID: <20260908201146.532645-2-jm@ti.com> (raw)
In-Reply-To: <20260908201146.532645-1-jm@ti.com>

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


      reply	other threads:[~2026-09-08 20:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260908201146.532645-2-jm@ti.com \
    --to=jm@ti.com \
    --cc=jh80.chung@samsung.com \
    --cc=peng.fan@nxp.com \
    --cc=tanmay.kathpalia@altera.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.u-boot-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox