From patchwork Fri Feb 16 14:57:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10224869 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 442FB601E7 for ; Fri, 16 Feb 2018 14:58:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34CFB28FCC for ; Fri, 16 Feb 2018 14:58:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 29748290DA; Fri, 16 Feb 2018 14:58:22 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham 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 B9960290FB for ; Fri, 16 Feb 2018 14:58:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033521AbeBPO6V (ORCPT ); Fri, 16 Feb 2018 09:58:21 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:34618 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758054AbeBPO6O (ORCPT ); Fri, 16 Feb 2018 09:58:14 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180216145812euoutp01deb0585af52955575e1250c122906e55~T1kVBrwBy2269822698euoutp01P; Fri, 16 Feb 2018 14:58:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180216145812euoutp01deb0585af52955575e1250c122906e55~T1kVBrwBy2269822698euoutp01P DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1518793092; bh=oESQxaNpDlfa9QYZsPBnXZ9turZzDwq+a7PVuUYGvbw=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=VVOaOPrDhFuGb7uOfl1k0SGJKRoZxJkmhhLGXxtOPs80DTzv5HCsZ1K6Z8JLGJfl/ Pn/+AQWlAsxFbRTf4rahqnvatNPWEINCKX0IQz75uI5UGxmhKUZqhLdiqPlSexfObf L1MSFTsT/blpc6+T4QV/AHwl6tU+rNwYtvJt38cI= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180216145810eucas1p1fb8a3505ad78ceeb09291ba23244da99~T1kTY1FJp2922829228eucas1p1S; Fri, 16 Feb 2018 14:58:10 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 06.94.17380.081F68A5; Fri, 16 Feb 2018 14:58:08 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180216145807eucas1p2260082a8178bc746dc8110982f2b0c2b~T1kQJWvDJ2829928299eucas1p2b; Fri, 16 Feb 2018 14:58:07 +0000 (GMT) X-AuditID: cbfec7f4-b4fc79c0000043e4-3f-5a86f18003f6 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 05.60.04183.E71F68A5; Fri, 16 Feb 2018 14:58:06 +0000 (GMT) Received: from AMDC2768.DIGITAL.local ([106.120.43.17]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P49008BP08QWR80@eusync3.samsung.com>; Fri, 16 Feb 2018 14:58:06 +0000 (GMT) From: Andrzej Hajda To: Sylwester Nawrocki Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , Tomasz Figa , Chanwoo Choi , Michael Turquette , Stephen Boyd , Kukjin Kim , Krzysztof Kozlowski , linux-samsung-soc@vger.kernel.org (moderated list:SAMSUNG SOC CLOCK DRIVERS), linux-clk@vger.kernel.org (open list:COMMON CLK FRAMEWORK) Subject: [PATCH v2 6/7] clk: samsung: s3c2410: fix PLL rates Date: Fri, 16 Feb 2018 15:57:53 +0100 Message-id: <20180216145754.14428-7-a.hajda@samsung.com> X-Mailer: git-send-email 2.16.1 In-reply-to: <20180216145754.14428-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrHIsWRmVeSWpSXmKPExsWy7djPc7oNH9uiDNa9kre4te4cq8XGGetZ La5/ec5q0f/4NbPF+fMb2C0+9txjtZhxfh+Txdojd9ktLp5ytTj8pp3V4t+1jSwWq3b9YXTg 8Xh/o5XdY+esu+wem1Z1snn0bVnF6PF5k1wAaxSXTUpqTmZZapG+XQJXxulVd9gKFohUXGt/ ytbA+EGgi5GTQ0LAROL7nRuMXYxcHEICKxglVh1cyASSEBL4zCix7VQdTNH1vz1sEEXLGCUu tr6Gcv4zSry4OY8FpIpNQFPi7+abbCC2iIC+xJJVF8FsZoFGFokVc8RAbGEBG4n9P36wgtgs AqoSK//OBqvhFbCQOPG6hR1im7zE4TdNYDWcApYSFyY/BTtPQmAJm8TZfR9ZIYpcJBZf+8EI YQtLvDq+BapZRuLy5G4WiIZuRolT+zqZIZwpjBLnX11mgqiyljh8/CIrxHl8EpO2TQcq4gCK 80p0tAlBlHhILPh+B6rcUWL556WsEC/3MEqs/tLJPIFRagEjwypG8dTS4tz01GKjvNRyveLE 3OLSvHS95PzcTYzAWD797/iXHYy7/iQdYhTgYFTi4bV41hYlxJpYVlyZe4hRgoNZSYT3+WOg EG9KYmVValF+fFFpTmrxIUZpDhYlcd44jbooIYH0xJLU7NTUgtQimCwTB6dUA+OKkwEL0yJ/ TjKTWL3h24WCe36X/9S2uSxYdrfQhl8iSnDbsTJ/VqA9Uv8cvj2PWW+YXDXnWrwC76HDj795 XHCxPaISb3bRQZ0/Mv2HOV992NeyF0XGHFvN/G85vN/re6/w14ef8xMuRmzWfVHjG3q4XOud vQ6Hzo2QTdeNDHh6JJfnP6w5psRSnJFoqMVcVJwIAGMJwAThAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPLMWRmVeSWpSXmKPExsVy+t/xq7r1H9uiDM7uZLK4te4cq8XGGetZ La5/ec5q0f/4NbPF+fMb2C0+9txjtZhxfh+Txdojd9ktLp5ytTj8pp3V4t+1jSwWq3b9YXTg 8Xh/o5XdY+esu+wem1Z1snn0bVnF6PF5k1wAaxSXTUpqTmZZapG+XQJXxulVd9gKFohUXGt/ ytbA+EGgi5GTQ0LAROL63x62LkYuDiGBJYwS267+ZQRJCAk0MklMPGIBYrMJaEr83XyTDcQW EdCXWLLqIlgDs0Aji8S1VRvBGoQFbCT2//jBCmKzCKhKrPw7G6yBV8BC4sTrFnaIbfISh980 gdVwClhKXJj8FGqZhcSZN2vZJjDyLGBkWMUoklpanJueW2ykV5yYW1yal66XnJ+7iREYbNuO /dyyg7HrXfAhRgEORiUe3geP26KEWBPLiitzDzFKcDArifA+BwnxpiRWVqUW5ccXleakFh9i lOZgURLnPW9QGSUkkJ5YkpqdmlqQWgSTZeLglGpgdHpmJvNDbdsn1wOF35/dkGVY6p1eWGFz s3VG5qZ9RxoN1t7ZGvDmbDoDWwjjnYrkkFaNaY6Lbmxj4FrL/3+mPafiK81ppyv0WMpntn7g 9vOrLX+6aSeHcoA89wH/Te48h1jagoTYpr0/yhyy9WGm3fS/oUZT7nhlBJfNd5Ty8JFOkzp1 N9FOiaU4I9FQi7moOBEAvtiA8zICAAA= X-CMS-MailID: 20180216145807eucas1p2260082a8178bc746dc8110982f2b0c2b X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180216145807eucas1p2260082a8178bc746dc8110982f2b0c2b X-RootMTR: 20180216145807eucas1p2260082a8178bc746dc8110982f2b0c2b References: <20180216145754.14428-1-a.hajda@samsung.com> 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 Rates declared in PLL rate tables should match exactly rates calculated from PLL coefficients. If that is not the case, rate of parent might be being set not as expected. For instance, if in the PLL rates table we have a 393216000 Hz entry and the real value as returned by the PLL's recalc_rate callback is 393216003, after setting PLL's clk rate to 393216000 clk_get_rate will return 393216003. If we now attempt to set rate of a PLL's child divider clock to 393216000/2 its rate will be 131072001, rather than 196608000. That is the divider will be set to 3 instead of 2, because 393216003/2 is greater than 196608000. To fix this issue declared rates are changed to exactly match rates generated by a PLL, as calculated from the P, M, S, K coefficients. Signed-off-by: Andrzej Hajda Acked-by: Tomasz Figa Acked-by: Chanwoo Choi --- drivers/clk/samsung/clk-s3c2410.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/clk/samsung/clk-s3c2410.c b/drivers/clk/samsung/clk-s3c2410.c index e0650c33863b..d8e58a659467 100644 --- a/drivers/clk/samsung/clk-s3c2410.c +++ b/drivers/clk/samsung/clk-s3c2410.c @@ -168,7 +168,7 @@ static struct samsung_pll_rate_table pll_s3c2410_12mhz_tbl[] __initdata = { PLL_35XX_RATE(226000000, 105, 1, 1), PLL_35XX_RATE(210000000, 132, 2, 1), /* 2410 common */ - PLL_35XX_RATE(203000000, 161, 3, 1), + PLL_35XX_RATE(202800000, 161, 3, 1), PLL_35XX_RATE(192000000, 88, 1, 1), PLL_35XX_RATE(186000000, 85, 1, 1), PLL_35XX_RATE(180000000, 82, 1, 1), @@ -178,18 +178,18 @@ static struct samsung_pll_rate_table pll_s3c2410_12mhz_tbl[] __initdata = { PLL_35XX_RATE(147000000, 90, 2, 1), PLL_35XX_RATE(135000000, 82, 2, 1), PLL_35XX_RATE(124000000, 116, 1, 2), - PLL_35XX_RATE(118000000, 150, 2, 2), + PLL_35XX_RATE(118500000, 150, 2, 2), PLL_35XX_RATE(113000000, 105, 1, 2), - PLL_35XX_RATE(101000000, 127, 2, 2), + PLL_35XX_RATE(101250000, 127, 2, 2), PLL_35XX_RATE(90000000, 112, 2, 2), - PLL_35XX_RATE(85000000, 105, 2, 2), + PLL_35XX_RATE(84750000, 105, 2, 2), PLL_35XX_RATE(79000000, 71, 1, 2), - PLL_35XX_RATE(68000000, 82, 2, 2), - PLL_35XX_RATE(56000000, 142, 2, 3), + PLL_35XX_RATE(67500000, 82, 2, 2), + PLL_35XX_RATE(56250000, 142, 2, 3), PLL_35XX_RATE(48000000, 120, 2, 3), - PLL_35XX_RATE(51000000, 161, 3, 3), + PLL_35XX_RATE(50700000, 161, 3, 3), PLL_35XX_RATE(45000000, 82, 1, 3), - PLL_35XX_RATE(34000000, 82, 2, 3), + PLL_35XX_RATE(33750000, 82, 2, 3), { /* sentinel */ }, };