diff mbox series

sunxi: clk: fix N formula for CPUX clocks

Message ID 20170926140247.26236-1-quentin.schulz@free-electrons.com
State Accepted
Commit c96f598be7dd075bd0c6bda73b7819c1a6a2016a
Headers show
Series sunxi: clk: fix N formula for CPUX clocks | expand

Commit Message

Quentin Schulz Sept. 26, 2017, 2:02 p.m. UTC
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>
---
 arch/arm/include/asm/arch-sunxi/clock_sun8i_a83t.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Maxime Ripard Sept. 26, 2017, 2:35 p.m. UTC | #1
On Tue, Sep 26, 2017 at 02:02:47PM +0000, Quentin Schulz wrote:
> 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>


Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Jagan Teki Oct. 9, 2017, 10:04 a.m. UTC | #2
On Tue, Sep 26, 2017 at 8:05 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> On Tue, Sep 26, 2017 at 02:02:47PM +0000, Quentin Schulz wrote:
>> 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>

Applied to u-boot-sunxi/master

thanks!
diff mbox series

Patch

diff --git a/arch/arm/include/asm/arch-sunxi/clock_sun8i_a83t.h b/arch/arm/include/asm/arch-sunxi/clock_sun8i_a83t.h
index 5e1346e524..c4f5f5f958 100644
--- a/arch/arm/include/asm/arch-sunxi/clock_sun8i_a83t.h
+++ b/arch/arm/include/asm/arch-sunxi/clock_sun8i_a83t.h
@@ -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)