From: Erick Shepherd <erick.shepherd@ni.com>
To: <adrian.hunter@intel.com>
Cc: <andy-ld.lu@mediatek.com>, <avri.altman@wdc.com>,
<dsimic@manjaro.org>, <erick.shepherd@ni.com>,
<jason.lai@genesyslogic.com.tw>, <jeff.johnson@oss.qualcomm.com>,
<jonathan@raspberrypi.com>, <keita.aihara@sony.com>,
<linux-kernel@vger.kernel.org>, <linux-mmc@vger.kernel.org>,
<ulf.hansson@linaro.org>, <victor.shih@genesyslogic.com.tw>,
<wsa+renesas@sang-engineering.com>
Subject: Re: [PATCH] mmc: Add quirk to disable DDR50 tuning
Date: Wed, 26 Mar 2025 14:30:47 -0500 [thread overview]
Message-ID: <20250326193047.1902835-1-erick.shepherd@ni.com> (raw)
In-Reply-To: <c6093207-2b68-4e3a-8a70-7ab4541ac59f@intel.com>
> Perhaps make a helper function (untested):
Making a helper function seems like a good idea to me. How does this
look? I tested it using the SD card with our issue to confirm the I/O
errors no longer appear. I also tested it with another DDR50 SD card
to make sure the tuning is still executed in that case. I don't have a
SDR50 or SDR104 card on hand but could try to find them if you believe
the helper function needs to be tested further.
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index cc757b850e79..fc3416027033 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -613,6 +613,29 @@ static int sd_set_current_limit(struct mmc_card *card, u8 *status)
return 0;
}
+/*
+ * Determine if the card should tune or not.
+ */
+static bool mmc_sd_use_tuning(struct mmc_card *card)
+{
+ /*
+ * SPI mode doesn't define CMD19 and tuning is only valid for SDR50 and
+ * SDR104 mode SD-cards. Note that tuning is mandatory for SDR104.
+ */
+ if (mmc_host_is_spi(card->host))
+ return false;
+
+ switch (card->host->ios.timing) {
+ case MMC_TIMING_UHS_SDR50:
+ case MMC_TIMING_UHS_SDR104:
+ return true;
+ case MMC_TIMING_UHS_DDR50:
+ return !mmc_card_no_uhs_ddr50_tuning(card);
+ }
+
+ return false;
+}
+
/*
* UHS-I specific initialization procedure
*/
@@ -656,14 +679,7 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card)
if (err)
goto out;
- /*
- * SPI mode doesn't define CMD19 and tuning is only valid for SDR50 and
- * SDR104 mode SD-cards. Note that tuning is mandatory for SDR104.
- */
- 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)) {
+ if (mmc_sd_use_tuning(card)) {
err = mmc_execute_tuning(card);
/*
Regards,
Erick
prev parent reply other threads:[~2025-03-26 21:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-14 19:58 [PATCH] mmc: Add quirk to disable DDR50 tuning Erick Shepherd
2025-03-17 10:40 ` Ulf Hansson
2025-03-24 19:21 ` Erick Shepherd
2025-03-25 6:33 ` Adrian Hunter
2025-03-26 19:30 ` Erick Shepherd [this message]
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=20250326193047.1902835-1-erick.shepherd@ni.com \
--to=erick.shepherd@ni.com \
--cc=adrian.hunter@intel.com \
--cc=andy-ld.lu@mediatek.com \
--cc=avri.altman@wdc.com \
--cc=dsimic@manjaro.org \
--cc=jason.lai@genesyslogic.com.tw \
--cc=jeff.johnson@oss.qualcomm.com \
--cc=jonathan@raspberrypi.com \
--cc=keita.aihara@sony.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=victor.shih@genesyslogic.com.tw \
--cc=wsa+renesas@sang-engineering.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