Skip to content

Commit 2bbafa7

Browse files
jerome-pouillerkartben
authored andcommitted
soc: silabs: siwx91x: Allow alternative memory partition
Chip siwx91x has 672kB of SRAM shared between the Cortex-M4 (Zephyr) and the NWP (Network Processor). 3 memory configurations are possible for the Cortex-M4: - 196kB - 256kB - 320kB Less memory is allocated to Zephyr, more memory is allocated to NWP, better are the WiFi and BLE performances. Signed-off-by: Jérôme Pouiller <[email protected]>
1 parent 8e5c95e commit 2bbafa7

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

dts/arm/silabs/siwg917.dtsi

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
/ {
1313
chosen {
14+
zephyr,sram = &sram0;
1415
zephyr,entropy = &rng0;
1516
zephyr,flash = &flash0;
1617
zephyr,flash-controller = &flashctrl0;
@@ -28,8 +29,17 @@
2829

2930
sram0: memory@0 {
3031
compatible = "mmio-sram";
31-
/* remove sram_dma0 region at the end of the sram */
32-
reg = <0x00000000 DT_SIZE_K(191)>;
32+
/* siwx91x has 672kB of SRAM shared between the Cortex-M4
33+
* (Zephyr) and the NWP (Network Processor). 3 memory
34+
* configurations are
35+
* possible:
36+
* - 196kB
37+
* - 256kB
38+
* - 320kB
39+
* Less memory is allocated to Zephyr, more memory is allocated
40+
* to NWP, better are the WiFi and BLE performances.
41+
*/
42+
reg = <0x00000000 DT_SIZE_K(196)>;
3343
};
3444

3545
sram_dma1: memory-dma@24061c00 {

soc/silabs/silabs_siwx91x/siwg917/nwp.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222

2323
LOG_MODULE_REGISTER(siwx91x_nwp);
2424

25+
BUILD_ASSERT(DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) == KB(196) ||
26+
DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) == KB(256) ||
27+
DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) == KB(320));
28+
2529
int siwg91x_get_nwp_config(int wifi_oper_mode, sl_wifi_device_configuration_t *get_config)
2630
{
2731
sl_wifi_device_configuration_t default_config = {
@@ -32,15 +36,22 @@ int siwg91x_get_nwp_config(int wifi_oper_mode, sl_wifi_device_configuration_t *g
3236
.feature_bit_map = SL_SI91X_FEAT_SECURITY_OPEN | SL_SI91X_FEAT_WPS_DISABLE,
3337
.tcp_ip_feature_bit_map = SL_SI91X_TCP_IP_FEAT_EXTENSION_VALID,
3438
.custom_feature_bit_map = SL_SI91X_CUSTOM_FEAT_EXTENSION_VALID,
35-
.ext_custom_feature_bit_map =
36-
MEMORY_CONFIG |
37-
SL_SI91X_EXT_FEAT_XTAL_CLK,
39+
.ext_custom_feature_bit_map = SL_SI91X_EXT_FEAT_XTAL_CLK,
3840
}
3941
};
42+
sl_si91x_boot_configuration_t *boot_config = &default_config.boot_config;
4043

4144
__ASSERT(get_config, "get_config cannot be NULL");
4245

43-
sl_si91x_boot_configuration_t *boot_config = &default_config.boot_config;
46+
if (DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) == KB(196)) {
47+
boot_config->ext_custom_feature_bit_map |= SL_SI91X_EXT_FEAT_480K_M4SS_192K;
48+
} else if (DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) == KB(256)) {
49+
boot_config->ext_custom_feature_bit_map |= SL_SI91X_EXT_FEAT_416K_M4SS_256K;
50+
} else if (DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) == KB(320)) {
51+
boot_config->ext_custom_feature_bit_map |= SL_SI91X_EXT_FEAT_352K_M4SS_320K;
52+
} else {
53+
k_panic();
54+
}
4455

4556
if (wifi_oper_mode == SL_SI91X_CLIENT_MODE) {
4657
boot_config->oper_mode = SL_SI91X_CLIENT_MODE;

0 commit comments

Comments
 (0)