[PATCH] Timers: prevent conflict between ARM Generic Timer and Timer drivers

Marius Dinu m95d+git at psihoexpert.ro
Fri Aug 1 14:57:30 CEST 2025


Can't enable both CONFIG_SYS_ARCH_TIMER and CONFIG_TIMER_*.
This error occurs:
  ld: lib/time.o: in function `get_tbclk':
  /usr/src/u-boot/lib/time.c:72: multiple definition of `get_tbclk'; arch/arm/cpu/armv7/arch_timer.o:/usr/src/u-boot/arch/arm/cpu/armv7/arch_timer.c:63: first defined here
  ld: lib/time.o: in function `get_ticks':
  /usr/src/u-boot/lib/time.c:87: multiple definition of `get_ticks'; arch/arm/cpu/armv7/arch_timer.o:/usr/src/u-boot/arch/arm/cpu/armv7/arch_timer.c:44: first defined here

This commit makes timer drivers only available when ARM Generic Timer is not selected.
If it's selected, shows a warning explaining why Timers aren't visible.

Signed-off-by: Marius Dinu <m95d+git at psihoexpert.ro>
---
 arch/arm/Kconfig      | 2 ++
 drivers/timer/Kconfig | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 4e7593616d8..afa581dcf78 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -453,6 +453,8 @@ config SYS_ARCH_TIMER
 	  It is mandatory for ARMv8 implementation and widely available
 	  on ARMv7 systems.
 
+	  Note: Timer drivers (CONFIG_TIMER) are unavailable when this timer is selected.
+
 config ARM_SMCCC
 	bool "Support for ARM SMC Calling Convention (SMCCC)"
 	depends on CPU_V7A || ARM64
diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig
index cb6fc0e7fda..f1020661dc0 100644
--- a/drivers/timer/Kconfig
+++ b/drivers/timer/Kconfig
@@ -1,8 +1,13 @@
 menu "Timer Support"
 
+comment "Timer drivers are unavailable when ARM Generic Timer (CONFIG_SYS_ARCH_TIMER) is selected."
+	depends on DM
+	depends on SYS_ARCH_TIMER
+
 config TIMER
 	bool "Enable driver model for timer drivers"
 	depends on DM
+	depends on !SYS_ARCH_TIMER
 	help
 	  Enable driver model for timer access. It uses the same API as
 	  lib/time.c, but now implemented by the uclass. The first timer
-- 
2.49.0




More information about the U-Boot mailing list