From: Johan Rudholm <johan.rudholm@axis.com>
To: ulf.hansson@linaro.org, cjb@laptop.org
Cc: linux-mmc@vger.kernel.org, Johan Rudholm <johanru@axis.com>
Subject: [PATCH] mmc: core: make hw_reset power cycle SD-cards
Date: Tue, 9 Sep 2014 16:21:48 +0200 [thread overview]
Message-ID: <1410272508-4885-1-git-send-email-johanru@axis.com> (raw)
SD-cards cannot be reset, but they can be power cycled. Power cycling
a buggy SD-card sometimes helps it get back on track.
Signed-off-by: Johan Rudholm <johanru@axis.com>
---
drivers/mmc/core/core.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index d03a080..9171aa9 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2250,19 +2250,25 @@ static int mmc_do_hw_reset(struct mmc_host *host, int check)
{
struct mmc_card *card = host->card;
- if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset)
- return -EOPNOTSUPP;
-
if (!card)
return -EINVAL;
- if (!mmc_can_reset(card))
+ if (!mmc_card_sd(card) && !((host->caps & MMC_CAP_HW_RESET) &&
+ host->ops->hw_reset))
+ return -EOPNOTSUPP;
+
+ if (!mmc_card_sd(card) && !mmc_can_reset(card))
return -EOPNOTSUPP;
mmc_host_clk_hold(host);
mmc_set_clock(host, host->f_init);
- host->ops->hw_reset(host);
+ if (mmc_card_sd(card))
+ mmc_power_cycle(host, card->ocr);
+ else
+ host->ops->hw_reset(host);
+
+ pr_warning("%s: reset device\n", mmc_hostname(host));
/* If the reset has happened, then a status command will fail */
if (check) {
--
1.7.2.5
next reply other threads:[~2014-09-09 14:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-09 14:21 Johan Rudholm [this message]
2014-09-11 11:03 ` [PATCH] mmc: core: make hw_reset power cycle SD-cards Ulf Hansson
2014-09-12 6:44 ` Johan Rudholm
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=1410272508-4885-1-git-send-email-johanru@axis.com \
--to=johan.rudholm@axis.com \
--cc=cjb@laptop.org \
--cc=johanru@axis.com \
--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