boards: nxp: convert board sys_inits to hooks

Convert the nxp boards that have general init functions
as SYS_INITs to use board_early_init_hook instead.

Also standardize selection of CONFIG_BOARD_EARLY_INIT_HOOK in the
Kconfig file across NXP boards.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
This commit is contained in:
Declan Snyder 2025-02-11 07:35:35 -06:00 committed by Benjamin Cabé
commit 9cc3676c75
17 changed files with 39 additions and 65 deletions

View file

@ -1,8 +1,5 @@
# Copyright 2024 NXP # Copyright 2024-2025 NXP
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
config BOARD_INIT_PRIORITY config BOARD_FRDM_MCXA156
int "Board initialization priority" select BOARD_EARLY_INIT_HOOK
default 1
help
Board initialization priority.

View file

@ -15,7 +15,7 @@
/* System clock frequency. */ /* System clock frequency. */
extern uint32_t SystemCoreClock; extern uint32_t SystemCoreClock;
static int frdm_mcxa156_init(void) void board_early_init_hook(void)
{ {
uint32_t coreFreq; uint32_t coreFreq;
spc_active_mode_core_ldo_option_t ldoOption; spc_active_mode_core_ldo_option_t ldoOption;
@ -238,8 +238,4 @@ static int frdm_mcxa156_init(void)
/* Set SystemCoreClock variable. */ /* Set SystemCoreClock variable. */
SystemCoreClock = CLOCK_INIT_CORE_CLOCK; SystemCoreClock = CLOCK_INIT_CORE_CLOCK;
return 0;
} }
SYS_INIT(frdm_mcxa156_init, PRE_KERNEL_1, CONFIG_BOARD_INIT_PRIORITY);

View file

@ -1,8 +1,5 @@
# Copyright 2024 NXP # Copyright 2024-2025 NXP
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
#
config BOARD_INIT_PRIORITY config BOARD_FRDM_MCXN236
int "Board initialization priority" select BOARD_EARLY_INIT_HOOK
default 1
help
Board initialization priority.

View file

@ -57,7 +57,7 @@ void power_mode_od(void)
SPC_SetSRAMOperateVoltage(SPC0, &cfg); SPC_SetSRAMOperateVoltage(SPC0, &cfg);
} }
static int frdm_mcxn236_init(void) void board_early_init_hook(void)
{ {
enable_lpcac(); enable_lpcac();
@ -301,8 +301,4 @@ static int frdm_mcxn236_init(void)
/* Set SystemCoreClock variable. */ /* Set SystemCoreClock variable. */
SystemCoreClock = CLOCK_INIT_CORE_CLOCK; SystemCoreClock = CLOCK_INIT_CORE_CLOCK;
return 0;
} }
SYS_INIT(frdm_mcxn236_init, PRE_KERNEL_1, CONFIG_BOARD_INIT_PRIORITY);

View file

@ -1,8 +1,5 @@
# Copyright 2024 NXP # Copyright 2024-2025 NXP
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
config BOARD_INIT_PRIORITY config BOARD_FRDM_MCXN947
int "Board initialization priority" select BOARD_EARLY_INIT_HOOK
default 1
help
Board initialization priority.

View file

@ -84,7 +84,7 @@ __ramfunc static void enable_cache64(void)
} }
#endif #endif
static int frdm_mcxn947_init(void) void board_early_init_hook(void)
{ {
power_mode_od(); power_mode_od();
@ -394,8 +394,4 @@ static int frdm_mcxn947_init(void)
/* Set SystemCoreClock variable. */ /* Set SystemCoreClock variable. */
SystemCoreClock = CLOCK_INIT_CORE_CLOCK; SystemCoreClock = CLOCK_INIT_CORE_CLOCK;
return 0;
} }
SYS_INIT(frdm_mcxn947_init, PRE_KERNEL_1, CONFIG_BOARD_INIT_PRIORITY);

View file

@ -0,0 +1,5 @@
# Copyright 2024-2025 NXP
# SPDX-License-Identifier: Apache-2.0
config BOARD_LPCXPRESSO55S69
select BOARD_EARLY_INIT_HOOK

View file

@ -8,7 +8,7 @@
#include <fsl_common.h> #include <fsl_common.h>
#include <soc.h> #include <soc.h>
static int lpcxpresso_55s69_board_init(void) void board_early_init_hook(void)
{ {
#if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm6), nxp_lpc_i2s, okay)) && \ #if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm6), nxp_lpc_i2s, okay)) && \
@ -47,8 +47,4 @@ static int lpcxpresso_55s69_board_init(void)
#endif #endif
#endif #endif
return 0;
} }
SYS_INIT(lpcxpresso_55s69_board_init, PRE_KERNEL_1, 0);

View file

@ -0,0 +1,5 @@
# Copyright 2025 NXP
# SPDX-License-Identifier: Apache-2.0
config BOARD_MIMXRT1180_EVK
select BOARD_EARLY_INIT_HOOK

View file

@ -12,9 +12,6 @@ config EXTERNAL_MEM_CONFIG_DATA
config NXP_IMX_EXTERNAL_HYPERRAM config NXP_IMX_EXTERNAL_HYPERRAM
default y if CPU_CORTEX_M33 default y if CPU_CORTEX_M33
config BOARD_EARLY_INIT_HOOK
default y
if SECOND_CORE_MCUX && BOARD_MIMXRT1180_EVK_MIMXRT1189_CM7 if SECOND_CORE_MCUX && BOARD_MIMXRT1180_EVK_MIMXRT1189_CM7
config BUILD_OUTPUT_INFO_HEADER config BUILD_OUTPUT_INFO_HEADER

View file

@ -1,12 +1,9 @@
# Copyright 2022, NXP # Copyright 2022, 2025 NXP
# Copyright (c) 2023 Google LLC. # Copyright (c) 2023 Google LLC.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
config BOARD_INIT_PRIORITY config BOARD_MIMXRT595_EVK
int "Board initialization priority" select BOARD_EARLY_INIT_HOOK if BOARD_MIMXRT595_EVK_MIMXRT595S_CM33
default 45
help
Board initialization priority.
DT_ADSP_RESET_MEM := $(dt_nodelabel_path,adsp_reset) DT_ADSP_RESET_MEM := $(dt_nodelabel_path,adsp_reset)
DT_ADSP_DATA_MEM := $(dt_nodelabel_path,adsp_data) DT_ADSP_DATA_MEM := $(dt_nodelabel_path,adsp_data)

View file

@ -263,7 +263,7 @@ __ramfunc int32_t power_manager_set_profile(uint32_t power_profile)
#endif /* CONFIG_REGULATOR */ #endif /* CONFIG_REGULATOR */
static int mimxrt595_evk_init(void) void board_early_init_hook(void)
{ {
/* Set the correct voltage range according to the board. */ /* Set the correct voltage range according to the board. */
power_pad_vrange_t vrange = { power_pad_vrange_t vrange = {
@ -385,8 +385,6 @@ static int mimxrt595_evk_init(void)
rd_trim_96 = CLKCTL0->FRO_RDTRIM; rd_trim_96 = CLKCTL0->FRO_RDTRIM;
sc_trim_96 = sc_trim_192; sc_trim_96 = sc_trim_192;
} }
return 0;
} }
@ -417,5 +415,3 @@ SYS_INIT(board_config_pmic, POST_KERNEL, CONFIG_APPLICATION_INIT_PRIORITY);
*/ */
SYS_INIT(init_psram_framebufs, POST_KERNEL, CONFIG_APPLICATION_INIT_PRIORITY); SYS_INIT(init_psram_framebufs, POST_KERNEL, CONFIG_APPLICATION_INIT_PRIORITY);
#endif #endif
SYS_INIT(mimxrt595_evk_init, PRE_KERNEL_1, CONFIG_BOARD_INIT_PRIORITY);

View file

@ -1,8 +1,6 @@
# Copyright 2025 NXP
# Copyright (c) 2022 Nordic Semiconductor ASA # Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
config BOARD_INIT_PRIORITY config BOARD_MIMXRT685_EVK
int "Board initialization priority" select BOARD_EARLY_INIT_HOOK
default 45
help
Board initialization priority.

View file

@ -7,7 +7,7 @@
#include <zephyr/devicetree.h> #include <zephyr/devicetree.h>
#include <fsl_device_registers.h> #include <fsl_device_registers.h>
static int mimxrt685_evk_init(void) void board_early_init_hook(void)
{ {
/* flexcomm1 and flexcomm3 are configured to loopback the TX signal to RX */ /* flexcomm1 and flexcomm3 are configured to loopback the TX signal to RX */
@ -54,8 +54,4 @@ static int mimxrt685_evk_init(void)
*/ */
OCOTP->OTP_SHADOW[97] = 0x314000; OCOTP->OTP_SHADOW[97] = 0x314000;
#endif /* CONFIG_REBOOT */ #endif /* CONFIG_REBOOT */
return 0;
} }
SYS_INIT(mimxrt685_evk_init, PRE_KERNEL_1, CONFIG_BOARD_INIT_PRIORITY);

View file

@ -0,0 +1,7 @@
# Copyright 2025 NXP
# SPDX-License-Identifier: Apache-2.0
config BOARD_MIMXRT700_EVK
select BOARD_EARLY_INIT_HOOK if \
BOARD_MIMXRT700_EVK_MIMXRT798S_CM33_CPU0 || \
BOARD_MIMXRT700_EVK_MIMXRT798S_CM33_CPU1

View file

@ -12,7 +12,6 @@ CONFIG_GPIO=y
CONFIG_ARM_MPU=y CONFIG_ARM_MPU=y
CONFIG_HW_STACK_PROTECTION=y CONFIG_HW_STACK_PROTECTION=y
CONFIG_BOARD_EARLY_INIT_HOOK=y
# Enable TrustZone-M # Enable TrustZone-M
CONFIG_TRUSTED_EXECUTION_SECURE=y CONFIG_TRUSTED_EXECUTION_SECURE=y

View file

@ -12,7 +12,6 @@ CONFIG_GPIO=y
CONFIG_ARM_MPU=y CONFIG_ARM_MPU=y
CONFIG_HW_STACK_PROTECTION=y CONFIG_HW_STACK_PROTECTION=y
CONFIG_BOARD_EARLY_INIT_HOOK=y
# Enable TrustZone-M # Enable TrustZone-M
CONFIG_TRUSTED_EXECUTION_SECURE=y CONFIG_TRUSTED_EXECUTION_SECURE=y