mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Mendez, Judith" <jm@ti.com>
To: "Diogo Ivo (Schneider Electric)" <diogo.ivo@bootlin.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Ulf Hansson <ulfh@kernel.org>
Cc: <linux-mmc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	"Pascal EBERHARD" <pascal.eberhard@se.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	<stable@vger.kernel.org>
Subject: Re: [PATCH v2 3/4] mmc: sdhci_am654: Clear ITAPDLY on tuning failure
Date: Mon, 3 Aug 2026 14:40:35 -0500	[thread overview]
Message-ID: <ae76ddd0-5401-49e3-8f52-cc7aab189a7c@ti.com> (raw)
In-Reply-To: <20260803-am654-sdhci-v2-3-a5ee5be86133@bootlin.com>

Hi Diogo,

Thanks for the fix.

On 8/3/2026 8:47 AM, Diogo Ivo (Schneider Electric) wrote:
> When tuning fails, stale ITAPDLY values can persist and interfere with
> subsequent I/O accesses, for example in DDR50 mode in cards with no tuning
> support. Move the ITAPDLY enable setting out of the tuning loop to after
> successful tuning, and explicitly clear ITAPDLY (delay and enable) when
> tuning fails so that we are sure only working values are actually left in
> hardware.
> 
> Fixes: 901d16e46296 ("mmc: sdhci_am654: Add retry tuning")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Diogo Ivo (Schneider Electric) <diogo.ivo@bootlin.com>

Reviewed-by: Judith Mendez <jm@ti.com>

> ---
> Changes in v2:
>   - As suggested by Sashiko clear the values in itap_del_sel[] and itap_del_ena[]
>     so that they agree with what is written in HW and subsequent runtime_suspend()
>     and runtime_resume() can never write stale values.
>   - Remove now unused timing variable
> ---
>   drivers/mmc/host/sdhci_am654.c | 12 +++++++-----
>   1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
> index 0db587e702ac..8ce10422bba0 100644
> --- a/drivers/mmc/host/sdhci_am654.c
> +++ b/drivers/mmc/host/sdhci_am654.c
> @@ -527,7 +527,6 @@ static int sdhci_am654_do_tuning(struct sdhci_host *host,
>   {
>   	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>   	struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host);
> -	unsigned char timing = host->mmc->ios.timing;
>   	struct window fail_window[ITAPDLY_LENGTH];
>   	struct device *dev = mmc_dev(host->mmc);
>   	u8 curr_pass, itap;
> @@ -536,11 +535,8 @@ static int sdhci_am654_do_tuning(struct sdhci_host *host,
>   
>   	memset(fail_window, 0, sizeof(fail_window));
>   
> -	/* Enable ITAPDLY */
> -	sdhci_am654->itap_del_ena[timing] = 0x1;
> -
>   	for (itap = 0; itap < ITAPDLY_LENGTH; itap++) {
> -		sdhci_am654_write_itapdly(sdhci_am654, itap, sdhci_am654->itap_del_ena[timing]);
> +		sdhci_am654_write_itapdly(sdhci_am654, itap, 0x1);
>   
>   		curr_pass = !mmc_send_tuning(host->mmc, opcode, NULL);
>   
> @@ -584,10 +580,16 @@ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host,
>   
>   	if (itapdly < 0) {
>   		dev_err(dev, "Failed to find itapdly, fail tuning\n");
> +		sdhci_am654_write_itapdly(sdhci_am654, 0, 0);
> +		sdhci_am654->itap_del_ena[timing] = 0;
> +		sdhci_am654->itap_del_sel[timing] = 0;
>   		return -1;
>   	}
>   
>   	dev_dbg(dev, "Passed tuning, final itapdly=%d\n", itapdly);
> +
> +	/* Enable ITAPDLY */
> +	sdhci_am654->itap_del_ena[timing] = 0x1;
>   	sdhci_am654_write_itapdly(sdhci_am654, itapdly, sdhci_am654->itap_del_ena[timing]);
>   	/* Save ITAPDLY */
>   	sdhci_am654->itap_del_sel[timing] = itapdly;
> 


  reply	other threads:[~2026-08-03 19:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03 13:47 [PATCH v2 0/4] mmc: sdhci_am654: Fix DDR50 mode for cards without tuning support Diogo Ivo (Schneider Electric)
2026-08-03 13:47 ` [PATCH v2 1/4] mmc: sdhci_am654: Move tuning_loop to local variable Diogo Ivo (Schneider Electric)
2026-08-03 19:19   ` Mendez, Judith
2026-08-03 13:47 ` [PATCH v2 2/4] mmc: sdhci_am654: Reset command and data lines on failed tuning Diogo Ivo (Schneider Electric)
2026-08-03 19:28   ` Mendez, Judith
2026-08-03 13:47 ` [PATCH v2 3/4] mmc: sdhci_am654: Clear ITAPDLY on tuning failure Diogo Ivo (Schneider Electric)
2026-08-03 19:40   ` Mendez, Judith [this message]
2026-08-03 13:47 ` [PATCH v2 4/4] mmc: sdhci_am654: Fallback to DT-provided itap delay on DDR50 " Diogo Ivo (Schneider Electric)
2026-08-03 19:59   ` Mendez, Judith
2026-08-04  8:45     ` Diogo Ivo
2026-08-05 23:13       ` Mendez, Judith
2026-08-07  6:35         ` Adrian Hunter
2026-08-07 10:52           ` Diogo Ivo
2026-08-07  8:16 ` [PATCH v2 0/4] mmc: sdhci_am654: Fix DDR50 mode for cards without tuning support Adrian Hunter

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=ae76ddd0-5401-49e3-8f52-cc7aab189a7c@ti.com \
    --to=jm@ti.com \
    --cc=adrian.hunter@intel.com \
    --cc=diogo.ivo@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=pascal.eberhard@se.com \
    --cc=stable@vger.kernel.org \
    --cc=thomas.petazzoni@bootlin.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®