diff mbox

[V2] mmc: mmc: Attempt to flush cache before reset

Message ID 5729A6ED.4010009@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Adrian Hunter May 4, 2016, 7:38 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>
---


Changes in V2:

	Do flush in mmc_reset() instead of mmc_hw_reset()


 drivers/mmc/core/mmc.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Ulf Hansson May 4, 2016, 11:13 a.m. UTC | #1
On 4 May 2016 at 09:38, 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.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>

Thanks, applied for next!

Kind regards
Uffe

> ---
>
>
> Changes in V2:
>
>         Do flush in mmc_reset() instead of mmc_hw_reset()
>
>
>  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 0cf42af33d0f..d4d1b77c1c1e 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1965,6 +1965,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. */
> --
> 1.9.1
>
>
--
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/mmc.c b/drivers/mmc/core/mmc.c
index 0cf42af33d0f..d4d1b77c1c1e 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1965,6 +1965,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. */