[PATCH] mmc: rtsx: usb add 100ms delay before power on

Ricky Wu posted 1 patch 7 months, 3 weeks ago
drivers/mmc/host/rtsx_usb_sdmmc.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] mmc: rtsx: usb add 100ms delay before power on
Posted by Ricky Wu 7 months, 3 weeks ago
this delay make sure the last time power off did the discharge clean.
During the card recognition process, card power will be toggled in 1ms,
and 1ms is not enough to discharge cleanly

Signed-off-by: Ricky Wu <ricky_wu@realtek.com>
---
 drivers/mmc/host/rtsx_usb_sdmmc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mmc/host/rtsx_usb_sdmmc.c b/drivers/mmc/host/rtsx_usb_sdmmc.c
index 1edfe2acf809..e5820b2bb380 100644
--- a/drivers/mmc/host/rtsx_usb_sdmmc.c
+++ b/drivers/mmc/host/rtsx_usb_sdmmc.c
@@ -952,6 +952,8 @@ static int sd_power_on(struct rtsx_usb_sdmmc *host)
 	struct rtsx_ucr *ucr = host->ucr;
 	int err;
 
+	msleep(100);
+
 	dev_dbg(sdmmc_dev(host), "%s\n", __func__);
 	rtsx_usb_init_cmd(ucr);
 	rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_SELECT, 0x07, SD_MOD_SEL);
-- 
2.25.1

Re: [PATCH] mmc: rtsx: usb add 100ms delay before power on
Posted by Ulf Hansson 7 months, 2 weeks ago
On Mon, 21 Apr 2025 at 05:15, Ricky Wu <ricky_wu@realtek.com> wrote:
>
> this delay make sure the last time power off did the discharge clean.
> During the card recognition process, card power will be toggled in 1ms,
> and 1ms is not enough to discharge cleanly
>
> Signed-off-by: Ricky Wu <ricky_wu@realtek.com>
> ---
>  drivers/mmc/host/rtsx_usb_sdmmc.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mmc/host/rtsx_usb_sdmmc.c b/drivers/mmc/host/rtsx_usb_sdmmc.c
> index 1edfe2acf809..e5820b2bb380 100644
> --- a/drivers/mmc/host/rtsx_usb_sdmmc.c
> +++ b/drivers/mmc/host/rtsx_usb_sdmmc.c
> @@ -952,6 +952,8 @@ static int sd_power_on(struct rtsx_usb_sdmmc *host)
>         struct rtsx_ucr *ucr = host->ucr;
>         int err;
>
> +       msleep(100);
> +

Wouldn't it be better to do this at power-off instead then? Otherwise
you may end up adding 100ms at card-initialization even if the card
has been off for a long time?

Or maybe this is because we are worried about bootloaders turning on
the card and leaving it in that state when the kernel boots?

>         dev_dbg(sdmmc_dev(host), "%s\n", __func__);
>         rtsx_usb_init_cmd(ucr);
>         rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_SELECT, 0x07, SD_MOD_SEL);
> --
> 2.25.1
>

Kind regards
Uffe