mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Kathpalia, Tanmay" <tanmay.kathpalia@altera.com>
To: tze.yee.ng@altera.com, Adrian Hunter <adrian.hunter@intel.com>,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	devicetree@vger.kernel.org, Ulf Hansson <ulfh@kernel.org>
Subject: Re: [PATCH v3 1/4] mmc: sdhci-cadence: abort failed tuning command on SD6HC
Date: Mon, 16 Nov 2026 00:54:54 +0530	[thread overview]
Message-ID: <8fd95a2f-6320-4c52-8e5c-6e26c8aa46fd@altera.com> (raw)
In-Reply-To: <20261106-sd_cadence_ddr50_v3-v3-1-cb50afece614@altera.com>


On 06-11-2026 11:46, tze.yee.ng@altera.com wrote:
> From: Tze Yee Ng <tze.yee.ng@altera.com>
>
> SD6HC uses a software tuning loop that calls mmc_send_tuning() for every
> tap but never aborts a command that fails. When a CMD21 fails with a
> command error the eMMC can remain in the Data state and reject the next
> command, so the CMD6 that mmc_select_hs400() issues right after tuning
> times out. SD is not affected because CMD12 cannot abort CMD19.

Nit: The SD state diagram (Fig 4-13) shows CMD12 leaving the data state 
after CMD19; the
tuning section just doesn't use it. Instead we can use that SD is 
unchanged because
mmc_send_abort_tuning() only acts on CMD21.

>
> Request the command error from mmc_send_tuning() and, on a command
> error, abort the tuning command with mmc_send_abort_tuning(), which is a
> no-op for SD. This matches the generic sdhci tuning path.
>
> Suggested-by: Tanmay Kathpalia <tanmay.kathpalia@altera.com>
> Signed-off-by: Tze Yee Ng <tze.yee.ng@altera.com>
> ---
> Changes in v3:
> - New patch replacing the v2 1/4 PHY settle: abort the failed tuning
>    command (mmc_send_abort_tuning(), a no-op for SD) instead of masking
>    the post-tuning command timeout with a settle delay. (Tanmay Kathpalia)
> ---
>   drivers/mmc/host/sdhci-cadence-core.c | 11 ++++++++++-
>   1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-cadence-core.c b/drivers/mmc/host/sdhci-cadence-core.c
> index 745455743b01..a94296cebf47 100644
> --- a/drivers/mmc/host/sdhci-cadence-core.c
> +++ b/drivers/mmc/host/sdhci-cadence-core.c
> @@ -330,9 +330,18 @@ static int sdhci_cdns_execute_tuning(struct sdhci_host *host, u32 opcode)
>   	}
>   
>   	for (i = 0; i < SDHCI_CDNS_MAX_TUNING_LOOP; i++) {
> +		int cmd_error = 0;
> +
>   		if (sdhci_cdns_set_tune_val(host, i) ||
> -		    mmc_send_tuning(host->mmc, opcode, NULL)) { /* bad */
> +		    mmc_send_tuning(host->mmc, opcode, &cmd_error)) { /* bad */
>   			cur_streak = 0;
> +			/*
> +			 * Abort a failed tuning command so an eMMC does not
> +			 * stay in the Data state and reject the next command;
> +			 * a no-op for SD.
> +			 */
> +			if (cmd_error)
> +				mmc_send_abort_tuning(host->mmc, opcode);

sdhci_cdns_execute_tuning() is shared with SD4HC, so this changes those 
too, and only SD6HC was
tested. Please limit the abort to SD6HC:

     if (cmd_error && host->version >= SDHCI_SPEC_420)
         mmc_send_abort_tuning(host->mmc, opcode);

If SD4HC should get it too, that can be a follow-up once it has been 
tested on EyeQ or UniPhier.

With the SD6HC guard and the commit message fix:
Reviewed-by: Tanmay Kathpalia <tanmay.kathpalia@altera.com>

>

  reply	other threads:[~2026-11-15 19:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06  6:16 [PATCH v3 0/4] mmc: sdhci-cadence: SD6HC DDR50/DDR52 read-path tuning and fixes tze.yee.ng
2026-11-06  6:16 ` [PATCH v3 1/4] mmc: sdhci-cadence: abort failed tuning command on SD6HC tze.yee.ng
2026-11-15 19:24   ` Kathpalia, Tanmay [this message]
2026-11-06  6:16 ` [PATCH v3 2/4] mmc: sdhci-cadence6: program PHONY_DQS_TIMING for extended-read DDR tze.yee.ng
2026-11-15 14:51   ` Kathpalia, Tanmay
2026-11-06  6:16 ` [PATCH v3 3/4] dt-bindings: mmc: cdns,sd6hc: add SD6HC DDR50 read-path tuning tze.yee.ng
2026-11-06 12:40   ` Krzysztof Kozlowski
2026-11-06  6:16 ` [PATCH v3 4/4] mmc: sdhci-cadence6: read SD6HC DDR50 tuning from device tree tze.yee.ng
2026-11-15 18:47   ` Kathpalia, Tanmay

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=8fd95a2f-6320-4c52-8e5c-6e26c8aa46fd@altera.com \
    --to=tanmay.kathpalia@altera.com \
    --cc=adrian.hunter@intel.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=tze.yee.ng@altera.com \
    --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®