Devicetree
 help / color / mirror / Atom feed
* [PATCH v5 0/9] clk: nuvoton: ma35d1: Fix mux parenting and peripheral clock rates
@ 2026-09-29 14:44 Miquel Raynal
  2026-09-29 14:44 ` [PATCH v5 1/9] clk: nuvoton: ma35d1: Keep the clock count in the driver Miquel Raynal
                   ` (8 more replies)
  0 siblings, 9 replies; 17+ messages in thread
From: Miquel Raynal @ 2026-09-29 14:44 UTC (permalink / raw)
  To: Jacky Huang, Shan-Chun Hung, Stephen Boyd, Brian Masney,
	Jerome Brunet, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Chi-Fang Li, Arnd Bergmann, Andrew Jeffery, Avi Fishman,
	Tomer Maimon, Tali Perry, Patrick Venture, Nancy Yuen,
	Benjamin Fair
  Cc: Thomas Petazzoni, Steam Lin, linux-arm-kernel, linux-clk,
	linux-kernel, Krzysztof Kozlowski, devicetree, openbmc,
	Miquel Raynal, stable, Conor Dooley, Jacky Huang, Jerome Brunet

I am in possession of an MA35D1 NuMaker board. The SPI controller has
been contributed, but at this stage it does not work with the current
clock driver.

The clock controller registers its muxes with .fw_name parent data,
which requires every internal clock name to be declared in the DT. As
the DT does not declare them, all parent lookups fail: muxes end up
registered as root clocks and most peripherals read a zero rate.

This conversion exposed a first issue with the WDT/WWDT parents which
were actually missing in the clock driver. I am not using these clocks
myself but it is worth fixing.

The second round of reviews raised another problem with the
crystals. HXT and LXT are external crystal oscillators wired on the
board, while HIRC and LIRC are on-chip RC oscillators. HXT was poorly
described (and incorrectly exposed through the DT) while LXT was not
even documented. The series now also takes the two crystal inputs from
the DT: they get documented in the bindings, described in the boards and
looked up by the driver.

The clock tree now looks much more accurate.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
Changes in v5:
- Fix the bindings wrt HXT and LXT.
- Fix the DT descriptions of HXT and LXT.
- Collect tags.
- Link to v4: https://lore.kernel.org/r/20260925-perso-ma35d1-upstream-clk-v4-0-f3697553391f@bootlin.com

Changes in v4:
- I forgot to bump the clock counter in the driver after adding the two
  new clocks in the bindings. Sashiko will keep complaining about the
  incoherency though. Since binding and driver changes should be kept
  separated, I cannot do both at the same time.
- Link to v3: https://lore.kernel.org/r/20260925-perso-ma35d1-upstream-clk-v3-0-ffbae7e020a8@bootlin.com

Changes in v3:
- Drop the number of clocks from the binding, set it in the driver only
- Split the binding/driver patches completely
- Link to v2: https://lore.kernel.org/r/20260921-perso-ma35d1-upstream-clk-v2-0-209fd32a8b00@bootlin.com

Changes in v2:
- New patch 1/3: register the missing WDT/WWDT parent clocks
- New patch 3/3: harden the code
- Link to v1: https://lore.kernel.org/r/20260813-perso-ma35d1-upstream-clk-v1-1-e78e5e6172ea@bootlin.com

---
Miquel Raynal (9):
      clk: nuvoton: ma35d1: Keep the clock count in the driver
      dt-bindings: clock: ma35d1: Document the missing crystal inputs
      dt-bindings: clock: ma35d1: Drop CLK_MAX_IDX define
      dt-bindings: clock: ma35d1: Add missing WDT/WWDT parent clocks
      clk: nuvoton: ma35d1: Add missing WDT/WWDT parent clocks
      clk: nuvoton: ma35d1: Use clk_hw pointers as mux parents
      clk: nuvoton: ma35d1: Avoid possible error pointer dereferencing
      clk: nuvoton: ma35d1: get HXT/LXT from DT
      arm64: dts: nuvoton: ma35d1: Add LXT crystal and correct HXT name

 .../bindings/clock/nuvoton,ma35d1-clk.yaml         |  16 +-
 arch/arm64/boot/dts/nuvoton/ma35d1-iot-512m.dts    |   9 +-
 arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts    |   9 +-
 arch/arm64/boot/dts/nuvoton/ma35d1.dtsi            |   3 +-
 drivers/clk/nuvoton/clk-ma35d1-divider.c           |   3 +
 drivers/clk/nuvoton/clk-ma35d1-pll.c               |   3 +
 drivers/clk/nuvoton/clk-ma35d1.c                   | 656 +++++++--------------
 include/dt-bindings/clock/nuvoton,ma35d1-clk.h     |   3 +-
 8 files changed, 246 insertions(+), 456 deletions(-)
---
base-commit: c5137d373338693fc18f03824782c7d383bfd57a
change-id: 20260813-perso-ma35d1-upstream-clk-65cacfc1a86b

Best regards,
-- 
Miquel Raynal <miquel.raynal@bootlin.com>


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2026-09-30 11:55 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-29 14:44 [PATCH v5 0/9] clk: nuvoton: ma35d1: Fix mux parenting and peripheral clock rates Miquel Raynal
2026-09-29 14:44 ` [PATCH v5 1/9] clk: nuvoton: ma35d1: Keep the clock count in the driver Miquel Raynal
2026-09-29 14:44 ` [PATCH v5 2/9] dt-bindings: clock: ma35d1: Document the missing crystal inputs Miquel Raynal
2026-09-30 11:55   ` Krzysztof Kozlowski
2026-09-29 14:44 ` [PATCH v5 3/9] dt-bindings: clock: ma35d1: Drop CLK_MAX_IDX define Miquel Raynal
2026-09-29 14:44 ` [PATCH v5 4/9] dt-bindings: clock: ma35d1: Add missing WDT/WWDT parent clocks Miquel Raynal
2026-09-29 14:44 ` [PATCH v5 5/9] clk: nuvoton: " Miquel Raynal
2026-09-29 14:44 ` [PATCH v5 6/9] clk: nuvoton: ma35d1: Use clk_hw pointers as mux parents Miquel Raynal
2026-09-29 14:44 ` [PATCH v5 7/9] clk: nuvoton: ma35d1: Avoid possible error pointer dereferencing Miquel Raynal
2026-09-29 14:44 ` [PATCH v5 8/9] clk: nuvoton: ma35d1: get HXT/LXT from DT Miquel Raynal
2026-09-29 14:56   ` sashiko-bot
2026-09-29 20:36     ` Miquel Raynal
2026-09-30  7:39       ` Jerome Brunet
2026-09-30  9:12         ` Miquel Raynal
2026-09-29 14:44 ` [PATCH v5 9/9] arm64: dts: nuvoton: ma35d1: Add LXT crystal and correct HXT name Miquel Raynal
2026-09-29 15:01   ` sashiko-bot
2026-09-29 20:48     ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox