Thread (19 messages) 19 messages, 2 authors, 15d ago

[PATCH v6 10/12] clk: nuvoton: ma35d1: Reparent SYSPLL correctly

flat view
COLD15d SUPERSEDED

From: Miquel Raynal <miquel.raynal@bootlin.com>
Date: 2026-09-30 17:26:54
Also in: linux-clk, linux-devicetree, lkml, stable
Subsystem: arm/nuvoton ma35 architecture, common clk framework, the rest · Maintainers: Jacky Huang, Shan-Chun Hung, Stephen Boyd, Brian Masney, Jerome Brunet, Linus Torvalds

Revision v6 of 3 in this series.

Revisions (3)
  1. v6 current
  2. v9 [diff vs current]
  3. v10 [diff vs current]
The clock tree is still incorrect. SYSPLL is derived from HXT, very much
like CAPLL, DDRPLL, VPLL, APLL and EPLL. SYSPLL has a fixed frequency,
but if HXT gets gated, SYSPLL stops running.

Reparent SYSPLL under HXT_GATE to properly define the clock tree
topology. After this change, the frequencies are identical, but the
clock tree looks (again) much closer to the reality.

Even though the TRM does not explicitly shows that HIRC and LIRC are
internally sourced from HXT and LXT, respectively, there are high
chances that these should be reparented as well. I will not do it but
the discussion is open and in case it becomes relevant, the 'parent'
field of the modified ma35d1_clk_fixed() helper can just be set
accordingly.

Fixes: 691521a367cf ("clk: nuvoton: Add clock driver for ma35d1 clock controller")
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/clk/nuvoton/clk-ma35d1.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/clk/nuvoton/clk-ma35d1.c b/drivers/clk/nuvoton/clk-ma35d1.c
index 384449d473c7..16cf2771e5ed 100644
--- a/drivers/clk/nuvoton/clk-ma35d1.c
+++ b/drivers/clk/nuvoton/clk-ma35d1.c
@@ -132,9 +132,9 @@ static const struct clk_div_table eadc_div_table[] = {
 	{13, 28}, {14, 30}, {15, 32}, {0, 0},
 };
 
-static struct clk_hw *ma35d1_clk_fixed(const char *name, int rate)
+static struct clk_hw *ma35d1_clk_fixed(const char *name, int rate, const char *parent)
 {
-	return clk_hw_register_fixed_rate(NULL, name, NULL, 0, rate);
+	return clk_hw_register_fixed_rate(NULL, name, parent, 0, rate);
 }
 
 static struct clk_hw *ma35d1_clk_mux(struct device *dev, const char *name,
@@ -279,22 +279,22 @@ static int ma35d1_clocks_probe(struct platform_device *pdev)
 		hws[LXT] = __clk_get_hw(clks[1].clk);
 	else
 		/* Old DTs do not describe the low-speed crystal */
-		hws[LXT] = ma35d1_clk_fixed("lxt", 32768);
+		hws[LXT] = ma35d1_clk_fixed("lxt", 32768, NULL);
 
 	hws[HXT_GATE] = ma35d1_clk_gate_parent(dev, "hxt_gate", hws[HXT],
 					       clk_base + REG_CLK_PWRCTL, 0);
 	hws[LXT_GATE] = ma35d1_clk_gate_parent(dev, "lxt_gate", hws[LXT],
 					       clk_base + REG_CLK_PWRCTL, 1);
-	hws[HIRC] = ma35d1_clk_fixed("hirc", 12000000);
+	hws[HIRC] = ma35d1_clk_fixed("hirc", 12000000, NULL);
 	hws[HIRC_GATE] = ma35d1_clk_gate(dev, "hirc_gate", "hirc",
 					 clk_base + REG_CLK_PWRCTL, 2);
-	hws[LIRC] = ma35d1_clk_fixed("lirc", 32000);
+	hws[LIRC] = ma35d1_clk_fixed("lirc", 32000, NULL);
 	hws[LIRC_GATE] = ma35d1_clk_gate(dev, "lirc_gate", "lirc",
 					 clk_base + REG_CLK_PWRCTL, 3);
 
 	hws[CAPLL] = ma35d1_reg_clk_pll(dev, CAPLL, pllmode[0], "capll",
 					hws[HXT_GATE], clk_base + REG_CLK_PLL0CTL0);
-	hws[SYSPLL] = ma35d1_clk_fixed("syspll", 180000000);
+	hws[SYSPLL] = ma35d1_clk_fixed("syspll", 180000000, "hxt_gate");
 	hws[DDRPLL] = ma35d1_reg_clk_pll(dev, DDRPLL, pllmode[1], "ddrpll",
 					hws[HXT_GATE], clk_base + REG_CLK_PLL2CTL0);
 	hws[APLL] = ma35d1_reg_clk_pll(dev, APLL, pllmode[2], "apll",
@@ -335,8 +335,8 @@ static int ma35d1_clocks_probe(struct platform_device *pdev)
 	hws[PCLK3_DIV4096] = ma35d1_clk_fixed_factor(dev, "pclk3_div4096", "pclk3", 1, 4096);
 	hws[PCLK4_DIV4096] = ma35d1_clk_fixed_factor(dev, "pclk4_div4096", "pclk4", 1, 4096);
 
-	hws[USBPHY0] = ma35d1_clk_fixed("usbphy0", 480000000);
-	hws[USBPHY1] = ma35d1_clk_fixed("usbphy1", 480000000);
+	hws[USBPHY0] = ma35d1_clk_fixed("usbphy0", 480000000, NULL);
+	hws[USBPHY1] = ma35d1_clk_fixed("usbphy1", 480000000, NULL);
 
 	/* DDR */
 	hws[DDR0_GATE] = ma35d1_clk_gate(dev, "ddr0_gate", "ddrpll",
-- 
2.55.0

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help