From 4d654250a52289987ec580f921a609d752825293 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Fri, 3 Nov 2023 09:57:25 -0500 Subject: [PATCH] soc: lpc55xxx: Fix system hw clock cycle rate Commit c6e3bac4f changed the core clock frequency of LPC55XXX series. That clock is used by the cortex-m systick timer, which is the default timer used for system time in zephyr on this series. The bug is that the config SYS_CLOCK_HW_CYCLES_PER_SEC default was not updated on the affected platforms to account for this change, so system time is currently recorded as 150% of reality. Fix this by changing the kconfig to be set automatically at SOC level and remove board defaults. Signed-off-by: Declan Snyder --- boards/arm/lpcxpresso55s06/lpcxpresso55s06_defconfig | 1 - boards/arm/lpcxpresso55s16/lpcxpresso55s16_defconfig | 1 - boards/arm/lpcxpresso55s28/lpcxpresso55s28_defconfig | 1 - boards/arm/lpcxpresso55s36/lpcxpresso55s36_defconfig | 1 - boards/arm/lpcxpresso55s69/lpcxpresso55s69_cpu0_defconfig | 1 - boards/arm/lpcxpresso55s69/lpcxpresso55s69_cpu1_defconfig | 1 - boards/arm/lpcxpresso55s69/lpcxpresso55s69_ns_defconfig | 1 - soc/arm/nxp_lpc/lpc55xxx/Kconfig.soc | 4 ++++ 8 files changed, 4 insertions(+), 7 deletions(-) diff --git a/boards/arm/lpcxpresso55s06/lpcxpresso55s06_defconfig b/boards/arm/lpcxpresso55s06/lpcxpresso55s06_defconfig index b239a73b8c0..a743b67e2fd 100644 --- a/boards/arm/lpcxpresso55s06/lpcxpresso55s06_defconfig +++ b/boards/arm/lpcxpresso55s06/lpcxpresso55s06_defconfig @@ -13,7 +13,6 @@ CONFIG_SERIAL=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_GPIO=y CONFIG_PINCTRL=y -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=96000000 CONFIG_ARM_MPU=y CONFIG_RUNTIME_NMI=y diff --git a/boards/arm/lpcxpresso55s16/lpcxpresso55s16_defconfig b/boards/arm/lpcxpresso55s16/lpcxpresso55s16_defconfig index 1c7617436ce..44af7c468e1 100644 --- a/boards/arm/lpcxpresso55s16/lpcxpresso55s16_defconfig +++ b/boards/arm/lpcxpresso55s16/lpcxpresso55s16_defconfig @@ -13,7 +13,6 @@ CONFIG_SERIAL=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_GPIO=y CONFIG_PINCTRL=y -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=96000000 CONFIG_ARM_MPU=y CONFIG_RUNTIME_NMI=y diff --git a/boards/arm/lpcxpresso55s28/lpcxpresso55s28_defconfig b/boards/arm/lpcxpresso55s28/lpcxpresso55s28_defconfig index d99a3d01c55..8ce8f718d7e 100644 --- a/boards/arm/lpcxpresso55s28/lpcxpresso55s28_defconfig +++ b/boards/arm/lpcxpresso55s28/lpcxpresso55s28_defconfig @@ -13,7 +13,6 @@ CONFIG_SERIAL=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_GPIO=y CONFIG_PINCTRL=y -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=96000000 CONFIG_ARM_MPU=y CONFIG_HW_STACK_PROTECTION=y diff --git a/boards/arm/lpcxpresso55s36/lpcxpresso55s36_defconfig b/boards/arm/lpcxpresso55s36/lpcxpresso55s36_defconfig index 40c1b5fec75..4bf154138af 100644 --- a/boards/arm/lpcxpresso55s36/lpcxpresso55s36_defconfig +++ b/boards/arm/lpcxpresso55s36/lpcxpresso55s36_defconfig @@ -13,7 +13,6 @@ CONFIG_SERIAL=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_GPIO=y CONFIG_PINCTRL=y -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=96000000 CONFIG_ARM_MPU=y CONFIG_RUNTIME_NMI=y diff --git a/boards/arm/lpcxpresso55s69/lpcxpresso55s69_cpu0_defconfig b/boards/arm/lpcxpresso55s69/lpcxpresso55s69_cpu0_defconfig index f6bfb945eec..ece94dd0b6f 100644 --- a/boards/arm/lpcxpresso55s69/lpcxpresso55s69_cpu0_defconfig +++ b/boards/arm/lpcxpresso55s69/lpcxpresso55s69_cpu0_defconfig @@ -12,7 +12,6 @@ CONFIG_UART_CONSOLE=y CONFIG_SERIAL=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_GPIO=y -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=96000000 CONFIG_ARM_MPU=y CONFIG_HW_STACK_PROTECTION=y CONFIG_PINCTRL=y diff --git a/boards/arm/lpcxpresso55s69/lpcxpresso55s69_cpu1_defconfig b/boards/arm/lpcxpresso55s69/lpcxpresso55s69_cpu1_defconfig index 63d74806221..d93ccd89329 100644 --- a/boards/arm/lpcxpresso55s69/lpcxpresso55s69_cpu1_defconfig +++ b/boards/arm/lpcxpresso55s69/lpcxpresso55s69_cpu1_defconfig @@ -8,7 +8,6 @@ CONFIG_SOC_SERIES_LPC55XXX=y CONFIG_SOC_LPC55S69_CPU1=y CONFIG_BOARD_LPCXPRESSO55S69_CPU1=y CONFIG_GPIO=y -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=96000000 CONFIG_PINCTRL=y CONFIG_RUNTIME_NMI=y diff --git a/boards/arm/lpcxpresso55s69/lpcxpresso55s69_ns_defconfig b/boards/arm/lpcxpresso55s69/lpcxpresso55s69_ns_defconfig index a82f0241fed..451a92a74a6 100644 --- a/boards/arm/lpcxpresso55s69/lpcxpresso55s69_ns_defconfig +++ b/boards/arm/lpcxpresso55s69/lpcxpresso55s69_ns_defconfig @@ -12,7 +12,6 @@ CONFIG_UART_CONSOLE=y CONFIG_SERIAL=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_GPIO=y -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=96000000 CONFIG_PINCTRL=y # TFM sets up MPU_NS, can't correctly change this configuration yet diff --git a/soc/arm/nxp_lpc/lpc55xxx/Kconfig.soc b/soc/arm/nxp_lpc/lpc55xxx/Kconfig.soc index a1531b8ede4..c0341a8e9c5 100644 --- a/soc/arm/nxp_lpc/lpc55xxx/Kconfig.soc +++ b/soc/arm/nxp_lpc/lpc55xxx/Kconfig.soc @@ -130,6 +130,10 @@ config INIT_PLL1 Note that flash programming operations are limited to 100MHz, and this PLL should not be used as the core clock in those cases. +config SYS_CLOCK_HW_CYCLES_PER_SEC + default 144000000 if INIT_PLL1 + default 96000000 + config SECOND_CORE_MCUX bool "LPC55xxx's second core" depends on HAS_MCUX