Skip to contentSkip to conversation

drivers: clk: agilex5: Setting correct counter frequency in boot mode

PATCH In review Boon Khai Ng 2 participants 4 messages Feb 24 – Apr 14 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: clk: agilex5: Setting correct counter frequency in boot mode

From: Tien Fong Chee <[email protected]>

Counter frequency need to be set in 200Mhz when system in boot mode. 400Mhz need to be set when system exit the boot mode with the PLL generating the high frequency clock set by user.

---
 arch/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/Kconfig +1 -0
index 5508fce796a..4cc42ca393b 100644
@@ -30,6 +30,7 @@ config COUNTER_FREQUENCY
 			ROCKCHIP_RK3288 || ROCKCHIP_RK322X || ROCKCHIP_RK3036
 	default 25000000 if ARCH_LX2160A || ARCH_LX2162A || ARCH_LS1088A
 	default 100000000 if ARCH_ZYNQMP
+	default 400000000 if ARCH_SOCFPGA && ARM64 && !TARGET_SOCFPGA_AGILEX5
 	default 200000000 if ARCH_SOCFPGA_AGILEX5 || ARCH_SOCFPGA_AGILEX7M
 	default 0
 	help
Signature · 1 line
2.43.7
#2 lore raw
In reply to Boon Khai Ng

Re-add Tien Fong's Altera Email, with the patch's content.

Quoted 29 lines


From: Tien Fong Chee <[email protected]>

Counter frequency need to be set in 200Mhz when system in boot mode. 400Mhz need to be set when system exit the boot mode with the PLL generating the high frequency clock set by user.

---
 arch/arm/Kconfig | 1 +

 1 file changed, 1 insertion(+)
arch/arm/Kconfig +0 -0
index 5508fce796a..4cc42ca393b 100644
@@ -30,6 +30,7 @@ config COUNTER_FREQUENCY

                         ROCKCHIP_RK3288 || ROCKCHIP_RK322X || ROCKCHIP_RK3036 default 25000000 if ARCH_LX2160A || ARCH_LX2162A || ARCH_LS1088A default 100000000 if ARCH_ZYNQMP
+       default 400000000 if ARCH_SOCFPGA && ARM64 && !TARGET_SOCFPGA_AGILEX5 default 200000000 if ARCH_SOCFPGA_AGILEX5 || ARCH_SOCFPGA_AGILEX7M default 0
         help
--
2.43.7

#3 lore raw

Hi Boon Khai,

Quoted 29 lines

From: NG, BOON KHAI <[email protected]>
Sent: Tuesday, April 14, 2026 3:43 PM
To: U-boot Openlist <[email protected]>; Chee, Tien Fong <[email protected]>
Cc: Alice Guo <[email protected]>; YUSLAIMI, ALIF ZAKUAN <[email protected]>; Anshul Dalal <[email protected]>; Casey Connolly <[email protected]>; Christian Marangi <[email protected]>; Ilias Apalodimas <[email protected]>; Neil Armstrong <[email protected]>; Quentin Schulz <[email protected]>; Rayagonda Kokatanur <[email protected]>; Tien Fong Chee <[email protected]>; Tingting Meng <[email protected]>; Tom Rini <[email protected]> Subject: Re: [PATCH v1] drivers: clk: agilex5: Setting correct counter frequency in boot mode
Re-add Tien Fong's Altera Email, with the patch's content.

Quoted 14 lines


From: Tien Fong Chee <[email protected]>

Counter frequency need to be set in 200Mhz when system in boot mode. 400Mhz need to be set when system exit the boot mode with the PLL generating the high frequency clock set by user.

---
 arch/arm/Kconfig | 1 +

 1 file changed, 1 insertion(+)
Quoted 11 lines
Quoted 11 lines
arch/arm/Kconfig +0 -0
index 5508fce796a..4cc42ca393b 100644
@@ -30,6 +30,7 @@ config COUNTER_FREQUENCY

                         ROCKCHIP_RK3288 || ROCKCHIP_RK322X || ROCKCHIP_RK3036
         default 25000000 if ARCH_LX2160A || ARCH_LX2162A || ARCH_LS1088A default 100000000 if ARCH_ZYNQMP
+       default 400000000 if ARCH_SOCFPGA && ARM64 && !TARGET_SOCFPGA_AGILEX5

The commit message describes a *runtime* transition (200MHz early, 400MHz after PLL), but this patch only changes the Kconfig default (static).

All SoCFPGA64 counters are sourced from cs_at_clk and are 200MHz at early boot, so defaulting COUNTER_FREQUENCY to 400MHz will break early timeouts/delays.

Please respin:
- keep CONFIG_COUNTER_FREQUENCY default at 200000000 for SoCFPGA64, and
- perform the 400MHz update at runtime in the clock/PLL bring-up path, following the existing pattern in drivers/clk/altera/clk-agilex5.c (around the PLL setup section near line ~403), i.e. only update the counter frequency after the PLL is configured and the clock source has switched.
- Ensure correct namespace is used CONFIG_ARCH_SOCFPGA_* .

Best regards,
Tien Fong