Skip to contentSkip to conversation

Nuvoton WPCM450 clock and reset driver

PATCH Applied Jonathan Neuschäfer 4 participants 13 messages May 8, 2022 – Nov 1, 2022

Subsystems (7)

v3 of 12 Applied Latest is v12 →

lore
Share & tools
lore

Jonathan Neuschäfer

author maintainer
#0 lore raw

v3 cover Nuvoton WPCM450 clock and reset driver

This series adds support for the clock and reset controller in the Nuvoton WPCM450 SoC. This means that the clock rates for peripherals will be calculated automatically based on the clock tree as it was preconfigured by the bootloader. The 24 MHz dummy clock, that is currently in the devicetree, is no longer needed. Somewhat unfortunately, this also means that there is a breaking change once the devicetree starts relying on the clock driver, but I find it acceptable in this case, because WPCM450 is still at a somewhat early stage.

Upstreaming plan (although other suggestions are welcome):

Once reviewed,

- The ARM/dts changes should go through Joel Stanley's bmc tree
- The clocksource/timer changes should probably go via Daniel Lezcano and TIP
- The watchdog patch should go via the watchdog tree
- The clock controller bindings and driver should go through the clk tree
- It might make sense to delay the final ARM/dts patch ("ARM: dts: wpcm450:
Switch clocks to clock controller") until next cycle to make sure it is merged after the clock driver.

v3:
- Changed "refclk" string to "ref"
- Fixed some dead code in the driver
- Added clk_prepare_enable call to the watchdog restart handler
- Added a few review tags

v2:
- https://lore.kernel.org/lkml/[email protected]/
- various small improvements

v1:
- https://lore.kernel.org/lkml/[email protected]/

Jonathan Neuschäfer (7):
dt-bindings: timer: nuvoton,npcm7xx-timer: Allow specifying all clocks
clocksource: timer-npcm7xx: Enable timer 1 clock before use
watchdog: npcm: Enable clock if provided
dt-bindings: clock: Add Nuvoton WPCM450 clock/reset controller
ARM: dts: wpcm450: Add clock controller node
clk: wpcm450: Add Nuvoton WPCM450 clock/reset controller driver
ARM: dts: wpcm450: Switch clocks to clock controller

 .../bindings/clock/nuvoton,wpcm450-clk.yaml   |  66 ++++
 .../bindings/timer/nuvoton,npcm7xx-timer.yaml |   8 +-
 arch/arm/boot/dts/nuvoton-wpcm450.dtsi        |  29 +-
 drivers/clk/Makefile                          |   1 +
 drivers/clk/clk-wpcm450.c                     | 363 ++++++++++++++++++
 drivers/clocksource/timer-npcm7xx.c           |  10 +
 drivers/reset/Kconfig                         |   2 +-
 drivers/watchdog/npcm_wdt.c                   |  18 +
 .../dt-bindings/clock/nuvoton,wpcm450-clk.h   |  67 ++++
 9 files changed, 555 insertions(+), 9 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/nuvoton,wpcm450-clk.yaml
 create mode 100644 drivers/clk/clk-wpcm450.c
 create mode 100644 include/dt-bindings/clock/nuvoton,wpcm450-clk.h

--
2.35.1

author maintainer
#1 lore raw

PATCH v3 1/7 dt-bindings: timer: nuvoton,npcm7xx-timer: Allow specifying all clocks

The timer module contains multiple timers. In the WPCM450 SoC, each timer runs off a clock can be gated individually. To model this correctly, the timer node in the devicetree needs to take multiple clock inputs.

---

v3:
- Add R-b tag

v2:
- no changes

---
 .../devicetree/bindings/timer/nuvoton,npcm7xx-timer.yaml  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/timer/nuvoton,npcm7xx-timer.yaml +7 -1
index 0cbc26a721514..023c999113c38 100644
@@ -23,7 +23,13 @@ properties:
       - description: The timer interrupt of timer 0
 
   clocks:
-    maxItems: 1
+    items:
+      - description: The reference clock for timer 0
+      - description: The reference clock for timer 1
+      - description: The reference clock for timer 2
+      - description: The reference clock for timer 3
+      - description: The reference clock for timer 4
+    minItems: 1
 
 required:
   - compatible

--
2.35.1

author maintainer
#2 lore raw

PATCH v3 2/7 clocksource: timer-npcm7xx: Enable timer 1 clock before use

In reply to Jonathan Neuschäfer

In the WPCM450 SoC, the clocks for each timer can be gated individually. To prevent the timer 1 clock from being gated, enable it explicitly.

---

v3:
- no changes

v2:
- Provide context in pr_warn message

v1:
- https://lore.kernel.org/lkml/[email protected]/

---
 drivers/clocksource/timer-npcm7xx.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/clocksource/timer-npcm7xx.c +10 -0
index a00520cbb660a..9af30af5f989a 100644
@@ -188,6 +188,7 @@ static void __init npcm7xx_clocksource_init(void)
 
 static int __init npcm7xx_timer_init(struct device_node *np)
 {
+	struct clk *clk;
 	int ret;
 
 	ret = timer_of_init(np, &npcm7xx_to);
@@ -199,6 +200,15 @@ static int __init npcm7xx_timer_init(struct device_node *np)
 	npcm7xx_to.of_clk.rate = npcm7xx_to.of_clk.rate /
 		(NPCM7XX_Tx_MIN_PRESCALE + 1);
 
+	/* Enable the clock for timer1, if it exists */
+	clk = of_clk_get(np, 1);
+	if (clk) {
+		if (!IS_ERR(clk))
+			clk_prepare_enable(clk);
+		else
+			pr_warn("%pOF: Failed to get clock for timer1: %pe", np, clk);
+	}
+
 	npcm7xx_clocksource_init();
 	npcm7xx_clockevents_init();
 

--
2.35.1

#3 lore raw

Re: [PATCH v3 2/7] clocksource: timer-npcm7xx: Enable timer 1 clock before use

Quoted 5 lines · Jonathan Neuschäfer

In the WPCM450 SoC, the clocks for each timer can be gated individually. To prevent the timer 1 clock from being gated, enable it explicitly.

---

Applied, thanks

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
author maintainer
#4 lore raw

Re: [PATCH v3 2/7] clocksource: timer-npcm7xx: Enable timer 1 clock before use

Quoted 9 lines · Daniel Lezcano
Quoted 5 lines · Jonathan Neuschäfer

In the WPCM450 SoC, the clocks for each timer can be gated individually. To prevent the timer 1 clock from being gated, enable it explicitly.

---

Applied, thanks

Hi, I didn't see this patch in linux-next. May I know where you applied it?

If it got lost somehow, I can also resend it later.

Best regards,
Jonathan

author maintainer
#5 lore raw

PATCH v3 3/7 watchdog: npcm: Enable clock if provided

In reply to Jonathan Neuschäfer

On the Nuvoton WPCM450 SoC, with its upcoming clock driver, peripheral clocks are individually gated and ungated. Therefore, the watchdog driver must be able to ungate the watchdog clock.

---

v3:
- Add enable/disable calls to npcm_wdt_restart handler
- Not applied due to the above change: Acked-by: Guenter Roeck <[email protected]>

v2:
- https://lore.kernel.org/lkml/[email protected]/
- Add clk_disable_unprepare call, suggested by Guenter Roeck

v1:
- https://lore.kernel.org/lkml/[email protected]/

---
 drivers/watchdog/npcm_wdt.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/watchdog/npcm_wdt.c +18 -0
index 28a24caa2627c..a1240a906ef2a 100644
@@ -3,6 +3,7 @@
 // Copyright (c) 2018 IBM Corp.
 
 #include <linux/bitops.h>
+#include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
@@ -43,6 +44,7 @@
 struct npcm_wdt {
 	struct watchdog_device  wdd;
 	void __iomem		*reg;
+	struct clk		*clk;
 };
 
 static inline struct npcm_wdt *to_npcm_wdt(struct watchdog_device *wdd)
@@ -66,6 +68,9 @@ static int npcm_wdt_start(struct watchdog_device *wdd)
 	struct npcm_wdt *wdt = to_npcm_wdt(wdd);
 	u32 val;
 
+	if (wdt->clk)
+		clk_prepare_enable(wdt->clk);
+
 	if (wdd->timeout < 2)
 		val = 0x800;
 	else if (wdd->timeout < 3)
@@ -100,6 +105,9 @@ static int npcm_wdt_stop(struct watchdog_device *wdd)
 
 	writel(0, wdt->reg);
 
+	if (wdt->clk)
+		clk_disable_unprepare(wdt->clk);
+
 	return 0;
 }
 
@@ -147,9 +155,15 @@ static int npcm_wdt_restart(struct watchdog_device *wdd,
 {
 	struct npcm_wdt *wdt = to_npcm_wdt(wdd);
 
+	if (wdt->clk)
+		clk_prepare_enable(wdt->clk);
+
 	writel(NPCM_WTR | NPCM_WTRE | NPCM_WTE, wdt->reg);
 	udelay(1000);
 
+	if (wdt->clk)
+		clk_disable_unprepare(wdt->clk);
+
 	return 0;
 }
 
@@ -191,6 +205,10 @@ static int npcm_wdt_probe(struct platform_device *pdev)
 	if (IS_ERR(wdt->reg))
 		return PTR_ERR(wdt->reg);
 
+	wdt->clk = devm_clk_get_optional(&pdev->dev, NULL);
+	if (IS_ERR(wdt->clk))
+		return PTR_ERR(wdt->clk);
+
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
 		return irq;

--
2.35.1

maintainer
#6 lore raw

Re: [PATCH v3 3/7] watchdog: npcm: Enable clock if provided

Quoted 64 lines · Jonathan Neuschäfer

On the Nuvoton WPCM450 SoC, with its upcoming clock driver, peripheral clocks are individually gated and ungated. Therefore, the watchdog driver must be able to ungate the watchdog clock.

---

v3:
- Add enable/disable calls to npcm_wdt_restart handler
- Not applied due to the above change: Acked-by: Guenter Roeck <[email protected]>

v2:
- https://lore.kernel.org/lkml/[email protected]/
- Add clk_disable_unprepare call, suggested by Guenter Roeck

v1:
- https://lore.kernel.org/lkml/[email protected]/

---
  drivers/watchdog/npcm_wdt.c | 18 ++++++++++++++++++
  1 file changed, 18 insertions(+)
drivers/watchdog/npcm_wdt.c +8 -0
index 28a24caa2627c..a1240a906ef2a 100644
@@ -3,6 +3,7 @@
  // Copyright (c) 2018 IBM Corp.
 
  #include <linux/bitops.h>
+#include <linux/clk.h>
  #include <linux/delay.h>
  #include <linux/interrupt.h>
  #include <linux/kernel.h>
@@ -43,6 +44,7 @@
  struct npcm_wdt {
  	struct watchdog_device  wdd;
  	void __iomem		*reg;
+	struct clk		*clk;
  };
 
  static inline struct npcm_wdt *to_npcm_wdt(struct watchdog_device *wdd)
@@ -66,6 +68,9 @@ static int npcm_wdt_start(struct watchdog_device *wdd)
  	struct npcm_wdt *wdt = to_npcm_wdt(wdd);
  	u32 val;
 
+	if (wdt->clk)
+		clk_prepare_enable(wdt->clk);
+
  	if (wdd->timeout < 2)
  		val = 0x800;
  	else if (wdd->timeout < 3)
@@ -100,6 +105,9 @@ static int npcm_wdt_stop(struct watchdog_device *wdd)
 
  	writel(0, wdt->reg);
 
+	if (wdt->clk)
+		clk_disable_unprepare(wdt->clk);
+
  	return 0;
  }
 
@@ -147,9 +155,15 @@ static int npcm_wdt_restart(struct watchdog_device *wdd,
  {
  	struct npcm_wdt *wdt = to_npcm_wdt(wdd);

drivers/watchdog/npcm_wdt.c static int npcm_wdt_restart(struct watchdog_device *wdd, · line 166

Quoted 10 lines
drivers/watchdog/npcm_wdt.c +6 -0
 
+	if (wdt->clk)
+		clk_prepare_enable(wdt->clk);
+
  	writel(NPCM_WTR | NPCM_WTRE | NPCM_WTE, wdt->reg);
  	udelay(1000);
 
+	if (wdt->clk)
+		clk_disable_unprepare(wdt->clk);
+

I am trying to understand why you stop the clock here.
If the watchdog didn't reset the system by now, for whatever reason, you explicitly don't want it to reset the system ? If so, please add a comment describing the reason for stopping the clock here.

Thanks,
Guenter

Quoted 17 lines
drivers/watchdog/npcm_wdt.c +4 -1
  	return 0;
  }
 
@@ -191,6 +205,10 @@ static int npcm_wdt_probe(struct platform_device *pdev)
  	if (IS_ERR(wdt->reg))
  		return PTR_ERR(wdt->reg);
 
+	wdt->clk = devm_clk_get_optional(&pdev->dev, NULL);
+	if (IS_ERR(wdt->clk))
+		return PTR_ERR(wdt->clk);
+
  	irq = platform_get_irq(pdev, 0);
  	if (irq < 0)
  		return irq;
--

2.35.1

author maintainer
#7 lore raw

Re: [PATCH v3 3/7] watchdog: npcm: Enable clock if provided

Quoted 19 lines · Guenter Roeck
Quoted 18 lines · Jonathan Neuschäfer

On the Nuvoton WPCM450 SoC, with its upcoming clock driver, peripheral clocks are individually gated and ungated. Therefore, the watchdog driver must be able to ungate the watchdog clock.

---

v3:
- Add enable/disable calls to npcm_wdt_restart handler
- Not applied due to the above change: Acked-by: Guenter Roeck <[email protected]>

v2:
- https://lore.kernel.org/lkml/[email protected]/
- Add clk_disable_unprepare call, suggested by Guenter Roeck

v1:
- https://lore.kernel.org/lkml/[email protected]/
---

[...]

Quoted 10 lines
Quoted 10 lines
drivers/watchdog/npcm_wdt.c +3 -0
@@ -147,9 +155,15 @@ static int npcm_wdt_restart(struct watchdog_device *wdd,
  {
  	struct npcm_wdt *wdt = to_npcm_wdt(wdd);
 
+	if (wdt->clk)
+		clk_prepare_enable(wdt->clk);
+
  	writel(NPCM_WTR | NPCM_WTRE | NPCM_WTE, wdt->reg);
  	udelay(1000);
 
Quoted 8 lines

drivers/watchdog/npcm_wdt.c static int npcm_wdt_stop(struct watchdog_device *wdd) · line 110

Quoted 3 lines
drivers/watchdog/npcm_wdt.c +3 -0
+	if (wdt->clk)
+		clk_disable_unprepare(wdt->clk);
+

I am trying to understand why you stop the clock here.
If the watchdog didn't reset the system by now, for whatever reason, you explicitly don't want it to reset the system ? If so, please add a comment describing the reason for stopping the clock here.

It was for symmetry with starting the clock, and in the hope that udelay(1000) will be enough to reach timer expiration. (In practice it does appear to work, although 1ms is not much.)

Upon reconsideration, I agree it's better to leave the clock running for reset (with a comment pointing out the asymmetry).

Best regards,
Jonathan

author maintainer
#8 lore raw

PATCH v3 4/7 dt-bindings: clock: Add Nuvoton WPCM450 clock/reset controller

In reply to Jonathan Neuschäfer

The Nuvoton WPCM450 SoC has a combined clock and reset controller. Add a devicetree binding for it, as well as definitions for the bit numbers used by it.

---

v3:
- Change clock-output-names and clock-names from "refclk" to "ref", suggested by Krzysztof Kozlowski

v2:
- https://lore.kernel.org/lkml/[email protected]/
- Various improvements, suggested by Krzysztof Kozlowski

v1:
- https://lore.kernel.org/lkml/[email protected]/

---
 .../bindings/clock/nuvoton,wpcm450-clk.yaml   | 66 ++++++++++++++++++
 .../dt-bindings/clock/nuvoton,wpcm450-clk.h   | 67 +++++++++++++++++++
 2 files changed, 133 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/nuvoton,wpcm450-clk.yaml
 create mode 100644 include/dt-bindings/clock/nuvoton,wpcm450-clk.h
Documentation/devicetree/bindings/clock/nuvoton,wpcm450-clk.yaml new file +66 -0
new file mode 100644
index 0000000000000..525024a58df4c
@@ -0,0 +1,66 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/nuvoton,wpcm450-clk.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Nuvoton WPCM450 clock controller
+
+maintainers:
+  - Jonathan Neuschäfer <[email protected]>
+
+description:
+  The clock controller of the Nuvoton WPCM450 SoC supplies clocks and resets to
+  the rest of the chip.
+
+properties:
+  compatible:
+    const: nuvoton,wpcm450-clk
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: Reference clock oscillator (should be 48 MHz)
+
+  clock-names:
+    items:
+      - const: ref
+
+  '#clock-cells':
+    const: 1
+
+  '#reset-cells':
+    const: 1
+
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - '#clock-cells'
+
+examples:
+  - |
+    #include <dt-bindings/clock/nuvoton,wpcm450-clk.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    refclk: clock-48mhz {
+      /* 48 MHz reference oscillator */
+      compatible = "fixed-clock";
+      clock-output-names = "ref";
+      clock-frequency = <48000000>;
+      #clock-cells = <0>;
+    };
+
+    clk: clock-controller@b0000200 {
+      reg = <0xb0000200 0x100>;
+      compatible = "nuvoton,wpcm450-clk";
+      clocks = <&refclk>;
+      clock-names = "ref";
+      #clock-cells = <1>;
+      #reset-cells = <1>;
+    };
include/dt-bindings/clock/nuvoton,wpcm450-clk.h new file +67 -0

67 lines not on this page · raw message

--
2.35.1

Reviewed-by on v3 4/7
#9 lore raw

Re: [PATCH v3 4/7] dt-bindings: clock: Add Nuvoton WPCM450 clock/reset controller

Quoted 10 lines · Jonathan Neuschäfer

The Nuvoton WPCM450 SoC has a combined clock and reset controller. Add a devicetree binding for it, as well as definitions for the bit numbers used by it.

---

v3:
- Change clock-output-names and clock-names from "refclk" to "ref", suggested by Krzysztof Kozlowski

Best regards,
Krzysztof

author maintainer
#10 lore raw

PATCH v3 5/7 ARM: dts: wpcm450: Add clock controller node

In reply to Jonathan Neuschäfer

This declares the clock controller and the necessary 48 Mhz reference clock in the WPCM450 device. Switching devices over to the clock controller is intentionally done in a separate patch to give time for the clock controller driver to land.

---

v3:
- Change clock-output-names and clock-names from "refclk" to "ref"

v2:
- https://lore.kernel.org/lkml/[email protected]/
- no changes

---
 arch/arm/boot/dts/nuvoton-wpcm450.dtsi | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
arch/arm/boot/dts/nuvoton-wpcm450.dtsi +17 -0
index 1c63ab14c4383..515e943787416 100644
@@ -39,6 +39,14 @@ clk24m: clock-24mhz {
 		#clock-cells = <0>;
 	};
 
+	refclk: clock-48mhz {
+		/* 48 MHz reference oscillator */
+		compatible = "fixed-clock";
+		clock-output-names = "ref";
+		clock-frequency = <48000000>;
+		#clock-cells = <0>;
+	};
+
 	soc {
 		compatible = "simple-bus";
 		#address-cells = <1>;
@@ -51,6 +59,15 @@ gcr: syscon@b0000000 {
 			reg = <0xb0000000 0x200>;
 		};
 
+		clk: clock-controller@b0000200 {
+			compatible = "nuvoton,wpcm450-clk";
+			reg = <0xb0000200 0x100>;
+			clocks = <&refclk>;
+			clock-names = "ref";
+			#clock-cells = <1>;
+			#reset-cells = <1>;
+		};
+
 		serial0: serial@b8000000 {
 			compatible = "nuvoton,wpcm450-uart";
 			reg = <0xb8000000 0x20>;

--
2.35.1

author maintainer
#11 lore raw

PATCH v3 6/7 clk: wpcm450: Add Nuvoton WPCM450 clock/reset controller driver

In reply to Jonathan Neuschäfer

This driver implements the following features w.r.t. the clock and reset controller in the WPCM450 SoC:

- It calculates the rates for all clocks managed by the clock controller
- It leaves the clock tree mostly unchanged, except that it enables/ disables clock gates based on usage.
- It exposes the reset lines managed by the controller using the Generic Reset Controller subsystem

NOTE: If the driver and the corresponding devicetree node are present,
the driver will disable "unused" clocks. This is problem until the clock relations are properly declared in the devicetree (in a later patch). Until then, the clk_ignore_unused kernel parameter can be used as a workaround.

---

v3:
- Change reference clock name from "refclk" to "ref"
- Remove unused variable in return path of wpcm450_clk_register_pll
- Remove unused divisor tables

v2:
- https://lore.kernel.org/lkml/[email protected]/
- no changes

---
 drivers/clk/Makefile      |   1 +
 drivers/clk/clk-wpcm450.c | 363 ++++++++++++++++++++++++++++++++++++++
 drivers/reset/Kconfig     |   2 +-
 3 files changed, 365 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/clk-wpcm450.c
drivers/clk/Makefile +1 -0
index 2bd5ffd595bf3..07edb0f4ba8ba 100644
@@ -73,6 +73,7 @@ obj-$(CONFIG_ARCH_VT8500)		+= clk-vt8500.o
 obj-$(CONFIG_COMMON_CLK_RS9_PCIE)	+= clk-renesas-pcie.o
 obj-$(CONFIG_COMMON_CLK_VC5)		+= clk-versaclock5.o
 obj-$(CONFIG_COMMON_CLK_WM831X)		+= clk-wm831x.o
+obj-$(CONFIG_ARCH_WPCM450)		+= clk-wpcm450.o
 obj-$(CONFIG_COMMON_CLK_XGENE)		+= clk-xgene.o
 
 # please keep this section sorted lexicographically by directory path name
drivers/clk/clk-wpcm450.c new file +363 -0

363 lines not on this page · raw message

drivers/reset/Kconfig +1 -1
index b496028b6bfaf..50a3c1403c335 100644
@@ -201,7 +201,7 @@ config RESET_SCMI
 
 config RESET_SIMPLE
 	bool "Simple Reset Controller Driver" if COMPILE_TEST
-	default ARCH_ASPEED || ARCH_BCM4908 || ARCH_BITMAIN || ARCH_REALTEK || ARCH_STM32 || (ARCH_INTEL_SOCFPGA && ARM64) || ARCH_SUNXI || ARC
+	default ARCH_ASPEED || ARCH_BCM4908 || ARCH_BITMAIN || ARCH_REALTEK || ARCH_STM32 || (ARCH_INTEL_SOCFPGA && ARM64) || ARCH_SUNXI || ARC || ARCH_NPCM
 	help
 	  This enables a simple reset controller driver for reset lines that
 	  that can be asserted and deasserted by toggling bits in a contiguous,

--
2.35.1

author maintainer
#12 lore raw

PATCH v3 7/7 ARM: dts: wpcm450: Switch clocks to clock controller

In reply to Jonathan Neuschäfer

This change is incompatible with older kernels because it requires the clock controller driver, but I think that's acceptable because WPCM450 support is generally still in an early phase.

---

v2, v3:
- no changes

---
 arch/arm/boot/dts/nuvoton-wpcm450.dtsi | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
arch/arm/boot/dts/nuvoton-wpcm450.dtsi +9 -11
index 515e943787416..d5ed95ef810e8 100644
@@ -2,6 +2,7 @@
 // Copyright 2021 Jonathan Neuschäfer
 
 #include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/clock/nuvoton,wpcm450-clk.h>
 
 / {
 	compatible = "nuvoton,wpcm450";
@@ -32,13 +33,6 @@ cpu@0 {
 		};
 	};
 
-	clk24m: clock-24mhz {
-		/* 24 MHz dummy clock */
-		compatible = "fixed-clock";
-		clock-frequency = <24000000>;
-		#clock-cells = <0>;
-	};
-
 	refclk: clock-48mhz {
 		/* 48 MHz reference oscillator */
 		compatible = "fixed-clock";
@@ -73,7 +67,7 @@ serial0: serial@b8000000 {
 			reg = <0xb8000000 0x20>;
 			reg-shift = <2>;
 			interrupts = <7 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&clk24m>;
+			clocks = <&clk WPCM450_CLK_UART0>;
 			pinctrl-names = "default";
 			pinctrl-0 = <&bsp_pins>;
 			status = "disabled";
@@ -84,7 +78,7 @@ serial1: serial@b8000100 {
 			reg = <0xb8000100 0x20>;
 			reg-shift = <2>;
 			interrupts = <8 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&clk24m>;
+			clocks = <&clk WPCM450_CLK_UART1>;
 			status = "disabled";
 		};
 
@@ -92,14 +86,18 @@ timer0: timer@b8001000 {
 			compatible = "nuvoton,wpcm450-timer";
 			interrupts = <12 IRQ_TYPE_LEVEL_HIGH>;
 			reg = <0xb8001000 0x1c>;
-			clocks = <&clk24m>;
+			clocks = <&clk WPCM450_CLK_TIMER0>,
+				 <&clk WPCM450_CLK_TIMER1>,
+				 <&clk WPCM450_CLK_TIMER2>,
+				 <&clk WPCM450_CLK_TIMER3>,
+				 <&clk WPCM450_CLK_TIMER4>;
 		};
 
 		watchdog0: watchdog@b800101c {
 			compatible = "nuvoton,wpcm450-wdt";
 			interrupts = <1 IRQ_TYPE_LEVEL_HIGH>;
 			reg = <0xb800101c 0x4>;
-			clocks = <&clk24m>;
+			clocks = <&clk WPCM450_CLK_WDT>;
 		};
 
 		aic: interrupt-controller@b8002000 {

--
2.35.1