[PATCH 2/2] snapdragon: Set timer frequency for ARMV8_CNTFRQ_BROKEN platforms

Balaji Selvanathan balaji.selvanathan at oss.qualcomm.com
Mon Apr 6 12:55:37 CEST 2026


Implement arch_cpu_init() for Snapdragon platforms to initialize the
timer frequency when CONFIG_ARMV8_CNTFRQ_BROKEN is enabled. This is
required for platforms where the firmware does not set CNTFRQ_EL0.

Signed-off-by: Balaji Selvanathan <balaji.selvanathan at oss.qualcomm.com>
---
 arch/arm/mach-snapdragon/board.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
index 5fb3240acc5..6cc9270cc5a 100644
--- a/arch/arm/mach-snapdragon/board.c
+++ b/arch/arm/mach-snapdragon/board.c
@@ -39,6 +39,23 @@ DECLARE_GLOBAL_DATA_PTR;
 
 enum qcom_boot_source qcom_boot_source __section(".data") = 0;
 
+int arch_cpu_init(void)
+{
+	/* Set timer frequency for CONFIG_ARMV8_CNTFRQ_BROKEN
+	 * Use CONFIG_COUNTER_FREQUENCY if defined, which allows per-platform
+	 * timer frequency configuration via defconfig.
+	 */
+	if (IS_ENABLED(CONFIG_ARMV8_CNTFRQ_BROKEN)) {
+#ifdef CONFIG_COUNTER_FREQUENCY
+		gd->arch.timer_rate_hz = CONFIG_COUNTER_FREQUENCY;
+#else
+		gd->arch.timer_rate_hz = 19200000; /* Default 19.2 MHz for Qualcomm */
+#endif
+	}
+
+	return 0;
+}
+
 static struct mm_region rbx_mem_map[CONFIG_NR_DRAM_BANKS + 2] = { { 0 } };
 
 struct mm_region *mem_map = rbx_mem_map;

-- 
2.34.1



More information about the U-Boot mailing list