mmc: dw_mmc: Fix hang on data CRC error
Subsystems (2)
PATCH 1/1 mmc: dw_mmc: Fix hang on data CRC error
When a Data CRC interrupt is received, the driver disables the DMA, then sends the stop/abort command and then waits for Data Transfer Over.
However, sometimes, when a data CRC error is received in the middle of a multi-block write transfer, the Data Transfer Over interrupt is never received, and the driver hangs and never completes the request.
The driver sets the BMOD.SWR bit (SDMMC_IDMAC_SWRESET) when stopping the DMA, but according to the manual CMD.STOP_ABORT_CMD should be programmed "before assertion of SWR". Do these operations in the recommended order. With this change the Data Transfer Over is always received correctly in my tests.
--- drivers/mmc/host/dw_mmc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mmc/host/dw_mmc.c +3 -3
@@ -2083,8 +2083,8 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t)continue ; } -dw_mci_stop_dma (host);send_stop_abort (host, data); +dw_mci_stop_dma (host); state =STATE_SENDING_STOP ;break ; }
@@ -2108,10 +2108,10 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t)*/ if (test_and_clear_bit (EVENT_DATA_ERROR , &host->pending_events)) { -dw_mci_stop_dma (host);if (!(host->data_status & (SDMMC_INT_DRTO |SDMMC_INT_EBE )))send_stop_abort (host, data); +dw_mci_stop_dma (host); state =STATE_DATA_ERROR ;break ; }
@@ -2144,10 +2144,10 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t)*/ if (test_and_clear_bit (EVENT_DATA_ERROR , &host->pending_events)) { -dw_mci_stop_dma (host);if (!(host->data_status & (SDMMC_INT_DRTO |SDMMC_INT_EBE )))send_stop_abort (host, data); +dw_mci_stop_dma (host); state =STATE_DATA_ERROR ;break ; }
Signature · 1 line
2.28.0
Jaehoon Chung
maintainerDear Vincent,
Quoted 7 lines · Vincent Whitchurch
When a Data CRC interrupt is received, the driver disables the DMA, then sends the stop/abort command and then waits for Data Transfer Over.
However, sometimes, when a data CRC error is received in the middle of a multi-block write transfer, the Data Transfer Over interrupt is never received, and the driver hangs and never completes the request.
Quoted 5 lines
The driver sets the BMOD.SWR bit (
SDMMC_IDMAC_SWRESET) when stopping the DMA, but according to the manual CMD.STOP_ABORT_CMD should be programmed "before assertion of SWR". Do these operations in the recommended order. With this change the Data Transfer Over is always received correctly in my tests.
I will check with your patch. I didn't see any CRC error on my targets before.
Best Regards,
Jaehoon Chung
Quoted 45 lines
Signed-off-by Vincent Whitchurch <[email protected]>--- drivers/mmc/host/dw_mmc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/mmc/host/dw_mmc.c +3
-3@@ -2083,8 +2083,8 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t)continue ; } -dw_mci_stop_dma (host);send_stop_abort (host, data); +dw_mci_stop_dma (host); state =STATE_SENDING_STOP ;break ; }@@ -2108,10 +2108,10 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t)*/ if (test_and_clear_bit (EVENT_DATA_ERROR , &host->pending_events)) { -dw_mci_stop_dma (host);if (!(host->data_status & (SDMMC_INT_DRTO |SDMMC_INT_EBE )))send_stop_abort (host, data); +dw_mci_stop_dma (host); state =STATE_DATA_ERROR ;break ; }@@ -2144,10 +2144,10 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t)*/ if (test_and_clear_bit (EVENT_DATA_ERROR , &host->pending_events)) { -dw_mci_stop_dma (host);if (!(host->data_status & (SDMMC_INT_DRTO |SDMMC_INT_EBE )))send_stop_abort (host, data); +dw_mci_stop_dma (host); state =STATE_DATA_ERROR ;break ; }
Quoted 8 lines · Jaehoon Chung
Quoted 7 lines · Vincent Whitchurch
When a Data CRC interrupt is received, the driver disables the DMA, then sends the stop/abort command and then waits for Data Transfer Over.
However, sometimes, when a data CRC error is received in the middle of a multi-block write transfer, the Data Transfer Over interrupt is never received, and the driver hangs and never completes the request.
Quoted 7 lines
Quoted 5 lines
The driver sets the BMOD.SWR bit (
SDMMC_IDMAC_SWRESET) when stopping the DMA, but according to the manual CMD.STOP_ABORT_CMD should be programmed "before assertion of SWR". Do these operations in the recommended order. With this change the Data Transfer Over is always received correctly in my tests.I will check with your patch. I didn't see any CRC error on my targets before.
Have you had a chance to check it? You can use the fault-injection patch if you want to trigger aborted transfers without getting real CRC errors:
Jaehoon Chung
maintainerQuoted 23 lines · Vincent Whitchurch
Quoted 8 lines · Jaehoon Chung
Quoted 7 lines · Vincent Whitchurch
When a Data CRC interrupt is received, the driver disables the DMA, then sends the stop/abort command and then waits for Data Transfer Over.
However, sometimes, when a data CRC error is received in the middle of a multi-block write transfer, the Data Transfer Over interrupt is never received, and the driver hangs and never completes the request.
Quoted 7 lines
Quoted 5 lines
The driver sets the BMOD.SWR bit (
SDMMC_IDMAC_SWRESET) when stopping the DMA, but according to the manual CMD.STOP_ABORT_CMD should be programmed "before assertion of SWR". Do these operations in the recommended order. With this change the Data Transfer Over is always received correctly in my tests.I will check with your patch. I didn't see any CRC error on my targets before.
Have you had a chance to check it? You can use the fault-injection patch if you want to trigger aborted transfers without getting real CRC errors:
Jaehoon Chung
maintainerHi Vicent,
Quoted 15 lines · Vincent Whitchurch
Quoted 14 lines · Jaehoon Chung
Quoted 12 lines · Vincent Whitchurch
When a Data CRC interrupt is received, the driver disables the DMA, then sends the stop/abort command and then waits for Data Transfer Over.
However, sometimes, when a data CRC error is received in the middle of a multi-block write transfer, the Data Transfer Over interrupt is never received, and the driver hangs and never completes the request.
The driver sets the BMOD.SWR bit (
SDMMC_IDMAC_SWRESET) when stopping the DMA, but according to the manual CMD.STOP_ABORT_CMD should be programmed "before assertion of SWR". Do these operations in the recommended order. With this change the Data Transfer Over is always received correctly in my tests.
Quoted 5 lines
Quoted 1 line
I will check with your patch. I didn't see any CRC error on my targets before.
Have you had a chance to check it? You can use the fault-injection patch if you want to trigger aborted transfers without getting real CRC errors:
Sorry for too late. I did my other task. I will check yours on Today. Anyway, Thanks for checking this issue.
Best Regards,
Jaehoon Chung
Quoted 7 lines · Vincent Whitchurch
When a Data CRC interrupt is received, the driver disables the DMA, then sends the stop/abort command and then waits for Data Transfer Over.
However, sometimes, when a data CRC error is received in the middle of a multi-block write transfer, the Data Transfer Over interrupt is never received, and the driver hangs and never completes the request.
Quoted 7 lines
The driver sets the BMOD.SWR bit (
SDMMC_IDMAC_SWRESET) when stopping the DMA, but according to the manual CMD.STOP_ABORT_CMD should be programmed "before assertion of SWR". Do these operations in the recommended order. With this change the Data Transfer Over is always received correctly in my tests.Signed-off-by Vincent Whitchurch <[email protected]>
Best Regards,
Jaehoon Chung
Quoted 43 lines
--- drivers/mmc/host/dw_mmc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/mmc/host/dw_mmc.c +3
-3@@ -2083,8 +2083,8 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t)continue ; } -dw_mci_stop_dma (host);send_stop_abort (host, data); +dw_mci_stop_dma (host); state =STATE_SENDING_STOP ;break ; }@@ -2108,10 +2108,10 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t)*/ if (test_and_clear_bit (EVENT_DATA_ERROR , &host->pending_events)) { -dw_mci_stop_dma (host);if (!(host->data_status & (SDMMC_INT_DRTO |SDMMC_INT_EBE )))send_stop_abort (host, data); +dw_mci_stop_dma (host); state =STATE_DATA_ERROR ;break ; }@@ -2144,10 +2144,10 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t)*/ if (test_and_clear_bit (EVENT_DATA_ERROR , &host->pending_events)) { -dw_mci_stop_dma (host);if (!(host->data_status & (SDMMC_INT_DRTO |SDMMC_INT_EBE )))send_stop_abort (host, data); +dw_mci_stop_dma (host); state =STATE_DATA_ERROR ;break ; }
Quoted 8 lines · Vincent Whitchurch
When a Data CRC interrupt is received, the driver disables the DMA, then sends the stop/abort command and then waits for Data Transfer Over.
However, sometimes, when a data CRC error is received in the middle of a multi-block write transfer, the Data Transfer Over interrupt is never received, and the driver hangs and never completes the request.
Quoted 7 lines
The driver sets the BMOD.SWR bit (
SDMMC_IDMAC_SWRESET) when stopping the DMA, but according to the manual CMD.STOP_ABORT_CMD should be programmed "before assertion of SWR". Do these operations in the recommended order. With this change the Data Transfer Over is always received correctly in my tests.Signed-off-by Vincent Whitchurch <[email protected]>
Applied for fixes and by adding a stable tag, thanks!
Kind regards
Uffe
Quoted 45 lines
--- drivers/mmc/host/dw_mmc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/mmc/host/dw_mmc.c +3
-4@@ -2083,8 +2083,8 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t)continue ; } -dw_mci_stop_dma (host);send_stop_abort (host, data); +dw_mci_stop_dma (host); state =STATE_SENDING_STOP ;break ; }@@ -2108,10 +2108,10 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t)*/ if (test_and_clear_bit (EVENT_DATA_ERROR , &host->pending_events)) { -dw_mci_stop_dma (host);if (!(host->data_status & (SDMMC_INT_DRTO |SDMMC_INT_EBE )))send_stop_abort (host, data); +dw_mci_stop_dma (host); state =STATE_DATA_ERROR ;break ; }@@ -2144,10 +2144,10 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t)*/ if (test_and_clear_bit (EVENT_DATA_ERROR , &host->pending_events)) { -dw_mci_stop_dma (host);if (!(host->data_status & (SDMMC_INT_DRTO |SDMMC_INT_EBE )))send_stop_abort (host, data); +dw_mci_stop_dma (host); state =STATE_DATA_ERROR ;break ; } --2.28.0