Skip to contentSkip to conversation

clocksource: move NXP timer selection to drivers/clocksource

PATCH Superseded Enric Balletbo i Serra 2 participants 2 messages May 13 – May 14

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 clocksource: move NXP timer selection to drivers/clocksource

From: Enric Balletbo i Serra <[email protected]>

The Kconfig logic for selecting the scheduler clocksource on NXP Vybrid (VF610) uses a choice block restricted to 32-bit ARM. This prevents 64-bit architectures, such as the NXP S32 family, from enabling the NXP Periodic Interrupt Timer (PIT) driver (CONFIG_NXP_PIT_TIMER).

Relocate the NXP clocksource selection from arch/arm/mach-imx/Kconfig to drivers/clocksource/Kconfig. This allows the configuration to be shared across different architectures.

Update the selection to include support for ARCH_S32 and add a "None" option to allow using the standard ARM Architected Timer. The Vybrid Global Timer option is restricted to ARCH_MULTI_V7 SOC_VF610 platforms to prevent it from being visible on Cortex-M4 builds, which lack the ARM Global Timer hardware.

Fixes bee33f22d7c3 ("clocksource/drivers/nxp-pit: Add NXP Automotive s32g2 / s32g3 support")

---
Changes in v2:
- Fix VF_USE_ARM_GLOBAL_TIMER dependency: use ARCH_MULTI_V7 instead of
ARM to prevent the option from being visible on Cortex-M4 builds
(Sashiko AI review)
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 arch/arm/mach-imx/Kconfig   | 21 ---------------------
 drivers/clocksource/Kconfig | 30 ++++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 21 deletions(-)
arch/arm/mach-imx/Kconfig +0 -21
index 6ea1bd55acf8..a361840d7a04 100644
@@ -227,27 +227,6 @@ config SOC_VF610
 	help
 	  This enables support for Freescale Vybrid VF610 processor.
 
-choice
-	prompt "Clocksource for scheduler clock"
-	depends on SOC_VF610
-	default VF_USE_ARM_GLOBAL_TIMER
-
-	config VF_USE_ARM_GLOBAL_TIMER
-		bool "Use ARM Global Timer"
-		depends on ARCH_MULTI_V7
-		select ARM_GLOBAL_TIMER
-		select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
-		help
-		  Use the ARM Global Timer as clocksource
-
-	config VF_USE_PIT_TIMER
-		bool "Use PIT timer"
-		select NXP_PIT_TIMER
-		help
-		  Use SoC Periodic Interrupt Timer (PIT) as clocksource
-
-endchoice
-
 endif
 
 endif
drivers/clocksource/Kconfig +30 -0
index d1a33a231a44..15c02d3e9dbf 100644
@@ -793,4 +793,34 @@ config RTK_SYSTIMER
 	  this option only when building for a Realtek platform or for compilation
 	  testing.
 
+choice
+	prompt "NXP clocksource for scheduler clock"
+	depends on SOC_VF610 || ARCH_S32
+	# Default to Global Timer for Vybrid (32-bit)
+	default VF_USE_ARM_GLOBAL_TIMER if SOC_VF610
+	# Default to None for S32 (64-bit)
+	default VF_TIMER_NONE if ARCH_S32
+
+	config VF_USE_ARM_GLOBAL_TIMER
+		bool "Use NXP Vybrid Global Timer"
+		depends on ARCH_MULTI_V7 && SOC_VF610
+		select ARM_GLOBAL_TIMER
+		select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
+		help
+		  Use the NXP Vybrid Global Timer as clocksource.
+
+	config VF_USE_PIT_TIMER
+		bool "Use NXP PIT timer"
+		select NXP_PIT_TIMER
+		help
+		  Use NXP Periodic Interrupt Timer (PIT) as clocksource.
+
+	config VF_TIMER_NONE
+		bool "None (Use standard Arch Timer)"
+		help
+		  Do not use any specific NXP timer driver. Use the standard
+		  ARM Architected Timer instead.
+
+endchoice
+
 endmenu

---
base-commit: 7fd2df204f342fc17d1a0bfcd474b24232fb0f32
change-id: 20260302-fix-nxp-timer-9cb1fbd7afcd

Best regards,

Signature · 1 line
Enric Balletbo i Serra <[email protected]>
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] `VF_TIMER_NONE` is selectable on Vybrid (`SOC_VF610`) platforms but relies on hardware that does…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] VF_TIMER_NONE is selectable on Vybrid (SOC_VF610) platforms but relies on hardware that does not exist on those platforms. --

commit 7af32213cbfafc4c689a6d3a071f0b9a62837a94
Author: Enric Balletbo i Serra <[email protected]>

clocksource: move NXP timer selection to drivers/clocksource

This commit relocates the NXP clocksource selection from the ARM mach-imx architecture Kconfig to the drivers/clocksource Kconfig so it can be shared across architectures. It updates the choice block to support ARCH_S32 and adds a None option to allow using the standard ARM Architected Timer.

Quoted 4 lines
drivers/clocksource/Kconfig +0 -0
index d1a33a231a44c..15c02d3e9dbff 100644

[ ... ]

Quoted 17 lines
drivers/clocksource/Kconfig +17 -0
+choice
+	prompt "NXP clocksource for scheduler clock"
+	depends on SOC_VF610 || ARCH_S32
+	# Default to Global Timer for Vybrid (32-bit)
+	default VF_USE_ARM_GLOBAL_TIMER if SOC_VF610
+	# Default to None for S32 (64-bit)
+	default VF_TIMER_NONE if ARCH_S32
+
+	config VF_USE_ARM_GLOBAL_TIMER
+		bool "Use NXP Vybrid Global Timer"
+		depends on ARCH_MULTI_V7 && SOC_VF610
+		select ARM_GLOBAL_TIMER
+		select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
+		help
+		  Use the NXP Vybrid Global Timer as clocksource.
+
+	config VF_USE_PIT_TIMER

drivers/clocksource/Kconfig config RTK_SYSTIMER · line 822

Quoted 10 lines
drivers/clocksource/Kconfig +10 -0
+		bool "Use NXP PIT timer"
+		select NXP_PIT_TIMER
+		help
+		  Use NXP Periodic Interrupt Timer (PIT) as clocksource.
+
+	config VF_TIMER_NONE
+		bool "None (Use standard Arch Timer)"
+		help
+		  Do not use any specific NXP timer driver. Use the standard
+		  ARM Architected Timer instead.

Does this allow VF_TIMER_NONE to be selected on Vybrid (SOC_VF610) platforms?

Since the choice block itself depends on SOC_VF610 || ARCH_S32, this option is visible on Vybrid builds. If selected, it would result in a kernel without a valid scheduler clocksource because the Vybrid SoC lacks the standard ARM Architected Timer hardware.

Could VF_TIMER_NONE have a depends on ARCH_S32 or !SOC_VF610 restriction to prevent creating unbootable kernels on Vybrid?

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