All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: sunxi-ng: h6: Fix default PLL GPU rate
@ 2022-09-28 20:01 ` Jernej Skrabec
  0 siblings, 0 replies; 4+ messages in thread
From: Jernej Skrabec @ 2022-09-28 20:01 UTC (permalink / raw)
  To: wens, samuel
  Cc: mturquette, sboyd, r.stratiienko, linux-clk, linux-arm-kernel,
	linux-sunxi, linux-kernel, Jernej Skrabec

In commit 4167ac8a657e ("clk: sunxi-ng: sun50i: h6: Modify GPU clock
configuration to support DFS") divider M0 was forced to be 1 in order to
support DFS. However, that left N as it is, at high value of 36. On
boards without devfreq enabled (all of them in kernel 6.0), this
effectively sets GPU frequency to 864 MHz. This is about 100 MHz above
maximum supported frequency.

In order to fix this, let's set N to 18 (register value 17). That way
default frequency of 432 MHz is preserved.

Fixes: 4167ac8a657e ("clk: sunxi-ng: sun50i: h6: Modify GPU clock configuration to support DFS")
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
---
 drivers/clk/sunxi-ng/ccu-sun50i-h6.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
index 30056da3e0af..42568c616181 100644
--- a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
+++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
@@ -1191,9 +1191,13 @@ static int sun50i_h6_ccu_probe(struct platform_device *pdev)
 	if (IS_ERR(reg))
 		return PTR_ERR(reg);
 
-	/* Force PLL_GPU output divider bits to 0 */
+	/*
+	 * Force PLL_GPU output divider bits to 0 and adjust
+	 * multiplier to sensible default value of 432 MHz.
+	 */
 	val = readl(reg + SUN50I_H6_PLL_GPU_REG);
-	val &= ~BIT(0);
+	val &= ~(GENMASK(15, 8) | BIT(0));
+	val |= 17 << 8;
 	writel(val, reg + SUN50I_H6_PLL_GPU_REG);
 
 	/* Force GPU_CLK divider bits to 0 */
-- 
2.37.3


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

* [PATCH] clk: sunxi-ng: h6: Fix default PLL GPU rate
@ 2022-09-28 20:01 ` Jernej Skrabec
  0 siblings, 0 replies; 4+ messages in thread
From: Jernej Skrabec @ 2022-09-28 20:01 UTC (permalink / raw)
  To: wens, samuel
  Cc: mturquette, sboyd, r.stratiienko, linux-clk, linux-arm-kernel,
	linux-sunxi, linux-kernel, Jernej Skrabec

In commit 4167ac8a657e ("clk: sunxi-ng: sun50i: h6: Modify GPU clock
configuration to support DFS") divider M0 was forced to be 1 in order to
support DFS. However, that left N as it is, at high value of 36. On
boards without devfreq enabled (all of them in kernel 6.0), this
effectively sets GPU frequency to 864 MHz. This is about 100 MHz above
maximum supported frequency.

In order to fix this, let's set N to 18 (register value 17). That way
default frequency of 432 MHz is preserved.

Fixes: 4167ac8a657e ("clk: sunxi-ng: sun50i: h6: Modify GPU clock configuration to support DFS")
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
---
 drivers/clk/sunxi-ng/ccu-sun50i-h6.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
index 30056da3e0af..42568c616181 100644
--- a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
+++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
@@ -1191,9 +1191,13 @@ static int sun50i_h6_ccu_probe(struct platform_device *pdev)
 	if (IS_ERR(reg))
 		return PTR_ERR(reg);
 
-	/* Force PLL_GPU output divider bits to 0 */
+	/*
+	 * Force PLL_GPU output divider bits to 0 and adjust
+	 * multiplier to sensible default value of 432 MHz.
+	 */
 	val = readl(reg + SUN50I_H6_PLL_GPU_REG);
-	val &= ~BIT(0);
+	val &= ~(GENMASK(15, 8) | BIT(0));
+	val |= 17 << 8;
 	writel(val, reg + SUN50I_H6_PLL_GPU_REG);
 
 	/* Force GPU_CLK divider bits to 0 */
-- 
2.37.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] clk: sunxi-ng: h6: Fix default PLL GPU rate
  2022-09-28 20:01 ` Jernej Skrabec
@ 2022-09-28 23:42   ` Stephen Boyd
  -1 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2022-09-28 23:42 UTC (permalink / raw)
  To: Jernej Skrabec, samuel, wens
  Cc: mturquette, r.stratiienko, linux-clk, linux-arm-kernel,
	linux-sunxi, linux-kernel, Jernej Skrabec

Quoting Jernej Skrabec (2022-09-28 13:01:22)
> In commit 4167ac8a657e ("clk: sunxi-ng: sun50i: h6: Modify GPU clock
> configuration to support DFS") divider M0 was forced to be 1 in order to
> support DFS. However, that left N as it is, at high value of 36. On
> boards without devfreq enabled (all of them in kernel 6.0), this
> effectively sets GPU frequency to 864 MHz. This is about 100 MHz above
> maximum supported frequency.
> 
> In order to fix this, let's set N to 18 (register value 17). That way
> default frequency of 432 MHz is preserved.
> 
> Fixes: 4167ac8a657e ("clk: sunxi-ng: sun50i: h6: Modify GPU clock configuration to support DFS")
> Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> ---

Applied to clk-fixes

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

* Re: [PATCH] clk: sunxi-ng: h6: Fix default PLL GPU rate
@ 2022-09-28 23:42   ` Stephen Boyd
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2022-09-28 23:42 UTC (permalink / raw)
  To: Jernej Skrabec, samuel, wens
  Cc: mturquette, r.stratiienko, linux-clk, linux-arm-kernel,
	linux-sunxi, linux-kernel, Jernej Skrabec

Quoting Jernej Skrabec (2022-09-28 13:01:22)
> In commit 4167ac8a657e ("clk: sunxi-ng: sun50i: h6: Modify GPU clock
> configuration to support DFS") divider M0 was forced to be 1 in order to
> support DFS. However, that left N as it is, at high value of 36. On
> boards without devfreq enabled (all of them in kernel 6.0), this
> effectively sets GPU frequency to 864 MHz. This is about 100 MHz above
> maximum supported frequency.
> 
> In order to fix this, let's set N to 18 (register value 17). That way
> default frequency of 432 MHz is preserved.
> 
> Fixes: 4167ac8a657e ("clk: sunxi-ng: sun50i: h6: Modify GPU clock configuration to support DFS")
> Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> ---

Applied to clk-fixes

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-09-28 23:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28 20:01 [PATCH] clk: sunxi-ng: h6: Fix default PLL GPU rate Jernej Skrabec
2022-09-28 20:01 ` Jernej Skrabec
2022-09-28 23:42 ` Stephen Boyd
2022-09-28 23:42   ` Stephen Boyd

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.