diff mbox series

mmc: rtsx: usb add 100ms delay before power on

Message ID 20250421031536.1173373-1-ricky_wu@realtek.com
State New
Headers show
Series mmc: rtsx: usb add 100ms delay before power on | expand

Commit Message

Ricky Wu April 21, 2025, 3:15 a.m. UTC
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(+)

Comments

Ulf Hansson April 28, 2025, 4:08 p.m. UTC | #1
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
diff mbox series

Patch

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);