diff mbox

mmc: core: Attempt to flush cache before reset

Message ID 1461829739-19772-1-git-send-email-adrian.hunter@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Adrian Hunter April 28, 2016, 7:48 a.m. UTC
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>
---
 drivers/mmc/core/core.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Ulf Hansson May 2, 2016, 8:31 a.m. UTC | #1
On 28 April 2016 at 09:48, Adrian Hunter <adrian.hunter@intel.com> wrote:
> 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.

Makes sense!

>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
>  drivers/mmc/core/core.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 99275e40bf2f..1b4e0ccb0885 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -2453,6 +2453,12 @@ int mmc_hw_reset(struct mmc_host *host)
>                 return -EOPNOTSUPP;
>         }
>
> +       /*
> +        * 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);
> +

I prefer if you move this into mmc_reset() in drivers/mmc/core/mmc.c
instead, as it's an mmc specific operation.

>         ret = host->bus_ops->reset(host);
>         mmc_bus_put(host);
>
> --
> 1.9.1
>

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 99275e40bf2f..1b4e0ccb0885 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2453,6 +2453,12 @@  int mmc_hw_reset(struct mmc_host *host)
 		return -EOPNOTSUPP;
 	}
 
+	/*
+	 * 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);
+
 	ret = host->bus_ops->reset(host);
 	mmc_bus_put(host);