You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2023/11/13 10:17:13 UTC
(mynewt-core) 01/02: hw/drivers/nrf53_ipc: Split IPC initalization
This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 063ad03ec6c9adf975f3abc0d882fffd90ed79c0
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Wed Nov 8 09:05:26 2023 +0100
hw/drivers/nrf53_ipc: Split IPC initalization
This splits IPC initialization into two phases: IPC setup and
networking core startup. This allows to do any custom IPC setup
before actually starting networking core. By default netcore is
enabled right after setup so not functional changes.
---
hw/drivers/ipc_nrf5340/pkg.yml | 1 +
hw/drivers/ipc_nrf5340/src/ipc_nrf5340.c | 18 +++++++++++++-----
hw/drivers/ipc_nrf5340/syscfg.yml | 8 ++++++++
3 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/hw/drivers/ipc_nrf5340/pkg.yml b/hw/drivers/ipc_nrf5340/pkg.yml
index ed2ae46b7..4ad4b9c13 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 906ad31a5..da24746ee 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) {
diff --git a/hw/drivers/ipc_nrf5340/syscfg.yml b/hw/drivers/ipc_nrf5340/syscfg.yml
index 20e99d37b..c6ae2f595 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