Commit ee458692 authored by Sebastian Bøe's avatar Sebastian Bøe Committed by Benjamin Cabé
Browse files

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: default avatarSebastian Bøe <sebastian.boe@nordicsemi.no>
parent 8007e248
Loading
Loading
Loading
Loading
+1 −3
Changes for soc/nordic/nrf53/nrf53_cpunet_mgmt.c: 1 added line, 3 removed lines.
Original line number Diff line number Diff line
@@ -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;
+18 −0
Changes for soc/nordic/nrf53/nrf53_cpunet_mgmt.h: 18 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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__ */
+7 −0
Changes for soc/nordic/nrf53/soc.c: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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)