From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4656606A681 for ; Tue, 1 Dec 2026 08:57:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=A9YugTwa; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DKFw8VS/ DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References: Message-Id:MIME-Version:Subject:Date:From:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=mqOhK6TSqJv3gmKBa5Sb7SonQOXLd1k6RqGefdiXIQY=; b=A9YugTwaZ+NZ9rvpSvJXX93JX2 Rd8Jhih/MTE0OzO/NKBFkkvqCbA+YWKNoDd46IZ+BFTrCgGZWFUvOb3b/+W0i5O1A4TLWXMNxvfJQ uxIO2L5oYBjBK8R2gEs4wwO/iJ4g3zLkZZgYTlHKHrHeGS7/V3KBb1O2/g9QvdtZzhM/v16Edqq9V ZKbrJvbQGS9s+XUK1qs0w7QJRWmfc4YCnWT2sL6e47no2O5c+gtCgnLRQmLQEI0EJz01qgCTtSrRk UGC7w/wTCUBVZWqkLZwsOlTYSzjJPl/FfO3KrqL1UtwrK6izSaNKdUWsKWkuDajTbNxFlQq4uIrgd iJ2DZ24Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYJfZ-000000076DE-1uyO; Tue, 01 Dec 2026 08:57:01 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYJfV-0000000760n-0Psu; Tue, 01 Dec 2026 08:56:57 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 88AFC623B4; Tue, 1 Dec 2026 08:56:56 +0000 (UTC) Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1796115416; b=hYpqc3TCpghaO88cmmRQC/+GE/cffh22Jq/fRRSwFSLKAptvnoI4VE7gM9q5r+68xP9Y uD4+u4mutXKdBM7WEAWkfJLFqqkkDX03OqWSgkXXWbvgIdGkFqulHPUI94L4KIbKnXdiu /SqY5wePon1ZIKoVEo8LRXrAgSnroFQWoXcoTQgtmmfozCz7nA/XxVGpYvDd7dNld71Zn VRnOg+y3afDWMWQ47m9bKuzSAlc5bfY4cwuXB8xTE2XCUhyCsZe1lg4nxQ9Fb8DAXJ/I8 5LDZQr6D+o9Bxaotpg/drVcqlCBRJlC/7DEP65XkNbum0+Y3+6igJ49KAnUlx0Auslw== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796115416; h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=u+L4vPD0B+u/WBVgd/jMJZZlIUzI5Wq0/q6Oz7Spmbo=; b=Wyxqs5mAf295Vof6HO00eRALHsbRzxH614iYvnzt6bLVkRR/KaIlRl60jq4mVJq/Jd6l cxd85HDAPGvKvxy3R/qVPih+rxgdjfxtnAm6yx3/ohc1KdNDotsDTnli/lFvzsUpdqAcI SNEWOUnlBED2qHr3A1BfeL39dueCLhP8PTjqGH94CgwmwUZnCIVYAqNmDICjg2fc4IRLF GlYyZOqhgAqPNdPd3lS91CDZWsbq48v753juroFqmjv+C6SsskdDdKCP1m6ko9jdozUUG ckyWg2iyCDMaqBb+mxM4/QlWk5nt1wEmk/8h3JjM1HzfY2WPJlMdu9sHkwNQw2iYAvg== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 271371F008A0; Tue, 1 Dec 2026 08:56:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796115416; bh=u+L4vPD0B+u/WBVgd/jMJZZlIUzI5Wq0/q6Oz7Spmbo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=DKFw8VS/PKfWv5D+qrPRJuVRdH+EPNWO4P/HOpHfx5FZz0hOFzL+gGzHe5NPfIfpL rIHupMW0z6puhtJhAK9rEryh4fkepTw6WdRf7p3Hy8GIRh2Gzx1R5MUjFj9yer6STK B8WkS/DlbmULwR/T9Tx48l0dCV70Y/HgeSAizBDGqU3yKX63N+E/A05RnN46tKLMEV vhSj1YAd9FjHu+5EuGlfyMCeiOLBp+dw/+Hg5RV7isJkvrRzCtc6/KK6QtafNYcvU0 08TdQ+Wt9ekqNxuBBjejX35oRtYAxqbD5XTPnefPDRtI16XUsmQbMRhmukPwUXxGqa 0rZKKC0EH0UlA== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 8EB784ECA6; Tue, 1 Dec 2026 08:56:42 +0000 (UTC) From: Jian Hu via B4 Relay Date: Tue, 01 Dec 2026 16:56:23 +0800 Subject: [PATCH RFC RFT v3 10/13] clk: meson: s4: Model the PLL pre-divider as a divider clock X-Archived-By: MIME-Version: 1.0 Message-Id: <20261201-meson_refactor_n-v3-10-f85a4460fd80@amlogic.com> References: <20261201-meson_refactor_n-v3-0-f85a4460fd80@amlogic.com> In-Reply-To: <20261201-meson_refactor_n-v3-0-f85a4460fd80@amlogic.com> To: Stephen Boyd , Brian Masney , Jerome Brunet , Neil Armstrong , Jerome Brunet , Kevin Hilman , Martin Blumenstingl , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Carlo Caione , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Jian Hu X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796115399; l=7392; i=jian.hu@amlogic.com; s=20260415; h=from:subject:message-id; bh=Vmqd1T8xUVm3UOXOUy4+KVvYijI5R13t5PGuKRk9IIw=; b=imG+8zIt67V+vAoZqq9IeW6V2RrdHoC8g87PUgUW54v7aGXICWiC7CyfnuNhjP/ReOVrma+Nm +7b921uFUo8C8azaCgt5TRlOQDac9P05QhAQzru0SnA/yZYZ2KmjxpL X-Developer-Key: i=jian.hu@amlogic.com; a=ed25519; pk=zHUE+rNtH9z+Sb8au1/elWknjFQmy5QDVkBoxleuOIA= X-Endpoint-Received: by B4 Relay for jian.hu@amlogic.com/20260415 with auth_id=735 X-Original-From: Jian Hu X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: jian.hu@amlogic.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 From: Jian Hu The pre-divider is currently described by a dedicated n parameter, although it is a plain divider between the input clock and the DCO. Model it as a regular divider clock and make it the parent of the DCO. Signed-off-by: Jian Hu --- drivers/clk/meson/s4-pll.c | 130 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 102 insertions(+), 28 deletions(-) diff --git a/drivers/clk/meson/s4-pll.c b/drivers/clk/meson/s4-pll.c index 56ce6f566e53..52c1836a53d3 100644 --- a/drivers/clk/meson/s4-pll.c +++ b/drivers/clk/meson/s4-pll.c @@ -51,6 +51,29 @@ * Meanwhile, these clock won't ever change at runtime. * For the above reasons, we can only use ro_ops for fixed PLL related clocks. */ +static struct clk_regmap s4_fixed_prediv = { + .data = &(struct clk_regmap_div_data){ + .offset = ANACTRL_FIXPLL_CTRL0, + .shift = 10, + .width = 5, + /* + * CLK_DIVIDER_ONE_BASED: the register value is the divisor + * itself, so a value of 1 gives a divisor of 1 and the PLL + * input is not divided. The hardware keeps this pre-divider + * at 1, which minimizes the PLL jitter. + */ + .flags = CLK_DIVIDER_ONE_BASED, + }, + .hw.init = &(struct clk_init_data){ + .name = "fixed_prediv", + .ops = &clk_regmap_divider_ro_ops, + .parent_data = (const struct clk_parent_data []) { + { .fw_name = "xtal", } + }, + .num_parents = 1, + }, +}; + static struct clk_regmap s4_fixed_pll_dco = { .data = &(struct meson_clk_pll_data){ .en = { @@ -68,11 +91,6 @@ static struct clk_regmap s4_fixed_pll_dco = { .shift = 0, .width = 17, }, - .n = { - .reg_off = ANACTRL_FIXPLL_CTRL0, - .shift = 10, - .width = 5, - }, .l = { .reg_off = ANACTRL_FIXPLL_CTRL0, .shift = 31, @@ -87,8 +105,8 @@ static struct clk_regmap s4_fixed_pll_dco = { .hw.init = &(struct clk_init_data){ .name = "fixed_pll_dco", .ops = &meson_clk_pll_ro_ops, - .parent_data = (const struct clk_parent_data []) { - { .fw_name = "xtal", } + .parent_hws = (const struct clk_hw *[]) { + &s4_fixed_prediv.hw }, .num_parents = 1, }, @@ -273,6 +291,34 @@ static struct clk_regmap s4_fclk_div2p5 = { }, }; +/* Force the pre-divider at 1 to minimize PLL jitter */ +static const struct clk_div_table s4_pll_prediv_div_table[] = { + { .val = 1, .div = 1 }, + { /* sentinel */ } +}; + +static struct clk_regmap s4_gp0_prediv = { + .data = &(struct clk_regmap_div_data){ + .offset = ANACTRL_GP0PLL_CTRL0, + .shift = 10, + .width = 5, + .table = s4_pll_prediv_div_table, + /* + * CLK_DIVIDER_INVALID_ZERO to report 0 Hz during registration. + * The same applies below. + */ + .flags = CLK_DIVIDER_INVALID_ZERO, + }, + .hw.init = &(struct clk_init_data){ + .name = "gp0_prediv", + .ops = &clk_regmap_divider_ops, + .parent_data = (const struct clk_parent_data []) { + { .fw_name = "xtal", } + }, + .num_parents = 1, + }, +}; + static const struct pll_mult_range s4_gp0_pll_mult_range = { .min = 125, .max = 250, @@ -302,11 +348,6 @@ static struct clk_regmap s4_gp0_pll_dco = { .shift = 0, .width = 8, }, - .n = { - .reg_off = ANACTRL_GP0PLL_CTRL0, - .shift = 10, - .width = 5, - }, .l = { .reg_off = ANACTRL_GP0PLL_CTRL0, .shift = 31, @@ -324,10 +365,11 @@ static struct clk_regmap s4_gp0_pll_dco = { .hw.init = &(struct clk_init_data){ .name = "gp0_pll_dco", .ops = &meson_clk_pll_ops, - .parent_data = (const struct clk_parent_data []) { - { .fw_name = "xtal", } + .parent_hws = (const struct clk_hw *[]) { + &s4_gp0_prediv.hw }, .num_parents = 1, + .flags = CLK_SET_RATE_PARENT, }, }; @@ -350,6 +392,24 @@ static struct clk_regmap s4_gp0_pll = { }, }; +static struct clk_regmap s4_hifi_prediv = { + .data = &(struct clk_regmap_div_data){ + .offset = ANACTRL_HIFIPLL_CTRL0, + .shift = 10, + .width = 5, + .table = s4_pll_prediv_div_table, + .flags = CLK_DIVIDER_INVALID_ZERO, + }, + .hw.init = &(struct clk_init_data){ + .name = "hifi_prediv", + .ops = &clk_regmap_divider_ops, + .parent_data = (const struct clk_parent_data []) { + { .fw_name = "xtal", } + }, + .num_parents = 1, + }, +}; + /* * Internal hifi pll emulation configuration parameters */ @@ -373,11 +433,6 @@ static struct clk_regmap s4_hifi_pll_dco = { .shift = 0, .width = 8, }, - .n = { - .reg_off = ANACTRL_HIFIPLL_CTRL0, - .shift = 10, - .width = 5, - }, .frac = { .reg_off = ANACTRL_HIFIPLL_CTRL1, .shift = 0, @@ -402,10 +457,11 @@ static struct clk_regmap s4_hifi_pll_dco = { .hw.init = &(struct clk_init_data){ .name = "hifi_pll_dco", .ops = &meson_clk_pll_ops, - .parent_data = (const struct clk_parent_data []) { - { .fw_name = "xtal", } + .parent_hws = (const struct clk_hw *[]) { + &s4_hifi_prediv.hw }, .num_parents = 1, + .flags = CLK_SET_RATE_PARENT, }, }; @@ -428,6 +484,24 @@ static struct clk_regmap s4_hifi_pll = { }, }; +static struct clk_regmap s4_hdmi_prediv = { + .data = &(struct clk_regmap_div_data){ + .offset = ANACTRL_HDMIPLL_CTRL0, + .shift = 10, + .width = 5, + .table = s4_pll_prediv_div_table, + .flags = CLK_DIVIDER_INVALID_ZERO, + }, + .hw.init = &(struct clk_init_data){ + .name = "hdmi_prediv", + .ops = &clk_regmap_divider_ops, + .parent_data = (const struct clk_parent_data []) { + { .fw_name = "xtal", } + }, + .num_parents = 1, + }, +}; + static struct clk_regmap s4_hdmi_pll_dco = { .data = &(struct meson_clk_pll_data){ .en = { @@ -440,11 +514,6 @@ static struct clk_regmap s4_hdmi_pll_dco = { .shift = 0, .width = 8, }, - .n = { - .reg_off = ANACTRL_HDMIPLL_CTRL0, - .shift = 10, - .width = 5, - }, .l = { .reg_off = ANACTRL_HDMIPLL_CTRL0, .shift = 31, @@ -460,10 +529,11 @@ static struct clk_regmap s4_hdmi_pll_dco = { .hw.init = &(struct clk_init_data){ .name = "hdmi_pll_dco", .ops = &meson_clk_pll_ops, - .parent_data = (const struct clk_parent_data []) { - { .fw_name = "xtal", } + .parent_hws = (const struct clk_hw *[]) { + &s4_hdmi_prediv.hw }, .num_parents = 1, + .flags = CLK_SET_RATE_PARENT, }, }; @@ -760,6 +830,7 @@ static struct clk_regmap s4_mpll3 = { /* Array of all clocks provided by this provider */ static struct clk_hw *s4_pll_hw_clks[] = { + [CLKID_FIXED_PREDIV] = &s4_fixed_prediv.hw, [CLKID_FIXED_PLL_DCO] = &s4_fixed_pll_dco.hw, [CLKID_FIXED_PLL] = &s4_fixed_pll.hw, [CLKID_FCLK_DIV2_DIV] = &s4_fclk_div2_div.hw, @@ -774,10 +845,13 @@ static struct clk_hw *s4_pll_hw_clks[] = { [CLKID_FCLK_DIV7] = &s4_fclk_div7.hw, [CLKID_FCLK_DIV2P5_DIV] = &s4_fclk_div2p5_div.hw, [CLKID_FCLK_DIV2P5] = &s4_fclk_div2p5.hw, + [CLKID_GP0_PREDIV] = &s4_gp0_prediv.hw, [CLKID_GP0_PLL_DCO] = &s4_gp0_pll_dco.hw, [CLKID_GP0_PLL] = &s4_gp0_pll.hw, + [CLKID_HIFI_PREDIV] = &s4_hifi_prediv.hw, [CLKID_HIFI_PLL_DCO] = &s4_hifi_pll_dco.hw, [CLKID_HIFI_PLL] = &s4_hifi_pll.hw, + [CLKID_HDMI_PREDIV] = &s4_hdmi_prediv.hw, [CLKID_HDMI_PLL_DCO] = &s4_hdmi_pll_dco.hw, [CLKID_HDMI_PLL_OD] = &s4_hdmi_pll_od.hw, [CLKID_HDMI_PLL] = &s4_hdmi_pll.hw, -- 2.47.1 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic