From: Bean Huo <huobean@gmail.com>
To: ulf.hansson@linaro.org, adrian.hunter@intel.com
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
Bean Huo <beanhuo@micron.com>
Subject: [PATCH v1 1/2] mmc: core: Issue HPI in case the BKOPS timed out
Date: Wed, 18 Aug 2021 00:42:07 +0200 [thread overview]
Message-ID: <20210817224208.153652-2-huobean@gmail.com> (raw)
In-Reply-To: <20210817224208.153652-1-huobean@gmail.com>
From: Bean Huo <beanhuo@micron.com>
If the BKOPS timed out, the card is probably still busy in the
R1_STATE_PRG. Rather than let application in the userland continue
to wait, let's try to abort it with a HPI command to get back into
R1_STATE_TRAN.
Signed-off-by: Bean Huo <beanhuo@micron.com>
---
drivers/mmc/core/mmc_ops.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index 90d213a2203f..0c54858e89c0 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -959,8 +959,15 @@ void mmc_run_bkops(struct mmc_card *card)
*/
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
EXT_CSD_BKOPS_START, 1, MMC_BKOPS_TIMEOUT_MS);
- if (err)
- pr_warn("%s: Error %d starting bkops\n",
+ /*
+ * If the BKOPS timed out, the card is probably still busy in the
+ * R1_STATE_PRG. Rather than continue to wait, let's try to abort
+ * it with a HPI command to get back into R1_STATE_TRAN.
+ */
+ if (err == -ETIMEDOUT && !mmc_interrupt_hpi(card))
+ pr_warn("%s: BKOPS aborted\n", mmc_hostname(card->host));
+ else if (err)
+ pr_warn("%s: Error %d running bkops\n",
mmc_hostname(card->host), err);
mmc_retune_release(card->host);
--
2.25.1
next prev parent reply other threads:[~2021-08-17 22:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-17 22:42 [PATCH v1 0/2] two minor changes of eMMC BKOPS Bean Huo
2021-08-17 22:42 ` Bean Huo [this message]
2021-08-24 14:56 ` [PATCH v1 1/2] mmc: core: Issue HPI in case the BKOPS timed out Ulf Hansson
2021-08-17 22:42 ` [PATCH v1 2/2] mmc: core: Let BKOPS timeout readable/writable via sysfs Bean Huo
2021-08-24 14:33 ` Ulf Hansson
2021-08-25 8:43 ` Bean Huo
2021-08-23 7:53 ` [PATCH v1 0/2] two minor changes of eMMC BKOPS Bean Huo
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=20210817224208.153652-2-huobean@gmail.com \
--to=huobean@gmail.com \
--cc=adrian.hunter@intel.com \
--cc=beanhuo@micron.com \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.