linux-mips
[Top] [All Lists]

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

To: Linux-MIPS <linux-mips@linux-mips.org>
Subject: [PATCH RESEND] MIPS: Alchemy: fix cpu clock calculation
From: Manuel Lauss <manuel.lauss@gmail.com>
Date: Wed, 18 Feb 2015 11:01:56 +0100
Cc: Ralf Baechle <ralf@linux-mips.org>, John Crispin <blogic@openwrt.org>, Bruno Randolf <br1@einfach.org>, Manuel Lauss <manuel.lauss@gmail.com>, stable@vger.kernel.org [v3.17+]
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; 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: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
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 <blogic@openwrt.org>
Tested-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Cc: stable@vger.kernel.org      [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 
*hw,
                t = 396000000;
        else {
                t = alchemy_rdsys(AU1000_SYS_CPUPLL) & 0x7f;
+               if (alchemy_get_cputype() < ALCHEMY_CPU_AU1300)
+                       t &= 0x3f;
                t *= parent_rate;
        }
 
-- 
2.3.0


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