[Top] [All Lists]

[PATCH RESEND] MIPS: Alchemy: fix cpu clock calculation

To: Linux-MIPS <>
Subject: [PATCH RESEND] MIPS: Alchemy: fix cpu clock calculation
From: Manuel Lauss <>
Date: Wed, 18 Feb 2015 11:01:56 +0100
Cc: Ralf Baechle <>, John Crispin <>, Bruno Randolf <>, Manuel Lauss <>, [v3.17+]
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20120113; h=from:to:cc:subject:date:message-id; bh=GFZg5Ycymgz14ccb2d3UMrArDg2CSEh3BJUn1CYytMU=; b=DoNgt/g4rkMRCsEdgwNUeXuhuA93G18xbD3chqbFH4oWwkzwabJuQbAJBj6GkEAE6f /61XUeoWbGsPD4k9UWmIlHnm/YKqf8gkByrQrZe2gZs5JhmkUXI5wDBgbo+0Hn/OhRa4 u1Cj+AVYCPuNsSe1FSgJO6eew8Xxb6WWU4htpg8pHsN/vTDB3YGDAGBbikOr94mA2sSV Im6e6xuiy9EDF+XIRtvH7snY9O4Y6SPlW4pzfFMEo29Fz9uB+uWBwI80Sm0Mxnr5/JWk O5+2pYOxd8gsszUKbN0YH40S3u5hs5dOdAj6Ze7mXobQJHCV6/brzu4mvObY0oCzPemG mt6Q==
List-archive: <>
List-help: <>
List-id: linux-mips <>
List-owner: <>
List-post: <>
List-software: Ecartis version 1.0.0
List-subscribe: <>
List-unsubscribe: <>
Original-recipient: rfc822;
The current code uses bits 0-6 of the sys_cpupll register to calculate
core clock speed.  However this is only valid on Au1300, on all earlier
models the hardware only uses bits 0-5 to generate core clock.

This fixes clock calculation on the MTX1 (Au1500), where bit 6 of cpupll
is set as well, which ultimately lead the code to calculate a bogus cpu
core clock and also uart base clock down the line.

Reported-by: John Crispin <>
Tested-by: Bruno Randolf <>
Signed-off-by: Manuel Lauss <>
Cc:      [v3.17+]
John originally noticed that the reported UART baud base differed between 3.14
and 3.18 on the MTX1,  Bruno tested and confirmed that the fix is correct.

Resend with linux mips ml address.

 arch/mips/alchemy/common/clock.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/mips/alchemy/common/clock.c b/arch/mips/alchemy/common/clock.c
index d8737a8..546914c 100644
--- a/arch/mips/alchemy/common/clock.c
+++ b/arch/mips/alchemy/common/clock.c
@@ -127,6 +127,8 @@ static unsigned long alchemy_clk_cpu_recalc(struct clk_hw 
                t = 396000000;
        else {
                t = alchemy_rdsys(AU1000_SYS_CPUPLL) & 0x7f;
+               if (alchemy_get_cputype() < ALCHEMY_CPU_AU1300)
+                       t &= 0x3f;
                t *= parent_rate;

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH RESEND] MIPS: Alchemy: fix cpu clock calculation, Manuel Lauss <=