diff mbox

[v2] mmc: tmio: reset the controller after power-up

Message ID Pine.LNX.4.64.1304241143460.11670@axis700.grange (mailing list archive)
State Superseded
Headers show

Commit Message

Guennadi Liakhovetski April 24, 2013, 9:59 a.m. UTC
This fixes two reported problems:
1. after a system resume the controller isn't functioning until a command
   runs on a timeout and a controller reset is performed.
2. if a card is ejected during a running write operation, its re-insertion
   isn't detected.

Reported-by: Nguyen Viet Dung <nv-dung@jinso.co.jp>
Reported-by: Nguyen Hong Ky <nh-ky@jinso.co.jp>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
---

v2: this patch supersedes the earlier "mmc: tmio: postpone controller 
reset during resume" in that it extends the number of cases, in which the 
reset is applied. It turned out, it is needed not only after a resume, but 
also for recovery after an interrupted write. It also now applies on top 
of "[PATCH v2] MMC: tmio: fix unbalanced power-on calls with clock-gating 
enabled" http://article.gmane.org/gmane.linux.kernel.mmc/20233. Reporters 
are cordially invited to add their "Tested-by" tags ;-)

Chris, both these patches are fixes. Not sure whether it's still a good 
idea to push them for 3.9, maybe better get them into 3.10 and then to 
stable?

 drivers/mmc/host/tmio_mmc_pio.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Guennadi Liakhovetski April 25, 2013, 10:41 a.m. UTC | #1
Hi Chris

On Wed, 24 Apr 2013, Guennadi Liakhovetski wrote:

> This fixes two reported problems:
> 1. after a system resume the controller isn't functioning until a command
>    runs on a timeout and a controller reset is performed.
> 2. if a card is ejected during a running write operation, its re-insertion
>    isn't detected.
> 
> Reported-by: Nguyen Viet Dung <nv-dung@jinso.co.jp>
> Reported-by: Nguyen Hong Ky <nh-ky@jinso.co.jp>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>

Please, add the following tags, when applying:

Tested-by: Nguyen Viet Dung <nv-dung@jinso.co.jp>
Tested-by: Nguyen Hong Ky <nh-ky@jinso.co.jp>

Thanks
Guennadi

> ---
> 
> v2: this patch supersedes the earlier "mmc: tmio: postpone controller 
> reset during resume" in that it extends the number of cases, in which the 
> reset is applied. It turned out, it is needed not only after a resume, but 
> also for recovery after an interrupted write. It also now applies on top 
> of "[PATCH v2] MMC: tmio: fix unbalanced power-on calls with clock-gating 
> enabled" http://article.gmane.org/gmane.linux.kernel.mmc/20233. Reporters 
> are cordially invited to add their "Tested-by" tags ;-)
> 
> Chris, both these patches are fixes. Not sure whether it's still a good 
> idea to push them for 3.9, maybe better get them into 3.10 and then to 
> stable?
> 
>  drivers/mmc/host/tmio_mmc_pio.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> index 1d5ef64..fcb9503 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
> @@ -863,6 +863,8 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>  			tmio_mmc_clk_update(mmc);
>  			pm_runtime_get_sync(dev);
>  		}
> +		if (host->power == TMIO_MMC_OFF_STOP)
> +			tmio_mmc_reset(host);
>  		tmio_mmc_set_clock(host, ios->clock);
>  		if (host->power == TMIO_MMC_OFF_STOP)
>  			/* power up SD card and the bus */
> @@ -1161,7 +1163,6 @@ int tmio_mmc_host_resume(struct device *dev)
>  	struct mmc_host *mmc = dev_get_drvdata(dev);
>  	struct tmio_mmc_host *host = mmc_priv(mmc);
>  
> -	tmio_mmc_reset(host);
>  	tmio_mmc_enable_dma(host, true);
>  
>  	/* The MMC core will perform the complete set up */
> -- 
> 1.7.2.5
> 
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Guennadi Liakhovetski June 6, 2013, 7:36 a.m. UTC | #2
Hi Chris

On Thu, 25 Apr 2013, Guennadi Liakhovetski wrote:

> Hi Chris
> 
> On Wed, 24 Apr 2013, Guennadi Liakhovetski wrote:
> 
> > This fixes two reported problems:
> > 1. after a system resume the controller isn't functioning until a command
> >    runs on a timeout and a controller reset is performed.
> > 2. if a card is ejected during a running write operation, its re-insertion
> >    isn't detected.
> > 
> > Reported-by: Nguyen Viet Dung <nv-dung@jinso.co.jp>
> > Reported-by: Nguyen Hong Ky <nh-ky@jinso.co.jp>
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
> 
> Please, add the following tags, when applying:
> 
> Tested-by: Nguyen Viet Dung <nv-dung@jinso.co.jp>
> Tested-by: Nguyen Hong Ky <nh-ky@jinso.co.jp>

This one too, please :)

Thanks
Guennadi

> > ---
> > 
> > v2: this patch supersedes the earlier "mmc: tmio: postpone controller 
> > reset during resume" in that it extends the number of cases, in which the 
> > reset is applied. It turned out, it is needed not only after a resume, but 
> > also for recovery after an interrupted write. It also now applies on top 
> > of "[PATCH v2] MMC: tmio: fix unbalanced power-on calls with clock-gating 
> > enabled" http://article.gmane.org/gmane.linux.kernel.mmc/20233. Reporters 
> > are cordially invited to add their "Tested-by" tags ;-)
> > 
> > Chris, both these patches are fixes. Not sure whether it's still a good 
> > idea to push them for 3.9, maybe better get them into 3.10 and then to 
> > stable?
> > 
> >  drivers/mmc/host/tmio_mmc_pio.c |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> > index 1d5ef64..fcb9503 100644
> > --- a/drivers/mmc/host/tmio_mmc_pio.c
> > +++ b/drivers/mmc/host/tmio_mmc_pio.c
> > @@ -863,6 +863,8 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
> >  			tmio_mmc_clk_update(mmc);
> >  			pm_runtime_get_sync(dev);
> >  		}
> > +		if (host->power == TMIO_MMC_OFF_STOP)
> > +			tmio_mmc_reset(host);
> >  		tmio_mmc_set_clock(host, ios->clock);
> >  		if (host->power == TMIO_MMC_OFF_STOP)
> >  			/* power up SD card and the bus */
> > @@ -1161,7 +1163,6 @@ int tmio_mmc_host_resume(struct device *dev)
> >  	struct mmc_host *mmc = dev_get_drvdata(dev);
> >  	struct tmio_mmc_host *host = mmc_priv(mmc);
> >  
> > -	tmio_mmc_reset(host);
> >  	tmio_mmc_enable_dma(host, true);
> >  
> >  	/* The MMC core will perform the complete set up */
> > -- 
> > 1.7.2.5
> > 
> > 
> 
> ---
> Guennadi Liakhovetski, Ph.D.
> Freelance Open-Source Software Developer
> http://www.open-technology.de/
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chris Ball June 6, 2013, 11:43 a.m. UTC | #3
Hi,

On Wed, Apr 24 2013, Guennadi Liakhovetski wrote:
> This fixes two reported problems:
> 1. after a system resume the controller isn't functioning until a command
>    runs on a timeout and a controller reset is performed.
> 2. if a card is ejected during a running write operation, its re-insertion
>    isn't detected.
>
> Reported-by: Nguyen Viet Dung <nv-dung@jinso.co.jp>
> Reported-by: Nguyen Hong Ky <nh-ky@jinso.co.jp>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>

This doesn't apply to mmc-next -- please could you rebase/resend?

- Chris.
diff mbox

Patch

diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 1d5ef64..fcb9503 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -863,6 +863,8 @@  static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 			tmio_mmc_clk_update(mmc);
 			pm_runtime_get_sync(dev);
 		}
+		if (host->power == TMIO_MMC_OFF_STOP)
+			tmio_mmc_reset(host);
 		tmio_mmc_set_clock(host, ios->clock);
 		if (host->power == TMIO_MMC_OFF_STOP)
 			/* power up SD card and the bus */
@@ -1161,7 +1163,6 @@  int tmio_mmc_host_resume(struct device *dev)
 	struct mmc_host *mmc = dev_get_drvdata(dev);
 	struct tmio_mmc_host *host = mmc_priv(mmc);
 
-	tmio_mmc_reset(host);
 	tmio_mmc_enable_dma(host, true);
 
 	/* The MMC core will perform the complete set up */