diff --git a/hw/drivers/ipc_nrf5340/pkg.yml b/hw/drivers/ipc_nrf5340/pkg.yml index ed2ae46b7e..4ad4b9c139 100644 --- a/hw/drivers/ipc_nrf5340/pkg.yml +++ b/hw/drivers/ipc_nrf5340/pkg.yml @@ -31,3 +31,4 @@ pkg.deps: pkg.init: ipc_nrf5340_init: 'MYNEWT_VAL(IPC_NRF5340_SYSINIT_STAGE)' + ipc_nrf5340_netcore_init: 'MYNEWT_VAL(IPC_NRF5340_NETCORE_SYSINIT_STAGE)' diff --git a/hw/drivers/ipc_nrf5340/src/ipc_nrf5340.c b/hw/drivers/ipc_nrf5340/src/ipc_nrf5340.c index 906ad31a5f..6d586799d2 100644 --- a/hw/drivers/ipc_nrf5340/src/ipc_nrf5340.c +++ b/hw/drivers/ipc_nrf5340/src/ipc_nrf5340.c @@ -264,7 +264,11 @@ ipc_nrf5340_init(void) NRF_GPIO_Type *nrf_gpio; #endif + /* Make sure network core if off when we set up IPC */ + NRF_RESET->NETWORK.FORCEOFF = RESET_NETWORK_FORCEOFF_FORCEOFF_Hold; + memset(ipc_shared, 0, sizeof(ipc_shared)); + memset(shms, 0, sizeof(shms)); #if MYNEWT_VAL(NRF5340_EMBED_NET_CORE) /* @@ -286,10 +290,6 @@ ipc_nrf5340_init(void) } #endif - /* Make sure network core if off when we set up IPC */ - NRF_RESET->NETWORK.FORCEOFF = RESET_NETWORK_FORCEOFF_FORCEOFF_Hold; - memset(shms, 0, sizeof(shms)); - for (i = 0; i < IPC_MAX_CHANS; ++i) { shms[i].buf = shms_bufs[i]; shms[i].buf_size = IPC_BUF_SIZE; @@ -325,7 +325,11 @@ ipc_nrf5340_init(void) /* this allows netcore to access appcore RAM */ NRF_SPU_S->EXTDOMAIN[0].PERM = SPU_EXTDOMAIN_PERM_SECATTR_Secure << SPU_EXTDOMAIN_PERM_SECATTR_Pos; } +} +void +ipc_nrf5340_netcore_init(void) +{ /* Start Network Core */ /* Workaround for Errata 161: "RESET: Core is not fully reset after Force-OFF" */ *(volatile uint32_t *) ((uint32_t)NRF_RESET + 0x618ul) = 1ul; @@ -358,10 +362,14 @@ ipc_nrf5340_init(void) ipc_nrf5340_init_nrf_ipc(); NRF_IPC->SEND_CNF[NET_CRASH_CHANNEL] = (0x01UL << NET_CRASH_CHANNEL); +} +void +ipc_nrf5340_netcore_init(void) +{ /* * If ipc_state is already APP_AND_NET_RUNNING it means that net core - * restarted without app core involvment, notify app core about such + * restarted without app core involvement, notify app core about such * case. */ if (ipc_shared->ipc_state == APP_AND_NET_RUNNING) { @@ -395,7 +403,7 @@ ipc_nrf5340_reset(void) } /* Start Network Core */ - NRF_RESET->NETWORK.FORCEOFF = RESET_NETWORK_FORCEOFF_FORCEOFF_Release; + ipc_nrf5340_netcore_init(); } #endif diff --git a/hw/drivers/ipc_nrf5340/syscfg.yml b/hw/drivers/ipc_nrf5340/syscfg.yml index 20e99d37b9..c6ae2f595d 100644 --- a/hw/drivers/ipc_nrf5340/syscfg.yml +++ b/hw/drivers/ipc_nrf5340/syscfg.yml @@ -41,6 +41,14 @@ syscfg.defs: Sysinit stage for nRF53 IPC value: 10 + IPC_NRF5340_NETCORE_SYSINIT_STAGE: + description: > + Sysinit stage for nRF53 IPC networking core start. On application + core this enables networking core and wait for it to notify that IPC + is ready. On networking core this notifies application core that IPC + is ready. + value: 11 + IPC_NRF5340_NET_GPIO: description: > List of comma separated GPIO that should be configured for Network