Skip to contentSkip to conversation

clocksource: move NXP timer selection to drivers/clocksource

PATCH Applied Enric Balletbo i Serra 7 participants 7 messages May 14 – Jun 13

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v3 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 restricted to ARCH_S32, since Vybrid lacks the 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 v3:
- Restrict VF_TIMER_NONE to ARCH_S32 to prevent selecting it on Vybrid platforms which lack the ARM Architected Timer
- Link to v2: https://lore.kernel.org/r/[email protected]

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 | 31 +++++++++++++++++++++++++++++++
 2 files changed, 31 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 +31 -0
index d1a33a231a44..d9c76dd443f8 100644
@@ -793,4 +793,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"
+		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)"
+		depends on ARCH_S32
+		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: - [High] Shoehorning ARCH_S32 (ARM64) into the Vybrid scheduler clock choice block risks replacing the…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Shoehorning ARCH_S32 (ARM64) into the Vybrid scheduler clock choice block risks replacing the native ARM Architected Timer with a slower 32-bit MMIO timer. --

commit 37ddcc4eb82e3bfe1a0ebf5e407f22b4f2b1bef7
Author: Enric Balletbo i Serra <[email protected]>

clocksource: move NXP timer selection to drivers/clocksource

This commit relocates the NXP clocksource Kconfig logic from arch/arm/mach-imx/Kconfig to drivers/clocksource/Kconfig. It updates the selection to include support for the 64-bit ARCH_S32 platform, adding a "None" option to fallback to the standard ARM Architected Timer.

[ ... ]

Quoted 19 lines
drivers/clocksource/Kconfig +11 -0
index d1a33a231a44c..d9c76dd443f8a 100644
@@ -793,4 +793,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"
+		depends on ARCH_MULTI_V7 && SOC_VF610

drivers/clocksource/Kconfig config RTK_SYSTIMER · line 816

Quoted 10 lines
drivers/clocksource/Kconfig +10 -0
+		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.

Could this replace the native ARM Architected Timer with a slower 32-bit MMIO timer on S32 systems?

Since NXP_PIT_TIMER has no prompt of its own, an S32 user needing the PIT timer for other valid purposes (like clock events) is forced to select VF_USE_PIT_TIMER from this choice block.

If selected, the timer-nxp-pit.c driver unconditionally calls sched_clock_register() during initialization. This automatically overrides the existing scheduler clock if the new clock's rate is higher than or equal to the current one.

Because the PIT timer is typically driven by a high-speed system bus, its frequency will likely exceed the ARM Architected Timer's standard 25-50 MHz rate. Overriding the heavily optimized 64-bit system-register Architected Timer with a 32-bit memory-mapped PIT timer introduces massive read latency for every sched_clock() call.

Would it be better to expose NXP_PIT_TIMER as a standalone option for S32, and modify the driver to avoid registering as sched_clock on ARM64 architectures?

Quoted 11 lines
drivers/clocksource/Kconfig +10 -0
+
+	config VF_TIMER_NONE
+		bool "None (Use standard Arch Timer)"
+		depends on ARCH_S32
+		help
+		  Do not use any specific NXP timer driver. Use the standard
+		  ARM Architected Timer instead.
+
+endchoice
+
 endmenu
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw

Hi,

For some reason this doesn't appear as a thread in my original email. Answering your question below.

Missatge de l'adreça <[email protected]> del dia dj., 14 de maig 2026 a les 21:05:

Quoted 65 lines

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Shoehorning ARCH_S32 (ARM64) into the Vybrid scheduler clock choice block risks replacing the native ARM Architected Timer with a slower 32-bit MMIO timer. --

commit 37ddcc4eb82e3bfe1a0ebf5e407f22b4f2b1bef7
Author: Enric Balletbo i Serra <[email protected]>

clocksource: move NXP timer selection to drivers/clocksource

This commit relocates the NXP clocksource Kconfig logic from arch/arm/mach-imx/Kconfig to drivers/clocksource/Kconfig. It updates the selection to include support for the 64-bit ARCH_S32 platform, adding a "None" option to fallback to the standard ARM Architected Timer.

[ ... ]

Quoted 19 lines
drivers/clocksource/Kconfig +11 -0
index d1a33a231a44c..d9c76dd443f8a 100644
@@ -793,4 +793,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"
+             depends on ARCH_MULTI_V7 && SOC_VF610

drivers/clocksource/Kconfig config RTK_SYSTIMER · line 816

Quoted 10 lines
drivers/clocksource/Kconfig +10 -0
+             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.

Could this replace the native ARM Architected Timer with a slower 32-bit MMIO timer on S32 systems?

Since NXP_PIT_TIMER has no prompt of its own, an S32 user needing the PIT timer for other valid purposes (like clock events) is forced to select VF_USE_PIT_TIMER from this choice block.

If selected, the timer-nxp-pit.c driver unconditionally calls sched_clock_register() during initialization. This automatically overrides the existing scheduler clock if the new clock's rate is higher than or equal to the current one.

Because the PIT timer is typically driven by a high-speed system bus, its frequency will likely exceed the ARM Architected Timer's standard 25-50 MHz rate. Overriding the heavily optimized 64-bit system-register Architected Timer with a 32-bit memory-mapped PIT timer introduces massive read latency for every sched_clock() call.

Quoted 4 lines

Would it be better to expose NXP_PIT_TIMER as a standalone option for S32, and modify the driver to avoid registering as sched_clock on ARM64 architectures?

This is pre-existing driver behavior that applies equally on Vybrid today. The choice block defaults to VF_TIMER_NONE on S32, so the PIT is only selected if the user explicitly requests it. The choice prompt ("NXP clocksource for scheduler clock") makes the intent clear.

Decoupling NXP_PIT_TIMER from sched_clock registration on arm64 would be a worthwhile improvement to the driver itself, but I think that's a separate change from this Kconfig reorganization.

Does it make sense?

Cheers,
Enric

Quoted 14 lines

drivers/clocksource/Kconfig config RTK_SYSTIMER · line 827

Quoted 11 lines
drivers/clocksource/Kconfig +10 -0
+
+     config VF_TIMER_NONE
+             bool "None (Use standard Arch Timer)"
+             depends on ARCH_S32
+             help
+               Do not use any specific NXP timer driver. Use the standard
+               ARM Architected Timer instead.
+
+endchoice
+
 endmenu

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

#3 lore raw
In reply to Enric Balletbo i Serra

Hi all,

Quoted 18 lines · Enric Balletbo i Serra

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 restricted to ARCH_S32, since Vybrid lacks the 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.

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

Now that Frank [1] has created a merge request for Linux 7.1-rc1 and the request includes

arm64: dts: s32g: add PIT support for s32g2 and s32g3

If this patch is ok, would it make sense to pick that patch? Otherwise, we won't be able to select the PIT timer for aarch64 only builds.

Thanks.,
Enric

[1] From: [email protected]

The following changes since commit 254f49634ee16a731174d2ae34bc50bd5f45e731:

Linux 7.1-rc1 (2026-04-26 14:19:00 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/frank.li/linux.git
tags/imx-dt64-7.2

for you to fetch changes up to c10cfc952215644956284a42fa7b7860dfbcb5f5:

Quoted 97 lines

---
Changes in v3:
- Restrict VF_TIMER_NONE to ARCH_S32 to prevent selecting it on Vybrid platforms which lack the ARM Architected Timer
- Link to v2: https://lore.kernel.org/r/[email protected]

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 | 31 +++++++++++++++++++++++++++++++
 2 files changed, 31 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 +31 -1
index d1a33a231a44..d9c76dd443f8 100644
@@ -793,4 +793,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"
+               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)"
+               depends on ARCH_S32
+               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,
--
Enric Balletbo i Serra <[email protected]>

#4 lore raw
Quoted 22 lines · Enric Balletbo i Serra

Hi all,

Quoted 18 lines · Enric Balletbo i Serra

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 restricted to ARCH_S32, since Vybrid lacks the 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.

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

Now that Frank [1] has created a merge request for Linux 7.1-rc1 and the request includes

Thomas:
It touch drivers/clocksource, Is it okay go through Soc tree Or you
can help take care this one?

Frank

Quoted 124 lines

arm64: dts: s32g: add PIT support for s32g2 and s32g3

If this patch is ok, would it make sense to pick that patch? Otherwise, we won't be able to select the PIT timer for aarch64 only builds.

Thanks.,
Enric

[1] From: [email protected]

The following changes since commit 254f49634ee16a731174d2ae34bc50bd5f45e731:

Linux 7.1-rc1 (2026-04-26 14:19:00 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/frank.li/linux.git
tags/imx-dt64-7.2

for you to fetch changes up to c10cfc952215644956284a42fa7b7860dfbcb5f5:

Quoted 97 lines

---
Changes in v3:
- Restrict VF_TIMER_NONE to ARCH_S32 to prevent selecting it on Vybrid platforms which lack the ARM Architected Timer
- Link to v2: https://lore.kernel.org/r/[email protected]

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 | 31 +++++++++++++++++++++++++++++++
 2 files changed, 31 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 +31 -1
index d1a33a231a44..d9c76dd443f8 100644
@@ -793,4 +793,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"
+               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)"
+               depends on ARCH_S32
+               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,
--
Enric Balletbo i Serra <[email protected]>

#5 lore raw
Quoted 27 lines · Frank Li
Quoted 26 lines · Enric Balletbo i Serra

Hi all,

Quoted 21 lines · Enric Balletbo i Serra

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 restricted to ARCH_S32, since Vybrid lacks the 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")
Quoted 6 lines
Quoted 2 lines

Now that Frank [1] has created a merge request for Linux 7.1-rc1 and the request includes

Thomas:
It touch drivers/clocksource, Is it okay go through Soc tree Or you
can help take care this one?

I picked it

Thanks

#6 lore raw
In reply to Enric Balletbo i Serra
The following commit has been merged into the timers/clocksource branch of tip:

The following commit has been merged into the timers/clocksource branch of tip:

Commit-ID:     a9ac745bc320cbdc2ed3c851eb78f91f22ff975b
Gitweb:        https://git.kernel.org/tip/a9ac745bc320cbdc2ed3c851eb78f91f22ff975b
Author:        Enric Balletbo i Serra <[email protected]>
AuthorDate:    Thu, 14 May 2026 13:14:17 +02:00
Committer:     Daniel Lezcano <[email protected]>
CommitterDate: Wed, 10 Jun 2026 07:26:07 +02:00

clocksource: move NXP timer selection to drivers/clocksource

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 restricted to ARCH_S32, since Vybrid lacks the 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")
---
 arch/arm/mach-imx/Kconfig   | 21 ---------------------
 drivers/clocksource/Kconfig | 31 +++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 21 deletions(-)
arch/arm/mach-imx/Kconfig +0 -21
index 6ea1bd5..a361840 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 +31 -0
index d1a33a2..d9c76dd 100644
@@ -793,4 +793,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"
+		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)"
+		depends on ARCH_S32
+		help
+		  Do not use any specific NXP timer driver. Use the standard
+		  ARM Architected Timer instead.
+
+endchoice
+
 endmenu