Linux-mmc Archive mirror
 help / color / mirror / Atom feed
From: Michael Wu <michael@allwinnertech.com>
To: ulf.hansson@linaro.org, CLoehle@hyperstone.com,
	adrian.hunter@intel.com, jinpu.wang@ionos.com, hare@suse.de,
	victor.shih@genesyslogic.com.tw, avri.altman@wdc.com,
	asuk4.q@gmail.com
Cc: axboe@kernel.dk, brauner@kernel.org, f.fainelli@gmail.com,
	beanhuo@micron.com, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] mmc: core: Add new flag to force hardware reset
Date: Thu, 14 Sep 2023 08:03:48 +0800	[thread overview]
Message-ID: <20230914000348.25790-1-michael@allwinnertech.com> (raw)

Entering the recovery system itself indicates a transmission error.
In this situation, we intend to execute the mmc_blk_reset function
to clear any anomalies that may be caused by errors. We have previously
discussed with several MMC device manufacturers, and they expressed
their desire for us to reset the device when errors occur to ensure
stable operation. We aim to make this code compatible with all devices
and ensure its stable performance, so we would like to add this patch

Signed-off-by: Michael Wu <michael@allwinnertech.com>
---
 drivers/mmc/core/block.c | 2 +-
 include/linux/mmc/host.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index b5b414a71e0b..29fbe0ddeadb 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -1503,7 +1503,7 @@ void mmc_blk_cqe_recovery(struct mmc_queue *mq)
 	pr_debug("%s: CQE recovery start\n", mmc_hostname(host));
 
 	err = mmc_cqe_recovery(host);
-	if (err)
+	if (err || host->cqe_recovery_reset_always)
 		mmc_blk_reset(mq->blkdata, host, MMC_BLK_CQE_RECOVERY);
 	mmc_blk_reset_success(mq->blkdata, MMC_BLK_CQE_RECOVERY);
 
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 62a6847a3b6f..f578541a06b5 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -518,6 +518,7 @@ struct mmc_host {
 	int			cqe_qdepth;
 	bool			cqe_enabled;
 	bool			cqe_on;
+	bool			cqe_recovery_reset_always;
 
 	/* Inline encryption support */
 #ifdef CONFIG_MMC_CRYPTO
-- 
2.29.0


             reply	other threads:[~2023-09-14  0:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-14  0:03 Michael Wu [this message]
2023-09-14  8:00 ` [PATCH] mmc: core: Add new flag to force hardware reset Wenchao Chen
2023-09-25 13:59   ` Ulf Hansson
2023-11-06 12:26     ` Michael Wu
2023-11-06 14:19       ` Ulf Hansson
2024-01-11  6:05         ` Wenchao Chen

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=20230914000348.25790-1-michael@allwinnertech.com \
    --to=michael@allwinnertech.com \
    --cc=CLoehle@hyperstone.com \
    --cc=adrian.hunter@intel.com \
    --cc=asuk4.q@gmail.com \
    --cc=avri.altman@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=beanhuo@micron.com \
    --cc=brauner@kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=hare@suse.de \
    --cc=jinpu.wang@ionos.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=victor.shih@genesyslogic.com.tw \
    /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).