Skip to contentSkip to conversation

clk: x86: Do not gate clocks enabled by the firmware

PATCH Superseded Carlo Caione 4 participants 4 messages Jul 13, 2017 – Jul 14, 2017 Common clk

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 clk: x86: Do not gate clocks enabled by the firmware

From: Carlo Caione <[email protected]>

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

---
 drivers/clk/x86/clk-pmc-atom.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/clk/x86/clk-pmc-atom.c +7 -0
index 2b60577703ef..3c73d2e564ca 100644
@@ -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 is a 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);
Signature · 1 line
2.13.2
Acked-by on v2 1/1
#1 lore raw
Quoted 6 lines · Carlo Caione

From: Carlo Caione <[email protected]>

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

I suppose it should go via clock tree.

Quoted 29 lines

---
 drivers/clk/x86/clk-pmc-atom.c | 7 +++++++

 1 file changed, 7 insertions(+)
drivers/clk/x86/clk-pmc- renamed from drivers/clk/x86/clk-pmc-atom.c +0 -0

atom.c
index 2b60577703ef..3c73d2e564ca 100644

drivers/clk/x86/clk-pmc-atom.c +0 -0
@@ -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);

drivers/clk/x86/clk-pmc-atom.c +2 -0
+	/*
+	 * If the clock was already enabled by the firmware mark is a

critical

drivers/clk/x86/clk-pmc-atom.c +1 -0
+	 * to avoid it being gated by the clock framework if no

driver owns it

drivers/clk/x86/clk-pmc-atom.c +4 -0
+	 */
+	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);

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
Acked-by
#2 lore raw
Quoted 18 lines · Andy Shevchenko
Quoted 6 lines · Carlo Caione

From: Carlo Caione <[email protected]>

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

I suppose it should go via clock tree.

Quoted 6 lines

---
 drivers/clk/x86/clk-pmc-atom.c | 7 +++++++

 1 file changed, 7 insertions(+)
Quoted 14 lines
Quoted 13 lines
drivers/clk/x86/clk-pmc- renamed from drivers/clk/x86/clk-pmc-atom.c +0 -0

atom.c
index 2b60577703ef..3c73d2e564ca 100644

drivers/clk/x86/clk-pmc-atom.c +0 -0
@@ -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);

drivers/clk/x86/clk-pmc-atom.c +2 -0
+	/*
+	 * If the clock was already enabled by the firmware mark is a
Quoted 1 line

critical

Nit... I think this should read... "mark it as critical" ?

Quoted 2 lines
Quoted 2 lines
drivers/clk/x86/clk-pmc-atom.c +1 -0
+	 * to avoid it being gated by the clock framework if no

driver owns it

owns it.

Signature · 2 lines
Darren Hart
VMware Open Source Technology Center
#3 lore raw
Quoted 36 lines · Darren Hart
Quoted 29 lines · Andy Shevchenko
Quoted 6 lines · Carlo Caione

From: Carlo Caione <[email protected]>

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

I suppose it should go via clock tree.

Quoted 17 lines
---
 drivers/clk/x86/clk-pmc-atom.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/clk/x86/clk-pmc- renamed from drivers/clk/x86/clk-pmc-atom.c +0 -0

atom.c
index 2b60577703ef..3c73d2e564ca 100644

drivers/clk/x86/clk-pmc-atom.c +0 -0
@@ -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);
 
Quoted 3 lines
Quoted 3 lines
drivers/clk/x86/clk-pmc-atom.c +2 -0
+   /*
+    * If the clock was already enabled by the firmware mark is a

critical

Nit... I think this should read... "mark it as critical" ?

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

+ * to avoid it being gated by the clock framework if no
driver owns it

owns it.

Ooops. Yeah, submitting a v3 with better spelling and your ACKs.

Thanks,

Signature · 1 line
Carlo Caione  |  +39.340.80.30.096  |  Endless