soc: nxp: Make clock init weak and global

Make clock init functions in SOC level weak and global so they can be
overriden by board/app level.

Ideally these should have been put at board level but for now just make
them weak so they can be overriden without breaking anything.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
This commit is contained in:
Declan Snyder 2025-01-27 16:13:43 -06:00 committed by Benjamin Cabé
commit b83f8ed070
24 changed files with 24 additions and 24 deletions

View file

@ -183,7 +183,7 @@ static void SOC_CacheInit(void)
} }
/* Initialize clock. */ /* Initialize clock. */
static void SOC_ClockInit(void) void __weak SOC_ClockInit(void)
{ {
/* OSC/PLL is already initialized by Cortex-A9 core */ /* OSC/PLL is already initialized by Cortex-A9 core */

View file

@ -11,7 +11,7 @@
#include "wdog_imx.h" #include "wdog_imx.h"
/* Initialize clock. */ /* Initialize clock. */
void SOC_ClockInit(void) __weak void SOC_ClockInit(void)
{ {
/* OSC/PLL is already initialized by Cortex-A7 (u-boot) */ /* OSC/PLL is already initialized by Cortex-A7 (u-boot) */

View file

@ -58,7 +58,7 @@ static void soc_rdc_init(void)
#endif #endif
static void soc_clock_init(void) __weak void soc_clock_init(void)
{ {
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c3)) #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c3))
/* Set I2C source to SysPLL1 Div5 160MHZ */ /* Set I2C source to SysPLL1 Div5 160MHZ */

View file

@ -71,7 +71,7 @@ static const ccm_analog_frac_pll_config_t g_audioPll2Config = {
.postDiv = 1U, /* AUDIO PLL2 frequency = 722534399HZ */ .postDiv = 1U, /* AUDIO PLL2 frequency = 722534399HZ */
}; };
static void SOC_ClockInit(void) __weak void SOC_ClockInit(void)
{ {
/* /*
* Switch AHB NOC root to 24M first in order to configure * Switch AHB NOC root to 24M first in order to configure

View file

@ -46,7 +46,7 @@ static void SOC_RdcInit(void)
CLOCK_ControlGate(kCLOCK_VideoPll2Gate, kCLOCK_ClockNeededAll); CLOCK_ControlGate(kCLOCK_VideoPll2Gate, kCLOCK_ClockNeededAll);
} }
static void SOC_ClockInit(void) __weak void SOC_ClockInit(void)
{ {
/* /*
* Switch AHB NOC root to 25M first in order to configure * Switch AHB NOC root to 25M first in order to configure

View file

@ -80,7 +80,7 @@ const ccm_analog_integer_pll_config_t g_sysPll3Config = {
.postDiv = 2U, /*!< SYSTEM PLL3 frequency = 600MHZ */ .postDiv = 2U, /*!< SYSTEM PLL3 frequency = 600MHZ */
}; };
static void SOC_ClockInit(void) __weak void SOC_ClockInit(void)
{ {
/* /*
* The following steps just show how to configure the PLL clock sources using the clock * The following steps just show how to configure the PLL clock sources using the clock

View file

@ -135,7 +135,7 @@ const __imx_boot_ivt_section ivt image_vector_table = {
/** /**
* @brief Initialize the system clock * @brief Initialize the system clock
*/ */
static ALWAYS_INLINE void clock_init(void) __weak void clock_init(void)
{ {
/* Boot ROM did initialize the XTAL, here we only sets external XTAL /* Boot ROM did initialize the XTAL, here we only sets external XTAL
* OSC freq * OSC freq

View file

@ -99,7 +99,7 @@ __attribute__((weak)) void board_flexspi_clock_safe_config(void)
/** /**
* @brief Initialize the system clock * @brief Initialize the system clock
*/ */
static ALWAYS_INLINE void clock_init(void) __weak void clock_init(void)
{ {
clock_root_config_t rootCfg = {0}; clock_root_config_t rootCfg = {0};

View file

@ -160,7 +160,7 @@ const __imx_boot_ivt_section ivt image_vector_table = {
/** /**
* @brief Initialize the system clock * @brief Initialize the system clock
*/ */
static ALWAYS_INLINE void clock_init(void) __weak void clock_init(void)
{ {
clock_root_config_t rootCfg = {0}; clock_root_config_t rootCfg = {0};

View file

@ -181,7 +181,7 @@ static void usb_device_clock_init(void)
/** /**
* @brief Initialize the system clock * @brief Initialize the system clock
*/ */
static ALWAYS_INLINE void clock_init(void) __weak void clock_init(void)
{ {
#ifdef CONFIG_SOC_MIMXRT685S_CM33 #ifdef CONFIG_SOC_MIMXRT685S_CM33
/* Configure LPOSC clock*/ /* Configure LPOSC clock*/

View file

@ -84,7 +84,7 @@ static const sim_clock_config_t simConfig = {
* clock. * clock.
* *
*/ */
static ALWAYS_INLINE void clock_init(void) __weak void clock_init(void)
{ {
CLOCK_SetSimSafeDivs(); CLOCK_SetSimSafeDivs();

View file

@ -87,7 +87,7 @@ static const sim_clock_config_t simConfig = {
* clock. * clock.
* *
*/ */
static ALWAYS_INLINE void clock_init(void) __weak void clock_init(void)
{ {
CLOCK_SetSimSafeDivs(); CLOCK_SetSimSafeDivs();

View file

@ -69,7 +69,7 @@ static const sim_clock_config_t sim_config = {
.pllFllFrac = (0), .pllFllFrac = (0),
}; };
static ALWAYS_INLINE void clk_init(void) __weak void clk_init(void)
{ {
CLOCK_SetSimSafeDivs(); CLOCK_SetSimSafeDivs();

View file

@ -145,7 +145,7 @@ static const scg_spll_config_t scg_spll_config = {
.mult = (SCG_CLOCK_MULT(pll) - 16U) .mult = (SCG_CLOCK_MULT(pll) - 16U)
}; };
static ALWAYS_INLINE void clk_init(void) __weak void clk_init(void)
{ {
const scg_sys_clk_config_t scg_sys_clk_config_safe = { const scg_sys_clk_config_t scg_sys_clk_config_safe = {
.divSlow = kSCG_SysClkDivBy4, .divSlow = kSCG_SysClkDivBy4,

View file

@ -81,7 +81,7 @@ static const scg_firc_config_t scg_firc_config = {
.trimConfig = NULL .trimConfig = NULL
}; };
static ALWAYS_INLINE void clk_init(void) __weak void clk_init(void)
{ {
const scg_sys_clk_config_t scg_sys_clk_config_safe = { const scg_sys_clk_config_t scg_sys_clk_config_safe = {
.divSlow = kSCG_SysClkDivBy4, .divSlow = kSCG_SysClkDivBy4,

View file

@ -24,7 +24,7 @@
* Variables * Variables
******************************************************************************/ ******************************************************************************/
static ALWAYS_INLINE void clock_init(void) __weak void clock_init(void)
{ {
/* /*
* Core clock: 48MHz * Core clock: 48MHz

View file

@ -63,7 +63,7 @@ static const sim_clock_config_t sim_config = {
SIM_CLKDIV1_OUTDIV4(CLOCK_DIVIDER(flash_clk)), SIM_CLKDIV1_OUTDIV4(CLOCK_DIVIDER(flash_clk)),
}; };
static ALWAYS_INLINE void clk_init(void) __weak void clk_init(void)
{ {
CLOCK_SetSimSafeDivs(); CLOCK_SetSimSafeDivs();

View file

@ -117,7 +117,7 @@ static void set_modem_clock(void)
* clock. * clock.
* *
*/ */
static ALWAYS_INLINE void clock_init(void) __weak void clock_init(void)
{ {
CLOCK_SetSimSafeDivs(); CLOCK_SetSimSafeDivs();

View file

@ -52,7 +52,7 @@ static void CLOCK_SYS_FllStableDelay(void)
} }
} }
static ALWAYS_INLINE void clock_init(void) __weak void clock_init(void)
{ {
CLOCK_SetSimSafeDivs(); CLOCK_SetSimSafeDivs();

View file

@ -46,7 +46,7 @@
*/ */
#define CPU_FREQ DT_PROP(DT_PATH(cpus, cpu_0), clock_frequency) #define CPU_FREQ DT_PROP(DT_PATH(cpus, cpu_0), clock_frequency)
static ALWAYS_INLINE void clock_init(void) __weak void clock_init(void)
{ {
#ifdef CONFIG_SOC_LPC54114_M4 #ifdef CONFIG_SOC_LPC54114_M4

View file

@ -78,7 +78,7 @@ const pll_setup_t pll1Setup = {
* *
*/ */
static ALWAYS_INLINE void clock_init(void) __weak void clock_init(void)
{ {
ExternalClockFrequency = 0; ExternalClockFrequency = 0;

View file

@ -83,7 +83,7 @@ const osc_config_t oscConfig_BOARD_BootClockRUN = {
} }
}; };
static void clock_init(void) __weak void clock_init(void)
{ {
/* Set the system clock dividers in SIM to safe value. */ /* Set the system clock dividers in SIM to safe value. */
CLOCK_SetSimSafeDivs(); CLOCK_SetSimSafeDivs();

View file

@ -19,7 +19,7 @@
extern uint32_t SystemCoreClock; extern uint32_t SystemCoreClock;
extern void nxp_nbu_init(void); extern void nxp_nbu_init(void);
static ALWAYS_INLINE void clock_init(void) __weak void clock_init(void)
{ {
/* Unlock Reference Clock Status Registers to allow writes */ /* Unlock Reference Clock Status Registers to allow writes */
CLOCK_UnlockFircControlStatusReg(); CLOCK_UnlockFircControlStatusReg();

View file

@ -80,7 +80,7 @@ const clock_avpll_config_t avpll_config = {
* clock needs to be re-initialized on exit from Standby mode. Hence * clock needs to be re-initialized on exit from Standby mode. Hence
* this function is relocated to RAM. * this function is relocated to RAM.
*/ */
__ramfunc void clock_init(void) __weak __ramfunc void clock_init(void)
{ {
POWER_DisableGDetVSensors(); POWER_DisableGDetVSensors();