Skip to contentSkip to conversation

sunxi: clk: fix N formula for CPUX clocks

PATCH New Quentin Schulz 3 participants 3 messages Sep 26, 2017 – Oct 9, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sunxi: clk: fix N formula for CPUX clocks

As explained in arch/arm/mach-sunxi/clock_sun8i_a83t.c, clk for CPU clusters is computed as clk = 24*n. However, the current formula is clk = 24*(n-1).

This results in a clock set to a frequency that isn't specified as possible for CPUs.

Let's use the correct formula.

Fixes f542948b1e8c ("sunxi: clk: add basic clocks for A83T")
---
 arch/arm/include/asm/arch-sunxi/clock_sun8i_a83t.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/arch-sunxi/clock_sun8i_a83t.h +1 -1
index 5e1346e524..c4f5f5f958 100644
@@ -158,7 +158,7 @@ struct sunxi_ccm_reg {
 #define CPU_CLK_SRC_OSC24M		0
 #define CPU_CLK_SRC_PLL1		1
 
-#define CCM_PLL1_CTRL_N(n)		((((n) - 1) & 0xff) << 8)
+#define CCM_PLL1_CTRL_N(n)		(((n) & 0xff) << 8)
 #define CCM_PLL1_CTRL_P(n)		(((n) & 0x1) << 16)
 #define CCM_PLL1_CTRL_EN		(0x1 << 31)
 #define CMM_PLL1_CLOCK_TIME_2		(0x2 << 24)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 sunxi: clk: fix N formula for CPUX clocks

Quoted 11 lines · Quentin Schulz

As explained in arch/arm/mach-sunxi/clock_sun8i_a83t.c, clk for CPU clusters is computed as clk = 24*n. However, the current formula is clk = 24*(n-1).

This results in a clock set to a frequency that isn't specified as possible for CPUs.

Let's use the correct formula.

Fixes f542948b1e8c ("sunxi: clk: add basic clocks for A83T")

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170926/ae783a5b/attachment.sig>
#2 lore raw

PATCH 1/1 sunxi: clk: fix N formula for CPUX clocks

Quoted 8 lines · Maxime Ripard
Quoted 7 lines · Quentin Schulz

As explained in arch/arm/mach-sunxi/clock_sun8i_a83t.c, clk for CPU clusters is computed as clk = 24*n. However, the current formula is clk = 24*(n-1).

This results in a clock set to a frequency that isn't specified as possible for CPUs.

Quoted 6 lines
Quoted 4 lines

Let's use the correct formula.

Fixes f542948b1e8c ("sunxi: clk: add basic clocks for A83T")

Applied to u-boot-sunxi/master

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.