Skip to content

Commit ee45869

Browse files
SebastianBoekartben
authored andcommitted
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 <[email protected]>
1 parent 8007e24 commit ee45869

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

soc/nordic/nrf53/nrf53_cpunet_mgmt.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static void onoff_stop(struct onoff_manager *mgr, onoff_notify_fn notify)
6767
notify(mgr, 0);
6868
}
6969

70-
static int nrf53_cpunet_mgmt_init(void)
70+
int nrf53_cpunet_mgmt_init(void)
7171
{
7272
static const struct onoff_transitions transitions = {
7373
.start = onoff_start,
@@ -77,8 +77,6 @@ static int nrf53_cpunet_mgmt_init(void)
7777
return onoff_manager_init(&cpunet_mgr, &transitions);
7878
}
7979

80-
SYS_INIT(nrf53_cpunet_mgmt_init, PRE_KERNEL_1, 0);
81-
8280
void nrf53_cpunet_enable(bool on)
8381
{
8482
int ret;

soc/nordic/nrf53/nrf53_cpunet_mgmt.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,22 @@ void nrf53_cpunet_enable(bool on);
3333
*/
3434
void nrf53_cpunet_init(void);
3535

36+
/**
37+
* @brief Initialize the CPU network management system for the nRF5340.
38+
*
39+
* This function sets up an on-off manager for managing the network core of the nRF5340.
40+
* It configures the necessary transitions for starting and stopping the network core.
41+
*
42+
* The function also ensures proper handling of GPIO pin forwarding when the
43+
* `CONFIG_SOC_NRF_GPIO_FORWARDER_FOR_NRF5340` configuration is enabled. Pins are
44+
* forwarded to the network core during startup and reassigned to the application
45+
* core during shutdown.
46+
*
47+
* @return 0 on success, or a negative error code on failure.
48+
*
49+
* @note This function relies on the `onoff_manager` API to manage the start and stop
50+
* transitions for the network core.
51+
*/
52+
int nrf53_cpunet_mgmt_init(void);
53+
3654
#endif /* NRF53_CPUNET_MGMT_H__ */

soc/nordic/nrf53/soc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,13 @@ void soc_early_init_hook(void)
553553
#if defined(CONFIG_SOC_DCDC_NRF53X_HV) || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(vregh))
554554
nrf_regulators_vreg_enable_set(NRF_REGULATORS, NRF_REGULATORS_VREG_HIGH, true);
555555
#endif
556+
557+
#if defined(CONFIG_SOC_NRF53_CPUNET_MGMT)
558+
int err = nrf53_cpunet_mgmt_init();
559+
560+
__ASSERT_NO_MSG(err == 0);
561+
(void)err;
562+
#endif
556563
}
557564

558565
void soc_late_init_hook(void)

0 commit comments

Comments
 (0)