From: Ulrich Hecht <uli+renesas@fpond.eu>
To: linux-renesas-soc@vger.kernel.org, linux-mmc@vger.kernel.org
Cc: niklas.soderlund@ragnatech.se, wsa@the-dreams.de,
yamada.masahiro@socionext.com, geert@linux-m68k.org,
ulf.hansson@linaro.org, magnus.damm@gmail.com,
Ulrich Hecht <uli+renesas@fpond.eu>
Subject: [PATCH 1/2] mmc: tmio: leave clock handling to PM if enabled
Date: Tue, 16 Jul 2019 17:01:03 +0200 [thread overview]
Message-ID: <1563289264-26432-2-git-send-email-uli+renesas@fpond.eu> (raw)
In-Reply-To: <1563289264-26432-1-git-send-email-uli+renesas@fpond.eu>
This fixes a clock imbalance that occurs because the SD clock is handled
by both PM and the hardware driver.
See https://www.spinics.net/lists/linux-mmc/msg44431.html for details.
This patch removes the clock handling from the driver's PM callbacks and
turns the clock off after probing.
Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
---
drivers/mmc/host/tmio_mmc_core.c | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)
diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index 31ffcc3..26dcbba 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -1260,9 +1260,14 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
/* See if we also get DMA */
tmio_mmc_request_dma(_host, pdata);
- pm_runtime_set_active(&pdev->dev);
+#ifdef CONFIG_PM
+ /* PM handles the clock; disable it so it won't be enabled twice. */
+ if (_host->clk_disable)
+ _host->clk_disable(_host);
+ pm_runtime_get_sync(&pdev->dev);
pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
pm_runtime_use_autosuspend(&pdev->dev);
+#endif
ret = mmc_add_host(mmc);
if (ret)
@@ -1302,20 +1307,6 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
EXPORT_SYMBOL_GPL(tmio_mmc_host_remove);
#ifdef CONFIG_PM
-static int tmio_mmc_clk_enable(struct tmio_mmc_host *host)
-{
- if (!host->clk_enable)
- return -ENOTSUPP;
-
- return host->clk_enable(host);
-}
-
-static void tmio_mmc_clk_disable(struct tmio_mmc_host *host)
-{
- if (host->clk_disable)
- host->clk_disable(host);
-}
-
int tmio_mmc_host_runtime_suspend(struct device *dev)
{
struct tmio_mmc_host *host = dev_get_drvdata(dev);
@@ -1325,8 +1316,6 @@ int tmio_mmc_host_runtime_suspend(struct device *dev)
if (host->clk_cache)
host->set_clock(host, 0);
- tmio_mmc_clk_disable(host);
-
return 0;
}
EXPORT_SYMBOL_GPL(tmio_mmc_host_runtime_suspend);
@@ -1340,7 +1329,6 @@ int tmio_mmc_host_runtime_resume(struct device *dev)
{
struct tmio_mmc_host *host = dev_get_drvdata(dev);
- tmio_mmc_clk_enable(host);
tmio_mmc_hw_reset(host->mmc);
if (host->clk_cache)
--
2.7.4
next prev parent reply other threads:[~2019-07-16 15:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-16 15:01 [PATCH 0/2] mmc: tmio: remove Gen2+ workaround and fix up Ulrich Hecht
2019-07-16 15:01 ` Ulrich Hecht [this message]
2019-07-16 19:05 ` [PATCH 1/2] mmc: tmio: leave clock handling to PM if enabled Wolfram Sang
2019-07-17 1:13 ` Niklas Söderlund
2019-07-25 13:43 ` Ulf Hansson
2019-07-29 8:44 ` Geert Uytterhoeven
2019-07-16 15:01 ` [PATCH 2/2] mmc: tmio: remove obsolete PM workaround Ulrich Hecht
2019-07-29 8:37 ` Geert Uytterhoeven
2019-07-25 21:15 ` [PATCH 0/2] mmc: tmio: remove Gen2+ workaround and fix up Niklas Söderlund
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1563289264-26432-2-git-send-email-uli+renesas@fpond.eu \
--to=uli+renesas@fpond.eu \
--cc=geert@linux-m68k.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=niklas.soderlund@ragnatech.se \
--cc=ulf.hansson@linaro.org \
--cc=wsa@the-dreams.de \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.