Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: Erick Shepherd <erick.shepherd@ni.com>
To: <linux-kernel@vger.kernel.org>
Cc: <linux-mmc@vger.kernel.org>, <york.yang@csr.com>,
	<ulf.hansson@linaro.org>, Erick Shepherd <erick.shepherd@ni.com>
Subject: [RFC PATCH 2/2] mmc: Allow tuning to be skipped during card init
Date: Mon, 27 Jan 2025 16:36:54 -0600	[thread overview]
Message-ID: <20250127223654.290904-2-erick.shepherd@ni.com> (raw)
In-Reply-To: <20250127223654.290904-1-erick.shepherd@ni.com>

Add a new field to the mmc_host struct to track when the card should
skip the initial tuning and use it to conditionally stop tuning in the
mmc_sd_init_uhs_card function. Currently the new field only gets set
when a DDR50 card fails to tune, which indicates the card does not
support tuning.

Signed-off-by: Erick Shepherd <erick.shepherd@ni.com>
---
 drivers/mmc/core/sd.c    | 4 +++-
 include/linux/mmc/host.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index cc757b850e79..353715fd8f53 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -663,7 +663,8 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card)
 	if (!mmc_host_is_spi(card->host) &&
 		(card->host->ios.timing == MMC_TIMING_UHS_SDR50 ||
 		 card->host->ios.timing == MMC_TIMING_UHS_DDR50 ||
-		 card->host->ios.timing == MMC_TIMING_UHS_SDR104)) {
+		 card->host->ios.timing == MMC_TIMING_UHS_SDR104) &&
+		!card->host->skip_init_tune) {
 		err = mmc_execute_tuning(card);
 
 		/*
@@ -676,6 +677,7 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card)
 		if (err && card->host->ios.timing == MMC_TIMING_UHS_DDR50) {
 			pr_warn("%s: ddr50 tuning failed\n",
 				mmc_hostname(card->host));
+			card->host->skip_init_tune = 1;
 			err = 0;
 		}
 	}
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 68f09a955a90..91c4db6837c9 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -486,6 +486,7 @@ struct mmc_host {
 	unsigned int		use_spi_crc:1;
 	unsigned int		claimed:1;	/* host exclusively claimed */
 	unsigned int		doing_init_tune:1; /* initial tuning in progress */
+	unsigned int		skip_init_tune:1;	/* skip the initial tuning */
 	unsigned int		can_retune:1;	/* re-tuning can be used */
 	unsigned int		doing_retune:1;	/* re-tuning in progress */
 	unsigned int		retune_now:1;	/* do re-tuning at next req */
-- 
2.43.0


  reply	other threads:[~2025-01-28  0:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-27 22:36 [RFC PATCH 1/2] mmc: Update sdhci tune function to return errors Erick Shepherd
2025-01-27 22:36 ` Erick Shepherd [this message]
2025-01-28 16:04   ` [RFC PATCH 2/2] mmc: Allow tuning to be skipped during card init Judith Mendez
2025-01-28 22:20     ` Erick Shepherd
2025-02-03 13:49   ` Ulf Hansson
2025-02-03 13:42 ` [RFC PATCH 1/2] mmc: Update sdhci tune function to return errors Ulf Hansson
2025-02-06 21:07   ` Erick Shepherd
2025-02-06 23:53 ` Judith Mendez

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=20250127223654.290904-2-erick.shepherd@ni.com \
    --to=erick.shepherd@ni.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=york.yang@csr.com \
    /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