mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shawn Lin <shawn.lin@rock-chips.com>
To: Deomid rojer Ryabkov <rojer@rojer.me>
Cc: shawn.lin@rock-chips.com, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Jensen Huang <jensenhuang@friendlyarm.com>,
	Ulf Hansson <ulfh@kernel.org>
Subject: Re: [PATCH 1/2] mmc: core: sdio: retry without UHS if UHS init fails
Date: Mon, 26 Oct 2026 08:58:27 +0800	[thread overview]
Message-ID: <2155efb5-4d22-4a4e-8541-29f263f96dc9@rock-chips.com> (raw)
In-Reply-To: <20261023232813.2983368-2-rojer@rojer.me>

在 2026/10/24 星期六 7:28, Deomid rojer Ryabkov 写道:
> If mmc_sdio_init_uhs_card() fails, typically because tuning finds no
> working sample phase, card initialisation fails and the card is not
> usable at all, even though it would work fine in high-speed mode.
> 
> This happens for example on the FriendlyElec NanoPi R2S Plus when the
> SDIO pins of the RTL8822CS Wi-Fi module are left at their default 4 mA
> drive strength:
> 
>    dwmmc_rockchip ff5f0000.mmc: All phases bad!
>    mmc2: tuning execution failed: -5
>    mmc2: error -5 whilst initialising SDIO card
>    [... repeated for every init frequency ...]
>    mmc2: Failed to initialize a non-removable card
> 
> There is already a fallback for a failure to read the CCCR in UHS mode:
> power-cycle the card and restart the init sequence without

Nit: It doesn't power-cycle the card but soft-reset it.
Otherwise it looks good to me,

Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>

> R4_18V_PRESENT. Do the same when UHS init fails, so that the card comes
> up in high-speed mode instead:
> 
>    mmc2: UHS init failed (-5), retrying without UHS
>    mmc2: Skipping voltage switch
>    mmc2: new high speed SDIO card at address 0001
> 
> The fallback is taken at most once, as the retry doesn't request UHS.
> 
> Signed-off-by: Deomid rojer Ryabkov <rojer@rojer.me>
> ---
>   drivers/mmc/core/sdio.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
> index 83085e7648..6787fdf1c5 100644
> --- a/drivers/mmc/core/sdio.c
> +++ b/drivers/mmc/core/sdio.c
> @@ -867,8 +867,14 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
>   	/* Only if card supports 1.8v and UHS signaling */
>   	if ((ocr & R4_18V_PRESENT) && card->sw_caps.sd3_bus_mode) {
>   		err = mmc_sdio_init_uhs_card(card);
> -		if (err)
> -			goto remove;
> +		if (err) {
> +			pr_warn("%s: UHS init failed (%d), retrying without UHS\n",
> +				mmc_hostname(host), err);
> +			mmc_sdio_pre_init(host, ocr_card,
> +					  card != oldcard ? card : NULL);
> +			retries = 0;
> +			goto try_again;
> +		}
>   	} else {
>   		/*
>   		 * Switch to high-speed (if supported).


  reply	other threads:[~2026-10-26  0:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-23 23:28 [PATCH 0/2] mmc: core: sdio: fix UHS init with fixed 1.8V vqmmc Deomid rojer Ryabkov
2026-10-23 23:28 ` [PATCH 1/2] mmc: core: sdio: retry without UHS if UHS init fails Deomid rojer Ryabkov
2026-10-26  0:58   ` Shawn Lin [this message]
2026-10-23 23:28 ` [PATCH 2/2] mmc: core: sdio: skip CMD11 if signalling is already 1.8V Deomid rojer Ryabkov
2026-10-23 23:28   ` [PATCH 2/2 alt] mmc: core: sdio: retry without CMD11 if it fails at 1.8V Deomid rojer Ryabkov
2026-10-24  2:24   ` [PATCH 2/2] mmc: core: sdio: skip CMD11 if signalling is already 1.8V Shawn Lin
2026-10-26  2:02     ` Shawn Lin

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=2155efb5-4d22-4a4e-8541-29f263f96dc9@rock-chips.com \
    --to=shawn.lin@rock-chips.com \
    --cc=jensenhuang@friendlyarm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=rojer@rojer.me \
    --cc=ulfh@kernel.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

all inboxes | Powered by JetHome®