Skip to content

Commit 6a7cbff

Browse files
asmellbykartben
authored andcommitted
soc: silabs: siwx91x: Initialize NWP sufficiently early
The NWP provides Bluetooth, Wi-Fi and crypto services, and must be initialized before any users of these. Mbed TLS is initialized at priority level 40 (kernel default priority), ensure that the NWP is initialized before that. Make the priority configurable to allow users to tweak the init sequence. Signed-off-by: Aksel Skauge Mellbye <[email protected]>
1 parent 39e56e9 commit 6a7cbff

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

soc/silabs/silabs_siwx91x/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,12 @@ config SOC_SILABS_SLEEPTIMER
1919
help
2020
The Sleeptimer HAL module is used for SIWX91X.
2121

22+
config SIWX91X_NWP_INIT_PRIORITY
23+
int "SiWx91x Network Processor init priority"
24+
default 39
25+
help
26+
Initialization priority of the SiWx91x Network Processor. NWP init must
27+
have a higher priority than services that depend on it, such as Bluetooth,
28+
Wi-Fi and crypto.
29+
2230
endif # SOC_FAMILY_SILABS_SIWX91X

soc/silabs/silabs_siwx91x/siwg917/nwp.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,11 @@ static int siwg917_nwp_init(void)
193193

194194
return 0;
195195
}
196-
SYS_INIT(siwg917_nwp_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
196+
#if defined(CONFIG_MBEDTLS_INIT)
197+
BUILD_ASSERT(CONFIG_SIWX91X_NWP_INIT_PRIORITY < CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
198+
"mbed TLS must be initialized after the NWP.");
199+
#endif
200+
SYS_INIT(siwg917_nwp_init, POST_KERNEL, CONFIG_SIWX91X_NWP_INIT_PRIORITY);
197201

198202
/* IRQn 74 is used for communication with co-processor */
199203
Z_ISR_DECLARE(74, 0, IRQ074_Handler, 0);

0 commit comments

Comments
 (0)