Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nrf5340 ipc split #3104

Merged
merged 2 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions hw/drivers/ipc_nrf5340/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)'
20 changes: 14 additions & 6 deletions hw/drivers/ipc_nrf5340/src/ipc_nrf5340.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
/*
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions hw/drivers/ipc_nrf5340/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down