* [PATCH] MMC:mmc_spi: Recover from CRC error for SD read/write operation over SPI.
@ 2010-07-09 8:03 sonic zhang
2010-07-09 15:43 ` Mike Frysinger
0 siblings, 1 reply; 6+ messages in thread
From: sonic zhang @ 2010-07-09 8:03 UTC (permalink / raw)
To: David Brownell; +Cc: linux-mmc, Linux Kernel, uclinux-dist-devel
>From 94d1ea57ac2fbe37133e25e99ccb265250f0027d Mon Sep 17 00:00:00 2001
From: Sonic Zhang <sonic.zhang@analog.com>
Date: Fri, 9 Jul 2010 15:36:20 +0800
Subject: [PATCH] MMC:mmc_spi: Recover from CRC error for SD read/write operation over SPI.
SPI bus is not reliable on all platforms when doing large dada transfer.
Current mmc spi driver fails SD read/write command immediately, if
occational CRC error is reported by SD device. This patch makes the
operation recover from the CRC error by doing last SD command again.
The retry count is set to 5 to ensure the driver pass any stress test.
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
---
drivers/mmc/host/mmc_spi.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index ad847a2..8192434 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1055,6 +1055,8 @@ static void mmc_spi_request(struct mmc_host *mmc, struct mmc_request *mrq)
{
struct mmc_spi_host *host = mmc_priv(mmc);
int status = -EINVAL;
+ int crc_retry = 5;
+ struct mmc_command stop;
#ifdef DEBUG
/* MMC core and layered drivers *MUST* issue SPI-aware commands */
@@ -1084,10 +1086,30 @@ static void mmc_spi_request(struct mmc_host *mmc, struct mmc_request *mrq)
}
#endif
+crc_recover:
/* issue command; then optionally data and stop */
status = mmc_spi_command_send(host, mrq, mrq->cmd, mrq->data != NULL);
if (status == 0 && mrq->data) {
mmc_spi_data_do(host, mrq->cmd, mrq->data, mrq->data->blksz);
+
+ /*
+ * SPI bus is not reliable when doing large dada transfer.
+ * If occational crc error is reported by SD device when do
+ * data read/write over SPI, it can be recovered by doing
+ * last SD command again. The retry count is set to 5 to
+ * ensure the driver pass any stress test.
+ */
+ if (mrq->data->error == -EILSEQ && crc_retry) {
+ stop.opcode = MMC_STOP_TRANSMISSION;
+ stop.arg = 0;
+ stop.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
+
+ status = mmc_spi_command_send(host, mrq, &stop, 0);
+ crc_retry--;
+ mrq->data->error = 0;
+ goto crc_recover;
+ }
+
if (mrq->stop)
status = mmc_spi_command_send(host, mrq, mrq->stop, 0);
else
--
1.6.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Uclinux-dist-devel] [PATCH] MMC:mmc_spi: Recover from CRC error for SD read/write operation over SPI.
2010-07-09 8:03 [PATCH] MMC:mmc_spi: Recover from CRC error for SD read/write operation over SPI sonic zhang
@ 2010-07-09 15:43 ` Mike Frysinger
0 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2010-07-09 15:43 UTC (permalink / raw)
To: sonic zhang; +Cc: David Brownell, uclinux-dist-devel, linux-mmc, Linux Kernel
On Fri, Jul 9, 2010 at 04:03, sonic zhang <sonic.adi@gmail.com> wrote:
> SPI bus is not reliable on all platforms when doing large dada transfer.
dada -> data
> occational CRC error is reported by SD device. This patch makes the
occational -> occasional
-mike
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Uclinux-dist-devel] [PATCH] MMC:mmc_spi: Recover from CRC error for SD read/write operation over SPI.
@ 2010-07-09 15:43 ` Mike Frysinger
0 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2010-07-09 15:43 UTC (permalink / raw)
To: sonic zhang; +Cc: David Brownell, uclinux-dist-devel, linux-mmc, Linux Kernel
On Fri, Jul 9, 2010 at 04:03, sonic zhang <sonic.adi@gmail.com> wrote:
> SPI bus is not reliable on all platforms when doing large dada transfer.
dada -> data
> occational CRC error is reported by SD device. This patch makes the
occational -> occasional
-mike
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH RESEND] MMC:mmc_spi: Recover from CRC error for SD read/write operation over SPI.
@ 2010-08-27 20:36 Chris Ball
2010-10-16 21:19 ` [PATCH] " Mike Frysinger
0 siblings, 1 reply; 6+ messages in thread
From: Chris Ball @ 2010-08-27 20:36 UTC (permalink / raw)
To: sonic zhang
Cc: David Brownell, Grant Likely, Anton Vorontsov, Ernst Schwab,
linux-mmc, Linux Kernel, uclinux-dist-devel
Hi,
There were no comments about this patch -- Andrew, please take it if
there are no objections.
From: Sonic Zhang <sonic.zhang@analog.com>
Date: Mon, 12 Jul 2010 15:50:56 +0800
Subject: [PATCH] mmc_spi: Recover from CRC error for SD read/write operation over SPI.
SPI bus is not reliable on all platforms when doing large data transfer.
Current mmc spi driver fails SD read/write command immediately, if
occasional CRC error is reported by SD device. This patch makes the
operation recover from the CRC error by doing last SD command again.
The retry count is set to 5 to ensure the driver pass any stress test.
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
[cjb: fixed merge conflict against current Linus]
Signed-off-by: Chris Ball <cjb@laptop.org>
---
drivers/mmc/host/mmc_spi.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 62a3582..3d48e21 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1055,6 +1055,8 @@ static void mmc_spi_request(struct mmc_host *mmc, struct mmc_request *mrq)
{
struct mmc_spi_host *host = mmc_priv(mmc);
int status = -EINVAL;
+ int crc_retry = 5;
+ struct mmc_command stop;
#ifdef DEBUG
/* MMC core and layered drivers *MUST* issue SPI-aware commands */
@@ -1087,10 +1089,29 @@ static void mmc_spi_request(struct mmc_host *mmc, struct mmc_request *mrq)
/* request exclusive bus access */
spi_bus_lock(host->spi->master);
+crc_recover:
/* issue command; then optionally data and stop */
status = mmc_spi_command_send(host, mrq, mrq->cmd, mrq->data != NULL);
if (status == 0 && mrq->data) {
mmc_spi_data_do(host, mrq->cmd, mrq->data, mrq->data->blksz);
+
+ /*
+ * SPI bus is not reliable when doing large data transfer.
+ * If occasional crc error is reported by SD device when do
+ * data read/write over SPI, it can be recovered by doing
+ * last SD command again. The retry count is set to 5 to
+ * ensure the driver pass any stress test.
+ */
+ if (mrq->data->error == -EILSEQ && crc_retry) {
+ stop.opcode = MMC_STOP_TRANSMISSION;
+ stop.arg = 0;
+ stop.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
+ status = mmc_spi_command_send(host, mrq, &stop, 0);
+ crc_retry--;
+ mrq->data->error = 0;
+ goto crc_recover;
+ }
+
if (mrq->stop)
status = mmc_spi_command_send(host, mrq, mrq->stop, 0);
else
--
1.7.0.1
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] MMC:mmc_spi: Recover from CRC error for SD read/write operation over SPI.
2010-08-27 20:36 [PATCH RESEND] " Chris Ball
@ 2010-10-16 21:19 ` Mike Frysinger
2010-10-16 23:01 ` Chris Ball
0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2010-10-16 21:19 UTC (permalink / raw)
To: linux-mmc, Adrian Hunter, Andrew Morton
Cc: uclinux-dist-devel, linux-kernel, David Brownell, Grant Likely,
Anton Vorontsov, Ernst Schwab, Sonic Zhang, Chris Ball
From: Sonic Zhang <sonic.zhang@analog.com>
SPI bus is not reliable on all platforms when doing large data transfer.
Current mmc spi driver fails SD read/write command immediately, if
occasional CRC error is reported by SD device. This patch makes the
operation recover from the CRC error by doing last SD command again.
The retry count is set to 5 to ensure the driver pass any stress test.
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
[cjb: fixed merge conflict against current Linus]
Signed-off-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
Andrew: we posted this months ago with no feedback ... could you pick it up ?
drivers/mmc/host/mmc_spi.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 62a3582..fbd673e 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1055,6 +1055,8 @@ static void mmc_spi_request(struct mmc_host *mmc, struct mmc_request *mrq)
{
struct mmc_spi_host *host = mmc_priv(mmc);
int status = -EINVAL;
+ int crc_retry = 5;
+ struct mmc_command stop;
#ifdef DEBUG
/* MMC core and layered drivers *MUST* issue SPI-aware commands */
@@ -1087,10 +1089,30 @@ static void mmc_spi_request(struct mmc_host *mmc, struct mmc_request *mrq)
/* request exclusive bus access */
spi_bus_lock(host->spi->master);
+ crc_recover:
/* issue command; then optionally data and stop */
status = mmc_spi_command_send(host, mrq, mrq->cmd, mrq->data != NULL);
if (status == 0 && mrq->data) {
mmc_spi_data_do(host, mrq->cmd, mrq->data, mrq->data->blksz);
+
+ /*
+ * SPI bus is not reliable when doing large data transfer.
+ * If occasional crc error is reported by SD device when do
+ * data read/write over SPI, it can be recovered by doing
+ * last SD command again. The retry count is set to 5 to
+ * ensure the driver pass any stress test.
+ */
+ if (mrq->data->error == -EILSEQ && crc_retry) {
+ stop.opcode = MMC_STOP_TRANSMISSION;
+ stop.arg = 0;
+ stop.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
+
+ status = mmc_spi_command_send(host, mrq, &stop, 0);
+ crc_retry--;
+ mrq->data->error = 0;
+ goto crc_recover;
+ }
+
if (mrq->stop)
status = mmc_spi_command_send(host, mrq, mrq->stop, 0);
else
--
1.7.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] MMC:mmc_spi: Recover from CRC error for SD read/write operation over SPI.
2010-10-16 21:19 ` [PATCH] " Mike Frysinger
@ 2010-10-16 23:01 ` Chris Ball
2010-10-16 23:11 ` Mike Frysinger
0 siblings, 1 reply; 6+ messages in thread
From: Chris Ball @ 2010-10-16 23:01 UTC (permalink / raw)
To: Mike Frysinger
Cc: linux-mmc, Adrian Hunter, Andrew Morton, uclinux-dist-devel,
linux-kernel, David Brownell, Grant Likely, Anton Vorontsov,
Ernst Schwab, Sonic Zhang
On Sat, Oct 16, 2010 at 05:19:36PM -0400, Mike Frysinger wrote:
> Andrew: we posted this months ago with no feedback ... could you pick it up ?
Sorry, my fault for missing this -- I've pushed it to mmc-next now,
with minor language changes.
Thanks,
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] MMC:mmc_spi: Recover from CRC error for SD read/write operation over SPI.
2010-10-16 23:01 ` Chris Ball
@ 2010-10-16 23:11 ` Mike Frysinger
0 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2010-10-16 23:11 UTC (permalink / raw)
To: Chris Ball
Cc: linux-mmc, Adrian Hunter, Andrew Morton, uclinux-dist-devel,
linux-kernel, David Brownell, Grant Likely, Anton Vorontsov,
Ernst Schwab, Sonic Zhang
On Sat, Oct 16, 2010 at 19:01, Chris Ball wrote:
> On Sat, Oct 16, 2010 at 05:19:36PM -0400, Mike Frysinger wrote:
>> Andrew: we posted this months ago with no feedback ... could you pick it up ?
>
> Sorry, my fault for missing this -- I've pushed it to mmc-next now,
> with minor language changes.
np. thanks !
-mike
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-10-16 23:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-09 8:03 [PATCH] MMC:mmc_spi: Recover from CRC error for SD read/write operation over SPI sonic zhang
2010-07-09 15:43 ` [Uclinux-dist-devel] " Mike Frysinger
2010-07-09 15:43 ` Mike Frysinger
2010-08-27 20:36 [PATCH RESEND] " Chris Ball
2010-10-16 21:19 ` [PATCH] " Mike Frysinger
2010-10-16 23:01 ` Chris Ball
2010-10-16 23:11 ` Mike Frysinger
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.