sunxi: clk: fix N formula for CPUX clocks
authorQuentin Schulz <quentin.schulz@free-electrons.com>
Tue, 26 Sep 2017 14:02:47 +0000 (16:02 +0200)
committerMaxime Ripard <maxime.ripard@free-electrons.com>
Wed, 25 Oct 2017 08:05:05 +0000 (10:05 +0200)
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")

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
arch/arm/include/asm/arch-sunxi/clock_sun8i_a83t.h

index 5dfcbf3b017bec52a80f97eab0121302c27de46b..b4ea2f8cfbd509dece962d40044709f585fc5322 100644 (file)
@@ -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)