From: Radovan Lekanovic <lekanovic@gmail.com>
To: linux-mmc@vger.kernel.org
Subject: MMC - Driver hangs if using bad SDCard
Date: Fri, 21 May 2010 12:13:25 +0000 (UTC) [thread overview]
Message-ID: <loom.20100521T141144-491@post.gmane.org> (raw)
Hi
I have experienced problems with the MMC driver if using an bad SD card the MMC
driver ends up in an infinite loop in file block.c function mmc_blk_issue_rq.
if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) {
do {
int err;
cmd.opcode = MMC_SEND_STATUS;
cmd.arg = card->rca << 16;
cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
err = mmc_wait_for_cmd(card->host, &cmd, 5);
if (err) {
printk(KERN_ERR "%s: error %d requesting status\n",
req->rq_disk->disk_name, err);
goto cmd_err;
}
/*
* Some cards mishandle the status bits,
* so make sure to check both the busy
* indication and the card state.
*/
} while (!(cmd.resp[0] & R1_READY_FOR_DATA) ||
(R1_CURRENT_STATE(cmd.resp[0]) == 7));
The problem is that R1_CURRENT_STATE(cmd.resp[0]) == 7 will always be TRUE.
This problem will drain the battery on portabel devices.
The card works fine on other devices.
My idea to solve this problem is to break this loop by an timer if it take too
long time for the SD-Card to replay. Will that solution break anything? Any
other better solutions?
BR
Lekan
reply other threads:[~2010-05-21 12:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=loom.20100521T141144-491@post.gmane.org \
--to=lekanovic@gmail.com \
--cc=linux-mmc@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