mmc: bcm2835: reset host on timeout

The bcm2835 mmc host tends to lock up for unknown reason so reset it on
timeout. The upper mmc block layer tries retransimitting with single
blocks which tends to work out after a long wait.

This is better than giving up and leaving the machine broken for no
obvious reason.

Fixes: 660fc733bd ("mmc: bcm2835: Add new driver for the sdhost controller.")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Acked-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
Michal Suchanek 2018-11-11 21:23:53 +01:00 committed by Ulf Hansson
parent 74ff81e16c
commit f6000a4eb3

View File

@ -275,6 +275,7 @@ static void bcm2835_reset(struct mmc_host *mmc)
if (host->dma_chan) if (host->dma_chan)
dmaengine_terminate_sync(host->dma_chan); dmaengine_terminate_sync(host->dma_chan);
host->dma_chan = NULL;
bcm2835_reset_internal(host); bcm2835_reset_internal(host);
} }
@ -826,6 +827,8 @@ static void bcm2835_timeout(struct work_struct *work)
dev_err(dev, "timeout waiting for hardware interrupt.\n"); dev_err(dev, "timeout waiting for hardware interrupt.\n");
bcm2835_dumpregs(host); bcm2835_dumpregs(host);
bcm2835_reset(host->mmc);
if (host->data) { if (host->data) {
host->data->error = -ETIMEDOUT; host->data->error = -ETIMEDOUT;
bcm2835_finish_data(host); bcm2835_finish_data(host);