Page MenuHomeFreeBSD

D50751.1775512141.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D50751.1775512141.diff

Index: sys/dev/mmc/mmcspi.c
===================================================================
--- sys/dev/mmc/mmcspi.c
+++ sys/dev/mmc/mmcspi.c
@@ -106,6 +106,7 @@
#define MMCSPI_DATA_BLOCK_LEN 512
#define MMCSPI_DATA_CRC_LEN 2
+#define MMCSPI_STOP_RETRIES 5 /* times to retry STOP command */
#define MMCSPI_POLL_LEN 8 /* amount to read when searching */
#define MMCSPI_R1_MASK 0x80 /* mask used to search for R1 tokens */
@@ -1411,7 +1412,7 @@
}
static unsigned int
-mmcspi_send_stop(device_t dev, unsigned int retries)
+mmcspi_send_stop(device_t dev)
{
struct mmcspi_command stop;
struct mmc_command mmc_stop;
@@ -1424,6 +1425,7 @@
memset(&mmc_stop, 0, sizeof(mmc_stop));
mmc_stop.opcode = MMC_STOP_TRANSMISSION;
mmc_stop.flags = MMC_RSP_R1B | MMC_CMD_AC;
+ mmc_stop.retries = MMCSPI_STOP_RETRIES;
err = mmcspi_set_up_command(dev, &stop, &mmc_stop);
if (MMC_ERR_NONE != err) {
@@ -1436,10 +1438,12 @@
* the caller retry the entire read/write command due to such a
* failure is pointlessly expensive.
*/
- for (i = 0; i <= retries; i++) {
+ for (i = 0; i <= mmc_stop.retries; i++) {
TRACE(dev, ACTION, "sending stop message\n");
err = mmcspi_send_cmd(dev, &stop, &stop_response);
+ if (MMC_ERR_BADCRC == err)
+ continue;
if (MMC_ERR_NONE != err) {
TRACE_EXIT(dev);
return (err);
@@ -1447,10 +1451,7 @@
TRACE(dev, RESULT, "stop response=0x%02x\n", stop_response);
- /* retry on crc error */
- if (stop_response & stop.error_mask & MMCSPI_R1_CRC_ERR) {
- continue;
- }
+ break;
}
if (stop_response & stop.error_mask) {
@@ -1525,7 +1526,7 @@
/* multi-block read commands require a stop */
if (num_blocks > 1) {
- err = mmcspi_send_stop(dev, cmd->retries);
+ err = mmcspi_send_stop(dev);
if (MMC_ERR_NONE != err) {
TRACE_EXIT(dev);
return (err);
@@ -1621,7 +1622,7 @@
* write phase will be whatever error was
* indicated in the data respone token.
*/
- mmcspi_send_stop(dev, cmd->retries);
+ mmcspi_send_stop(dev);
}
/*

File Metadata

Mime Type
text/plain
Expires
Mon, Apr 6, 9:49 PM (5 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28281626
Default Alt Text
D50751.1775512141.diff (2 KB)

Event Timeline