2828#include "sl_si91x_power_manager.h"
2929
3030#define AP_MAX_NUM_STA 4
31+ #define SL_SI91X_EXT_FEAT_FRONT_END_MSK (BIT(30) | BIT(29))
3132
3233LOG_MODULE_REGISTER (siwx91x_nwp );
3334
@@ -43,6 +44,10 @@ struct siwx91x_nwp_config {
4344 void (* config_irq )(const struct device * dev );
4445 uint32_t stack_size ;
4546 uint8_t power_profile ;
47+ uint8_t antenna_selection ;
48+ bool support_1p8v ;
49+ bool enable_xtal_correction ;
50+ bool qspi_80mhz_clk ;
4651};
4752
4853typedef struct {
@@ -147,16 +152,50 @@ static void siwx91x_apply_sram_config(sl_si91x_boot_configuration_t *boot_config
147152 }
148153}
149154
155+ static void siwx91x_apply_boot_config (const struct device * dev ,
156+ sl_si91x_boot_configuration_t * boot_config )
157+ {
158+ const struct siwx91x_nwp_config * cfg = dev -> config ;
159+ struct {
160+ bool enabled ;
161+ uint32_t * target ;
162+ uint32_t bit ;
163+ } features [] = {
164+ { cfg -> support_1p8v , & boot_config -> ext_custom_feature_bit_map ,
165+ SL_SI91X_EXT_FEAT_1P8V_SUPPORT },
166+ { !cfg -> enable_xtal_correction , & boot_config -> ext_custom_feature_bit_map ,
167+ SL_SI91X_EXT_FEAT_DISABLE_XTAL_CORRECTION },
168+ { cfg -> qspi_80mhz_clk , & boot_config -> ext_custom_feature_bit_map ,
169+ SL_SI91X_EXT_FEAT_NWP_QSPI_80MHZ_CLK_ENABLE },
170+ };
171+
172+ for (int i = 0 ; i < ARRAY_SIZE (features ); i ++ ) {
173+ if (features [i ].enabled ) {
174+ * features [i ].target |= features [i ].bit ;
175+ }
176+ }
177+
178+ boot_config -> ext_custom_feature_bit_map &= ~SL_SI91X_EXT_FEAT_FRONT_END_MSK ;
179+ boot_config -> ext_custom_feature_bit_map |=
180+ FIELD_PREP (SL_SI91X_EXT_FEAT_FRONT_END_MSK , cfg -> antenna_selection );
181+ }
182+
150183static void siwx91x_configure_sta_mode (sl_si91x_boot_configuration_t * boot_config )
151184{
152185 const bool wifi_enabled = IS_ENABLED (CONFIG_WIFI_SILABS_SIWX91X );
153186 const bool bt_enabled = IS_ENABLED (CONFIG_BT_SILABS_SIWX91X );
154187
155188 boot_config -> oper_mode = SL_SI91X_CLIENT_MODE ;
156189
157- if (IS_ENABLED (CONFIG_WIFI_SILABS_SIWX91X_ROAMING_USE_DEAUTH )) {
158- boot_config -> custom_feature_bit_map |=
159- SL_SI91X_CUSTOM_FEAT_ROAM_WITH_DEAUTH_OR_NULL_DATA ;
190+ if (wifi_enabled ) {
191+ boot_config -> feature_bit_map |= SL_SI91X_FEAT_SECURITY_OPEN ;
192+ if (IS_ENABLED (CONFIG_WIFI_SILABS_SIWX91X_FEAT_SECURITY_PSK )) {
193+ boot_config -> feature_bit_map |= SL_SI91X_FEAT_SECURITY_PSK ;
194+ }
195+ if (IS_ENABLED (CONFIG_WIFI_SILABS_SIWX91X_ROAMING_USE_DEAUTH )) {
196+ boot_config -> custom_feature_bit_map |=
197+ SL_SI91X_CUSTOM_FEAT_ROAM_WITH_DEAUTH_OR_NULL_DATA ;
198+ }
160199 }
161200
162201 if (wifi_enabled && bt_enabled ) {
@@ -174,9 +213,9 @@ static void siwx91x_configure_sta_mode(sl_si91x_boot_configuration_t *boot_confi
174213
175214#ifdef CONFIG_WIFI_SILABS_SIWX91X
176215 boot_config -> ext_tcp_ip_feature_bit_map = SL_SI91X_CONFIG_FEAT_EXTENSION_VALID ;
177- boot_config -> ext_custom_feature_bit_map |=
178- SL_SI91X_EXT_FEAT_IEEE_80211W |
179- SL_SI91X_EXT_FEAT_FRONT_END_SWITCH_PINS_ULP_GPIO_4_5_0 ;
216+ if ( IS_ENABLED ( CONFIG_WIFI_SILABS_SIWX91X_MFP )) {
217+ boot_config -> ext_custom_feature_bit_map |= SL_SI91X_EXT_FEAT_IEEE_80211W ;
218+ }
180219 if (IS_ENABLED (CONFIG_WIFI_SILABS_SIWX91X_ENHANCED_MAX_PSP )) {
181220 boot_config -> config_feature_bit_map = SL_SI91X_ENABLE_ENHANCED_MAX_PSP ;
182221 }
@@ -316,20 +355,11 @@ static int siwx91x_get_nwp_config(const struct device *dev,
316355 .band = SL_SI91X_WIFI_BAND_2_4GHZ ,
317356 .boot_option = LOAD_NWP_FW ,
318357 .boot_config = {
319- .feature_bit_map = SL_SI91X_FEAT_SECURITY_OPEN | SL_SI91X_FEAT_WPS_DISABLE |
320- SL_SI91X_FEAT_SECURITY_PSK | SL_SI91X_FEAT_AGGREGATION |
321- SL_SI91X_FEAT_HIDE_PSK_CREDENTIALS ,
358+ .feature_bit_map = SL_SI91X_FEAT_WPS_DISABLE | SL_SI91X_FEAT_AGGREGATION ,
322359 .tcp_ip_feature_bit_map = SL_SI91X_TCP_IP_FEAT_EXTENSION_VALID ,
323360 .custom_feature_bit_map = SL_SI91X_CUSTOM_FEAT_EXTENSION_VALID |
324- SL_SI91X_CUSTOM_FEAT_ASYNC_CONNECTION_STATUS |
325- SL_SI91X_CUSTOM_FEAT_RTC_FROM_HOST ,
326- .ext_custom_feature_bit_map =
327- SL_SI91X_EXT_FEAT_XTAL_CLK | SL_SI91X_EXT_FEAT_1P8V_SUPPORT |
328- SL_SI91X_EXT_FEAT_DISABLE_XTAL_CORRECTION |
329- SL_SI91X_EXT_FEAT_NWP_QSPI_80MHZ_CLK_ENABLE |
330- SL_SI91X_EXT_FEAT_FRONT_END_SWITCH_PINS_ULP_GPIO_4_5_0 |
331- SL_SI91X_EXT_FEAT_FRONT_END_INTERNAL_SWITCH |
332- SL_SI91X_EXT_FEAT_XTAL_CLK ,
361+ SL_SI91X_CUSTOM_FEAT_ASYNC_CONNECTION_STATUS ,
362+ .ext_custom_feature_bit_map = SL_SI91X_EXT_FEAT_XTAL_CLK ,
333363 }
334364 };
335365
@@ -344,8 +374,12 @@ static int siwx91x_get_nwp_config(const struct device *dev,
344374 return - EINVAL ;
345375 }
346376
377+ if (IS_ENABLED (CONFIG_WIFI_SILABS_SIWX91X_FEAT_HIDE_PSK_CREDENTIALS )) {
378+ boot_config -> feature_bit_map |= SL_SI91X_FEAT_HIDE_PSK_CREDENTIALS ;
379+ }
347380 siwx91x_store_country_code (dev , DEFAULT_COUNTRY_CODE );
348381 siwx91x_apply_sram_config (boot_config );
382+ siwx91x_apply_boot_config (dev , boot_config );
349383
350384 switch (wifi_oper_mode ) {
351385 case WIFI_STA_MODE :
@@ -467,7 +501,11 @@ BUILD_ASSERT(CONFIG_SIWX91X_NWP_INIT_PRIORITY < CONFIG_KERNEL_INIT_PRIORITY_DEFA
467501 static const struct siwx91x_nwp_config siwx91x_nwp_config_##inst = { \
468502 .config_irq = silabs_siwx91x_nwp_irq_configure_##inst, \
469503 .power_profile = DT_ENUM_IDX(DT_DRV_INST(inst), power_profile), \
470- .stack_size = DT_INST_PROP(inst, stack_size) \
504+ .stack_size = DT_INST_PROP(inst, stack_size), \
505+ .support_1p8v = DT_INST_PROP(inst, support_1p8v), \
506+ .enable_xtal_correction = DT_INST_PROP(inst, enable_xtal_correction), \
507+ .qspi_80mhz_clk = DT_INST_PROP(inst, qspi_80mhz_clk), \
508+ .antenna_selection = DT_INST_ENUM_IDX(inst, antenna_selection), \
471509 }; \
472510 \
473511 /* Coprocessor uses value stored in IVT to store its stack. We can't use Z_ISR_DECLARE() */ \
0 commit comments