public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Christoph Stoidner <c.stoidner@phytec.de>
To: <u-boot@lists.denx.de>
Cc: Christoph Stoidner <c.stoidner@phytec.de>,
	Peng Fan <peng.fan@nxp.com>,
	Jaehoon Chung <jh80.chung@samsung.com>
Subject: [PATCH] mmc: Fix missing 1 ms delay after mmc power up
Date: Fri, 31 Oct 2025 15:59:51 +0100	[thread overview]
Message-ID: <20251031145951.535376-1-c.stoidner@phytec.de> (raw)

mmc/sd specification requires a 1 ms delay (stable supply voltage)
after vdd was enabled and before issuing first command.

For most sdcard/soc combinations, the missing delay seems to be not a
problem because the processing time between enabling vdd and the first
command is often hundreds of microseconds or more. However, in our
specific case, some sdcards were not detected by u-boot:
* soc: NXP i.MX 93
* sdcards: SanDisk Ultra, 64GB micro SDXC 1,
           MediaRange, 8GB, SDHC
* measured time between vdd and first command: approx. 784us
* symptom: both sdcards did not respond at all to first commands,
           u-boot mmc subsystem ran into timeout and stops to
           initialize the cards

Signed-off-by: Christoph Stoidner <c.stoidner@phytec.de>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/mmc.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index ec61ed92e86..2093d169094 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -2878,11 +2878,18 @@ static int mmc_power_cycle(struct mmc *mmc)
 		return ret;
 
 	/*
-	 * SD spec recommends at least 1ms of delay. Let's wait for 2ms
-	 * to be on the safer side.
+	 * SD spec recommends at least 1ms of 'power on' delay.
+	 * Let's wait for 2ms to be on the safer side.
 	 */
 	udelay(2000);
-	return mmc_power_on(mmc);
+	ret = mmc_power_on(mmc);
+
+	/*
+	 * SD spec recommends at least 1ms of 'stable supply voltage' delay.
+	 * Let's wait for 2ms to be on the safer side.
+	 */
+	udelay(2000);
+	return ret;
 }
 
 int mmc_get_op_cond(struct mmc *mmc, bool quiet)
-- 
2.43.0


             reply	other threads:[~2025-10-31 15:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-31 14:59 Christoph Stoidner [this message]
2025-11-04  8:34 ` [PATCH] mmc: Fix missing 1 ms delay after mmc power up Peng Fan
2025-11-10 20:46   ` AW: " Christoph Stoidner
2025-11-18  4:56     ` Peng Fan
2025-11-28 12:38       ` Christoph Stoidner
2026-01-05  2:49         ` Peng Fan
     [not found] ` <a41edf4c-39f5-432e-8eeb-9426dba89a17@freeshell.de>
     [not found]   ` <DB9P195MB12122313AC9E54232C3B713D97CCA@DB9P195MB1212.EURP195.PROD.OUTLOOK.COM>
2025-11-12 20:25     ` E Shattow
2026-01-08 13:32 ` Peng Fan

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=20251031145951.535376-1-c.stoidner@phytec.de \
    --to=c.stoidner@phytec.de \
    --cc=jh80.chung@samsung.com \
    --cc=peng.fan@nxp.com \
    --cc=u-boot@lists.denx.de \
    /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