From: Timo Teras <timo.teras@solidboot.com>
To: Pierre Ossman <drzeus-list@drzeus.cx>
Cc: Timo Teras <timo.teras@solidboot.com>, linux-kernel@vger.kernel.org
Subject: [PATCH] MMC: Poll card status after rescanning cards
Date: Wed, 25 Oct 2006 09:37:41 +0300 [thread overview]
Message-ID: <20061025063741.GA18599@mail.solidboot.com> (raw)
In-Reply-To: <453E4654.1030809@drzeus.cx>
Some broken cards seem to process CMD1 even in stand-by state. The result is
that the card replies with ILLEGAL_COMMAND error for the next command sent
after rescanning. Currently the next command is select card, which would
return the error. But CMD7 does actually succeed and retries of the command
will timeout. The workaround is to poll card status after CMD1 to clear the
pending error.
Signed-off-by: Timo Teras <timo.teras@solidboot.com>
---
drivers/mmc/mmc.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index ee8863c..c236646 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1178,14 +1178,29 @@ static void mmc_rescan(void *data)
{
struct mmc_host *host = data;
struct list_head *l, *n;
+ unsigned char power_mode;
mmc_claim_host(host);
- if (host->ios.power_mode == MMC_POWER_ON)
+ /*
+ * Check for removed cards and newly inserted ones. We check for
+ * removed cards first so we can intelligently re-select the VDD.
+ */
+ power_mode = host->ios.power_mode;
+ if (power_mode == MMC_POWER_ON)
mmc_check_cards(host);
mmc_setup(host);
+ /*
+ * Some broken cards process CMD1 even in stand-by state. There is
+ * no reply, but an ILLEGAL_COMMAND error is cached and returned
+ * after next command. We poll for card status here to clear any
+ * possibly pending error.
+ */
+ if (power_mode == MMC_POWER_ON)
+ mmc_check_cards(host);
+
if (!list_empty(&host->cards)) {
/*
* (Re-)calculate the fastest clock rate which the
--
1.4.1.1
next prev parent reply other threads:[~2006-10-25 6:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-16 9:06 MMC: When rescanning cards check existing cards after mmc_setup() Timo Teras
2006-10-22 9:55 ` Pierre Ossman
2006-10-24 10:14 ` Timo Teras
2006-10-24 16:59 ` Pierre Ossman
2006-10-25 6:37 ` Timo Teras [this message]
2006-10-26 7:20 ` [PATCH] MMC: Poll card status after rescanning cards Pierre Ossman
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=20061025063741.GA18599@mail.solidboot.com \
--to=timo.teras@solidboot.com \
--cc=drzeus-list@drzeus.cx \
--cc=linux-kernel@vger.kernel.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