* [PATCH] mmc: sdhci-s3c: ensure non-transaction of bus before clk_disable
@ 2012-10-18 9:53 Seungwon Jeon
2012-10-18 11:01 ` [PATCH v2] " Heiko Stübner
0 siblings, 1 reply; 3+ messages in thread
From: Seungwon Jeon @ 2012-10-18 9:53 UTC (permalink / raw)
To: linux-mmc
Cc: 'Heiko Stübner', 'Chander Kashyap',
'Chris Ball'
Clock should be supplied during bus transaction. This patch defers
clk_disabe in runtime_suspend if CMD/DATA line is used.
Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
---
drivers/mmc/host/sdhci-s3c.c | 13 +++++++++----
drivers/mmc/host/sdhci.c | 6 ++++--
drivers/mmc/host/sdhci.h | 2 ++
3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index 2903949..490b781 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -845,12 +845,17 @@ static int sdhci_s3c_runtime_suspend(struct device *dev)
struct sdhci_host *host = dev_get_drvdata(dev);
struct sdhci_s3c *ourhost = to_s3c(host);
struct clk *busclk = ourhost->clk_io;
- int ret;
+ int ret = 0;
- ret = sdhci_runtime_suspend_host(host);
+ if (!(readl(host->ioaddr + SDHCI_PRESENT_STATE) &
+ (SDHCI_CMD_INHIBIT | SDHCI_DATA_INHIBIT))) {
+ ret = sdhci_runtime_suspend_host(host);
+ clk_disable(ourhost->clk_bus[ourhost->cur_clk]);
+ clk_disable(busclk);
+ } else {
+ sdhci_runtime_pm_put(host);
+ }
- clk_disable(ourhost->clk_bus[ourhost->cur_clk]);
- clk_disable(busclk);
return ret;
}
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 7922adb..deeffce 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2535,16 +2535,18 @@ EXPORT_SYMBOL_GPL(sdhci_enable_irq_wakeups);
#ifdef CONFIG_PM_RUNTIME
-static int sdhci_runtime_pm_get(struct sdhci_host *host)
+int sdhci_runtime_pm_get(struct sdhci_host *host)
{
return pm_runtime_get_sync(host->mmc->parent);
}
+EXPORT_SYMBOL_GPL(sdhci_runtime_pm_get);
-static int sdhci_runtime_pm_put(struct sdhci_host *host)
+int sdhci_runtime_pm_put(struct sdhci_host *host)
{
pm_runtime_mark_last_busy(host->mmc->parent);
return pm_runtime_put_autosuspend(host->mmc->parent);
}
+EXPORT_SYMBOL_GPL(sdhci_runtime_pm_put);
int sdhci_runtime_suspend_host(struct sdhci_host *host)
{
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 97653ea..fbf9a08 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -384,6 +384,8 @@ extern void sdhci_enable_irq_wakeups(struct sdhci_host *host);
#endif
#ifdef CONFIG_PM_RUNTIME
+extern int sdhci_runtime_pm_get(struct sdhci_host *host);
+extern int sdhci_runtime_pm_put(struct sdhci_host *host);
extern int sdhci_runtime_suspend_host(struct sdhci_host *host);
extern int sdhci_runtime_resume_host(struct sdhci_host *host);
#endif
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH v2] mmc: sdhci-s3c: ensure non-transaction of bus before clk_disable
2012-10-18 9:53 [PATCH] mmc: sdhci-s3c: ensure non-transaction of bus before clk_disable Seungwon Jeon
@ 2012-10-18 11:01 ` Heiko Stübner
2012-10-29 21:18 ` Chris Ball
0 siblings, 1 reply; 3+ messages in thread
From: Heiko Stübner @ 2012-10-18 11:01 UTC (permalink / raw)
To: Seungwon Jeon; +Cc: linux-mmc, 'Chander Kashyap', 'Chris Ball'
Clock should be supplied during bus transaction. This patch defers
clk_disabe in runtime_suspend if CMD/DATA line is used.
Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
Acked-by: Heiko Stuebner <heiko@sntech.de>
---
It's also necessary to destaticise the forward declarations in the top of
sdhci.c, which I've done in this v2.
drivers/mmc/host/sdhci-s3c.c | 13 +++++++++----
drivers/mmc/host/sdhci.c | 14 ++++++++------
drivers/mmc/host/sdhci.h | 2 ++
3 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index 30e3d01..0cabf18 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -848,12 +848,17 @@ static int sdhci_s3c_runtime_suspend(struct device *dev)
struct sdhci_host *host = dev_get_drvdata(dev);
struct sdhci_s3c *ourhost = to_s3c(host);
struct clk *busclk = ourhost->clk_io;
- int ret;
+ int ret = 0;
- ret = sdhci_runtime_suspend_host(host);
+ if (!(readl(host->ioaddr + SDHCI_PRESENT_STATE) &
+ (SDHCI_CMD_INHIBIT | SDHCI_DATA_INHIBIT))) {
+ ret = sdhci_runtime_suspend_host(host);
+ clk_disable(ourhost->clk_bus[ourhost->cur_clk]);
+ clk_disable(busclk);
+ } else {
+ sdhci_runtime_pm_put(host);
+ }
- clk_disable(ourhost->clk_bus[ourhost->cur_clk]);
- clk_disable(busclk);
return ret;
}
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 7922adb..57de949 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -55,14 +55,14 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode);
static void sdhci_tuning_timer(unsigned long data);
#ifdef CONFIG_PM_RUNTIME
-static int sdhci_runtime_pm_get(struct sdhci_host *host);
-static int sdhci_runtime_pm_put(struct sdhci_host *host);
+int sdhci_runtime_pm_get(struct sdhci_host *host);
+int sdhci_runtime_pm_put(struct sdhci_host *host);
#else
-static inline int sdhci_runtime_pm_get(struct sdhci_host *host)
+inline int sdhci_runtime_pm_get(struct sdhci_host *host)
{
return 0;
}
-static inline int sdhci_runtime_pm_put(struct sdhci_host *host)
+inline int sdhci_runtime_pm_put(struct sdhci_host *host)
{
return 0;
}
@@ -2535,16 +2535,18 @@ EXPORT_SYMBOL_GPL(sdhci_enable_irq_wakeups);
#ifdef CONFIG_PM_RUNTIME
-static int sdhci_runtime_pm_get(struct sdhci_host *host)
+int sdhci_runtime_pm_get(struct sdhci_host *host)
{
return pm_runtime_get_sync(host->mmc->parent);
}
+EXPORT_SYMBOL_GPL(sdhci_runtime_pm_get);
-static int sdhci_runtime_pm_put(struct sdhci_host *host)
+int sdhci_runtime_pm_put(struct sdhci_host *host)
{
pm_runtime_mark_last_busy(host->mmc->parent);
return pm_runtime_put_autosuspend(host->mmc->parent);
}
+EXPORT_SYMBOL_GPL(sdhci_runtime_pm_put);
int sdhci_runtime_suspend_host(struct sdhci_host *host)
{
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 97653ea..fbf9a08 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -384,6 +384,8 @@ extern void sdhci_enable_irq_wakeups(struct sdhci_host *host);
#endif
#ifdef CONFIG_PM_RUNTIME
+extern int sdhci_runtime_pm_get(struct sdhci_host *host);
+extern int sdhci_runtime_pm_put(struct sdhci_host *host);
extern int sdhci_runtime_suspend_host(struct sdhci_host *host);
extern int sdhci_runtime_resume_host(struct sdhci_host *host);
#endif
--
1.7.2.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] mmc: sdhci-s3c: ensure non-transaction of bus before clk_disable
2012-10-18 11:01 ` [PATCH v2] " Heiko Stübner
@ 2012-10-29 21:18 ` Chris Ball
0 siblings, 0 replies; 3+ messages in thread
From: Chris Ball @ 2012-10-29 21:18 UTC (permalink / raw)
To: Heiko Stübner; +Cc: Seungwon Jeon, linux-mmc, 'Chander Kashyap'
Hi,
On Thu, Oct 18 2012, Heiko Stübner wrote:
> Clock should be supplied during bus transaction. This patch defers
> clk_disabe in runtime_suspend if CMD/DATA line is used.
>
> Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
> Acked-by: Heiko Stuebner <heiko@sntech.de>
> ---
> It's also necessary to destaticise the forward declarations in the top of
> sdhci.c, which I've done in this v2.
Looks like this doesn't apply to mmc-next anymore -- please could you
rebase/resend?
Thanks,
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-10-29 21:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-18 9:53 [PATCH] mmc: sdhci-s3c: ensure non-transaction of bus before clk_disable Seungwon Jeon
2012-10-18 11:01 ` [PATCH v2] " Heiko Stübner
2012-10-29 21:18 ` Chris Ball
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.