Commit 25f8203b authored by Vincent Whitchurch's avatar Vincent Whitchurch Committed by Ulf Hansson

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.
Signed-off-by: default avatarVincent Whitchurch <vincent.whitchurch@axis.com>
Reviewed-by: default avatarJaehoon Chung <jh80.chung@samsung.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20210630102232.16011-1-vincent.whitchurch@axis.comSigned-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent c500bee1
...@@ -2018,8 +2018,8 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t) ...@@ -2018,8 +2018,8 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t)
continue; continue;
} }
dw_mci_stop_dma(host);
send_stop_abort(host, data); send_stop_abort(host, data);
dw_mci_stop_dma(host);
state = STATE_SENDING_STOP; state = STATE_SENDING_STOP;
break; break;
} }
...@@ -2043,10 +2043,10 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t) ...@@ -2043,10 +2043,10 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t)
*/ */
if (test_and_clear_bit(EVENT_DATA_ERROR, if (test_and_clear_bit(EVENT_DATA_ERROR,
&host->pending_events)) { &host->pending_events)) {
dw_mci_stop_dma(host);
if (!(host->data_status & (SDMMC_INT_DRTO | if (!(host->data_status & (SDMMC_INT_DRTO |
SDMMC_INT_EBE))) SDMMC_INT_EBE)))
send_stop_abort(host, data); send_stop_abort(host, data);
dw_mci_stop_dma(host);
state = STATE_DATA_ERROR; state = STATE_DATA_ERROR;
break; break;
} }
...@@ -2079,10 +2079,10 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t) ...@@ -2079,10 +2079,10 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t)
*/ */
if (test_and_clear_bit(EVENT_DATA_ERROR, if (test_and_clear_bit(EVENT_DATA_ERROR,
&host->pending_events)) { &host->pending_events)) {
dw_mci_stop_dma(host);
if (!(host->data_status & (SDMMC_INT_DRTO | if (!(host->data_status & (SDMMC_INT_DRTO |
SDMMC_INT_EBE))) SDMMC_INT_EBE)))
send_stop_abort(host, data); send_stop_abort(host, data);
dw_mci_stop_dma(host);
state = STATE_DATA_ERROR; state = STATE_DATA_ERROR;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment