From patchwork Fri Jul 21 11:19:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 9856645 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0B91860388 for ; Fri, 21 Jul 2017 11:20:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E87D728783 for ; Fri, 21 Jul 2017 11:20:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD4682879A; Fri, 21 Jul 2017 11:20:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88D8228783 for ; Fri, 21 Jul 2017 11:20:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753215AbdGULUN (ORCPT ); Fri, 21 Jul 2017 07:20:13 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:22577 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752130AbdGULUK (ORCPT ); Fri, 21 Jul 2017 07:20:10 -0400 Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20170721112008epoutp031fd54233ed459c8f536b0e76a3d5c33b~TVH-YDvC02160821608epoutp03f; Fri, 21 Jul 2017 11:20:08 +0000 (GMT) Received: from epsmges5p3.samsung.com (unknown [182.195.42.46]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20170721112008epcas5p45816e8e66032563c5950c5dfa46e2f3c~TVH-P45xg2171821718epcas5p45; Fri, 21 Jul 2017 11:20:08 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p3.samsung.com (EPCPMTA) with SMTP id D8.6B.04762.863E1795; Fri, 21 Jul 2017 20:20:08 +0900 (KST) Received: from epsmgms2p2.samsung.com (unknown [182.195.42.80]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20170721112008epcas5p1eb75e4eb00d1dbad130460d2cbc0ce0c~TVH_ypqiU1169811698epcas5p1Q; Fri, 21 Jul 2017 11:20:08 +0000 (GMT) X-AuditID: b6c32a2e-f79746d00000129a-5a-5971e368848a Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 2A.05.05071.863E1795; Fri, 21 Jul 2017 20:20:08 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OTF006FBU5B1A10@mmp2.samsung.com>; Fri, 21 Jul 2017 20:20:08 +0900 (KST) From: Sylwester Nawrocki To: mturquette@baylibre.com, sboyd@codeaurora.org Cc: cw00.choi@samsung.com, krzk@kernel.org, linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, b.zolnierkie@samsung.com, linux-kernel@vger.kernel.org, Sylwester Nawrocki Subject: [PATCH] clk: samsung: exynos5420: The EPLL rate table corrections Date: Fri, 21 Jul 2017 13:19:50 +0200 Message-id: <1500635990-19474-1-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFIsWRmVeSWpSXmKPExsWy7bCmpm7G48JIg85uTYuNM9azWlz/8pzV 4vz5DewWH3vusVpc3jWHzWLG+X1MFhdPuVoc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ziwr31 bF2MXBxCAqsZJZqun2UFSQgJ/GKUuNsXBWKzCRhK9B7tYwSxRYDs5RN2MoM0MAtcZJRYvvwg WIOwgJfEp717waayCKhK3Or5wgJi8wq4Sfzd8JUdYpucxMljk1knMHIvYGRYxciVWlCcm55b bFRgtIkRGJrbDmsF7GBsOhd9iFGAg1GJh5dhXUGkEGtiWXFl7iFGCQ5mJRHe/IeFkUK8KYmV ValF+fFFpTmpxYcYTYFWTmSWEk3OB8ZNXkm8oYmlkYmBmZmhkYGxmZI474TALxFCAumJJanZ qakFqUUwfUwcnFINjBslq9Q3yzN1Rdmm8d+obD1t8z604cknve8PNnjEuZVen6RR17lWJW2x vuG5lzrCa7brfhP5pyTSsIjh5bN3xVqhMlJ2mqFq17ak2vVYaSz0XMifNWc3g51ErqsB7/l8 /570PSxXzmz8UZZzs2tV33m1W+ZhU/+uPj2L69D33g8bGE0sq7/nKbEUZyQaajEXFScCAPDO UJBjAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170721112008epcas5p1eb75e4eb00d1dbad130460d2cbc0ce0c X-Msg-Generator: CA X-Sender-IP: 182.195.42.80 X-Local-Sender: =?UTF-8?B?U3lsd2VzdGVyIE5hd3JvY2tpG1NSUE9MLUtlcm5lbCAoVFAp?= =?UTF-8?B?G+yCvOyEseyghOyekBtTZW5pb3IgU29mdHdhcmUgRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?U3lsd2VzdGVyIE5hd3JvY2tpG1NSUE9MLUtlcm5lbCAoVFAp?= =?UTF-8?B?G1NhbXN1bmcgRWxlY3Ryb25pY3MbU2VuaW9yIFNvZnR3YXJlIEVuZ2luZWVy?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 105P X-CMS-RootMailID: 20170721112008epcas5p1eb75e4eb00d1dbad130460d2cbc0ce0c X-RootMTR: 20170721112008epcas5p1eb75e4eb00d1dbad130460d2cbc0ce0c References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes values of the EPLL K coefficient and changes the EPLL output frequency values to match exactly what is possible to achieve with given M, P, S, K coefficients. This allows to avoid rounding errors and unexpected frequency being set with clk_set_rate(), due to recalc_rate returning different values than the PLL rate specified in the exynos5420_epll_24mhz_tbl table. E.g. this prevents a case where two consecutive clk_set_rate() calls with same argument result in different PLL output frequency. The PLL output frequencies have been calculated with formula: f = fxtal * (M * 2^16 + K) / (P * 2^S) / 2^16 where fxtal = 24000000. Fixes: 9842452acd ("clk: samsung: exynos542x: Add EPLL rate table") Signed-off-by: Sylwester Nawrocki --- drivers/clk/samsung/clk-exynos5420.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c index 0748a0b..9a6476a 100644 --- a/drivers/clk/samsung/clk-exynos5420.c +++ b/drivers/clk/samsung/clk-exynos5420.c @@ -1283,16 +1283,16 @@ static void __init exynos5420_clk_sleep_init(void) {} static const struct samsung_pll_rate_table exynos5420_epll_24mhz_tbl[] = { PLL_36XX_RATE(600000000U, 100, 2, 1, 0), PLL_36XX_RATE(400000000U, 200, 3, 2, 0), - PLL_36XX_RATE(393216000U, 197, 3, 2, 25690), - PLL_36XX_RATE(361267200U, 301, 5, 2, 3671), + PLL_36XX_RATE(393216003U, 197, 3, 2, -25690), + PLL_36XX_RATE(361267218U, 301, 5, 2, 3671), PLL_36XX_RATE(200000000U, 200, 3, 3, 0), - PLL_36XX_RATE(196608000U, 197, 3, 3, -25690), - PLL_36XX_RATE(180633600U, 301, 5, 3, 3671), - PLL_36XX_RATE(131072000U, 131, 3, 3, 4719), + PLL_36XX_RATE(196608001U, 197, 3, 3, -25690), + PLL_36XX_RATE(180633609U, 301, 5, 3, 3671), + PLL_36XX_RATE(131072006U, 131, 3, 3, 4719), PLL_36XX_RATE(100000000U, 200, 3, 4, 0), - PLL_36XX_RATE(65536000U, 131, 3, 4, 4719), - PLL_36XX_RATE(49152000U, 197, 3, 5, 25690), - PLL_36XX_RATE(32768000U, 131, 3, 5, 4719), + PLL_36XX_RATE( 65536003U, 131, 3, 4, 4719), + PLL_36XX_RATE( 49152000U, 197, 3, 5, -25690), + PLL_36XX_RATE( 32768001U, 131, 3, 5, 4719), }; static struct samsung_pll_clock exynos5x_plls[nr_plls] __initdata = {