From 437db4c6e79881d33aca521987188c728df350a8 Mon Sep 17 00:00:00 2001 From: Adrian Hunter Date: Wed, 4 May 2016 10:38:21 +0300 Subject: mmc: mmc: Attempt to flush cache before reset CMD0 or hardware reset may invalidate the cache, so it needs to be flushed before reset. In the case of recovery, we can't expect flushing the cache to work always, but have a go and ignore errors. Signed-off-by: Adrian Hunter Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 28b477d397b1..f99c47e003fe 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1958,6 +1958,12 @@ static int mmc_reset(struct mmc_host *host) { struct mmc_card *card = host->card; + /* + * In the case of recovery, we can't expect flushing the cache to work + * always, but we have a go and ignore errors. + */ + mmc_flush_cache(host->card); + if ((host->caps & MMC_CAP_HW_RESET) && host->ops->hw_reset && mmc_can_reset(card)) { /* If the card accept RST_n signal, send it. */ -- cgit v1.2.3