| From 6fa5c9807b85480145cbdcd4eb14844181a09117 Mon Sep 17 00:00:00 2001 |
| From: Guennadi Liakhovetski <g.liakhovetski@gmx.de> |
| Date: Mon, 22 Apr 2013 10:29:26 +0200 |
| Subject: mmc: tmio: postpone controller reset during resume |
| |
| When resuming, the tmio_mmc_host_resume() function is run when the |
| controller might still be powered down. Issuing a reset command to it at |
| that time has no effect. This patch postpones resetting the controller |
| until the first powering-up .set_ios() call. |
| |
| Reported-by: Nguyen Viet Dung <nv-dung@jinso.co.jp> |
| Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com> |
| Signed-off-by: Chris Ball <cjb@laptop.org> |
| (cherry picked from commit b22ffdcd25d67a07f2b5a75a7805826bfe8597f1) |
| Signed-off-by: Simon Horman <horms+renesas@verge.net.au> |
| --- |
| drivers/mmc/host/tmio_mmc.h | 1 + |
| drivers/mmc/host/tmio_mmc_pio.c | 6 +++++- |
| 2 files changed, 6 insertions(+), 1 deletion(-) |
| |
| diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h |
| index d857f5c6..759d8f4f 100644 |
| --- a/drivers/mmc/host/tmio_mmc.h |
| +++ b/drivers/mmc/host/tmio_mmc.h |
| @@ -85,6 +85,7 @@ struct tmio_mmc_host { |
| unsigned long last_req_ts; |
| struct mutex ios_lock; /* protect set_ios() context */ |
| bool native_hotplug; |
| + bool resuming; |
| }; |
| |
| int tmio_mmc_host_probe(struct tmio_mmc_host **host, |
| diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c |
| index 5a1bc3b4..7e644da0 100644 |
| --- a/drivers/mmc/host/tmio_mmc_pio.c |
| +++ b/drivers/mmc/host/tmio_mmc_pio.c |
| @@ -862,6 +862,10 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) |
| if (!host->power) { |
| tmio_mmc_clk_update(mmc); |
| pm_runtime_get_sync(dev); |
| + if (host->resuming) { |
| + tmio_mmc_reset(host); |
| + host->resuming = false; |
| + } |
| } |
| tmio_mmc_set_clock(host, ios->clock); |
| if (!host->power) { |
| @@ -1154,10 +1158,10 @@ 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 */ |
| + host->resuming = true; |
| return mmc_resume_host(mmc); |
| } |
| EXPORT_SYMBOL(tmio_mmc_host_resume); |
| -- |
| 1.8.4.3.gca3854a |
| |