All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: core: Attempt to flush cache before reset
@ 2016-04-28  7:48 Adrian Hunter
  2016-05-02  8:31 ` Ulf Hansson
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Hunter @ 2016-04-28  7:48 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc

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(+)

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);
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: core: Attempt to flush cache before reset
  2016-04-28  7:48 [PATCH] mmc: core: Attempt to flush cache before reset Adrian Hunter
@ 2016-05-02  8:31 ` Ulf Hansson
  2016-05-04  7:38   ` [PATCH V2] mmc: mmc: " Adrian Hunter
  0 siblings, 1 reply; 4+ messages in thread
From: Ulf Hansson @ 2016-05-02  8:31 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: linux-mmc

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH V2] mmc: mmc: Attempt to flush cache before reset
  2016-05-02  8:31 ` Ulf Hansson
@ 2016-05-04  7:38   ` Adrian Hunter
  2016-05-04 11:13     ` Ulf Hansson
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Hunter @ 2016-05-04  7:38 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc

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(+)

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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] mmc: mmc: Attempt to flush cache before reset
  2016-05-04  7:38   ` [PATCH V2] mmc: mmc: " Adrian Hunter
@ 2016-05-04 11:13     ` Ulf Hansson
  0 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2016-05-04 11:13 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: linux-mmc

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
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-05-04 11:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-28  7:48 [PATCH] mmc: core: Attempt to flush cache before reset Adrian Hunter
2016-05-02  8:31 ` Ulf Hansson
2016-05-04  7:38   ` [PATCH V2] mmc: mmc: " Adrian Hunter
2016-05-04 11:13     ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.