Linux-mmc Archive mirror
 help / color / mirror / Atom feed
From: Felix Qin <xiaokeqinhealth@126.com>
To: ulf.hansson@linaro.org, linux-mmc@vger.kernel.org
Cc: dsimic@manjaro.org, Avri.Altman@wdc.com,
	Felix Qin <xiaokeqinhealth@126.com>,
	Avri Altman <avri.altman@wdc.com>
Subject: [PATCH v2 1/1] mmc: core: increase the number of retries of the ACMD41
Date: Wed, 17 Apr 2024 16:45:00 +0800	[thread overview]
Message-ID: <20240417084500.152486-1-xiaokeqinhealth@126.com> (raw)

Extensive testing has shown that a few specific SD cards require
an increase in the number of command retries to successfully
initialize.

More info:
Platform: Rockchip SoC + DW Multimedia host Controller
SD card: Xvv microSD CMH34A17TMA12 (Made in Korea)
Note: The SD card is custom-made by the customer in collaboration
with the wafer foundry.

Signed-off-by: Felix Qin <xiaokeqinhealth@126.com>
Acked-by: Avri Altman <avri.altman@wdc.com>
---
v2: Add more info
---
---
 drivers/mmc/core/sd_ops.c | 4 ++--
 drivers/mmc/core/sd_ops.h | 8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c
index a59cd592f06e..b3b6e8725b80 100644
--- a/drivers/mmc/core/sd_ops.c
+++ b/drivers/mmc/core/sd_ops.c
@@ -127,7 +127,7 @@ int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
 		cmd.arg = ocr;
 	cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R3 | MMC_CMD_BCR;
 
-	for (i = 100; i; i--) {
+	for (i = SD_APP_OP_COND_RETRIES; i; i--) {
 		err = mmc_wait_for_app_cmd(host, NULL, &cmd);
 		if (err)
 			break;
@@ -147,7 +147,7 @@ int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
 
 		err = -ETIMEDOUT;
 
-		mmc_delay(10);
+		mmc_delay(SD_APP_OP_COND_INTERVAL);
 	}
 
 	if (!i)
diff --git a/drivers/mmc/core/sd_ops.h b/drivers/mmc/core/sd_ops.h
index 7667fc223b74..80c5c836ccd1 100644
--- a/drivers/mmc/core/sd_ops.h
+++ b/drivers/mmc/core/sd_ops.h
@@ -10,6 +10,14 @@
 
 #include <linux/types.h>
 
+/*
+ * Extensive testing has shown that a few specific SD cards require
+ * an increase in the number of command retries to successfully
+ * initialize.
+ */
+#define SD_APP_OP_COND_RETRIES  200
+#define SD_APP_OP_COND_INTERVAL 10	/* millisecond */
+
 struct mmc_card;
 struct mmc_host;
 
-- 
2.34.1


             reply	other threads:[~2024-04-17  8:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-17  8:45 Felix Qin [this message]
2024-04-17  9:10 ` [PATCH v2 1/1] mmc: core: increase the number of retries of the ACMD41 Dragan Simic
2024-04-25 16:22 ` Ulf Hansson

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=20240417084500.152486-1-xiaokeqinhealth@126.com \
    --to=xiaokeqinhealth@126.com \
    --cc=Avri.Altman@wdc.com \
    --cc=dsimic@manjaro.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).