From patchwork Fri Sep 6 05:52:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuan Liu via B4 Relay X-Patchwork-Id: 13793313 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 55342CD5BA4 for ; Fri, 6 Sep 2024 05:54:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WswoBeWT/2hH8kfK4PckBvQBek2/dva/fYoHU0jfIB8=; b=Y2SCNYDLNJNpReoHqnNFqM52tv U1DthujxPX2bT0qX/LwCUvBN2u5VYCA98upc9dv+zWIIZKlvchPvyXo7cI7LwRWU1bX7GsyUbSVqc JhgOGfrv7y4w4JInMgc7vmcsi60FW9Ql89LD9T3yL1yOMyY+lujPftG32JJfipA3JwkUKyUKJHk7k Yzp4FkTuKhVHjS1Cq4cEWE+O8QBYkDcbIOCYb/+RTbt3UQlQwkIX+liIiAM6JpIad47IMHIKq3pVE EKQ1cPISgDh2i2lcuSXv0K34jsL7JfL+H8T/nlEDLiap9ObN/HlKbT+sdFF2j6mwuHeG0xKHqxvbV bjvAL23A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smRva-0000000AmgI-3Lby; Fri, 06 Sep 2024 05:54:38 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smRte-0000000Am1H-1ZUV; Fri, 06 Sep 2024 05:52:40 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id CBD37A44679; Fri, 6 Sep 2024 05:52:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id C1FAFC4CEC8; Fri, 6 Sep 2024 05:52:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725601956; bh=I9JprPGgr2Q1JvjMeHkxOvLVu+H/5UNCtWt/M48Ns14=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Li+xwak6lwSBbAuxqsHiQ70CrZ4YDmU8reJOfqLZE2sDhVY22EzngQQ76gWGEYPwy FR1cP+SB+1+HZWggmz9cIG3X78F4ZPjTIayCiJBPhtNVpw71m/5Ub2/zdw+hucl412 K3v12+KuOYxjdhDPYTXuFr017hkMQUSIqUlR5L4xQKMGV/yxaGisM2QKyQH1LLpQDy nlIcPvGmrQcDgKHp+rNJq+X9ZPEPXqqbyQmoCQR45RbKxSLmJxqEX9x2e5r7iHukpX N9l5t7DGkSlDZy/w1GEGVp7rBQWvm33/Uz7Qri9f7zk5cyNTsVsRX/tf3qSWw6c2X0 X8FCl7YgsFrTg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFD64CD5BDD; Fri, 6 Sep 2024 05:52:36 +0000 (UTC) From: Chuan Liu via B4 Relay Date: Fri, 06 Sep 2024 13:52:33 +0800 Subject: [PATCH 1/4] clk: meson: Support PLL with fixed fractional denominators MIME-Version: 1.0 Message-Id: <20240906-fix_clk-v1-1-2977ef0d72e7@amlogic.com> References: <20240906-fix_clk-v1-0-2977ef0d72e7@amlogic.com> In-Reply-To: <20240906-fix_clk-v1-0-2977ef0d72e7@amlogic.com> To: Neil Armstrong , Jerome Brunet , Michael Turquette , Stephen Boyd , Kevin Hilman , Martin Blumenstingl Cc: linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Chuan Liu X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1725601955; l=2567; i=chuan.liu@amlogic.com; s=20240902; h=from:subject:message-id; bh=SoIKZiELa8FSJI7fmIZsiz6qIoB6+tJ8z3x3hDJR/OM=; b=HYGdsd4TDjl5DW9tu+regMVhcuVnmoqEWuyRRdEK8IXmAPDX+KAM5EnWN+mXPd6AJqh1qj1XV DlfZzdykYAXDTgKqia5Qg17K3yaT8fizM93sTUuRayorsD/5VsvJQC+ X-Developer-Key: i=chuan.liu@amlogic.com; a=ed25519; pk=fnKDB+81SoWGKW2GJNFkKy/ULvsDmJZRGBE7pR5Xcpo= X-Endpoint-Received: by B4 Relay for chuan.liu@amlogic.com/20240902 with auth_id=203 X-Original-From: Chuan Liu X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240905_225238_585250_4A6D3BE0 X-CRM114-Status: GOOD ( 13.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: chuan.liu@amlogic.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Chuan Liu Some PLLs with fractional multipliers have fractional denominators that are fixed to "100000" instead of the previous "(1 << pll->frac.width)". Signed-off-by: Chuan Liu --- drivers/clk/meson/clk-pll.c | 22 +++++++++++++++++++--- drivers/clk/meson/clk-pll.h | 1 + 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c index bc570a2ff3a3..f0009c174564 100644 --- a/drivers/clk/meson/clk-pll.c +++ b/drivers/clk/meson/clk-pll.c @@ -36,6 +36,12 @@ #include "clk-regmap.h" #include "clk-pll.h" +/* + * Some PLLs with fractional multipliers have fractional denominators that + * are fixed to "100000" instead of the previous "(1 << pll->frac.width)". + */ +#define FIXED_FRAC_MAX 100000 + static inline struct meson_clk_pll_data * meson_clk_pll_data(struct clk_regmap *clk) { @@ -57,12 +63,17 @@ static unsigned long __pll_params_to_rate(unsigned long parent_rate, struct meson_clk_pll_data *pll) { u64 rate = (u64)parent_rate * m; + unsigned int frac_max; if (frac && MESON_PARM_APPLICABLE(&pll->frac)) { u64 frac_rate = (u64)parent_rate * frac; - rate += DIV_ROUND_UP_ULL(frac_rate, - (1 << pll->frac.width)); + if (pll->flags & CLK_MESON_PLL_FIXED_FRAC_MAX) + frac_max = FIXED_FRAC_MAX; + else + frac_max = (1 << pll->frac.width); + + rate += DIV_ROUND_UP_ULL(frac_rate, frac_max); } return DIV_ROUND_UP_ULL(rate, n); @@ -100,13 +111,18 @@ static unsigned int __pll_params_with_frac(unsigned long rate, unsigned int n, struct meson_clk_pll_data *pll) { - unsigned int frac_max = (1 << pll->frac.width); + unsigned int frac_max; u64 val = (u64)rate * n; /* Bail out if we are already over the requested rate */ if (rate < parent_rate * m / n) return 0; + if (pll->flags & CLK_MESON_PLL_FIXED_FRAC_MAX) + frac_max = FIXED_FRAC_MAX; + else + frac_max = (1 << pll->frac.width); + if (pll->flags & CLK_MESON_PLL_ROUND_CLOSEST) val = DIV_ROUND_CLOSEST_ULL(val * frac_max, parent_rate); else diff --git a/drivers/clk/meson/clk-pll.h b/drivers/clk/meson/clk-pll.h index 7b6b87274073..e996d3727eb1 100644 --- a/drivers/clk/meson/clk-pll.h +++ b/drivers/clk/meson/clk-pll.h @@ -29,6 +29,7 @@ struct pll_mult_range { #define CLK_MESON_PLL_ROUND_CLOSEST BIT(0) #define CLK_MESON_PLL_NOINIT_ENABLED BIT(1) +#define CLK_MESON_PLL_FIXED_FRAC_MAX BIT(2) struct meson_clk_pll_data { struct parm en; From patchwork Fri Sep 6 05:52:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuan Liu via B4 Relay X-Patchwork-Id: 13793327 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7F3F5C54FC6 for ; Fri, 6 Sep 2024 05:56:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=J7DeD8DrZ2joGx7LmAnLXHJ7O2bgCLib0UfxG7JY/dU=; b=OU/Z+iSvms6xcBh2wPsbd1do3o embq8LUafKkd9SdrOg0SgzMbg/I4D3SZ/c0mAo6i8l/Z757eRtG2wmse7b+Vo3NgLReMv7R9AXMhw fYy+2JhVsDLJMUaXw8q5uJklBTBCsb+4FmIB7X/2GzTulLptMvikGWAZaU+I81k5hY5M7u7gXJ6rW i5ClkuuXI4pBJC6r2Axzwze1A3bapKOMO0F0Ou4IdtyyndtmSGexlhTl+8zvNsapzkF172/YDdfBU NzWa+iZqEIVF1JPM+rNzqxLLIgmkaXzBFIjRSO9PvWbYsVwyK25gBrvoqfqZw0Z3m4pIjUZTlE8KU Qhe25TsA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smRxT-0000000An47-32iB; Fri, 06 Sep 2024 05:56:35 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smRte-0000000Am1I-2L7z; Fri, 06 Sep 2024 05:52:41 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id F0611A44671; Fri, 6 Sep 2024 05:52:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id D445CC4CEC9; Fri, 6 Sep 2024 05:52:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725601956; bh=S3mFqsYvIRYGegsx08fYvuzsX6Qwu4VsDx147bN5fYc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=YCUAAoKkVzT2EMiB9d27VUcc2cwtreBRMnj8ACMRtWT68xLZHapaFd8VxJwPlmrNa eXlp8EuZ4p9XYAKbWECgqunAnmbTcFPuU+zFacPZMnNYhA/UO+/Ea8XeXy5AJ/cIHB D3Rerl1wyv3x3kN56BxKQOMO7+xAshSmTWIECqT7GapOdkQQ+3b3ApMdB26UiuiJzs fM0m17qCQEL0zynEU1HvIhsQawZeiSyjfqWCehYLajnCZRze4v3up1WYLrTQEHE+Wo UazDJJwgOj+eQZZArA24Dv+IghHu/ATxBBGjk+1LWiAxTikBDV+o2Mv65hn4gr5Nrc A4uZUJi2Nikwg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3A64CD5BA4; Fri, 6 Sep 2024 05:52:36 +0000 (UTC) From: Chuan Liu via B4 Relay Date: Fri, 06 Sep 2024 13:52:34 +0800 Subject: [PATCH 2/4] clk: meson: c3: pll: hifi_pll frequency is not accurate MIME-Version: 1.0 Message-Id: <20240906-fix_clk-v1-2-2977ef0d72e7@amlogic.com> References: <20240906-fix_clk-v1-0-2977ef0d72e7@amlogic.com> In-Reply-To: <20240906-fix_clk-v1-0-2977ef0d72e7@amlogic.com> To: Neil Armstrong , Jerome Brunet , Michael Turquette , Stephen Boyd , Kevin Hilman , Martin Blumenstingl Cc: linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Chuan Liu X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1725601955; l=836; i=chuan.liu@amlogic.com; s=20240902; h=from:subject:message-id; bh=M/IqRKmFgbyGrESbxg574FVPvS6H4iQmlVvP8JBwBMQ=; b=fchMifHrKQ1Qtl5EJeyYwqm5AFN+WR+v2xXBG5jYR5Bv2xcf2EFq/9m415BdgCEIMgcTOHG5p ZLaESWUH2lsD2xDLkYxGRCwkuqlxfJmrulvCl1A4FRfKItaqvJsnTzp X-Developer-Key: i=chuan.liu@amlogic.com; a=ed25519; pk=fnKDB+81SoWGKW2GJNFkKy/ULvsDmJZRGBE7pR5Xcpo= X-Endpoint-Received: by B4 Relay for chuan.liu@amlogic.com/20240902 with auth_id=203 X-Original-From: Chuan Liu X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240905_225238_899954_410464E6 X-CRM114-Status: UNSURE ( 9.25 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: chuan.liu@amlogic.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Chuan Liu The fractional denominator of C3's hifi_pll fractional multiplier is fixed to 100000, so flag CLK_MESON_PLL_FIXED_FRAC_MAX is added. Fixes: 8a9a129dc565 ("clk: meson: c3: add support for the C3 SoC PLL clock") Signed-off-by: Chuan Liu --- drivers/clk/meson/c3-pll.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/meson/c3-pll.c b/drivers/clk/meson/c3-pll.c index 32bd2ed9d304..a350173efe90 100644 --- a/drivers/clk/meson/c3-pll.c +++ b/drivers/clk/meson/c3-pll.c @@ -361,6 +361,7 @@ static struct clk_regmap hifi_pll_dco = { .range = &c3_gp0_pll_mult_range, .init_regs = c3_hifi_init_regs, .init_count = ARRAY_SIZE(c3_hifi_init_regs), + .flags = CLK_MESON_PLL_FIXED_FRAC_MAX, }, .hw.init = &(struct clk_init_data) { .name = "hifi_pll_dco", From patchwork Fri Sep 6 05:52:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuan Liu via B4 Relay X-Patchwork-Id: 13793314 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 06384CD5BA4 for ; Fri, 6 Sep 2024 05:55:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3BkTeLrC7lJCtHQe8ABPREDn/vfvCQC5Oa4IANABYJk=; b=tZuP88ORAy8t55OQjSOzDWDg0M wkBC6/E9fdSgcIaIR+LuBigkG8M31pbQ6tt8pkTHXAZbeXQhUNpYD+BfbAuVNg2g309AfK4Z0pXr9 RWN/v6uy0Zve6nbRjsd6o6C5s+RNFjMsn5BB6vKh7MCA8Pyi5sNlPQiNOE7t1gTJRiIEalVWPG34U vYXERe+CeWSHRlOFnJon1ikiTIqxLHS5M1LoGeohg7utrQxa6Qu9StGCxlKZm070Spxt7QtMX8ovK rdK+cKb8gBTUqpHTA9+yagu2XCH2VFtzHDGDwZM670e89X4qd5Wuz3TrYHbTMC1H2AxWT2oP9JLOK hb9gseRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smRwY-0000000AmwP-1JjP; Fri, 06 Sep 2024 05:55:38 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smRte-0000000Am1O-1teX; Fri, 06 Sep 2024 05:52:40 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 343C7A4467C; Fri, 6 Sep 2024 05:52:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id DF67AC4CECC; Fri, 6 Sep 2024 05:52:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725601956; bh=fZnb4eOdBuuUWog66uoDoe+ZN8bX/78YQ6P8dpOsCpw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=qPqB5D00PLNLktkk6j0d+tG2sR8G64MDsJr5f4NK8gjwvX6sFtCEr5cL+fabhHS9+ Ym0V8JSSIqYsvxImVvHy62JdxbKrNOH6SZicXNt3P3JAwaaJrVnAnjNhBgGbTY7IxQ Zq2gjICUFWB4AUfqv86yaoKRDRScqyLZu3PCPNjhl8tTbm3ufHkLdBN0wYBouFLs3k Dt6L7hEyHgDN2QqcRozRL1a85o1vwOQyp1nNRTVQ1PI5PICp9Y9IJeG42BB8P+2I2X Su1AHtaLZZtZGEj1INrzEUrfLAN8ezUYe3qnXD/BHBbNBy0S2FAAVjW/sANowTlJsz YedEFGttKdjqQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D671ACE7AB2; Fri, 6 Sep 2024 05:52:36 +0000 (UTC) From: Chuan Liu via B4 Relay Date: Fri, 06 Sep 2024 13:52:35 +0800 Subject: [PATCH 3/4] clk: meson: s4: pll: hifi_pll support fractional multiplier MIME-Version: 1.0 Message-Id: <20240906-fix_clk-v1-3-2977ef0d72e7@amlogic.com> References: <20240906-fix_clk-v1-0-2977ef0d72e7@amlogic.com> In-Reply-To: <20240906-fix_clk-v1-0-2977ef0d72e7@amlogic.com> To: Neil Armstrong , Jerome Brunet , Michael Turquette , Stephen Boyd , Kevin Hilman , Martin Blumenstingl Cc: linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Chuan Liu X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1725601955; l=1150; i=chuan.liu@amlogic.com; s=20240902; h=from:subject:message-id; bh=9arg64z8UgGz40ls665ct4U5mW7FxNd6ZQXnRFwYvkw=; b=IogfYnGomgoFnpWnEW+aCeCWGoCRu5sjduQc9ITv14leLMU9GP9TTYlf8pekBb+LXLIr543YO OhNH1AkivSsAjqqOQYQGUTeWrKmzZRYalqnckEaeovZLnZ6Hg/9bc83 X-Developer-Key: i=chuan.liu@amlogic.com; a=ed25519; pk=fnKDB+81SoWGKW2GJNFkKy/ULvsDmJZRGBE7pR5Xcpo= X-Endpoint-Received: by B4 Relay for chuan.liu@amlogic.com/20240902 with auth_id=203 X-Original-From: Chuan Liu X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240905_225238_597420_75791B20 X-CRM114-Status: GOOD ( 10.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: chuan.liu@amlogic.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Chuan Liu The s4's hifi_pll supports a fractional frequency multiplier, but frac parameters are not configured in the driver. Signed-off-by: Chuan Liu --- drivers/clk/meson/s4-pll.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/clk/meson/s4-pll.c b/drivers/clk/meson/s4-pll.c index b0258933fb9d..a97e19057b05 100644 --- a/drivers/clk/meson/s4-pll.c +++ b/drivers/clk/meson/s4-pll.c @@ -329,7 +329,6 @@ static struct clk_regmap s4_gp0_pll = { * Internal hifi pll emulation configuration parameters */ static const struct reg_sequence s4_hifi_init_regs[] = { - { .reg = ANACTRL_HIFIPLL_CTRL1, .def = 0x00010e56 }, { .reg = ANACTRL_HIFIPLL_CTRL2, .def = 0x00000000 }, { .reg = ANACTRL_HIFIPLL_CTRL3, .def = 0x6a285c00 }, { .reg = ANACTRL_HIFIPLL_CTRL4, .def = 0x65771290 }, @@ -354,6 +353,11 @@ static struct clk_regmap s4_hifi_pll_dco = { .shift = 10, .width = 5, }, + .frac = { + .reg_off = ANACTRL_HIFIPLL_CTRL1, + .shift = 0, + .width = 17, + }, .l = { .reg_off = ANACTRL_HIFIPLL_CTRL0, .shift = 31, From patchwork Fri Sep 6 05:52:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuan Liu via B4 Relay X-Patchwork-Id: 13793328 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 57637C54FC6 for ; Fri, 6 Sep 2024 05:57:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jYQtFjQIPX0DXj1ZYxy/O/7gU18Qgl/t6KmLchUlMFA=; b=X0YorDJX5Z12jU6UVzBSjBtCLj 3epHak1G1GzwTY/y5p8CNKgI50lZnazxY88eZrtl5BOUzDlL/2sAPzX4ak0OEPrI7JOiUz9nx2YA2 gG6/+lRQKkJeObsVax4mi6UfGkcReyeNZBRzj1hWZDiD2T+fjgIm1M1CQB+Kaa+HJzwxgLCBqbp+J mJrNCB7MR9/V0NovzbqR3QbO4OaC4escHQgPcaXEnWxRbh33LvX2f/OsbFdecaGxQPAU3uRQnolAi tFm/IZugBw06RJZ5LLBI9rwI/EtBeoSWOrF5YY7Cem07ygrVnyMlZ4YA54rqIBXuxRbtCl5nrgm3t lAcxcs+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smRyP-0000000AnDY-3u7a; Fri, 06 Sep 2024 05:57:33 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smRte-0000000Am1L-3FHf; Fri, 06 Sep 2024 05:52:41 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 345ABA4467E; Fri, 6 Sep 2024 05:52:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id F10CAC4CECD; Fri, 6 Sep 2024 05:52:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725601957; bh=NF51BZTpHooM2jXXouuv+vaFnFg1br4o/kba70yIL58=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=BFyRRY4NFXwkS4wHF0H/68dCuyWVIwSnIn0mPwTReAkVJRSePaPLXj5DQtiF83o5G GH/lzZDuQbcIleoQ2bAYMx4i6j7//0biTUnE59KtzQaJQIhpNzCD2l/WU+VwgPnGNA yoNUlLd9uGIoCwUGlkwv+rquLXNWHyILYMdjzLiXpiaDncRYAoWxzkhrursQ714/XK X1ybSLWhNaVRkwHBlZMu/VAWJXvgAnyG7EmdQaydUVXhwGgiQPZEPA7METuLqxnmJv VRQqzxo8/4iHxnESYxXh5FA3VEhFbsYbCqDPZbuip9AcXaYLMM9v996ebNUg/vuzRY VE/eYK9RuUvdQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7D0DCE7AB4; Fri, 6 Sep 2024 05:52:36 +0000 (UTC) From: Chuan Liu via B4 Relay Date: Fri, 06 Sep 2024 13:52:36 +0800 Subject: [PATCH 4/4] clk: meson: s4: pll: hifi_pll frequency is not accurate MIME-Version: 1.0 Message-Id: <20240906-fix_clk-v1-4-2977ef0d72e7@amlogic.com> References: <20240906-fix_clk-v1-0-2977ef0d72e7@amlogic.com> In-Reply-To: <20240906-fix_clk-v1-0-2977ef0d72e7@amlogic.com> To: Neil Armstrong , Jerome Brunet , Michael Turquette , Stephen Boyd , Kevin Hilman , Martin Blumenstingl Cc: linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Chuan Liu X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1725601955; l=856; i=chuan.liu@amlogic.com; s=20240902; h=from:subject:message-id; bh=ro5ykdJDKk3Y3xDmm5Xm1OoCgPIR4AFyD2bYCkCFPEE=; b=IZ/yVuY2wLIpYN/mhZKmh78eSRhQWPOQXk6dCtA0gTmfYzo0NItf/y9PgHvE5d6fhK5WadFzv FjJPFyhAp4AAYn5pGpB2DtD/haOcypyrWQKn+SK+pRys+RXlfwNHg5p X-Developer-Key: i=chuan.liu@amlogic.com; a=ed25519; pk=fnKDB+81SoWGKW2GJNFkKy/ULvsDmJZRGBE7pR5Xcpo= X-Endpoint-Received: by B4 Relay for chuan.liu@amlogic.com/20240902 with auth_id=203 X-Original-From: Chuan Liu X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240905_225238_978724_951D5FCD X-CRM114-Status: UNSURE ( 9.89 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: chuan.liu@amlogic.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Chuan Liu The fractional denominator of S4's hifi_pll fractional multiplier is fixed to 100000, so flag CLK_MESON_PLL_FIXED_FRAC_MAX is added. Signed-off-by: Chuan Liu --- drivers/clk/meson/s4-pll.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/meson/s4-pll.c b/drivers/clk/meson/s4-pll.c index a97e19057b05..a793ac2e8cc7 100644 --- a/drivers/clk/meson/s4-pll.c +++ b/drivers/clk/meson/s4-pll.c @@ -371,7 +371,8 @@ static struct clk_regmap s4_hifi_pll_dco = { .range = &s4_gp0_pll_mult_range, .init_regs = s4_hifi_init_regs, .init_count = ARRAY_SIZE(s4_hifi_init_regs), - .flags = CLK_MESON_PLL_ROUND_CLOSEST, + .flags = CLK_MESON_PLL_ROUND_CLOSEST | + CLK_MESON_PLL_FIXED_FRAC_MAX, }, .hw.init = &(struct clk_init_data){ .name = "hifi_pll_dco",