Skip to contentSkip to conversation

arm64: dts: intel: fix dw-apb-timer clock initialisation on Agilex and Agilex5

PATCH Superseded Adrian Ng Ho Yin 3 participants 6 messages May 26 – Sep 3 Device tree bindings

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover arm64: dts: intel: fix dw-apb-timer clock initialisation on Agilex and Agilex5

The DesignWare APB timers on Intel Agilex and Agilex5 SoCs fail to initialise because their clock managers are platform drivers registered at core_initcall, which runs after time_init() where TIMER_OF_DECLARE callbacks fire. With clocks/clock-names in the DTS, the timer driver calls clk_get() at a point when the clock provider is not yet registered, causing the timers to never come up.

Replace the clocks/clock-names reference in both DTSIs with a static clock-frequency of 100 MHz, which is the L4_SP clock rate configured by the bootloader. The dw-apb-timer binding explicitly supports this as an alternative when the clock framework is unavailable at probe time.

Adrian Ng Ho Yin (2):
arm64: dts: socfpga: agilex5: replace clocks reference with
clock-frequency for dw-apb-timer
arm64: dts: socfpga: agilex: replace clocks reference with
clock-frequency for dw-apb-timer

 arch/arm64/boot/dts/intel/socfpga_agilex.dtsi  | 12 ++++--------
 arch/arm64/boot/dts/intel/socfpga_agilex5.dtsi | 12 ++++--------
 2 files changed, 8 insertions(+), 16 deletions(-)
Signature · 1 line
2.49.GIT
#1 lore raw

PATCH 1/2 arm64: dts: socfpga: agilex5: replace clocks reference with clock-frequency for dw-apb-timer

The Agilex5 clock manager is a platform driver initialised at core_initcall, after time_init() where TIMER_OF_DECLARE callbacks run. The timer cannot defer its probe, so clk_get() fails and the timer is never brought up.

With clock-frequency, the tick rate is read directly from the DT node without involving the clock framework, allowing the timer to initialise regardless of when the clock manager is ready.

Replace clocks/clock-names with a static clock-frequency of 100 MHz, which is the L4_SP clock rate configured by the bootloader.

---
 arch/arm64/boot/dts/intel/socfpga_agilex5.dtsi | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
arch/arm64/boot/dts/intel/socfpga_agilex5.dtsi +4 -8
index b06c6d5d60ee..24b4d129b1d5 100644
@@ -430,32 +430,28 @@ timer0: timer0@10c03000 {
 			compatible = "snps,dw-apb-timer";
 			reg = <0x10c03000 0x100>;
 			interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&clkmgr AGILEX5_L4_SP_CLK>;
-			clock-names = "timer";
+			clock-frequency = <100000000>;
 		};
 
 		timer1: timer1@10c03100 {
 			compatible = "snps,dw-apb-timer";
 			reg = <0x10c03100 0x100>;
 			interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&clkmgr AGILEX5_L4_SP_CLK>;
-			clock-names = "timer";
+			clock-frequency = <100000000>;
 		};
 
 		timer2: timer2@10d00000 {
 			compatible = "snps,dw-apb-timer";
 			reg = <0x10d00000 0x100>;
 			interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&clkmgr AGILEX5_L4_SP_CLK>;
-			clock-names = "timer";
+			clock-frequency = <100000000>;
 		};
 
 		timer3: timer3@10d00100 {
 			compatible = "snps,dw-apb-timer";
 			reg = <0x10d00100 0x100>;
 			interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&clkmgr AGILEX5_L4_SP_CLK>;
-			clock-names = "timer";
+			clock-frequency = <100000000>;
 		};
 
 		uart0: serial@10c02000 {
Signature · 1 line
2.49.GIT
#2 lore raw

Re: [PATCH 1/2] arm64: dts: socfpga: agilex5: replace clocks reference with clock-frequency for dw-apb-timer

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Replacing 'clocks' with a static 'clock-frequency' property to work around a Linux driver probe…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Replacing 'clocks' with a static 'clock-frequency' property to work around a Linux driver probe ordering issue violates the principle that Device Tree describes hardware topology, not OS software state. --

commit a7903d7afbf4e7139441f7d02ec41f33a88a0de2
Author: Adrian Ng Ho Yin <[email protected]>

arm64: dts: socfpga: agilex5: replace clocks reference with clock-frequency for dw-apb-timer

This commit replaces the clocks and clock-names properties with a hardcoded clock-frequency property for the dw-apb-timer nodes in the Agilex5 device tree. This is done to bypass a Linux probe ordering issue where the timer initialization runs before the clock manager driver.

arch/arm64/boot/dts/intel/socfpga_agilex5.dtsi timer0: timer0@10c03000 { · line 434

Quoted 11 lines
arch/arm64/boot/dts/intel/socfpga_agilex5.dtsi +1 -2
@@ -430,32 +430,28 @@ timer0: timer0@10c03000 {
 			compatible = "snps,dw-apb-timer";
 			reg = <0x10c03000 0x100>;
 			interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&clkmgr AGILEX5_L4_SP_CLK>;
-			clock-names = "timer";
+			clock-frequency = <100000000>;
 		};

[Severity: Medium]
Is this modifying the device tree to work around an OS software state issue rather than describing the hardware topology? Replacing the physical clocks reference with a static clock-frequency bypasses the actual hardware link.

Could the clock provider be registered early using CLK_OF_DECLARE instead of removing the clocks property?

[ ... ]

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw

Re: [PATCH 1/2] arm64: dts: socfpga: agilex5: replace clocks reference with clock-frequency for dw-apb-timer

Quoted 31 lines · On 5/26/2026 5:24 PM, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Replacing 'clocks' with a static 'clock-frequency' property to work around a Linux driver probe ordering issue violates the principle that Device Tree describes hardware topology, not OS software state. --

commit a7903d7afbf4e7139441f7d02ec41f33a88a0de2
Author: Adrian Ng Ho Yin <[email protected]>

arm64: dts: socfpga: agilex5: replace clocks reference with clock-frequency for dw-apb-timer

This commit replaces the clocks and clock-names properties with a hardcoded clock-frequency property for the dw-apb-timer nodes in the Agilex5 device tree. This is done to bypass a Linux probe ordering issue where the timer initialization runs before the clock manager driver.

arch/arm64/boot/dts/intel/socfpga_agilex5.dtsi timer0: timer0@10c03000 { · line 434

Quoted 11 lines
arch/arm64/boot/dts/intel/socfpga_agilex5.dtsi +1 -2
@@ -430,32 +430,28 @@ timer0: timer0@10c03000 {
  			compatible = "snps,dw-apb-timer";
  			reg = <0x10c03000 0x100>;
  			interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&clkmgr AGILEX5_L4_SP_CLK>;
-			clock-names = "timer";
+			clock-frequency = <100000000>;
  		};

[Severity: Medium]
Is this modifying the device tree to work around an OS software state issue rather than describing the hardware topology? Replacing the physical clocks reference with a static clock-frequency bypasses the actual hardware link.

Quoted 5 lines

Could the clock provider be registered early using CLK_OF_DECLARE instead of removing the clocks property?

[ ... ]

Hi Dinh,

With regard to this comment from Sashiko which method do you prefer since you are the maintainer for both the device tree and the socfpga clk manager.

Converting the clock manager to CLK_OF_DECLARE is technically feasible but requires replacing devm_platform_ioremap_resource() and devm_kzalloc() with of_iomap() and kzalloc(), and changing the error handling model from returning an int to a void function with no deferral path. That is a separate, more invasive change. The dw-apb-timer binding explicitly provides clock-frequency as the supported alternative for this exact scenario — where the clock framework is unavailable at timer probe time.

Thank You
Adrian

#4 lore raw

PATCH 2/2 arm64: dts: socfpga: agilex: replace clocks reference with clock-frequency for dw-apb-timer

In reply to Adrian Ng Ho Yin

The Agilex clock manager is a platform driver initialised at core_initcall, after time_init() where TIMER_OF_DECLARE callbacks run. The timer cannot defer its probe, so clk_get() fails and the timer is never brought up.

With clock-frequency, the tick rate is read directly from the DT node without involving the clock framework, allowing the timer to initialise regardless of when the clock manager is ready.

Replace clocks/clock-names with a static clock-frequency of 100 MHz, which is the L4_SP clock rate configured by the bootloader.

---
 arch/arm64/boot/dts/intel/socfpga_agilex.dtsi | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
arch/arm64/boot/dts/intel/socfpga_agilex.dtsi +4 -8
index 0dfbafde8822..4ed762c6e07f 100644
@@ -491,32 +491,28 @@ timer0: timer0@ffc03000 {
 			compatible = "snps,dw-apb-timer";
 			interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>;
 			reg = <0xffc03000 0x100>;
-			clocks = <&clkmgr AGILEX_L4_SP_CLK>;
-			clock-names = "timer";
+			clock-frequency = <100000000>;
 		};
 
 		timer1: timer1@ffc03100 {
 			compatible = "snps,dw-apb-timer";
 			interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>;
 			reg = <0xffc03100 0x100>;
-			clocks = <&clkmgr AGILEX_L4_SP_CLK>;
-			clock-names = "timer";
+			clock-frequency = <100000000>;
 		};
 
 		timer2: timer2@ffd00000 {
 			compatible = "snps,dw-apb-timer";
 			interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>;
 			reg = <0xffd00000 0x100>;
-			clocks = <&clkmgr AGILEX_L4_SP_CLK>;
-			clock-names = "timer";
+			clock-frequency = <100000000>;
 		};
 
 		timer3: timer3@ffd00100 {
 			compatible = "snps,dw-apb-timer";
 			interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
 			reg = <0xffd00100 0x100>;
-			clocks = <&clkmgr AGILEX_L4_SP_CLK>;
-			clock-names = "timer";
+			clock-frequency = <100000000>;
 		};
 
 		uart0: serial@ffc02000 {
Signature · 1 line
2.49.GIT
#5 lore raw
In reply to Adrian Ng Ho Yin
Quoted 18 lines · Adrian Ng Ho Yin

The DesignWare APB timers on Intel Agilex and Agilex5 SoCs fail to initialise because their clock managers are platform drivers registered at core_initcall, which runs after time_init() where TIMER_OF_DECLARE callbacks fire. With clocks/clock-names in the DTS, the timer driver calls clk_get() at a point when the clock provider is not yet registered, causing the timers to never come up.

Replace the clocks/clock-names reference in both DTSIs with a static clock-frequency of 100 MHz, which is the L4_SP clock rate configured by the bootloader. The dw-apb-timer binding explicitly supports this as an alternative when the clock framework is unavailable at probe time.

Adrian Ng Ho Yin (2):
arm64: dts: socfpga: agilex5: replace clocks reference with
clock-frequency for dw-apb-timer
arm64: dts: socfpga: agilex: replace clocks reference with
clock-frequency for dw-apb-timer

Quoted 4 lines
  arch/arm64/boot/dts/intel/socfpga_agilex.dtsi  | 12 ++++--------
  arch/arm64/boot/dts/intel/socfpga_agilex5.dtsi | 12 ++++--------
  2 files changed, 8 insertions(+), 16 deletions(-)

Do you want this to get backported to stable releeases? If so, please append a Fixes tag.

I think the same patch can be applied to socfpga_stratix10.dtsi.

Thanks,
Dinh