]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mmc: mmc: Attempt to flush cache before reset
authorAdrian Hunter <adrian.hunter@intel.com>
Wed, 4 May 2016 07:38:21 +0000 (10:38 +0300)
committerUlf Hansson <ulf.hansson@linaro.org>
Wed, 4 May 2016 11:11:53 +0000 (13:11 +0200)
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 <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/mmc.c

index 28b477d397b1be342689a51929983b84e0d96022..f99c47e003fe0dc9bab8db1a8f7047963f202ae8 100644 (file)
@@ -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. */