linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] clk: x86: Do not gate clocks enabled by the firmware
@ 2017-07-14  8:23 Carlo Caione
  2017-07-18 23:24 ` Stephen Boyd
  2017-09-07  9:22 ` Carlo Caione
  0 siblings, 2 replies; 10+ messages in thread
From: Carlo Caione @ 2017-07-14  8:23 UTC (permalink / raw)
  To: mturquette, linux-clk, dvhart, pierre-louis.bossart, sboyd, linux,
	eballetbo, andriy.shevchenko
  Cc: Carlo Caione

From: Carlo Caione <carlo@endlessm.com>

Read the enable register to determine if the clock is already in use by
the firmware. In this case avoid gating the clock.

Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Darren Hart (VMware) <dvhart@infradead.org>
Signed-off-by: Carlo Caione <carlo@endlessm.com>
---
 drivers/clk/x86/clk-pmc-atom.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/clk/x86/clk-pmc-atom.c b/drivers/clk/x86/clk-pmc-atom.c
index 2b60577703ef..be8d821ce625 100644
--- a/drivers/clk/x86/clk-pmc-atom.c
+++ b/drivers/clk/x86/clk-pmc-atom.c
@@ -185,6 +185,13 @@ static struct clk_plt *plt_clk_register(struct platform_device *pdev, int id,
 	pclk->reg = base + PMC_CLK_CTL_OFFSET + id * PMC_CLK_CTL_SIZE;
 	spin_lock_init(&pclk->lock);
 
+	/*
+	 * If the clock was already enabled by the firmware mark it as critical
+	 * to avoid it being gated by the clock framework if no driver owns it.
+	 */
+	if (plt_clk_is_enabled(&pclk->hw))
+		init.flags |= CLK_IS_CRITICAL;
+
 	ret = devm_clk_hw_register(&pdev->dev, &pclk->hw);
 	if (ret) {
 		pclk = ERR_PTR(ret);
-- 
2.13.2

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

end of thread, other threads:[~2017-09-22 22:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-14  8:23 [PATCH v3] clk: x86: Do not gate clocks enabled by the firmware Carlo Caione
2017-07-18 23:24 ` Stephen Boyd
2017-09-07  9:22 ` Carlo Caione
2017-09-07 11:59   ` Pierre-Louis Bossart
2017-09-07 21:51     ` Pierre-Louis Bossart
2017-09-08  8:05       ` Carlo Caione
2017-09-18  8:05       ` Andy Shevchenko
2017-09-22 21:36         ` Darren Hart
2017-09-22 21:47           ` Carlo Caione
2017-09-22 22:17           ` Pierre-Louis Bossart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).