Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753843AbdGULUO (ORCPT ); Fri, 21 Jul 2017 07:20:14 -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 X-AuditID: b6c32a2e-f79746d00000129a-5a-5971e368848a 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+X1MFhdPuVocftPOavHjTDeLA6fH+xut7B6X+3qZPDat6mTz 6NuyitHj8ya5ANYoLpuU1JzMstQifbsErozNtz6xFzQJVezd942tgXE6fxcjJ4eEgInE2snP GCFsMYkL99azdTFycQgJLGWUOPfnPAuE85lR4tPDTlaYjhcbZzBDJNYySiye1g7V8otR4sf9 b0wgVWwChhK9R/vA5ooA2csn7ATrYBa4zChxrb2fDSQhLOAl8WnvXmYQm0VAVeJWzxcWEJtX wE3i74av7BDr5CROHpvMCtIsIXCdTWLatZNAzRxAjqzEpgPMEDUuEg3nbrJB2MISr45vgeqV kujumMUO0dvPKHFiTTMjhDODUeJO+wQmiCpricPHL4I9xyzAJ9H7+wkTxAJeiY42IYgSD4nF Pw9ALXCU+H6sC2yxkECsxM7zR9gnMEovYGRYxSiWWlCcm55abFpgr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8 /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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2251 Lines: 53 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 = { -- 1.9.1