From patchwork Mon Dec 19 06:17:04 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chander Kashyap X-Patchwork-Id: 5860 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 908FE23E33 for ; Mon, 19 Dec 2011 06:17:33 +0000 (UTC) Received: from mail-ey0-f180.google.com (mail-ey0-f180.google.com [209.85.215.180]) by fiordland.canonical.com (Postfix) with ESMTP id 8751CA18265 for ; Mon, 19 Dec 2011 06:17:33 +0000 (UTC) Received: by mail-ey0-f180.google.com with SMTP id c11so1539480eaa.11 for ; Sun, 18 Dec 2011 22:17:33 -0800 (PST) Received: by 10.204.133.207 with SMTP id g15mr4512931bkt.17.1324275453291; Sun, 18 Dec 2011 22:17:33 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.204.40.4 with SMTP id i4cs117032bke; Sun, 18 Dec 2011 22:17:33 -0800 (PST) Received: by 10.50.157.135 with SMTP id wm7mr25416608igb.39.1324275450916; Sun, 18 Dec 2011 22:17:30 -0800 (PST) Received: from mail-iy0-f178.google.com (mail-iy0-f178.google.com [209.85.210.178]) by mx.google.com with ESMTPS id cv5si5473949igc.45.2011.12.18.22.17.30 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 18 Dec 2011 22:17:30 -0800 (PST) Received-SPF: neutral (google.com: 209.85.210.178 is neither permitted nor denied by best guess record for domain of chander.kashyap@linaro.org) client-ip=209.85.210.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.178 is neither permitted nor denied by best guess record for domain of chander.kashyap@linaro.org) smtp.mail=chander.kashyap@linaro.org Received: by mail-iy0-f178.google.com with SMTP id f6so9767859iag.37 for ; Sun, 18 Dec 2011 22:17:30 -0800 (PST) Received: by 10.50.181.228 with SMTP id dz4mr25444196igc.22.1324275450248; Sun, 18 Dec 2011 22:17:30 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id py4sm18235908igc.2.2011.12.18.22.17.26 (version=SSLv3 cipher=OTHER); Sun, 18 Dec 2011 22:17:29 -0800 (PST) From: Chander Kashyap To: u-boot@lists.denx.de Cc: mk7.kang@samsung.com, bjlee@samsung.com, patches@linaro.org, samsung@lists.linaro.org, linaro-dev@lists.linaro.org, Chander Kashyap Subject: [PATCH 2/2] Exynos: Fix ARM Clock frequency calculation Date: Mon, 19 Dec 2011 11:47:04 +0530 Message-Id: <1324275424-29468-3-git-send-email-chander.kashyap@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1324275424-29468-1-git-send-email-chander.kashyap@linaro.org> References: <1324275424-29468-1-git-send-email-chander.kashyap@linaro.org> Earliar ARM clock frequency was calculated by: MOUTAPLL/(DIVAPLL + 1) which is actually returning SCLKAPLL. It is fixed by calcuating it as follows: ARMCLK=MOUTCORE/(DIVCORE + 1)/DIVCORE2 + 1) Signed-off-by: Chander Kashyap --- arch/arm/cpu/armv7/exynos/clock.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/arm/cpu/armv7/exynos/clock.c b/arch/arm/cpu/armv7/exynos/clock.c index 64de262..17ff012 100644 --- a/arch/arm/cpu/armv7/exynos/clock.c +++ b/arch/arm/cpu/armv7/exynos/clock.c @@ -103,14 +103,17 @@ static unsigned long exynos4_get_arm_clk(void) (struct exynos4_clock *)samsung_get_base_clock(); unsigned long div; unsigned long dout_apll; - unsigned int apll_ratio; + unsigned int core_ratio; + unsigned int core2_ratio; div = readl(&clk->div_cpu0); /* APLL_RATIO: [26:24] */ - apll_ratio = (div >> 24) & 0x7; + core_ratio = (div >> 0) & 0x7; + core2_ratio = (div >> 28) & 0x7; - dout_apll = get_pll_clk(APLL) / (apll_ratio + 1); + dout_apll = get_pll_clk(APLL) / (core_ratio + 1); + dout_apll /= (core2_ratio + 1); return dout_apll; }