Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
* [PATCH RESEND] clocksource: move NXP timer selection to drivers/clocksource
@ 2026-05-12  6:45 Enric Balletbo i Serra
  2026-05-12 15:17 ` Frank Li
  2026-05-13  5:57 ` sashiko-bot
  0 siblings, 2 replies; 3+ messages in thread
From: Enric Balletbo i Serra @ 2026-05-12  6:45 UTC (permalink / raw)
  To: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Daniel Lezcano, Thomas Gleixner
  Cc: linux-arm-kernel, imx, linux-kernel, Enric Balletbo i Serra

From: Enric Balletbo i Serra <eballetb@redhat.com>

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 now specifically restricted to 32-bit ARM SOC_VF610
platforms.

Fixes: bee33f22d7c3 ("clocksource/drivers/nxp-pit: Add NXP Automotive s32g2 / s32g3 support")
Signed-off-by: Enric Balletbo i Serra <eballetb@redhat.com>
---
 arch/arm/mach-imx/Kconfig   | 21 ---------------------
 drivers/clocksource/Kconfig | 31 +++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 6ea1bd55acf8..a361840d7a04 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -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
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index fd9112706545..b5c88ec65802 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -794,4 +794,35 @@ 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"
+		# This option is ONLY visible if we are on 32-bit ARM
+		depends on ARM && 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: 11439c4635edd669ae435eec308f4ab8a0804808
change-id: 20260302-fix-nxp-timer-9cb1fbd7afcd

Best regards,
-- 
Enric Balletbo i Serra <eballetb@redhat.com>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH RESEND] clocksource: move NXP timer selection to drivers/clocksource
  2026-05-12  6:45 [PATCH RESEND] clocksource: move NXP timer selection to drivers/clocksource Enric Balletbo i Serra
@ 2026-05-12 15:17 ` Frank Li
  2026-05-13  5:57 ` sashiko-bot
  1 sibling, 0 replies; 3+ messages in thread
From: Frank Li @ 2026-05-12 15:17 UTC (permalink / raw)
  To: Enric Balletbo i Serra
  Cc: Russell King, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Daniel Lezcano, Thomas Gleixner, linux-arm-kernel,
	imx, linux-kernel, Enric Balletbo i Serra

On Tue, May 12, 2026 at 08:45:16AM +0200, Enric Balletbo i Serra wrote:
> From: Enric Balletbo i Serra <eballetb@redhat.com>
>
> 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 now specifically restricted to 32-bit ARM SOC_VF610
> platforms.
>
> Fixes: bee33f22d7c3 ("clocksource/drivers/nxp-pit: Add NXP Automotive s32g2 / s32g3 support")

How it work when upstream clocksource/drivers/nxp-pit?

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> Signed-off-by: Enric Balletbo i Serra <eballetb@redhat.com>
> ---
>  arch/arm/mach-imx/Kconfig   | 21 ---------------------
>  drivers/clocksource/Kconfig | 31 +++++++++++++++++++++++++++++++
>  2 files changed, 31 insertions(+), 21 deletions(-)
>
> diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
> index 6ea1bd55acf8..a361840d7a04 100644
> --- a/arch/arm/mach-imx/Kconfig
> +++ b/arch/arm/mach-imx/Kconfig
> @@ -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
> diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
> index fd9112706545..b5c88ec65802 100644
> --- a/drivers/clocksource/Kconfig
> +++ b/drivers/clocksource/Kconfig
> @@ -794,4 +794,35 @@ 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"
> +		# This option is ONLY visible if we are on 32-bit ARM
> +		depends on ARM && 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: 11439c4635edd669ae435eec308f4ab8a0804808
> change-id: 20260302-fix-nxp-timer-9cb1fbd7afcd
>
> Best regards,
> --
> Enric Balletbo i Serra <eballetb@redhat.com>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH RESEND] clocksource: move NXP timer selection to drivers/clocksource
  2026-05-12  6:45 [PATCH RESEND] clocksource: move NXP timer selection to drivers/clocksource Enric Balletbo i Serra
  2026-05-12 15:17 ` Frank Li
@ 2026-05-13  5:57 ` sashiko-bot
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-05-13  5:57 UTC (permalink / raw)
  To: Enric Balletbo i Serra; +Cc: Frank.Li, imx

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The patch incorrectly broadens the dependency for `VF_USE_ARM_GLOBAL_TIMER` from `ARCH_MULTI_V7` to `ARM && SOC_VF610`, which breaks the default clocksource selection for Cortex-M4 builds of the Vybrid SoC.
--

commit cb813057e5be52d91a25b9ef118dc8090d04e9c6
Author: Enric Balletbo i Serra <eballetb@redhat.com>

clocksource: move NXP timer selection to drivers/clocksource

This commit relocates the NXP clocksource selection from the mach-imx Kconfig
to drivers/clocksource/Kconfig to allow sharing across architectures. It also
updates the selection to support ARCH_S32 and adds an option to fall back to
the standard ARM Architected Timer.

> diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
> index fd91127065454..b5c88ec658025 100644
> --- a/drivers/clocksource/Kconfig
> +++ b/drivers/clocksource/Kconfig
[ ... ]
> +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"
> +		# This option is ONLY visible if we are on 32-bit ARM
> +		depends on ARM && SOC_VF610

Does this dependency change break Cortex-M4 builds for the Vybrid SoC?

The Freescale Vybrid SoC supports both Cortex-A5 (ARCH_MULTI_V7) and
Cortex-M4 (ARM_SINGLE_ARMV7M) configurations. Previously,
VF_USE_ARM_GLOBAL_TIMER explicitly depended on ARCH_MULTI_V7. This correctly
hid the option on M4 builds, allowing Kconfig to fall back to the PIT timer
by default.

Since ARM evaluates to true for all 32-bit ARM architectures, including
ARM_SINGLE_ARMV7M, this option is now visible on Cortex-M4 builds. Because
the choice block defaults to VF_USE_ARM_GLOBAL_TIMER for SOC_VF610, Kconfig
will select the Cortex-A Global Timer by default for the Cortex-M4.

Will the M4 core fail to boot since it lacks the ARM Global Timer and the
required NXP_PIT_TIMER driver is no longer selected?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260512-fix-nxp-timer-v1-1-565e13ef3e46@redhat.com?part=1

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-13  5:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12  6:45 [PATCH RESEND] clocksource: move NXP timer selection to drivers/clocksource Enric Balletbo i Serra
2026-05-12 15:17 ` Frank Li
2026-05-13  5:57 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox