Skip to content
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
2 changes: 1 addition & 1 deletion drivers/bluetooth/hci/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ config BT_SILABS_SIWX91X
bool "Silabs SiWx91x Bluetooth interface"
default y
depends on DT_HAS_SILABS_SIWX91X_BT_HCI_ENABLED
select WISECONNECT_NETWORK_STACK
select SILABS_SIWX91X_NWP
select ENTROPY_GENERATOR
help
Use Silicon Labs Wiseconnect 3.x Bluetooth library to connect to the controller.
Expand Down
23 changes: 21 additions & 2 deletions drivers/bluetooth/hci/hci_silabs_siwx91x.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ LOG_MODULE_REGISTER(bt_hci_driver_siwg917);

static void siwx91x_bt_resp_rcvd(uint16_t status, rsi_ble_event_rcp_rcvd_info_t *resp_buf);

struct hci_config {
const struct device *nwp_dev;
};

struct hci_data {
bt_hci_recv_t recv;
rsi_data_packet_t rsi_data_packet;
Expand Down Expand Up @@ -95,15 +99,30 @@ static void siwx91x_bt_resp_rcvd(uint16_t status, rsi_ble_event_rcp_rcvd_info_t
}
}

static int siwx91x_bt_init(const struct device *dev)
{
const struct hci_config *hci_config = dev->config;

if (!device_is_ready(hci_config->nwp_dev)) {
LOG_ERR("NWP device not ready");
return -ENODEV;
}

return 0;
}

static DEVICE_API(bt_hci, siwx91x_api) = {
.open = siwx91x_bt_open,
.send = siwx91x_bt_send,
};

#define HCI_DEVICE_INIT(inst) \
static struct hci_config hci_config_##inst = { \
.nwp_dev = DEVICE_DT_GET(DT_INST_PARENT(inst)) \
}; \
static struct hci_data hci_data_##inst; \
DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &hci_data_##inst, NULL, POST_KERNEL, \
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &siwx91x_api)
DEVICE_DT_INST_DEFINE(inst, siwx91x_bt_init, NULL, &hci_data_##inst, &hci_config_##inst, \
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &siwx91x_api)

/* Only one instance supported right now */
HCI_DEVICE_INIT(0)
2 changes: 1 addition & 1 deletion drivers/flash/Kconfig.siwx91x
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ config SOC_FLASH_SILABS_SIWX91X
select FLASH_HAS_EXPLICIT_ERASE
select FLASH_HAS_PAGE_LAYOUT
# Flash controller is handled by the network coprocessor
select WISECONNECT_NETWORK_STACK
select SILABS_SIWX91X_NWP
help
Enable flash controller for flash embedded on Silicon Labs SiWx91x
chips.
2 changes: 1 addition & 1 deletion drivers/wifi/siwx91x/Kconfig.siwx91x
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ config WIFI_SILABS_SIWX91X
default y
depends on DT_HAS_SILABS_SIWX91X_WIFI_ENABLED
depends on NETWORKING
select WISECONNECT_NETWORK_STACK
select SILABS_SIWX91X_NWP
select EVENTS
select NET_L2_WIFI_MGMT
help
Expand Down
19 changes: 14 additions & 5 deletions drivers/wifi/siwx91x/siwx91x_wifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <zephyr/version.h>

#include <nwp.h>
#include <siwx91x_nwp.h>
#include "siwx91x_wifi.h"
#include "siwx91x_wifi_ap.h"
#include "siwx91x_wifi_ps.h"
Expand Down Expand Up @@ -207,7 +207,7 @@ static int siwx91x_mode(const struct device *dev, struct wifi_mode_info *mode)
mode->mode = cur_mode;
} else if (mode->oper == WIFI_MGMT_SET) {
if (cur_mode != mode->mode) {
ret = siwx91x_nwp_mode_switch(mode->mode, false, 0);
ret = siwx91x_nwp_mode_switch(siwx91x_cfg->nwp_dev, mode->mode, false, 0);
if (ret < 0) {
return ret;
}
Expand Down Expand Up @@ -394,6 +394,7 @@ static int map_sdk_region_to_zephyr_channel_info(const sli_si91x_set_region_ap_r

static int siwx91x_wifi_reg_domain(const struct device *dev, struct wifi_reg_domain *reg_domain)
{
const struct siwx91x_config *siwx91x_cfg = dev->config;
const sli_si91x_set_region_ap_request_t *sdk_reg = NULL;
sl_wifi_operation_mode_t oper_mode = sli_get_opermode();
sl_wifi_region_code_t region_code;
Expand All @@ -411,13 +412,13 @@ static int siwx91x_wifi_reg_domain(const struct device *dev, struct wifi_reg_dom
}

if (region_code == SL_WIFI_DEFAULT_REGION) {
siwx91x_store_country_code(DEFAULT_COUNTRY_CODE);
siwx91x_store_country_code(siwx91x_cfg->nwp_dev, DEFAULT_COUNTRY_CODE);
LOG_INF("Country code not supported, using default region");
} else {
siwx91x_store_country_code(reg_domain->country_code);
siwx91x_store_country_code(siwx91x_cfg->nwp_dev, reg_domain->country_code);
}
} else if (reg_domain->oper == WIFI_MGMT_GET) {
country_code = siwx91x_get_country_code();
country_code = siwx91x_get_country_code(siwx91x_cfg->nwp_dev);
memcpy(reg_domain->country_code, country_code, WIFI_COUNTRY_CODE_LEN);
region_code = siwx91x_map_country_code_to_region(country_code);

Expand Down Expand Up @@ -532,6 +533,13 @@ int siwx91x_set_rts_threshold(const struct device *dev, unsigned int rts_thresho

static int siwx91x_dev_init(const struct device *dev)
{
const struct siwx91x_config *siwx91x_cfg = dev->config;

if (!device_is_ready(siwx91x_cfg->nwp_dev)) {
LOG_ERR("NWP device not ready");
return -ENODEV;
}

return 0;
}

Expand Down Expand Up @@ -568,6 +576,7 @@ static const struct net_wifi_mgmt_offload siwx91x_api = {
};

static const struct siwx91x_config siwx91x_cfg = {
.nwp_dev = DEVICE_DT_GET(DT_INST_PARENT(0)),
.scan_tx_power = DT_INST_PROP(0, wifi_max_tx_pwr_scan),
.join_tx_power = DT_INST_PROP(0, wifi_max_tx_pwr_join),
};
Expand Down
1 change: 1 addition & 0 deletions drivers/wifi/siwx91x/siwx91x_wifi.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "sl_si91x_types.h"

struct siwx91x_config {
const struct device *nwp_dev;
uint8_t scan_tx_power;
uint8_t join_tx_power;
};
Expand Down
6 changes: 4 additions & 2 deletions drivers/wifi/siwx91x/siwx91x_wifi_ap.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2024-2025 Silicon Laboratories Inc.
* SPDX-License-Identifier: Apache-2.0
*/
#include <nwp.h>
#include <siwx91x_nwp.h>
#include "siwx91x_wifi.h"

#include "sl_rsi_utility.h"
Expand All @@ -13,11 +13,13 @@ LOG_MODULE_DECLARE(siwx91x_wifi);

static int siwx91x_nwp_reboot_if_required(const struct device *dev, uint8_t oper_mode)
{
const struct siwx91x_config *siwx91x_cfg = dev->config;
struct siwx91x_dev *sidev = dev->data;
int ret;

if (sidev->reboot_needed) {
ret = siwx91x_nwp_mode_switch(oper_mode, sidev->hidden_ssid, sidev->max_num_sta);
ret = siwx91x_nwp_mode_switch(siwx91x_cfg->nwp_dev, oper_mode, sidev->hidden_ssid,
sidev->max_num_sta);
if (ret < 0) {
LOG_ERR("Failed to reboot the device: %d", ret);
return ret;
Expand Down
2 changes: 1 addition & 1 deletion drivers/wifi/siwx91x/siwx91x_wifi_ps.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/sys/util.h>
#include <nwp.h>
#include <siwx91x_nwp.h>
#include "siwx91x_wifi.h"
#include "siwx91x_wifi_ps.h"

Expand Down
2 changes: 1 addition & 1 deletion drivers/wifi/siwx91x/siwx91x_wifi_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
#include <zephyr/logging/log.h>

#include <nwp.h>
#include <siwx91x_nwp.h>
#include "siwx91x_wifi.h"
#include "siwx91x_wifi_scan.h"

Expand Down
2 changes: 1 addition & 1 deletion drivers/wifi/siwx91x/siwx91x_wifi_sta.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
#include <zephyr/logging/log.h>

#include <nwp.h>
#include <siwx91x_nwp.h>
#include "siwx91x_wifi.h"
#include "siwx91x_wifi_socket.h"
#include "siwx91x_wifi_ps.h"
Expand Down
5 changes: 5 additions & 0 deletions dts/arm/silabs/siwg917.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@
nwp: nwp {
compatible = "silabs,siwx91x-nwp";
power-profile = "high-performance";
stack-size = <10240>;
interrupt-parent = <&nvic>;
interrupts = <30 0>, <74 0>;
interrupt-names = "nwp_stack", "nwp_irq";
status = "okay";

bt_hci0: bt_hci {
compatible = "silabs,siwx91x-bt-hci";
Expand Down
12 changes: 11 additions & 1 deletion dts/bindings/net/wireless/silabs,siwx91x-nwp.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2025 Silicon Laboratories Inc.
# SPDX-License-Identifier: Apache-2.0

title: Silicon Labs SiWx91x NWP (Network Wireless Processor)
title: Silicon Labs SiWx91x NWP (Network Wireless Coprocessor)

description: |
The Network Wireless Processor (NWP) manages Wi-Fi and Bluetooth connectivity on SiWx91x devices,
Expand All @@ -10,7 +10,17 @@ description: |

compatible: "silabs,siwx91x-nwp"

include: base.yaml

properties:
interrupts:
required: true

stack-size:
type: int
description: Stack size for the NWP in bytes
required: true

power-profile:
type: string
description: Power/performance profile
Expand Down
4 changes: 2 additions & 2 deletions modules/hal_silabs/wiseconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ if(CONFIG_BT_SILABS_SIWX91X)
)
endif() # CONFIG_BT_SILABS_SIWX91X

if(CONFIG_WISECONNECT_NETWORK_STACK)
if(CONFIG_SILABS_SIWX91X_NWP)
zephyr_compile_definitions(
SLI_SI91X_ENABLE_OS
SL_SI91X_SI917_RAM_MEM_CONFIG=2
Expand Down Expand Up @@ -198,7 +198,7 @@ if(CONFIG_WISECONNECT_NETWORK_STACK)
${WISECONNECT_DIR}/components/device/silabs/si91x/wireless/firmware_upgrade/firmware_upgradation.c
)
zephyr_include_directories(.)
endif() # CONFIG_WISECONNECT_NETWORK_STACK
endif() # CONFIG_SILABS_SIWX91X_NWP

if(CONFIG_SOC_SILABS_SLEEPTIMER)
zephyr_include_directories(
Expand Down
17 changes: 15 additions & 2 deletions soc/silabs/silabs_siwx91x/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,22 @@ config SOC_SILABS_SLEEPTIMER
help
The Sleeptimer HAL module is used for SIWX91X.

config SILABS_SIWX91X_NWP
bool "Silabs Network Coprocessor"
depends on DT_HAS_SILABS_SIWX91X_NWP_ENABLED
select CMSIS_RTOS_V2
select POLL
select DYNAMIC_THREAD
select THREAD_NAME
select THREAD_STACK_INFO
select THREAD_MONITOR
select INIT_STACKS
help
Add support for Network Coprocessor (also named NWP) presents on SiWx91x parts.

config SOC_SIWX91X_PM_BACKEND_PMGR
bool
select WISECONNECT_NETWORK_STACK
select SILABS_SIWX91X_NWP
select SILABS_SLEEPTIMER_TIMER
select SRAM_VECTOR_TABLE
select CODE_DATA_RELOCATION_SRAM
Expand Down Expand Up @@ -64,7 +77,7 @@ config SIWX91X_ENCRYPT

config SIWX91X_FIRMWARE_UPGRADE
bool "Support for firmware upgrade"
select WISECONNECT_NETWORK_STACK
select SILABS_SIWX91X_NWP
help
The firmware upgrade process for SiWx91x devices involves coordinated
communication with both the Network Co-Processor (NCP) and the ROM
Expand Down
14 changes: 2 additions & 12 deletions soc/silabs/silabs_siwx91x/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,7 @@ configdefault SYS_CLOCK_TICKS_PER_SEC
configdefault UART_NS16550_DW8250_DW_APB
default y

config WISECONNECT_NETWORK_STACK
bool
select CMSIS_RTOS_V2
select POLL
select DYNAMIC_THREAD
select THREAD_NAME
select THREAD_STACK_INFO
select THREAD_MONITOR
select INIT_STACKS

if WISECONNECT_NETWORK_STACK
if SILABS_SIWX91X_NWP

# WiseConnect create threads with realtime priority. Default (10kHz) clock tick
# prevent proper use of the system with these threads.
Expand All @@ -42,7 +32,7 @@ config CMSIS_V2_THREAD_DYNAMIC_STACK_SIZE
config CMSIS_V2_THREAD_MAX_STACK_SIZE
default 2048

endif # WISECONNECT_NETWORK_STACK
endif

rsource "*/Kconfig.defconfig"

Expand Down
2 changes: 1 addition & 1 deletion soc/silabs/silabs_siwx91x/siwg917/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

zephyr_sources_ifdef(CONFIG_SOC_SERIES_SIWG917 soc.c)
zephyr_sources_ifdef(CONFIG_WISECONNECT_NETWORK_STACK nwp.c)
zephyr_sources_ifdef(CONFIG_SILABS_SIWX91X_NWP siwx91x_nwp.c)
zephyr_sources_ifdef(CONFIG_SOC_SIWX91X_PM_BACKEND_PMGR soc_siwx91x_power_pmgr.c)

set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld CACHE INTERNAL "")
Loading