[PATCH RFC RFT v3 11/13] clk: meson: s7: Model the PLL pre-divider as a divider clock

From: Jian Hu via B4 Relay

Date: Tue Dec 01 2026 - 03:56:52 EST


From: Jian Hu <jian.hu@xxxxxxxxxxx>

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 <jian.hu@xxxxxxxxxxx>
---
drivers/clk/meson/s7-pll.c | 33 ++++++++++++++++++++++++++-------
1 file changed, 26 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/meson/s7-pll.c b/drivers/clk/meson/s7-pll.c
index 5b115c3ff35e..0387c25082ac 100644
--- a/drivers/clk/meson/s7-pll.c
+++ b/drivers/clk/meson/s7-pll.c
@@ -38,6 +38,29 @@
#define HDMIPLL_CTRL3 0x1cc
#define HDMIPLL_STS 0x1dc

+static struct clk_regmap s7_fixed_pll_prediv = {
+ .data = &(struct clk_regmap_div_data) {
+ .offset = FIXPLL_CTRL0,
+ .shift = 11,
+ .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_pll_prediv",
+ .ops = &clk_regmap_divider_ro_ops,
+ .parent_data = &(const struct clk_parent_data) {
+ .fw_name = "fix",
+ },
+ .num_parents = 1,
+ },
+};
+
static struct clk_regmap s7_fixed_pll_vco = {
.data = &(struct meson_clk_pll_data) {
.en = {
@@ -50,11 +73,6 @@ static struct clk_regmap s7_fixed_pll_vco = {
.shift = 0,
.width = 9,
},
- .n = {
- .reg_off = FIXPLL_CTRL0,
- .shift = 11,
- .width = 5,
- },
.l = {
.reg_off = FIXPLL_STS,
.shift = 31,
@@ -69,8 +87,8 @@ static struct clk_regmap s7_fixed_pll_vco = {
.hw.init = &(struct clk_init_data) {
.name = "fixed_pll_vco",
.ops = &meson_clk_pll_ro_ops,
- .parent_data = &(const struct clk_parent_data) {
- .fw_name = "fix",
+ .parent_hws = (const struct clk_hw *[]) {
+ &s7_fixed_pll_prediv.hw
},
.num_parents = 1,
},
@@ -631,6 +649,7 @@ static struct clk_regmap s7_hdmi_pll_pix = {
};

static struct clk_hw *s7_pll_hws[] = {
+ [CLKID_FIXED_PLL_PREDIV] = &s7_fixed_pll_prediv.hw,
[CLKID_FIXED_PLL_VCO] = &s7_fixed_pll_vco.hw,
[CLKID_FIXED_PLL] = &s7_fixed_pll.hw,
[CLKID_FCLK_DIV2_DIV] = &s7_fclk_div2_div.hw,

--
2.47.1