mmc: Fix missing 1 ms delay after mmc power up
PATCH 1/1 mmc: Fix missing 1 ms delay after mmc power up
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
--- drivers/mmc/mmc.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/mmc/mmc.c +10 -3
@@ -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)
Signature · 1 line
2.43.0
Hi Christoph
Thanks for your patch.
Quoted 1 line
Subject: [PATCH] mmc: Fix missing 1 ms delay after mmc power up
...
Quoted 20 lines
drivers/mmc/mmc.c +0
-1@@ -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
drivers/mmc/mmc.c +6
-2-* 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.
drivers/mmc/mmc.c static int mmc_power_cycle(struct mmc *mmc) · line 2891
Quoted 3 lines
drivers/mmc/mmc.c +3
-0+* Let's wait for 2ms to be on the safer side. +*/ +udelay (2000 );
Per spec,
From Figure 6-4: Power-up Diagram of Card
the 1ms is voltageSupply ramp up time, so I am thinking the fix should be in your regulator side, saying startup-delay-us property in your regulator node.
Thanks,
Peng.
Quoted 6 lines
drivers/mmc/mmc.c +1
-1+return ret; }int mmc_get_op_cond (struct mmc *mmc,bool quiet) --2.43.0
Hi Peng, thanks for your feedback.
Quoted 5 lines
Hi Christoph
Thanks for your patch.
Quoted 1 line
Subject: [PATCH] mmc: Fix missing 1 ms delay after mmc power up
...
Quoted 7 lines
Quoted 1 line
+ udelay(2000);
Per spec,
From Figure 6-4: Power-up Diagram of Card
the 1ms is voltageSupply ramp up time, so I am thinking the fix should be in your regulator side, saying startup-delay-us property in your regulator node.
True, this could also be handled via the regulator’s DTS properties, and some boards already do that. However, from my point of view, that’s not the right place for this particular delay.
The SD specification distinguishes between two different delays (see Figure 6-5 “Power-Up Diagram (Host)” in SD Spec 6.00, §6.4.1):
1) "Power ramp up"
2) "Stable voltage delay"
The first one (power ramp up) is regulator-specific and should indeed be covered by the regulator’s startup-delay-us property in the device tree. But this patch is about the second one - the "stable voltage delay".
That delay is completely independent of any regulator/voltage-supply or board characteristics; it is a constant 1ms delay by the SD interface itself to ensure correct card initialization timing.
Decoupling it from the regulators would make board-code developers live easier, and can make U-Boot’s MMC initialization more robust across all boards.
What do you think about that?
Regards,
Christoph
Quoted 4 lines
Thanks,
Peng.Quoted 1 line
+ return ret;
...
Quoted 30 lines · Christoph Stoidner
Hi Peng, thanks for your feedback.
Quoted 5 lines
Hi Christoph
Thanks for your patch.
Quoted 1 line
Subject: [PATCH] mmc: Fix missing 1 ms delay after mmc power up
...
Quoted 7 lines
Quoted 1 line
+ udelay(2000);
Per spec,
From Figure 6-4: Power-up Diagram of Card
the 1ms is voltageSupply ramp up time, so I am thinking the fix should be in your regulator side, saying startup-delay-us property in your regulator node.True, this could also be handled via the regulator?s DTS properties, and some boards already do that. However, from my point of view, that?s not the right place for this particular delay.
The SD specification distinguishes between two different delays (see Figure 6-5 ?Power-Up Diagram (Host)? in SD Spec 6.00, ?6.4.1):
1) "Power ramp up"
2) "Stable voltage delay"The first one (power ramp up) is regulator-specific and should indeed be covered by the regulator?s startup-delay-us property in the device tree. But this patch is about the second one - the "stable voltage delay".
Quoted 8 lines
That delay is completely independent of any regulator/voltage-supply or board characteristics; it is a constant 1ms delay by the SD interface itself to ensure correct card initialization timing.
Decoupling it from the regulators would make board-code developers live easier, and can make U-Boot?s MMC initialization more robust across all boards.What do you think about that?
Sorry for late.
Thanks for explaining this, this is reasonable. I am thinking it might be better if we add ios.post_power_delay_ms for your platform.
Regards
Peng
Quoted 9 lines
Regards,
ChristophQuoted 4 lines
Thanks,
Peng.Quoted 1 line
+ return ret;
...
Hi Peng,
Quoted 47 lines · Peng Fan
Quoted 46 lines · Christoph Stoidner
Hi Peng, thanks for your feedback.
Quoted 5 lines
Hi Christoph
Thanks for your patch.
Quoted 1 line
Subject: [PATCH] mmc: Fix missing 1 ms delay after mmc power up
...
Quoted 8 lines
Quoted 1 line
+ udelay(2000);
Per spec,
From Figure 6-4: Power-up Diagram of Card
the 1ms is voltageSupply ramp up time, so I am thinking the fix should be in your regulator side, saying startup-delay-us property
in your regulator node.True, this could also be handled via the regulator?s DTS properties, and
some boards already do that. However, from my point of view, that?s not
the right place for this particular delay.The SD specification distinguishes between two different delays (see Figure 6-5 ?Power-Up Diagram (Host)? in SD Spec 6.00, ?6.4.1):
1) "Power ramp up"
2) "Stable voltage delay"The first one (power ramp up) is regulator-specific and should indeed be
covered by the regulator?s startup-delay-us property in the device tree.
But this patch is about the second one - the "stable voltage delay".That delay is completely independent of any regulator/voltage- supply or
board characteristics; it is a constant 1ms delay by the SD interface itself
to ensure correct card initialization timing. Decoupling it from the regulators would make board-code developers live easier, and can make U-Boot?s MMC initialization more robust across
all boards.
Quoted 6 lines
Quoted 1 line
What do you think about that?
Sorry for late.
Thanks for explaining this, this is reasonable. I am thinking it might be better
if we add ios.post_power_delay_ms for your platform.
you mean we should introduce the DTS property post_power_delay_ms for mmc and then use it in our platform's DTS?
But a DTS property is actually what I want to avoid, because that delay is nothing platform-specific and should be solved all for one in the mmc subsystem drivers/mmc/mmc.c itself.
What's the reason why you prefer a DTS property?
Regards,
Christoph
Quoted 13 lines
Regards
PengQuoted 9 lines
Regards,
ChristophQuoted 4 lines
Thanks,
Peng.Quoted 1 line
+ return ret;
...
Quoted 54 lines
Subject: Re: AW: [PATCH] mmc: Fix missing 1 ms delay after mmc power up
Hi Peng,
Quoted 1 line · Peng Fan
On Mon, Nov 10, 2025 at 08:46:39PM +0000, Christoph Stoidner
Quoted 7 lines · wrote:
Quoted 7 lines
Hi Peng, thanks for your feedback.
Quoted 5 lines
Hi Christoph
Thanks for your patch.
Quoted 1 line
Subject: [PATCH] mmc: Fix missing 1 ms delay after mmc power
up
Quoted 5 lines
Quoted 5 lines
...
Quoted 4 lines
Quoted 1 line
+ udelay(2000);
Per spec,
From Figure 6-4: Power-up Diagram of Card the 1ms isvoltageSupply
Quoted 18 lines
Quoted 18 lines
Quoted 2 lines
ramp up time, so I am thinking the fix should be in your regulator side, saying startup-delay-us property in your regulator node.
True, this could also be handled via the regulator?s DTS properties, and some boards already do that. However, from my point of view, that?s not the right place for this particular delay.
The SD specification distinguishes between two different delays (see Figure 6-5 ?Power-Up Diagram (Host)? in SD Spec 6.00, ?6.4.1):
1) "Power ramp up"
2) "Stable voltage delay"The first one (power ramp up) is regulator-specific and should indeed be covered by the regulator?s startup-delay-us property in the device tree.
But this patch is about the second one - the "stable voltage delay".Quoted 4 lines
Quoted 4 lines
That delay is completely independent of any regulator/voltage- supply or board characteristics; it is a constant 1ms delay by the SD interface itself to ensure correct card initialization timing. Decoupling it from the regulators would make board-code
developers
Quoted 8 lines
Quoted 4 lines
live easier, and can make U-Boot?s MMC initialization more robust across all boards.
What do you think about that?
Sorry for late.
Thanks for explaining this, this is reasonable. I am thinking it might be better if we add ios.post_power_delay_ms for your platform.
Quoted 8 lines
you mean we should introduce the DTS property
post_power_delay_msfor mmc and then use it in our platform's DTS?But a DTS property is actually what I want to avoid, because that delay is nothing platform-specific and should be solved all for one in the mmc subsystem
drivers/mmc/mmc.citself.What's the reason why you prefer a DTS property?
You message seems breaks the mail thread. So my script not able to retrieve the message thread from patchwork.
I just don't like to add delays. Reading the spec again, I am fine with your changes.
Thanks,
Peng.
Quoted 17 lines
Regards,
ChristophQuoted 13 lines
Regards
PengQuoted 9 lines
Regards,
ChristophQuoted 4 lines
Thanks,
Peng.Quoted 1 line
+ return ret;
...
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): DB9P195MB12122313AC9E54232C3B713D97CCA@DB9P195MB1212.EURP195.PROD.OUTLOOK.COM
Quoted 6 lines · Christoph Stoidner
Hello, sorry, did you send that mail only direct to me? I cannot find it in the Mailinglist.
I don't want to bother you. However would you mind to send it also to the list, to have it transparent for all?
Regards,
Christoph
Okay, sorry I missed this before. CC: U-Boot Mailing List
-E
Quoted 83 lines
________________________________
Von: E Shattow <[email protected]>
Gesendet: Freitag, 31. Oktober 2025 22:27
An: Christoph Stoidner <[email protected]>
Betreff: Re: [PATCH] mmc: Fix missing 1 ms delay after mmc power upQuoted 38 lines · Christoph Stoidner
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 cardsSigned-off-by Christoph Stoidner <[email protected]>Cc Peng Fan <[email protected]>Cc Jaehoon Chung <[email protected]>--- drivers/mmc/mmc.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)drivers/mmc/mmc.c +3
-3@@ -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);drivers/mmc/mmc.c static int mmc_power_cycle(struct mmc *mmc) · line 2895
Quoted 10 lines
drivers/mmc/mmc.c +7
-0+ +/* +* 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)Let's do what it says. Would udelay(1000) ever possibly complete faster than the recommended time in the specification ?
/*drivers/mmc/mmc.c +6
-3-* SD spec recommends at least 1ms of delay. Let's wait for 2ms -* to be on the safer side. +* SD spec requires: +* 1ms of delay 'power on' before power on +* 1ms of 'stable supply voltage' after power on */ udelay (1000 ); -return mmc_power_on (mmc); + ret =mmc_power_on (mmc); +udelay (1000 ); +return ret; }To follow the specification recommendations exactly?
Also, why add the delay before returning from
mmc_power_on()inmmc_power_cycle()and not inmmc_power_on()itself?-E
Peng Fan
AppliedQuoted 15 lines · Christoph Stoidner
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
Quoted 4 lines
Signed-off-by Christoph Stoidner <[email protected]>Cc Peng Fan <[email protected]>Cc Jaehoon Chung <[email protected]>---
Applied.
Thanks,
Peng