soc: nrf53: Port nrf53_cpunet_mgmt_init to soc_early_init_hook

Port from SYS_INIT to soc_early_init_hook because SYS_INIT is legacy.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This commit is contained in:
Sebastian Bøe 2025-04-25 09:02:32 +02:00 committed by Benjamin Cabé
commit ee458692b5
3 changed files with 26 additions and 3 deletions

View file

@ -67,7 +67,7 @@ static void onoff_stop(struct onoff_manager *mgr, onoff_notify_fn notify)
notify(mgr, 0);
}
static int nrf53_cpunet_mgmt_init(void)
int nrf53_cpunet_mgmt_init(void)
{
static const struct onoff_transitions transitions = {
.start = onoff_start,
@ -77,8 +77,6 @@ static int nrf53_cpunet_mgmt_init(void)
return onoff_manager_init(&cpunet_mgr, &transitions);
}
SYS_INIT(nrf53_cpunet_mgmt_init, PRE_KERNEL_1, 0);
void nrf53_cpunet_enable(bool on)
{
int ret;

View file

@ -33,4 +33,22 @@ void nrf53_cpunet_enable(bool on);
*/
void nrf53_cpunet_init(void);
/**
* @brief Initialize the CPU network management system for the nRF5340.
*
* This function sets up an on-off manager for managing the network core of the nRF5340.
* It configures the necessary transitions for starting and stopping the network core.
*
* The function also ensures proper handling of GPIO pin forwarding when the
* `CONFIG_SOC_NRF_GPIO_FORWARDER_FOR_NRF5340` configuration is enabled. Pins are
* forwarded to the network core during startup and reassigned to the application
* core during shutdown.
*
* @return 0 on success, or a negative error code on failure.
*
* @note This function relies on the `onoff_manager` API to manage the start and stop
* transitions for the network core.
*/
int nrf53_cpunet_mgmt_init(void);
#endif /* NRF53_CPUNET_MGMT_H__ */

View file

@ -553,6 +553,13 @@ void soc_early_init_hook(void)
#if defined(CONFIG_SOC_DCDC_NRF53X_HV) || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(vregh))
nrf_regulators_vreg_enable_set(NRF_REGULATORS, NRF_REGULATORS_VREG_HIGH, true);
#endif
#if defined(CONFIG_SOC_NRF53_CPUNET_MGMT)
int err = nrf53_cpunet_mgmt_init();
__ASSERT_NO_MSG(err == 0);
(void)err;
#endif
}
void soc_late_init_hook(void)