Skip to content

Commit e05ffdb

Browse files
soc: nxp s32k3: derive sys clock from devicetree
Use devicetree to provide the system clock frequency for S32K3 instead of hardcoding it in board defconfigs. - Add clock-frequency to /cpus/cpu@0 in nxp_s32k344_m7.dtsi using DT_FREQ_M(160). - Define DT_SYSCLK_PATH and derive SYS_CLOCK_HW_CYCLES_PER_SEC from the sysclk node via dt_node_int_prop_int() when CORTEX_M_SYSTICK. - Remove CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC from mr_canhubk3 and mr_canhubk3_s32k344_mcuboot defconfigs. This keeps the clock configuration in a single SoC-level place, aligns S32K3 with other NXP Cortex-M SoCs, and ensures both the MCUboot and application builds share the same SYS_CLOCK_HW_CYCLES_PER_SEC. Signed-off-by: Sumit Batra <sumit.batra@nxp.com>
1 parent 36c5e26 commit e05ffdb

File tree

4 files changed

+3
-8
lines changed

4 files changed

+3
-8
lines changed

boards/nxp/mr_canhubk3/mr_canhubk3_defconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44
CONFIG_BUILD_OUTPUT_HEX=y
55

6-
# Use Systick as system clock
7-
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=160000000
8-
96
# Run from internal Flash
107
CONFIG_XIP=y
118

boards/nxp/mr_canhubk3/mr_canhubk3_s32k344_mcuboot_defconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44
CONFIG_BUILD_OUTPUT_HEX=y
55

6-
# Use Systick as system clock
7-
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=160000000
8-
96
# Enable MPU
107
CONFIG_ARM_MPU=y
118

dts/arm/nxp/nxp_s32k344_m7.dtsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
device_type = "cpu";
2121
compatible = "arm,cortex-m7";
2222
reg = <0>;
23+
clock-frequency = <DT_FREQ_M(160)>;
2324
};
2425

2526
cpu@1 {

soc/nxp/s32/s32k3/Kconfig.defconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# NXP S32K3XX MCU series
22

3-
# Copyright 2023-2024 NXP
3+
# Copyright 2023-2025 NXP
44
# SPDX-License-Identifier: Apache-2.0
55

66
if SOC_SERIES_S32K3
77

88
config SYS_CLOCK_HW_CYCLES_PER_SEC
9-
default 2000000
9+
default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency) if CORTEX_M_SYSTICK
1010

1111
config NUM_IRQS
1212
# must be >= the highest interrupt number used

0 commit comments

Comments
 (0)