Devicetree
 help / color / mirror / Atom feed
From: "NG, TZE YEE" <tze.yee.ng@altera.com>
To: Adrian Hunter <adrian.hunter@intel.com>,
	Tanmay Kathpalia <tanmay.kathpalia@altera.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 v4 1/3] mmc: sdhci-cadence: abort failed tuning command on SD6HC
Date: Thu, 3 Dec 2026 16:38:55 +0800	[thread overview]
Message-ID: <cd4396bb-e61f-402b-a587-a43be82ed7fe@altera.com> (raw)
In-Reply-To: <b8fc0b50-1e74-4eed-9899-90d6a49d1d03@intel.com>

Hi Adrian,

Thanks for the Ack.

On 2/12/2026 3:50 pm, Adrian Hunter wrote:
> On 19/11/2026 11:45, 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.
>>
>> Request the command error from mmc_send_tuning() and, on a command
>> error, abort the tuning command with mmc_send_abort_tuning(). This
>> matches the generic sdhci tuning path. SD is unaffected because
>> mmc_send_abort_tuning() only acts on the CMD21 tuning command and is a
>> no-op for the SD CMD19 one.
>>
>> sdhci_cdns_execute_tuning() is shared with SD4HC, so limit the abort to
>> SD6HC (SDHCI_SPEC_420 and later); only SD6HC has been tested and SD4HC
>> can opt in once validated.
>>
>> Suggested-by: Tanmay Kathpalia <tanmay.kathpalia@altera.com>
>> Signed-off-by: Tze Yee Ng <tze.yee.ng@altera.com>
>> Reviewed-by: Tanmay Kathpalia <tanmay.kathpalia@altera.com>
> 
> The comment could use a tweak - see below.  Nevertheless:
> 
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> 
>> ---
>> Changes in v4:
>> - Limited the abort to SD6HC (host->version >= SDHCI_SPEC_420)
>>    because sdhci_cdns_execute_tuning() is shared with SD4HC, which has
>>    not been tested; reworded the commit message accordingly.
>> - Added Tanmay's Reviewed-by.
>>
>> 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 | 12 +++++++++++-
>>   1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/host/sdhci-cadence-core.c b/drivers/mmc/host/sdhci-cadence-core.c
>> index 745455743b01..5e5a74ca25ce 100644
>> --- a/drivers/mmc/host/sdhci-cadence-core.c
>> +++ b/drivers/mmc/host/sdhci-cadence-core.c
>> @@ -330,9 +330,19 @@ 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.
>> +			 * Restrict to SD6HC; the shared path also serves the
>> +			 * untested SD4HC. A no-op for SD in any case.
> 
> "Restrict to SD6HC; the shared path also serves the untested SD4HC"
> is AI generated and doesn't make sense.
> 
> "A no-op for SD in any case"
> is not relevant
> 
> Could just be:
> 
> 	"Restrict to SD6HC for now because it is untested with SD4HC"
> 

Agreed the comment is poor. I'll use your wording:

	/*
	 * Abort a failed tuning command so an eMMC does not stay
	 * in the Data state and reject the next command. Restrict
	 * to SD6HC for now because it is untested with SD4HC.
	 */

> but why not test SD4HC?
> 

I don't have any SD4HC hardware, so I can't validate the change there. 
The abort mirrors the generic sdhci tuning path and should be safe on 
SD4HC too, but I'd rather not change tuning behavior on a controller I 
can't exercise. Limiting it to SD6HC keeps this to what I've actually 
tested. SD4HC can opt in once someone with the hardware can confirm it.

Thanks,
Tze Yee

>> +			 */
>> +			if (cmd_error && host->version >= SDHCI_SPEC_420)
>> +				mmc_send_abort_tuning(host->mmc, opcode);
>>   		} else { /* good */
>>   			cur_streak++;
>>   			if (cur_streak > max_streak) {
>>
> 


  reply	other threads:[~2026-12-03  8:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  9:45 [PATCH v4 0/3] mmc: sdhci-cadence: SD6HC DDR50/DDR52 read-path tuning and fixes tze.yee.ng
2026-11-19  9:45 ` [PATCH v4 1/3] mmc: sdhci-cadence: abort failed tuning command on SD6HC tze.yee.ng
2026-11-19  9:53   ` sashiko-bot
2026-12-02  7:50   ` Adrian Hunter
2026-12-03  8:38     ` NG, TZE YEE [this message]
2026-11-19  9:45 ` [PATCH v4 2/3] dt-bindings: mmc: cdns,sd6hc: add SD6HC DDR50 read-path tuning tze.yee.ng
2026-11-22 16:03   ` Krzysztof Kozlowski
2026-11-22 19:05   ` Kathpalia, Tanmay
2026-11-25  7:26     ` NG, TZE YEE
2026-12-02  8:22       ` Kathpalia, Tanmay
2026-11-19  9:45 ` [PATCH v4 3/3] mmc: sdhci-cadence6: tune SD6HC DDR50/DDR52 read path tze.yee.ng
2026-11-22 19:06   ` Kathpalia, Tanmay
2026-11-25  7:48     ` NG, TZE YEE
2026-12-02  8:12       ` Kathpalia, Tanmay
2026-12-03  8:44         ` NG, TZE YEE
2026-12-02  7:50   ` Adrian Hunter
2026-12-03  8:51     ` NG, TZE YEE
2026-11-22 16:03 ` [PATCH v4 0/3] mmc: sdhci-cadence: SD6HC DDR50/DDR52 read-path tuning and fixes Krzysztof Kozlowski
2026-11-25  6:38   ` NG, TZE YEE

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=cd4396bb-e61f-402b-a587-a43be82ed7fe@altera.com \
    --to=tze.yee.ng@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=tanmay.kathpalia@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