From: Johnson Thomas <johnsonthomas@nanometrics.ca>
To: cjb@laptop.org
Cc: dbrownell@users.sourceforge.net, linux-mmc@vger.kernel.org,
linux-kernel@vger.kernel.org, johnsonthomas@nanometrics.ca,
jamesnuss@nanometrics.ca
Subject: [PATCH] mmc: mmc_spi: synchronize STOP_TRANSMISSION with next data token during block reads
Date: Mon, 3 Mar 2014 14:17:11 -0500 [thread overview]
Message-ID: <1393874231-21929-1-git-send-email-johnsonthomas@nanometrics.ca> (raw)
Certain SD cards respond with an invalid response (ie,. response
not defined in the SD protocol) during block reads when the
OUT_OF_RANGE data token is sent back from the card at the same time
as the host sends a STOP_TRANSMISSION command (CMD12). As a result,
the card enters a bad state which leads to rejecting any subsequent
commands until the card is reset.
Synchronize with the subsequent data token for every block read before
issuing a STOP_TRANSMISSION command (CMD12). The synchronization is
done by issuing 0xff bytes until a data token is received.
Signed-off-by: Johnson Thomas <johnsonthomas@nanometrics.ca>
---
drivers/mmc/host/mmc_spi.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 7c1e16a..7703a15 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -984,6 +984,14 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd,
}
}
+ if (direction == DMA_FROM_DEVICE && multiple) {
+ int status = mmc_spi_readtoken(host, timeout);
+ if (status < 0)
+ dev_dbg(&spi->dev,
+ "read error for data token, returned status: 0x%02x (%d)\n",
+ status, status);
+ }
+
/* NOTE some docs describe an MMC-only SET_BLOCK_COUNT (CMD23) that
* can be issued before multiblock writes. Unlike its more widely
* documented analogue for SD cards (SET_WR_BLK_ERASE_COUNT, ACMD23),
--
1.7.1
reply other threads:[~2014-03-03 19:17 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=1393874231-21929-1-git-send-email-johnsonthomas@nanometrics.ca \
--to=johnsonthomas@nanometrics.ca \
--cc=cjb@laptop.org \
--cc=dbrownell@users.sourceforge.net \
--cc=jamesnuss@nanometrics.ca \
--cc=linux-kernel@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).