MMC:mmc_spi: Recover from CRC error for SD read/write operation over SPI.
Subsystems (2)
PATCH v2 1/1 MMC:mmc_spi: Recover from CRC error for SD read/write operation over SPI.
Quoted 1 line
From
94d1ea57ac2fbe37133e25e99ccb265250f0027dMon Sep 17 00:00:00 2001
From: Sonic Zhang <[email protected]>
Date: Fri, 9 Jul 2010 15:36:20 +0800
Subject: [PATCH v2] 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 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.
--- drivers/mmc/host/mmc_spi.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)
drivers/mmc/host/mmc_spi.c +22 -0
@@ -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 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
Signature · 1 line
1.6.0
Any comments?
Sonic
Quoted 70 lines · sonic zhang
Quoted 1 line
From
94d1ea57ac2fbe37133e25e99ccb265250f0027dMon Sep 17 00:00:00 2001From: Sonic Zhang <[email protected]>
Date: Fri, 9 Jul 2010 15:36:20 +0800
Subject: [PATCH v2] 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 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 <[email protected]>---
drivers/mmc/host/mmc_spi.c | 22 ++++++++++++++++++++++1 files changed, 22 insertions(+), 0 deletions(-)drivers/mmc/host/mmc_spi.c +22
-0@@ -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 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.6.0--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 1 line · Sonic Zhang
Any comments?
might want to CC akpm so he'll pick this up in case the mmc guys miss it -mike
PATCH RESEND 1/1 MMC:mmc_spi: Recover from CRC error for SD read/write operation over SPI.
In reply to sonic zhangHi,
There were no comments about this patch -- Andrew, please take it if there are no objections.
From: Sonic Zhang <[email protected]>
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.
--- drivers/mmc/host/mmc_spi.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-)
drivers/mmc/host/mmc_spi.c +21 -0
@@ -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
Signature · 5 lines
1.7.0.1 -- Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child
PATCH 1/1 MMC:mmc_spi: Recover from CRC error for SD read/write operation over SPI.
From: Sonic Zhang <[email protected]>
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.
---
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(-)
drivers/mmc/host/mmc_spi.c +22 -0
@@ -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
Signature · 1 line
1.7.3.1
Quoted 1 line · Mike Frysinger
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,
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child
Quoted 5 lines · Chris Ball
Quoted 1 line · Mike Frysinger
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