From 12a71c3dfedee04bcad7901324da198ffb0db7a1 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 5 Aug 2024 20:40:25 +0530 Subject: [PATCH 01/25] drivers: Remove nRF70 Wi-Fi driver This is now part of the Zephyr upstream. Signed-off-by: Chaitanya Tata --- CODEOWNERS | 1 - drivers/CMakeLists.txt | 1 - drivers/Kconfig | 1 - drivers/wifi/CMakeLists.txt | 6 - drivers/wifi/Kconfig | 11 - drivers/wifi/nrf700x/CMakeLists.txt | 239 -- drivers/wifi/nrf700x/Kconfig | 751 ----- drivers/wifi/nrf700x/inc/coex.h | 84 - drivers/wifi/nrf700x/inc/coex_struct.h | 182 -- drivers/wifi/nrf700x/inc/fmac_main.h | 133 - drivers/wifi/nrf700x/inc/net_if.h | 66 - drivers/wifi/nrf700x/inc/wifi_mgmt.h | 75 - drivers/wifi/nrf700x/inc/wifi_mgmt_scan.h | 34 - drivers/wifi/nrf700x/inc/wpa_supp_if.h | 142 - drivers/wifi/nrf700x/rpu_fw_patches.ld | 51 - drivers/wifi/nrf700x/src/coex.c | 333 -- drivers/wifi/nrf700x/src/fmac_main.c | 952 ------ drivers/wifi/nrf700x/src/fw_load.c | 306 -- drivers/wifi/nrf700x/src/net_if.c | 1239 -------- drivers/wifi/nrf700x/src/qspi/inc/ficr_prog.h | 23 - drivers/wifi/nrf700x/src/qspi/inc/qspi_if.h | 116 - drivers/wifi/nrf700x/src/qspi/inc/rpu_hw_if.h | 61 - drivers/wifi/nrf700x/src/qspi/inc/spi_if.h | 36 - drivers/wifi/nrf700x/src/qspi/inc/spi_nor.h | 49 - drivers/wifi/nrf700x/src/qspi/src/device.c | 86 - drivers/wifi/nrf700x/src/qspi/src/ficr_prog.c | 379 --- drivers/wifi/nrf700x/src/qspi/src/qspi_if.c | 1342 -------- drivers/wifi/nrf700x/src/qspi/src/rpu_hw_if.c | 482 --- drivers/wifi/nrf700x/src/qspi/src/spi_if.c | 343 -- drivers/wifi/nrf700x/src/shim.c | 973 ------ drivers/wifi/nrf700x/src/shim.h | 68 - drivers/wifi/nrf700x/src/timer.c | 43 - drivers/wifi/nrf700x/src/timer.h | 26 - drivers/wifi/nrf700x/src/wifi_mgmt.c | 1015 ------ drivers/wifi/nrf700x/src/wifi_mgmt_scan.c | 440 --- drivers/wifi/nrf700x/src/wifi_util.c | 1005 ------ drivers/wifi/nrf700x/src/wifi_util.h | 24 - drivers/wifi/nrf700x/src/work.c | 158 - drivers/wifi/nrf700x/src/work.h | 44 - drivers/wifi/nrf700x/src/wpa_supp_if.c | 2761 ----------------- 40 files changed, 14081 deletions(-) delete mode 100644 drivers/wifi/CMakeLists.txt delete mode 100644 drivers/wifi/Kconfig delete mode 100644 drivers/wifi/nrf700x/CMakeLists.txt delete mode 100644 drivers/wifi/nrf700x/Kconfig delete mode 100644 drivers/wifi/nrf700x/inc/coex.h delete mode 100644 drivers/wifi/nrf700x/inc/coex_struct.h delete mode 100644 drivers/wifi/nrf700x/inc/fmac_main.h delete mode 100644 drivers/wifi/nrf700x/inc/net_if.h delete mode 100644 drivers/wifi/nrf700x/inc/wifi_mgmt.h delete mode 100644 drivers/wifi/nrf700x/inc/wifi_mgmt_scan.h delete mode 100644 drivers/wifi/nrf700x/inc/wpa_supp_if.h delete mode 100644 drivers/wifi/nrf700x/rpu_fw_patches.ld delete mode 100644 drivers/wifi/nrf700x/src/coex.c delete mode 100644 drivers/wifi/nrf700x/src/fmac_main.c delete mode 100644 drivers/wifi/nrf700x/src/fw_load.c delete mode 100644 drivers/wifi/nrf700x/src/net_if.c delete mode 100644 drivers/wifi/nrf700x/src/qspi/inc/ficr_prog.h delete mode 100644 drivers/wifi/nrf700x/src/qspi/inc/qspi_if.h delete mode 100644 drivers/wifi/nrf700x/src/qspi/inc/rpu_hw_if.h delete mode 100644 drivers/wifi/nrf700x/src/qspi/inc/spi_if.h delete mode 100644 drivers/wifi/nrf700x/src/qspi/inc/spi_nor.h delete mode 100644 drivers/wifi/nrf700x/src/qspi/src/device.c delete mode 100644 drivers/wifi/nrf700x/src/qspi/src/ficr_prog.c delete mode 100644 drivers/wifi/nrf700x/src/qspi/src/qspi_if.c delete mode 100644 drivers/wifi/nrf700x/src/qspi/src/rpu_hw_if.c delete mode 100644 drivers/wifi/nrf700x/src/qspi/src/spi_if.c delete mode 100644 drivers/wifi/nrf700x/src/shim.c delete mode 100644 drivers/wifi/nrf700x/src/shim.h delete mode 100644 drivers/wifi/nrf700x/src/timer.c delete mode 100644 drivers/wifi/nrf700x/src/timer.h delete mode 100644 drivers/wifi/nrf700x/src/wifi_mgmt.c delete mode 100644 drivers/wifi/nrf700x/src/wifi_mgmt_scan.c delete mode 100644 drivers/wifi/nrf700x/src/wifi_util.c delete mode 100644 drivers/wifi/nrf700x/src/wifi_util.h delete mode 100644 drivers/wifi/nrf700x/src/work.c delete mode 100644 drivers/wifi/nrf700x/src/work.h delete mode 100644 drivers/wifi/nrf700x/src/wpa_supp_if.c diff --git a/CODEOWNERS b/CODEOWNERS index 58954b0dbcb2..3c31d4130305 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -90,7 +90,6 @@ Kconfig* @tejlmand /drivers/sensor/bme68x_iaq/ @nrfconnect/ncs-cia /drivers/sensor/paw3212/ @anangl @pdunaj @MarekPieta /drivers/sensor/pmw3360/ @anangl @pdunaj @MarekPieta -/drivers/wifi/nrf700x/ @krish2718 @sachinthegreen @rado17 @rlubos /dts/ @anangl /ext/ @carlescufi /include/ @anangl @rlubos diff --git a/drivers/CMakeLists.txt b/drivers/CMakeLists.txt index a6f71a22de50..3a178f3e1a93 100644 --- a/drivers/CMakeLists.txt +++ b/drivers/CMakeLists.txt @@ -14,4 +14,3 @@ endif() add_subdirectory_ifdef(CONFIG_NETWORKING net) add_subdirectory_ifdef(CONFIG_SENSOR sensor) add_subdirectory(serial) -add_subdirectory_ifdef(CONFIG_WIFI wifi) diff --git a/drivers/Kconfig b/drivers/Kconfig index 5de1bff4fe93..112c3c48d0af 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -19,6 +19,5 @@ endif rsource "net/Kconfig" rsource "sensor/Kconfig" rsource "serial/Kconfig" -rsource "wifi/Kconfig" endmenu diff --git a/drivers/wifi/CMakeLists.txt b/drivers/wifi/CMakeLists.txt deleted file mode 100644 index a1589e33f07f..000000000000 --- a/drivers/wifi/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -# Copyright (c) 2018-2020 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# -add_subdirectory_ifdef(CONFIG_WIFI_NRF700X nrf700x) diff --git a/drivers/wifi/Kconfig b/drivers/wifi/Kconfig deleted file mode 100644 index 95ab147c235a..000000000000 --- a/drivers/wifi/Kconfig +++ /dev/null @@ -1,11 +0,0 @@ -# -# Copyright (c) 2022 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -if WIFI - -rsource "nrf700x/Kconfig" - -endif # WIFI diff --git a/drivers/wifi/nrf700x/CMakeLists.txt b/drivers/wifi/nrf700x/CMakeLists.txt deleted file mode 100644 index a972da139ca6..000000000000 --- a/drivers/wifi/nrf700x/CMakeLists.txt +++ /dev/null @@ -1,239 +0,0 @@ -# -# Copyright (c) 2022 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -zephyr_library() - -set(OS_AGNOSTIC_BASE ${ZEPHYR_NRFXLIB_MODULE_DIR}/nrf_wifi) - -zephyr_include_directories( - inc - ${OS_AGNOSTIC_BASE}/utils/inc - ${OS_AGNOSTIC_BASE}/os_if/inc - ${OS_AGNOSTIC_BASE}/bus_if/bus/qspi/inc - ${OS_AGNOSTIC_BASE}/bus_if/bal/inc - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/inc - ${OS_AGNOSTIC_BASE}/fw_load/mips/fw/inc - ${OS_AGNOSTIC_BASE}/hw_if/hal/inc - src/qspi/inc - # for net_sprint_ll_addr - ${ZEPHYR_BASE}/subsys/net/ip - ${OS_AGNOSTIC_BASE}/hw_if/hal/inc/fw - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/inc/fw -) - -zephyr_include_directories_ifdef(CONFIG_NRF700X_RADIO_TEST - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/inc/radio_test -) - -zephyr_include_directories_ifndef(CONFIG_NRF700X_RADIO_TEST - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/inc/default -) - -zephyr_library_sources_ifdef(CONFIG_NRF700X_SR_COEX - src/coex.c -) - -zephyr_library_sources( - ${OS_AGNOSTIC_BASE}/os_if/src/osal.c - ${OS_AGNOSTIC_BASE}/utils/src/list.c - ${OS_AGNOSTIC_BASE}/utils/src/queue.c - ${OS_AGNOSTIC_BASE}/utils/src/util.c - ${OS_AGNOSTIC_BASE}/hw_if/hal/src/hal_api.c - ${OS_AGNOSTIC_BASE}/hw_if/hal/src/hal_fw_patch_loader.c - ${OS_AGNOSTIC_BASE}/hw_if/hal/src/hal_interrupt.c - ${OS_AGNOSTIC_BASE}/hw_if/hal/src/hal_mem.c - ${OS_AGNOSTIC_BASE}/hw_if/hal/src/hal_reg.c - ${OS_AGNOSTIC_BASE}/hw_if/hal/src/hpqm.c - ${OS_AGNOSTIC_BASE}/hw_if/hal/src/pal.c - ${OS_AGNOSTIC_BASE}/bus_if/bal/src/bal.c - ${OS_AGNOSTIC_BASE}/bus_if/bus/qspi/src/qspi.c - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/cmd.c - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/event.c - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/fmac_api_common.c - src/shim.c - src/work.c - src/timer.c - src/fmac_main.c - src/fw_load.c - src/qspi/src/device.c - src/qspi/src/rpu_hw_if.c - src/qspi/src/ficr_prog.c -) - -zephyr_library_sources_ifndef(CONFIG_NRF700X_RADIO_TEST - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/rx.c - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/fmac_vif.c - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/fmac_util.c - src/net_if.c - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/default/fmac_api.c -) - -zephyr_library_sources_ifdef(CONFIG_NET_L2_WIFI_MGMT - src/wifi_mgmt_scan.c -) - -zephyr_library_sources_ifdef(CONFIG_NRF700X_SYSTEM_MODE - src/wifi_mgmt.c -) - -zephyr_library_sources_ifdef(CONFIG_NRF700X_SCAN_ONLY - src/wifi_mgmt_scan.c -) - -zephyr_library_sources_ifdef(CONFIG_NRF700X_RADIO_TEST - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/radio_test/fmac_api.c - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/fmac_util.c -) - -zephyr_library_sources_ifdef(CONFIG_NRF700X_DATA_TX - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/tx.c - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/fmac_peer.c -) - -zephyr_library_sources_ifdef(CONFIG_NRF700X_STA_MODE - src/wpa_supp_if.c - src/wifi_mgmt.c - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/fmac_peer.c - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/fmac_util.c -) - -zephyr_library_sources_ifdef(CONFIG_NRF700X_AP_MODE - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/fmac_ap.c -) - - -# Without WPA supplicant we only support scan -zephyr_library_sources_ifdef(CONFIG_NRF700X_STA_MODE - src/wpa_supp_if.c - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/fmac_peer.c - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/fmac_util.c -) - -zephyr_library_sources_ifdef(CONFIG_NRF700X_ON_QSPI - src/qspi/src/qspi_if.c -) - -zephyr_library_sources_ifdef(CONFIG_NRF700X_ON_SPI - src/qspi/src/spi_if.c -) - -zephyr_library_sources_ifdef(CONFIG_NRF700X_UTIL - src/wifi_util.c -) - -if(CONFIG_NRF_WIFI_PATCHES_EXT_FLASH_XIP) -# Run patches from the external flash (XIP). No need to copy. -zephyr_code_relocate(FILES src/fw_load.c LOCATION EXTFLASH_RODATA NOCOPY) -endif() - -zephyr_compile_definitions_ifdef(CONFIG_NRF700X_ON_QSPI -# These are XIP related anomalies and aren't applicable for nRF7002 and cause -# throughput issues. - -DNRF53_ERRATA_43_ENABLE_WORKAROUND=0 - -DNRF52_ERRATA_215_ENABLE_WORKAROUND=0 -# nRF70 QSPI doesn't use 192MHz clock and most samples use 128MHz, this can cause anomaly 159 -# but as its rare and not seen in most cases, we can disable it. -# Alternative is 128MHz CPU should be disabled that impacts Wi-Fi performance. - -DNRF53_ERRATA_159_ENABLE_WORKAROUND=0 -) - -# RPU FW patch binaries based on the selected configuration -if(CONFIG_NRF700X_SYSTEM_MODE) - set(NRF70_PATCH ${OS_AGNOSTIC_BASE}/fw_bins/default/nrf70.bin) -elseif(CONFIG_NRF700X_RADIO_TEST) - set(NRF70_PATCH ${OS_AGNOSTIC_BASE}/fw_bins/radio_test/nrf70.bin) -elseif(CONFIG_NRF700X_SCAN_ONLY) - set(NRF70_PATCH ${OS_AGNOSTIC_BASE}/fw_bins/scan_only/nrf70.bin) -elseif (CONFIG_NRF700X_SYSTEM_WITH_RAW_MODES) - set(NRF70_PATCH ${OS_AGNOSTIC_BASE}/fw_bins/system_with_raw/nrf70.bin) -else() - # Error - message(FATAL_ERROR "Unsupported nRF70 patch configuration") -endif() - -zephyr_compile_definitions( - -DCONFIG_NRF_WIFI_FW_BIN=${NRF70_PATCH} -) - -if(CONFIG_NRF_WIFI_PATCHES_EXT_FLASH_STORE) - message(STATUS "nRF WiFi FW patch binary will be stored in external flash") - - dt_chosen(ext_flash_dev PROPERTY nordic,pm-ext-flash) - if(DEFINED ext_flash_dev) - get_filename_component(qspi_node ${ext_flash_dev} DIRECTORY) - else() - dt_nodelabel(qspi_node NODELABEL "qspi") - endif() - if(DEFINED qspi_node) - dt_reg_addr(xip_addr PATH ${qspi_node} NAME qspi_mm) - if(NOT DEFINED xip_addr) - message(FATAL_ERROR "Unable to find XIP area in dts") - endif() - else() - message(FATAL_ERROR "QSPI node not found in dts") - endif() - - if(CONFIG_PARTITION_MANAGER_ENABLED) - if(NOT SYSBUILD) - add_custom_target(nrf70_wifi_fw_patch_target - DEPENDS ${CMAKE_BINARY_DIR}/zephyr/nrf70.hex - ) - add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/zephyr/nrf70.hex - COMMAND ${Python3_EXECUTABLE} - -c "import sys; import intelhex; intelhex.bin2hex(sys.argv[1], sys.argv[2], int(sys.argv[3])) " - ${NRF70_PATCH} - ${CMAKE_BINARY_DIR}/zephyr/nrf70.hex - $ - VERBATIM - ) - # Delegate merging WiFi FW patch to mcuboot because we need to merge signed hex instead of raw nrf70.hex. - if(NOT CONFIG_NRF_WIFI_FW_PATCH_DFU) - set_property( - GLOBAL PROPERTY - nrf70_wifi_fw_PM_HEX_FILE - ${CMAKE_BINARY_DIR}/zephyr/nrf70.hex - ) - set_property( - GLOBAL PROPERTY - nrf70_wifi_fw_PM_TARGET - nrf70_wifi_fw_patch_target - ) - endif() - endif() - else() - dt_nodelabel(nrf70_fw_node NODELABEL "nrf70_fw_partition") - if(NOT DEFINED nrf70_fw_node) - message(FATAL_ERROR "nrf70_fw_partition node not found in dts") - endif() - dt_prop(nrf70_fw_offset PATH ${nrf70_fw_node} PROPERTY reg INDEX 0) - if(NOT DEFINED nrf70_fw_offset) - message(FATAL_ERROR "nrf70_fw_partition.reg not found in dts") - endif() - math(EXPR NRF70_PATCH_ADDR "${xip_addr} + ${nrf70_fw_offset}") - - # Using python module instead of intelhex command line tool to handle windows - execute_process( - COMMAND ${Python3_EXECUTABLE} - -c "import sys; import intelhex; intelhex.bin2hex(sys.argv[1], sys.argv[2], int(sys.argv[3]))" - ${NRF70_PATCH} - ${CMAKE_BINARY_DIR}/zephyr/nrf70.hex - ${NRF70_PATCH_ADDR} - RESULT_VARIABLE _bin2hex_result - OUTPUT_VARIABLE _bin2hex_output - ERROR_VARIABLE _bin2hex_error - COMMAND_ECHO STDOUT - ) - - if(NOT _bin2hex_result EQUAL 0) - message(FATAL_ERROR "Failed to convert binary patch to hex format: \n${_bin2hex_output}\n${_bin2hex_error}") - endif() - - set_property(GLOBAL APPEND PROPERTY HEX_FILES_TO_MERGE - ${CMAKE_BINARY_DIR}/zephyr/nrf70.hex ${CMAKE_BINARY_DIR}/zephyr/zephyr.hex) - set_property(TARGET runners_yaml_props_target PROPERTY - hex_file ${CMAKE_BINARY_DIR}/zephyr/merged.hex) - endif() -endif() diff --git a/drivers/wifi/nrf700x/Kconfig b/drivers/wifi/nrf700x/Kconfig deleted file mode 100644 index d446e1b20c99..000000000000 --- a/drivers/wifi/nrf700x/Kconfig +++ /dev/null @@ -1,751 +0,0 @@ -# Nordic Wi-Fi driver for nRF700x -# -# Copyright (c) 2022 Nordic Semiconductor -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -DT_COMPAT_NORDIC_NRF700X_QSPI := nordic,nrf700x-qspi -DT_COMPAT_NORDIC_NRF700X_SPI := nordic,nrf700x-spi - -menuconfig WIFI_NRF700X - bool "nRF700x driver" - depends on WIFI - select NET_L2_WIFI_MGMT if NETWORKING - select NET_L2_ETHERNET_MGMT if NETWORKING && NET_L2_ETHERNET - select WIFI_USE_NATIVE_NETWORKING if NETWORKING - select EXPERIMENTAL if !SOC_SERIES_NRF53X && !SOC_SERIES_NRF91X - help - Nordic Wi-Fi Driver - -if WIFI_NRF700X -module = WIFI_NRF700X_BUS -module-dep = LOG -module-str = Log level for Wi-Fi nRF700x bus layers -module-help = Sets log level for Wi-Fi nRF700x bus layers -source "subsys/net/Kconfig.template.log_config.net" - -config WIFI_NRF700X_BUS_LOG_LEVEL - # Enable error by default - default 1 - -choice NRF700X_OPER_MODES - bool "nRF700x operating modes" - default NRF700X_SYSTEM_MODE if WPA_SUPP && !(NRF700X_RAW_DATA_TX || NRF700X_RAW_DATA_RX || NRF700X_PROMISC_DATA_RX) - default NRF700X_SYSTEM_WITH_RAW_MODES if (NRF700X_RAW_DATA_TX || NRF700X_RAW_DATA_RX || NRF700X_PROMISC_DATA_RX) - default NRF700X_SCAN_ONLY - help - Select the operating mode of the nRF700x driver - -config NRF700X_SYSTEM_MODE - bool "Enable nRF700X system mode" - depends on WPA_SUPP - help - Select this option to enable system mode of the nRF700x driver - -config NRF700X_SCAN_ONLY - bool "Enable nRF700X scan only mode" - help - Select this option to enable scan only mode of the nRF700x driver - -config NRF700X_RADIO_TEST - bool "Radio test mode of the nRF700x driver" - -config NRF700X_SYSTEM_WITH_RAW_MODES - bool "Enable nRF700X system mode with raw modes" - # TODO: This dependency need to be removed for Monitor and TX injection only - depends on WPA_SUPP - help - Select this option to enable system mode of the nRF700x driver with raw modes - -endchoice - -if NRF700X_SYSTEM_MODE || NRF700X_SYSTEM_WITH_RAW_MODES -config NRF700X_STA_MODE - bool "Enable nRF700X STA mode" - default y - help - Select this option to enable STA mode of the nRF700x driver - -config NRF700X_AP_MODE - bool "Enable Access point mode" - depends on WPA_SUPP_AP - -config NRF700X_P2P_MODE - bool "Enable P2P support in driver" -endif # NRF700X_SYSTEM_MODE || NRF700X_SYSTEM_WITH_RAW_MODES - -config NRF700X_RAW_DATA_TX - bool "Enable RAW TX data path in the driver" - -config NRF700X_RAW_DATA_RX - bool "Enable RAW RX sniffer operation in the driver" - -config NRF700X_PROMISC_DATA_RX - bool "Enable promiscuous RX sniffer operation in the driver" - depends on WPA_SUPP - select EXPERIMENTAL - select NET_PROMISCUOUS_MODE - -config NRF700X_DATA_TX - bool "Enable TX data path in the driver" - default y if NRF700X_SYSTEM_MODE || NRF700X_SYSTEM_WITH_RAW_MODES - -config NRF_WIFI_IF_AUTO_START - bool "Enable Wi-Fi interface auto start on boot" - default y - -config NRF_WIFI_PATCHES_BUILTIN - bool "Store nRF700x FW patches as part of the driver" - depends on !NRF_WIFI_PATCHES_EXT_FLASH_STORE - default y if !NRF_WIFI_PATCHES_EXT_FLASH_STORE - help - Select this option to store nRF700x FW patches as part of the driver. - This option impacts the code memory footprint of the driver. - -choice NRF_WIFI_PATCHES_EXT_FLASH_SUPPORT - bool "Store nRF700x FW patches in external flash" - default NRF_WIFI_PATCHES_EXT_FLASH_DISABLED - help - Select this option to store nRF700x FW patches in external flash. - This option helps to reduce the code memory size of the application, but - requires external memory to be available for storing the FW patches. - -config NRF_WIFI_PATCHES_EXT_FLASH_DISABLED - bool "Store nRF700x FW patches in RAM" - select NRF_WIFI_PATCHES_BUILTIN - -config NRF_WIFI_PATCHES_EXT_FLASH_XIP - bool "Relocate nRF700x FW patches to external memory and execute from there" - # nRF7002 supports SPI based external flash access with no XIP - depends on !BOARD_NRF7002DK_NRF5340_CPUAPP && !BOARD_NRF7002DK_NRF5340_CPUAPP_NS - # Disable until Matter DFU changes are ready - # default y if BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF52840DK_NRF52840 - select NRF_WIFI_PATCHES_BUILTIN - # For accessing external flash - select FLASH - # For relocation code to external flash - select XIP - select NORDIC_QSPI_NOR - select BUILD_NO_GAP_FILL - select CODE_DATA_RELOCATION - select HAVE_CUSTOM_LINKER_SCRIPT - -config NRF_WIFI_PATCHES_EXT_FLASH_STORE - bool "Store nRF700x FW patches in external memory but execute from RAM" - # nRF7002 supports SPI based external memory access but missing tools support - # TODO: Enable when tools support is available (NRFJPROG-157) - depends on !BOARD_NRF7002DK_NRF5340_CPUAPP && !BOARD_NRF7002DK_NRF5340_CPUAPP_NS - select FLASH - select FLASH_MAP -endchoice - -if NRF_WIFI_PATCHES_EXT_FLASH_STORE -config NRF_WIFI_FW_FLASH_CHUNK_SIZE - int "Chunk size for nRF70 FW patches to be read from external flash" - default 8192 - help - Chunk size for nRF70 FW patches to be read from external flash. - This option impacts the loading time of the nRF70 FW patches and - RAM usage (heap) of the application. - -config NRF_WIFI_FW_PATCH_INTEGRITY_CHECK - bool "Enable integrity check of nRF70 FW patches" - select FLASH_AREA_CHECK_INTEGRITY - default y - help - Select this option to enable integrity check of nRF70 FW patches using - SHA-256 verification algorithm.This option impacts the loading time of the - nRF70 FW patches but protects against corrupted FW patches. - -config NRF_WIFI_FW_PATCH_DFU - bool "Direct Firmware Update of nRF70 FW patch" - depends on PARTITION_MANAGER_ENABLED - depends on BOOTLOADER_MCUBOOT - depends on !XIP_SPLIT_IMAGE - help - Enabling this option adds support for Device Firmware Update (DFU) - for the nRF70 Series Firmware Patch. - - This feature requires the addition of an MCUBoot partition pair: - a primary and a secondary partition. These partitions are used to - store the new firmware patch. The specific partition numbers to be used - depend on the number of partitions already in use. - - The "nrf70_wifi_fw" partition must be added to the newly created - MCUBoot primary partition. Once this Kconfig option is enabled, - the nRF70.hex file will be signed by MCUBoot. The signed image - will then be merged with the application image and flashed onto - the target board. - - Ensure that the required MCUBoot partitions are properly configured - before enabling this option. Refer to the documentation for detailed - instructions on partition configuration and the DFU process. - -# TC is the default but Wi-Fi uses MbedTLS, so, to avoid loading another library. -if NRF_WIFI_FW_PATCH_INTEGRITY_CHECK -choice FLASH_AREA_CHECK_INTEGRITY_BACKEND - default FLASH_AREA_CHECK_INTEGRITY_MBEDTLS -endchoice -endif -endif - -config CUSTOM_LINKER_SCRIPT - string "Custom linker script for nRF700x FW patches" - default "${ZEPHYR_BASE}/../nrf/drivers/wifi/nrf700x/rpu_fw_patches.ld" - -config NRF_WIFI_LOW_POWER - bool "Enable low power mode in nRF Wi-Fi chipsets" - default y - -config NRF700X_TCP_IP_CHECKSUM_OFFLOAD - bool "Enable TCP/IP checksum offload" - default y - -config NRF700X_REG_DOMAIN - string "The ISO/IEC alpha2 country code for the country in which this device is currently operating. Default 00 (World regulatory)" - # 00 is used for World regulatory - default "00" - -# Making calls to RPU from net_mgmt callbacks. -# -# If WPA supplicant is enabled, then don't override as it has higher -# stack requirements. -config NET_MGMT_EVENT_STACK_SIZE - default 2048 if !WPA_SUPP - -config NRF700X_LOG_VERBOSE - bool "Maintains the verbosity of information in logs" - default y - -module = WIFI_NRF700X -module-dep = LOG -module-str = Log level for Wi-Fi nRF700x driver -module-help = Sets log level for Wi-Fi nRF700x driver -source "subsys/logging/Kconfig.template.log_config" - -config WIFI_NRF700X_LOG_LEVEL - # Enable error by default - default 1 - -config NRF700X_ON_QSPI - def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF700X_QSPI)) - select NRFX_QSPI - -config NRF700X_ON_SPI - def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF700X_SPI)) - select SPI - -# Wi-Fi and SR Coexistence Hardware configuration. -config NRF700X_SR_COEX - bool "Enable Wi-Fi and SR coexistence support" - select EXPERIMENTAL if OPENTHREAD - def_bool $(dt_nodelabel_enabled,nrf_radio_coex) - -# GPIO configuration to control SR side RF switch position. -config NRF700X_SR_COEX_RF_SWITCH - def_bool $(dt_nodelabel_has_prop,nrf_radio_coex,srrf-switch-gpios) - -config NRF700X_WORKQ_STACK_SIZE - int "Stack size for workqueue" - default 4096 - -config NRF700X_WORKQ_MAX_ITEMS - int "Maximum work items for all workqueues" - default 100 - -config NRF700X_MAX_TX_PENDING_QLEN - int "Maximum number of pending TX packets" - default 18 - -config NRF700X_UTIL - depends on SHELL - bool "Enable Utility shell in nRF700x driver" - -config NRF700X_QSPI_LOW_POWER - bool "Enable low power mode in QSPI" - default y if NRF_WIFI_LOW_POWER - -config NRF700X_PCB_LOSS_2G - int "PCB loss for 2.4 GHz band" - default 0 - range 0 4 - help - Specifies PCB loss from the antenna connector to the RF pin. - The values are in dB scale in steps of 1dB and range of 0-4dB. - The loss is considered in the RX path only. - -config NRF700X_PCB_LOSS_5G_BAND1 - int "PCB loss for 5 GHz band (5150 MHz - 5350 MHz, Channel-32 - Channel-68)" - default 0 - range 0 4 - help - Specifies PCB loss from the antenna connector to the RF pin. - The values are in dB scale in steps of 1dB and range of 0-4dB. - The loss is considered in the RX path only. - -config NRF700X_PCB_LOSS_5G_BAND2 - int "PCB loss for 5 GHz band (5470 MHz - 5730 MHz, Channel-96 - Channel-144)" - default 0 - range 0 4 - help - Specifies PCB loss from the antenna connector to the RF pin. - The values are in dB scale in steps of 1dB and range of 0-4dB. - The loss is considered in the RX path only. - -config NRF700X_PCB_LOSS_5G_BAND3 - int "PCB loss for 5 GHz band (5730 MHz - 5895 MHz, Channel-149 - Channel-177)" - default 0 - range 0 4 - help - Specifies PCB loss from the antenna connector to the RF pin. - The values are in dB scale in steps of 1dB and range of 0-4dB. - The loss is considered in the RX path only. - -config NRF700X_ANT_GAIN_2G - int "Antenna gain for 2.4 GHz band" - default 0 - range 0 6 - -config NRF700X_ANT_GAIN_5G_BAND1 - int "Antenna gain for 5 GHz band (5150 MHz - 5350 MHz)" - default 0 - range 0 6 - -config NRF700X_ANT_GAIN_5G_BAND2 - int "Antenna gain for 5 GHz band (5470 MHz - 5730 MHz)" - default 0 - range 0 6 - -config NRF700X_ANT_GAIN_5G_BAND3 - int "Antenna gain for 5 GHz band (5730 MHz - 5895 MHz)" - default 0 - range 0 6 - -config NRF700X_BAND_2G_LOWER_EDGE_BACKOFF_DSSS - int "DSSS Transmit power backoff (in dB) for lower edge of 2.4 GHz frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_2G_LOWER_EDGE_BACKOFF_HT - int "HT/VHT Transmit power backoff (in dB) for lower edge of 2.4 GHz frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_2G_LOWER_EDGE_BACKOFF_HE - int "HE Transmit power backoff (in dB) for lower edge of 2.4 GHz frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_2G_UPPER_EDGE_BACKOFF_DSSS - int "DSSS Transmit power backoff (in dB) for upper edge of 2.4 GHz frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_2G_UPPER_EDGE_BACKOFF_HT - int "HT/VHT Transmit power backoff (in dB) for upper edge of 2.4 GHz frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_2G_UPPER_EDGE_BACKOFF_HE - int "HE Transmit power backoff (in dB) for upper edge of 2.4 GHz frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_UNII_1_LOWER_EDGE_BACKOFF_HT - int "HT/VHT Transmit power backoff (in dB) for lower edge of UNII-1 frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_UNII_1_LOWER_EDGE_BACKOFF_HE - int "HE Transmit power backoff (in dB) for lower edge of UNII-1 frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_UNII_1_UPPER_EDGE_BACKOFF_HT - int "HT/VHT Transmit power backoff (in dB) for upper edge of UNII-1 frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_UNII_1_UPPER_EDGE_BACKOFF_HE - int "HE Transmit power backoff (in dB) for upper edge of UNII-1 frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_UNII_2A_LOWER_EDGE_BACKOFF_HT - int "HT/VHT Transmit power backoff (in dB) for lower edge of UNII-2A frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_UNII_2A_LOWER_EDGE_BACKOFF_HE - int "HE Transmit power backoff (in dB) for lower edge of UNII-2A frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_UNII_2A_UPPER_EDGE_BACKOFF_HT - int "HT/VHT Transmit power backoff (in dB) for upper edge of UNII-2A frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_UNII_2A_UPPER_EDGE_BACKOFF_HE - int "HE Transmit power backoff (in dB) for upper edge of UNII-2A frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_UNII_2C_LOWER_EDGE_BACKOFF_HT - int "HT/VHT Transmit power backoff (in dB) for lower edge of UNII-2C frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_UNII_2C_LOWER_EDGE_BACKOFF_HE - int "HE Transmit power backoff (in dB) for lower edge of UNII-2C frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_UNII_2C_UPPER_EDGE_BACKOFF_HT - int "HT/VHT Transmit power backoff (in dB) for upper edge of UNII-2C frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_UNII_2C_UPPER_EDGE_BACKOFF_HE - int "HE Transmit power backoff (in dB) for upper edge of UNII-2C frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_UNII_3_LOWER_EDGE_BACKOFF_HT - int "HT/VHT Transmit power backoff (in dB) for lower edge of UNII-3 frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_UNII_3_LOWER_EDGE_BACKOFF_HE - int "HE Transmit power backoff (in dB) for lower edge of UNII-3 frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_UNII_3_UPPER_EDGE_BACKOFF_HT - int "HT/VHT Transmit power backoff (in dB) for upper edge of UNII-3 frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_UNII_3_UPPER_EDGE_BACKOFF_HE - int "HE Transmit power backoff (in dB) for upper edge of UNII-3 frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_UNII_4_LOWER_EDGE_BACKOFF_HT - int "HT/VHT Transmit power backoff (in dB) for lower edge of UNII-4 frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_UNII_4_LOWER_EDGE_BACKOFF_HE - int "HE Transmit power backoff (in dB) for lower edge of UNII-4 frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_UNII_4_UPPER_EDGE_BACKOFF_HT - int "HT/VHT Transmit power backoff (in dB) for upper edge of UNII-4 frequency band" - default 0 - range 0 10 - -config NRF700X_BAND_UNII_4_UPPER_EDGE_BACKOFF_HE - int "HE Transmit power backoff (in dB) for upper edge of UNII-4 frequency band" - default 0 - range 0 10 - -# Performance fine tuning options - -config NRF700X_RX_NUM_BUFS - int "Number of RX buffers" - default 48 - -config NRF700X_MAX_TX_AGGREGATION - int "Maximum number of TX packets to aggregate" - default 12 - -config NRF700X_MAX_TX_TOKENS - int "Maximum number of TX tokens" - range 5 12 if !NRF700X_RADIO_TEST - default 10 - -config NRF700X_TX_MAX_DATA_SIZE - int "Maximum size of TX data" - default 1600 - -config NRF700X_RX_MAX_DATA_SIZE - int "Maximum size of RX data" - default 1600 - -config NRF700X_TX_DONE_WQ_ENABLED - bool "Enable TX done workqueue (impacts performance negatively)" - -config NRF700X_RX_WQ_ENABLED - bool "Enable RX workqueue" - -# Use for IRQ processing (TODO: using for BH processing causes issues) -config NUM_METAIRQ_PRIORITIES - default 1 - -config NRF700X_IRQ_WQ_PRIORITY - int "Priority of the workqueue for handling IRQs" - default -15 - -config NRF700X_BH_WQ_PRIORITY - int "Priority of the workqueue for handling bottom half" - default 0 - -config NRF700X_IRQ_WQ_STACK_SIZE - int "Stack size of the workqueue for handling IRQs" - default 2048 - -config NRF700X_BH_WQ_STACK_SIZE - int "Stack size of the workqueue for handling bottom half" - default 2048 - -if NRF700X_TX_DONE_WQ_ENABLED -config NRF700X_TX_DONE_WQ_PRIORITY - int "Priority of the workqueue for handling TX done" - default 0 - -config NRF700X_TX_DONE_WQ_STACK_SIZE - int "Stack size of the workqueue for handling TX done" - default 2048 -endif - -if NRF700X_RX_WQ_ENABLED -config NRF700X_RX_WQ_PRIORITY - int "Priority of the workqueue for handling RX" - default 0 - -config NRF700X_RX_WQ_STACK_SIZE - int "Stack size of the workqueue for handling RX" - default 2048 -endif - -if NRF_WIFI_LOW_POWER -config NRF700X_RPU_PS_IDLE_TIMEOUT_MS - int "RPU power save idle timeout in milliseconds" - default 10 - -config NRF700X_RPU_EXTEND_TWT_SP - bool "Enable extending TWT service period" - help - In case frames accepted before beginning of SP are not - transmitted before the SP completes then typically they are - dropped to conform to SP window as per specification i.e., no - transmission outside SP window. - - This feature mitigates the frame loss by transmitting even after SP - completion by using standard contention mechanism which is allowed - in specification but not recommended. As the device is actively transmitting - beyond SP, the power consumption increases depending on the amount - of traffic available at the start of SP. - - Please note that if a frame is sent after SP starts it will be queued and this - mechanism is not used. -endif - -config WIFI_FIXED_MAC_ADDRESS - string "WiFi Fixed MAC address in format XX:XX:XX:XX:XX:XX" - help - This overrides the MAC address read from OTP. Strictly for testing purposes only. - -choice - prompt "Wi-Fi MAC address type" - default WIFI_OTP_MAC_ADDRESS if WIFI_FIXED_MAC_ADDRESS = "" - default WIFI_FIXED_MAC_ADDRESS_ENABLED if WIFI_FIXED_MAC_ADDRESS != "" - help - Select the type of MAC address to be used by the Wi-Fi driver - -config WIFI_OTP_MAC_ADDRESS - bool "Use MAC address from OTP" - help - This option uses the MAC address stored in the OTP memory of the nRF700x. - -config WIFI_FIXED_MAC_ADDRESS_ENABLED - bool "Enable fixed MAC address" - help - Enable fixed MAC address - -config WIFI_RANDOM_MAC_ADDRESS - bool "Enable random MAC address generation at runtime" - depends on ENTROPY_GENERATOR - help - This option enables random MAC address generation at runtime. - The random MAC address is generated using the entropy device random generator. - -endchoice - -config NRF700X_RSSI_STALE_TIMEOUT_MS - int "RSSI stale timeout in milliseconds" - default 1000 - help - RSSI stale timeout is the period after which driver queries - RPU to get the RSSI the value. - If data is active (e.g. ping), driver stores the RSSI value from - the received frames and provides this stored information - to wpa_supplicant. In this case a higher value will be suitable - as stored RSSI value at driver will be updated regularly. - If data is not active or after the stale timeout duration, - driver queries the RPU to get the RSSI value - and provides it to wpa_supplicant. The value should be set to lower - value as driver does not store it and requires RPU to provide the - info. - -if NETWORKING -# Finetune defaults for certain system components used by the driver -config HEAP_MEM_POOL_SIZE - default 153000 - -config SYSTEM_WORKQUEUE_STACK_SIZE - default 4096 - -config NET_TX_STACK_SIZE - default 4096 - -config NET_RX_STACK_SIZE - default 4096 - -config NET_TC_TX_COUNT - default 1 - -endif # NETWORKING - -# Override the Wi-Fi subsytems WIFI_MGMT_SCAN_SSID_FILT_MAX parameter, -# since we support a maximum of 2 SSIDs for scan result filtering. -config WIFI_MGMT_SCAN_SSID_FILT_MAX - default 2 -endif - -config NRF_WIFI_SCAN_MAX_BSS_CNT - int "Maximum number of scan results to return." - default 0 - range 0 65535 - help - Maximum number of scan results to return. 0 represents unlimited number of BSSes. - -config NRF_WIFI_BEAMFORMING - bool "Enable Wi-Fi beamforming. Enabling beamforming can provide slight improvement in performance where as disabling it can provide better power saving in low network activity applications" - default y - -config WIFI_NRF700X_SCAN_TIMEOUT_S - int "Scan timeout in seconds" - default 30 - -menu "nRF Wi-Fi operation band(s)" - visible if !NRF70_2_4G_ONLY - -config NRF_WIFI_2G_BAND - bool "Set operation band to 2.4GHz" - default y if NRF70_2_4G_ONLY - -config NRF_WIFI_5G_BAND - bool "Set operation band to 5GHz" - depends on !NRF70_2_4G_ONLY - -config NRF_WIFI_OP_BAND - int "Options to set operation band" - default 1 if NRF_WIFI_2G_BAND - default 2 if NRF_WIFI_5G_BAND - default 3 - help - Set this option to select frequency band - 1 - 2.4GHz - 2 - 5GHz - 3 - All ( 2.4GHz and 5GHz ) -endmenu - -config NRF_WIFI_IFACE_MTU - int "MTU for Wi-Fi interface" - range 576 2304 if NET_IPV4 - range 1280 2304 if NET_IPV6 - default 1500 - -config WIFI_NRF700X_SKIP_LOCAL_ADMIN_MAC - bool "Suppress networks with non-individual MAC address as BSSID in the scan results" - help - Wi-Fi access points use locally administered MAC address to manage - multiple virtual interfaces, for geo-location usecase these networks - from the virtual interfaces do not help in anyway as they are co-located with the primary interface - that has globally unique MAC address. - - So, to save resources, this option drops such networks from the scan results. - -config WIFI_NRF700X_SCAN_DISABLE_DFS_CHANNELS - bool "Disables DFS channels in scan operation" - help - This option disables inclusion of DFS channels in scan operation. - This is useful to reduce the scan time, as DFS channels are seldom used. - -config NET_INTERFACE_NAME_LEN - # nordic_wlanN - default 15 - -config NRF_WIFI_AP_DEAD_DETECT_TIMEOUT - int "Access point dead detection timeout in seconds" - range 1 30 - default 20 - help - The number of seconds after which AP is declared dead if no beacons - are received from the AP. Used to detect AP silently going down e.g., power off. - -config NRF_WIFI_RPU_RECOVERY - bool "Enable RPU recovery mechanism" - select EXPERIMENTAL - help - Enable RPU recovery mechanism to recover from RPU (nRF70) hang. - This feature performs an interface reset (down and up) which triggers - a RPU coldboot. Application's network connection will be lost during - the recovery process and it is application's responsibility to - re-establish the network connection. - -if NRF_WIFI_RPU_RECOVERY - -config NRF_WIFI_RPU_RECOVERY_PROPAGATION_DELAY_MS - int "RPU recovery propagation delay in milliseconds" - default 10 - help - Propagation delay in milliseconds to wait after RPU is powered down - before powering it up. This delay is required to ensure that the recovery - is propagted to all the applications and stack and have enough time to - clean up the resources. - -config NET_MGMT_EVENT_QUEUE_SIZE - # Doing interface down and up even with delay puts a lot of events in the queue - default 16 -endif - -config NRF_WIFI_COMBINED_BUCKEN_IOVDD_GPIO - bool - help - Enable this option to use a single GPIO to control both buck enable and IOVDD enable, - there will be a internal hardware switch to add delay between the two operations. This - is typically 4ms delay for nRF70. - -config NRF_WIFI_FEAT_WMM - bool "Enable/Disable WMM mode" - default y - help - This option controls disable/enable of the WMM(Wireless Multi-Media) feature. - -choice NRF_WIFI_PS_DATA_RETRIEVAL_MECHANISM - prompt "Power save data retrieval mechanism" - default NRF_WIFI_PS_POLL_BASED_RETRIEVAL - help - Select the mechanism to retrieve buffered data from AP. - -config NRF_WIFI_PS_POLL_BASED_RETRIEVAL - bool "PS-Poll frame based mechanism to retrieve buffered data from AP" - help - When AP notifies about availability of buffered data, the STA stays in power save - and retrieves the frames one-by-one, this conserved more power but adds latency - to the traffic. Ideal for minimum number of frames. - -config NRF_WIFI_QOS_NULL_BASED_RETRIEVAL - bool "QoS null frame based mechanism to retrieve buffered data from AP" - help - When AP notifies about availability of buffered data, the STA comes out of - power save and then AP can deliver all buffered frames without any additional - overhead or latency, but STA enters power save after a delay costing more power - depending on the delay. Ideal for heavy buffered traffic. - -endchoice diff --git a/drivers/wifi/nrf700x/inc/coex.h b/drivers/wifi/nrf700x/inc/coex.h deleted file mode 100644 index 13f3b2e0786b..000000000000 --- a/drivers/wifi/nrf700x/inc/coex.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief Header containing Coexistence APIs. - */ - -#ifndef __COEX_H__ -#define __COEX_H__ - -#include - -/* Indicates WLAN frequency band of operation */ -enum nrf_wifi_pta_wlan_op_band { - NRF_WIFI_PTA_WLAN_OP_BAND_2_4_GHZ = 0, - NRF_WIFI_PTA_WLAN_OP_BAND_5_GHZ, - NRF_WIFI_PTA_WLAN_OP_BAND_NONE = 0xFF -}; - -/** - * @function nrf_wifi_coex_config_pta(enum nrf_wifi_pta_wlan_op_band wlan_band, - * bool separate_antennas, bool is_sr_protocol_ble) - * - * @brief Function used to configure PTA tables of coexistence hardware. - * - * @param[in] enum nrf_wifi_pta_wlan_op_band wlan_band - * @param[in] separate_antennas - * Indicates whether separate antenans are used or not. - * @param[in] is_sr_protocol_ble - * Indicates if SR protocol is Bluetooth LE or not. - * @return Returns status of configuration. - * Returns zero upon successful configuration. - * Returns non-zero upon unsuccessful configuration. - */ -int nrf_wifi_coex_config_pta(enum nrf_wifi_pta_wlan_op_band wlan_band, bool separate_antennas, - bool is_sr_protocol_ble); - -#if defined(CONFIG_NRF700X_SR_COEX_RF_SWITCH) || defined(__DOXYGEN__) -/** - * @function nrf_wifi_config_sr_switch(bool separate_antennas) - * - * @brief Function used to configure SR side switch (nRF5340 side switch in nRF7002 DK). - * - * @param[in] separate_antennas - * Indicates whether separate antenans are used or not. - * - * @return Returns status of configuration. - * Returns zero upon successful configuration. - * Returns non-zero upon unsuccessful configuration. - */ -int nrf_wifi_config_sr_switch(bool separate_antennas); -#endif /* CONFIG_NRF700X_SR_COEX_RF_SWITCH */ - -/** - * @function nrf_wifi_coex_config_non_pta(bool separate_antennas) - * - * @brief Function used to configure non-PTA registers of coexistence hardware. - * - * @param[in] separate_antennas - * Indicates whether separate antenans are used or not. - * @param[in] is_sr_protocol_ble - * Indicates if SR protocol is Bluetooth LE or not. - * - * @return Returns status of configuration. - * Returns zero upon successful configuration. - * Returns non-zero upon unsuccessful configuration. - */ -int nrf_wifi_coex_config_non_pta(bool separate_antennas, bool is_sr_protocol_ble); - -/** - * @function nrf_wifi_coex_hw_reset(void) - * - * @brief Function used to reset coexistence hardware. - * - * @return Returns status of configuration. - * Returns zero upon successful configuration. - * Returns non-zero upon unsuccessful configuration. - */ -int nrf_wifi_coex_hw_reset(void); - -#endif /* __COEX_H__ */ diff --git a/drivers/wifi/nrf700x/inc/coex_struct.h b/drivers/wifi/nrf700x/inc/coex_struct.h deleted file mode 100644 index ccdf210ebb6b..000000000000 --- a/drivers/wifi/nrf700x/inc/coex_struct.h +++ /dev/null @@ -1,182 +0,0 @@ -/** - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief Structures and related enumerations used in Coexistence. - */ - -#ifndef __COEX_STRUCT_H__ -#define __COEX_STRUCT_H__ - -#include -#include - -/* Max size of message buffer (exchanged between host and MAC). This is in "bytes" */ -#define MAX_MESSAGE_BUF_SIZE 320 -/* Number of elements in coex_ch_configuration other than configbuf[] */ -#define NUM_ELEMENTS_EXCL_CONFIGBUF 4 -/* Each configuration value is of type uint32_t */ -#define MAX_NUM_CONFIG_VALUES ((MAX_MESSAGE_BUF_SIZE-\ - (NUM_ELEMENTS_EXCL_CONFIGBUF*sizeof(uint32_t)))>>2) -/* Number of elements in coex_sr_traffic_info other than sr_traffic_info[] */ -#define NUM_ELEMENTS_EXCL_SRINFOBUF 1 -/* Each SR Traffic Info is of type uint32_t */ -#define MAX_SR_TRAFFIC_BUF_SIZE 32 - -enum { - /** Used two different values for AGGREGATION module because offset from base is - * beyond supported message buffer size for WAIT_STATE_1_TIME register - */ - COEX_HARDWARE = 1, - MAC_CTRL, - MAC_CTRL_AGG_WAIT_STATE_1_TIME, - MAC_CTRL_AGG, - MAC_CTRL_DEAGG, - WLAN_CTRL, -}; - -/* IDs of different messages posted from Coexistence Driver to Coexistence Manager */ -enum { - /* To insturct Coexistence Manager to collect and post SR traffic information */ - COLLECT_SR_TRAFFIC_INFO = 1, - /* To insturct Coexistence Manager to allocate a priority window to SR */ - ALLOCATE_PTI_WINDOW, - /* To do configuration of hardware related to coexistence */ - HW_CONFIGURATION, - /* To start allocating periodic priority windows to Wi-Fi and SR */ - ALLOCATE_PPW, - /* To start allocating virtual priority windows to Wi-Fi */ - ALLOCATE_VPW, - /* To configure CM SW parameters */ - SW_CONFIGURATION, - /* To control sheliak side switch */ - UPDATE_SWITCH_CONFIG -}; - -/* ID(s) of different messages posted from Coexistence Manager to Coexistence Driver */ -enum { - /* To post SR traffic information */ - SR_TRAFFIC_INFO = 1 -}; - -/** - * struct coex_collect_sr_traffic_info - Message from CD to CM to request SR traffic info. - * @message_id: Indicates message ID. This is to be set to COLLECT_SR_TRAFFIC_INFO. - * @num_sets_requested: Indicates the number of sets of duration and periodicity to be collected. - * - * Message from CD to CM to request SR traffic information. - */ -struct coex_collect_sr_traffic_info { - uint32_t message_id; - uint32_t num_sets_requested; -}; - -/** - * struct coex_ch_configuration -Message from CD to CM to configure CH. - * @message_id: Indicates message ID. This is to be set to HW_CONFIGURATION. - * @num_reg_to_config: Indicates the number of registers to be configured. - * @hw_to_config: Indicates the hardware block that is to be configured. - * @hw_block_base_addr: Base address of the hardware block to be configured. - * @configbuf: Configuration buffer that holds packed offset and configuration value. - * - * Message from CD to CM to configure CH - */ -struct coex_ch_configuration { - uint32_t message_id; - uint32_t num_reg_to_config; - uint32_t hw_to_config; - uint32_t hw_block_base_addr; - uint32_t configbuf[MAX_NUM_CONFIG_VALUES]; -}; - -/** - * struct coex_allocate_pti_window - Message to CM to request a priority window. - * @message_id: Indicates message ID. This is to be set to ALLOCATE_PTI_WINDOW. - * @device_req_window: Indicates device requesting a priority window. - * @window_start_or_end: Indicates if request is posted to START or END a priority window. - * @imp_of_request: Indicates importance of activity for which the window is requested. - * @can_be_deferred: activity of Wi-Fi/SR, for which window is requested can be deferred or not. - * - * Message to CM to request a priority window - */ -struct coex_allocate_pti_window { - uint32_t message_id; - uint32_t device_req_window; - uint32_t window_start_or_end; - uint32_t imp_of_request; - uint32_t can_be_deferred; -}; - -/** - * struct coex_allocate_ppw - Message from CD to CM to allocate Periodic Priority Windows. - * @message_id: Indicates message ID. This is to be set to ALLOCATE_PPW. - * @start_or_stop: Indiates start or stop allocation of PPWs. - * @first_pti_window: Indicates first priority window in the series of PPWs. - * @ps_mechanism: Indicates recommended powersave mechanism for Wi-Fi's downlink. - * @wifi_window_duration: Indicates duration of Wi-Fi priority window. - * @sr_window_duration: Indicates duration of SR priority window. - * - * Message from CD to CM to allocate Periodic Priority Windows. - */ -struct coex_allocate_ppw { - uint32_t message_id; - uint32_t start_or_stop; - uint32_t first_pti_window; - uint32_t ps_mechanism; - uint32_t wifi_window_duration; - uint32_t sr_window_duration; -}; - -/** - * struct coex_allocate_vpw - Message from CD to CM to allocate Virtual Priority Windows. - * @message_id: Indicates message ID. This is to be set to ALLOCATE_VPW. - * @start_or_stop: Indicates start or stop allocation of VPWs. - * @wifi_window_duration: Indicates duration of Wi-Fi virtual priority window. - * @ps_mechanism: Indicates recommended powersave mechanism for Wi-Fi's downlink. - * - * Message from CD to CM to allocate Virtual Priority Windows. - */ -struct coex_allocate_vpw { - uint32_t message_id; - uint32_t start_or_stop; - uint32_t wifi_window_duration; - uint32_t ps_mechanism; -}; - -/** - * struct coex_config_cm_params - Message from CD to CM to configure CM parameters - * @message_id: Indicates message ID. This is to be set to SW_CONFIGURATION. - * @first_isr_trigger_period: microseconds . used to trigger the ISR mechanism. - * @sr_window_poll_periodicity_vpw: microseconds. This is used to poll through SR window. - * that comes after Wi-Fi window ends and next SR activity starts, in the case of VPWs. - * @lead_time_from_end_of_wlan_win: microseconds. Lead time from the end of Wi-Fi window. - * (to inform AP that Wi-Fi is entering powersave) in the case of PPW and VPW generation. - * @sr_window_poll_count_threshold: This is equal to "Wi-Fi contention timeout. - * threshold"/sr_window_poll_periodicity_vpw. - * - * Message from CD to CM to configure CM parameters. - */ -struct coex_config_cm_params { - uint32_t message_id; - uint32_t first_isr_trigger_period; - uint32_t sr_window_poll_periodicity_vpw; - uint32_t lead_time_from_end_of_wlan_win; - uint32_t sr_window_poll_count_threshold; -}; - -/** - * struct coex_sr_traffic_info - Message from CM to CD to post SR traffic information. - * @message_id: Indicates message ID. This is to be set to SR_TRAFFIC_INFO. - * @sr_traffic_info: Traffic information buffer. - * - * Message from CM to CD to post SR traffic inforamtion - */ -struct coex_sr_traffic_info { - uint32_t message_id; - uint32_t sr_traffic_info[MAX_SR_TRAFFIC_BUF_SIZE]; -}; - -#endif /* __COEX_STRUCT_H__ */ diff --git a/drivers/wifi/nrf700x/inc/fmac_main.h b/drivers/wifi/nrf700x/inc/fmac_main.h deleted file mode 100644 index 46c8b47eedbd..000000000000 --- a/drivers/wifi/nrf700x/inc/fmac_main.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief Header containing FMAC interface specific declarations for the - * Zephyr OS layer of the Wi-Fi driver. - */ - -#ifndef __ZEPHYR_FMAC_MAIN_H__ -#define __ZEPHYR_FMAC_MAIN_H__ - -#include - -#include -#include -#ifndef CONFIG_NRF700X_RADIO_TEST -#include -#include -#ifdef CONFIG_NETWORKING -#include -#endif /* CONFIG_NETWORKING */ -#ifdef CONFIG_NRF700X_STA_MODE -#include -#endif /* CONFIG_NRF700X_STA_MODE */ -#endif /* !CONFIG_NRF700X_RADIO_TEST */ - -#include -#include -#include "ncs_version.h" - -#define NRF700X_DRIVER_VERSION "1."NCS_VERSION_STRING - -#ifndef CONFIG_NRF700X_RADIO_TEST -struct nrf_wifi_vif_ctx_zep { - const struct device *zep_dev_ctx; - struct net_if *zep_net_if_ctx; - void *supp_drv_if_ctx; - void *rpu_ctx_zep; - unsigned char vif_idx; - struct k_mutex vif_lock; - - scan_result_cb_t disp_scan_cb; - bool scan_in_progress; - int scan_type; - uint16_t max_bss_cnt; - unsigned int scan_res_cnt; - struct k_work_delayable scan_timeout_work; - - struct net_eth_addr mac_addr; - int if_type; - char ifname[16]; - enum nrf_wifi_fmac_if_op_state if_op_state; - bool set_if_event_received; - int set_if_status; -#ifdef CONFIG_NET_STATISTICS_ETHERNET - struct net_stats_eth eth_stats; -#endif /* CONFIG_NET_STATISTICS_ETHERNET */ -#ifdef CONFIG_NRF700X_STA_MODE - unsigned int assoc_freq; - enum nrf_wifi_fmac_if_carr_state if_carr_state; - struct wpa_signal_info *signal_info; - struct wpa_conn_info *conn_info; - struct zep_wpa_supp_dev_callbk_fns supp_callbk_fns; - unsigned char twt_flows_map; - unsigned char twt_flow_in_progress_map; - struct wifi_ps_config *ps_info; - bool ps_config_info_evnt; - bool authorized; - bool cookie_resp_received; -#ifdef CONFIG_NRF700X_DATA_TX - struct k_work nrf_wifi_net_iface_work; -#endif /* CONFIG_NRF700X_DATA_TX */ - unsigned long rssi_record_timestamp_us; - signed short rssi; -#endif /* CONFIG_NRF700X_STA_MODE */ -#ifdef CONFIG_NRF700X_AP_MODE - int inactive_time_sec; -#endif /* CONFIG_NRF700X_AP_MODE */ -#ifdef CONFIG_NRF_WIFI_RPU_RECOVERY - struct k_work nrf_wifi_rpu_recovery_work; -#endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */ -}; - -struct nrf_wifi_vif_ctx_map { - const char *ifname; - struct nrf_wifi_vif_ctx_zep *vif_ctx; -}; -#endif /* !CONFIG_NRF700X_RADIO_TEST */ - -struct nrf_wifi_ctx_zep { - void *drv_priv_zep; - void *rpu_ctx; -#ifdef CONFIG_NRF700X_RADIO_TEST - struct rpu_conf_params conf_params; - bool rf_test_run; - unsigned char rf_test; -#else /* CONFIG_NRF700X_RADIO_TEST */ - struct nrf_wifi_vif_ctx_zep vif_ctx_zep[MAX_NUM_VIFS]; -#ifdef CONFIG_NRF700X_UTIL - struct rpu_conf_params conf_params; -#endif /* CONFIG_NRF700X_UTIL */ -#endif /* CONFIG_NRF700X_RADIO_TEST */ - unsigned char *extended_capa, *extended_capa_mask; - unsigned int extended_capa_len; - struct k_mutex rpu_lock; -}; - -struct nrf_wifi_drv_priv_zep { - struct nrf_wifi_fmac_priv *fmac_priv; - /* TODO: Replace with a linked list to handle unlimited RPUs */ - struct nrf_wifi_ctx_zep rpu_ctx_zep; -}; - -extern struct nrf_wifi_drv_priv_zep rpu_drv_priv_zep; - -void nrf_wifi_scan_timeout_work(struct k_work *work); -void configure_tx_pwr_settings(struct nrf_wifi_tx_pwr_ctrl_params *tx_pwr_ctrl_params, - struct nrf_wifi_tx_pwr_ceil_params *tx_pwr_ceil_params); -void configure_board_dep_params(struct nrf_wifi_board_params *board_params); -void set_tx_pwr_ceil_default(struct nrf_wifi_tx_pwr_ceil_params *pwr_ceil_params); -const char *nrf_wifi_get_drv_version(void); -enum nrf_wifi_status nrf_wifi_fmac_dev_add_zep(struct nrf_wifi_drv_priv_zep *drv_priv_zep); -enum nrf_wifi_status nrf_wifi_fmac_dev_rem_zep(struct nrf_wifi_drv_priv_zep *drv_priv_zep); -enum nrf_wifi_status nrf_wifi_fw_load(void *rpu_ctx); -struct nrf_wifi_vif_ctx_zep *nrf_wifi_get_vif_ctx(struct net_if *iface); -void nrf_wifi_rpu_recovery_cb(void *vif_ctx, - void *event_data, - unsigned int event_len); - -#endif /* __ZEPHYR_FMAC_MAIN_H__ */ diff --git a/drivers/wifi/nrf700x/inc/net_if.h b/drivers/wifi/nrf700x/inc/net_if.h deleted file mode 100644 index 7d2d3ff784fe..000000000000 --- a/drivers/wifi/nrf700x/inc/net_if.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief Header containing network stack interface specific declarations for - * the Zephyr OS layer of the Wi-Fi driver. - */ - -#ifndef __ZEPHYR_NET_IF_H__ -#define __ZEPHYR_NET_IF_H__ -#include -#include -#include -#include -#include -#include - -#define UNICAST_MASK GENMASK(7, 1) -#define LOCAL_BIT BIT(1) - -void nrf_wifi_if_init_zep(struct net_if *iface); - -int nrf_wifi_if_start_zep(const struct device *dev); - -int nrf_wifi_if_stop_zep(const struct device *dev); - -int nrf_wifi_if_set_config_zep(const struct device *dev, - enum ethernet_config_type type, - const struct ethernet_config *config); - -int nrf_wifi_if_get_config_zep(const struct device *dev, - enum ethernet_config_type type, - struct ethernet_config *config); - -enum ethernet_hw_caps nrf_wifi_if_caps_get(const struct device *dev); - -int nrf_wifi_if_send(const struct device *dev, - struct net_pkt *pkt); - -void nrf_wifi_if_rx_frm(void *os_vif_ctx, - void *frm); - -#if defined(CONFIG_NRF700X_RAW_DATA_RX) || defined(CONFIG_NRF700X_PROMISC_DATA_RX) -void nrf_wifi_if_sniffer_rx_frm(void *os_vif_ctx, - void *frm, - struct raw_rx_pkt_header *raw_rx_hdr, - bool pkt_free); -#endif /* CONFIG_NRF700X_RAW_DATA_RX || CONFIG_NRF700X_PROMISC_DATA_RX */ - -enum nrf_wifi_status nrf_wifi_if_carr_state_chg(void *os_vif_ctx, - enum nrf_wifi_fmac_if_carr_state carr_state); - -int nrf_wifi_stats_get(const struct device *dev, - struct net_stats_wifi *stats); - -struct net_stats_eth *nrf_wifi_eth_stats_get(const struct device *dev); - -void nrf_wifi_set_iface_event_handler(void *os_vif_ctx, - struct nrf_wifi_umac_event_set_interface *event, - unsigned int event_len); - -int nrf_wifi_stats_reset(const struct device *dev); -#endif /* __ZEPHYR_NET_IF_H__ */ diff --git a/drivers/wifi/nrf700x/inc/wifi_mgmt.h b/drivers/wifi/nrf700x/inc/wifi_mgmt.h deleted file mode 100644 index 9e8424d43a05..000000000000 --- a/drivers/wifi/nrf700x/inc/wifi_mgmt.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief Header containing WiFi management operation implementations - * for the Zephyr OS. - */ - -#ifndef __ZEPHYR_WIFI_MGMT_H__ -#define __ZEPHYR_WIFI_MGMT_H__ -#include - -#include -#include - -#include "osal_api.h" - -/** Filter setting defines for sniffer mode. */ -#define WIFI_MGMT_DATA_CTRL_FILTER_SETTING 0xE -#define WIFI_ALL_FILTER_SETTING 0xF - -struct twt_interval_float { - unsigned short mantissa; - unsigned char exponent; -}; - -int nrf_wifi_set_power_save(const struct device *dev, - struct wifi_ps_params *params); - -int nrf_wifi_set_twt(const struct device *dev, - struct wifi_twt_params *twt_params); - -void nrf_wifi_event_proc_twt_setup_zep(void *vif_ctx, - struct nrf_wifi_umac_cmd_config_twt *twt_setup_info, - unsigned int event_len); - -void nrf_wifi_event_proc_twt_teardown_zep(void *vif_ctx, - struct nrf_wifi_umac_cmd_teardown_twt *twt_teardown_info, - unsigned int event_len); - -void nrf_wifi_event_proc_twt_sleep_zep(void *vif_ctx, - struct nrf_wifi_umac_event_twt_sleep *twt_sleep_info, - unsigned int event_len); - -int nrf_wifi_twt_teardown_flows(struct nrf_wifi_vif_ctx_zep *vif_ctx_zep, - unsigned char start_flow_id, unsigned char end_flow_id); - -int nrf_wifi_get_power_save_config(const struct device *dev, - struct wifi_ps_config *ps_config); - -void nrf_wifi_event_proc_get_power_save_info(void *vif_ctx, - struct nrf_wifi_umac_event_power_save_info *ps_info, - unsigned int event_len); - -#ifdef CONFIG_NRF700X_SYSTEM_WITH_RAW_MODES -int nrf_wifi_mode(const struct device *dev, - struct wifi_mode_info *mode); -#endif - -#if defined(CONFIG_NRF700X_RAW_DATA_TX) || defined(CONFIG_NRF700X_RAW_DATA_RX) -int nrf_wifi_channel(const struct device *dev, - struct wifi_channel_info *channel); -#endif /* CONFIG_NRF700X_RAW_DATA_TX || CONFIG_NRF700X_RAW_DATA_RX */ - -#if defined(CONFIG_NRF700X_RAW_DATA_RX) || defined(CONFIG_NRF700X_PROMISC_DATA_RX) -int nrf_wifi_filter(const struct device *dev, - struct wifi_filter_info *filter); -#endif /* CONFIG_NRF700X_RAW_DATA_RX || CONFIG_NRF700X_PROMISC_DATA_RX */ - -int nrf_wifi_set_rts_threshold(const struct device *dev, - unsigned int rts_threshold); -#endif /* __ZEPHYR_WIFI_MGMT_H__ */ diff --git a/drivers/wifi/nrf700x/inc/wifi_mgmt_scan.h b/drivers/wifi/nrf700x/inc/wifi_mgmt_scan.h deleted file mode 100644 index f7b1bdf3f3c5..000000000000 --- a/drivers/wifi/nrf700x/inc/wifi_mgmt_scan.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief Header containing display scan specific declarations for the - * Zephyr OS layer of the Wi-Fi driver. - */ - -#ifndef __ZEPHYR_DISP_SCAN_H__ -#define __ZEPHYR_DISP_SCAN_H__ -#include -#include - -#include "osal_api.h" -int nrf_wifi_disp_scan_zep(const struct device *dev, struct wifi_scan_params *params, - scan_result_cb_t cb); - -enum nrf_wifi_status nrf_wifi_disp_scan_res_get_zep(struct nrf_wifi_vif_ctx_zep *vif_ctx_zep); - -void nrf_wifi_event_proc_disp_scan_res_zep(void *vif_ctx, - struct nrf_wifi_umac_event_new_scan_display_results *scan_res, - unsigned int event_len, - bool is_last); - -#ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS -void nrf_wifi_rx_bcn_prb_resp_frm(void *vif_ctx, - void *frm, - unsigned short frequency, - signed short signal); -#endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS */ -#endif /* __ZEPHYR_DISP_SCAN_H__ */ diff --git a/drivers/wifi/nrf700x/inc/wpa_supp_if.h b/drivers/wifi/nrf700x/inc/wpa_supp_if.h deleted file mode 100644 index 698dcf0b5acd..000000000000 --- a/drivers/wifi/nrf700x/inc/wpa_supp_if.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief Header containing WPA supplicant interface specific declarations for - * the Zephyr OS layer of the Wi-Fi driver. - */ - -#ifndef __ZEPHYR_WPA_SUPP_IF_H__ -#define __ZEPHYR_WPA_SUPP_IF_H__ - - -#define RPU_RESP_EVENT_TIMEOUT 5000 -#ifdef CONFIG_NRF700X_STA_MODE -#include - -void *nrf_wifi_wpa_supp_dev_init(void *supp_drv_if_ctx, const char *iface_name, - struct zep_wpa_supp_dev_callbk_fns *supp_callbk_fns); - -void nrf_wifi_wpa_supp_dev_deinit(void *if_priv); - -int nrf_wifi_wpa_supp_scan2(void *if_priv, struct wpa_driver_scan_params *params); - -int nrf_wifi_wpa_supp_scan_abort(void *if_priv); - -int nrf_wifi_wpa_supp_scan_results_get(void *if_priv); - -int nrf_wifi_wpa_supp_deauthenticate(void *if_priv, const char *addr, unsigned short reason_code); - -int nrf_wifi_wpa_supp_authenticate(void *if_priv, struct wpa_driver_auth_params *params, - struct wpa_bss *curr_bss); - -int nrf_wifi_wpa_supp_associate(void *if_priv, struct wpa_driver_associate_params *params); - -int nrf_wifi_wpa_set_supp_port(void *if_priv, int authorized, char *bssid); - -int nrf_wifi_wpa_supp_signal_poll(void *if_priv, struct wpa_signal_info *si, - unsigned char *bssid); - -int nrf_wifi_nl80211_send_mlme(void *if_priv, const u8 *data, size_t data_len, int noack, - unsigned int freq, int no_cck, int offchanok, unsigned int wait_time, - int cookie); - -int nrf_wifi_supp_get_wiphy(void *if_priv); - -int nrf_wifi_supp_register_frame(void *if_priv, - u16 type, const u8 *match, size_t match_len, - bool multicast); - -int nrf_wifi_wpa_supp_set_key(void *if_priv, - const unsigned char *ifname, - enum wpa_alg alg, - const unsigned char *addr, - int key_idx, - int set_tx, - const unsigned char *seq, - size_t seq_len, - const unsigned char *key, - size_t key_len); - -void nrf_wifi_wpa_supp_event_proc_scan_start(void *if_priv); - -void nrf_wifi_wpa_supp_event_proc_scan_done(void *if_priv, - struct nrf_wifi_umac_event_trigger_scan *scan_done_event, - unsigned int event_len, - int aborted); - -void nrf_wifi_wpa_supp_event_proc_scan_res(void *if_priv, - struct nrf_wifi_umac_event_new_scan_results *scan_res, - unsigned int event_len, - bool more_res); - -void nrf_wifi_wpa_supp_event_proc_auth_resp(void *if_priv, - struct nrf_wifi_umac_event_mlme *auth_resp, - unsigned int event_len); - -void nrf_wifi_wpa_supp_event_proc_assoc_resp(void *if_priv, - struct nrf_wifi_umac_event_mlme *assoc_resp, - unsigned int event_len); - -void nrf_wifi_wpa_supp_event_proc_deauth(void *if_priv, - struct nrf_wifi_umac_event_mlme *deauth, - unsigned int event_len); - -void nrf_wifi_wpa_supp_event_proc_disassoc(void *if_priv, - struct nrf_wifi_umac_event_mlme *disassoc, - unsigned int event_len); - -void nrf_wifi_wpa_supp_event_proc_get_sta(void *if_priv, - struct nrf_wifi_umac_event_new_station *info, - unsigned int event_len); - -void nrf_wifi_wpa_supp_event_proc_get_if(void *if_priv, - struct nrf_wifi_interface_info *info, - unsigned int event_len); - -void nrf_wifi_wpa_supp_event_mgmt_tx_status(void *if_priv, - struct nrf_wifi_umac_event_mlme *mlme_event, - unsigned int event_len); - - -void nrf_wifi_wpa_supp_event_proc_unprot_mgmt(void *if_priv, - struct nrf_wifi_umac_event_mlme *unprot_mgmt, - unsigned int event_len); - -void nrf_wifi_wpa_supp_event_get_wiphy(void *if_priv, - struct nrf_wifi_event_get_wiphy *get_wiphy, - unsigned int event_len); - -void nrf_wifi_wpa_supp_event_mgmt_rx_callbk_fn(void *if_priv, - struct nrf_wifi_umac_event_mlme *mgmt_rx_event, - unsigned int event_len); - -int nrf_wifi_supp_get_capa(void *if_priv, struct wpa_driver_capa *capa); - -void nrf_wifi_wpa_supp_event_mac_chgd(void *if_priv); -int nrf_wifi_supp_get_conn_info(void *if_priv, struct wpa_conn_info *info); - -void nrf_wifi_supp_event_proc_get_conn_info(void *os_vif_ctx, - struct nrf_wifi_umac_event_conn_info *info, - unsigned int event_len); - -#endif /* CONFIG_NRF700X_STA_MODE */ -#ifdef CONFIG_NRF700X_AP_MODE -int nrf_wifi_wpa_supp_init_ap(void *if_priv, struct wpa_driver_associate_params *params); -int nrf_wifi_wpa_supp_start_ap(void *if_priv, struct wpa_driver_ap_params *params); -int nrf_wifi_wpa_supp_change_beacon(void *if_priv, struct wpa_driver_ap_params *params); -int nrf_wifi_wpa_supp_stop_ap(void *if_priv); -int nrf_wifi_wpa_supp_deinit_ap(void *if_priv); -int nrf_wifi_wpa_supp_sta_add(void *if_priv, struct hostapd_sta_add_params *params); -int nrf_wifi_wpa_supp_sta_remove(void *if_priv, const u8 *addr); -int nrf_wifi_supp_register_mgmt_frame(void *if_priv, - u16 frame_type, size_t match_len, const u8 *match); -int nrf_wifi_wpa_supp_sta_set_flags(void *if_priv, const u8 *addr, - unsigned int total_flags, unsigned int flags_or, - unsigned int flags_and); -int nrf_wifi_wpa_supp_sta_get_inact_sec(void *if_priv, const u8 *addr); -#endif /* CONFIG_NRF700X_AP_MODE */ -#endif /* __ZEPHYR_WPA_SUPP_IF_H__ */ diff --git a/drivers/wifi/nrf700x/rpu_fw_patches.ld b/drivers/wifi/nrf700x/rpu_fw_patches.ld deleted file mode 100644 index e2a6fdd50c69..000000000000 --- a/drivers/wifi/nrf700x/rpu_fw_patches.ld +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @file - * @brief Custom Linker command/script file - * - * Custom Linker script for the Cortex-M platforms. - */ - -#include -#include - -#include -#include - -#if CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP || CONFIG_BOARD_NRF52840DK_NRF52840 -/* - * nRF53/52 series ship an external flash that can be used for XIP using QSPI/SPI. - * - * Note: In nRF7002 external flash using is accessible only using SPI but there is no - * support for XIP, so, relocation cannot be used. - */ -#if CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP -#define EXTFLASH_BASE_ADDR 0x10000000 -#define EXTFLASH_SIZE 0x800000 -#elif CONFIG_BOARD_NRF52840DK_NRF52840 -#define EXTFLASH_BASE_ADDR 0x12000000 -#define EXTFLASH_SIZE 0x800000 -#endif /* CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP */ - -#if USE_PARTITION_MANAGER && PM_EXTERNAL_FLASH_ADDRESS -#include -#define EXTFLASH_ADDRESS (EXTFLASH_BASE_ADDR + PM_EXTERNAL_FLASH_ADDRESS) -#undef EXTFLASH_SIZE -#define EXTFLASH_SIZE (PM_EXTERNAL_FLASH_SIZE) -#else -#define EXTFLASH_ADDRESS (EXTFLASH_BASE_ADDR) -#endif /* USE_PARTITION_MANAGER && PM_EXTERNAL_FLASH_ADDRESS */ - -MEMORY -{ - EXTFLASH (wx) : ORIGIN = EXTFLASH_ADDRESS, LENGTH = EXTFLASH_SIZE -} - -#endif /* CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP || CONFIG_BOARD_NRF52840DK_NRF52840 */ - -#include diff --git a/drivers/wifi/nrf700x/src/coex.c b/drivers/wifi/nrf700x/src/coex.c deleted file mode 100644 index 22313de2fa19..000000000000 --- a/drivers/wifi/nrf700x/src/coex.c +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** @file - * @brief Coexistence functions - */ - -#include -#include -#include -#include -#include - -#include "coex.h" -#include "coex_struct.h" -#include "fmac_main.h" -#include "fmac_api.h" - -LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF700X_LOG_LEVEL); - -extern struct nrf_wifi_drv_priv_zep rpu_drv_priv_zep; -static struct nrf_wifi_ctx_zep *rpu_ctx = &rpu_drv_priv_zep.rpu_ctx_zep; - -#define CH_BASE_ADDRESS ABS_EXT_SYS_WLANSYSCOEX_CH_CONTROL -#define COEX_CONFIG_FIXED_PARAMS 4 -#define COEX_REG_CFG_OFFSET_SHIFT 24 - -/* copied from uccp530_77_registers_ext_sys_bus.h of UCCP toolkit */ -#define EXT_SYS_WLANSYSCOEX_CH_CONTROL 0x0000 -#define ABS_EXT_SYS_WLANSYSCOEX_CH_CONTROL 0xA401BC00UL -#define EXT_SYS_WLANSYSCOEX_CH_TIME_REFERENCE 0x0004 -#define EXT_SYS_WLANSYSCOEX_CH_SR_INFO_STATUS 0x0040 -#define EXT_SYS_WLANSYSCOEX_CH_NO_WINDOW_LOOKUP_0 0x008C -#define EXT_SYS_WLANSYSCOEX_CH_NO_WINDOW_LOOKUP_44 0x013C -#define EXT_SYS_WLANSYSCOEX_RESET_SHIFT 0 - -/* copied from uccp530_77_registers.h of UCCP toolkit */ -#define ABS_PMB_WLAN_MAC_CTRL_PULSED_SOFTWARE_RESET 0xA5009A00UL - -#ifdef CONFIG_NRF700X_SR_COEX_RF_SWITCH - #define NRF_RADIO_COEX_NODE DT_NODELABEL(nrf_radio_coex) - static const struct gpio_dt_spec sr_rf_switch_spec = - GPIO_DT_SPEC_GET(NRF_RADIO_COEX_NODE, srrf_switch_gpios); -#endif /* CONFIG_NRF700X_SR_COEX_RF_SWITCH */ - -/* PTA registers configuration of Coexistence Hardware */ -/* Separate antenna configuration, WLAN in 2.4GHz. For BLE protocol. */ -const uint16_t config_buffer_SEA_ble[] = { - 0x0019, 0x00F6, 0x0008, 0x0062, 0x00F5, - 0x00F5, 0x0019, 0x0019, 0x0074, 0x0074, - 0x0008, 0x01E2, 0x00D5, 0x00D5, 0x01F6, - 0x01F6, 0x0061, 0x0061, 0x01E2, 0x0008, - 0x0004, 0x0004, 0x0019, 0x0019, 0x0008, - 0x0008, 0x00F5, 0x00F5, 0x00D5, 0x00D5, - 0x0008, 0x01E2, 0x0051, 0x0051, 0x0074, - 0x0074, 0x00F6, 0x0019, 0x0062, 0x0019, - 0x00F6, 0x0008, 0x0062, 0x0008, 0x001A -}; - -/* Separate antenna configuration, WLAN in 2.4GHz. For non BLE protocol */ -const uint16_t config_buffer_SEA_non_ble[] = { - 0x0019, 0x00F6, 0x0008, 0x0062, 0x00F5, - 0x00F5, 0x0061, 0x0061, 0x0074, 0x0074, - 0x01E2, 0x01E2, 0x00D5, 0x00D5, 0x01F6, - 0x01F6, 0x0061, 0x0061, 0x01E2, 0x01E2, - 0x00C4, 0x00C4, 0x0061, 0x0061, 0x0008, - 0x0008, 0x00F5, 0x00F5, 0x00D5, 0x00D5, - 0x0162, 0x0162, 0x0019, 0x0019, 0x01F6, - 0x01F6, 0x00F6, 0x0019, 0x0062, 0x0019, - 0x00F6, 0x0008, 0x0062, 0x0008, 0x001A -}; - -/* Shared antenna configuration, WLAN in 2.4GHz. */ -const uint16_t config_buffer_SHA[] = { - 0x0019, 0x00F6, 0x0008, 0x00E2, 0x0015, - 0x00F5, 0x0019, 0x0019, 0x0004, 0x01F6, - 0x0008, 0x01E2, 0x00F5, 0x00F5, 0x01F6, - 0x01F6, 0x00E1, 0x00E1, 0x01E2, 0x0008, - 0x0004, 0x0004, 0x0019, 0x0019, 0x0008, - 0x0008, 0x0015, 0x00F5, 0x00F5, 0x00F5, - 0x0008, 0x01E2, 0x00E1, 0x00E1, 0x0004, - 0x01F6, 0x00F6, 0x0019, 0x00E2, 0x0019, - 0x00F6, 0x0008, 0x00E2, 0x0008, 0x001A -}; - -/* Shared/separate antennas, WLAN in 5GHz */ -const uint16_t config_buffer_5G[] = { - 0x0039, 0x0076, 0x0028, 0x0062, 0x0075, - 0x0075, 0x0061, 0x0061, 0x0074, 0x0074, - 0x0060, 0x0060, 0x0075, 0x0075, 0x0064, - 0x0064, 0x0071, 0x0071, 0x0060, 0x0060, - 0x0064, 0x0064, 0x0061, 0x0061, 0x0060, - 0x0060, 0x0075, 0x0075, 0x0075, 0x0075, - 0x0060, 0x0060, 0x0071, 0x0071, 0x0074, - 0x0074, 0x0076, 0x0039, 0x0062, 0x0039, - 0x0076, 0x0028, 0x0062, 0x0028, 0x003A -}; - -/* non-PTA register configuration of coexistence hardware */ -/* Shared antenna */ -const uint32_t ch_config_sha[] = { - 0x00000028, 0x00000000, 0x001e1023, 0x00000000, 0x00000000, - 0x00000000, 0x00000021, 0x000002ca, 0x00000050, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000 -}; - -/* Separate antennas. For BLE protocol. */ -const uint32_t ch_config_sep_ble[] = { - 0x00000028, 0x00000000, 0x001e1023, 0x00000000, 0x00000000, - 0x00000000, 0x00000021, 0x000002ca, 0x00000055, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000 -}; - -/* Separate antennas. For non BLE protocol. */ -const uint32_t ch_config_sep_non_ble[] = { - 0x00000028, 0x00000000, 0x001e1023, 0x00000000, 0x00000000, - 0x00000000, 0x00000021, 0x000002ca, 0x00000055, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000 -}; - -int nrf_wifi_coex_config_non_pta(bool separate_antennas, bool is_sr_protocol_ble) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct coex_ch_configuration params = { 0 }; - const uint32_t *config_buffer_ptr = NULL; - uint32_t start_offset = 0; - uint32_t num_reg_to_config = 1; - uint32_t cmd_len, index; - - /* Offset from the base address of CH */ - start_offset = ((EXT_SYS_WLANSYSCOEX_CH_TIME_REFERENCE - - EXT_SYS_WLANSYSCOEX_CH_CONTROL) >> 2); - /* Number of registers to be configured */ - num_reg_to_config = ((EXT_SYS_WLANSYSCOEX_CH_SR_INFO_STATUS - - EXT_SYS_WLANSYSCOEX_CH_TIME_REFERENCE) >> 2) + 1; - - if (separate_antennas) { - if (is_sr_protocol_ble) { - config_buffer_ptr = ch_config_sep_ble; - } else { - config_buffer_ptr = ch_config_sep_non_ble; - } - } else { - config_buffer_ptr = ch_config_sha; - } - - params.message_id = HW_CONFIGURATION; - params.num_reg_to_config = num_reg_to_config; - params.hw_to_config = COEX_HARDWARE; - params.hw_block_base_addr = CH_BASE_ADDRESS; - - for (index = 0; index < num_reg_to_config; index++) { - params.configbuf[index] = (start_offset << COEX_REG_CFG_OFFSET_SHIFT) | - (*(config_buffer_ptr + index)); - start_offset++; - } - - cmd_len = (COEX_CONFIG_FIXED_PARAMS + num_reg_to_config) * sizeof(uint32_t); - status = nrf_wifi_fmac_conf_srcoex(rpu_ctx->rpu_ctx, - (void *)(¶ms), cmd_len); - if (status != NRF_WIFI_STATUS_SUCCESS) { - return -1; - } - - return 0; -} - -int nrf_wifi_coex_config_pta(enum nrf_wifi_pta_wlan_op_band wlan_band, bool separate_antennas, - bool is_sr_protocol_ble) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct coex_ch_configuration params = { 0 }; - const uint16_t *config_buffer_ptr = NULL; - uint32_t start_offset = 0; - uint32_t num_reg_to_config = 1; - uint32_t cmd_len, index; - - /* common for both SHA and SEA */ - /* Indicates offset from the base address of CH */ - start_offset = ((EXT_SYS_WLANSYSCOEX_CH_NO_WINDOW_LOOKUP_0 - - EXT_SYS_WLANSYSCOEX_CH_CONTROL) >> 2); - /* Number of contiguous registers to be configured starting from base+offset */ - num_reg_to_config = ((EXT_SYS_WLANSYSCOEX_CH_NO_WINDOW_LOOKUP_44 - - EXT_SYS_WLANSYSCOEX_CH_NO_WINDOW_LOOKUP_0) >> 2) + 1; - - if (wlan_band == NRF_WIFI_PTA_WLAN_OP_BAND_2_4_GHZ) { - /* WLAN operating in 2.4GHz */ - if (separate_antennas) { - /* separate antennas configuration */ - if (is_sr_protocol_ble) { - config_buffer_ptr = config_buffer_SEA_ble; - } else { - config_buffer_ptr = config_buffer_SEA_non_ble; - } - } else { - /* Shared antenna configuration */ - config_buffer_ptr = config_buffer_SHA; - } - } else if (wlan_band == NRF_WIFI_PTA_WLAN_OP_BAND_5_GHZ) { - /* WLAN operating in 5GHz */ - config_buffer_ptr = config_buffer_5G; - } else { - return -EINVAL; - } - - params.message_id = HW_CONFIGURATION; - params.num_reg_to_config = num_reg_to_config; - params.hw_to_config = COEX_HARDWARE; - params.hw_block_base_addr = CH_BASE_ADDRESS; - - for (index = 0; index < num_reg_to_config; index++) { - params.configbuf[index] = (start_offset << COEX_REG_CFG_OFFSET_SHIFT) | - (*(config_buffer_ptr+index)); - start_offset++; - } - - cmd_len = (COEX_CONFIG_FIXED_PARAMS + num_reg_to_config) * sizeof(uint32_t); - status = nrf_wifi_fmac_conf_srcoex(rpu_ctx->rpu_ctx, - (void *)(¶ms), cmd_len); - if (status != NRF_WIFI_STATUS_SUCCESS) { - return -1; - } - - return 0; -} -#ifdef CONFIG_NRF700X_SR_COEX_RF_SWITCH -int nrf_wifi_config_sr_switch(bool separate_antennas) -{ - int ret; - - if (!device_is_ready(sr_rf_switch_spec.port)) { - LOG_ERR("Unable to open GPIO device"); - return -ENODEV; - } - - ret = gpio_pin_configure_dt(&sr_rf_switch_spec, GPIO_OUTPUT); - if (ret < 0) { - LOG_ERR("Unable to configure GPIO device"); - return -1; - } - - if (separate_antennas) { - gpio_pin_set_dt(&sr_rf_switch_spec, 0x0); - LOG_INF("GPIO P1.10 set to 0"); - } else { - gpio_pin_set_dt(&sr_rf_switch_spec, 0x1); - LOG_INF("GPIO P1.10 set to 1"); - } - - return 0; -} -#endif /* CONFIG_NRF700X_SR_COEX_RF_SWITCH */ - -int nrf_wifi_coex_hw_reset(void) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct coex_ch_configuration params = { 0 }; - uint32_t num_reg_to_config = 1; - uint32_t start_offset = 0; - uint32_t index = 0; - uint32_t coex_hw_reset = 1; - uint32_t cmd_len; - - /* reset CH */ - params.message_id = HW_CONFIGURATION; - params.num_reg_to_config = num_reg_to_config; - params.hw_to_config = COEX_HARDWARE; - params.hw_block_base_addr = CH_BASE_ADDRESS; - - start_offset = ((EXT_SYS_WLANSYSCOEX_CH_CONTROL - EXT_SYS_WLANSYSCOEX_CH_CONTROL) >> 2); - params.configbuf[index] = (start_offset << COEX_REG_CFG_OFFSET_SHIFT) | - (coex_hw_reset << EXT_SYS_WLANSYSCOEX_RESET_SHIFT); - - cmd_len = (COEX_CONFIG_FIXED_PARAMS + num_reg_to_config) * sizeof(uint32_t); - - status = nrf_wifi_fmac_conf_srcoex(rpu_ctx->rpu_ctx, - (void *)(¶ms), cmd_len); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("CH reset configuration failed"); - return -1; - } - - return 0; -} - -#ifdef CONFIG_NRF700X_SR_COEX_RF_SWITCH -int sr_gpio_config(void) -{ - int ret; - - if (!device_is_ready(sr_rf_switch_spec.port)) { - return -ENODEV; - } - - ret = gpio_pin_configure_dt(&sr_rf_switch_spec, GPIO_OUTPUT); - if (ret) { - LOG_ERR("SR GPIO configuration failed %d", ret); - } - - return ret; -} - -int sr_gpio_remove(void) -{ - int ret; - - ret = gpio_pin_configure_dt(&sr_rf_switch_spec, GPIO_DISCONNECTED); - if (ret) { - LOG_ERR("SR GPIO remove failed %d", ret); - } - - return ret; -} - -int sr_ant_switch(unsigned int ant_switch) -{ - int ret; - - ret = gpio_pin_set_dt(&sr_rf_switch_spec, ant_switch & 0x1); - if (ret) { - LOG_ERR("SR GPIO set failed %d", ret); - } - - return ret; -} -#endif /* CONFIG_NRF700X_SR_COEX_RF_SWITCH */ diff --git a/drivers/wifi/nrf700x/src/fmac_main.c b/drivers/wifi/nrf700x/src/fmac_main.c deleted file mode 100644 index 81a5c92a0fbf..000000000000 --- a/drivers/wifi/nrf700x/src/fmac_main.c +++ /dev/null @@ -1,952 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief File containing FMAC interface specific definitions for the - * Zephyr OS layer of the Wi-Fi driver. - */ - -#include - -#include -#ifdef CONFIG_NET_L2_ETHERNET -#include -#endif -#include -#include -#include - - -#include -#include -#include "fmac_util.h" -#include - -#ifndef CONFIG_NRF700X_RADIO_TEST -#ifdef CONFIG_NRF700X_STA_MODE -#include -#include -#include -#include -#else -#include -#include -#endif /* CONFIG_WPA_SPP */ -#include - -#endif /* !CONFIG_NRF700X_RADIO_TEST */ - -#define DT_DRV_COMPAT nordic_wlan0 -LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF700X_LOG_LEVEL); - -struct nrf_wifi_drv_priv_zep rpu_drv_priv_zep; -extern const struct nrf_wifi_osal_ops nrf_wifi_os_zep_ops; - -/* 3 bytes for addreess, 3 bytes for length */ -#define MAX_PKT_RAM_TX_ALIGN_OVERHEAD 6 -#ifndef CONFIG_NRF700X_RADIO_TEST -#ifdef CONFIG_NRF700X_DATA_TX - -#define MAX_RX_QUEUES 3 - -#define MAX_TX_FRAME_SIZE \ - (CONFIG_NRF_WIFI_IFACE_MTU + NRF_WIFI_FMAC_ETH_HDR_LEN + TX_BUF_HEADROOM) -#define TOTAL_TX_SIZE \ - (CONFIG_NRF700X_MAX_TX_TOKENS * CONFIG_NRF700X_TX_MAX_DATA_SIZE) -#define TOTAL_RX_SIZE \ - (CONFIG_NRF700X_RX_NUM_BUFS * CONFIG_NRF700X_RX_MAX_DATA_SIZE) - -BUILD_ASSERT(CONFIG_NRF700X_MAX_TX_TOKENS >= 1, - "At least one TX token is required"); -BUILD_ASSERT(CONFIG_NRF700X_MAX_TX_AGGREGATION <= 15, - "Max TX aggregation is 15"); -BUILD_ASSERT(CONFIG_NRF700X_RX_NUM_BUFS >= 1, - "At least one RX buffer is required"); -BUILD_ASSERT(RPU_PKTRAM_SIZE - TOTAL_RX_SIZE >= TOTAL_TX_SIZE, - "Packet RAM overflow: not enough memory for TX"); - -BUILD_ASSERT(CONFIG_NRF700X_TX_MAX_DATA_SIZE >= MAX_TX_FRAME_SIZE, - "TX buffer size must be at least as big as the MTU and headroom"); - -static const unsigned char aggregation = 1; -static const unsigned char max_num_tx_agg_sessions = 4; -static const unsigned char max_num_rx_agg_sessions = 8; -static const unsigned char reorder_buf_size = 16; -static const unsigned char max_rxampdu_size = MAX_RX_AMPDU_SIZE_64KB; - -static const unsigned char max_tx_aggregation = CONFIG_NRF700X_MAX_TX_AGGREGATION; - -static const unsigned int rx1_num_bufs = CONFIG_NRF700X_RX_NUM_BUFS / MAX_RX_QUEUES; -static const unsigned int rx2_num_bufs = CONFIG_NRF700X_RX_NUM_BUFS / MAX_RX_QUEUES; -static const unsigned int rx3_num_bufs = CONFIG_NRF700X_RX_NUM_BUFS / MAX_RX_QUEUES; - -static const unsigned int rx1_buf_sz = CONFIG_NRF700X_RX_MAX_DATA_SIZE; -static const unsigned int rx2_buf_sz = CONFIG_NRF700X_RX_MAX_DATA_SIZE; -static const unsigned int rx3_buf_sz = CONFIG_NRF700X_RX_MAX_DATA_SIZE; - -static const unsigned char rate_protection_type; -#else -/* Reduce buffers to Scan only operation */ -static const unsigned int rx1_num_bufs = 2; -static const unsigned int rx2_num_bufs = 2; -static const unsigned int rx3_num_bufs = 2; - -static const unsigned int rx1_buf_sz = 1000; -static const unsigned int rx2_buf_sz = 1000; -static const unsigned int rx3_buf_sz = 1000; -#endif - -struct nrf_wifi_drv_priv_zep rpu_drv_priv_zep; -static K_MUTEX_DEFINE(reg_lock); - -const char *nrf_wifi_get_drv_version(void) -{ - return NRF700X_DRIVER_VERSION; -} - -/* If the interface is not Wi-Fi then errors are expected, so, fail silently */ -struct nrf_wifi_vif_ctx_zep *nrf_wifi_get_vif_ctx(struct net_if *iface) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx = &rpu_drv_priv_zep.rpu_ctx_zep; - - if (!iface || !rpu_ctx || !rpu_ctx->rpu_ctx) { - return NULL; - } - - for (int i = 0; i < ARRAY_SIZE(rpu_ctx->vif_ctx_zep); i++) { - if (rpu_ctx->vif_ctx_zep[i].zep_net_if_ctx == iface) { - vif_ctx_zep = &rpu_ctx->vif_ctx_zep[i]; - break; - } - } - - return vif_ctx_zep; -} - -void nrf_wifi_event_proc_scan_start_zep(void *if_priv, - struct nrf_wifi_umac_event_trigger_scan *scan_start_event, - unsigned int event_len) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - - vif_ctx_zep = if_priv; - - if (vif_ctx_zep->scan_type == SCAN_DISPLAY) { - return; - } - -#ifdef CONFIG_NRF700X_STA_MODE - nrf_wifi_wpa_supp_event_proc_scan_start(if_priv); -#endif /* CONFIG_NRF700X_STA_MODE */ -} - - -void nrf_wifi_event_proc_scan_done_zep(void *vif_ctx, - struct nrf_wifi_umac_event_trigger_scan *scan_done_event, - unsigned int event_len) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - - vif_ctx_zep = vif_ctx; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return; - } - - switch (vif_ctx_zep->scan_type) { -#ifdef CONFIG_NET_L2_WIFI_MGMT - case SCAN_DISPLAY: - status = nrf_wifi_disp_scan_res_get_zep(vif_ctx_zep); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_disp_scan_res_get_zep failed", __func__); - return; - } - vif_ctx_zep->scan_in_progress = false; - break; -#endif /* CONFIG_NET_L2_WIFI_MGMT */ -#ifdef CONFIG_NRF700X_STA_MODE - case SCAN_CONNECT: - nrf_wifi_wpa_supp_event_proc_scan_done(vif_ctx_zep, - scan_done_event, - event_len, - 0); - break; -#endif /* CONFIG_NRF700X_STA_MODE */ - default: - LOG_ERR("%s: Scan type = %d not supported yet", __func__, vif_ctx_zep->scan_type); - return; - } - - status = NRF_WIFI_STATUS_SUCCESS; -} - -void nrf_wifi_scan_timeout_work(struct k_work *work) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - - vif_ctx_zep = CONTAINER_OF(work, struct nrf_wifi_vif_ctx_zep, scan_timeout_work.work); - - if (!vif_ctx_zep->scan_in_progress) { - LOG_INF("%s: Scan not in progress", __func__); - return; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - -#ifdef CONFIG_NET_L2_WIFI_MGMT - if (vif_ctx_zep->disp_scan_cb) { - vif_ctx_zep->disp_scan_cb(vif_ctx_zep->zep_net_if_ctx, -ETIMEDOUT, NULL); - vif_ctx_zep->disp_scan_cb = NULL; - } else -#endif /* CONFIG_NET_L2_WIFI_MGMT */ - { -#ifdef CONFIG_NRF700X_STA_MODE - /* WPA supplicant scan */ - union wpa_event_data event; - struct scan_info *info = NULL; - - memset(&event, 0, sizeof(event)); - - info = &event.scan_info; - - info->aborted = 0; - info->external_scan = 0; - info->nl_scan_event = 1; - - if (vif_ctx_zep->supp_drv_if_ctx && - vif_ctx_zep->supp_callbk_fns.scan_done) { - vif_ctx_zep->supp_callbk_fns.scan_done(vif_ctx_zep->supp_drv_if_ctx, - &event); - } -#endif /* CONFIG_NRF700X_STA_MODE */ - } - - vif_ctx_zep->scan_in_progress = false; -} - -#ifdef CONFIG_NRF700X_STA_MODE -static void nrf_wifi_process_rssi_from_rx(void *vif_ctx, - signed short signal) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = vif_ctx; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - - vif_ctx_zep = vif_ctx; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return; - } - - fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - - vif_ctx_zep->rssi = MBM_TO_DBM(signal); - vif_ctx_zep->rssi_record_timestamp_us = - nrf_wifi_osal_time_get_curr_us(); -} -#endif /* CONFIG_NRF700X_STA_MODE */ - - -void nrf_wifi_event_get_reg_zep(void *vif_ctx, - struct nrf_wifi_reg *get_reg_event, - unsigned int event_len) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - - LOG_DBG("%s: alpha2 = %c%c", __func__, - get_reg_event->nrf_wifi_alpha2[0], - get_reg_event->nrf_wifi_alpha2[1]); - vif_ctx_zep = vif_ctx; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - - if (fmac_dev_ctx->alpha2_valid) { - LOG_ERR("%s: Unsolicited regulatory get!", __func__); - return; - } - - memcpy(&fmac_dev_ctx->alpha2, - &get_reg_event->nrf_wifi_alpha2, - sizeof(get_reg_event->nrf_wifi_alpha2)); - - fmac_dev_ctx->reg_chan_count = get_reg_event->num_channels; - memcpy(fmac_dev_ctx->reg_chan_info, - &get_reg_event->chn_info, - fmac_dev_ctx->reg_chan_count * - sizeof(struct nrf_wifi_get_reg_chn_info)); - - fmac_dev_ctx->alpha2_valid = true; -} - -int nrf_wifi_reg_domain(const struct device *dev, struct wifi_reg_domain *reg_domain) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_fmac_reg_info reg_domain_info = {0}; - struct wifi_reg_chan_info *chan_info = NULL; - struct nrf_wifi_get_reg_chn_info *reg_domain_chan_info = NULL; - int ret = -1; - int chan_idx = 0; - - k_mutex_lock(®_lock, K_FOREVER); - - if (!dev || !reg_domain) { - goto err; - } - - vif_ctx_zep = dev->data; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - goto err; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - goto err; - } - - fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - if (!fmac_dev_ctx) { - LOG_ERR("%s: fmac_dev_ctx is NULL", __func__); - goto err; - } - - if (reg_domain->oper == WIFI_MGMT_SET) { -#ifndef CONFIG_NRF700X_RADIO_TEST -#ifdef CONFIG_NRF700X_STA_MODE - /* Need to check if WPA supplicant is initialized or not. - * Must be checked when CONFIG_WPA_SUPP is enabled. - * Not applicable for RADIO_TEST or when CONFIG_WPA_SUPP is not enabled. - */ - /* It is possbile that during supplicant initialization driver may - * get the command. lock will try to ensure that supplicant - * initialization is complete. - */ - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if ((!vif_ctx_zep->supp_drv_if_ctx) || - (!wifi_nm_get_instance_iface(vif_ctx_zep->zep_net_if_ctx))) { - LOG_ERR("%s: WPA supplicant initialization not complete yet", __func__); - k_mutex_unlock(&vif_ctx_zep->vif_lock); - goto err; - } - k_mutex_unlock(&vif_ctx_zep->vif_lock); -#endif /* CONFIG_NRF700X_STA_MODE */ -#endif /* !CONFIG_NRF700X_RADIO_TEST */ - memcpy(reg_domain_info.alpha2, reg_domain->country_code, WIFI_COUNTRY_CODE_LEN); - - reg_domain_info.force = reg_domain->force; - - status = nrf_wifi_fmac_set_reg(fmac_dev_ctx, ®_domain_info); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: Failed to set regulatory domain", __func__); - goto err; - } - } else if (reg_domain->oper == WIFI_MGMT_GET) { - - if (!reg_domain->chan_info) { - LOG_ERR("%s: Invalid regulatory info (NULL)\n", __func__); - goto err; - } - - status = nrf_wifi_fmac_get_reg(fmac_dev_ctx, ®_domain_info); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: Failed to get regulatory domain", __func__); - goto err; - } - - memcpy(reg_domain->country_code, reg_domain_info.alpha2, WIFI_COUNTRY_CODE_LEN); - reg_domain->num_channels = reg_domain_info.reg_chan_count; - - for (chan_idx = 0; chan_idx < reg_domain_info.reg_chan_count; chan_idx++) { - chan_info = &(reg_domain->chan_info[chan_idx]); - reg_domain_chan_info = &(reg_domain_info.reg_chan_info[chan_idx]); - chan_info->center_frequency = reg_domain_chan_info->center_frequency; - chan_info->dfs = !!reg_domain_chan_info->dfs; - chan_info->max_power = reg_domain_chan_info->max_power; - chan_info->passive_only = !!reg_domain_chan_info->passive_channel; - chan_info->supported = !!reg_domain_chan_info->supported; - } - } else { - LOG_ERR("%s: Invalid operation: %d", __func__, reg_domain->oper); - goto err; - } - - ret = 0; -err: - k_mutex_unlock(®_lock); - return ret; -} -#ifdef CONFIG_NRF700X_STA_MODE -void nrf_wifi_event_proc_cookie_rsp(void *vif_ctx, - struct nrf_wifi_umac_event_cookie_rsp *cookie_rsp_event, - unsigned int event_len) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - - vif_ctx_zep = vif_ctx; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - - LOG_DBG("%s: cookie_rsp_event->cookie = %llx", __func__, cookie_rsp_event->cookie); - LOG_DBG("%s: host_cookie = %llx", __func__, cookie_rsp_event->host_cookie); - LOG_DBG("%s: mac_addr = %x:%x:%x:%x:%x:%x", __func__, - cookie_rsp_event->mac_addr[0], - cookie_rsp_event->mac_addr[1], - cookie_rsp_event->mac_addr[2], - cookie_rsp_event->mac_addr[3], - cookie_rsp_event->mac_addr[4], - cookie_rsp_event->mac_addr[5]); - - vif_ctx_zep->cookie_resp_received = true; - /* TODO: When supp_callbk_fns.mgmt_tx_status is implemented, add logic - * here to use the cookie and host_cookie to map requests to responses. - */ -} -#endif /* CONFIG_NRF700X_STA_MODE */ - -void reg_change_callbk_fn(void *vif_ctx, - struct nrf_wifi_event_regulatory_change *reg_change_event, - unsigned int event_len) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - - vif_ctx_zep = vif_ctx; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return; - } - - fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - if (!fmac_dev_ctx) { - LOG_ERR("%s: fmac_dev_ctx is NULL", __func__); - return; - } - - fmac_dev_ctx->reg_change = k_malloc(sizeof(struct nrf_wifi_event_regulatory_change)); - if (!fmac_dev_ctx->reg_change) { - LOG_ERR("%s: Failed to allocate memory for reg_change", __func__); - return; - } - - memcpy(fmac_dev_ctx->reg_change, - reg_change_event, - sizeof(struct nrf_wifi_event_regulatory_change)); - fmac_dev_ctx->reg_set_status = true; -} -#endif /* !CONFIG_NRF700X_RADIO_TEST */ - -void configure_tx_pwr_settings(struct nrf_wifi_tx_pwr_ctrl_params *tx_pwr_ctrl_params, - struct nrf_wifi_tx_pwr_ceil_params *tx_pwr_ceil_params) -{ - tx_pwr_ctrl_params->ant_gain_2g = CONFIG_NRF700X_ANT_GAIN_2G; - tx_pwr_ctrl_params->ant_gain_5g_band1 = CONFIG_NRF700X_ANT_GAIN_5G_BAND1; - tx_pwr_ctrl_params->ant_gain_5g_band2 = CONFIG_NRF700X_ANT_GAIN_5G_BAND2; - tx_pwr_ctrl_params->ant_gain_5g_band3 = CONFIG_NRF700X_ANT_GAIN_5G_BAND3; - tx_pwr_ctrl_params->band_edge_2g_lo_dss = CONFIG_NRF700X_BAND_2G_LOWER_EDGE_BACKOFF_DSSS; - tx_pwr_ctrl_params->band_edge_2g_lo_ht = CONFIG_NRF700X_BAND_2G_LOWER_EDGE_BACKOFF_HT; - tx_pwr_ctrl_params->band_edge_2g_lo_he = CONFIG_NRF700X_BAND_2G_LOWER_EDGE_BACKOFF_HE; - tx_pwr_ctrl_params->band_edge_2g_hi_dsss = CONFIG_NRF700X_BAND_2G_UPPER_EDGE_BACKOFF_DSSS; - tx_pwr_ctrl_params->band_edge_2g_hi_ht = CONFIG_NRF700X_BAND_2G_UPPER_EDGE_BACKOFF_HT; - tx_pwr_ctrl_params->band_edge_2g_hi_he = CONFIG_NRF700X_BAND_2G_UPPER_EDGE_BACKOFF_HE; - tx_pwr_ctrl_params->band_edge_5g_unii_1_lo_ht = - CONFIG_NRF700X_BAND_UNII_1_LOWER_EDGE_BACKOFF_HT; - tx_pwr_ctrl_params->band_edge_5g_unii_1_lo_he = - CONFIG_NRF700X_BAND_UNII_1_LOWER_EDGE_BACKOFF_HE; - tx_pwr_ctrl_params->band_edge_5g_unii_1_hi_ht = - CONFIG_NRF700X_BAND_UNII_1_UPPER_EDGE_BACKOFF_HT; - tx_pwr_ctrl_params->band_edge_5g_unii_1_hi_he = - CONFIG_NRF700X_BAND_UNII_1_UPPER_EDGE_BACKOFF_HE; - tx_pwr_ctrl_params->band_edge_5g_unii_2a_lo_ht = - CONFIG_NRF700X_BAND_UNII_2A_LOWER_EDGE_BACKOFF_HT; - tx_pwr_ctrl_params->band_edge_5g_unii_2a_lo_he = - CONFIG_NRF700X_BAND_UNII_2A_LOWER_EDGE_BACKOFF_HE; - tx_pwr_ctrl_params->band_edge_5g_unii_2a_hi_ht = - CONFIG_NRF700X_BAND_UNII_2A_UPPER_EDGE_BACKOFF_HT; - tx_pwr_ctrl_params->band_edge_5g_unii_2a_hi_he = - CONFIG_NRF700X_BAND_UNII_2A_UPPER_EDGE_BACKOFF_HE; - tx_pwr_ctrl_params->band_edge_5g_unii_2c_lo_ht = - CONFIG_NRF700X_BAND_UNII_2C_LOWER_EDGE_BACKOFF_HT; - tx_pwr_ctrl_params->band_edge_5g_unii_2c_lo_he = - CONFIG_NRF700X_BAND_UNII_2C_LOWER_EDGE_BACKOFF_HE; - tx_pwr_ctrl_params->band_edge_5g_unii_2c_hi_ht = - CONFIG_NRF700X_BAND_UNII_2C_UPPER_EDGE_BACKOFF_HT; - tx_pwr_ctrl_params->band_edge_5g_unii_2c_hi_he = - CONFIG_NRF700X_BAND_UNII_2C_UPPER_EDGE_BACKOFF_HE; - tx_pwr_ctrl_params->band_edge_5g_unii_3_lo_ht = - CONFIG_NRF700X_BAND_UNII_3_LOWER_EDGE_BACKOFF_HT; - tx_pwr_ctrl_params->band_edge_5g_unii_3_lo_he = - CONFIG_NRF700X_BAND_UNII_3_LOWER_EDGE_BACKOFF_HE; - tx_pwr_ctrl_params->band_edge_5g_unii_3_hi_ht = - CONFIG_NRF700X_BAND_UNII_3_UPPER_EDGE_BACKOFF_HT; - tx_pwr_ctrl_params->band_edge_5g_unii_3_hi_he = - CONFIG_NRF700X_BAND_UNII_3_UPPER_EDGE_BACKOFF_HE; - tx_pwr_ctrl_params->band_edge_5g_unii_4_lo_ht = - CONFIG_NRF700X_BAND_UNII_4_LOWER_EDGE_BACKOFF_HT; - tx_pwr_ctrl_params->band_edge_5g_unii_4_lo_he = - CONFIG_NRF700X_BAND_UNII_4_LOWER_EDGE_BACKOFF_HE; - tx_pwr_ctrl_params->band_edge_5g_unii_4_hi_ht = - CONFIG_NRF700X_BAND_UNII_4_UPPER_EDGE_BACKOFF_HT; - tx_pwr_ctrl_params->band_edge_5g_unii_4_hi_he = - CONFIG_NRF700X_BAND_UNII_4_UPPER_EDGE_BACKOFF_HE; - - - tx_pwr_ceil_params->max_pwr_2g_dsss = - DT_PROP(DT_NODELABEL(nrf70_tx_power_ceiling), max_pwr_2g_dsss); - - tx_pwr_ceil_params->max_pwr_2g_mcs7 = - DT_PROP(DT_NODELABEL(nrf70_tx_power_ceiling), max_pwr_2g_mcs7); - - tx_pwr_ceil_params->max_pwr_2g_mcs0 = - DT_PROP(DT_NODELABEL(nrf70_tx_power_ceiling), max_pwr_2g_mcs0); - -#ifndef CONFIG_NRF70_2_4G_ONLY - tx_pwr_ceil_params->max_pwr_5g_low_mcs7 = - DT_PROP(DT_NODELABEL(nrf70_tx_power_ceiling), max_pwr_5g_low_mcs7); - - tx_pwr_ceil_params->max_pwr_5g_mid_mcs7 = - DT_PROP(DT_NODELABEL(nrf70_tx_power_ceiling), max_pwr_5g_mid_mcs7); - - tx_pwr_ceil_params->max_pwr_5g_high_mcs7 = - DT_PROP(DT_NODELABEL(nrf70_tx_power_ceiling), max_pwr_5g_high_mcs7); - - tx_pwr_ceil_params->max_pwr_5g_low_mcs0 = - DT_PROP(DT_NODELABEL(nrf70_tx_power_ceiling), max_pwr_5g_low_mcs0); - - tx_pwr_ceil_params->max_pwr_5g_mid_mcs0 = - DT_PROP(DT_NODELABEL(nrf70_tx_power_ceiling), max_pwr_5g_mid_mcs0); - - tx_pwr_ceil_params->max_pwr_5g_high_mcs0 = - DT_PROP(DT_NODELABEL(nrf70_tx_power_ceiling), max_pwr_5g_high_mcs0); -#endif /* CONFIG_NRF70_2_4G_ONLY */ -} - -void configure_board_dep_params(struct nrf_wifi_board_params *board_params) -{ - board_params->pcb_loss_2g = CONFIG_NRF700X_PCB_LOSS_2G; -#ifndef CONFIG_NRF70_2_4G_ONLY - board_params->pcb_loss_5g_band1 = CONFIG_NRF700X_PCB_LOSS_5G_BAND1; - board_params->pcb_loss_5g_band2 = CONFIG_NRF700X_PCB_LOSS_5G_BAND2; - board_params->pcb_loss_5g_band3 = CONFIG_NRF700X_PCB_LOSS_5G_BAND3; -#endif /* CONFIG_NRF70_2_4G_ONLY */ -} - -enum nrf_wifi_status nrf_wifi_fmac_dev_add_zep(struct nrf_wifi_drv_priv_zep *drv_priv_zep) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - void *rpu_ctx = NULL; - enum op_band op_band = CONFIG_NRF_WIFI_OP_BAND; -#ifdef CONFIG_NRF_WIFI_LOW_POWER - int sleep_type = -1; - -#ifndef CONFIG_NRF700X_RADIO_TEST - sleep_type = HW_SLEEP_ENABLE; -#else - sleep_type = SLEEP_DISABLE; -#endif /* CONFIG_NRF700X_RADIO_TEST */ -#endif /* CONFIG_NRF_WIFI_LOW_POWER */ - struct nrf_wifi_tx_pwr_ctrl_params tx_pwr_ctrl_params; - struct nrf_wifi_tx_pwr_ceil_params tx_pwr_ceil_params; - struct nrf_wifi_board_params board_params; - - unsigned int fw_ver = 0; - - rpu_ctx_zep = &drv_priv_zep->rpu_ctx_zep; - - rpu_ctx_zep->drv_priv_zep = drv_priv_zep; - - rpu_ctx = nrf_wifi_fmac_dev_add(drv_priv_zep->fmac_priv, rpu_ctx_zep); - - if (!rpu_ctx) { - LOG_ERR("%s: nrf_wifi_fmac_dev_add failed", __func__); - rpu_ctx_zep = NULL; - goto err; - } - - rpu_ctx_zep->rpu_ctx = rpu_ctx; - - status = nrf_wifi_fw_load(rpu_ctx); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fw_load failed", __func__); - goto err; - } - - status = nrf_wifi_fmac_ver_get(rpu_ctx, - &fw_ver); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: FW version read failed", __func__); - goto err; - } - - LOG_DBG("Firmware (v%d.%d.%d.%d) booted successfully", - NRF_WIFI_UMAC_VER(fw_ver), - NRF_WIFI_UMAC_VER_MAJ(fw_ver), - NRF_WIFI_UMAC_VER_MIN(fw_ver), - NRF_WIFI_UMAC_VER_EXTRA(fw_ver)); - - configure_tx_pwr_settings(&tx_pwr_ctrl_params, - &tx_pwr_ceil_params); - - configure_board_dep_params(&board_params); - -#ifdef CONFIG_NRF700X_RADIO_TEST - status = nrf_wifi_fmac_dev_init_rt(rpu_ctx_zep->rpu_ctx, -#ifdef CONFIG_NRF_WIFI_LOW_POWER - sleep_type, -#endif /* CONFIG_NRF_WIFI_LOW_POWER */ - NRF_WIFI_DEF_PHY_CALIB, - op_band, - IS_ENABLED(CONFIG_NRF_WIFI_BEAMFORMING), - &tx_pwr_ctrl_params, - &tx_pwr_ceil_params, - &board_params); -#else - status = nrf_wifi_fmac_dev_init(rpu_ctx_zep->rpu_ctx, -#ifdef CONFIG_NRF_WIFI_LOW_POWER - sleep_type, -#endif /* CONFIG_NRF_WIFI_LOW_POWER */ - NRF_WIFI_DEF_PHY_CALIB, - op_band, - IS_ENABLED(CONFIG_NRF_WIFI_BEAMFORMING), - &tx_pwr_ctrl_params, - &tx_pwr_ceil_params, - &board_params); -#endif /* CONFIG_NRF700X_RADIO_TEST */ - - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_dev_init failed", __func__); - goto err; - } - - k_mutex_init(&rpu_ctx_zep->rpu_lock); - - return status; -err: - if (rpu_ctx) { -#ifdef CONFIG_NRF700X_RADIO_TEST - nrf_wifi_fmac_dev_rem_rt(rpu_ctx); -#else - nrf_wifi_fmac_dev_rem(rpu_ctx); -#endif /* CONFIG_NRF700X_RADIO_TEST */ - rpu_ctx_zep->rpu_ctx = NULL; - } - return status; -} - -enum nrf_wifi_status nrf_wifi_fmac_dev_rem_zep(struct nrf_wifi_drv_priv_zep *drv_priv_zep) -{ - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - - rpu_ctx_zep = &drv_priv_zep->rpu_ctx_zep; -#ifdef CONFIG_NRF700X_RADIO_TEST - nrf_wifi_fmac_dev_deinit_rt(rpu_ctx_zep->rpu_ctx); - nrf_wifi_fmac_dev_rem_rt(rpu_ctx_zep->rpu_ctx); -#else - nrf_wifi_fmac_dev_deinit(rpu_ctx_zep->rpu_ctx); - nrf_wifi_fmac_dev_rem(rpu_ctx_zep->rpu_ctx); -#endif /* CONFIG_NRF700X_RADIO_TEST */ - - k_free(rpu_ctx_zep->extended_capa); - rpu_ctx_zep->extended_capa = NULL; - k_free(rpu_ctx_zep->extended_capa_mask); - rpu_ctx_zep->extended_capa_mask = NULL; - - rpu_ctx_zep->rpu_ctx = NULL; - LOG_DBG("%s: FMAC device removed", __func__); - - return NRF_WIFI_STATUS_SUCCESS; -} - -static int nrf_wifi_drv_main_zep(const struct device *dev) -{ -#ifndef CONFIG_NRF700X_RADIO_TEST - struct nrf_wifi_fmac_callbk_fns callbk_fns = { 0 }; - struct nrf_wifi_data_config_params data_config = { 0 }; - struct rx_buf_pool_params rx_buf_pools[MAX_NUM_OF_RX_QUEUES]; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = dev->data; - - vif_ctx_zep->rpu_ctx_zep = &rpu_drv_priv_zep.rpu_ctx_zep; - -#ifdef CONFIG_NRF700X_DATA_TX - data_config.aggregation = aggregation; - data_config.wmm = IS_ENABLED(CONFIG_NRF_WIFI_FEAT_WMM); - data_config.max_num_tx_agg_sessions = max_num_tx_agg_sessions; - data_config.max_num_rx_agg_sessions = max_num_rx_agg_sessions; - data_config.max_tx_aggregation = max_tx_aggregation; - data_config.reorder_buf_size = reorder_buf_size; - data_config.max_rxampdu_size = max_rxampdu_size; - data_config.rate_protection_type = rate_protection_type; - callbk_fns.if_carr_state_chg_callbk_fn = nrf_wifi_if_carr_state_chg; - callbk_fns.rx_frm_callbk_fn = nrf_wifi_if_rx_frm; -#if defined(CONFIG_NRF700X_RAW_DATA_RX) || defined(CONFIG_NRF700X_PROMISC_DATA_RX) - callbk_fns.rx_sniffer_frm_callbk_fn = nrf_wifi_if_sniffer_rx_frm; -#endif /* CONFIG_NRF700X_RAW_DATA_RX || CONFIG_NRF700X_PROMISC_DATA_RX */ -#endif - rx_buf_pools[0].num_bufs = rx1_num_bufs; - rx_buf_pools[1].num_bufs = rx2_num_bufs; - rx_buf_pools[2].num_bufs = rx3_num_bufs; - rx_buf_pools[0].buf_sz = rx1_buf_sz; - rx_buf_pools[1].buf_sz = rx2_buf_sz; - rx_buf_pools[2].buf_sz = rx3_buf_sz; - -#ifdef CONFIG_NRF_WIFI_RPU_RECOVERY - callbk_fns.rpu_recovery_callbk_fn = nrf_wifi_rpu_recovery_cb; -#endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */ - callbk_fns.scan_start_callbk_fn = nrf_wifi_event_proc_scan_start_zep; - callbk_fns.scan_done_callbk_fn = nrf_wifi_event_proc_scan_done_zep; - callbk_fns.reg_change_callbk_fn = reg_change_callbk_fn; -#ifdef CONFIG_NET_L2_WIFI_MGMT - callbk_fns.disp_scan_res_callbk_fn = nrf_wifi_event_proc_disp_scan_res_zep; -#endif /* CONFIG_NET_L2_WIFI_MGMT */ -#ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS - callbk_fns.rx_bcn_prb_resp_callbk_fn = nrf_wifi_rx_bcn_prb_resp_frm; -#endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS */ -#if defined(CONFIG_NRF700X_SYSTEM_MODE) || defined(CONFIG_NRF700X_SYSTEM_WITH_RAW_MODES) - callbk_fns.set_if_callbk_fn = nrf_wifi_set_iface_event_handler; -#endif /* CONFIG_NRF700X_SYSTEM_MODE */ -#ifdef CONFIG_NRF700X_STA_MODE - callbk_fns.twt_config_callbk_fn = nrf_wifi_event_proc_twt_setup_zep; - callbk_fns.twt_teardown_callbk_fn = nrf_wifi_event_proc_twt_teardown_zep; - callbk_fns.twt_sleep_callbk_fn = nrf_wifi_event_proc_twt_sleep_zep; - callbk_fns.event_get_reg = nrf_wifi_event_get_reg_zep; - callbk_fns.event_get_ps_info = nrf_wifi_event_proc_get_power_save_info; - callbk_fns.cookie_rsp_callbk_fn = nrf_wifi_event_proc_cookie_rsp; - callbk_fns.process_rssi_from_rx = nrf_wifi_process_rssi_from_rx; - callbk_fns.scan_res_callbk_fn = nrf_wifi_wpa_supp_event_proc_scan_res; - callbk_fns.auth_resp_callbk_fn = nrf_wifi_wpa_supp_event_proc_auth_resp; - callbk_fns.assoc_resp_callbk_fn = nrf_wifi_wpa_supp_event_proc_assoc_resp; - callbk_fns.deauth_callbk_fn = nrf_wifi_wpa_supp_event_proc_deauth; - callbk_fns.disassoc_callbk_fn = nrf_wifi_wpa_supp_event_proc_disassoc; - callbk_fns.get_station_callbk_fn = nrf_wifi_wpa_supp_event_proc_get_sta; - callbk_fns.get_interface_callbk_fn = nrf_wifi_wpa_supp_event_proc_get_if; - callbk_fns.mgmt_tx_status = nrf_wifi_wpa_supp_event_mgmt_tx_status; - callbk_fns.unprot_mlme_mgmt_rx_callbk_fn = nrf_wifi_wpa_supp_event_proc_unprot_mgmt; - callbk_fns.event_get_wiphy = nrf_wifi_wpa_supp_event_get_wiphy; - callbk_fns.mgmt_rx_callbk_fn = nrf_wifi_wpa_supp_event_mgmt_rx_callbk_fn; - callbk_fns.get_conn_info_callbk_fn = nrf_wifi_supp_event_proc_get_conn_info; -#endif /* CONFIG_NRF700X_STA_MODE */ - - /* The OSAL layer needs to be initialized before any other initialization - * so that other layers (like FW IF,HW IF etc) have access to OS ops - */ - nrf_wifi_osal_init(&nrf_wifi_os_zep_ops); - - rpu_drv_priv_zep.fmac_priv = nrf_wifi_fmac_init(&data_config, - rx_buf_pools, - &callbk_fns); -#else /* !CONFIG_NRF700X_RADIO_TEST */ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - - /* The OSAL layer needs to be initialized before any other initialization - * so that other layers (like FW IF,HW IF etc) have access to OS ops - */ - nrf_wifi_osal_init(&nrf_wifi_os_zep_ops); - - rpu_drv_priv_zep.fmac_priv = nrf_wifi_fmac_init_rt(); -#endif /* CONFIG_NRF700X_RADIO_TEST */ - - if (rpu_drv_priv_zep.fmac_priv == NULL) { - LOG_ERR("%s: nrf_wifi_fmac_init failed", - __func__); - goto err; - } - -#ifdef CONFIG_NRF700X_DATA_TX - struct nrf_wifi_fmac_priv_def *def_priv = NULL; - - def_priv = wifi_fmac_priv(rpu_drv_priv_zep.fmac_priv); - def_priv->max_ampdu_len_per_token = - (RPU_PKTRAM_SIZE - (CONFIG_NRF700X_RX_NUM_BUFS * CONFIG_NRF700X_RX_MAX_DATA_SIZE)) / - CONFIG_NRF700X_MAX_TX_TOKENS; - /* Align to 4-byte */ - def_priv->max_ampdu_len_per_token &= ~0x3; - - /* Alignment overhead for size based coalesce */ - def_priv->avail_ampdu_len_per_token = - def_priv->max_ampdu_len_per_token - - (MAX_PKT_RAM_TX_ALIGN_OVERHEAD * max_tx_aggregation); -#endif /* CONFIG_NRF700X_DATA_TX */ - -#ifdef CONFIG_NRF700X_RADIO_TEST - status = nrf_wifi_fmac_dev_add_zep(&rpu_drv_priv_zep); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_dev_add_zep failed", __func__); - goto fmac_deinit; - } -#else - k_work_init_delayable(&vif_ctx_zep->scan_timeout_work, - nrf_wifi_scan_timeout_work); -#endif /* CONFIG_NRF700X_RADIO_TEST */ - - return 0; -#ifdef CONFIG_NRF700X_RADIO_TEST -fmac_deinit: - nrf_wifi_fmac_deinit_rt(rpu_drv_priv_zep.fmac_priv); - nrf_wifi_osal_deinit(); -#endif /* CONFIG_NRF700X_RADIO_TEST */ -err: - return -1; -} - -#ifndef CONFIG_NRF700X_RADIO_TEST -#ifdef CONFIG_NET_L2_WIFI_MGMT -static struct wifi_mgmt_ops nrf_wifi_mgmt_ops = { - .scan = nrf_wifi_disp_scan_zep, -#ifdef CONFIG_NET_STATISTICS_WIFI - .get_stats = nrf_wifi_stats_get, - .reset_stats = nrf_wifi_stats_reset, -#endif /* CONFIG_NET_STATISTICS_WIFI */ -#ifdef CONFIG_NRF700X_STA_MODE - .set_power_save = nrf_wifi_set_power_save, - .set_twt = nrf_wifi_set_twt, - .reg_domain = nrf_wifi_reg_domain, - .get_power_save_config = nrf_wifi_get_power_save_config, - .set_rts_threshold = nrf_wifi_set_rts_threshold, -#endif /* CONFIG_NRF700X_STA_MODE */ -#ifdef CONFIG_NRF700X_SYSTEM_WITH_RAW_MODES - .mode = nrf_wifi_mode, -#endif -#if defined(CONFIG_NRF700X_RAW_DATA_TX) || defined(CONFIG_NRF700X_RAW_DATA_RX) - .channel = nrf_wifi_channel, -#endif /* CONFIG_NRF700X_RAW_DATA_TX || CONFIG_NRF700X_RAW_DATA_RX */ -#if defined(CONFIG_NRF700X_RAW_DATA_RX) || defined(CONFIG_NRF700X_PROMISC_DATA_RX) - .filter = nrf_wifi_filter, -#endif /* CONFIG_NRF700X_RAW_DATA_RX || CONFIG_NRF700X_PROMISC_DATA_RX */ -}; -#endif /* CONFIG_NET_L2_WIFI_MGMT */ - - -#ifdef CONFIG_NET_L2_ETHERNET -static const struct net_wifi_mgmt_offload wifi_offload_ops = { - .wifi_iface.iface_api.init = nrf_wifi_if_init_zep, - .wifi_iface.start = nrf_wifi_if_start_zep, - .wifi_iface.stop = nrf_wifi_if_stop_zep, - .wifi_iface.set_config = nrf_wifi_if_set_config_zep, - .wifi_iface.get_config = nrf_wifi_if_get_config_zep, - .wifi_iface.get_capabilities = nrf_wifi_if_caps_get, - .wifi_iface.send = nrf_wifi_if_send, -#ifdef CONFIG_NET_STATISTICS_ETHERNET - .wifi_iface.get_stats = nrf_wifi_eth_stats_get, -#endif /* CONFIG_NET_STATISTICS_ETHERNET */ -#ifdef CONFIG_NET_L2_WIFI_MGMT - .wifi_mgmt_api = &nrf_wifi_mgmt_ops, -#endif /* CONFIG_NET_L2_WIFI_MGMT */ -}; -#endif /* CONFIG_NET_L2_ETHERNET */ - - -#ifdef CONFIG_NRF700X_STA_MODE -static const struct zep_wpa_supp_dev_ops wpa_supp_ops = { - .init = nrf_wifi_wpa_supp_dev_init, - .deinit = nrf_wifi_wpa_supp_dev_deinit, - .scan2 = nrf_wifi_wpa_supp_scan2, - .scan_abort = nrf_wifi_wpa_supp_scan_abort, - .get_scan_results2 = nrf_wifi_wpa_supp_scan_results_get, - .deauthenticate = nrf_wifi_wpa_supp_deauthenticate, - .authenticate = nrf_wifi_wpa_supp_authenticate, - .associate = nrf_wifi_wpa_supp_associate, - .set_supp_port = nrf_wifi_wpa_set_supp_port, - .set_key = nrf_wifi_wpa_supp_set_key, - .signal_poll = nrf_wifi_wpa_supp_signal_poll, - .send_mlme = nrf_wifi_nl80211_send_mlme, - .get_wiphy = nrf_wifi_supp_get_wiphy, - .register_frame = nrf_wifi_supp_register_frame, - .get_capa = nrf_wifi_supp_get_capa, - .get_conn_info = nrf_wifi_supp_get_conn_info, -#ifdef CONFIG_NRF700X_AP_MODE - .init_ap = nrf_wifi_wpa_supp_init_ap, - .start_ap = nrf_wifi_wpa_supp_start_ap, - .change_beacon = nrf_wifi_wpa_supp_change_beacon, - .stop_ap = nrf_wifi_wpa_supp_stop_ap, - .deinit_ap = nrf_wifi_wpa_supp_deinit_ap, - .sta_add = nrf_wifi_wpa_supp_sta_add, - .sta_remove = nrf_wifi_wpa_supp_sta_remove, - .register_mgmt_frame = nrf_wifi_supp_register_mgmt_frame, - .sta_set_flags = nrf_wifi_wpa_supp_sta_set_flags, - .get_inact_sec = nrf_wifi_wpa_supp_sta_get_inact_sec, -#endif /* CONFIG_NRF700X_AP_MODE */ -}; -#endif /* CONFIG_NRF700X_STA_MODE */ -#endif /* !CONFIG_NRF700X_RADIO_TEST */ - - -#ifdef CONFIG_NET_L2_ETHERNET -ETH_NET_DEVICE_DT_INST_DEFINE(0, - nrf_wifi_drv_main_zep, /* init_fn */ - NULL, /* pm_action_cb */ - &rpu_drv_priv_zep.rpu_ctx_zep.vif_ctx_zep[0], /* data */ -#ifdef CONFIG_NRF700X_STA_MODE - &wpa_supp_ops, /* cfg */ -#else /* CONFIG_NRF700X_STA_MODE */ - NULL, /* cfg */ -#endif /* !CONFIG_NRF700X_STA_MODE */ - CONFIG_WIFI_INIT_PRIORITY, /* prio */ - &wifi_offload_ops, /* api */ - CONFIG_NRF_WIFI_IFACE_MTU); /*mtu */ -#else -DEVICE_DT_INST_DEFINE(0, - nrf_wifi_drv_main_zep, /* init_fn */ - NULL, /* pm_action_cb */ -#ifndef CONFIG_NRF700X_RADIO_TEST - &rpu_drv_priv_zep, /* data */ -#else /* !CONFIG_NRF700X_RADIO_TEST */ - NULL, -#endif /* CONFIG_NRF700X_RADIO_TEST */ - NULL, /* cfg */ - POST_KERNEL, - CONFIG_WIFI_INIT_PRIORITY, /* prio */ - NULL); /* api */ -#endif /* CONFIG_NRF700X_STA_MODE */ - -#ifdef CONFIG_L2_WIFI_CONNECTIVITY -CONN_MGR_BIND_CONN(Z_DEVICE_DT_DEV_ID(DT_DRV_INST(0)), L2_CONN_WLAN0); -#endif /* CONFIG_L2_WIFI_CONNECTIVITY */ diff --git a/drivers/wifi/nrf700x/src/fw_load.c b/drivers/wifi/nrf700x/src/fw_load.c deleted file mode 100644 index ba6ce8424e5c..000000000000 --- a/drivers/wifi/nrf700x/src/fw_load.c +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief File containing FW load functions for Zephyr. - */ -#include -#include - -#include -#include -#if defined(CONFIG_NRF_WIFI_PATCHES_EXT_FLASH_XIP) && defined(CONFIG_NORDIC_QSPI_NOR) -#include -#endif /* CONFIG_NRF_WIFI_PATCHES_EXT_FLASH_XIP */ - -#include -#if defined(CONFIG_NRF_WIFI_PATCHES_EXT_FLASH_XIP) && defined(CONFIG_NORDIC_QSPI_NOR) -/* For NRF QSPI NOR special handling is needed for this file as all RODATA of - * this file is stored in external flash, so, any use of RODATA has to be protected - * by disabling XIP and enabling it again after use. This means no LOG_* macros - * (buffered) or buffered printk can be used in this file, else it will crash. - */ -LOG_MODULE_DECLARE(wifi_nrf, LOG_LEVEL_NONE); -#else -LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF700X_LOG_LEVEL); -#endif /* CONFIG_NRF_WIFI_PATCHES_EXT_FLASH_XIP */ - -#include - -#ifdef CONFIG_NRF_WIFI_PATCHES_BUILTIN -/* INCBIN macro Taken from https://gist.github.com/mmozeiko/ed9655cf50341553d282 */ -#define STR2(x) #x -#define STR(x) STR2(x) - -#ifdef __APPLE__ -#define USTR(x) "_" STR(x) -#else -#define USTR(x) STR(x) -#endif - -#ifdef _WIN32 -#define INCBIN_SECTION ".rdata, \"dr\"" -#elif defined __APPLE__ -#define INCBIN_SECTION "__TEXT,__const" -#else -#define INCBIN_SECTION ".rodata.*" -#endif - -/* this aligns start address to 16 and terminates byte array with explicit 0 - * which is not really needed, feel free to change it to whatever you want/need - */ -#define INCBIN(prefix, name, file) \ - __asm__(".section " INCBIN_SECTION "\n" \ - ".global " USTR(prefix) "_" STR(name) "_start\n" \ - ".balign 16\n" \ - USTR(prefix) "_" STR(name) "_start:\n" \ - ".incbin \"" file "\"\n" \ - \ - ".global " STR(prefix) "_" STR(name) "_end\n" \ - ".balign 1\n" \ - USTR(prefix) "_" STR(name) "_end:\n" \ - ".byte 0\n" \ - ); \ - extern __aligned(16) const char prefix ## _ ## name ## _start[]; \ - extern const char prefix ## _ ## name ## _end[]; - -INCBIN(_bin, nrf70_fw, STR(CONFIG_NRF_WIFI_FW_BIN)); -#endif /* CONFIG_NRF_WIFI_PATCHES_BUILTIN */ - -#ifdef CONFIG_NRF_WIFI_PATCHES_EXT_FLASH_STORE -#include -#include - -#include "hal_api.h" - -#include - -#if USE_PARTITION_MANAGER -#include -#define NRF70_FW_PATCH_ID PM_NRF70_WIFI_FW_ID -#else -#define NRF70_FW_PATCH_ID FIXED_PARTITION_ID(nrf70_fw_partition) -#endif -static const struct flash_area *fa; - -static int nrf_wifi_read_and_download_chunk(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx, - const struct flash_area *fa, - unsigned int image_id, - char *fw_chunk, - unsigned int offset, - unsigned int rpu_addr_offset, - unsigned int len) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - const struct nrf70_fw_addr_info *addr_info; - struct nrf_wifi_fmac_fw_chunk_info fw_chunk_info = { 0 }; - int err; - - LOG_DBG("Reading chunk of size %d from offset %d", len, offset); - - /* Read the chunk from Flash */ - err = flash_area_read(fa, offset, fw_chunk, len); - if (err < 0) { - LOG_ERR("Failed to read patch chunk offset:%d from flash: %d", offset, err); - goto out; - } - - switch (image_id) { - case NRF70_IMAGE_LMAC_PRI: - addr_info = &nrf70_fw_addr_info[0]; - break; - case NRF70_IMAGE_LMAC_SEC: - addr_info = &nrf70_fw_addr_info[1]; - break; - case NRF70_IMAGE_UMAC_PRI: - addr_info = &nrf70_fw_addr_info[2]; - break; - case NRF70_IMAGE_UMAC_SEC: - addr_info = &nrf70_fw_addr_info[3]; - break; - default: - LOG_ERR("Invalid image id: %d\n", image_id); - goto out; - } - - fw_chunk_info.dest_addr = addr_info->dest_addr + rpu_addr_offset; - memcpy(fw_chunk_info.id_str, addr_info->name, sizeof(addr_info->name)); - fw_chunk_info.data = fw_chunk; - fw_chunk_info.size = len; - - status = nrf_wifi_fmac_fw_chunk_load(fmac_dev_ctx, - addr_info->rpu_proc, - &fw_chunk_info); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("Failed to load patch chunk, %s", addr_info->name); - } - -out: - return status; -} - -enum nrf_wifi_status nrf_wifi_fw_load(void *rpu_ctx) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf70_fw_image_info patch_hdr; - unsigned int image_id; - int err; - unsigned int offset = 0, rpu_addr_offset; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = rpu_ctx; - unsigned int max_chunk_size = CONFIG_NRF_WIFI_FW_FLASH_CHUNK_SIZE; - char *fw_chunk = NULL; -#ifdef CONFIG_NRF_WIFI_FW_PATCH_INTEGRITY_CHECK - struct flash_area_check nrf70_fw_patch_check = { 0 }; - char *fw_patch_check_buf = NULL; -#endif /* NRF_WIFI_FW_PATCH_INTEGRITY_CHECK */ - - err = flash_area_open(NRF70_FW_PATCH_ID, &fa); - if (err < 0) { - LOG_ERR("Failed to open flash area: %d", err); - goto out; - } - - LOG_DBG("Flash area opened with size: %d, offset: %ld", fa->fa_size, fa->fa_off); - - /* Read the Header from Flash */ - err = flash_area_read(fa, 0, &patch_hdr, sizeof(patch_hdr)); - if (err < 0) { - LOG_ERR("Failed to read patch header from flash: %d", err); - goto out; - } - offset += sizeof(patch_hdr); - - status = nrf_wifi_validate_fw_header(rpu_ctx, &patch_hdr); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("Failed to validate patch header: %d", status); - goto out; - } - -#ifdef CONFIG_NRF_WIFI_FW_PATCH_INTEGRITY_CHECK - fw_patch_check_buf = k_malloc(max_chunk_size); - if (!fw_patch_check_buf) { - LOG_ERR("Failed to allocate memory for patch data size: %d", patch_hdr.len); - goto out; - } - nrf70_fw_patch_check.match = (uint8_t *)patch_hdr.hash; - nrf70_fw_patch_check.clen = patch_hdr.len; - nrf70_fw_patch_check.off = offset; - nrf70_fw_patch_check.rbuf = fw_patch_check_buf; - nrf70_fw_patch_check.rblen = max_chunk_size; - /* Check the integrity of the patch */ - err = flash_area_check_int_sha256(fa, &nrf70_fw_patch_check); - if (err < 0) { - LOG_ERR("Patch integrity check failed: %d", err); - status = NRF_WIFI_STATUS_FAIL; - k_free(fw_patch_check_buf); - goto out; - } - k_free(fw_patch_check_buf); -#endif /* NRF_WIFI_FW_PATCH_INTEGRITY_CHECK */ - - status = nrf_wifi_fmac_fw_reset(rpu_ctx); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("Failed to reset FMAC: %d", status); - goto out; - } - - fw_chunk = k_malloc(max_chunk_size); - if (!fw_chunk) { - LOG_ERR("Failed to allocate memory for patch chunk size: %d", max_chunk_size); - goto out; - } - - for (image_id = 0; image_id < patch_hdr.num_images; image_id++) { - struct nrf70_fw_image image; - unsigned int num_chunks; - unsigned int chunk_id; - - rpu_addr_offset = 0; - - /* Read sub-header */ - err = flash_area_read(fa, offset, &image, sizeof(image)); - if (err < 0) { - LOG_ERR("Failed to read patch image from flash: %d", err); - goto out; - } - offset += sizeof(image); - - num_chunks = image.len / max_chunk_size + - (image.len % max_chunk_size ? 1 : 0); - LOG_DBG("Processing image %d, len: %d, num_chunks: %d", - image_id, image.len, num_chunks); - for (chunk_id = 0; chunk_id < num_chunks; chunk_id++) { - unsigned int chunk_size = image.len - chunk_id * max_chunk_size; - - if (chunk_size > max_chunk_size) { - chunk_size = max_chunk_size; - } - - LOG_DBG("Processing chunk %d-%d, size: %d", image_id, chunk_id, chunk_size); - status = nrf_wifi_read_and_download_chunk(fmac_dev_ctx, - fa, image_id, fw_chunk, offset, rpu_addr_offset, - chunk_size); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("Failed to read and download patch %d-%d", - image_id, chunk_id); - goto out; - } - offset += chunk_size; - rpu_addr_offset += chunk_size; - } - } - - status = nrf_wifi_fmac_fw_boot(rpu_ctx); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("Failed to boot FMAC: %d", status); - goto out; - } - -out: - if (fw_chunk) { - k_free(fw_chunk); - } - flash_area_close(fa); - return status; -} -#else -enum nrf_wifi_status nrf_wifi_fw_load(void *rpu_ctx) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_fmac_fw_info fw_info = { 0 }; -#if defined(CONFIG_NRF_WIFI_PATCHES_EXT_FLASH_XIP) && defined(CONFIG_NORDIC_QSPI_NOR) - const struct device *flash_dev = DEVICE_DT_GET(DT_INST(0, nordic_qspi_nor)); -#endif /* CONFIG_NRF_WIFI_PATCHES_EXT_FLASH_XIP */ - uint8_t *fw_start; - uint8_t *fw_end; - - fw_start = (uint8_t *)_bin_nrf70_fw_start; - fw_end = (uint8_t *)_bin_nrf70_fw_end; - -#if defined(CONFIG_NRF_WIFI_PATCHES_EXT_FLASH_XIP) && defined(CONFIG_NORDIC_QSPI_NOR) - nrf_qspi_nor_xip_enable(flash_dev, true); -#endif /* CONFIG_NRF_WIFI */ - - status = nrf_wifi_fmac_fw_parse(rpu_ctx, fw_start, fw_end - fw_start, - &fw_info); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_fw_parse failed", __func__); - return status; - } - /* Load the FW patches to the RPU */ - status = nrf_wifi_fmac_fw_load(rpu_ctx, &fw_info); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_fw_load failed", __func__); - } - -#if defined(CONFIG_NRF_WIFI_PATCHES_EXT_FLASH_XIP) && defined(CONFIG_NORDIC_QSPI_NOR) - nrf_qspi_nor_xip_enable(flash_dev, false); -#endif /* CONFIG_NRF_WIFI */ - - return status; -} -#endif /* NRF_WIFI_PATCHES_EXT_FLASH_STORE */ diff --git a/drivers/wifi/nrf700x/src/net_if.c b/drivers/wifi/nrf700x/src/net_if.c deleted file mode 100644 index 28173824b84a..000000000000 --- a/drivers/wifi/nrf700x/src/net_if.c +++ /dev/null @@ -1,1239 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief File containing netowrk stack interface specific definitions for the - * Zephyr OS layer of the Wi-Fi driver. - */ - -#include - -#ifdef CONFIG_WIFI_RANDOM_MAC_ADDRESS -#include -#endif - -#include -LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF700X_LOG_LEVEL); - -#include "net_private.h" - -#include "util.h" -#include "fmac_api.h" -#include "fmac_util.h" -#include "shim.h" -#include "fmac_main.h" -#include "wpa_supp_if.h" -#include "net_if.h" - -extern char *net_sprint_ll_addr_buf(const uint8_t *ll, uint8_t ll_len, - char *buf, int buflen); - -#ifdef CONFIG_NRF700X_STA_MODE -static struct net_mgmt_event_callback ip_maddr4_cb; -static struct net_mgmt_event_callback ip_maddr6_cb; -#endif /* CONFIG_NRF700X_STA_MODE */ - -void nrf_wifi_set_iface_event_handler(void *os_vif_ctx, - struct nrf_wifi_umac_event_set_interface *event, - unsigned int event_len) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - - if (!os_vif_ctx) { - LOG_ERR("%s: Invalid parameters", - __func__); - goto out; - } - - if (!event) { - LOG_ERR("%s: event is NULL", - __func__); - goto out; - } - - (void)event_len; - - vif_ctx_zep = os_vif_ctx; - - vif_ctx_zep->set_if_event_received = true; - vif_ctx_zep->set_if_status = event->return_value; - -out: - return; -} - -#ifdef CONFIG_NRF_WIFI_RPU_RECOVERY -static void nrf_wifi_rpu_recovery_work_handler(struct k_work *work) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = CONTAINER_OF(work, - struct nrf_wifi_vif_ctx_zep, - nrf_wifi_rpu_recovery_work); - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return; - } - - if (!vif_ctx_zep->zep_net_if_ctx) { - LOG_ERR("%s: zep_net_if_ctx is NULL", __func__); - return; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep || !rpu_ctx_zep->rpu_ctx) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return; - } - - k_mutex_lock(&rpu_ctx_zep->rpu_lock, K_FOREVER); - LOG_DBG("%s: Bringing the interface down", __func__); - /* This indirectly does a cold-boot of RPU */ - net_if_down(vif_ctx_zep->zep_net_if_ctx); - k_msleep(CONFIG_NRF_WIFI_RPU_RECOVERY_PROPAGATION_DELAY_MS); - LOG_DBG("%s: Bringing the interface up", __func__); - net_if_up(vif_ctx_zep->zep_net_if_ctx); - k_mutex_unlock(&rpu_ctx_zep->rpu_lock); -} - -void nrf_wifi_rpu_recovery_cb(void *vif_ctx_handle, - void *event_data, - unsigned int event_len) -{ - struct nrf_wifi_fmac_vif_ctx *vif_ctx = vif_ctx_handle; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - struct nrf_wifi_fmac_dev_ctx_def *def_dev_ctx = NULL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - - if (!vif_ctx) { - LOG_ERR("%s: vif_ctx is NULL", - __func__); - goto out; - } - - fmac_dev_ctx = vif_ctx->fmac_dev_ctx; - def_dev_ctx = wifi_dev_priv(fmac_dev_ctx); - if (!def_dev_ctx) { - LOG_ERR("%s: def_dev_ctx is NULL", - __func__); - goto out; - } - - vif_ctx_zep = vif_ctx->os_vif_ctx; - (void)event_data; - - k_work_submit(&vif_ctx_zep->nrf_wifi_rpu_recovery_work); -out: - return; -} -#endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */ - -#ifdef CONFIG_NRF700X_DATA_TX -static void nrf_wifi_net_iface_work_handler(struct k_work *work) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = CONTAINER_OF(work, - struct nrf_wifi_vif_ctx_zep, - nrf_wifi_net_iface_work); - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return; - } - - if (!vif_ctx_zep->zep_net_if_ctx) { - LOG_ERR("%s: zep_net_if_ctx is NULL", __func__); - return; - } - - if (vif_ctx_zep->if_carr_state == NRF_WIFI_FMAC_IF_CARR_STATE_ON) { - net_if_dormant_off(vif_ctx_zep->zep_net_if_ctx); - } else if (vif_ctx_zep->if_carr_state == NRF_WIFI_FMAC_IF_CARR_STATE_OFF) { - net_if_dormant_on(vif_ctx_zep->zep_net_if_ctx); - } -} - -#if defined(CONFIG_NRF700X_RAW_DATA_RX) || defined(CONFIG_NRF700X_PROMISC_DATA_RX) -void nrf_wifi_if_sniffer_rx_frm(void *os_vif_ctx, void *frm, - struct raw_rx_pkt_header *raw_rx_hdr, - bool pkt_free) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = os_vif_ctx; - struct net_if *iface = vif_ctx_zep->zep_net_if_ctx; - struct net_pkt *pkt; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - struct nrf_wifi_fmac_dev_ctx_def *def_dev_ctx = NULL; - int ret; - - def_dev_ctx = wifi_dev_priv(fmac_dev_ctx); - - pkt = net_raw_pkt_from_nbuf(iface, frm, sizeof(struct raw_rx_pkt_header), - raw_rx_hdr, - pkt_free); - if (!pkt) { - LOG_DBG("Failed to allocate net_pkt"); - return; - } - - net_capture_pkt(iface, pkt); - - ret = net_recv_data(iface, pkt); - if (ret < 0) { - LOG_DBG("RCV Packet dropped by NET stack: %d", ret); - net_pkt_unref(pkt); - } -} -#endif /* CONFIG_NRF700X_RAW_DATA_RX || CONFIG_NRF700X_PROMISC_DATA_RX */ - -void nrf_wifi_if_rx_frm(void *os_vif_ctx, void *frm) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = os_vif_ctx; - struct net_if *iface = vif_ctx_zep->zep_net_if_ctx; - struct net_pkt *pkt; - int status; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - struct nrf_wifi_fmac_dev_ctx_def *def_dev_ctx = NULL; - struct rpu_host_stats *host_stats = NULL; - - def_dev_ctx = wifi_dev_priv(fmac_dev_ctx); - host_stats = &def_dev_ctx->host_stats; - host_stats->total_rx_pkts++; - - pkt = net_pkt_from_nbuf(iface, frm); - if (!pkt) { - LOG_DBG("Failed to allocate net_pkt"); - host_stats->total_rx_drop_pkts++; - return; - } - - status = net_recv_data(iface, pkt); - - if (status < 0) { - LOG_DBG("RCV Packet dropped by NET stack: %d", status); - host_stats->total_rx_drop_pkts++; - net_pkt_unref(pkt); - } -} - -enum nrf_wifi_status nrf_wifi_if_carr_state_chg(void *os_vif_ctx, - enum nrf_wifi_fmac_if_carr_state carr_state) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - - if (!os_vif_ctx) { - LOG_ERR("%s: Invalid parameters", - __func__); - goto out; - } - - vif_ctx_zep = os_vif_ctx; - - vif_ctx_zep->if_carr_state = carr_state; - - LOG_DBG("%s: Carrier state: %d", __func__, carr_state); - - k_work_submit(&vif_ctx_zep->nrf_wifi_net_iface_work); - - status = NRF_WIFI_STATUS_SUCCESS; - -out: - return status; -} - -static bool is_eapol(struct net_pkt *pkt) -{ - struct net_eth_hdr *hdr; - uint16_t ethertype; - - hdr = NET_ETH_HDR(pkt); - ethertype = ntohs(hdr->type); - - return ethertype == NET_ETH_PTYPE_EAPOL; -} -#endif /* CONFIG_NRF700X_DATA_TX */ - -enum ethernet_hw_caps nrf_wifi_if_caps_get(const struct device *dev) -{ - enum ethernet_hw_caps caps = (ETHERNET_LINK_10BASE_T | - ETHERNET_LINK_100BASE_T | ETHERNET_LINK_1000BASE_T); - -#ifdef CONFIG_NRF700X_TCP_IP_CHECKSUM_OFFLOAD - caps |= ETHERNET_HW_TX_CHKSUM_OFFLOAD | - ETHERNET_HW_RX_CHKSUM_OFFLOAD; -#endif /* CONFIG_NRF700X_TCP_IP_CHECKSUM_OFFLOAD */ - -#ifdef CONFIG_NRF700X_RAW_DATA_TX - caps |= ETHERNET_TXINJECTION_MODE; -#endif -#ifdef CONFIG_NRF700X_PROMISC_DATA_RX - caps |= ETHERNET_PROMISC_MODE; -#endif - return caps; -} - -int nrf_wifi_if_send(const struct device *dev, - struct net_pkt *pkt) -{ - int ret = -1; -#ifdef CONFIG_NRF700X_DATA_TX - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx_def *def_dev_ctx = NULL; - struct rpu_host_stats *host_stats = NULL; - void *nbuf = NULL; - - if (!dev || !pkt) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - goto out; - } - - vif_ctx_zep = dev->data; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - goto out; - } - - ret = k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (ret != 0) { - LOG_ERR("%s: Failed to lock vif_lock", __func__); - goto out; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep || !rpu_ctx_zep->rpu_ctx) { - goto unlock; - } - - def_dev_ctx = wifi_dev_priv(rpu_ctx_zep->rpu_ctx); - host_stats = &def_dev_ctx->host_stats; - nbuf = net_pkt_to_nbuf(pkt); - if (!nbuf) { - LOG_DBG("Failed to allocate net_pkt"); - host_stats->total_tx_drop_pkts++; - goto out; - } - -#ifdef CONFIG_NRF700X_RAW_DATA_TX - if ((*(unsigned int *)pkt->frags->data) == NRF_WIFI_MAGIC_NUM_RAWTX) { - if (vif_ctx_zep->if_carr_state != NRF_WIFI_FMAC_IF_CARR_STATE_ON) { - goto unlock; - } - - ret = nrf_wifi_fmac_start_rawpkt_xmit(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - nbuf); - } else { -#endif /* CONFIG_NRF700X_RAW_DATA_TX */ - if ((vif_ctx_zep->if_carr_state != NRF_WIFI_FMAC_IF_CARR_STATE_ON) || - (!vif_ctx_zep->authorized && !is_eapol(pkt))) { - goto unlock; - } - - ret = nrf_wifi_fmac_start_xmit(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - nbuf); -#ifdef CONFIG_NRF700X_RAW_DATA_TX - } -#endif /* CONFIG_NRF700X_RAW_DATA_TX */ -unlock: - k_mutex_unlock(&vif_ctx_zep->vif_lock); -#else - ARG_UNUSED(dev); - ARG_UNUSED(pkt); - goto out; -#endif /* CONFIG_NRF700X_DATA_TX */ - -out: - return ret; -} - -#ifdef CONFIG_NRF700X_STA_MODE -static void ip_maddr_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, - struct net_if *iface) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct net_eth_addr mac_addr; - struct nrf_wifi_umac_mcast_cfg *mcast_info = NULL; - enum nrf_wifi_status status; - uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - int ret; - - if (mgmt_event != NET_EVENT_IPV4_MADDR_ADD && - mgmt_event != NET_EVENT_IPV4_MADDR_DEL && - mgmt_event != NET_EVENT_IPV6_MADDR_ADD && - mgmt_event != NET_EVENT_IPV6_MADDR_DEL) { - return; - } - - vif_ctx_zep = nrf_wifi_get_vif_ctx(iface); - if (!vif_ctx_zep) { - return; - } - - ret = k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (ret != 0) { - LOG_ERR("%s: Failed to lock vif_lock", __func__); - goto out; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep || !rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: rpu_ctx_zep or rpu_ctx is NULL", - __func__); - goto unlock; - } - - mcast_info = k_calloc(sizeof(*mcast_info), sizeof(char)); - - if (!mcast_info) { - LOG_ERR("%s: Unable to allocate memory of size %d " - "for mcast_info", __func__, sizeof(*mcast_info)); - return; - } - - if ((mgmt_event == NET_EVENT_IPV4_MADDR_ADD) || - (mgmt_event == NET_EVENT_IPV4_MADDR_DEL)) { - if ((cb->info == NULL) || - (cb->info_length != sizeof(struct in_addr))) { - goto unlock; - } - - net_eth_ipv4_mcast_to_mac_addr((const struct in_addr *)cb->info, - &mac_addr); - - if (mgmt_event == NET_EVENT_IPV4_MADDR_ADD) { - mcast_info->type = MCAST_ADDR_ADD; - } else { - mcast_info->type = MCAST_ADDR_DEL; - } - - } else if ((mgmt_event == NET_EVENT_IPV6_MADDR_ADD) || - (mgmt_event == NET_EVENT_IPV6_MADDR_DEL)) { - if ((cb->info == NULL) || - (cb->info_length != sizeof(struct in6_addr))) { - goto unlock; - } - - net_eth_ipv6_mcast_to_mac_addr( - (const struct in6_addr *)cb->info, - &mac_addr); - - if (mgmt_event == NET_EVENT_IPV6_MADDR_ADD) { - mcast_info->type = MCAST_ADDR_ADD; - } else { - mcast_info->type = MCAST_ADDR_DEL; - } - } - - memcpy(((char *)(mcast_info->mac_addr)), - &mac_addr, - NRF_WIFI_ETH_ADDR_LEN); - - status = nrf_wifi_fmac_set_mcast_addr(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - mcast_info); - - if (status == NRF_WIFI_STATUS_FAIL) { - LOG_ERR("%s: nrf_wifi_fmac_set_multicast failed for" - " mac addr=%s", - __func__, - net_sprint_ll_addr_buf(mac_addr.addr, - WIFI_MAC_ADDR_LEN, mac_string_buf, - sizeof(mac_string_buf))); - } -unlock: - k_mutex_unlock(&vif_ctx_zep->vif_lock); -out: - k_free(mcast_info); -} -#endif /* CONFIG_NRF700X_STA_MODE */ - -#ifdef CONFIG_WIFI_FIXED_MAC_ADDRESS_ENABLED -BUILD_ASSERT(sizeof(CONFIG_WIFI_FIXED_MAC_ADDRESS) - 1 == ((WIFI_MAC_ADDR_LEN * 2) + 5), - "Invalid fixed MAC address length"); -#endif - -enum nrf_wifi_status nrf_wifi_get_mac_addr(struct nrf_wifi_vif_ctx_zep *vif_ctx_zep) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - int ret; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", - __func__); - goto out; - } - - ret = k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (ret != 0) { - LOG_ERR("%s: Failed to lock vif_lock", __func__); - goto out; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep || !rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: rpu_ctx_zep or rpu_ctx is NULL", - __func__); - goto unlock; - } - - fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - -#ifdef CONFIG_WIFI_FIXED_MAC_ADDRESS_ENABLED - char fixed_mac_addr[WIFI_MAC_ADDR_LEN]; - - ret = net_bytes_from_str(fixed_mac_addr, - WIFI_MAC_ADDR_LEN, - CONFIG_WIFI_FIXED_MAC_ADDRESS); - if (ret < 0) { - LOG_ERR("%s: Failed to parse MAC address: %s", - __func__, - CONFIG_WIFI_FIXED_MAC_ADDRESS); - goto unlock; - } - - memcpy(vif_ctx_zep->mac_addr.addr, - fixed_mac_addr, - WIFI_MAC_ADDR_LEN); -#elif CONFIG_WIFI_RANDOM_MAC_ADDRESS - char random_mac_addr[WIFI_MAC_ADDR_LEN]; - - sys_rand_get(random_mac_addr, WIFI_MAC_ADDR_LEN); - random_mac_addr[0] = (random_mac_addr[0] & UNICAST_MASK) | LOCAL_BIT; - - memcpy(vif_ctx_zep->mac_addr.addr, - random_mac_addr, - WIFI_MAC_ADDR_LEN); -#elif CONFIG_WIFI_OTP_MAC_ADDRESS - status = nrf_wifi_fmac_otp_mac_addr_get(fmac_dev_ctx, - vif_ctx_zep->vif_idx, - vif_ctx_zep->mac_addr.addr); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: Fetching of MAC address from OTP failed", - __func__); - goto unlock; - } -#endif - - if (!nrf_wifi_utils_is_mac_addr_valid(vif_ctx_zep->mac_addr.addr)) { - LOG_ERR("%s: Invalid MAC address: %s", - __func__, - net_sprint_ll_addr(vif_ctx_zep->mac_addr.addr, - WIFI_MAC_ADDR_LEN)); - status = NRF_WIFI_STATUS_FAIL; - memset(vif_ctx_zep->mac_addr.addr, - 0, - WIFI_MAC_ADDR_LEN); - goto unlock; - } - status = NRF_WIFI_STATUS_SUCCESS; -unlock: - k_mutex_unlock(&vif_ctx_zep->vif_lock); -out: - return status; -} - -void nrf_wifi_if_init_zep(struct net_if *iface) -{ - const struct device *dev = NULL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct ethernet_context *eth_ctx = net_if_l2_data(iface); - - if (!iface) { - LOG_ERR("%s: Invalid parameters", - __func__); - return; - } - - dev = net_if_get_device(iface); - - if (!dev) { - LOG_ERR("%s: Invalid dev", - __func__); - return; - } - - vif_ctx_zep = dev->data; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", - __func__); - return; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", - __func__); - return; - } - - vif_ctx_zep->zep_net_if_ctx = iface; - vif_ctx_zep->zep_dev_ctx = dev; - - eth_ctx->eth_if_type = L2_ETH_IF_TYPE_WIFI; - ethernet_init(iface); - net_eth_carrier_on(iface); - net_if_dormant_on(iface); - -#ifdef CONFIG_NRF700X_STA_MODE - net_mgmt_init_event_callback(&ip_maddr4_cb, - ip_maddr_event_handler, - NET_EVENT_IPV4_MADDR_ADD | NET_EVENT_IPV4_MADDR_DEL); - net_mgmt_add_event_callback(&ip_maddr4_cb); - - net_mgmt_init_event_callback(&ip_maddr6_cb, - ip_maddr_event_handler, - NET_EVENT_IPV6_MADDR_ADD | NET_EVENT_IPV6_MADDR_DEL); - net_mgmt_add_event_callback(&ip_maddr6_cb); -#endif /* CONFIG_NRF700X_STA_MODE */ -#ifdef CONFIG_NRF700X_DATA_TX - k_work_init(&vif_ctx_zep->nrf_wifi_net_iface_work, - nrf_wifi_net_iface_work_handler); -#endif /* CONFIG_NRF700X_DATA_TX */ - -#ifdef CONFIG_NRF_WIFI_RPU_RECOVERY - k_work_init(&vif_ctx_zep->nrf_wifi_rpu_recovery_work, - nrf_wifi_rpu_recovery_work_handler); -#endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */ - -#if !defined(CONFIG_NRF_WIFI_IF_AUTO_START) - net_if_flag_set(iface, NET_IF_NO_AUTO_START); -#endif /* CONFIG_NRF_WIFI_IF_AUTO_START */ - net_if_flag_set(iface, NET_IF_NO_TX_LOCK); - - return; -} - -/* Board-specific Wi-Fi startup code to run before the Wi-Fi device is started */ -__weak int nrf_wifi_if_zep_start_board(const struct device *dev) -{ - ARG_UNUSED(dev); - return 0; -} - -/* Board-specific Wi-Fi shutdown code to run after the Wi-Fi device is stopped */ -__weak int nrf_wifi_if_zep_stop_board(const struct device *dev) -{ - ARG_UNUSED(dev); - return 0; -} - -int nrf_wifi_if_start_zep(const struct device *dev) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - struct nrf_wifi_umac_chg_vif_state_info vif_info; - struct nrf_wifi_umac_add_vif_info add_vif_info; - char *mac_addr = NULL; - unsigned int mac_addr_len = 0; - int ret = -1; - bool fmac_dev_added = false; - - if (!dev) { - LOG_ERR("%s: Invalid parameters", - __func__); - goto out; - } - - if (!device_is_ready(dev)) { - LOG_ERR("%s: Device %s is not ready", - __func__, dev->name); - goto out; - } - - ret = nrf_wifi_if_zep_start_board(dev); - if (ret) { - LOG_ERR("nrf_wifi_if_zep_start_board failed with error: %d", - ret); - goto out; - } - - vif_ctx_zep = dev->data; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", - __func__); - goto out; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", - __func__); - goto out; - } - - ret = k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (ret != 0) { - LOG_ERR("%s: Failed to lock vif_lock", __func__); - goto out; - } - - if (!rpu_ctx_zep->rpu_ctx) { - status = nrf_wifi_fmac_dev_add_zep(&rpu_drv_priv_zep); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_dev_add_zep failed", - __func__); - goto out; - } - fmac_dev_added = true; - LOG_DBG("%s: FMAC device added", __func__); - } - - fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - - memset(&add_vif_info, - 0, - sizeof(add_vif_info)); - - /* TODO: This should be configurable */ - add_vif_info.iftype = NRF_WIFI_IFTYPE_STATION; - - memcpy(add_vif_info.ifacename, - dev->name, - strlen(dev->name)); - - vif_ctx_zep->vif_idx = nrf_wifi_fmac_add_vif(fmac_dev_ctx, - vif_ctx_zep, - &add_vif_info); - if (vif_ctx_zep->vif_idx >= MAX_NUM_VIFS) { - LOG_ERR("%s: FMAC returned invalid interface index", - __func__); - goto dev_rem; - } - - k_mutex_init(&vif_ctx_zep->vif_lock); - rpu_ctx_zep->vif_ctx_zep[vif_ctx_zep->vif_idx].if_type = - add_vif_info.iftype; - - /* Check if user has provided a valid MAC address, if not - * fetch it from OTP. - */ - mac_addr = net_if_get_link_addr(vif_ctx_zep->zep_net_if_ctx)->addr; - mac_addr_len = net_if_get_link_addr(vif_ctx_zep->zep_net_if_ctx)->len; - - if (!nrf_wifi_utils_is_mac_addr_valid(mac_addr)) { - status = nrf_wifi_get_mac_addr(vif_ctx_zep); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: Failed to get MAC address", - __func__); - goto del_vif; - } - net_if_set_link_addr(vif_ctx_zep->zep_net_if_ctx, - vif_ctx_zep->mac_addr.addr, - WIFI_MAC_ADDR_LEN, - NET_LINK_ETHERNET); - mac_addr = vif_ctx_zep->mac_addr.addr; - mac_addr_len = WIFI_MAC_ADDR_LEN; - } - - status = nrf_wifi_fmac_set_vif_macaddr(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - mac_addr); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: MAC address change failed", - __func__); - goto del_vif; - } - - memset(&vif_info, - 0, - sizeof(vif_info)); - - vif_info.state = NRF_WIFI_FMAC_IF_OP_STATE_UP; - vif_info.if_index = vif_ctx_zep->vif_idx; - - memcpy(vif_ctx_zep->ifname, - dev->name, - strlen(dev->name)); - - status = nrf_wifi_fmac_chg_vif_state(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - &vif_info); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_chg_vif_state failed", - __func__); - goto del_vif; - } - -#ifdef CONFIG_NRF700X_STA_MODE - nrf_wifi_wpa_supp_event_mac_chgd(vif_ctx_zep); - -#ifdef CONFIG_NRF_WIFI_LOW_POWER - status = nrf_wifi_fmac_set_power_save(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - NRF_WIFI_PS_ENABLED); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_set_power_save failed", - __func__); - goto dev_rem; - } -#endif /* CONFIG_NRF_WIFI_LOW_POWER */ -#endif /* CONFIG_NRF700X_STA_MODE */ - - vif_ctx_zep->if_op_state = NRF_WIFI_FMAC_IF_OP_STATE_UP; - - ret = 0; - - goto out; -del_vif: - status = nrf_wifi_fmac_del_vif(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_del_vif failed", - __func__); - } -dev_rem: - /* Free only if we added above i.e., for 1st VIF */ - if (fmac_dev_added) { - nrf_wifi_fmac_dev_rem_zep(&rpu_drv_priv_zep); - } -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - - -int nrf_wifi_if_stop_zep(const struct device *dev) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_umac_chg_vif_state_info vif_info; - int ret = -1; - - if (!dev) { - LOG_ERR("%s: Invalid parameters", - __func__); - goto out; - } - - vif_ctx_zep = dev->data; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", - __func__); - goto out; - } - - ret = k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (ret != 0) { - LOG_ERR("%s: Failed to lock vif_lock", __func__); - goto out; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", - __func__); - goto out; - } - -#ifdef CONFIG_NRF700X_STA_MODE -#ifdef CONFIG_NRF_WIFI_LOW_POWER - status = nrf_wifi_fmac_set_power_save(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - NRF_WIFI_PS_DISABLED); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_set_power_save failed", - __func__); - goto unlock; - } -#endif /* CONFIG_NRF_WIFI_LOW_POWER */ -#endif /* CONFIG_NRF700X_STA_MODE */ - - memset(&vif_info, - 0, - sizeof(vif_info)); - - vif_info.state = NRF_WIFI_FMAC_IF_OP_STATE_DOWN; - vif_info.if_index = vif_ctx_zep->vif_idx; - - status = nrf_wifi_fmac_chg_vif_state(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - &vif_info); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_chg_vif_state failed", - __func__); - goto unlock; - } - - status = nrf_wifi_fmac_del_vif(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_del_vif failed", - __func__); - goto unlock; - } - - vif_ctx_zep->if_op_state = NRF_WIFI_FMAC_IF_OP_STATE_DOWN; - - if (nrf_wifi_fmac_get_num_vifs(rpu_ctx_zep->rpu_ctx) == 0) { - nrf_wifi_fmac_dev_rem_zep(&rpu_drv_priv_zep); - } - ret = 0; -unlock: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - - ret = nrf_wifi_if_zep_stop_board(dev); - if (ret) { - LOG_ERR("nrf_wifi_if_zep_stop_board failed with error: %d", - ret); - } -out: - return ret; -} - -int nrf_wifi_if_get_config_zep(const struct device *dev, - enum ethernet_config_type type, - struct ethernet_config *config) -{ - int ret = -1; -#ifdef CONFIG_NRF700X_RAW_DATA_TX - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - struct nrf_wifi_fmac_dev_ctx_def *def_dev_ctx = NULL; - - if (!dev || !config) { - LOG_ERR("%s: Invalid parameters", - __func__); - goto out; - } - - vif_ctx_zep = dev->data; - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", - __func__); - goto out; - } - - ret = k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (ret != 0) { - LOG_ERR("%s: Failed to lock vif_lock", __func__); - goto out; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep || !rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: rpu_ctx_zep or rpu_ctx is NULL", - __func__); - goto unlock; - } - fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - def_dev_ctx = wifi_dev_priv(fmac_dev_ctx); - if (!def_dev_ctx) { - LOG_ERR("%s: def_dev_ctx is NULL", - __func__); - goto unlock; - } - - if (type == ETHERNET_CONFIG_TYPE_TXINJECTION_MODE) { - config->txinjection_mode = - def_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx]->txinjection_mode; - } - ret = 0; -unlock: - k_mutex_unlock(&vif_ctx_zep->vif_lock); -out: -#endif - return ret; -} - -int nrf_wifi_if_set_config_zep(const struct device *dev, - enum ethernet_config_type type, - const struct ethernet_config *config) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - struct nrf_wifi_fmac_dev_ctx_def *def_dev_ctx = NULL; - int ret = -1; - - if (!dev) { - LOG_ERR("%s: Invalid parameters", - __func__); - goto out; - } - - vif_ctx_zep = dev->data; - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", - __func__); - goto out; - } - - ret = k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (ret != 0) { - LOG_ERR("%s: Failed to lock vif_lock", __func__); - goto out; - } - - /* Commands without FMAC interaction */ - if (type == ETHERNET_CONFIG_TYPE_MAC_ADDRESS) { - if (!net_eth_is_addr_valid((struct net_eth_addr *)&config->mac_address)) { - LOG_ERR("%s: Invalid MAC address", - __func__); - goto unlock; - } - memcpy(vif_ctx_zep->mac_addr.addr, - config->mac_address.addr, - sizeof(vif_ctx_zep->mac_addr.addr)); - - net_if_set_link_addr(vif_ctx_zep->zep_net_if_ctx, - vif_ctx_zep->mac_addr.addr, - sizeof(vif_ctx_zep->mac_addr.addr), - NET_LINK_ETHERNET); - ret = 0; - goto unlock; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep || !rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: rpu_ctx_zep or rpu_ctx is NULL", - __func__); - goto unlock; - } - - fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - def_dev_ctx = wifi_dev_priv(fmac_dev_ctx); - if (!def_dev_ctx) { - LOG_ERR("%s: def_dev_ctx is NULL", - __func__); - goto unlock; - } - -#ifdef CONFIG_NRF700X_RAW_DATA_TX - if (type == ETHERNET_CONFIG_TYPE_TXINJECTION_MODE) { - unsigned char mode; - - if (def_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx]->txinjection_mode == - config->txinjection_mode) { - LOG_INF("%s: Driver TX injection setting is same as configured setting", - __func__); - goto unlock; - } - /** - * Since UMAC wishes to use the same mode command as previously - * used for mode, `OR` the primary mode with TX-Injection mode and - * send it to the UMAC. That way UMAC can still maintain code - * as is - */ - if (config->txinjection_mode) { - mode = (def_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx]->mode) | - (NRF_WIFI_TX_INJECTION_MODE); - } else { - mode = (def_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx]->mode) ^ - (NRF_WIFI_TX_INJECTION_MODE); - } - - ret = nrf_wifi_fmac_set_mode(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, mode); - - if (ret != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: Mode set operation failed", __func__); - goto unlock; - } - } -#endif -#ifdef CONFIG_NRF700X_PROMISC_DATA_RX - else if (type == ETHERNET_CONFIG_TYPE_PROMISC_MODE) { - unsigned char mode; - - if (def_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx]->promisc_mode == - config->promisc_mode) { - LOG_ERR("%s: Driver promisc mode setting is same as configured setting", - __func__); - goto out; - } - - if (config->promisc_mode) { - mode = (def_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx]->mode) | - (NRF_WIFI_PROMISCUOUS_MODE); - } else { - mode = (def_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx]->mode) ^ - (NRF_WIFI_PROMISCUOUS_MODE); - } - - ret = nrf_wifi_fmac_set_mode(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, mode); - - if (ret != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: mode set operation failed", __func__); - goto out; - } - } -#endif - ret = 0; -unlock: - k_mutex_unlock(&vif_ctx_zep->vif_lock); -out: - return ret; -} - -#ifdef CONFIG_NET_STATISTICS_ETHERNET -struct net_stats_eth *nrf_wifi_eth_stats_get(const struct device *dev) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - - if (!dev) { - LOG_ERR("%s Device not found", __func__); - goto out; - } - - vif_ctx_zep = dev->data; - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - goto out; - } - - return &vif_ctx_zep->eth_stats; -out: - return NULL; -} -#endif /* CONFIG_NET_STATISTICS_ETHERNET */ - -#ifdef CONFIG_NET_STATISTICS_WIFI -int nrf_wifi_stats_get(const struct device *dev, struct net_stats_wifi *zstats) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; -#ifdef CONFIG_NRF700X_RAW_DATA_TX - struct nrf_wifi_fmac_dev_ctx_def *def_dev_ctx = NULL; -#endif /* CONFIG_NRF700X_RAW_DATA_TX */ - struct rpu_op_stats stats; - int ret = -1; - - if (!dev) { - LOG_ERR("%s Device not found", __func__); - goto out; - } - - if (!zstats) { - LOG_ERR("%s Stats buffer not allocated", __func__); - goto out; - } - - vif_ctx_zep = dev->data; - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - goto out; - } - - ret = k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (ret != 0) { - LOG_ERR("%s: Failed to lock vif_lock", __func__); - goto out; - } - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep || !rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: rpu_ctx_zep or rpu_ctx is NULL", - __func__); - goto unlock; - } - - memset(&stats, 0, sizeof(struct rpu_op_stats)); - status = nrf_wifi_fmac_stats_get(rpu_ctx_zep->rpu_ctx, 0, &stats); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_stats_get failed", __func__); - goto unlock; - } - - zstats->pkts.tx = stats.host.total_tx_pkts; - zstats->pkts.rx = stats.host.total_rx_pkts; - zstats->errors.tx = stats.host.total_tx_drop_pkts; - zstats->errors.rx = stats.host.total_rx_drop_pkts + - stats.fw.umac.interface_data_stats.rx_checksum_error_count; - zstats->bytes.received = stats.fw.umac.interface_data_stats.rx_bytes; - zstats->bytes.sent = stats.fw.umac.interface_data_stats.tx_bytes; - zstats->sta_mgmt.beacons_rx = stats.fw.umac.interface_data_stats.rx_beacon_success_count; - zstats->sta_mgmt.beacons_miss = stats.fw.umac.interface_data_stats.rx_beacon_miss_count; - zstats->broadcast.rx = stats.fw.umac.interface_data_stats.rx_broadcast_pkt_count; - zstats->broadcast.tx = stats.fw.umac.interface_data_stats.tx_broadcast_pkt_count; - zstats->multicast.rx = stats.fw.umac.interface_data_stats.rx_multicast_pkt_count; - zstats->multicast.tx = stats.fw.umac.interface_data_stats.tx_multicast_pkt_count; - zstats->unicast.rx = stats.fw.umac.interface_data_stats.rx_unicast_pkt_count; - zstats->unicast.tx = stats.fw.umac.interface_data_stats.tx_unicast_pkt_count; - -#ifdef CONFIG_NRF700X_RAW_DATA_TX - def_dev_ctx = wifi_dev_priv(rpu_ctx_zep->rpu_ctx); - zstats->errors.tx += def_dev_ctx->raw_pkt_stats.raw_pkt_send_failure; -#endif /* CONFIG_NRF700X_RAW_DATA_TX */ - ret = 0; -unlock: - k_mutex_unlock(&vif_ctx_zep->vif_lock); -out: - return ret; -} - -int nrf_wifi_stats_reset(const struct device *dev) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx_def *def_dev_ctx = NULL; - int ret = -1; - - if (!dev) { - LOG_ERR("%s Device not found", __func__); - goto out; - } - - vif_ctx_zep = dev->data; - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - goto out; - } - - ret = k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (ret != 0) { - LOG_ERR("%s: Failed to lock vif_lock", __func__); - goto out; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep || !rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: rpu_ctx_zep or rpu_ctx is NULL", - __func__); - goto unlock; - } - - status = nrf_wifi_fmac_stats_reset(rpu_ctx_zep->rpu_ctx); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_stats_reset failed", __func__); - goto unlock; - } - - def_dev_ctx = wifi_dev_priv(rpu_ctx_zep->rpu_ctx); - memset(&def_dev_ctx->host_stats, 0, sizeof(struct rpu_host_stats)); - - ret = 0; -unlock: - k_mutex_unlock(&vif_ctx_zep->vif_lock); -out: - return ret; -} -#endif /* CONFIG_NET_STATISTICS_WIFI */ diff --git a/drivers/wifi/nrf700x/src/qspi/inc/ficr_prog.h b/drivers/wifi/nrf700x/src/qspi/inc/ficr_prog.h deleted file mode 100644 index d2ae442e0bf4..000000000000 --- a/drivers/wifi/nrf700x/src/qspi/inc/ficr_prog.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief Header containing address/offets and functions for writing - * the FICR fields of the OTP memory on nRF7002 device - */ - -#ifndef __OTP_PROG_H_ -#define __OTP_PROG_H_ - -#include -#include - -int write_otp_memory(unsigned int otp_addr, unsigned int *write_val); -int read_otp_memory(unsigned int otp_addr, unsigned int *read_val, int len); -unsigned int check_protection(unsigned int *buff, unsigned int off1, unsigned int off2, - unsigned int off3, unsigned int off4); - -#endif /* __OTP_PROG_H_ */ diff --git a/drivers/wifi/nrf700x/src/qspi/inc/qspi_if.h b/drivers/wifi/nrf700x/src/qspi/inc/qspi_if.h deleted file mode 100644 index cb130f87dff0..000000000000 --- a/drivers/wifi/nrf700x/src/qspi/inc/qspi_if.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief Header containing QSPI device interface specific declarations for the - * Zephyr OS layer of the Wi-Fi driver. - */ - -#ifndef __QSPI_IF_H__ -#define __QSPI_IF_H__ - -#include -#include -#ifdef CONFIG_NRF700X_ON_QSPI -#include -#endif - -#define RPU_WAKEUP_NOW BIT(0) /* WAKEUP RPU - RW */ -#define RPU_AWAKE_BIT BIT(1) /* RPU AWAKE FROM SLEEP - RO */ -#define RPU_READY_BIT BIT(2) /* RPU IS READY - RO*/ - -struct qspi_config { -#ifdef CONFIG_NRF700X_ON_QSPI - nrf_qspi_addrmode_t addrmode; - nrf_qspi_readoc_t readoc; - nrf_qspi_writeoc_t writeoc; - nrf_qspi_frequency_t sckfreq; -#endif - unsigned char RDC4IO; - bool easydma; - bool single_op; - bool quad_spi; - bool encryption; - bool CMD_CNONCE; - bool enc_enabled; - struct k_sem lock; - unsigned int addrmask; - unsigned char qspi_slave_latency; -#if defined(CONFIG_NRF700X_ON_QSPI) && (NRF_QSPI_HAS_XIP_ENC || NRF_QSPI_HAS_DMA_ENC) - nrf_qspi_encryption_t p_cfg; -#endif /*CONFIG_NRF700X_ON_QSPI && (NRF_QSPI_HAS_XIP_ENC || NRF_QSPI_HAS_DMA_ENC)*/ - int test_hlread; - char *test_name; - int test_start; - int test_end; - int test_iterations; - int test_timediff_read; - int test_timediff_write; - int test_status; - int test_iteration; -}; -struct qspi_dev { - int (*deinit)(void); - void *config; - int (*init)(struct qspi_config *config); - int (*write)(unsigned int addr, const void *data, int len); - int (*read)(unsigned int addr, void *data, int len); - int (*hl_read)(unsigned int addr, void *data, int len); - void (*hard_reset)(void); -}; - -int qspi_cmd_wakeup_rpu(const struct device *dev, uint8_t data); - -int qspi_init(struct qspi_config *config); - -int qspi_write(unsigned int addr, const void *data, int len); - -int qspi_read(unsigned int addr, void *data, int len); - -int qspi_hl_read(unsigned int addr, void *data, int len); - -int qspi_deinit(void); - -void gpio_free_irq(int pin, struct gpio_callback *button_cb_data); - -int gpio_request_irq(int pin, struct gpio_callback *button_cb_data, void (*irq_handler)()); - -struct qspi_config *qspi_defconfig(void); - -struct qspi_dev *qspi_dev(void); -struct qspi_config *qspi_get_config(void); - -int qspi_cmd_sleep_rpu(const struct device *dev); - -void hard_reset(void); -void get_sleep_stats(uint32_t addr, uint32_t *buff, uint32_t wrd_len); - -extern struct device qspi_perip; - -int qspi_validate_rpu_wake_writecmd(const struct device *dev); -int qspi_cmd_wakeup_rpu(const struct device *dev, uint8_t data); -int qspi_wait_while_rpu_awake(const struct device *dev); - -int qspi_RDSR1(const struct device *dev, uint8_t *rdsr1); -int qspi_RDSR2(const struct device *dev, uint8_t *rdsr2); -int qspi_WRSR2(const struct device *dev, const uint8_t wrsr2); - -#ifdef CONFIG_NRF_WIFI_LOW_POWER -int func_rpu_sleep(void); -int func_rpu_wake(void); -int func_rpu_sleep_status(void); -#endif /* CONFIG_NRF_WIFI_LOW_POWER */ - -#define QSPI_KEY_LEN_BYTES 16 - -/*! \brief Enable encryption - * - * \param key Pointer to the 128-bit key - * \return 0 on success, negative errno code on failure. - */ -int qspi_enable_encryption(uint8_t *key); - -#endif /* __QSPI_IF_H__ */ diff --git a/drivers/wifi/nrf700x/src/qspi/inc/rpu_hw_if.h b/drivers/wifi/nrf700x/src/qspi/inc/rpu_hw_if.h deleted file mode 100644 index 98165b33cc67..000000000000 --- a/drivers/wifi/nrf700x/src/qspi/inc/rpu_hw_if.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief Header containing common functions for RPU hardware interaction - * using QSPI and SPI that can be invoked by shell or the driver. - */ - -#ifndef __RPU_HW_IF_H_ -#define __RPU_HW_IF_H_ - -#include -#include -#include - -enum { - SYSBUS = 0, - EXT_SYS_BUS, - PBUS, - PKTRAM, - GRAM, - LMAC_ROM, - LMAC_RET_RAM, - LMAC_SRC_RAM, - UMAC_ROM, - UMAC_RET_RAM, - UMAC_SRC_RAM, - NUM_MEM_BLOCKS -}; - -extern char blk_name[][15]; -extern uint32_t rpu_7002_memmap[][3]; - -int rpu_read(unsigned int addr, void *data, int len); -int rpu_write(unsigned int addr, const void *data, int len); - -int rpu_sleep(void); -int rpu_wakeup(void); -int rpu_sleep_status(void); -void rpu_get_sleep_stats(uint32_t addr, uint32_t *buff, uint32_t wrd_len); -int rpu_irq_config(struct gpio_callback *irq_callback_data, void (*irq_handler)()); -int rpu_irq_remove(struct gpio_callback *irq_callback_data); - -int rpu_wrsr2(uint8_t data); -int rpu_rdsr2(void); -int rpu_rdsr1(void); -int rpu_clks_on(void); - -int rpu_init(void); -int rpu_enable(void); -int rpu_disable(void); - -#ifdef CONFIG_NRF700X_SR_COEX_RF_SWITCH -int sr_ant_switch(unsigned int ant_switch); -int sr_gpio_remove(void); -int sr_gpio_config(void); -#endif /* CONFIG_NRF700X_SR_COEX_RF_SWITCH */ -#endif /* __RPU_HW_IF_H_ */ diff --git a/drivers/wifi/nrf700x/src/qspi/inc/spi_if.h b/drivers/wifi/nrf700x/src/qspi/inc/spi_if.h deleted file mode 100644 index 93ae191d7ea5..000000000000 --- a/drivers/wifi/nrf700x/src/qspi/inc/spi_if.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief Header containing SPI device interface specific declarations for the - * Zephyr OS layer of the Wi-Fi driver. - */ - -/* SPIM driver config */ - -int spim_init(struct qspi_config *config); - -int spim_deinit(void); - -int spim_write(unsigned int addr, const void *data, int len); - -int spim_read(unsigned int addr, void *data, int len); - -int spim_hl_read(unsigned int addr, void *data, int len); - -int spim_cmd_rpu_wakeup_fn(uint32_t data); - -int spim_wait_while_rpu_awake(void); - -int spi_validate_rpu_wake_writecmd(void); - -int spim_cmd_sleep_rpu_fn(void); - -int spim_RDSR1(const struct device *dev, uint8_t *rdsr1); - -int spim_RDSR2(const struct device *dev, uint8_t *rdsr2); - -int spim_WRSR2(const struct device *dev, const uint8_t wrsr2); diff --git a/drivers/wifi/nrf700x/src/qspi/inc/spi_nor.h b/drivers/wifi/nrf700x/src/qspi/inc/spi_nor.h deleted file mode 100644 index 93c2f41a63c3..000000000000 --- a/drivers/wifi/nrf700x/src/qspi/inc/spi_nor.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief Header containing SPI device specific declarations for the - * Zephyr OS layer of the Wi-Fi driver. - */ - -#ifndef __SPI_NOR_H__ -#define __SPI_NOR_H__ - -#include - -#define SPI_NOR_MAX_ID_LEN 3 - -/* Status register bits */ -#define SPI_NOR_WIP_BIT BIT(0) /* Write in progress */ -#define SPI_NOR_WEL_BIT BIT(1) /* Write enable latch */ - -/* Flash opcodes */ -#define SPI_NOR_CMD_WRSR 0x01 /* Write status register */ -#define SPI_NOR_CMD_RDSR 0x05 /* Read status register */ -#define SPI_NOR_CMD_READ 0x03 /* Read data */ -#define SPI_NOR_CMD_WREN 0x06 /* Write enable */ -#define SPI_NOR_CMD_WRDI 0x04 /* Write disable */ -#define SPI_NOR_CMD_PP 0x02 /* Page program */ -#define SPI_NOR_CMD_SE 0x20 /* Sector erase */ -#define SPI_NOR_CMD_BE_32K 0x52 /* Block erase 32KB */ -#define SPI_NOR_CMD_BE 0xD8 /* Block erase */ -#define SPI_NOR_CMD_CE 0xC7 /* Chip erase */ -#define SPI_NOR_CMD_RDID 0x9F /* Read JEDEC ID */ -#define SPI_NOR_CMD_ULBPR 0x98 /* Global Block Protection Unlock */ -#define SPI_NOR_CMD_4BA 0xB7 /* Enter 4-Byte Address Mode */ -#define SPI_NOR_CMD_DPD 0xB9 /* Deep Power Down */ -#define SPI_NOR_CMD_RDPD 0xAB /* Release from Deep Power Down */ - -/* Page, sector, and block size are standard, not configurable. */ -#define SPI_NOR_PAGE_SIZE 0x0100U -#define SPI_NOR_SECTOR_SIZE 0x1000U -#define SPI_NOR_BLOCK_SIZE 0x10000U - -/* Test whether offset is aligned to a given number of bits. */ -#define SPI_NOR_IS_ALIGNED(_ofs, _bits) (((_ofs)&BIT_MASK(_bits)) == 0) -#define SPI_NOR_IS_SECTOR_ALIGNED(_ofs) SPI_NOR_IS_ALIGNED(_ofs, 12) - -#endif /*__SPI_NOR_H__*/ diff --git a/drivers/wifi/nrf700x/src/qspi/src/device.c b/drivers/wifi/nrf700x/src/qspi/src/device.c deleted file mode 100644 index 86cd724b0b9e..000000000000 --- a/drivers/wifi/nrf700x/src/qspi/src/device.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief File containing QSPI device specific definitions for the - * Zephyr OS layer of the Wi-Fi driver. - */ - -#include -#include -#include -#include -#include - -#include "qspi_if.h" -#include "spi_if.h" - -static struct qspi_config config; - -#if defined(CONFIG_NRF700X_ON_QSPI) -static struct qspi_dev qspi = { - .init = qspi_init, - .deinit = qspi_deinit, - .read = qspi_read, - .write = qspi_write, - .hl_read = qspi_hl_read -}; -#else -static struct qspi_dev spim = { - .init = spim_init, - .deinit = spim_deinit, - .read = spim_read, - .write = spim_write, - .hl_read = spim_hl_read -}; -#endif - -struct qspi_config *qspi_defconfig(void) -{ - memset(&config, 0, sizeof(struct qspi_config)); -#if defined(CONFIG_NRF700X_ON_QSPI) - config.addrmode = NRF_QSPI_ADDRMODE_24BIT; - config.RDC4IO = 0xA0; - config.easydma = true; - config.quad_spi = true; -#endif - config.addrmask = 0x800000; /* set bit23 (incr. addr mode) */ - - config.test_name = "QSPI TEST"; - config.test_hlread = false; - config.test_iteration = 0; - - config.qspi_slave_latency = 0; - - config.encryption = config.CMD_CNONCE = false; - -#if defined(CONFIG_NRF700X_ON_QSPI) && (NRF_QSPI_HAS_XIP_ENC || NRF_QSPI_HAS_DMA_ENC) - - /*For #Bit 6 Enable below: i.e ALL Ones for QSPI Key*/ - memset(&config.p_cfg.key, 0xff, sizeof(config.p_cfg.key)); - - config.p_cfg.nonce[0] = 0x16181648; - config.p_cfg.nonce[1] = 0x0; - config.p_cfg.nonce[2] = 0x1; - -#endif /*CONFIG_NRF700X_ON_QSPI && (NRF_QSPI_HAS_XIP_ENC || NRF_QSPI_HAS_DMA_ENC)*/ - - return &config; -} - -struct qspi_config *qspi_get_config(void) -{ - return &config; -} - -struct qspi_dev *qspi_dev(void) -{ -#if CONFIG_NRF700X_ON_QSPI - return &qspi; -#else - return &spim; -#endif -} diff --git a/drivers/wifi/nrf700x/src/qspi/src/ficr_prog.c b/drivers/wifi/nrf700x/src/qspi/src/ficr_prog.c deleted file mode 100644 index 7f058d65abb8..000000000000 --- a/drivers/wifi/nrf700x/src/qspi/src/ficr_prog.c +++ /dev/null @@ -1,379 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/* @file - * @brief NRF Wi-Fi radio FICR programming functions - */ - -#include -#include -#include "rpu_if.h" -#include "rpu_hw_if.h" -#include "ficr_prog.h" - - -LOG_MODULE_DECLARE(otp_prog, CONFIG_WIFI_NRF700X_BUS_LOG_LEVEL); - -static void write_word(unsigned int addr, unsigned int data) -{ - rpu_write(addr, &data, 4); -} - -static void read_word(unsigned int addr, unsigned int *data) -{ - rpu_read(addr, data, 4); -} - -unsigned int check_protection(unsigned int *buff, unsigned int off1, unsigned int off2, - unsigned int off3, unsigned int off4) -{ - if ((buff[off1] == OTP_PROGRAMMED) && - (buff[off2] == OTP_PROGRAMMED) && - (buff[off3] == OTP_PROGRAMMED) && - (buff[off4] == OTP_PROGRAMMED)) - return OTP_PROGRAMMED; - else if ((buff[off1] == OTP_FRESH_FROM_FAB) && - (buff[off2] == OTP_FRESH_FROM_FAB) && - (buff[off3] == OTP_FRESH_FROM_FAB) && - (buff[off4] == OTP_FRESH_FROM_FAB)) - return OTP_FRESH_FROM_FAB; - else if ((buff[off1] == OTP_ENABLE_PATTERN) && - (buff[off2] == OTP_ENABLE_PATTERN) && - (buff[off3] == OTP_ENABLE_PATTERN) && - (buff[off4] == OTP_ENABLE_PATTERN)) - return OTP_ENABLE_PATTERN; - else - return OTP_INVALID; -} - - -static void set_otp_timing_reg_40mhz(void) -{ - write_word(OTP_TIMING_REG1_ADDR, OTP_TIMING_REG1_VAL); - write_word(OTP_TIMING_REG2_ADDR, OTP_TIMING_REG2_VAL); -} - -static int poll_otp_ready(void) -{ - int otp_mem_status = 0; - int poll = 0; - - while (poll != 100) { - read_word(OTP_POLL_ADDR, &otp_mem_status); - - if ((otp_mem_status & OTP_READY) == OTP_READY) { - return 0; - } - poll++; - } - LOG_ERR("OTP is not ready"); - return -ENOEXEC; -} - - -static int req_otp_standby_mode(void) -{ - write_word(OTP_RWSBMODE_ADDR, 0x0); - return poll_otp_ready(); -} - - -static int otp_wr_voltage_2V5(void) -{ - int err; - - err = req_otp_standby_mode(); - - if (err) { - LOG_ERR("Failed Setting OTP voltage IOVDD to 2.5V"); - return -ENOEXEC; - } - write_word(OTP_VOLTCTRL_ADDR, OTP_VOLTCTRL_2V5); - return 0; -} - -static int poll_otp_read_valid(void) -{ - int otp_mem_status = 0; - int poll = 0; - - while (poll < 100) { - read_word(OTP_POLL_ADDR, &otp_mem_status); - - if ((otp_mem_status & OTP_READ_VALID) == OTP_READ_VALID) { - return 0; - } - poll++; - } - LOG_ERR("failed poll_otp_read_valid()"); - return -ENOEXEC; -} - -static int poll_otp_wrdone(void) -{ - int otp_mem_status = 0; - int poll = 0; - - while (poll < 100) { - read_word(OTP_POLL_ADDR, &otp_mem_status); - - if ((otp_mem_status & OTP_WR_DONE) == OTP_WR_DONE) { - return 0; - } - poll++; - } - LOG_ERR("failed poll_otp_wrdone()"); - return -ENOEXEC; -} - -static int req_otp_read_mode(void) -{ - write_word(OTP_RWSBMODE_ADDR, OTP_READ_MODE); - return poll_otp_ready(); -} - - -static int req_otp_byte_write_mode(void) -{ - write_word(OTP_RWSBMODE_ADDR, OTP_BYTE_WRITE_MODE); - return poll_otp_ready(); -} - -static unsigned int read_otp_location(unsigned int offset, unsigned int *read_val) -{ - int err; - - write_word(OTP_RDENABLE_ADDR, offset); - err = poll_otp_read_valid(); - if (err) { - LOG_ERR("OTP read failed"); - return err; - } - read_word(OTP_READREG_ADDR, read_val); - - return 0; -} - -static int write_otp_location(unsigned int otp_location_offset, unsigned int otp_data) -{ - write_word(OTP_WRENABLE_ADDR, otp_location_offset); - write_word(OTP_WRITEREG_ADDR, otp_data); - - return poll_otp_wrdone(); -} - - -static int otp_rd_voltage_1V8(void) -{ - int err; - - err = req_otp_standby_mode(); - if (err) { - LOG_ERR("error in %s", __func__); - return err; - } - write_word(OTP_VOLTCTRL_ADDR, OTP_VOLTCTRL_1V8); - - return 0; -} - -static int update_mac_addr(unsigned int index, unsigned int *write_val) -{ - int ret = 0; - - for (int i = 0; i < 2; i++) { - ret = write_otp_location(MAC0_ADDR + 2 * index + i, write_val[i]); - if (ret == -ENOEXEC) { - LOG_ERR("FICR: Failed to update MAC ADDR%d", index); - break; - } - LOG_INF("mac addr %d : Reg%d (0x%x) = 0x%04x", - index, (i+1), (MAC0_ADDR + i) << 2, write_val[i]); - } - return ret; -} - -int write_otp_memory(unsigned int otp_addr, unsigned int *write_val) -{ - int err = 0; - int mask_val; - int ret = 0; - int retrim_loc = 0; - - err = poll_otp_ready(); - if (err) { - LOG_ERR("err in otp ready poll"); - return err; - } - - set_otp_timing_reg_40mhz(); - - err = otp_wr_voltage_2V5(); - if (err) { - LOG_ERR("error in write_voltage 2V5"); - goto _exit_otp_write; - } - - err = req_otp_byte_write_mode(); - if (err) { - LOG_ERR("error in OTP byte write mode"); - goto _exit_otp_write; - } - - switch (otp_addr) { - case REGION_PROTECT: - write_otp_location(REGION_PROTECT, write_val[0]); - write_otp_location(REGION_PROTECT+1, write_val[0]); - write_otp_location(REGION_PROTECT+2, write_val[0]); - write_otp_location(REGION_PROTECT+3, write_val[0]); - - LOG_INF("Written REGION_PROTECT0 (0x%x) : 0x%04x", - (REGION_PROTECT << 2), write_val[0]); - LOG_INF("Written REGION_PROTECT1 (0x%x) : 0x%04x", - (REGION_PROTECT+1) << 2, write_val[0]); - LOG_INF("Written REGION_PROTECT2 (0x%x) : 0x%04x", - (REGION_PROTECT+2) << 2, write_val[0]); - LOG_INF("Written REGION_PROTECT3 (0x%x) : 0x%04x", - (REGION_PROTECT+3) << 2, write_val[0]); - break; - case QSPI_KEY: - mask_val = QSPI_KEY_FLAG_MASK; - for (int i = 0; i < QSPI_KEY_LENGTH_BYTES / 4; i++) { - ret = write_otp_location(QSPI_KEY + i, write_val[i]); - if (ret == -ENOEXEC) { - LOG_ERR("FICR: Failed to write QSPI key offset-%d", QSPI_KEY + i); - goto _exit_otp_write; - } - LOG_INF("Written QSPI_KEY0 (0x%x) : 0x%04x", - (QSPI_KEY + i) << 2, write_val[i]); - } - write_otp_location(REGION_DEFAULTS, mask_val); - LOG_INF("Written REGION_DEFAULTS (0x%x) : 0x%04x", - (REGION_DEFAULTS) << 2, mask_val); - break; - case MAC0_ADDR: - mask_val = MAC0_ADDR_FLAG_MASK; - ret = update_mac_addr(0, write_val); - if (ret == -ENOEXEC) { - goto _exit_otp_write; - } - - write_otp_location(REGION_DEFAULTS, mask_val); - LOG_INF("Written MAC address 0"); - LOG_INF("Written REGION_DEFAULTS (0x%x) : 0x%04x", - (REGION_DEFAULTS) << 2, mask_val); - break; - case MAC1_ADDR: - mask_val = MAC1_ADDR_FLAG_MASK; - ret = update_mac_addr(1, write_val); - if (ret == -ENOEXEC) { - goto _exit_otp_write; - } - write_otp_location(REGION_DEFAULTS, mask_val); - LOG_INF("Written MAC address 1"); - LOG_INF("Written REGION_DEFAULTS (0x%x) : 0x%04x", - (REGION_DEFAULTS) << 2, mask_val); - break; - case CALIB_XO: - mask_val = CALIB_XO_FLAG_MASK; - ret = write_otp_location(CALIB_XO, write_val[0]); - - if (ret == -ENOEXEC) { - LOG_ERR("XO_Update Exception"); - goto _exit_otp_write; - } else { - write_otp_location(REGION_DEFAULTS, mask_val); - - LOG_INF("Written CALIB_XO (0x%x) to 0x%04x", - CALIB_XO << 2, write_val[0]); - LOG_INF("Written REGION_DEFAULTS (0x%x) : 0x%04x", - (REGION_DEFAULTS) << 2, mask_val); - } - break; - case PRODRETEST_PROGVERSION: - ret = write_otp_location(PRODRETEST_PROGVERSION, *write_val); - - if (ret == -ENOEXEC) { - LOG_ERR("PRODRETEST.PROGVERSION_Update Exception"); - goto _exit_otp_write; - } else { - LOG_INF("Written PRODRETEST.PROGVERSION 0x%04x", *write_val); - } - break; - case PRODRETEST_TRIM0: - case PRODRETEST_TRIM1: - case PRODRETEST_TRIM2: - case PRODRETEST_TRIM3: - case PRODRETEST_TRIM4: - case PRODRETEST_TRIM5: - case PRODRETEST_TRIM6: - case PRODRETEST_TRIM7: - case PRODRETEST_TRIM8: - case PRODRETEST_TRIM9: - case PRODRETEST_TRIM10: - case PRODRETEST_TRIM11: - case PRODRETEST_TRIM12: - case PRODRETEST_TRIM13: - case PRODRETEST_TRIM14: - retrim_loc = otp_addr - PRODRETEST_TRIM0; - ret = write_otp_location(otp_addr, *write_val); - - if (ret == -ENOEXEC) { - LOG_ERR("PRODRETEST.TRIM_Update Exception"); - goto _exit_otp_write; - } else { - LOG_INF("Written PRODRETEST.TRIM%d 0x%04x", - retrim_loc, *write_val); - } - break; - case REGION_DEFAULTS: - write_otp_location(REGION_DEFAULTS, write_val[0]); - - LOG_INF("Written REGION_DEFAULTS (0x%x) to 0x%04x", - REGION_DEFAULTS << 2, write_val[0]); - break; - default: - LOG_ERR("unknown field received: %d", otp_addr); - - } - return ret; - -_exit_otp_write: - err = req_otp_standby_mode(); - err |= otp_rd_voltage_1V8(); - return err; -} - -int read_otp_memory(unsigned int otp_addr, unsigned int *read_val, int len) -{ - int err; - - err = poll_otp_ready(); - if (err) { - LOG_ERR("err in otp ready poll"); - return -ENOEXEC; - } - - set_otp_timing_reg_40mhz(); - - err = otp_rd_voltage_1V8(); - if (err) { - LOG_ERR("error in read_voltage 1V8"); - return -ENOEXEC; - } - - err = req_otp_read_mode(); - if (err) { - LOG_ERR("error in req_otp_read_mode()"); - return -ENOEXEC; - } - - for (int i = 0; i < len; i++) { - read_otp_location(otp_addr + i, &read_val[i]); - } - - return req_otp_standby_mode(); -} diff --git a/drivers/wifi/nrf700x/src/qspi/src/qspi_if.c b/drivers/wifi/nrf700x/src/qspi/src/qspi_if.c deleted file mode 100644 index 0277440b0f74..000000000000 --- a/drivers/wifi/nrf700x/src/qspi/src/qspi_if.c +++ /dev/null @@ -1,1342 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief File containing QSPI device interface specific definitions for the - * Zephyr OS layer of the Wi-Fi driver. - */ - -#define DT_DRV_COMPAT nordic_nrf700x_qspi - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "spi_nor.h" -#include "qspi_if.h" - -static struct qspi_config *qspi_config; -#if NRF_QSPI_HAS_XIP_ENC || NRF_QSPI_HAS_DMA_ENC -static unsigned int nonce_last_addr; -static unsigned int nonce_cnt; -#endif /*NRF_QSPI_HAS_XIP_ENC || NRF_QSPI_HAS_DMA_ENC*/ - -/* Main config structure */ -static nrfx_qspi_config_t QSPIconfig; - -#define INST_0_SCK_FREQUENCY DT_INST_PROP(0, sck_frequency) -/* - * According to the respective specifications, the nRF52 QSPI supports clock - * frequencies 2 - 32 MHz and the nRF53 one supports 6 - 96 MHz. - */ -BUILD_ASSERT(INST_0_SCK_FREQUENCY >= (NRF_QSPI_BASE_CLOCK_FREQ / 16), - "Unsupported SCK frequency."); - -/* - * Determine a configuration value (INST_0_SCK_CFG) and, if needed, a divider - * (BASE_CLOCK_DIV) for the clock from which the SCK frequency is derived that - * need to be used to achieve the SCK frequency as close as possible (but not - * higher) to the one specified in DT. - */ -#if defined(CONFIG_SOC_SERIES_NRF53X) -/* - * On nRF53 Series SoCs, the default /4 divider for the HFCLK192M clock can - * only be used when the QSPI peripheral is idle. When a QSPI operation is - * performed, the divider needs to be changed to /1 or /2 (particularly, - * the specification says that the peripheral "supports 192 MHz and 96 MHz - * PCLK192M frequency"), but after that operation is complete, the default - * divider needs to be restored to avoid increased current consumption. - */ -#if (INST_0_SCK_FREQUENCY >= NRF_QSPI_BASE_CLOCK_FREQ) -/* For requested SCK >= 96 MHz, use HFCLK192M / 1 / (2*1) = 96 MHz */ -#define BASE_CLOCK_DIV NRF_CLOCK_HFCLK_DIV_1 -#define INST_0_SCK_CFG NRF_QSPI_FREQ_DIV1 -/* If anomaly 159 is to be prevented, only /1 divider can be used. */ -#elif NRF53_ERRATA_159_ENABLE_WORKAROUND -#define BASE_CLOCK_DIV NRF_CLOCK_HFCLK_DIV_1 -#define INST_0_SCK_CFG (DIV_ROUND_UP(NRF_QSPI_BASE_CLOCK_FREQ, \ - INST_0_SCK_FREQUENCY) - 1) -#elif (INST_0_SCK_FREQUENCY >= (NRF_QSPI_BASE_CLOCK_FREQ / 2)) -/* For 96 MHz > SCK >= 48 MHz, use HFCLK192M / 2 / (2*1) = 48 MHz */ -#define BASE_CLOCK_DIV NRF_CLOCK_HFCLK_DIV_2 -#define INST_0_SCK_CFG NRF_QSPI_FREQ_DIV1 -#elif (INST_0_SCK_FREQUENCY >= (NRF_QSPI_BASE_CLOCK_FREQ / 3)) -/* For 48 MHz > SCK >= 32 MHz, use HFCLK192M / 1 / (2*3) = 32 MHz */ -#define BASE_CLOCK_DIV NRF_CLOCK_HFCLK_DIV_1 -#define INST_0_SCK_CFG NRF_QSPI_FREQ_DIV3 -#else -/* For requested SCK < 32 MHz, use divider /2 for HFCLK192M. */ -#define BASE_CLOCK_DIV NRF_CLOCK_HFCLK_DIV_2 -#define INST_0_SCK_CFG (DIV_ROUND_UP(NRF_QSPI_BASE_CLOCK_FREQ / 2, \ - INST_0_SCK_FREQUENCY) - 1) -#endif - -#if BASE_CLOCK_DIV == NRF_CLOCK_HFCLK_DIV_1 -/* For 8 MHz, use HFCLK192M / 1 / (2*12) */ -#define INST_0_SCK_CFG_WAKE NRF_QSPI_FREQ_DIV12 -#elif BASE_CLOCK_DIV == NRF_CLOCK_HFCLK_DIV_2 -/* For 8 MHz, use HFCLK192M / 2 / (2*6) */ -#define INST_0_SCK_CFG_WAKE NRF_QSPI_FREQ_DIV6 -#else -#error "Unsupported base clock divider for wake-up frequency." -#endif - -/* After the base clock divider is changed, some time is needed for the new - * setting to take effect. This value specifies the delay (in microseconds) - * to be applied to ensure that the clock is ready when the QSPI operation - * starts. It was measured with a logic analyzer (unfortunately, the nRF5340 - * specification does not provide any numbers in this regard). - */ -#define BASE_CLOCK_SWITCH_DELAY_US 7 - -#else -/* - * On nRF52 Series SoCs, the base clock divider is not configurable, - * so BASE_CLOCK_DIV is not defined. - */ -#if (INST_0_SCK_FREQUENCY >= NRF_QSPI_BASE_CLOCK_FREQ) -#define INST_0_SCK_CFG NRF_QSPI_FREQ_DIV1 -#else -#define INST_0_SCK_CFG (DIV_ROUND_UP(NRF_QSPI_BASE_CLOCK_FREQ, \ - INST_0_SCK_FREQUENCY) - 1) -#endif - -/* For 8 MHz, use PCLK32M / 4 */ -#define INST_0_SCK_CFG_WAKE NRF_QSPI_FREQ_DIV4 - -#endif /* defined(CONFIG_SOC_SERIES_NRF53X) */ - -/* for accessing devicetree properties of the bus node */ -#define QSPI_NODE DT_BUS(DT_DRV_INST(0)) -#define QSPI_PROP_AT(prop, idx) DT_PROP_BY_IDX(QSPI_NODE, prop, idx) -#define QSPI_PROP_LEN(prop) DT_PROP_LEN(QSPI_NODE, prop) - -#define INST_0_QER \ - _CONCAT(JESD216_DW15_QER_, DT_ENUM_TOKEN(DT_DRV_INST(0), quad_enable_requirements)) - -static int qspi_device_init(const struct device *dev); -static void qspi_device_uninit(const struct device *dev); - -#define QSPI_SCK_DELAY 0 -#define WORD_SIZE 4 - -LOG_MODULE_DECLARE(wifi_nrf_bus, CONFIG_WIFI_NRF700X_BUS_LOG_LEVEL); - -/** - * @brief QSPI buffer structure - * Structure used both for TX and RX purposes. - * - * @param buf is a valid pointer to a data buffer. - * Can not be NULL. - * @param len is the length of the data to be handled. - * If no data to transmit/receive - pass 0. - */ -struct qspi_buf { - uint8_t *buf; - size_t len; -}; - -/** - * @brief QSPI command structure - * Structure used for custom command usage. - * - * @param op_code is a command value (i.e 0x9F - get Jedec ID) - * @param tx_buf structure used for TX purposes. Can be NULL if not used. - * @param rx_buf structure used for RX purposes. Can be NULL if not used. - */ -struct qspi_cmd { - uint8_t op_code; - const struct qspi_buf *tx_buf; - const struct qspi_buf *rx_buf; -}; - -/** - * @brief Structure for defining the QSPI NOR access - */ -struct qspi_nor_data { -#ifdef CONFIG_MULTITHREADING - /* The semaphore to control exclusive access on write/erase. */ - struct k_sem trans; - /* The semaphore to control exclusive access to the device. */ - struct k_sem sem; - /* The semaphore to indicate that transfer has completed. */ - struct k_sem sync; - /* The semaphore to control driver init/uninit. */ - struct k_sem count; -#else /* CONFIG_MULTITHREADING */ - /* A flag that signals completed transfer when threads are - * not enabled. - */ - volatile bool ready; -#endif /* CONFIG_MULTITHREADING */ -}; - -static inline int qspi_get_mode(bool cpol, bool cpha) -{ - register int ret = -EINVAL; - - if ((!cpol) && (!cpha)) - ret = 0; - else if (cpol && cpha) - ret = 1; - - __ASSERT(ret != -EINVAL, "Invalid QSPI mode"); - - return ret; -} - -static inline bool qspi_write_is_quad(nrf_qspi_writeoc_t lines) -{ - switch (lines) { - case NRF_QSPI_WRITEOC_PP4IO: - case NRF_QSPI_WRITEOC_PP4O: - return true; - default: - return false; - } -} - -static inline bool qspi_read_is_quad(nrf_qspi_readoc_t lines) -{ - switch (lines) { - case NRF_QSPI_READOC_READ4IO: - case NRF_QSPI_READOC_READ4O: - return true; - default: - return false; - } -} - -static inline int qspi_get_lines_write(uint8_t lines) -{ - register int ret = -EINVAL; - - switch (lines) { - case 3: - ret = NRF_QSPI_WRITEOC_PP4IO; - break; - case 2: - ret = NRF_QSPI_WRITEOC_PP4O; - break; - case 1: - ret = NRF_QSPI_WRITEOC_PP2O; - break; - case 0: - ret = NRF_QSPI_WRITEOC_PP; - break; - default: - break; - } - - __ASSERT(ret != -EINVAL, "Invalid QSPI write line"); - - return ret; -} - -static inline int qspi_get_lines_read(uint8_t lines) -{ - register int ret = -EINVAL; - - switch (lines) { - case 4: - ret = NRF_QSPI_READOC_READ4IO; - break; - case 3: - ret = NRF_QSPI_READOC_READ4O; - break; - case 2: - ret = NRF_QSPI_READOC_READ2IO; - break; - case 1: - ret = NRF_QSPI_READOC_READ2O; - break; - case 0: - ret = NRF_QSPI_READOC_FASTREAD; - break; - default: - break; - } - - __ASSERT(ret != -EINVAL, "Invalid QSPI read line"); - - return ret; -} - -nrfx_err_t _nrfx_qspi_read(void *p_rx_buffer, size_t rx_buffer_length, uint32_t src_address) -{ - return nrfx_qspi_read(p_rx_buffer, rx_buffer_length, src_address); -} - -nrfx_err_t _nrfx_qspi_write(void const *p_tx_buffer, size_t tx_buffer_length, uint32_t dst_address) -{ - return nrfx_qspi_write(p_tx_buffer, tx_buffer_length, dst_address); -} - -nrfx_err_t _nrfx_qspi_init(nrfx_qspi_config_t const *p_config, nrfx_qspi_handler_t handler, - void *p_context) -{ - NRF_QSPI_Type *p_reg = NRF_QSPI; - - nrfx_qspi_init(p_config, handler, p_context); - - /* RDC4IO = 4'hA (register IFTIMING), which means 10 Dummy Cycles for READ4. */ - p_reg->IFTIMING |= qspi_config->RDC4IO; - - /* LOG_DBG("%04x : IFTIMING", p_reg->IFTIMING & qspi_config->RDC4IO); */ - - /* ACTIVATE task fails for slave bitfile so ignore it */ - return NRFX_SUCCESS; -} - - -/** - * @brief Main configuration structure - */ -static struct qspi_nor_data qspi_nor_memory_data = { -#ifdef CONFIG_MULTITHREADING - .trans = Z_SEM_INITIALIZER(qspi_nor_memory_data.trans, 1, 1), - .sem = Z_SEM_INITIALIZER(qspi_nor_memory_data.sem, 1, 1), - .sync = Z_SEM_INITIALIZER(qspi_nor_memory_data.sync, 0, 1), - .count = Z_SEM_INITIALIZER(qspi_nor_memory_data.count, 0, K_SEM_MAX_LIMIT), -#endif /* CONFIG_MULTITHREADING */ -}; - -NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(QSPI_NODE); - -IF_ENABLED(CONFIG_PINCTRL, (PINCTRL_DT_DEFINE(QSPI_NODE))); - -/** - * @brief Converts NRFX return codes to the zephyr ones - */ -static inline int qspi_get_zephyr_ret_code(nrfx_err_t res) -{ - switch (res) { - case NRFX_SUCCESS: - return 0; - case NRFX_ERROR_INVALID_PARAM: - case NRFX_ERROR_INVALID_ADDR: - return -EINVAL; - case NRFX_ERROR_INVALID_STATE: - return -ECANCELED; -#if NRF53_ERRATA_159_ENABLE_WORKAROUND - case NRFX_ERROR_FORBIDDEN: - LOG_ERR("nRF5340 anomaly 159 conditions detected"); - LOG_ERR("Set the CPU clock to 64 MHz before starting QSPI operation"); - return -ECANCELED; -#endif - case NRFX_ERROR_BUSY: - case NRFX_ERROR_TIMEOUT: - default: - return -EBUSY; - } -} - -static inline struct qspi_nor_data *get_dev_data(const struct device *dev) -{ - return dev->data; -} - -static inline void qspi_lock(const struct device *dev) -{ -#ifdef CONFIG_MULTITHREADING - struct qspi_nor_data *dev_data = get_dev_data(dev); - - k_sem_take(&dev_data->sem, K_FOREVER); -#else /* CONFIG_MULTITHREADING */ - ARG_UNUSED(dev); -#endif /* CONFIG_MULTITHREADING */ - - /* - * Change the base clock divider only for the time the driver is locked - * to perform a QSPI operation, otherwise the power consumption would be - * increased also when the QSPI peripheral is idle. - */ -#if defined(CONFIG_SOC_SERIES_NRF53X) - nrf_clock_hfclk192m_div_set(NRF_CLOCK, BASE_CLOCK_DIV); - k_busy_wait(BASE_CLOCK_SWITCH_DELAY_US); -#endif -} - -static inline void qspi_unlock(const struct device *dev) -{ -#if defined(CONFIG_SOC_SERIES_NRF53X) - /* Restore the default base clock divider to reduce power consumption. - */ - nrf_clock_hfclk192m_div_set(NRF_CLOCK, NRF_CLOCK_HFCLK_DIV_4); - k_busy_wait(BASE_CLOCK_SWITCH_DELAY_US); -#endif - -#ifdef CONFIG_MULTITHREADING - struct qspi_nor_data *dev_data = get_dev_data(dev); - - k_sem_give(&dev_data->sem); -#else /* CONFIG_MULTITHREADING */ - ARG_UNUSED(dev); -#endif /* CONFIG_MULTITHREADING */ -} - -static inline void qspi_trans_lock(const struct device *dev) -{ -#ifdef CONFIG_MULTITHREADING - struct qspi_nor_data *dev_data = get_dev_data(dev); - - k_sem_take(&dev_data->trans, K_FOREVER); -#else /* CONFIG_MULTITHREADING */ - ARG_UNUSED(dev); -#endif /* CONFIG_MULTITHREADING */ -} - -static inline void qspi_trans_unlock(const struct device *dev) -{ -#ifdef CONFIG_MULTITHREADING - struct qspi_nor_data *dev_data = get_dev_data(dev); - - k_sem_give(&dev_data->trans); -#else /* CONFIG_MULTITHREADING */ - ARG_UNUSED(dev); -#endif /* CONFIG_MULTITHREADING */ -} - -static inline void qspi_wait_for_completion(const struct device *dev, nrfx_err_t res) -{ - struct qspi_nor_data *dev_data = get_dev_data(dev); - - if (res == NRFX_SUCCESS) { -#ifdef CONFIG_MULTITHREADING - k_sem_take(&dev_data->sync, K_FOREVER); -#else /* CONFIG_MULTITHREADING */ - unsigned int key = irq_lock(); - - while (!dev_data->ready) { - k_cpu_atomic_idle(key); - key = irq_lock(); - } - - dev_data->ready = false; - irq_unlock(key); -#endif /* CONFIG_MULTITHREADING */ - } -} - -static inline void qspi_complete(struct qspi_nor_data *dev_data) -{ -#ifdef CONFIG_MULTITHREADING - k_sem_give(&dev_data->sync); -#else /* CONFIG_MULTITHREADING */ - dev_data->ready = true; -#endif /* CONFIG_MULTITHREADING */ -} - -static inline void _qspi_complete(struct qspi_nor_data *dev_data) -{ - if (!qspi_config->easydma) - return; - - qspi_complete(dev_data); -} -static inline void _qspi_wait_for_completion(const struct device *dev, nrfx_err_t res) -{ - if (!qspi_config->easydma) - return; - - qspi_wait_for_completion(dev, res); -} - -/** - * @brief QSPI handler - * - * @param event Driver event type - * @param p_context Pointer to context. Use in interrupt handler. - * @retval None - */ -static void qspi_handler(nrfx_qspi_evt_t event, void *p_context) -{ - struct qspi_nor_data *dev_data = p_context; - - if (event == NRFX_QSPI_EVENT_DONE) - _qspi_complete(dev_data); -} - -static bool qspi_initialized; - -static int qspi_device_init(const struct device *dev) -{ - struct qspi_nor_data *dev_data = get_dev_data(dev); - nrfx_err_t res; - int ret = 0; - - if (!IS_ENABLED(CONFIG_NRF700X_QSPI_LOW_POWER)) { - return 0; - } - - qspi_lock(dev); - - /* In multithreading, driver can call qspi_device_init more than once - * before calling qspi_device_uninit. Keepping count, so QSPI is - * uninitialized only at the last call (count == 0). - */ -#ifdef CONFIG_MULTITHREADING - k_sem_give(&dev_data->count); -#endif - - if (!qspi_initialized) { - res = nrfx_qspi_init(&QSPIconfig, qspi_handler, dev_data); - ret = qspi_get_zephyr_ret_code(res); - NRF_QSPI->IFTIMING |= qspi_config->RDC4IO; - qspi_initialized = (ret == 0); - } - - qspi_unlock(dev); - - return ret; -} - -static void qspi_device_uninit(const struct device *dev) -{ - bool last = true; - - if (!IS_ENABLED(CONFIG_NRF700X_QSPI_LOW_POWER)) { - return; - } - - qspi_lock(dev); - -#ifdef CONFIG_MULTITHREADING - struct qspi_nor_data *dev_data = get_dev_data(dev); - - /* The last thread to finish using the driver uninit the QSPI */ - (void)k_sem_take(&dev_data->count, K_NO_WAIT); - last = (k_sem_count_get(&dev_data->count) == 0); -#endif - - if (last) { - while (nrfx_qspi_mem_busy_check() != NRFX_SUCCESS) { - if (IS_ENABLED(CONFIG_MULTITHREADING)) - k_msleep(50); - else - k_busy_wait(50000); - } - - nrfx_qspi_uninit(); - -#ifndef CONFIG_PINCTRL - nrf_gpio_cfg_output(QSPI_PROP_AT(csn_pins, 0)); - nrf_gpio_pin_set(QSPI_PROP_AT(csn_pins, 0)); -#endif - - qspi_initialized = false; - } - - qspi_unlock(dev); -} - -/* QSPI send custom command. - * - * If this is used for both send and receive the buffer sizes must be - * equal and cover the whole transaction. - */ -static int qspi_send_cmd(const struct device *dev, const struct qspi_cmd *cmd, bool wren) -{ - /* Check input parameters */ - if (!cmd) - return -EINVAL; - - const void *tx_buf = NULL; - size_t tx_len = 0; - void *rx_buf = NULL; - size_t rx_len = 0; - size_t xfer_len = sizeof(cmd->op_code); - - if (cmd->tx_buf) { - tx_buf = cmd->tx_buf->buf; - tx_len = cmd->tx_buf->len; - } - - if (cmd->rx_buf) { - rx_buf = cmd->rx_buf->buf; - rx_len = cmd->rx_buf->len; - } - - if ((rx_len != 0) && (tx_len != 0)) { - if (rx_len != tx_len) - return -EINVAL; - - xfer_len += tx_len; - } else - /* At least one of these is zero. */ - xfer_len += tx_len + rx_len; - - if (xfer_len > NRF_QSPI_CINSTR_LEN_9B) { - LOG_WRN("cinstr %02x transfer too long: %zu", cmd->op_code, xfer_len); - - return -EINVAL; - } - - nrf_qspi_cinstr_conf_t cinstr_cfg = { - .opcode = cmd->op_code, - .length = xfer_len, - .io2_level = true, - .io3_level = true, - .wipwait = false, - .wren = wren, - }; - - qspi_lock(dev); - - int res = nrfx_qspi_cinstr_xfer(&cinstr_cfg, tx_buf, rx_buf); - - qspi_unlock(dev); - return qspi_get_zephyr_ret_code(res); -} - -/* RDSR wrapper. Negative value is error. */ -static int qspi_rdsr(const struct device *dev) -{ - uint8_t sr = -1; - const struct qspi_buf sr_buf = { - .buf = &sr, - .len = sizeof(sr), - }; - struct qspi_cmd cmd = { - .op_code = SPI_NOR_CMD_RDSR, - .rx_buf = &sr_buf, - }; - int ret = qspi_send_cmd(dev, &cmd, false); - - return (ret < 0) ? ret : sr; -} - -/* Wait until RDSR confirms write is not in progress. */ -static int qspi_wait_while_writing(const struct device *dev) -{ - int ret; - - do { - ret = qspi_rdsr(dev); - } while ((ret >= 0) && ((ret & SPI_NOR_WIP_BIT) != 0U)); - - return (ret < 0) ? ret : 0; -} - -/** - * @brief Fills init struct - * - * @param config Pointer to the config struct provided by user - * @param initstruct Pointer to the configuration struct - * @retval None - */ -static inline void qspi_fill_init_struct(nrfx_qspi_config_t *initstruct) -{ - bool quad_mode; - - /* Configure XIP offset */ - initstruct->xip_offset = 0; - -#ifdef CONFIG_PINCTRL - initstruct->skip_gpio_cfg = true, - initstruct->skip_psel_cfg = true, -#else - /* Configure pins */ - initstruct->pins.sck_pin = DT_PROP(QSPI_NODE, sck_pin); - initstruct->pins.csn_pin = QSPI_PROP_AT(csn_pins, 0); - initstruct->pins.io0_pin = QSPI_PROP_AT(io_pins, 0); - initstruct->pins.io1_pin = QSPI_PROP_AT(io_pins, 1); -#if QSPI_PROP_LEN(io_pins) > 2 - initstruct->pins.io2_pin = QSPI_PROP_AT(io_pins, 2); - initstruct->pins.io3_pin = QSPI_PROP_AT(io_pins, 3); -#else - initstruct->pins.io2_pin = NRF_QSPI_PIN_NOT_CONNECTED; - initstruct->pins.io3_pin = NRF_QSPI_PIN_NOT_CONNECTED; -#endif -#endif /* CONFIG_PINCTRL */ - /* Configure Protocol interface */ - initstruct->prot_if.addrmode = NRF_QSPI_ADDRMODE_24BIT; - - initstruct->prot_if.dpmconfig = false; - - /* Configure physical interface */ - initstruct->phy_if.sck_freq = INST_0_SCK_CFG; - - /* Using MHZ fails checkpatch constant check */ - if (INST_0_SCK_FREQUENCY >= 16000000) { - qspi_config->qspi_slave_latency = 1; - } - initstruct->phy_if.sck_delay = QSPI_SCK_DELAY; - initstruct->phy_if.spi_mode = qspi_get_mode(DT_INST_PROP(0, cpol), DT_INST_PROP(0, cpha)); - - quad_mode = DT_INST_PROP(0, quad_mode); - if (quad_mode) { - initstruct->prot_if.readoc = NRF_QSPI_READOC_READ4IO; - initstruct->prot_if.writeoc = NRF_QSPI_WRITEOC_PP4IO; - } else { - initstruct->prot_if.readoc = NRF_QSPI_READOC_FASTREAD; - initstruct->prot_if.writeoc = NRF_QSPI_WRITEOC_PP; - } - - initstruct->phy_if.dpmen = false; -} - -/* Configures QSPI memory for the transfer */ -static int qspi_nrfx_configure(const struct device *dev) -{ - if (!dev) - return -ENXIO; - - struct qspi_nor_data *dev_data = dev->data; - - qspi_fill_init_struct(&QSPIconfig); - -#if defined(CONFIG_SOC_SERIES_NRF53X) - /* When the QSPI peripheral is activated, during the nrfx_qspi driver - * initialization, it reads the status of the connected flash chip. - * Make sure this transaction is performed with a valid base clock - * divider. - */ - nrf_clock_hfclk192m_div_set(NRF_CLOCK, BASE_CLOCK_DIV); - k_busy_wait(BASE_CLOCK_SWITCH_DELAY_US); -#endif - - nrfx_err_t res = _nrfx_qspi_init(&QSPIconfig, qspi_handler, dev_data); - -#if defined(CONFIG_SOC_SERIES_NRF53X) - /* Restore the default /4 divider after the QSPI initialization. */ - nrf_clock_hfclk192m_div_set(NRF_CLOCK, NRF_CLOCK_HFCLK_DIV_4); - k_busy_wait(BASE_CLOCK_SWITCH_DELAY_US); -#endif - - int ret = qspi_get_zephyr_ret_code(res); - - if (ret == 0) { - /* Set QE to match transfer mode. If not using quad - * it's OK to leave QE set, but doing so prevents use - * of WP#/RESET#/HOLD# which might be useful. - * - * Note build assert above ensures QER is S1B6. Other - * options require more logic. - */ - ret = qspi_rdsr(dev); - - if (ret < 0) { - LOG_ERR("RDSR failed: %d", ret); - return ret; - } - - uint8_t sr = (uint8_t)ret; - bool qe_value = (qspi_write_is_quad(QSPIconfig.prot_if.writeoc)) || - (qspi_read_is_quad(QSPIconfig.prot_if.readoc)); - const uint8_t qe_mask = BIT(6); /* only S1B6 */ - bool qe_state = ((sr & qe_mask) != 0U); - - LOG_DBG("RDSR %02x QE %d need %d: %s", sr, qe_state, qe_value, - (qe_state != qe_value) ? "updating" : "no-change"); - - ret = 0; - - if (qe_state != qe_value) { - const struct qspi_buf sr_buf = { - .buf = &sr, - .len = sizeof(sr), - }; - struct qspi_cmd cmd = { - .op_code = SPI_NOR_CMD_WRSR, - .tx_buf = &sr_buf, - }; - - sr ^= qe_mask; - ret = qspi_send_cmd(dev, &cmd, true); - - /* Writing SR can take some time, and further - * commands sent while it's happening can be - * corrupted. Wait. - */ - if (ret == 0) - ret = qspi_wait_while_writing(dev); - } - - if (ret < 0) - LOG_ERR("QE %s failed: %d", qe_value ? "set" : "clear", ret); - } - - return ret; -} - -static inline nrfx_err_t read_non_aligned(const struct device *dev, int addr, void *dest, - size_t size) -{ - uint8_t __aligned(WORD_SIZE) buf[WORD_SIZE * 2]; - uint8_t *dptr = dest; - - int flash_prefix = (WORD_SIZE - (addr % WORD_SIZE)) % WORD_SIZE; - - if (flash_prefix > size) - flash_prefix = size; - - int dest_prefix = (WORD_SIZE - (int)dptr % WORD_SIZE) % WORD_SIZE; - - if (dest_prefix > size) - dest_prefix = size; - - int flash_suffix = (size - flash_prefix) % WORD_SIZE; - int flash_middle = size - flash_prefix - flash_suffix; - int dest_middle = size - dest_prefix - (size - dest_prefix) % WORD_SIZE; - - if (flash_middle > dest_middle) { - flash_middle = dest_middle; - flash_suffix = size - flash_prefix - flash_middle; - } - - nrfx_err_t res = NRFX_SUCCESS; - - /* read from aligned flash to aligned memory */ - if (flash_middle != 0) { - res = _nrfx_qspi_read(dptr + dest_prefix, flash_middle, addr + flash_prefix); - - _qspi_wait_for_completion(dev, res); - - if (res != NRFX_SUCCESS) - return res; - - /* perform shift in RAM */ - if (flash_prefix != dest_prefix) - memmove(dptr + flash_prefix, dptr + dest_prefix, flash_middle); - } - - /* read prefix */ - if (flash_prefix != 0) { - res = _nrfx_qspi_read(buf, WORD_SIZE, addr - (WORD_SIZE - flash_prefix)); - - _qspi_wait_for_completion(dev, res); - - if (res != NRFX_SUCCESS) - return res; - - memcpy(dptr, buf + WORD_SIZE - flash_prefix, flash_prefix); - } - - /* read suffix */ - if (flash_suffix != 0) { - res = _nrfx_qspi_read(buf, WORD_SIZE * 2, addr + flash_prefix + flash_middle); - - _qspi_wait_for_completion(dev, res); - - if (res != NRFX_SUCCESS) - return res; - - memcpy(dptr + flash_prefix + flash_middle, buf, flash_suffix); - } - - return res; -} - -static int qspi_nor_read(const struct device *dev, int addr, void *dest, size_t size) -{ - if (!dest) - return -EINVAL; - - /* read size must be non-zero */ - if (!size) - return 0; - - int rc = qspi_device_init(dev); - - if (rc != 0) - goto out; - - qspi_lock(dev); - - nrfx_err_t res = read_non_aligned(dev, addr, dest, size); - - qspi_unlock(dev); - - rc = qspi_get_zephyr_ret_code(res); - -out: - qspi_device_uninit(dev); - return rc; -} - -/* addr aligned, sptr not null, slen less than 4 */ -static inline nrfx_err_t write_sub_word(const struct device *dev, int addr, const void *sptr, - size_t slen) -{ - uint8_t __aligned(4) buf[4]; - nrfx_err_t res; - - /* read out the whole word so that unchanged data can be - * written back - */ - res = _nrfx_qspi_read(buf, sizeof(buf), addr); - _qspi_wait_for_completion(dev, res); - - if (res == NRFX_SUCCESS) { - memcpy(buf, sptr, slen); - res = _nrfx_qspi_write(buf, sizeof(buf), addr); - _qspi_wait_for_completion(dev, res); - } - - return res; -} - -static int qspi_nor_write(const struct device *dev, int addr, const void *src, size_t size) -{ - if (!src) - return -EINVAL; - - /* write size must be non-zero, less than 4, or a multiple of 4 */ - if ((size == 0) || ((size > 4) && ((size % 4U) != 0))) - return -EINVAL; - - /* address must be 4-byte aligned */ - if ((addr % 4U) != 0) - return -EINVAL; - - nrfx_err_t res = NRFX_SUCCESS; - - int rc = qspi_device_init(dev); - - if (rc != 0) - goto out; - - qspi_trans_lock(dev); - - qspi_lock(dev); - - if (size < 4U) - res = write_sub_word(dev, addr, src, size); - else { - res = _nrfx_qspi_write(src, size, addr); - _qspi_wait_for_completion(dev, res); - } - - qspi_unlock(dev); - - qspi_trans_unlock(dev); - - rc = qspi_get_zephyr_ret_code(res); -out: - qspi_device_uninit(dev); - return rc; -} - -/** - * @brief Configure the flash - * - * @param dev The flash device structure - * @param info The flash info structure - * @return 0 on success, negative errno code otherwise - */ -static int qspi_nor_configure(const struct device *dev) -{ - int ret = qspi_nrfx_configure(dev); - - if (ret != 0) - return ret; - - qspi_device_uninit(dev); - - return 0; -} - -/** - * @brief Initialize and configure the flash - * - * @param name The flash name - * @return 0 on success, negative errno code otherwise - */ -static int qspi_nor_init(const struct device *dev) -{ -#ifdef CONFIG_PINCTRL - int ret = pinctrl_apply_state(PINCTRL_DT_DEV_CONFIG_GET(QSPI_NODE), PINCTRL_STATE_DEFAULT); - - if (ret < 0) { - return ret; - } -#endif - - IRQ_CONNECT(DT_IRQN(QSPI_NODE), DT_IRQ(QSPI_NODE, priority), nrfx_isr, - nrfx_qspi_irq_handler, 0); - return qspi_nor_configure(dev); -} - -#if defined(CONFIG_SOC_SERIES_NRF53X) -static int qspi_cmd_encryption(const struct device *dev, nrf_qspi_encryption_t *p_cfg) -{ - const struct qspi_buf tx_buf = { .buf = (uint8_t *)&p_cfg->nonce[1], - .len = sizeof(p_cfg->nonce[1]) }; - const struct qspi_cmd cmd = { - .op_code = 0x4f, - .tx_buf = &tx_buf, - }; - - int ret = qspi_device_init(dev); - - if (ret == 0) - ret = qspi_send_cmd(dev, &cmd, false); - - qspi_device_uninit(dev); - - if (ret < 0) - LOG_DBG("cmd_encryption failed %d", ret); - - return ret; -} -#endif - -int qspi_RDSR2(const struct device *dev, uint8_t *rdsr2) -{ - int ret = 0; - uint8_t sr = 0; - - const struct qspi_buf sr_buf = { - .buf = &sr, - .len = sizeof(sr), - }; - struct qspi_cmd cmd = { - .op_code = 0x2f, - .rx_buf = &sr_buf, - }; - - ret = qspi_device_init(dev); - - ret = qspi_send_cmd(dev, &cmd, false); - - qspi_device_uninit(dev); - - LOG_DBG("RDSR2 = 0x%x", sr); - - if (ret == 0) - *rdsr2 = sr; - - return ret; -} - -/* Wait until RDSR2 confirms RPU_WAKE write is successful */ -int qspi_validate_rpu_wake_writecmd(const struct device *dev) -{ - int ret = 0; - uint8_t rdsr2 = 0; - - for (int ii = 0; ii < 1; ii++) { - ret = qspi_RDSR2(dev, &rdsr2); - if (!ret && (rdsr2 & RPU_WAKEUP_NOW)) { - return 0; - } - } - - return -1; -} - - -int qspi_RDSR1(const struct device *dev, uint8_t *rdsr1) -{ - int ret = 0; - uint8_t sr = 0; - - const struct qspi_buf sr_buf = { - .buf = &sr, - .len = sizeof(sr), - }; - struct qspi_cmd cmd = { - .op_code = 0x1f, - .rx_buf = &sr_buf, - }; - - ret = qspi_device_init(dev); - - ret = qspi_send_cmd(dev, &cmd, false); - - qspi_device_uninit(dev); - - LOG_DBG("RDSR1 = 0x%x", sr); - - if (ret == 0) - *rdsr1 = sr; - - return ret; -} - -/* Wait until RDSR1 confirms RPU_AWAKE/RPU_READY */ -int qspi_wait_while_rpu_awake(const struct device *dev) -{ - int ret; - uint8_t val = 0; - - for (int ii = 0; ii < 10; ii++) { - ret = qspi_RDSR1(dev, &val); - - LOG_DBG("RDSR1 = 0x%x", val); - - if (!ret && (val & RPU_AWAKE_BIT)) { - break; - } - - k_msleep(1); - } - - if (ret || !(val & RPU_AWAKE_BIT)) { - LOG_ERR("RPU is not awake even after 10ms"); - return -1; - } - - /* Restore QSPI clock frequency from DTS */ - QSPIconfig.phy_if.sck_freq = INST_0_SCK_CFG; - - return val; -} - -int qspi_WRSR2(const struct device *dev, uint8_t data) -{ - const struct qspi_buf tx_buf = { - .buf = &data, - .len = sizeof(data), - }; - const struct qspi_cmd cmd = { - .op_code = 0x3f, - .tx_buf = &tx_buf, - }; - int ret = qspi_device_init(dev); - - if (ret == 0) - ret = qspi_send_cmd(dev, &cmd, false); - - qspi_device_uninit(dev); - - if (ret < 0) - LOG_ERR("cmd_wakeup RPU failed %d", ret); - - return ret; -} - -int qspi_cmd_wakeup_rpu(const struct device *dev, uint8_t data) -{ - int ret; - - /* Waking RPU works reliably only with lowest frequency (8MHz) */ - QSPIconfig.phy_if.sck_freq = INST_0_SCK_CFG_WAKE; - - ret = qspi_WRSR2(dev, data); - - return ret; -} - -struct device qspi_perip = { - .data = &qspi_nor_memory_data, -}; - -int qspi_deinit(void) -{ - LOG_DBG("TODO : %s", __func__); - - return 0; -} - -int qspi_init(struct qspi_config *config) -{ - unsigned int rc; - - qspi_config = config; - - config->readoc = config->quad_spi ? NRF_QSPI_READOC_READ4IO : NRF_QSPI_READOC_FASTREAD; - config->writeoc = config->quad_spi ? NRF_QSPI_WRITEOC_PP4IO : NRF_QSPI_WRITEOC_PP; - - rc = qspi_nor_init(&qspi_perip); - - k_sem_init(&qspi_config->lock, 1, 1); - - return rc; -} - -void qspi_update_nonce(unsigned int addr, int len, int hlread) -{ -#if NRF_QSPI_HAS_XIP_ENC || NRF_QSPI_HAS_DMA_ENC - - NRF_QSPI_Type *p_reg = NRF_QSPI; - - if (!qspi_config->encryption) - return; - - if (nonce_last_addr == 0 || hlread) - p_reg->DMA_ENC.NONCE2 = ++nonce_cnt; - else if ((nonce_last_addr + 4) != addr) - p_reg->DMA_ENC.NONCE2 = ++nonce_cnt; - - nonce_last_addr = addr + len - 4; - -#endif /*NRF_QSPI_HAS_XIP_ENC || NRF_QSPI_HAS_DMA_ENC*/ -} - -void qspi_addr_check(unsigned int addr, const void *data, unsigned int len) -{ - if ((addr % 4 != 0) || (((unsigned int)data) % 4 != 0) || (len % 4 != 0)) { - LOG_ERR("%s : Unaligned address %x %x %d %x %x", __func__, addr, - (unsigned int)data, (addr % 4 != 0), (((unsigned int)data) % 4 != 0), - (len % 4 != 0)); - } -} - -int qspi_write(unsigned int addr, const void *data, int len) -{ - int status; - - qspi_addr_check(addr, data, len); - - addr |= qspi_config->addrmask; - - k_sem_take(&qspi_config->lock, K_FOREVER); - - qspi_update_nonce(addr, len, 0); - - status = qspi_nor_write(&qspi_perip, addr, data, len); - - k_sem_give(&qspi_config->lock); - - return status; -} - -int qspi_read(unsigned int addr, void *data, int len) -{ - int status; - - qspi_addr_check(addr, data, len); - - addr |= qspi_config->addrmask; - - k_sem_take(&qspi_config->lock, K_FOREVER); - - qspi_update_nonce(addr, len, 0); - - status = qspi_nor_read(&qspi_perip, addr, data, len); - - k_sem_give(&qspi_config->lock); - - return status; -} - -int qspi_hl_readw(unsigned int addr, void *data) -{ - int status; - uint8_t *rxb = NULL; - uint32_t len = 4; - - len = len + (4 * qspi_config->qspi_slave_latency); - - rxb = k_malloc(len); - - if (rxb == NULL) { - LOG_ERR("%s: ERROR ENOMEM line %d", __func__, __LINE__); - return -ENOMEM; - } - - memset(rxb, 0, len); - - k_sem_take(&qspi_config->lock, K_FOREVER); - - qspi_update_nonce(addr, 4, 1); - - status = qspi_nor_read(&qspi_perip, addr, rxb, len); - - k_sem_give(&qspi_config->lock); - - *(uint32_t *)data = *(uint32_t *)(rxb + (len - 4)); - - k_free(rxb); - - return status; -} - -int qspi_hl_read(unsigned int addr, void *data, int len) -{ - int count = 0; - - qspi_addr_check(addr, data, len); - - while (count < (len / 4)) { - qspi_hl_readw(addr + (4 * count), ((char *)data + (4 * count))); - count++; - } - - return 0; -} - -int qspi_cmd_sleep_rpu(const struct device *dev) -{ - uint8_t data = 0x0; - - /* printf("TODO : %s:", __func__); */ - const struct qspi_buf tx_buf = { - .buf = &data, - .len = sizeof(data), - }; - - const struct qspi_cmd cmd = { - .op_code = 0x3f, /* 0x3f, //WRSR2(0x3F) WakeUP RPU. */ - .tx_buf = &tx_buf, - }; - - int ret = qspi_device_init(dev); - - if (ret == 0) { - ret = qspi_send_cmd(dev, &cmd, false); - } - - qspi_device_uninit(dev); - - if (ret < 0) { - LOG_ERR("cmd_wakeup RPU failed: %d", ret); - } - - return ret; -} - -/* Encryption public API */ - -int qspi_enable_encryption(uint8_t *key) -{ -#if defined(CONFIG_SOC_SERIES_NRF53X) - int err = 0; - - if (qspi_config->encryption) - return -EALREADY; - - int ret = qspi_device_init(&qspi_perip); - - if (ret != 0) { - LOG_ERR("qspi_device_init failed: %d", ret); - return -EIO; - } - - memcpy(qspi_config->p_cfg.key, key, 16); - - err = nrfx_qspi_dma_encrypt(&qspi_config->p_cfg); - if (err != NRFX_SUCCESS) { - LOG_ERR("nrfx_qspi_dma_encrypt failed: %d", err); - return -EIO; - } - - err = qspi_cmd_encryption(&qspi_perip, &qspi_config->p_cfg); - if (err != 0) { - LOG_ERR("qspi_cmd_encryption failed: %d", err); - return -EIO; - } - - qspi_config->encryption = true; - - qspi_device_uninit(&qspi_perip); - - return 0; -#else - return -ENOTSUP; -#endif -} diff --git a/drivers/wifi/nrf700x/src/qspi/src/rpu_hw_if.c b/drivers/wifi/nrf700x/src/qspi/src/rpu_hw_if.c deleted file mode 100644 index a1daffc18747..000000000000 --- a/drivers/wifi/nrf700x/src/qspi/src/rpu_hw_if.c +++ /dev/null @@ -1,482 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief File containing common functions for RPU hardware interaction - * using QSPI and SPI that can be invoked by shell or the driver. - */ - -#include -#include - -#include -#include -#include -#include -#include - -#include "rpu_hw_if.h" -#include "qspi_if.h" -#include "spi_if.h" - -LOG_MODULE_REGISTER(wifi_nrf_bus, CONFIG_WIFI_NRF700X_BUS_LOG_LEVEL); - -#define NRF7002_NODE DT_NODELABEL(nrf700x) - -static const struct gpio_dt_spec host_irq_spec = -GPIO_DT_SPEC_GET(NRF7002_NODE, host_irq_gpios); - -static const struct gpio_dt_spec iovdd_ctrl_spec = -GPIO_DT_SPEC_GET(NRF7002_NODE, iovdd_ctrl_gpios); - -static const struct gpio_dt_spec bucken_spec = -GPIO_DT_SPEC_GET(NRF7002_NODE, bucken_gpios); - -char blk_name[][15] = { "SysBus", "ExtSysBus", "PBus", "PKTRAM", - "GRAM", "LMAC_ROM", "LMAC_RET_RAM", "LMAC_SRC_RAM", - "UMAC_ROM", "UMAC_RET_RAM", "UMAC_SRC_RAM" }; - -uint32_t rpu_7002_memmap[][3] = { - { 0x000000, 0x008FFF, 1 }, - { 0x009000, 0x03FFFF, 2 }, - { 0x040000, 0x07FFFF, 1 }, - { 0x0C0000, 0x0F0FFF, 0 }, - { 0x080000, 0x092000, 1 }, - { 0x100000, 0x134000, 1 }, - { 0x140000, 0x14C000, 1 }, - { 0x180000, 0x190000, 1 }, - { 0x200000, 0x261800, 1 }, - { 0x280000, 0x2A4000, 1 }, - { 0x300000, 0x338000, 1 } -}; - -static const struct qspi_dev *qdev; -static struct qspi_config *cfg; - -static int validate_addr_blk(uint32_t start_addr, - uint32_t end_addr, - uint32_t block_no, - bool *hl_flag, - int *selected_blk) -{ - uint32_t *block_map = rpu_7002_memmap[block_no]; - - if (((start_addr >= block_map[0]) && (start_addr <= block_map[1])) && - ((end_addr >= block_map[0]) && (end_addr <= block_map[1]))) { - if (block_no == PKTRAM) { - *hl_flag = 0; - } - *selected_blk = block_no; - return 0; - } - - return -1; -} - -static int rpu_validate_addr(uint32_t start_addr, uint32_t len, bool *hl_flag) -{ - int ret = 0, i; - uint32_t end_addr; - int selected_blk; - - end_addr = start_addr + len - 1; - - *hl_flag = 1; - - for (i = 0; i < NUM_MEM_BLOCKS; i++) { - ret = validate_addr_blk(start_addr, end_addr, i, hl_flag, &selected_blk); - if (!ret) { - break; - } - } - - if (ret) { - LOG_ERR("Address validation failed - pls check memmory map and re-try"); - return -1; - } - - if ((selected_blk == LMAC_ROM) || (selected_blk == UMAC_ROM)) { - LOG_ERR("Error: Cannot write to ROM blocks"); - return -1; - } - - cfg->qspi_slave_latency = (*hl_flag) ? rpu_7002_memmap[selected_blk][2] : 0; - - return 0; -} - -int rpu_irq_config(struct gpio_callback *irq_callback_data, void (*irq_handler)()) -{ - int ret; - - if (!device_is_ready(host_irq_spec.port)) { - LOG_ERR("Host IRQ GPIO %s is not ready", host_irq_spec.port->name); - return -ENODEV; - } - - ret = gpio_pin_configure_dt(&host_irq_spec, GPIO_INPUT); - if (ret) { - LOG_ERR("Failed to configure host_irq pin %d", host_irq_spec.pin); - goto out; - } - - ret = gpio_pin_interrupt_configure_dt(&host_irq_spec, - GPIO_INT_EDGE_TO_ACTIVE); - if (ret) { - LOG_ERR("Failed to configure interrupt on host_irq pin %d", - host_irq_spec.pin); - goto out; - } - - gpio_init_callback(irq_callback_data, - irq_handler, - BIT(host_irq_spec.pin)); - - ret = gpio_add_callback(host_irq_spec.port, irq_callback_data); - if (ret) { - LOG_ERR("Failed to add callback on host_irq pin %d", - host_irq_spec.pin); - goto out; - } - - LOG_DBG("Finished Interrupt config\n"); - -out: - return ret; -} - -int rpu_irq_remove(struct gpio_callback *irq_callback_data) -{ - int ret; - - ret = gpio_pin_configure_dt(&host_irq_spec, GPIO_DISCONNECTED); - if (ret) { - LOG_ERR("Failed to remove host_irq pin %d", host_irq_spec.pin); - goto out; - } - - ret = gpio_remove_callback(host_irq_spec.port, irq_callback_data); - if (ret) { - LOG_ERR("Failed to remove callback on host_irq pin %d", - host_irq_spec.pin); - goto out; - } - -out: - return ret; -} - -static int rpu_gpio_config(void) -{ - int ret; - - if (!device_is_ready(iovdd_ctrl_spec.port)) { - LOG_ERR("IOVDD GPIO %s is not ready", iovdd_ctrl_spec.port->name); - return -ENODEV; - } - - if (!device_is_ready(bucken_spec.port)) { - LOG_ERR("BUCKEN GPIO %s is not ready", bucken_spec.port->name); - return -ENODEV; - } - - ret = gpio_pin_configure_dt(&bucken_spec, (GPIO_OUTPUT | NRF_GPIO_DRIVE_H0H1)); - if (ret) { - LOG_ERR("BUCKEN GPIO configuration failed..."); - return ret; - } - - ret = gpio_pin_configure_dt(&iovdd_ctrl_spec, GPIO_OUTPUT); - if (ret) { - LOG_ERR("IOVDD GPIO configuration failed..."); - gpio_pin_configure_dt(&bucken_spec, GPIO_DISCONNECTED); - return ret; - } - - LOG_DBG("GPIO configuration done...\n"); - - return 0; -} - -static int rpu_gpio_remove(void) -{ - int ret; - - ret = gpio_pin_configure_dt(&bucken_spec, GPIO_DISCONNECTED); - if (ret) { - LOG_ERR("BUCKEN GPIO remove failed..."); - return ret; - } - - ret = gpio_pin_configure_dt(&iovdd_ctrl_spec, GPIO_DISCONNECTED); - if (ret) { - LOG_ERR("IOVDD GPIO remove failed..."); - return ret; - } - - LOG_DBG("GPIO remove done...\n"); - return ret; -} - -static int rpu_pwron(void) -{ - int ret; - - ret = gpio_pin_set_dt(&bucken_spec, 1); - if (ret) { - LOG_ERR("BUCKEN GPIO set failed..."); - return ret; - } - /* Settling time is 50us (H0) or 100us (L0) */ - k_msleep(1); - - ret = gpio_pin_set_dt(&iovdd_ctrl_spec, 1); - if (ret) { - LOG_ERR("IOVDD GPIO set failed..."); - gpio_pin_set_dt(&bucken_spec, 0); - return ret; - } - /* Settling time for iovdd nRF7002 DK/EK - switch (TCK106AG): ~600us */ - k_msleep(1); - - if (IS_ENABLED(CONFIG_NRF_WIFI_COMBINED_BUCKEN_IOVDD_GPIO)) { - /* When a single GPIO is used, we need a total wait time after bucken assertion - * to be 6ms (1ms + 1ms + 4ms). - */ - k_msleep(4); - } - - LOG_DBG("Bucken = %d, IOVDD = %d", gpio_pin_get_dt(&bucken_spec), - gpio_pin_get_dt(&iovdd_ctrl_spec)); - - return ret; -} - -static int rpu_pwroff(void) -{ - int ret; - - ret = gpio_pin_set_dt(&bucken_spec, 0); /* BUCKEN = 0 */ - if (ret) { - LOG_ERR("BUCKEN GPIO set failed..."); - return ret; - } - - ret = gpio_pin_set_dt(&iovdd_ctrl_spec, 0); /* IOVDD CNTRL = 0 */ - if (ret) { - LOG_ERR("IOVDD GPIO set failed..."); - return ret; - } - - return ret; -} - -int rpu_read(unsigned int addr, void *data, int len) -{ - bool hl_flag; - - if (rpu_validate_addr(addr, len, &hl_flag)) { - return -1; - } - - if (hl_flag) - return qdev->hl_read(addr, data, len); - else - return qdev->read(addr, data, len); -} - -int rpu_write(unsigned int addr, const void *data, int len) -{ - bool hl_flag; - - if (rpu_validate_addr(addr, len, &hl_flag)) { - return -1; - } - - return qdev->write(addr, data, len); -} - -int rpu_sleep(void) -{ -#if CONFIG_NRF700X_ON_QSPI - return qspi_cmd_sleep_rpu(&qspi_perip); -#else - return spim_cmd_sleep_rpu_fn(); -#endif -} - -int rpu_wakeup(void) -{ - int ret; - - ret = rpu_wrsr2(1); - if (ret) { - LOG_ERR("Error: WRSR2 failed"); - return ret; - } - - ret = rpu_rdsr2(); - if (ret < 0) { - LOG_ERR("Error: RDSR2 failed"); - return ret; - } - - ret = rpu_rdsr1(); - if (ret < 0) { - LOG_ERR("Error: RDSR1 failed"); - return ret; - } - - return 0; -} - -int rpu_sleep_status(void) -{ - return rpu_rdsr1(); -} - -void rpu_get_sleep_stats(uint32_t addr, uint32_t *buff, uint32_t wrd_len) -{ - int ret; - - ret = rpu_wakeup(); - if (ret) { - LOG_ERR("Error: RPU wakeup failed"); - return; - } - - ret = rpu_read(addr, buff, wrd_len * 4); - if (ret) { - LOG_ERR("Error: RPU read failed"); - return; - } - - ret = rpu_sleep(); - if (ret) { - LOG_ERR("Error: RPU sleep failed"); - return; - } -} - -int rpu_wrsr2(uint8_t data) -{ - int ret; - -#if CONFIG_NRF700X_ON_QSPI - ret = qspi_cmd_wakeup_rpu(&qspi_perip, data); -#else - ret = spim_cmd_rpu_wakeup_fn(data); -#endif - - LOG_DBG("Written 0x%x to WRSR2", data); - return ret; -} - -int rpu_rdsr2(void) -{ -#if CONFIG_NRF700X_ON_QSPI - return qspi_validate_rpu_wake_writecmd(&qspi_perip); -#else - return spi_validate_rpu_wake_writecmd(); -#endif -} - -int rpu_rdsr1(void) -{ -#if CONFIG_NRF700X_ON_QSPI - return qspi_wait_while_rpu_awake(&qspi_perip); -#else - return spim_wait_while_rpu_awake(); -#endif -} - - -int rpu_clks_on(void) -{ - uint32_t rpu_clks = 0x100; - /* Enable RPU Clocks */ - qdev->write(0x048C20, &rpu_clks, 4); - LOG_DBG("RPU Clocks ON..."); - return 0; -} - -#define CALL_RPU_FUNC(func, ...) \ - do { \ - ret = func(__VA_ARGS__); \ - if (ret) { \ - LOG_DBG("Error: %s failed with %d", #func, ret); \ - goto out; \ - } \ - } while (0) - -int rpu_init(void) -{ - int ret; - - qdev = qspi_dev(); - cfg = qspi_get_config(); - - CALL_RPU_FUNC(rpu_gpio_config); - -#ifdef CONFIG_NRF700X_SR_COEX_RF_SWITCH - ret = sr_gpio_config(); - if (ret) { - goto remove_sr_gpio; - } -#endif - ret = rpu_pwron(); - if (ret) { - goto remove_rpu_gpio; - } - - return 0; - -remove_rpu_gpio: - rpu_gpio_remove(); - -#ifdef CONFIG_NRF700X_SR_COEX_RF_SWITCH -remove_sr_gpio: - sr_gpio_remove(); -#endif -out: - return ret; -} - -int rpu_enable(void) -{ - int ret; - - ret = rpu_wakeup(); - if (ret) { - goto rpu_pwroff; - } - - ret = rpu_clks_on(); - if (ret) { - goto rpu_pwroff; - } - - return 0; -rpu_pwroff: - rpu_pwroff(); - return ret; -} - -int rpu_disable(void) -{ - int ret; - - CALL_RPU_FUNC(rpu_pwroff); - CALL_RPU_FUNC(rpu_gpio_remove); -#ifdef CONFIG_NRF700X_SR_COEX_RF_SWITCH - CALL_RPU_FUNC(sr_gpio_remove); -#endif - qdev = NULL; - cfg = NULL; - -out: - return ret; -} diff --git a/drivers/wifi/nrf700x/src/qspi/src/spi_if.c b/drivers/wifi/nrf700x/src/qspi/src/spi_if.c deleted file mode 100644 index 51180ad03287..000000000000 --- a/drivers/wifi/nrf700x/src/qspi/src/spi_if.c +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief File containing SPI device interface specific definitions for the - * Zephyr OS layer of the Wi-Fi driver. - */ - -#include - -#include -#include - -#include "qspi_if.h" -#include "spi_if.h" - -LOG_MODULE_DECLARE(wifi_nrf_bus, CONFIG_WIFI_NRF700X_BUS_LOG_LEVEL); - -#define NRF7002_NODE DT_NODELABEL(nrf700x) - -static struct qspi_config *spim_config; - -static const struct spi_dt_spec spi_spec = -SPI_DT_SPEC_GET(NRF7002_NODE, SPI_WORD_SET(8) | SPI_TRANSFER_MSB, 0); - -static int spim_xfer_tx(unsigned int addr, void *data, unsigned int len) -{ - int err; - uint8_t hdr[4] = { - 0x02, /* PP opcode */ - (((addr >> 16) & 0xFF) | 0x80), - (addr >> 8) & 0xFF, - (addr & 0xFF) - }; - - const struct spi_buf tx_buf[] = { - {.buf = hdr, .len = sizeof(hdr) }, - {.buf = data, .len = len }, - }; - const struct spi_buf_set tx = { .buffers = tx_buf, .count = 2 }; - - - err = spi_transceive_dt(&spi_spec, &tx, NULL); - - return err; -} - - -static int spim_xfer_rx(unsigned int addr, void *data, unsigned int len, unsigned int discard_bytes) -{ - uint8_t hdr[] = { - 0x0b, /* FASTREAD opcode */ - (addr >> 16) & 0xFF, - (addr >> 8) & 0xFF, - addr & 0xFF, - 0 /* dummy byte */ - }; - - const struct spi_buf tx_buf[] = { - {.buf = hdr, .len = sizeof(hdr) }, - {.buf = NULL, .len = len }, - }; - - const struct spi_buf_set tx = { .buffers = tx_buf, .count = 2 }; - - const struct spi_buf rx_buf[] = { - {.buf = NULL, .len = sizeof(hdr) + discard_bytes}, - {.buf = data, .len = len }, - }; - - const struct spi_buf_set rx = { .buffers = rx_buf, .count = 2 }; - - return spi_transceive_dt(&spi_spec, &tx, &rx); -} - -int spim_read_reg(uint32_t reg_addr, uint8_t *reg_value) -{ - int err; - uint8_t tx_buffer[6] = { reg_addr }; - - const struct spi_buf tx_buf = { - .buf = tx_buffer, - .len = sizeof(tx_buffer) - }; - - const struct spi_buf_set tx = { - .buffers = &tx_buf, - .count = 1 - }; - - uint8_t sr[6]; - - struct spi_buf rx_buf = { - .buf = &sr, - .len = sizeof(sr), - }; - const struct spi_buf_set rx = { .buffers = &rx_buf, .count = 1 }; - - err = spi_transceive_dt(&spi_spec, &tx, &rx); - - LOG_DBG("err: %d -> %x %x %x %x %x %x", err, sr[0], sr[1], sr[2], sr[3], sr[4], sr[5]); - - if (err == 0) - *reg_value = sr[1]; - - return err; -} - -int spim_write_reg(uint32_t reg_addr, const uint8_t reg_value) -{ - int err; - uint8_t tx_buffer[] = { reg_addr, reg_value }; - - const struct spi_buf tx_buf = { .buf = tx_buffer, .len = sizeof(tx_buffer) }; - const struct spi_buf_set tx = { .buffers = &tx_buf, .count = 1 }; - - err = spi_transceive_dt(&spi_spec, &tx, NULL); - - if (err) { - LOG_ERR("SPI error: %d", err); - } - - return err; -} - - -int spim_RDSR1(const struct device *dev, uint8_t *rdsr1) -{ - uint8_t val = 0; - - return spim_read_reg(0x1F, &val); -} - -int spim_RDSR2(const struct device *dev, uint8_t *rdsr1) -{ - uint8_t val = 0; - - return spim_read_reg(0x2F, &val); -} - -int spim_WRSR2(const struct device *dev, const uint8_t wrsr2) -{ - return spim_write_reg(0x3F, wrsr2); -} - -int _spim_wait_while_rpu_awake(void) -{ - int ret; - uint8_t val = 0; - - for (int ii = 0; ii < 10; ii++) { - - ret = spim_read_reg(0x1F, &val); - - LOG_DBG("RDSR1 = 0x%x", val); - - if (!ret && (val & RPU_AWAKE_BIT)) { - break; - } - - k_msleep(1); - } - - if (ret || !(val & RPU_AWAKE_BIT)) { - LOG_ERR("RPU is not awake even after 10ms"); - return -1; - } - - return val; -} - -/* Wait until RDSR2 confirms RPU_WAKEUP_NOW write is successful */ -int spim_wait_while_rpu_wake_write(void) -{ - int ret; - uint8_t val = 0; - - for (int ii = 0; ii < 10; ii++) { - - ret = spim_read_reg(0x2F, &val); - - LOG_DBG("RDSR2 = 0x%x", val); - - if (!ret && (val & RPU_WAKEUP_NOW)) { - break; - } - - k_msleep(1); - } - - if (ret || !(val & RPU_WAKEUP_NOW)) { - LOG_ERR("RPU wakeup write ACK failed even after 10ms"); - return -1; - } - - return ret; -} - -int spim_cmd_rpu_wakeup(uint32_t data) -{ - return spim_write_reg(0x3F, data); -} - -unsigned int spim_cmd_sleep_rpu(void) -{ - int err; - uint8_t tx_buffer[] = { 0x3f, 0x0 }; - - const struct spi_buf tx_buf = { .buf = tx_buffer, .len = sizeof(tx_buffer) }; - const struct spi_buf_set tx = { .buffers = &tx_buf, .count = 1 }; - - err = spi_transceive_dt(&spi_spec, &tx, NULL); - - if (err) { - LOG_ERR("SPI error: %d", err); - } - - return 0; -} - -int spim_init(struct qspi_config *config) -{ - if (!spi_is_ready_dt(&spi_spec)) { - LOG_ERR("Device %s is not ready", spi_spec.bus->name); - return -ENODEV; - } - - spim_config = config; - - k_sem_init(&spim_config->lock, 1, 1); - - if (spi_spec.config.frequency >= MHZ(16)) { - spim_config->qspi_slave_latency = 1; - } - - LOG_INF("SPIM %s: freq = %d MHz", spi_spec.bus->name, - spi_spec.config.frequency / MHZ(1)); - LOG_INF("SPIM %s: latency = %d", spi_spec.bus->name, spim_config->qspi_slave_latency); - - return 0; -} - -int spim_deinit(void) -{ - LOG_DBG("TODO : %s", __func__); - - return 0; -} - -static void spim_addr_check(unsigned int addr, const void *data, unsigned int len) -{ - if ((addr % 4 != 0) || (((unsigned int)data) % 4 != 0) || (len % 4 != 0)) { - LOG_ERR("%s : Unaligned address %x %x %d %x %x", __func__, addr, - (unsigned int)data, (addr % 4 != 0), (((unsigned int)data) % 4 != 0), - (len % 4 != 0)); - } -} - -int spim_write(unsigned int addr, const void *data, int len) -{ - int status; - - spim_addr_check(addr, data, len); - - addr |= spim_config->addrmask; - - k_sem_take(&spim_config->lock, K_FOREVER); - - status = spim_xfer_tx(addr, (void *)data, len); - - k_sem_give(&spim_config->lock); - - return status; -} - -int spim_read(unsigned int addr, void *data, int len) -{ - int status; - - spim_addr_check(addr, data, len); - - addr |= spim_config->addrmask; - - k_sem_take(&spim_config->lock, K_FOREVER); - - status = spim_xfer_rx(addr, data, len, 0); - - k_sem_give(&spim_config->lock); - - return status; -} - -static int spim_hl_readw(unsigned int addr, void *data) -{ - int status = -1; - - k_sem_take(&spim_config->lock, K_FOREVER); - - status = spim_xfer_rx(addr, data, 4, 4 * spim_config->qspi_slave_latency); - - k_sem_give(&spim_config->lock); - - return status; -} - -int spim_hl_read(unsigned int addr, void *data, int len) -{ - int count = 0; - - spim_addr_check(addr, data, len); - - while (count < (len / 4)) { - spim_hl_readw(addr + (4 * count), (char *)data + (4 * count)); - count++; - } - - return 0; -} - -/* ------------------------------added for wifi utils -------------------------------- */ - -int spim_cmd_rpu_wakeup_fn(uint32_t data) -{ - return spim_cmd_rpu_wakeup(data); -} - -int spim_cmd_sleep_rpu_fn(void) -{ - return spim_cmd_sleep_rpu(); -} - -int spim_wait_while_rpu_awake(void) -{ - return _spim_wait_while_rpu_awake(); -} - -int spi_validate_rpu_wake_writecmd(void) -{ - return spim_wait_while_rpu_wake_write(); -} diff --git a/drivers/wifi/nrf700x/src/shim.c b/drivers/wifi/nrf700x/src/shim.c deleted file mode 100644 index 240f78340a25..000000000000 --- a/drivers/wifi/nrf700x/src/shim.c +++ /dev/null @@ -1,973 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief Header containing OS specific definitions for the - * Zephyr OS layer of the Wi-Fi driver. - */ - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "rpu_hw_if.h" -#include "shim.h" -#include "work.h" -#include "timer.h" -#include "osal_ops.h" -#include "qspi_if.h" - -LOG_MODULE_REGISTER(wifi_nrf, CONFIG_WIFI_NRF700X_LOG_LEVEL); - -struct zep_shim_intr_priv *intr_priv; - -static void *zep_shim_mem_alloc(size_t size) -{ - size = (size + 4) & 0xfffffffc; - return k_malloc(size); -} - -static void *zep_shim_mem_zalloc(size_t size) -{ - size = (size + 4) & 0xfffffffc; - return k_calloc(size, sizeof(char)); -} - -static void *zep_shim_mem_cpy(void *dest, const void *src, size_t count) -{ - return memcpy(dest, src, count); -} - -static void *zep_shim_mem_set(void *start, int val, size_t size) -{ - return memset(start, val, size); -} - -static int zep_shim_mem_cmp(const void *addr1, - const void *addr2, - size_t size) -{ - return memcmp(addr1, addr2, size); -} - -static unsigned int zep_shim_qspi_read_reg32(void *priv, unsigned long addr) -{ - unsigned int val; - struct zep_shim_bus_qspi_priv *qspi_priv = priv; - struct qspi_dev *dev; - - dev = qspi_priv->qspi_dev; - - if (addr < 0x0C0000) { - dev->hl_read(addr, &val, 4); - } else { - dev->read(addr, &val, 4); - } - - return val; -} - -static void zep_shim_qspi_write_reg32(void *priv, unsigned long addr, unsigned int val) -{ - struct zep_shim_bus_qspi_priv *qspi_priv = priv; - struct qspi_dev *dev; - - dev = qspi_priv->qspi_dev; - - dev->write(addr, &val, 4); -} - -static void zep_shim_qspi_cpy_from(void *priv, void *dest, unsigned long addr, size_t count) -{ - struct zep_shim_bus_qspi_priv *qspi_priv = priv; - struct qspi_dev *dev; - - dev = qspi_priv->qspi_dev; - - if (count % 4 != 0) { - count = (count + 4) & 0xfffffffc; - } - - if (addr < 0x0C0000) { - dev->hl_read(addr, dest, count); - } else { - dev->read(addr, dest, count); - } -} - -static void zep_shim_qspi_cpy_to(void *priv, unsigned long addr, const void *src, size_t count) -{ - struct zep_shim_bus_qspi_priv *qspi_priv = priv; - struct qspi_dev *dev; - - dev = qspi_priv->qspi_dev; - - if (count % 4 != 0) { - count = (count + 4) & 0xfffffffc; - } - - dev->write(addr, src, count); -} - -static void *zep_shim_spinlock_alloc(void) -{ - struct k_sem *lock = NULL; - - lock = k_malloc(sizeof(*lock)); - - if (!lock) { - LOG_ERR("%s: Unable to allocate memory for spinlock", __func__); - } - - return lock; -} - -static void zep_shim_spinlock_free(void *lock) -{ - k_free(lock); -} - -static void zep_shim_spinlock_init(void *lock) -{ - k_sem_init(lock, 1, 1); -} - -static void zep_shim_spinlock_take(void *lock) -{ - k_sem_take(lock, K_FOREVER); -} - -static void zep_shim_spinlock_rel(void *lock) -{ - k_sem_give(lock); -} - -static void zep_shim_spinlock_irq_take(void *lock, unsigned long *flags) -{ - k_sem_take(lock, K_FOREVER); -} - -static void zep_shim_spinlock_irq_rel(void *lock, unsigned long *flags) -{ - k_sem_give(lock); -} - -static int zep_shim_pr_dbg(const char *fmt, va_list args) -{ - char buf[80]; - - vsnprintf(buf, sizeof(buf), fmt, args); - - LOG_DBG("%s", buf); - - return 0; -} - -static int zep_shim_pr_info(const char *fmt, va_list args) -{ - char buf[80]; - - vsnprintf(buf, sizeof(buf), fmt, args); - - LOG_INF("%s", buf); - - return 0; -} - -static int zep_shim_pr_err(const char *fmt, va_list args) -{ - char buf[256]; - - vsnprintf(buf, sizeof(buf), fmt, args); - - LOG_ERR("%s", buf); - - return 0; -} - -struct nwb { - unsigned char *data; - unsigned char *tail; - int len; - int headroom; - void *next; - void *priv; - int iftype; - void *ifaddr; - void *dev; - int hostbuffer; - void *cleanup_ctx; - void (*cleanup_cb)(); - unsigned char priority; - bool chksum_done; -}; - -static void *zep_shim_nbuf_alloc(unsigned int size) -{ - struct nwb *nwb; - - nwb = (struct nwb *)k_calloc(sizeof(struct nwb), sizeof(char)); - - if (!nwb) - return NULL; - - nwb->priv = k_calloc(size, sizeof(char)); - - if (!nwb->priv) { - k_free(nwb); - return NULL; - } - - nwb->data = (unsigned char *)nwb->priv; - nwb->tail = nwb->data; - nwb->len = 0; - nwb->headroom = 0; - nwb->next = NULL; - - return nwb; -} - -static void zep_shim_nbuf_free(void *nbuf) -{ - struct nwb *nwb; - - nwb = nbuf; - - k_free(((struct nwb *)nbuf)->priv); - - k_free(nbuf); -} - -static void zep_shim_nbuf_headroom_res(void *nbuf, unsigned int size) -{ - struct nwb *nwb = (struct nwb *)nbuf; - - nwb->data += size; - nwb->tail += size; - nwb->headroom += size; -} - -static unsigned int zep_shim_nbuf_headroom_get(void *nbuf) -{ - return ((struct nwb *)nbuf)->headroom; -} - -static unsigned int zep_shim_nbuf_data_size(void *nbuf) -{ - return ((struct nwb *)nbuf)->len; -} - -static void *zep_shim_nbuf_data_get(void *nbuf) -{ - return ((struct nwb *)nbuf)->data; -} - -static void *zep_shim_nbuf_data_put(void *nbuf, unsigned int size) -{ - struct nwb *nwb = (struct nwb *)nbuf; - unsigned char *data = nwb->tail; - - nwb->tail += size; - nwb->len += size; - - return data; -} - -static void *zep_shim_nbuf_data_push(void *nbuf, unsigned int size) -{ - struct nwb *nwb = (struct nwb *)nbuf; - - nwb->data -= size; - nwb->headroom -= size; - nwb->len += size; - - return nwb->data; -} - -static void *zep_shim_nbuf_data_pull(void *nbuf, unsigned int size) -{ - struct nwb *nwb = (struct nwb *)nbuf; - - nwb->data += size; - nwb->headroom += size; - nwb->len -= size; - - return nwb->data; -} - -static unsigned char zep_shim_nbuf_get_priority(void *nbuf) -{ - struct nwb *nwb = (struct nwb *)nbuf; - - return nwb->priority; -} - -static unsigned char zep_shim_nbuf_get_chksum_done(void *nbuf) -{ - struct nwb *nwb = (struct nwb *)nbuf; - - return nwb->chksum_done; -} - -static void zep_shim_nbuf_set_chksum_done(void *nbuf, unsigned char chksum_done) -{ - struct nwb *nwb = (struct nwb *)nbuf; - - nwb->chksum_done = (bool)chksum_done; -} - -#include -#include - -void *net_pkt_to_nbuf(struct net_pkt *pkt) -{ - struct nwb *nwb; - unsigned char *data; - unsigned int len; - - len = net_pkt_get_len(pkt); - - nwb = zep_shim_nbuf_alloc(len + 100); - - if (!nwb) { - return NULL; - } - - zep_shim_nbuf_headroom_res(nwb, 100); - - data = zep_shim_nbuf_data_put(nwb, len); - - net_pkt_read(pkt, data, len); - - nwb->priority = net_pkt_priority(pkt); - nwb->chksum_done = (bool)net_pkt_is_chksum_done(pkt); - - return nwb; -} - -void *net_pkt_from_nbuf(void *iface, void *frm) -{ - struct net_pkt *pkt = NULL; - unsigned char *data; - unsigned int len; - struct nwb *nwb = frm; - - if (!nwb) { - return NULL; - } - - len = zep_shim_nbuf_data_size(nwb); - - data = zep_shim_nbuf_data_get(nwb); - - pkt = net_pkt_rx_alloc_with_buffer(iface, len, AF_UNSPEC, 0, K_MSEC(100)); - - if (!pkt) { - goto out; - } - - if (net_pkt_write(pkt, data, len)) { - net_pkt_unref(pkt); - pkt = NULL; - goto out; - } - -out: - zep_shim_nbuf_free(nwb); - return pkt; -} - -#if defined(CONFIG_NRF700X_RAW_DATA_RX) || defined(CONFIG_NRF700X_PROMISC_DATA_RX) -void *net_raw_pkt_from_nbuf(void *iface, void *frm, - unsigned short raw_hdr_len, - void *raw_rx_hdr, - bool pkt_free) -{ - struct net_pkt *pkt = NULL; - unsigned char *nwb_data; - unsigned char *data = NULL; - unsigned int nwb_len; - unsigned int total_len; - struct nwb *nwb = frm; - - if (!nwb) { - LOG_ERR("%s: Received network buffer is NULL", __func__); - return NULL; - } - - nwb_len = zep_shim_nbuf_data_size(nwb); - nwb_data = zep_shim_nbuf_data_get(nwb); - total_len = raw_hdr_len + nwb_len; - - data = (unsigned char *)k_malloc(total_len); - if (!data) { - LOG_ERR("%s: Unable to allocate memory for sniffer data packet", __func__); - goto out; - } - - pkt = net_pkt_rx_alloc_with_buffer(iface, total_len, AF_PACKET, ETH_P_ALL, K_MSEC(100)); - if (!pkt) { - LOG_ERR("%s: Unable to allocate net packet buffer", __func__); - goto out; - } - - memcpy(data, raw_rx_hdr, raw_hdr_len); - memcpy((data+raw_hdr_len), nwb_data, nwb_len); - - if (net_pkt_write(pkt, data, total_len)) { - net_pkt_unref(pkt); - pkt = NULL; - goto out; - } -out: - if (data != NULL) { - k_free(data); - } - - if (pkt_free) { - zep_shim_nbuf_free(nwb); - } - - return pkt; -} -#endif /* CONFIG_NRF700X_RAW_DATA_RX || CONFIG_NRF700X_PROMISC_DATA_RX */ - -static void *zep_shim_llist_node_alloc(void) -{ - struct zep_shim_llist_node *llist_node = NULL; - - llist_node = k_calloc(sizeof(*llist_node), sizeof(char)); - - if (!llist_node) { - LOG_ERR("%s: Unable to allocate memory for linked list node", __func__); - return NULL; - } - - sys_dnode_init(&llist_node->head); - - return llist_node; -} - -static void zep_shim_llist_node_free(void *llist_node) -{ - k_free(llist_node); -} - -static void *zep_shim_llist_node_data_get(void *llist_node) -{ - struct zep_shim_llist_node *zep_llist_node = NULL; - - zep_llist_node = (struct zep_shim_llist_node *)llist_node; - - return zep_llist_node->data; -} - -static void zep_shim_llist_node_data_set(void *llist_node, void *data) -{ - struct zep_shim_llist_node *zep_llist_node = NULL; - - zep_llist_node = (struct zep_shim_llist_node *)llist_node; - - zep_llist_node->data = data; -} - -static void *zep_shim_llist_alloc(void) -{ - struct zep_shim_llist *llist = NULL; - - llist = k_calloc(sizeof(*llist), sizeof(char)); - - if (!llist) { - LOG_ERR("%s: Unable to allocate memory for linked list", __func__); - } - - return llist; -} - -static void zep_shim_llist_free(void *llist) -{ - k_free(llist); -} - -static void zep_shim_llist_init(void *llist) -{ - struct zep_shim_llist *zep_llist = NULL; - - zep_llist = (struct zep_shim_llist *)llist; - - sys_dlist_init(&zep_llist->head); -} - -static void zep_shim_llist_add_node_tail(void *llist, void *llist_node) -{ - struct zep_shim_llist *zep_llist = NULL; - struct zep_shim_llist_node *zep_node = NULL; - - zep_llist = (struct zep_shim_llist *)llist; - zep_node = (struct zep_shim_llist_node *)llist_node; - - sys_dlist_append(&zep_llist->head, &zep_node->head); - - zep_llist->len += 1; -} - -static void zep_shim_llist_add_node_head(void *llist, void *llist_node) -{ - struct zep_shim_llist *zep_llist = NULL; - struct zep_shim_llist_node *zep_node = NULL; - - zep_llist = (struct zep_shim_llist *)llist; - zep_node = (struct zep_shim_llist_node *)llist_node; - - sys_dlist_prepend(&zep_llist->head, &zep_node->head); - - zep_llist->len += 1; -} - -static void *zep_shim_llist_get_node_head(void *llist) -{ - struct zep_shim_llist_node *zep_head_node = NULL; - struct zep_shim_llist *zep_llist = NULL; - - zep_llist = (struct zep_shim_llist *)llist; - - if (!zep_llist->len) { - return NULL; - } - - zep_head_node = (struct zep_shim_llist_node *)sys_dlist_peek_head(&zep_llist->head); - - return zep_head_node; -} - -static void *zep_shim_llist_get_node_nxt(void *llist, void *llist_node) -{ - struct zep_shim_llist_node *zep_node = NULL; - struct zep_shim_llist_node *zep_nxt_node = NULL; - struct zep_shim_llist *zep_llist = NULL; - - zep_llist = (struct zep_shim_llist *)llist; - zep_node = (struct zep_shim_llist_node *)llist_node; - - zep_nxt_node = (struct zep_shim_llist_node *)sys_dlist_peek_next(&zep_llist->head, - &zep_node->head); - - return zep_nxt_node; -} - -static void zep_shim_llist_del_node(void *llist, void *llist_node) -{ - struct zep_shim_llist_node *zep_node = NULL; - struct zep_shim_llist *zep_llist = NULL; - - zep_llist = (struct zep_shim_llist *)llist; - zep_node = (struct zep_shim_llist_node *)llist_node; - - sys_dlist_remove(&zep_node->head); - - zep_llist->len -= 1; -} - -static unsigned int zep_shim_llist_len(void *llist) -{ - struct zep_shim_llist *zep_llist = NULL; - - zep_llist = (struct zep_shim_llist *)llist; - - return zep_llist->len; -} - -static void *zep_shim_work_alloc(int type) -{ - return work_alloc(type); -} - -static void zep_shim_work_free(void *item) -{ - return work_free(item); -} - -static void zep_shim_work_init(void *item, void (*callback)(unsigned long data), - unsigned long data) -{ - work_init(item, callback, data); -} - -static void zep_shim_work_schedule(void *item) -{ - work_schedule(item); -} - -static void zep_shim_work_kill(void *item) -{ - work_kill(item); -} - -static unsigned long zep_shim_time_get_curr_us(void) -{ - return k_uptime_get() * USEC_PER_MSEC; -} - -static unsigned int zep_shim_time_elapsed_us(unsigned long start_time_us) -{ - unsigned long curr_time_us = 0; - - curr_time_us = zep_shim_time_get_curr_us(); - - return curr_time_us - start_time_us; -} - -static enum nrf_wifi_status zep_shim_bus_qspi_dev_init(void *os_qspi_dev_ctx) -{ - ARG_UNUSED(os_qspi_dev_ctx); - - return NRF_WIFI_STATUS_SUCCESS; -} - -static void zep_shim_bus_qspi_dev_deinit(void *priv) -{ - struct zep_shim_bus_qspi_priv *qspi_priv = priv; - volatile struct qspi_dev *dev = qspi_priv->qspi_dev; - - dev->deinit(); -} - -static void *zep_shim_bus_qspi_dev_add(void *os_qspi_priv, void *osal_qspi_dev_ctx) -{ - struct zep_shim_bus_qspi_priv *zep_qspi_priv = os_qspi_priv; - struct qspi_dev *dev = qspi_dev(); - int ret; - enum nrf_wifi_status status; - - ret = rpu_init(); - if (ret) { - LOG_ERR("%s: RPU init failed with error %d", __func__, ret); - return NULL; - } - - status = dev->init(qspi_defconfig()); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: QSPI device init failed", __func__); - return NULL; - } - - ret = rpu_enable(); - if (ret) { - LOG_ERR("%s: RPU enable failed with error %d", __func__, ret); - return NULL; - } - zep_qspi_priv->qspi_dev = dev; - zep_qspi_priv->dev_added = true; - - return zep_qspi_priv; -} - -static void zep_shim_bus_qspi_dev_rem(void *priv) -{ - struct zep_shim_bus_qspi_priv *qspi_priv = priv; - struct qspi_dev *dev = qspi_priv->qspi_dev; - - ARG_UNUSED(dev); - - /* TODO: Make qspi_dev a dynamic instance and remove it here */ - rpu_disable(); -} - -static void *zep_shim_bus_qspi_init(void) -{ - struct zep_shim_bus_qspi_priv *qspi_priv = NULL; - - qspi_priv = k_calloc(sizeof(*qspi_priv), sizeof(char)); - - if (!qspi_priv) { - LOG_ERR("%s: Unable to allocate memory for qspi_priv", __func__); - goto out; - } -out: - return qspi_priv; -} - -static void zep_shim_bus_qspi_deinit(void *os_qspi_priv) -{ - struct zep_shim_bus_qspi_priv *qspi_priv = NULL; - - qspi_priv = os_qspi_priv; - - k_free(qspi_priv); -} - -#ifdef CONFIG_NRF_WIFI_LOW_POWER -static int zep_shim_bus_qspi_ps_sleep(void *os_qspi_priv) -{ - rpu_sleep(); - - return 0; -} - -static int zep_shim_bus_qspi_ps_wake(void *os_qspi_priv) -{ - rpu_wakeup(); - - return 0; -} - -static int zep_shim_bus_qspi_ps_status(void *os_qspi_priv) -{ - return rpu_sleep_status(); -} -#endif /* CONFIG_NRF_WIFI_LOW_POWER */ - -static void zep_shim_bus_qspi_dev_host_map_get(void *os_qspi_dev_ctx, - struct nrf_wifi_osal_host_map *host_map) -{ - if (!os_qspi_dev_ctx || !host_map) { - LOG_ERR("%s: Invalid parameters", __func__); - return; - } - - host_map->addr = 0; -} - -static void irq_work_handler(struct k_work *work) -{ - int ret = 0; - - ret = intr_priv->callbk_fn(intr_priv->callbk_data); - - if (ret) { - LOG_ERR("%s: Interrupt callback failed", __func__); - } -} - - -extern struct k_work_q zep_wifi_intr_q; - -static void zep_shim_irq_handler(const struct device *dev, struct gpio_callback *cb, uint32_t pins) -{ - ARG_UNUSED(cb); - ARG_UNUSED(pins); - - k_work_schedule_for_queue(&zep_wifi_intr_q, &intr_priv->work, K_NO_WAIT); -} - -static enum nrf_wifi_status zep_shim_bus_qspi_intr_reg(void *os_dev_ctx, void *callbk_data, - int (*callbk_fn)(void *callbk_data)) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - int ret = -1; - - ARG_UNUSED(os_dev_ctx); - - intr_priv = k_calloc(sizeof(*intr_priv), sizeof(char)); - - if (!intr_priv) { - LOG_ERR("%s: Unable to allocate memory for intr_priv", __func__); - goto out; - } - - intr_priv->callbk_data = callbk_data; - intr_priv->callbk_fn = callbk_fn; - - k_work_init_delayable(&intr_priv->work, irq_work_handler); - - ret = rpu_irq_config(&intr_priv->gpio_cb_data, zep_shim_irq_handler); - - if (ret) { - LOG_ERR("%s: request_irq failed", __func__); - k_free(intr_priv); - intr_priv = NULL; - goto out; - } - - status = NRF_WIFI_STATUS_SUCCESS; - -out: - return status; -} - -static void zep_shim_bus_qspi_intr_unreg(void *os_qspi_dev_ctx) -{ - struct k_work_sync sync; - int ret; - - ARG_UNUSED(os_qspi_dev_ctx); - - ret = rpu_irq_remove(&intr_priv->gpio_cb_data); - if (ret) { - LOG_ERR("%s: rpu_irq_remove failed", __func__); - return; - } - - k_work_cancel_delayable_sync(&intr_priv->work, &sync); - - k_free(intr_priv); - intr_priv = NULL; -} - -#ifdef CONFIG_NRF_WIFI_LOW_POWER -static void *zep_shim_timer_alloc(void) -{ - struct timer_list *timer = NULL; - - timer = k_malloc(sizeof(*timer)); - - if (!timer) - LOG_ERR("%s: Unable to allocate memory for work", __func__); - - return timer; -} - -static void zep_shim_timer_init(void *timer, void (*callback)(unsigned long), unsigned long data) -{ - ((struct timer_list *)timer)->function = callback; - ((struct timer_list *)timer)->data = data; - - init_timer(timer); -} - -static void zep_shim_timer_free(void *timer) -{ - k_free(timer); -} - -static void zep_shim_timer_schedule(void *timer, unsigned long duration) -{ - mod_timer(timer, duration); -} - -static void zep_shim_timer_kill(void *timer) -{ - del_timer_sync(timer); -} -#endif /* CONFIG_NRF_WIFI_LOW_POWER */ - -static void zep_shim_assert(int test_val, int val, enum nrf_wifi_assert_op_type op, char *msg) -{ - switch (op) { - case NRF_WIFI_ASSERT_EQUAL_TO: - NET_ASSERT(test_val == val, "%s", msg); - break; - case NRF_WIFI_ASSERT_NOT_EQUAL_TO: - NET_ASSERT(test_val != val, "%s", msg); - break; - case NRF_WIFI_ASSERT_LESS_THAN: - NET_ASSERT(test_val < val, "%s", msg); - break; - case NRF_WIFI_ASSERT_LESS_THAN_EQUAL_TO: - NET_ASSERT(test_val <= val, "%s", msg); - break; - case NRF_WIFI_ASSERT_GREATER_THAN: - NET_ASSERT(test_val > val, "%s", msg); - break; - case NRF_WIFI_ASSERT_GREATER_THAN_EQUAL_TO: - NET_ASSERT(test_val >= val, "%s", msg); - break; - default: - LOG_ERR("%s: Invalid assertion operation", __func__); - } -} - -static unsigned int zep_shim_strlen(const void *str) -{ - return strlen(str); -} - -const struct nrf_wifi_osal_ops nrf_wifi_os_zep_ops = { - .mem_alloc = zep_shim_mem_alloc, - .mem_zalloc = zep_shim_mem_zalloc, - .mem_free = k_free, - .mem_cpy = zep_shim_mem_cpy, - .mem_set = zep_shim_mem_set, - .mem_cmp = zep_shim_mem_cmp, - - .qspi_read_reg32 = zep_shim_qspi_read_reg32, - .qspi_write_reg32 = zep_shim_qspi_write_reg32, - .qspi_cpy_from = zep_shim_qspi_cpy_from, - .qspi_cpy_to = zep_shim_qspi_cpy_to, - - .spinlock_alloc = zep_shim_spinlock_alloc, - .spinlock_free = zep_shim_spinlock_free, - .spinlock_init = zep_shim_spinlock_init, - .spinlock_take = zep_shim_spinlock_take, - .spinlock_rel = zep_shim_spinlock_rel, - - .spinlock_irq_take = zep_shim_spinlock_irq_take, - .spinlock_irq_rel = zep_shim_spinlock_irq_rel, - - .log_dbg = zep_shim_pr_dbg, - .log_info = zep_shim_pr_info, - .log_err = zep_shim_pr_err, - - .llist_node_alloc = zep_shim_llist_node_alloc, - .llist_node_free = zep_shim_llist_node_free, - .llist_node_data_get = zep_shim_llist_node_data_get, - .llist_node_data_set = zep_shim_llist_node_data_set, - - .llist_alloc = zep_shim_llist_alloc, - .llist_free = zep_shim_llist_free, - .llist_init = zep_shim_llist_init, - .llist_add_node_tail = zep_shim_llist_add_node_tail, - .llist_add_node_head = zep_shim_llist_add_node_head, - .llist_get_node_head = zep_shim_llist_get_node_head, - .llist_get_node_nxt = zep_shim_llist_get_node_nxt, - .llist_del_node = zep_shim_llist_del_node, - .llist_len = zep_shim_llist_len, - - .nbuf_alloc = zep_shim_nbuf_alloc, - .nbuf_free = zep_shim_nbuf_free, - .nbuf_headroom_res = zep_shim_nbuf_headroom_res, - .nbuf_headroom_get = zep_shim_nbuf_headroom_get, - .nbuf_data_size = zep_shim_nbuf_data_size, - .nbuf_data_get = zep_shim_nbuf_data_get, - .nbuf_data_put = zep_shim_nbuf_data_put, - .nbuf_data_push = zep_shim_nbuf_data_push, - .nbuf_data_pull = zep_shim_nbuf_data_pull, - .nbuf_get_priority = zep_shim_nbuf_get_priority, - .nbuf_get_chksum_done = zep_shim_nbuf_get_chksum_done, - .nbuf_set_chksum_done = zep_shim_nbuf_set_chksum_done, - - .tasklet_alloc = zep_shim_work_alloc, - .tasklet_free = zep_shim_work_free, - .tasklet_init = zep_shim_work_init, - .tasklet_schedule = zep_shim_work_schedule, - .tasklet_kill = zep_shim_work_kill, - - .sleep_ms = k_msleep, - .delay_us = k_usleep, - .time_get_curr_us = zep_shim_time_get_curr_us, - .time_elapsed_us = zep_shim_time_elapsed_us, - - .bus_qspi_init = zep_shim_bus_qspi_init, - .bus_qspi_deinit = zep_shim_bus_qspi_deinit, - .bus_qspi_dev_add = zep_shim_bus_qspi_dev_add, - .bus_qspi_dev_rem = zep_shim_bus_qspi_dev_rem, - .bus_qspi_dev_init = zep_shim_bus_qspi_dev_init, - .bus_qspi_dev_deinit = zep_shim_bus_qspi_dev_deinit, - .bus_qspi_dev_intr_reg = zep_shim_bus_qspi_intr_reg, - .bus_qspi_dev_intr_unreg = zep_shim_bus_qspi_intr_unreg, - .bus_qspi_dev_host_map_get = zep_shim_bus_qspi_dev_host_map_get, - -#ifdef CONFIG_NRF_WIFI_LOW_POWER - .timer_alloc = zep_shim_timer_alloc, - .timer_init = zep_shim_timer_init, - .timer_free = zep_shim_timer_free, - .timer_schedule = zep_shim_timer_schedule, - .timer_kill = zep_shim_timer_kill, - - .bus_qspi_ps_sleep = zep_shim_bus_qspi_ps_sleep, - .bus_qspi_ps_wake = zep_shim_bus_qspi_ps_wake, - .bus_qspi_ps_status = zep_shim_bus_qspi_ps_status, -#endif /* CONFIG_NRF_WIFI_LOW_POWER */ - - .assert = zep_shim_assert, - .strlen = zep_shim_strlen, -}; diff --git a/drivers/wifi/nrf700x/src/shim.h b/drivers/wifi/nrf700x/src/shim.h deleted file mode 100644 index ddddbe438674..000000000000 --- a/drivers/wifi/nrf700x/src/shim.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief Header containing OS interface specific declarations for the - * Zephyr OS layer of the Wi-Fi driver. - */ - -#ifndef __SHIM_H__ -#define __SHIM_H__ - -#include -#include -#include - -/** - * struct zep_shim_bus_qspi_priv - Structure to hold context information for the Linux OS - * shim. - * @opriv: Pointer to OSAL context. - * @pcie_callbk_data: Callback data to be passed to the PCIe callback functions. - * @pcie_prb_callbk: The callback function to be called when a PCIe device - * has been probed. - * @pcie_rem_callbk: The callback function to be called when a PCIe device - * has been removed. - * - * This structure maintains the context information necessary for the operation - * of the Linux shim. Some of the elements of the structure need to be - * initialized during the initialization of the Linux shim while others need to - * be kept updated over the duration of the Linux shim operation. - */ -struct zep_shim_bus_qspi_priv { - void *qspi_dev; - - bool dev_added; - bool dev_init; -}; - -struct zep_shim_intr_priv { - struct gpio_callback gpio_cb_data; - void *callbk_data; - int (*callbk_fn)(void *callbk_data); - struct k_work_delayable work; -}; - -struct zep_shim_llist_node { - sys_dnode_t head; - void *data; -}; - -struct zep_shim_llist { - sys_dlist_t head; - unsigned int len; -}; - -void *net_pkt_to_nbuf(struct net_pkt *pkt); -void *net_pkt_from_nbuf(void *iface, void *frm); -#if defined(CONFIG_NRF700X_RAW_DATA_RX) || defined(CONFIG_NRF700X_PROMISC_DATA_RX) -void *net_raw_pkt_from_nbuf(void *iface, - void *frm, - unsigned short raw_hdr_len, - void *raw_rx_hdr, - bool pkt_free); -#endif /* CONFIG_NRF700X_RAW_DATA_RX || CONFIG_NRF700X_PROMISC_DATA_RX */ - -#endif /* __SHIM_H__ */ diff --git a/drivers/wifi/nrf700x/src/timer.c b/drivers/wifi/nrf700x/src/timer.c deleted file mode 100644 index 9f1070463342..000000000000 --- a/drivers/wifi/nrf700x/src/timer.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief File containing timer specific definitons for the - * Zephyr OS layer of the Wi-Fi driver. - */ - -#include -#include - -#include -#include -#include - -#include "timer.h" - -static void timer_expiry_function(struct k_work *work) -{ - struct timer_list *timer; - - timer = (struct timer_list *)CONTAINER_OF(work, struct timer_list, work.work); - - timer->function(timer->data); -} - -void init_timer(struct timer_list *timer) -{ - k_work_init_delayable(&timer->work, timer_expiry_function); -} - -void mod_timer(struct timer_list *timer, int msec) -{ - k_work_schedule(&timer->work, K_MSEC(msec)); -} - -void del_timer_sync(struct timer_list *timer) -{ - k_work_cancel_delayable(&timer->work); -} diff --git a/drivers/wifi/nrf700x/src/timer.h b/drivers/wifi/nrf700x/src/timer.h deleted file mode 100644 index 2fbea4b9e9c0..000000000000 --- a/drivers/wifi/nrf700x/src/timer.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief Header containing timer specific declarations for the - * Zephyr OS layer of the Wi-Fi driver. - */ -#ifndef __TIMER_H__ -#define __TIMER_H__ - -struct timer_list { - void (*function)(unsigned long data); - unsigned long data; - struct k_work_delayable work; -}; - -void init_timer(struct timer_list *timer); - -void mod_timer(struct timer_list *timer, int msec); - -void del_timer_sync(struct timer_list *timer); - -#endif /* __TIMER_H__ */ diff --git a/drivers/wifi/nrf700x/src/wifi_mgmt.c b/drivers/wifi/nrf700x/src/wifi_mgmt.c deleted file mode 100644 index 5cf0d1c41ea6..000000000000 --- a/drivers/wifi/nrf700x/src/wifi_mgmt.c +++ /dev/null @@ -1,1015 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief File containing WiFi management operation implementations - * for the Zephyr OS. - */ - -#include - -#include -#include - -#include "util.h" -#include "fmac_api.h" -#include "fmac_tx.h" -#include "fmac_util.h" -#include "fmac_main.h" -#include "wifi_mgmt.h" - -LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF700X_LOG_LEVEL); - -extern struct nrf_wifi_drv_priv_zep rpu_drv_priv_zep; - -int nrf_wifi_set_power_save(const struct device *dev, - struct wifi_ps_params *params) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - int ret = -1; - unsigned int uapsd_queue = UAPSD_Q_MIN; /* Legacy mode */ - - if (!dev || !params) { - LOG_ERR("%s: dev or params is NULL", __func__); - return ret; - } - - vif_ctx_zep = dev->data; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return ret; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - switch (params->type) { - case WIFI_PS_PARAM_LISTEN_INTERVAL: - if ((params->listen_interval < - NRF_WIFI_LISTEN_INTERVAL_MIN) || - (params->listen_interval > - WIFI_LISTEN_INTERVAL_MAX)) { - params->fail_reason = - WIFI_PS_PARAM_LISTEN_INTERVAL_RANGE_INVALID; - return -EINVAL; - } - status = nrf_wifi_fmac_set_listen_interval( - rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - params->listen_interval); - break; - case WIFI_PS_PARAM_TIMEOUT: - if ((vif_ctx_zep->if_type != NRF_WIFI_IFTYPE_STATION) -#ifdef CONFIG_NRF700X_RAW_DATA_TX - && (vif_ctx_zep->if_type != NRF_WIFI_STA_TX_INJECTOR) -#endif /* CONFIG_NRF700X_RAW_DATA_TX */ -#ifdef CONFIG_NRF700X_PROMISC_DATA_RX - && (vif_ctx_zep->if_type != NRF_WIFI_STA_PROMISC_TX_INJECTOR) -#endif /* CONFIG_NRF700X_PROMISC_DATA_RX */ - ) { - LOG_ERR("%s: Operation supported only in STA enabled mode", - __func__); - params->fail_reason = - WIFI_PS_PARAM_FAIL_CMD_EXEC_FAIL; - goto out; - } - - status = nrf_wifi_fmac_set_power_save_timeout( - rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - params->timeout_ms); - break; - case WIFI_PS_PARAM_MODE: - if (params->mode == WIFI_PS_MODE_WMM) { - uapsd_queue = UAPSD_Q_MAX; /* WMM mode */ - } - - status = nrf_wifi_fmac_set_uapsd_queue(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - uapsd_queue); - break; - case WIFI_PS_PARAM_STATE: - status = nrf_wifi_fmac_set_power_save(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - params->enabled); - break; - case WIFI_PS_PARAM_WAKEUP_MODE: - status = nrf_wifi_fmac_set_ps_wakeup_mode( - rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - params->wakeup_mode); - break; - default: - params->fail_reason = - WIFI_PS_PARAM_FAIL_CMD_EXEC_FAIL; - return -ENOTSUP; - } - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: Confiuring PS param %d failed", - __func__, params->type); - params->fail_reason = - WIFI_PS_PARAM_FAIL_CMD_EXEC_FAIL; - goto out; - } - - - ret = 0; -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -int nrf_wifi_get_power_save_config(const struct device *dev, - struct wifi_ps_config *ps_config) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - int ret = -1; - int count = 0; - - if (!dev || !ps_config) { - return ret; - } - - vif_ctx_zep = dev->data; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return ret; - } - - if ((vif_ctx_zep->if_type != NRF_WIFI_IFTYPE_STATION) -#ifdef CONFIG_NRF700X_RAW_DATA_TX - && (vif_ctx_zep->if_type != NRF_WIFI_STA_TX_INJECTOR) -#endif /* CONFIG_NRF700X_RAW_DATA_TX */ -#ifdef CONFIG_NRF700X_PROMISC_DATA_RX - && (vif_ctx_zep->if_type != NRF_WIFI_STA_PROMISC_TX_INJECTOR) -#endif /* CONFIG_NRF700X_PROMISC_DATA_RX */ - ) { - LOG_ERR("%s: Operation supported only in STA enabled mode", - __func__); - return ret; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - goto out; - } - - vif_ctx_zep->ps_info = ps_config; - - vif_ctx_zep->ps_config_info_evnt = false; - - status = nrf_wifi_fmac_get_power_save_info(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_get_power_save_info failed", - __func__); - goto out; - } - - do { - nrf_wifi_osal_sleep_ms(1); - count++; - } while ((vif_ctx_zep->ps_config_info_evnt == false) && - (count < NRF_WIFI_FMAC_PS_CONF_EVNT_RECV_TIMEOUT)); - - if (count == NRF_WIFI_FMAC_PS_CONF_EVNT_RECV_TIMEOUT) { - nrf_wifi_osal_log_err("%s: Timed out", - __func__); - goto out; - } - - ret = 0; -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -/* TWT interval conversion helpers: User <-> Protocol */ -static struct twt_interval_float nrf_wifi_twt_us_to_float(uint32_t twt_interval) -{ - double mantissa = 0.0; - int exponent = 0; - struct twt_interval_float twt_interval_float; - - double twt_interval_ms = twt_interval / 1000.0; - - mantissa = frexp(twt_interval_ms, &exponent); - /* Ceiling and conversion to milli seconds */ - twt_interval_float.mantissa = ceil(mantissa * 1000); - twt_interval_float.exponent = exponent; - - return twt_interval_float; -} - -static uint64_t nrf_wifi_twt_float_to_us(struct twt_interval_float twt_interval_float) -{ - /* Conversion to micro-seconds */ - return floor(ldexp(twt_interval_float.mantissa, twt_interval_float.exponent) / (1000)) * - 1000; -} - -static unsigned char twt_wifi_mgmt_to_rpu_neg_type(enum wifi_twt_negotiation_type neg_type) -{ - unsigned char rpu_neg_type = 0; - - switch (neg_type) { - case WIFI_TWT_INDIVIDUAL: - rpu_neg_type = NRF_WIFI_TWT_NEGOTIATION_TYPE_INDIVIDUAL; - break; - case WIFI_TWT_BROADCAST: - rpu_neg_type = NRF_WIFI_TWT_NEGOTIATION_TYPE_BROADCAST; - break; - default: - LOG_ERR("%s: Invalid negotiation type: %d", - __func__, neg_type); - break; - } - - return rpu_neg_type; -} - -static enum wifi_twt_negotiation_type twt_rpu_to_wifi_mgmt_neg_type(unsigned char neg_type) -{ - enum wifi_twt_negotiation_type wifi_neg_type = WIFI_TWT_INDIVIDUAL; - - switch (neg_type) { - case NRF_WIFI_TWT_NEGOTIATION_TYPE_INDIVIDUAL: - wifi_neg_type = WIFI_TWT_INDIVIDUAL; - break; - case NRF_WIFI_TWT_NEGOTIATION_TYPE_BROADCAST: - wifi_neg_type = WIFI_TWT_BROADCAST; - break; - default: - LOG_ERR("%s: Invalid negotiation type: %d", - __func__, neg_type); - break; - } - - return wifi_neg_type; -} - -/* Though setup_cmd enums have 1-1 mapping but due to data type different need these */ -static enum wifi_twt_setup_cmd twt_rpu_to_wifi_mgmt_setup_cmd(signed int setup_cmd) -{ - enum wifi_twt_setup_cmd wifi_setup_cmd = WIFI_TWT_SETUP_CMD_REQUEST; - - switch (setup_cmd) { - case NRF_WIFI_REQUEST_TWT: - wifi_setup_cmd = WIFI_TWT_SETUP_CMD_REQUEST; - break; - case NRF_WIFI_SUGGEST_TWT: - wifi_setup_cmd = WIFI_TWT_SETUP_CMD_SUGGEST; - break; - case NRF_WIFI_DEMAND_TWT: - wifi_setup_cmd = WIFI_TWT_SETUP_CMD_DEMAND; - break; - case NRF_WIFI_GROUPING_TWT: - wifi_setup_cmd = WIFI_TWT_SETUP_CMD_GROUPING; - break; - case NRF_WIFI_ACCEPT_TWT: - wifi_setup_cmd = WIFI_TWT_SETUP_CMD_ACCEPT; - break; - case NRF_WIFI_ALTERNATE_TWT: - wifi_setup_cmd = WIFI_TWT_SETUP_CMD_ALTERNATE; - break; - case NRF_WIFI_DICTATE_TWT: - wifi_setup_cmd = WIFI_TWT_SETUP_CMD_DICTATE; - break; - case NRF_WIFI_REJECT_TWT: - wifi_setup_cmd = WIFI_TWT_SETUP_CMD_REJECT; - break; - default: - LOG_ERR("%s: Invalid setup command: %d", - __func__, setup_cmd); - break; - } - - return wifi_setup_cmd; -} - -static signed int twt_wifi_mgmt_to_rpu_setup_cmd(enum wifi_twt_setup_cmd setup_cmd) -{ - signed int rpu_setup_cmd = NRF_WIFI_REQUEST_TWT; - - switch (setup_cmd) { - case WIFI_TWT_SETUP_CMD_REQUEST: - rpu_setup_cmd = NRF_WIFI_REQUEST_TWT; - break; - case WIFI_TWT_SETUP_CMD_SUGGEST: - rpu_setup_cmd = NRF_WIFI_SUGGEST_TWT; - break; - case WIFI_TWT_SETUP_CMD_DEMAND: - rpu_setup_cmd = NRF_WIFI_DEMAND_TWT; - break; - case WIFI_TWT_SETUP_CMD_GROUPING: - rpu_setup_cmd = NRF_WIFI_GROUPING_TWT; - break; - case WIFI_TWT_SETUP_CMD_ACCEPT: - rpu_setup_cmd = NRF_WIFI_ACCEPT_TWT; - break; - case WIFI_TWT_SETUP_CMD_ALTERNATE: - rpu_setup_cmd = NRF_WIFI_ALTERNATE_TWT; - break; - case WIFI_TWT_SETUP_CMD_DICTATE: - rpu_setup_cmd = NRF_WIFI_DICTATE_TWT; - break; - case WIFI_TWT_SETUP_CMD_REJECT: - rpu_setup_cmd = NRF_WIFI_REJECT_TWT; - break; - default: - LOG_ERR("%s: Invalid setup command: %d", - __func__, setup_cmd); - break; - } - - return rpu_setup_cmd; -} - -void nrf_wifi_event_proc_get_power_save_info(void *vif_ctx, - struct nrf_wifi_umac_event_power_save_info *ps_info, - unsigned int event_len) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - - if (!vif_ctx || !ps_info) { - return; - } - - vif_ctx_zep = vif_ctx; - - vif_ctx_zep->ps_info->ps_params.mode = ps_info->ps_mode; - vif_ctx_zep->ps_info->ps_params.enabled = ps_info->enabled; - vif_ctx_zep->ps_info->num_twt_flows = ps_info->num_twt_flows; - vif_ctx_zep->ps_info->ps_params.timeout_ms = ps_info->ps_timeout; - vif_ctx_zep->ps_info->ps_params.listen_interval = ps_info->listen_interval; - vif_ctx_zep->ps_info->ps_params.wakeup_mode = ps_info->extended_ps; - - for (int i = 0; i < ps_info->num_twt_flows; i++) { - struct twt_interval_float twt_interval_float; - struct wifi_twt_flow_info *twt_zep = &vif_ctx_zep->ps_info->twt_flows[i]; - struct nrf_wifi_umac_config_twt_info *twt_rpu = &ps_info->twt_flow_info[i]; - - memset(twt_zep, 0, sizeof(struct wifi_twt_flow_info)); - - twt_zep->flow_id = twt_rpu->twt_flow_id; - twt_zep->implicit = twt_rpu->is_implicit ? 1 : 0; - twt_zep->trigger = twt_rpu->ap_trigger_frame ? 1 : 0; - twt_zep->announce = twt_rpu->twt_flow_type == NRF_WIFI_TWT_FLOW_TYPE_ANNOUNCED; - twt_zep->negotiation_type = twt_rpu_to_wifi_mgmt_neg_type(twt_rpu->neg_type); - twt_zep->dialog_token = twt_rpu->dialog_token; - twt_interval_float.mantissa = twt_rpu->twt_target_wake_interval_mantissa; - twt_interval_float.exponent = twt_rpu->twt_target_wake_interval_exponent; - twt_zep->twt_interval = nrf_wifi_twt_float_to_us(twt_interval_float); - twt_zep->twt_wake_interval = twt_rpu->nominal_min_twt_wake_duration; - } - - vif_ctx_zep->ps_config_info_evnt = true; -} - -static void nrf_wifi_twt_update_internal_state(struct nrf_wifi_vif_ctx_zep *vif_ctx_zep, - bool setup, unsigned char flow_id) -{ - if (setup) { - vif_ctx_zep->twt_flows_map |= BIT(flow_id); - vif_ctx_zep->twt_flow_in_progress_map &= ~BIT(flow_id); - } else { - vif_ctx_zep->twt_flows_map &= ~BIT(flow_id); - } -} - -int nrf_wifi_twt_teardown_flows(struct nrf_wifi_vif_ctx_zep *vif_ctx_zep, - unsigned char start_flow_id, unsigned char end_flow_id) -{ - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_umac_config_twt_info twt_info = {0}; - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - int ret = 0; - struct wifi_twt_params twt_params = {0}; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return ret; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - for (int flow_id = start_flow_id; flow_id < end_flow_id; flow_id++) { - if (!(vif_ctx_zep->twt_flows_map & BIT(flow_id))) { - continue; - } - twt_info.twt_flow_id = flow_id; - status = nrf_wifi_fmac_twt_teardown(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - &twt_info); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: TWT teardown for flow id %d failed", - __func__, flow_id); - ret = -1; - continue; - } - /* UMAC doesn't send TWT teardown event for host initiated teardown */ - nrf_wifi_twt_update_internal_state(vif_ctx_zep, false, flow_id); - /* TODO: Remove this once UMAC sends the status */ - twt_params.operation = WIFI_TWT_TEARDOWN; - twt_params.flow_id = flow_id; - twt_params.teardown_status = WIFI_TWT_TEARDOWN_SUCCESS; - wifi_mgmt_raise_twt_event(vif_ctx_zep->zep_net_if_ctx, &twt_params); - } - -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -int nrf_wifi_set_twt(const struct device *dev, - struct wifi_twt_params *twt_params) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_umac_config_twt_info twt_info = {0}; - int ret = -1; - - if (!dev || !twt_params) { - LOG_ERR("%s: dev or twt_params is NULL", __func__); - return ret; - } - - vif_ctx_zep = dev->data; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return ret; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - if (!(twt_params->operation == WIFI_TWT_TEARDOWN && twt_params->teardown.teardown_all) && - twt_params->flow_id >= WIFI_MAX_TWT_FLOWS) { - LOG_ERR("%s: Invalid flow id: %d", - __func__, twt_params->flow_id); - twt_params->fail_reason = WIFI_TWT_FAIL_INVALID_FLOW_ID; - goto out; - } - - switch (twt_params->operation) { - case WIFI_TWT_SETUP: - if (vif_ctx_zep->twt_flow_in_progress_map & BIT(twt_params->flow_id)) { - twt_params->fail_reason = WIFI_TWT_FAIL_OPERATION_IN_PROGRESS; - goto out; - } - - if (twt_params->setup_cmd == WIFI_TWT_SETUP_CMD_REQUEST) { - if (vif_ctx_zep->twt_flows_map & BIT(twt_params->flow_id)) { - twt_params->fail_reason = WIFI_TWT_FAIL_FLOW_ALREADY_EXISTS; - goto out; - } - } - - struct twt_interval_float twt_interval_float = - nrf_wifi_twt_us_to_float(twt_params->setup.twt_interval); - - twt_info.twt_flow_id = twt_params->flow_id; - twt_info.neg_type = twt_wifi_mgmt_to_rpu_neg_type(twt_params->negotiation_type); - twt_info.setup_cmd = twt_wifi_mgmt_to_rpu_setup_cmd(twt_params->setup_cmd); - twt_info.ap_trigger_frame = twt_params->setup.trigger; - twt_info.is_implicit = twt_params->setup.implicit; - if (twt_params->setup.announce) { - twt_info.twt_flow_type = NRF_WIFI_TWT_FLOW_TYPE_ANNOUNCED; - } else { - twt_info.twt_flow_type = NRF_WIFI_TWT_FLOW_TYPE_UNANNOUNCED; - } - - twt_info.nominal_min_twt_wake_duration = - twt_params->setup.twt_wake_interval; - twt_info.twt_target_wake_interval_mantissa = twt_interval_float.mantissa; - twt_info.twt_target_wake_interval_exponent = twt_interval_float.exponent; - - twt_info.dialog_token = twt_params->dialog_token; - twt_info.twt_wake_ahead_duration = twt_params->setup.twt_wake_ahead_duration; - - status = nrf_wifi_fmac_twt_setup(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - &twt_info); - - break; - case WIFI_TWT_TEARDOWN: - unsigned char start_flow_id = 0; - unsigned char end_flow_id = WIFI_MAX_TWT_FLOWS; - - if (!twt_params->teardown.teardown_all) { - if (!(vif_ctx_zep->twt_flows_map & BIT(twt_params->flow_id))) { - twt_params->fail_reason = WIFI_TWT_FAIL_INVALID_FLOW_ID; - goto out; - } - start_flow_id = twt_params->flow_id; - end_flow_id = twt_params->flow_id + 1; - twt_info.twt_flow_id = twt_params->flow_id; - } - - status = nrf_wifi_twt_teardown_flows(vif_ctx_zep, - start_flow_id, - end_flow_id); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: TWT teardown failed: start_flow_id: %d, end_flow_id: %d", - __func__, start_flow_id, end_flow_id); - goto out; - } - break; - - default: - LOG_ERR("Unknown TWT operation"); - status = NRF_WIFI_STATUS_FAIL; - break; - } - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_set_twt failed", __func__); - goto out; - } - - ret = 0; -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -void nrf_wifi_event_proc_twt_setup_zep(void *vif_ctx, - struct nrf_wifi_umac_cmd_config_twt *twt_setup_info, - unsigned int event_len) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct wifi_twt_params twt_params; - struct twt_interval_float twt_interval_float; - - if (!vif_ctx || !twt_setup_info) { - return; - } - - vif_ctx_zep = vif_ctx; - - twt_params.operation = WIFI_TWT_SETUP; - twt_params.flow_id = twt_setup_info->info.twt_flow_id; - twt_params.negotiation_type = twt_rpu_to_wifi_mgmt_neg_type(twt_setup_info->info.neg_type); - twt_params.setup_cmd = twt_rpu_to_wifi_mgmt_setup_cmd(twt_setup_info->info.setup_cmd); - twt_params.setup.trigger = twt_setup_info->info.ap_trigger_frame ? 1 : 0; - twt_params.setup.implicit = twt_setup_info->info.is_implicit ? 1 : 0; - twt_params.setup.announce = - twt_setup_info->info.twt_flow_type == NRF_WIFI_TWT_FLOW_TYPE_ANNOUNCED; - twt_params.setup.twt_wake_interval = - twt_setup_info->info.nominal_min_twt_wake_duration; - twt_interval_float.mantissa = twt_setup_info->info.twt_target_wake_interval_mantissa; - twt_interval_float.exponent = twt_setup_info->info.twt_target_wake_interval_exponent; - twt_params.setup.twt_interval = nrf_wifi_twt_float_to_us(twt_interval_float); - twt_params.dialog_token = twt_setup_info->info.dialog_token; - twt_params.resp_status = twt_setup_info->info.twt_resp_status; - - if ((twt_setup_info->info.twt_resp_status == 0) || - (twt_setup_info->info.neg_type == NRF_WIFI_ACCEPT_TWT)) { - nrf_wifi_twt_update_internal_state(vif_ctx_zep, true, twt_params.flow_id); - } - - wifi_mgmt_raise_twt_event(vif_ctx_zep->zep_net_if_ctx, &twt_params); -} - - -void nrf_wifi_event_proc_twt_teardown_zep(void *vif_ctx, - struct nrf_wifi_umac_cmd_teardown_twt *twt_teardown_info, - unsigned int event_len) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct wifi_twt_params twt_params = {0}; - - if (!vif_ctx || !twt_teardown_info) { - return; - } - - vif_ctx_zep = vif_ctx; - - twt_params.operation = WIFI_TWT_TEARDOWN; - twt_params.flow_id = twt_teardown_info->info.twt_flow_id; - /* TODO: ADD reason code in the twt_params structure */ - nrf_wifi_twt_update_internal_state(vif_ctx_zep, false, twt_params.flow_id); - - wifi_mgmt_raise_twt_event(vif_ctx_zep->zep_net_if_ctx, &twt_params); -} - -void nrf_wifi_event_proc_twt_sleep_zep(void *vif_ctx, - struct nrf_wifi_umac_event_twt_sleep *sleep_evnt, - unsigned int event_len) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - struct nrf_wifi_fmac_dev_ctx_def *def_dev_ctx = NULL; - struct nrf_wifi_fmac_priv_def *def_priv = NULL; -#ifdef CONFIG_NRF700X_DATA_TX - int desc = 0; - int ac = 0; -#endif - vif_ctx_zep = vif_ctx; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - def_dev_ctx = wifi_dev_priv(fmac_dev_ctx); - def_priv = wifi_fmac_priv(fmac_dev_ctx->fpriv); - - if (!sleep_evnt) { - LOG_ERR("%s: sleep_evnt is NULL", __func__); - return; - } - - switch (sleep_evnt->info.type) { - case TWT_BLOCK_TX: - nrf_wifi_osal_spinlock_take(def_dev_ctx->tx_config.tx_lock); - - def_dev_ctx->twt_sleep_status = NRF_WIFI_FMAC_TWT_STATE_SLEEP; - - wifi_mgmt_raise_twt_sleep_state(vif_ctx_zep->zep_net_if_ctx, - WIFI_TWT_STATE_SLEEP); - nrf_wifi_osal_spinlock_rel(def_dev_ctx->tx_config.tx_lock); - break; - case TWT_UNBLOCK_TX: - nrf_wifi_osal_spinlock_take(def_dev_ctx->tx_config.tx_lock); - def_dev_ctx->twt_sleep_status = NRF_WIFI_FMAC_TWT_STATE_AWAKE; - wifi_mgmt_raise_twt_sleep_state(vif_ctx_zep->zep_net_if_ctx, - WIFI_TWT_STATE_AWAKE); -#ifdef CONFIG_NRF700X_DATA_TX - for (ac = NRF_WIFI_FMAC_AC_BE; - ac <= NRF_WIFI_FMAC_AC_MAX; ++ac) { - desc = tx_desc_get(fmac_dev_ctx, ac); - if (desc < def_priv->num_tx_tokens) { - tx_pending_process(fmac_dev_ctx, desc, ac); - } - } -#endif - nrf_wifi_osal_spinlock_rel(def_dev_ctx->tx_config.tx_lock); - break; - default: - break; - } -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); -} - -#ifdef CONFIG_NRF700X_SYSTEM_WITH_RAW_MODES -int nrf_wifi_mode(const struct device *dev, - struct wifi_mode_info *mode) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - struct nrf_wifi_fmac_dev_ctx_def *def_dev_ctx = NULL; - int ret = -1; - - if (!dev || !mode) { - LOG_ERR("%s: illegal input parameters", __func__); - return ret; - } - - vif_ctx_zep = dev->data; - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return ret; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - def_dev_ctx = wifi_dev_priv(fmac_dev_ctx); - - if (!device_is_ready(dev)) { - LOG_ERR("%s: Device %s is not ready", - __func__, dev->name); - goto out; - } - - if (mode->oper == WIFI_MGMT_SET) { - status = nrf_wifi_check_mode_validity(mode->mode); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: mode setting is not valid", __func__); - goto out; - } - - if (vif_ctx_zep->authorized && (mode->mode == NRF_WIFI_MONITOR_MODE)) { - LOG_ERR("%s: Cannot set monitor mode when station is connected", - __func__); - goto out; - } - - /** - * Send the driver vif_idx instead of upper layer sent if_index. - * we map network if_index 1 to vif_idx of 0 and so on. The vif_ctx_zep - * context maps the correct network interface index to current driver - * interface index. - */ - status = nrf_wifi_fmac_set_mode(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, mode->mode); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: mode set operation failed", __func__); - goto out; - } - - } else { - mode->mode = def_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx]->mode; - /** - * This is a work-around to handle current UMAC mode handling. - * This might be removed in future versions when UMAC has more space. - */ -#ifdef CONFIG_NRF700X_RAW_DATA_TX - if (def_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx]->txinjection_mode == true) { - mode->mode ^= NRF_WIFI_TX_INJECTION_MODE; - } -#endif /* CONFIG_NRF700X_RAW_DATA_TX */ -#ifdef CONFIG_NRF700X_PROMISC_DATA_RX - if (def_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx]->promisc_mode == true) { - mode->mode ^= NRF_WIFI_PROMISCUOUS_MODE; - } -#endif /* CONFIG_NRF700X_PROMISC_DATA_RX */ - } - ret = 0; -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} -#endif /* CONFIG_NRF700X_SYSTEM_WITH_RAW_MODES */ - -#if defined(CONFIG_NRF700X_RAW_DATA_TX) || defined(CONFIG_NRF700X_RAW_DATA_RX) -int nrf_wifi_channel(const struct device *dev, - struct wifi_channel_info *channel) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx_def *def_dev_ctx = NULL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - int ret = -1; - - if (!dev || !channel) { - LOG_ERR("%s: illegal input parameters", __func__); - return ret; - } - - vif_ctx_zep = dev->data; - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return ret; - } - - if (vif_ctx_zep->authorized) { - LOG_ERR("%s: Cannot change channel when in station connected mode", __func__); - return ret; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - def_dev_ctx = wifi_dev_priv(fmac_dev_ctx); - - if (channel->oper == WIFI_MGMT_SET) { - /** - * Send the driver vif_idx instead of upper layer sent if_index. - * we map network if_index 1 to vif_idx of 0 and so on. The vif_ctx_zep - * context maps the correct network interface index to current driver - * interface index. - */ - status = nrf_wifi_fmac_set_channel(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, - channel->channel); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: set channel failed", __func__); - goto out; - } - } else { - channel->channel = def_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx]->channel; - } - ret = 0; -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} -#endif /* CONFIG_NRF700X_RAW_DATA_TX || CONFIG_NRF700X_RAW_DATA_RX */ - -#if defined(CONFIG_NRF700X_RAW_DATA_RX) || defined(CONFIG_NRF700X_PROMISC_DATA_RX) -int nrf_wifi_filter(const struct device *dev, - struct wifi_filter_info *filter) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - struct nrf_wifi_fmac_dev_ctx_def *def_dev_ctx = NULL; - int ret = -1; - - if (!dev || !filter) { - LOG_ERR("%s: Illegal input parameters", __func__); - goto out; - } - - vif_ctx_zep = dev->data; - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL\n", __func__); - goto out; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - def_dev_ctx = wifi_dev_priv(fmac_dev_ctx); - - if (filter->oper == WIFI_MGMT_SET) { - /** - * In case a user sets data + management + ctrl bits - * or all the filter bits. Map it to bit 0 set to - * enable "all" packet filter bit setting. - * In case only filter packet size is configured and filter - * setting is sent as zero, set the filter value to - * previously configured value. - */ - if (filter->filter == WIFI_MGMT_DATA_CTRL_FILTER_SETTING - || filter->filter == WIFI_ALL_FILTER_SETTING) { - filter->filter = 1; - } else if (filter->filter == 0) { - filter->filter = - def_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx]->packet_filter; - } - - /** - * Send the driver vif_idx instead of upper layer sent if_index. - * we map network if_index 1 to vif_idx of 0 and so on. The vif_ctx_zep - * context maps the correct network interface index to current driver - * interface index - */ - status = nrf_wifi_fmac_set_packet_filter(rpu_ctx_zep->rpu_ctx, filter->filter, - vif_ctx_zep->vif_idx, filter->buffer_size); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: Set filter operation failed\n", __func__); - goto out; - } - } else { - filter->filter = def_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx]->packet_filter; - } - ret = 0; -out: - return ret; -} -#endif /* CONFIG_NRF700X_RAW_DATA_RX || CONFIG_NRF700X_PROMISC_DATA_RX */ - -int nrf_wifi_set_rts_threshold(const struct device *dev, - unsigned int rts_threshold) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_umac_set_wiphy_info wiphy_info; - int ret = -1; - - if (!dev) { - LOG_ERR("%s: dev is NULL", __func__); - return ret; - } - - vif_ctx_zep = dev->data; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return ret; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - - if (!rpu_ctx_zep->rpu_ctx) { - LOG_ERR("%s: RPU context not initialized", __func__); - return ret; - } - - if ((int)rts_threshold < -1) { - /* 0 or any positive value is passed to f/w. - * For RTS off, -1 is passed to f/w. - * All other negative values considered as invalid. - */ - LOG_ERR("%s: Invalid threshold value : %d", __func__, (int)rts_threshold); - return ret; - } - - memset(&wiphy_info, 0, sizeof(struct nrf_wifi_umac_set_wiphy_info)); - - wiphy_info.rts_threshold = (int)rts_threshold; - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - - status = nrf_wifi_fmac_set_wiphy_params(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - &wiphy_info); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: Configuring rts threshold failed\n", __func__); - goto out; - } - - ret = 0; -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - - return ret; -} diff --git a/drivers/wifi/nrf700x/src/wifi_mgmt_scan.c b/drivers/wifi/nrf700x/src/wifi_mgmt_scan.c deleted file mode 100644 index d1d83aa026aa..000000000000 --- a/drivers/wifi/nrf700x/src/wifi_mgmt_scan.c +++ /dev/null @@ -1,440 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief File containing display scan specific definitions for the - * Zephyr OS layer of the Wi-Fi driver. - */ - -#include - -#include -#include - -#include "util.h" -#include "fmac_api.h" -#include "fmac_tx.h" -#include "fmac_main.h" -#include "wifi_mgmt_scan.h" - -LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF700X_LOG_LEVEL); - -extern struct nrf_wifi_drv_priv_zep rpu_drv_priv_zep; - -static enum nrf_wifi_band nrf_wifi_map_zep_band_to_rpu(enum wifi_frequency_bands zep_band) -{ - switch (zep_band) { - case WIFI_FREQ_BAND_2_4_GHZ: - return NRF_WIFI_BAND_2GHZ; - case WIFI_FREQ_BAND_5_GHZ: - return NRF_WIFI_BAND_5GHZ; - default: - return NRF_WIFI_BAND_INVALID; - } -} - -int nrf_wifi_disp_scan_zep(const struct device *dev, struct wifi_scan_params *params, - scan_result_cb_t cb) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_umac_scan_info *scan_info = NULL; - enum nrf_wifi_band band = NRF_WIFI_BAND_INVALID; - uint8_t band_flags = 0xFF; - uint8_t i = 0; - uint8_t j = 0; - uint8_t k = 0; - uint16_t num_scan_channels = 0; - int ret = -1; - - vif_ctx_zep = dev->data; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return ret; - } - - if (vif_ctx_zep->if_op_state != NRF_WIFI_FMAC_IF_OP_STATE_UP) { - LOG_ERR("%s: Interface not UP", __func__); - return ret; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - - - if (vif_ctx_zep->scan_in_progress) { - LOG_INF("%s: Scan already in progress", __func__); - ret = -EBUSY; - goto out; - } - - if (params) { - band_flags &= (~(1 << WIFI_FREQ_BAND_2_4_GHZ)); - -#ifndef CONFIG_NRF70_2_4G_ONLY - band_flags &= (~(1 << WIFI_FREQ_BAND_5_GHZ)); -#endif /* CONFIG_NRF70_2_4G_ONLY */ - - if (params->bands & band_flags) { - LOG_ERR("%s: Unsupported band(s) (0x%X)", __func__, params->bands); - ret = -EBUSY; - goto out; - } - - for (j = 0; j < CONFIG_WIFI_MGMT_SCAN_CHAN_MAX_MANUAL; j++) { - if (!params->band_chan[j].channel) { - break; - } - - num_scan_channels++; - } - } - - vif_ctx_zep->disp_scan_cb = cb; - - scan_info = k_calloc(sizeof(*scan_info) + - (num_scan_channels * - sizeof(scan_info->scan_params.center_frequency[0])), - sizeof(char)); - - if (!scan_info) { - LOG_ERR("%s: Unable to allocate memory for scan_info (size: %d bytes)", - __func__, - sizeof(*scan_info) + (num_scan_channels * - sizeof(scan_info->scan_params.center_frequency[0]))); - goto out; - } - - memset(scan_info, 0, sizeof(*scan_info) + (num_scan_channels * - sizeof(scan_info->scan_params.center_frequency[0]))); - - static uint8_t skip_local_admin_mac = IS_ENABLED(CONFIG_WIFI_NRF700X_SKIP_LOCAL_ADMIN_MAC); - - scan_info->scan_params.skip_local_admin_macs = skip_local_admin_mac; - - scan_info->scan_reason = SCAN_DISPLAY; - - if (params) { - if (params->scan_type == WIFI_SCAN_TYPE_PASSIVE) { - scan_info->scan_params.passive_scan = 1; - } - - scan_info->scan_params.bands = params->bands; - - if (params->dwell_time_active < 0) { - LOG_ERR("%s: Invalid dwell_time_active %d", __func__, - params->dwell_time_active); - goto out; - } else { - scan_info->scan_params.dwell_time_active = params->dwell_time_active; - } - - if (params->dwell_time_passive < 0) { - LOG_ERR("%s: Invalid dwell_time_passive %d", __func__, - params->dwell_time_passive); - goto out; - } else { - scan_info->scan_params.dwell_time_passive = params->dwell_time_passive; - } - - if ((params->max_bss_cnt < 0) || - (params->max_bss_cnt > WIFI_MGMT_SCAN_MAX_BSS_CNT)) { - LOG_ERR("%s: Invalid max_bss_cnt %d", __func__, - params->max_bss_cnt); - goto out; - } else { - vif_ctx_zep->max_bss_cnt = params->max_bss_cnt; - } - - for (i = 0; i < NRF_WIFI_SCAN_MAX_NUM_SSIDS; i++) { - if (!(params->ssids[i]) || !strlen(params->ssids[i])) { - break; - } - - memcpy(scan_info->scan_params.scan_ssids[i].nrf_wifi_ssid, - params->ssids[i], - sizeof(scan_info->scan_params.scan_ssids[i].nrf_wifi_ssid)); - - scan_info->scan_params.scan_ssids[i].nrf_wifi_ssid_len = - strlen(scan_info->scan_params.scan_ssids[i].nrf_wifi_ssid); - - scan_info->scan_params.num_scan_ssids++; - } - - for (i = 0; i < CONFIG_WIFI_MGMT_SCAN_CHAN_MAX_MANUAL; i++) { - if (!params->band_chan[i].channel) { - break; - } - - band = nrf_wifi_map_zep_band_to_rpu(params->band_chan[i].band); - - if (band == NRF_WIFI_BAND_INVALID) { - LOG_ERR("%s: Unsupported band %d", __func__, - params->band_chan[i].band); - goto out; - } - - scan_info->scan_params.center_frequency[k++] = nrf_wifi_utils_chan_to_freq( - band, params->band_chan[i].channel); - - if (scan_info->scan_params.center_frequency[k - 1] == -1) { - LOG_ERR("%s: Invalid channel %d", __func__, - params->band_chan[i].channel); - goto out; - } - } - - scan_info->scan_params.num_scan_channels = k; - } - - vif_ctx_zep->scan_res_cnt = 0; - - status = nrf_wifi_fmac_scan(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, scan_info); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_scan failed", __func__); - goto out; - } - - vif_ctx_zep->scan_type = SCAN_DISPLAY; - vif_ctx_zep->scan_in_progress = true; - - k_work_schedule(&vif_ctx_zep->scan_timeout_work, - K_SECONDS(CONFIG_WIFI_NRF700X_SCAN_TIMEOUT_S)); - - ret = 0; -out: - if (scan_info) { - k_free(scan_info); - } - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -enum nrf_wifi_status nrf_wifi_disp_scan_res_get_zep(struct nrf_wifi_vif_ctx_zep *vif_ctx_zep) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return NRF_WIFI_STATUS_FAIL; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - status = nrf_wifi_fmac_scan_res_get(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - SCAN_DISPLAY); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_scan failed", __func__); - goto out; - } - - status = NRF_WIFI_STATUS_SUCCESS; -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return status; -} - -static inline enum wifi_mfp_options drv_to_wifi_mgmt_mfp(unsigned char mfp_flag) -{ - if (!mfp_flag) - return WIFI_MFP_DISABLE; - if (mfp_flag & NRF_WIFI_MFP_REQUIRED) - return WIFI_MFP_REQUIRED; - if (mfp_flag & NRF_WIFI_MFP_CAPABLE) - return WIFI_MFP_OPTIONAL; - - return WIFI_MFP_UNKNOWN; -} -static inline enum wifi_security_type drv_to_wifi_mgmt(int drv_security_type) -{ - switch (drv_security_type) { - case NRF_WIFI_OPEN: - return WIFI_SECURITY_TYPE_NONE; - case NRF_WIFI_WEP: - return WIFI_SECURITY_TYPE_WEP; - case NRF_WIFI_WPA: - return WIFI_SECURITY_TYPE_WPA_PSK; - case NRF_WIFI_WPA2: - return WIFI_SECURITY_TYPE_PSK; - case NRF_WIFI_WPA2_256: - return WIFI_SECURITY_TYPE_PSK_SHA256; - case NRF_WIFI_WPA3: - return WIFI_SECURITY_TYPE_SAE; - case NRF_WIFI_WAPI: - return WIFI_SECURITY_TYPE_WAPI; - case NRF_WIFI_EAP: - return WIFI_SECURITY_TYPE_EAP; - default: - return WIFI_SECURITY_TYPE_UNKNOWN; - } -} - -void nrf_wifi_event_proc_disp_scan_res_zep(void *vif_ctx, - struct nrf_wifi_umac_event_new_scan_display_results *scan_res, - unsigned int event_len, - bool more_res) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct umac_display_results *r = NULL; - struct wifi_scan_result res; - uint16_t max_bss_cnt = 0; - unsigned int i = 0; - scan_result_cb_t cb = NULL; - - vif_ctx_zep = vif_ctx; - - cb = (scan_result_cb_t)vif_ctx_zep->disp_scan_cb; - - /* Delayed event (after scan timeout) or rogue event after scan done */ - if (!cb) { - return; - } - - max_bss_cnt = vif_ctx_zep->max_bss_cnt ? - vif_ctx_zep->max_bss_cnt : CONFIG_NRF_WIFI_SCAN_MAX_BSS_CNT; - - for (i = 0; i < scan_res->event_bss_count; i++) { - /* Limit the scan results to the configured maximum */ - if ((max_bss_cnt > 0) && - (vif_ctx_zep->scan_res_cnt >= max_bss_cnt)) { - break; - } - - memset(&res, 0x0, sizeof(res)); - - r = &scan_res->display_results[i]; - - res.ssid_length = MIN(sizeof(res.ssid), r->ssid.nrf_wifi_ssid_len); - - res.band = r->nwk_band; - - res.channel = r->nwk_channel; - - res.security = drv_to_wifi_mgmt(r->security_type); - - res.mfp = drv_to_wifi_mgmt_mfp(r->mfp_flag); - - memcpy(res.ssid, - r->ssid.nrf_wifi_ssid, - res.ssid_length); - - memcpy(res.mac, r->mac_addr, NRF_WIFI_ETH_ADDR_LEN); - res.mac_length = NRF_WIFI_ETH_ADDR_LEN; - - if (r->signal.signal_type == NRF_WIFI_SIGNAL_TYPE_MBM) { - int val = (r->signal.signal.mbm_signal); - - res.rssi = (val / 100); - } else if (r->signal.signal_type == NRF_WIFI_SIGNAL_TYPE_UNSPEC) { - res.rssi = (r->signal.signal.unspec_signal); - } - - vif_ctx_zep->disp_scan_cb(vif_ctx_zep->zep_net_if_ctx, - 0, - &res); - - vif_ctx_zep->scan_res_cnt++; - - /* NET_MGMT dropping events if too many are queued */ - k_yield(); - } - - if (more_res == false) { - vif_ctx_zep->disp_scan_cb(vif_ctx_zep->zep_net_if_ctx, 0, NULL); - vif_ctx_zep->scan_in_progress = false; - vif_ctx_zep->disp_scan_cb = NULL; - k_work_cancel_delayable(&vif_ctx_zep->scan_timeout_work); - } -} - - -#ifdef CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS -void nrf_wifi_rx_bcn_prb_resp_frm(void *vif_ctx, - void *nwb, - unsigned short frequency, - signed short signal) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = vif_ctx; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - struct wifi_raw_scan_result bcn_prb_resp_info; - int frame_length = 0; - int val = signal; - - vif_ctx_zep = vif_ctx; - - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return; - } - - if (!vif_ctx_zep->scan_in_progress) { - /*LOG_INF("%s: Scan not in progress : raw scan data not available", __func__);*/ - return; - } - - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - - frame_length = nrf_wifi_osal_nbuf_data_size(nwb); - - if (frame_length > CONFIG_WIFI_MGMT_RAW_SCAN_RESULT_LENGTH) { - nrf_wifi_osal_mem_cpy(&bcn_prb_resp_info.data, - nrf_wifi_osal_nbuf_data_get(nwb), - CONFIG_WIFI_MGMT_RAW_SCAN_RESULT_LENGTH); - - } else { - nrf_wifi_osal_mem_cpy(&bcn_prb_resp_info.data, - nrf_wifi_osal_nbuf_data_get(nwb), - frame_length); - } - - bcn_prb_resp_info.rssi = MBM_TO_DBM(val); - bcn_prb_resp_info.frequency = frequency; - bcn_prb_resp_info.frame_length = frame_length; - - wifi_mgmt_raise_raw_scan_result_event(vif_ctx_zep->zep_net_if_ctx, - &bcn_prb_resp_info); - -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); -} -#endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS */ diff --git a/drivers/wifi/nrf700x/src/wifi_util.c b/drivers/wifi/nrf700x/src/wifi_util.c deleted file mode 100644 index 2dae706695b8..000000000000 --- a/drivers/wifi/nrf700x/src/wifi_util.c +++ /dev/null @@ -1,1005 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/* @file - * @brief NRF Wi-Fi util shell module - */ -#include -#include "host_rpu_umac_if.h" -#include "fmac_api.h" -#include "fmac_util.h" -#include "fmac_main.h" -#include "wifi_util.h" - -extern struct nrf_wifi_drv_priv_zep rpu_drv_priv_zep; -struct nrf_wifi_ctx_zep *ctx = &rpu_drv_priv_zep.rpu_ctx_zep; - -static bool check_valid_data_rate(const struct shell *shell, - unsigned char rate_flag, - unsigned int data_rate) -{ - bool ret = false; - - switch (rate_flag) { - case RPU_TPUT_MODE_LEGACY: - if ((data_rate == 1) || - (data_rate == 2) || - (data_rate == 55) || - (data_rate == 11) || - (data_rate == 6) || - (data_rate == 9) || - (data_rate == 12) || - (data_rate == 18) || - (data_rate == 24) || - (data_rate == 36) || - (data_rate == 48) || - (data_rate == 54)) { - ret = true; - } - break; - case RPU_TPUT_MODE_HT: - case RPU_TPUT_MODE_HE_SU: - case RPU_TPUT_MODE_VHT: - if ((data_rate >= 0) && (data_rate <= 7)) { - ret = true; - } - break; - case RPU_TPUT_MODE_HE_ER_SU: - if (data_rate >= 0 && data_rate <= 2) { - ret = true; - } - break; - default: - shell_fprintf(shell, - SHELL_ERROR, - "%s: Invalid rate_flag %d\n", - __func__, - rate_flag); - break; - } - - return ret; -} - - -int nrf_wifi_util_conf_init(struct rpu_conf_params *conf_params) -{ - if (!conf_params) { - return -ENOEXEC; - } - - memset(conf_params, 0, sizeof(*conf_params)); - - /* Initialize values which are other than 0 */ - conf_params->he_ltf = -1; - conf_params->he_gi = -1; - return 0; -} - - -static int nrf_wifi_util_set_he_ltf(const struct shell *shell, - size_t argc, - const char *argv[]) -{ - char *ptr = NULL; - unsigned long he_ltf = 0; - - if (ctx->conf_params.set_he_ltf_gi) { - shell_fprintf(shell, - SHELL_ERROR, - "Disable 'set_he_ltf_gi', to set 'he_ltf'\n"); - return -ENOEXEC; - } - - he_ltf = strtoul(argv[1], &ptr, 10); - - if (he_ltf > 2) { - shell_fprintf(shell, - SHELL_ERROR, - "Invalid HE LTF value(%lu).\n", - he_ltf); - shell_help(shell); - return -ENOEXEC; - } - - ctx->conf_params.he_ltf = he_ltf; - - return 0; -} - - -static int nrf_wifi_util_set_he_gi(const struct shell *shell, - size_t argc, - const char *argv[]) -{ - char *ptr = NULL; - unsigned long he_gi = 0; - - if (ctx->conf_params.set_he_ltf_gi) { - shell_fprintf(shell, - SHELL_ERROR, - "Disable 'set_he_ltf_gi', to set 'he_gi'\n"); - return -ENOEXEC; - } - - he_gi = strtoul(argv[1], &ptr, 10); - - if (he_gi > 2) { - shell_fprintf(shell, - SHELL_ERROR, - "Invalid HE GI value(%lu).\n", - he_gi); - shell_help(shell); - return -ENOEXEC; - } - - ctx->conf_params.he_gi = he_gi; - - return 0; -} - - -static int nrf_wifi_util_set_he_ltf_gi(const struct shell *shell, - size_t argc, - const char *argv[]) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - char *ptr = NULL; - unsigned long val = 0; - - val = strtoul(argv[1], &ptr, 10); - - if ((val < 0) || (val > 1)) { - shell_fprintf(shell, - SHELL_ERROR, - "Invalid value(%lu).\n", - val); - shell_help(shell); - return -ENOEXEC; - } - - status = nrf_wifi_fmac_conf_ltf_gi(ctx->rpu_ctx, - ctx->conf_params.he_ltf, - ctx->conf_params.he_gi, - val); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - shell_fprintf(shell, - SHELL_ERROR, - "Programming ltf_gi failed\n"); - return -ENOEXEC; - } - - ctx->conf_params.set_he_ltf_gi = val; - - return 0; -} - -#ifdef CONFIG_NRF700X_STA_MODE -static int nrf_wifi_util_set_uapsd_queue(const struct shell *shell, - size_t argc, - const char *argv[]) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - char *ptr = NULL; - unsigned long val = 0; - - val = strtoul(argv[1], &ptr, 10); - - if ((val < UAPSD_Q_MIN) || (val > UAPSD_Q_MAX)) { - shell_fprintf(shell, - SHELL_ERROR, - "Invalid value(%lu).\n", - val); - shell_help(shell); - return -ENOEXEC; - } - - if (ctx->conf_params.uapsd_queue != val) { - status = nrf_wifi_fmac_set_uapsd_queue(ctx->rpu_ctx, - 0, - val); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - shell_fprintf(shell, - SHELL_ERROR, - "Programming uapsd_queue failed\n"); - return -ENOEXEC; - } - - ctx->conf_params.uapsd_queue = val; - } - - return 0; -} -#endif /* CONFIG_NRF700X_STA_MODE */ - - -static int nrf_wifi_util_show_cfg(const struct shell *shell, - size_t argc, - const char *argv[]) -{ - struct rpu_conf_params *conf_params = NULL; - - conf_params = &ctx->conf_params; - - shell_fprintf(shell, - SHELL_INFO, - "************* Configured Parameters ***********\n"); - shell_fprintf(shell, - SHELL_INFO, - "\n"); - - shell_fprintf(shell, - SHELL_INFO, - "he_ltf = %d\n", - conf_params->he_ltf); - - shell_fprintf(shell, - SHELL_INFO, - "he_gi = %u\n", - conf_params->he_gi); - - shell_fprintf(shell, - SHELL_INFO, - "set_he_ltf_gi = %d\n", - conf_params->set_he_ltf_gi); - - shell_fprintf(shell, - SHELL_INFO, - "uapsd_queue = %d\n", - conf_params->uapsd_queue); - - shell_fprintf(shell, - SHELL_INFO, - "rate_flag = %d, rate_val = %d\n", - ctx->conf_params.tx_pkt_tput_mode, - ctx->conf_params.tx_pkt_rate); - return 0; -} - -#ifdef CONFIG_NRF700X_STA_MODE -static int nrf_wifi_util_tx_stats(const struct shell *shell, - size_t argc, - const char *argv[]) -{ - int vif_index = -1; - int peer_index = 0; - int max_vif_index = MAX(MAX_NUM_APS, MAX_NUM_STAS); - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - void *queue = NULL; - unsigned int tx_pending_pkts = 0; - struct nrf_wifi_fmac_dev_ctx_def *def_dev_ctx = NULL; - - vif_index = atoi(argv[1]); - if ((vif_index < 0) || (vif_index >= max_vif_index)) { - shell_fprintf(shell, - SHELL_ERROR, - "Invalid vif index(%d).\n", - vif_index); - shell_help(shell); - return -ENOEXEC; - } - - fmac_dev_ctx = ctx->rpu_ctx; - def_dev_ctx = wifi_dev_priv(fmac_dev_ctx); - - /* TODO: Get peer_index from shell once AP mode is supported */ - shell_fprintf(shell, - SHELL_INFO, - "************* Tx Stats: vif(%d) peer(0) ***********\n", - vif_index); - - for (int i = 0; i < NRF_WIFI_FMAC_AC_MAX ; i++) { - queue = def_dev_ctx->tx_config.data_pending_txq[peer_index][i]; - tx_pending_pkts = nrf_wifi_utils_q_len(queue); - - shell_fprintf( - shell, - SHELL_INFO, - "Outstanding tokens: ac: %d -> %d (pending_q_len: %d)\n", - i, - def_dev_ctx->tx_config.outstanding_descs[i], - tx_pending_pkts); - } - - return 0; -} -#endif /* CONFIG_NRF700X_STA_MODE */ - - -static int nrf_wifi_util_tx_rate(const struct shell *shell, - size_t argc, - const char *argv[]) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - char *ptr = NULL; - long rate_flag = -1; - long data_rate = -1; - - rate_flag = strtol(argv[1], &ptr, 10); - - if (rate_flag >= RPU_TPUT_MODE_MAX) { - shell_fprintf(shell, - SHELL_ERROR, - "Invalid value %ld for rate_flags\n", - rate_flag); - shell_help(shell); - return -ENOEXEC; - } - - - if (rate_flag == RPU_TPUT_MODE_HE_TB) { - data_rate = -1; - } else { - if (argc < 3) { - shell_fprintf(shell, - SHELL_ERROR, - "rate_val needed for rate_flag = %ld\n", - rate_flag); - shell_help(shell); - return -ENOEXEC; - } - - data_rate = strtol(argv[2], &ptr, 10); - - if (!(check_valid_data_rate(shell, - rate_flag, - data_rate))) { - shell_fprintf(shell, - SHELL_ERROR, - "Invalid data_rate %ld for rate_flag %ld\n", - data_rate, - rate_flag); - return -ENOEXEC; - } - - } - - status = nrf_wifi_fmac_set_tx_rate(ctx->rpu_ctx, - rate_flag, - data_rate); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - shell_fprintf(shell, - SHELL_ERROR, - "Programming tx_rate failed\n"); - return -ENOEXEC; - } - - ctx->conf_params.tx_pkt_tput_mode = rate_flag; - ctx->conf_params.tx_pkt_rate = data_rate; - - return 0; -} - - -#ifdef CONFIG_NRF_WIFI_LOW_POWER -static int nrf_wifi_util_show_host_rpu_ps_ctrl_state(const struct shell *shell, - size_t argc, - const char *argv[]) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - int rpu_ps_state = -1; - - status = nrf_wifi_fmac_get_host_rpu_ps_ctrl_state(ctx->rpu_ctx, - &rpu_ps_state); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - shell_fprintf(shell, - SHELL_ERROR, - "Failed to get PS state\n"); - return -ENOEXEC; - } - - shell_fprintf(shell, - SHELL_INFO, - "RPU sleep status = %s\n", rpu_ps_state ? "AWAKE" : "SLEEP"); - return 0; -} -#endif /* CONFIG_NRF_WIFI_LOW_POWER */ - - -static int nrf_wifi_util_show_vers(const struct shell *shell, - size_t argc, - const char *argv[]) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - unsigned int fw_ver; - - fmac_dev_ctx = ctx->rpu_ctx; - - shell_fprintf(shell, SHELL_INFO, "Driver version: %s\n", - NRF700X_DRIVER_VERSION); - - status = nrf_wifi_fmac_ver_get(fmac_dev_ctx, &fw_ver); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - shell_fprintf(shell, - SHELL_INFO, - "Failed to get firmware version\n"); - return -ENOEXEC; - } - - shell_fprintf(shell, SHELL_INFO, - "Firmware version: %d.%d.%d.%d\n", - NRF_WIFI_UMAC_VER(fw_ver), - NRF_WIFI_UMAC_VER_MAJ(fw_ver), - NRF_WIFI_UMAC_VER_MIN(fw_ver), - NRF_WIFI_UMAC_VER_EXTRA(fw_ver)); - - return status; -} - -#ifndef CONFIG_NRF700X_RADIO_TEST -static int nrf_wifi_util_dump_rpu_stats(const struct shell *shell, - size_t argc, - const char *argv[]) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - struct rpu_op_stats stats; - enum rpu_stats_type stats_type = RPU_STATS_TYPE_ALL; - - if (argc == 2) { - const char *type = argv[1]; - - if (!strcmp(type, "umac")) { - stats_type = RPU_STATS_TYPE_UMAC; - } else if (!strcmp(type, "lmac")) { - stats_type = RPU_STATS_TYPE_LMAC; - } else if (!strcmp(type, "phy")) { - stats_type = RPU_STATS_TYPE_PHY; - } else if (!strcmp(type, "all")) { - stats_type = RPU_STATS_TYPE_ALL; - } else { - shell_fprintf(shell, - SHELL_ERROR, - "Invalid stats type %s\n", - type); - return -ENOEXEC; - } - } - - fmac_dev_ctx = ctx->rpu_ctx; - - memset(&stats, 0, sizeof(struct rpu_op_stats)); - status = nrf_wifi_fmac_stats_get(fmac_dev_ctx, 0, &stats); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - shell_fprintf(shell, - SHELL_ERROR, - "Failed to get stats\n"); - return -ENOEXEC; - } - - if (stats_type == RPU_STATS_TYPE_UMAC || stats_type == RPU_STATS_TYPE_ALL) { - struct rpu_umac_stats *umac = &stats.fw.umac; - - shell_fprintf(shell, SHELL_INFO, - "UMAC TX debug stats:\n" - "======================\n" - "tx_cmd: %u\n" - "tx_non_coalesce_pkts_rcvd_from_host: %u\n" - "tx_coalesce_pkts_rcvd_from_host: %u\n" - "tx_max_coalesce_pkts_rcvd_from_host: %u\n" - "tx_cmds_max_used: %u\n" - "tx_cmds_currently_in_use: %u\n" - "tx_done_events_send_to_host: %u\n" - "tx_done_success_pkts_to_host: %u\n" - "tx_done_failure_pkts_to_host: %u\n" - "tx_cmds_with_crypto_pkts_rcvd_from_host: %u\n" - "tx_cmds_with_non_crypto_pkts_rcvd_from_host: %u\n" - "tx_cmds_with_broadcast_pkts_rcvd_from_host: %u\n" - "tx_cmds_with_multicast_pkts_rcvd_from_host: %u\n" - "tx_cmds_with_unicast_pkts_rcvd_from_host: %u\n" - "xmit: %u\n" - "send_addba_req: %u\n" - "addba_resp: %u\n" - "softmac_tx: %u\n" - "internal_pkts: %u\n" - "external_pkts: %u\n" - "tx_cmds_to_lmac: %u\n" - "tx_dones_from_lmac: %u\n" - "total_cmds_to_lmac: %u\n" - "tx_packet_data_count: %u\n" - "tx_packet_mgmt_count: %u\n" - "tx_packet_beacon_count: %u\n" - "tx_packet_probe_req_count: %u\n" - "tx_packet_auth_count: %u\n" - "tx_packet_deauth_count: %u\n" - "tx_packet_assoc_req_count: %u\n" - "tx_packet_disassoc_count: %u\n" - "tx_packet_action_count: %u\n" - "tx_packet_other_mgmt_count: %u\n" - "tx_packet_non_mgmt_data_count: %u\n\n", - umac->tx_dbg_params.tx_cmd, - umac->tx_dbg_params.tx_non_coalesce_pkts_rcvd_from_host, - umac->tx_dbg_params.tx_coalesce_pkts_rcvd_from_host, - umac->tx_dbg_params.tx_max_coalesce_pkts_rcvd_from_host, - umac->tx_dbg_params.tx_cmds_max_used, - umac->tx_dbg_params.tx_cmds_currently_in_use, - umac->tx_dbg_params.tx_done_events_send_to_host, - umac->tx_dbg_params.tx_done_success_pkts_to_host, - umac->tx_dbg_params.tx_done_failure_pkts_to_host, - umac->tx_dbg_params.tx_cmds_with_crypto_pkts_rcvd_from_host, - umac->tx_dbg_params.tx_cmds_with_non_crypto_pkts_rcvd_from_host, - umac->tx_dbg_params.tx_cmds_with_broadcast_pkts_rcvd_from_host, - umac->tx_dbg_params.tx_cmds_with_multicast_pkts_rcvd_from_host, - umac->tx_dbg_params.tx_cmds_with_unicast_pkts_rcvd_from_host, - umac->tx_dbg_params.xmit, - umac->tx_dbg_params.send_addba_req, - umac->tx_dbg_params.addba_resp, - umac->tx_dbg_params.softmac_tx, - umac->tx_dbg_params.internal_pkts, - umac->tx_dbg_params.external_pkts, - umac->tx_dbg_params.tx_cmds_to_lmac, - umac->tx_dbg_params.tx_dones_from_lmac, - umac->tx_dbg_params.total_cmds_to_lmac, - umac->tx_dbg_params.tx_packet_data_count, - umac->tx_dbg_params.tx_packet_mgmt_count, - umac->tx_dbg_params.tx_packet_beacon_count, - umac->tx_dbg_params.tx_packet_probe_req_count, - umac->tx_dbg_params.tx_packet_auth_count, - umac->tx_dbg_params.tx_packet_deauth_count, - umac->tx_dbg_params.tx_packet_assoc_req_count, - umac->tx_dbg_params.tx_packet_disassoc_count, - umac->tx_dbg_params.tx_packet_action_count, - umac->tx_dbg_params.tx_packet_other_mgmt_count, - umac->tx_dbg_params.tx_packet_non_mgmt_data_count); - - shell_fprintf(shell, SHELL_INFO, - "UMAC RX debug stats\n" - "======================\n" - "lmac_events: %u\n" - "rx_events: %u\n" - "rx_coalesce_events: %u\n" - "total_rx_pkts_from_lmac: %u\n" - "max_refill_gap: %u\n" - "current_refill_gap: %u\n" - "out_of_order_mpdus: %u\n" - "reorder_free_mpdus: %u\n" - "umac_consumed_pkts: %u\n" - "host_consumed_pkts: %u\n" - "rx_mbox_post: %u\n" - "rx_mbox_receive: %u\n" - "reordering_ampdu: %u\n" - "timer_mbox_post: %u\n" - "timer_mbox_rcv: %u\n" - "work_mbox_post: %u\n" - "work_mbox_rcv: %u\n" - "tasklet_mbox_post: %u\n" - "tasklet_mbox_rcv: %u\n" - "userspace_offload_frames: %u\n" - "alloc_buf_fail: %u\n" - "rx_packet_total_count: %u\n" - "rx_packet_data_count: %u\n" - "rx_packet_qos_data_count: %u\n" - "rx_packet_protected_data_count: %u\n" - "rx_packet_mgmt_count: %u\n" - "rx_packet_beacon_count: %u\n" - "rx_packet_probe_resp_count: %u\n" - "rx_packet_auth_count: %u\n" - "rx_packet_deauth_count: %u\n" - "rx_packet_assoc_resp_count: %u\n" - "rx_packet_disassoc_count: %u\n" - "rx_packet_action_count: %u\n" - "rx_packet_probe_req_count: %u\n" - "rx_packet_other_mgmt_count: %u\n" - "max_coalesce_pkts: %d\n" - "null_skb_pointer_from_lmac: %u\n" - "unexpected_mgmt_pkt: %u\n\n", - umac->rx_dbg_params.lmac_events, - umac->rx_dbg_params.rx_events, - umac->rx_dbg_params.rx_coalesce_events, - umac->rx_dbg_params.total_rx_pkts_from_lmac, - umac->rx_dbg_params.max_refill_gap, - umac->rx_dbg_params.current_refill_gap, - umac->rx_dbg_params.out_of_order_mpdus, - umac->rx_dbg_params.reorder_free_mpdus, - umac->rx_dbg_params.umac_consumed_pkts, - umac->rx_dbg_params.host_consumed_pkts, - umac->rx_dbg_params.rx_mbox_post, - umac->rx_dbg_params.rx_mbox_receive, - umac->rx_dbg_params.reordering_ampdu, - umac->rx_dbg_params.timer_mbox_post, - umac->rx_dbg_params.timer_mbox_rcv, - umac->rx_dbg_params.work_mbox_post, - umac->rx_dbg_params.work_mbox_rcv, - umac->rx_dbg_params.tasklet_mbox_post, - umac->rx_dbg_params.tasklet_mbox_rcv, - umac->rx_dbg_params.userspace_offload_frames, - umac->rx_dbg_params.alloc_buf_fail, - umac->rx_dbg_params.rx_packet_total_count, - umac->rx_dbg_params.rx_packet_data_count, - umac->rx_dbg_params.rx_packet_qos_data_count, - umac->rx_dbg_params.rx_packet_protected_data_count, - umac->rx_dbg_params.rx_packet_mgmt_count, - umac->rx_dbg_params.rx_packet_beacon_count, - umac->rx_dbg_params.rx_packet_probe_resp_count, - umac->rx_dbg_params.rx_packet_auth_count, - umac->rx_dbg_params.rx_packet_deauth_count, - umac->rx_dbg_params.rx_packet_assoc_resp_count, - umac->rx_dbg_params.rx_packet_disassoc_count, - umac->rx_dbg_params.rx_packet_action_count, - umac->rx_dbg_params.rx_packet_probe_req_count, - umac->rx_dbg_params.rx_packet_other_mgmt_count, - umac->rx_dbg_params.max_coalesce_pkts, - umac->rx_dbg_params.null_skb_pointer_from_lmac, - umac->rx_dbg_params.unexpected_mgmt_pkt); - - shell_fprintf(shell, SHELL_INFO, - "UMAC control path stats\n" - "======================\n" - "cmd_init: %u\n" - "event_init_done: %u\n" - "cmd_rf_test: %u\n" - "cmd_connect: %u\n" - "cmd_get_stats: %u\n" - "event_ps_state: %u\n" - "cmd_set_reg: %u\n" - "cmd_get_reg: %u\n" - "cmd_req_set_reg: %u\n" - "cmd_trigger_scan: %u\n" - "event_scan_done: %u\n" - "cmd_get_scan: %u\n" - "umac_scan_req: %u\n" - "umac_scan_complete: %u\n" - "umac_scan_busy: %u\n" - "cmd_auth: %u\n" - "cmd_assoc: %u\n" - "cmd_deauth: %u\n" - "cmd_register_frame: %u\n" - "cmd_frame: %u\n" - "cmd_del_key: %u\n" - "cmd_new_key: %u\n" - "cmd_set_key: %u\n" - "cmd_get_key: %u\n" - "event_beacon_hint: %u\n" - "event_reg_change: %u\n" - "event_wiphy_reg_change: %u\n" - "cmd_set_station: %u\n" - "cmd_new_station: %u\n" - "cmd_del_station: %u\n" - "cmd_new_interface: %u\n" - "cmd_set_interface: %u\n" - "cmd_get_interface: %u\n" - "cmd_set_ifflags: %u\n" - "cmd_set_ifflags_done: %u\n" - "cmd_set_bss: %u\n" - "cmd_set_wiphy: %u\n" - "cmd_start_ap: %u\n" - "LMAC_CMD_PS: %u\n" - "CURR_STATE: %u\n\n", - umac->cmd_evnt_dbg_params.cmd_init, - umac->cmd_evnt_dbg_params.event_init_done, - umac->cmd_evnt_dbg_params.cmd_rf_test, - umac->cmd_evnt_dbg_params.cmd_connect, - umac->cmd_evnt_dbg_params.cmd_get_stats, - umac->cmd_evnt_dbg_params.event_ps_state, - umac->cmd_evnt_dbg_params.cmd_set_reg, - umac->cmd_evnt_dbg_params.cmd_get_reg, - umac->cmd_evnt_dbg_params.cmd_req_set_reg, - umac->cmd_evnt_dbg_params.cmd_trigger_scan, - umac->cmd_evnt_dbg_params.event_scan_done, - umac->cmd_evnt_dbg_params.cmd_get_scan, - umac->cmd_evnt_dbg_params.umac_scan_req, - umac->cmd_evnt_dbg_params.umac_scan_complete, - umac->cmd_evnt_dbg_params.umac_scan_busy, - umac->cmd_evnt_dbg_params.cmd_auth, - umac->cmd_evnt_dbg_params.cmd_assoc, - umac->cmd_evnt_dbg_params.cmd_deauth, - umac->cmd_evnt_dbg_params.cmd_register_frame, - umac->cmd_evnt_dbg_params.cmd_frame, - umac->cmd_evnt_dbg_params.cmd_del_key, - umac->cmd_evnt_dbg_params.cmd_new_key, - umac->cmd_evnt_dbg_params.cmd_set_key, - umac->cmd_evnt_dbg_params.cmd_get_key, - umac->cmd_evnt_dbg_params.event_beacon_hint, - umac->cmd_evnt_dbg_params.event_reg_change, - umac->cmd_evnt_dbg_params.event_wiphy_reg_change, - umac->cmd_evnt_dbg_params.cmd_set_station, - umac->cmd_evnt_dbg_params.cmd_new_station, - umac->cmd_evnt_dbg_params.cmd_del_station, - umac->cmd_evnt_dbg_params.cmd_new_interface, - umac->cmd_evnt_dbg_params.cmd_set_interface, - umac->cmd_evnt_dbg_params.cmd_get_interface, - umac->cmd_evnt_dbg_params.cmd_set_ifflags, - umac->cmd_evnt_dbg_params.cmd_set_ifflags_done, - umac->cmd_evnt_dbg_params.cmd_set_bss, - umac->cmd_evnt_dbg_params.cmd_set_wiphy, - umac->cmd_evnt_dbg_params.cmd_start_ap, - umac->cmd_evnt_dbg_params.LMAC_CMD_PS, - umac->cmd_evnt_dbg_params.CURR_STATE); - - shell_fprintf(shell, SHELL_INFO, - "UMAC interface stats\n" - "======================\n" - "tx_unicast_pkt_count: %u\n" - "tx_multicast_pkt_count: %u\n" - "tx_broadcast_pkt_count: %u\n" - "tx_bytes: %u\n" - "rx_unicast_pkt_count: %u\n" - "rx_multicast_pkt_count: %u\n" - "rx_broadcast_pkt_count: %u\n" - "rx_beacon_success_count: %u\n" - "rx_beacon_miss_count: %u\n" - "rx_bytes: %u\n" - "rx_checksum_error_count: %u\n\n" - "replay_attack_drop_cnt: %u\n\n", - umac->interface_data_stats.tx_unicast_pkt_count, - umac->interface_data_stats.tx_multicast_pkt_count, - umac->interface_data_stats.tx_broadcast_pkt_count, - umac->interface_data_stats.tx_bytes, - umac->interface_data_stats.rx_unicast_pkt_count, - umac->interface_data_stats.rx_multicast_pkt_count, - umac->interface_data_stats.rx_broadcast_pkt_count, - umac->interface_data_stats.rx_beacon_success_count, - umac->interface_data_stats.rx_beacon_miss_count, - umac->interface_data_stats.rx_bytes, - umac->interface_data_stats.rx_checksum_error_count, - umac->interface_data_stats.replay_attack_drop_cnt); - } - - if (stats_type == RPU_STATS_TYPE_LMAC || stats_type == RPU_STATS_TYPE_ALL) { - struct rpu_lmac_stats *lmac = &stats.fw.lmac; - - shell_fprintf(shell, SHELL_INFO, - "LMAC stats\n" - "======================\n" - "reset_cmd_cnt: %u\n" - "reset_complete_event_cnt: %u\n" - "unable_gen_event: %u\n" - "ch_prog_cmd_cnt: %u\n" - "channel_prog_done: %u\n" - "tx_pkt_cnt: %u\n" - "tx_pkt_done_cnt: %u\n" - "scan_pkt_cnt: %u\n" - "internal_pkt_cnt: %u\n" - "internal_pkt_done_cnt: %u\n" - "ack_resp_cnt: %u\n" - "tx_timeout: %u\n" - "deagg_isr: %u\n" - "deagg_inptr_desc_empty: %u\n" - "deagg_circular_buffer_full: %u\n" - "lmac_rxisr_cnt: %u\n" - "rx_decryptcnt: %u\n" - "process_decrypt_fail: %u\n" - "prepa_rx_event_fail: %u\n" - "rx_core_pool_full_cnt: %u\n" - "rx_mpdu_crc_success_cnt: %u\n" - "rx_mpdu_crc_fail_cnt: %u\n" - "rx_ofdm_crc_success_cnt: %u\n" - "rx_ofdm_crc_fail_cnt: %u\n" - "rxDSSSCrcSuccessCnt: %u\n" - "rxDSSSCrcFailCnt: %u\n" - "rx_crypto_start_cnt: %u\n" - "rx_crypto_done_cnt: %u\n" - "rx_event_buf_full: %u\n" - "rx_extram_buf_full: %u\n" - "scan_req: %u\n" - "scan_complete: %u\n" - "scan_abort_req: %u\n" - "scan_abort_complete: %u\n" - "internal_buf_pool_null: %u\n" - "rpu_hw_lockup_count: %u\n" - "rpu_hw_lockup_recovery_done: %u\n\n", - lmac->reset_cmd_cnt, - lmac->reset_complete_event_cnt, - lmac->unable_gen_event, - lmac->ch_prog_cmd_cnt, - lmac->channel_prog_done, - lmac->tx_pkt_cnt, - lmac->tx_pkt_done_cnt, - lmac->scan_pkt_cnt, - lmac->internal_pkt_cnt, - lmac->internal_pkt_done_cnt, - lmac->ack_resp_cnt, - lmac->tx_timeout, - lmac->deagg_isr, - lmac->deagg_inptr_desc_empty, - lmac->deagg_circular_buffer_full, - lmac->lmac_rxisr_cnt, - lmac->rx_decryptcnt, - lmac->process_decrypt_fail, - lmac->prepa_rx_event_fail, - lmac->rx_core_pool_full_cnt, - lmac->rx_mpdu_crc_success_cnt, - lmac->rx_mpdu_crc_fail_cnt, - lmac->rx_ofdm_crc_success_cnt, - lmac->rx_ofdm_crc_fail_cnt, - lmac->rxDSSSCrcSuccessCnt, - lmac->rxDSSSCrcFailCnt, - lmac->rx_crypto_start_cnt, - lmac->rx_crypto_done_cnt, - lmac->rx_event_buf_full, - lmac->rx_extram_buf_full, - lmac->scan_req, - lmac->scan_complete, - lmac->scan_abort_req, - lmac->scan_abort_complete, - lmac->internal_buf_pool_null, - lmac->rpu_hw_lockup_count, - lmac->rpu_hw_lockup_recovery_done); - } - - if (stats_type == RPU_STATS_TYPE_PHY || stats_type == RPU_STATS_TYPE_ALL) { - struct rpu_phy_stats *phy = &stats.fw.phy; - - shell_fprintf(shell, SHELL_INFO, - "PHY stats\n" - "======================\n" - "rssi_avg: %d\n" - "pdout_val: %u\n" - "ofdm_crc32_pass_cnt: %u\n" - "ofdm_crc32_fail_cnt: %u\n" - "dsss_crc32_pass_cnt: %u\n" - "dsss_crc32_fail_cnt: %u\n\n", - phy->rssi_avg, - phy->pdout_val, - phy->ofdm_crc32_pass_cnt, - phy->ofdm_crc32_fail_cnt, - phy->dsss_crc32_pass_cnt, - phy->dsss_crc32_fail_cnt); - } - - return 0; -} -#endif /* CONFIG_NRF700X_RADIO_TEST */ - -#ifdef CONFIG_NRF_WIFI_RPU_RECOVERY -static int nrf_wifi_util_trigger_rpu_recovery(const struct shell *shell, - size_t argc, - const char *argv[]) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - - if (!ctx || !ctx->rpu_ctx) { - shell_fprintf(shell, - SHELL_ERROR, - "RPU context not initialized\n"); - return -ENOEXEC; - } - - fmac_dev_ctx = ctx->rpu_ctx; - - status = nrf_wifi_fmac_rpu_recovery_callback(fmac_dev_ctx, NULL, 0); - if (status != NRF_WIFI_STATUS_SUCCESS) { - shell_fprintf(shell, - SHELL_ERROR, - "Failed to trigger RPU recovery\n"); - return -ENOEXEC; - } - - shell_fprintf(shell, - SHELL_INFO, - "RPU recovery triggered\n"); - - return 0; -} -#endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */ - -SHELL_STATIC_SUBCMD_SET_CREATE( - nrf_wifi_util_subcmds, - SHELL_CMD_ARG(he_ltf, - NULL, - "0 - 1x HE LTF\n" - "1 - 2x HE LTF\n" - "2 - 4x HE LTF ", - nrf_wifi_util_set_he_ltf, - 2, - 0), - SHELL_CMD_ARG(he_gi, - NULL, - "0 - 0.8 us\n" - "1 - 1.6 us\n" - "2 - 3.2 us ", - nrf_wifi_util_set_he_gi, - 2, - 0), - SHELL_CMD_ARG(set_he_ltf_gi, - NULL, - "0 - Disable\n" - "1 - Enable", - nrf_wifi_util_set_he_ltf_gi, - 2, - 0), -#ifdef CONFIG_NRF700X_STA_MODE - SHELL_CMD_ARG(uapsd_queue, - NULL, - " - 0 to 15", - nrf_wifi_util_set_uapsd_queue, - 2, - 0), -#endif /* CONFIG_NRF700X_STA_MODE */ - SHELL_CMD_ARG(show_config, - NULL, - "Display the current configuration values", - nrf_wifi_util_show_cfg, - 1, - 0), -#ifdef CONFIG_NRF700X_STA_MODE - SHELL_CMD_ARG(tx_stats, - NULL, - "Displays transmit statistics\n" - "vif_index: 0 - 1\n", - nrf_wifi_util_tx_stats, - 2, - 0), -#endif /* CONFIG_NRF700X_STA_MODE */ - SHELL_CMD_ARG(tx_rate, - NULL, - "Sets TX data rate to either a fixed value or AUTO\n" - "Parameters:\n" - " : The TX data rate type to be set, where:\n" - " 0 - LEGACY\n" - " 1 - HT\n" - " 2 - VHT\n" - " 3 - HE_SU\n" - " 4 - HE_ER_SU\n" - " 5 - AUTO\n" - " : The TX data rate value to be set, valid values are:\n" - " Legacy : <1, 2, 55, 11, 6, 9, 12, 18, 24, 36, 48, 54>\n" - " Non-legacy: \n" - " AUTO: \n", - nrf_wifi_util_tx_rate, - 2, - 1), -#ifdef CONFIG_NRF_WIFI_LOW_POWER - SHELL_CMD_ARG(sleep_state, - NULL, - "Display current sleep status", - nrf_wifi_util_show_host_rpu_ps_ctrl_state, - 1, - 0), -#endif /* CONFIG_NRF_WIFI_LOW_POWER */ - SHELL_CMD_ARG(show_vers, - NULL, - "Display the driver and the firmware versions", - nrf_wifi_util_show_vers, - 1, - 0), -#ifndef CONFIG_NRF700X_RADIO_TEST - SHELL_CMD_ARG(rpu_stats, - NULL, - "Display RPU stats " - "Parameters: umac or lmac or phy or all (default)", - nrf_wifi_util_dump_rpu_stats, - 1, - 1), -#endif /* CONFIG_NRF700X_RADIO_TEST */ -#ifdef CONFIG_NRF_WIFI_RPU_RECOVERY - SHELL_CMD_ARG(rpu_recovery_test, - NULL, - "Trigger RPU recovery", - nrf_wifi_util_trigger_rpu_recovery, - 1, - 0), -#endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */ - SHELL_SUBCMD_SET_END); - - -SHELL_CMD_REGISTER(wifi_util, - &nrf_wifi_util_subcmds, - "nRF Wi-Fi utility shell commands", - NULL); - - -static int nrf_wifi_util_init(void) -{ - - if (nrf_wifi_util_conf_init(&ctx->conf_params) < 0) - return -1; - - return 0; -} - - -SYS_INIT(nrf_wifi_util_init, - APPLICATION, - CONFIG_APPLICATION_INIT_PRIORITY); diff --git a/drivers/wifi/nrf700x/src/wifi_util.h b/drivers/wifi/nrf700x/src/wifi_util.h deleted file mode 100644 index afe67c86901e..000000000000 --- a/drivers/wifi/nrf700x/src/wifi_util.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/* @file - * @brief nRF Wi-Fi radio-test mode shell module - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct nrf_wifi_ctx_zep_rt { - struct nrf_wifi_fmac_priv *fmac_priv; - struct rpu_conf_params conf_params; -}; diff --git a/drivers/wifi/nrf700x/src/work.c b/drivers/wifi/nrf700x/src/work.c deleted file mode 100644 index 2106c629f62f..000000000000 --- a/drivers/wifi/nrf700x/src/work.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief File containing work specific definitions for the - * Zephyr OS layer of the Wi-Fi driver. - */ - -#include -#include -#include -#include - -#include "work.h" - -LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF700X_LOG_LEVEL); - -K_THREAD_STACK_DEFINE(bh_wq_stack_area, CONFIG_NRF700X_BH_WQ_STACK_SIZE); -struct k_work_q zep_wifi_bh_q; - -K_THREAD_STACK_DEFINE(irq_wq_stack_area, CONFIG_NRF700X_IRQ_WQ_STACK_SIZE); -struct k_work_q zep_wifi_intr_q; - -#ifdef CONFIG_NRF700X_TX_DONE_WQ_ENABLED -K_THREAD_STACK_DEFINE(tx_done_wq_stack_area, CONFIG_NRF700X_TX_DONE_WQ_STACK_SIZE); -struct k_work_q zep_wifi_tx_done_q; -#endif /* CONFIG_NRF700X_TX_DONE_WQ_ENABLED */ - -#ifdef CONFIG_NRF700X_RX_WQ_ENABLED -K_THREAD_STACK_DEFINE(rx_wq_stack_area, CONFIG_NRF700X_RX_WQ_STACK_SIZE); -struct k_work_q zep_wifi_rx_q; -#endif /* CONFIG_NRF700X_RX_WQ_ENABLED */ - -struct zep_work_item zep_work_item[CONFIG_NRF700X_WORKQ_MAX_ITEMS]; - -int get_free_work_item_index(void) -{ - int i; - - for (i = 0; i < CONFIG_NRF700X_WORKQ_MAX_ITEMS; i++) { - if (zep_work_item[i].in_use) - continue; - return i; - } - - return -1; -} - -void workqueue_callback(struct k_work *work) -{ - struct zep_work_item *item = CONTAINER_OF(work, struct zep_work_item, work); - - item->callback(item->data); -} - -struct zep_work_item *work_alloc(enum zep_work_type type) -{ - int free_work_index = get_free_work_item_index(); - - if (free_work_index < 0) { - LOG_ERR("%s: Reached maximum work items", __func__); - return NULL; - } - - zep_work_item[free_work_index].in_use = true; - zep_work_item[free_work_index].type = type; - - return &zep_work_item[free_work_index]; -} - -static int workqueue_init(void) -{ - k_work_queue_init(&zep_wifi_bh_q); - - k_work_queue_start(&zep_wifi_bh_q, - bh_wq_stack_area, - K_THREAD_STACK_SIZEOF(bh_wq_stack_area), - CONFIG_NRF700X_BH_WQ_PRIORITY, - NULL); - - k_thread_name_set(&zep_wifi_bh_q.thread, "nrf700x_bh_wq"); - - k_work_queue_init(&zep_wifi_intr_q); - - k_work_queue_start(&zep_wifi_intr_q, - irq_wq_stack_area, - K_THREAD_STACK_SIZEOF(irq_wq_stack_area), - CONFIG_NRF700X_IRQ_WQ_PRIORITY, - NULL); - - k_thread_name_set(&zep_wifi_intr_q.thread, "nrf700x_intr_wq"); -#ifdef CONFIG_NRF700X_TX_DONE_WQ_ENABLED - k_work_queue_init(&zep_wifi_tx_done_q); - - k_work_queue_start(&zep_wifi_tx_done_q, - tx_done_wq_stack_area, - K_THREAD_STACK_SIZEOF(tx_done_wq_stack_area), - CONFIG_NRF700X_TX_DONE_WQ_PRIORITY, - NULL); - - k_thread_name_set(&zep_wifi_tx_done_q.thread, "nrf700x_tx_done_wq"); -#endif /* CONFIG_NRF700X_TX_DONE_WQ_ENABLED */ - -#ifdef CONFIG_NRF700X_RX_WQ_ENABLED - k_work_queue_init(&zep_wifi_rx_q); - - k_work_queue_start(&zep_wifi_rx_q, - rx_wq_stack_area, - K_THREAD_STACK_SIZEOF(rx_wq_stack_area), - CONFIG_NRF700X_RX_WQ_PRIORITY, - NULL); - - k_thread_name_set(&zep_wifi_rx_q.thread, "nrf700x_rx_wq"); -#endif /* CONFIG_NRF700X_RX_WQ_ENABLED */ - - return 0; -} - -void work_init(struct zep_work_item *item, void (*callback)(unsigned long), - unsigned long data) -{ - item->callback = callback; - item->data = data; - - k_work_init(&item->work, workqueue_callback); -} - -void work_schedule(struct zep_work_item *item) -{ - if (item->type == ZEP_WORK_TYPE_IRQ) - k_work_submit_to_queue(&zep_wifi_intr_q, &item->work); - else if (item->type == ZEP_WORK_TYPE_BH) - k_work_submit_to_queue(&zep_wifi_bh_q, &item->work); -#ifdef CONFIG_NRF700X_TX_DONE_WQ_ENABLED - else if (item->type == ZEP_WORK_TYPE_TX_DONE) - k_work_submit_to_queue(&zep_wifi_tx_done_q, &item->work); -#endif /* CONFIG_NRF700X_TX_DONE_WQ_ENABLED */ -#ifdef CONFIG_NRF700X_RX_WQ_ENABLED - else if (item->type == ZEP_WORK_TYPE_RX) - k_work_submit_to_queue(&zep_wifi_rx_q, &item->work); -#endif /* CONFIG_NRF700X_RX_WQ_ENABLED */ -} - -void work_kill(struct zep_work_item *item) -{ - /* TODO: Based on context, use _sync version */ - k_work_cancel(&item->work); -} - -void work_free(struct zep_work_item *item) -{ - item->in_use = 0; -} - -SYS_INIT(workqueue_init, POST_KERNEL, 0); diff --git a/drivers/wifi/nrf700x/src/work.h b/drivers/wifi/nrf700x/src/work.h deleted file mode 100644 index 1af7f97bc633..000000000000 --- a/drivers/wifi/nrf700x/src/work.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief Header containing work specific declarations for the - * Zephyr OS layer of the Wi-Fi driver. - */ - -#ifndef __WORK_H__ -#define __WORK_H__ - - -extern struct k_work_q zep_wifi_bh_q; - -enum zep_work_type { - ZEP_WORK_TYPE_BH, - ZEP_WORK_TYPE_IRQ, - ZEP_WORK_TYPE_TX_DONE, - ZEP_WORK_TYPE_RX, -}; - -struct zep_work_item { - bool in_use; - struct k_work work; - unsigned long data; - void (*callback)(unsigned long data); - enum zep_work_type type; -}; - -struct zep_work_item *work_alloc(enum zep_work_type); - -void work_init(struct zep_work_item *work, void (*callback)(unsigned long callbk_data), - unsigned long data); - -void work_schedule(struct zep_work_item *work); - -void work_kill(struct zep_work_item *work); - -void work_free(struct zep_work_item *work); - -#endif /* __WORK_H__ */ diff --git a/drivers/wifi/nrf700x/src/wpa_supp_if.c b/drivers/wifi/nrf700x/src/wpa_supp_if.c deleted file mode 100644 index 149c9a32bf71..000000000000 --- a/drivers/wifi/nrf700x/src/wpa_supp_if.c +++ /dev/null @@ -1,2761 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/** - * @brief File containing WPA supplicant interface specific definitions for the - * Zephyr OS layer of the Wi-Fi driver. - */ -#include - -#include -#include - -#include "fmac_main.h" -#include "fmac_util.h" -#include "wifi_mgmt.h" -#include "wpa_supp_if.h" - -LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF700X_LOG_LEVEL); - -K_SEM_DEFINE(wait_for_event_sem, 0, 1); -K_SEM_DEFINE(wait_for_scan_resp_sem, 0, 1); -static K_MUTEX_DEFINE(mgmt_tx_lock); - -#define ACTION_FRAME_RESP_TIMEOUT_MS 5000 -#define SET_IFACE_EVENT_TIMEOUT_MS 5000 -#define CARR_ON_TIMEOUT_MS 5000 - -static int get_nrf_wifi_auth_type(int wpa_auth_alg) -{ - if (wpa_auth_alg & WPA_AUTH_ALG_OPEN) { - return NRF_WIFI_AUTHTYPE_OPEN_SYSTEM; - } - if (wpa_auth_alg & WPA_AUTH_ALG_SHARED) { - return NRF_WIFI_AUTHTYPE_SHARED_KEY; - } - if (wpa_auth_alg & WPA_AUTH_ALG_LEAP) { - return NRF_WIFI_AUTHTYPE_NETWORK_EAP; - } - if (wpa_auth_alg & WPA_AUTH_ALG_FT) { - return NRF_WIFI_AUTHTYPE_FT; - } - if (wpa_auth_alg & WPA_AUTH_ALG_SAE) { - return NRF_WIFI_AUTHTYPE_SAE; - } - - return NRF_WIFI_AUTHTYPE_MAX; -} - -static unsigned int wpa_alg_to_cipher_suite(enum wpa_alg alg, size_t key_len) -{ - switch (alg) { - case WPA_ALG_WEP: - if (key_len == 5) { - return RSN_CIPHER_SUITE_WEP40; - } - return RSN_CIPHER_SUITE_WEP104; - case WPA_ALG_TKIP: - return RSN_CIPHER_SUITE_TKIP; - case WPA_ALG_CCMP: - return RSN_CIPHER_SUITE_CCMP; - case WPA_ALG_GCMP: - return RSN_CIPHER_SUITE_GCMP; - case WPA_ALG_CCMP_256: - return RSN_CIPHER_SUITE_CCMP_256; - case WPA_ALG_GCMP_256: - return RSN_CIPHER_SUITE_GCMP_256; - case WPA_ALG_BIP_CMAC_128: - return RSN_CIPHER_SUITE_AES_128_CMAC; - case WPA_ALG_BIP_GMAC_128: - return RSN_CIPHER_SUITE_BIP_GMAC_128; - case WPA_ALG_BIP_GMAC_256: - return RSN_CIPHER_SUITE_BIP_GMAC_256; - case WPA_ALG_BIP_CMAC_256: - return RSN_CIPHER_SUITE_BIP_CMAC_256; - case WPA_ALG_SMS4: - return RSN_CIPHER_SUITE_SMS4; - case WPA_ALG_KRK: - return RSN_CIPHER_SUITE_KRK; - case WPA_ALG_NONE: - LOG_ERR("%s: Unexpected encryption algorithm %d", __func__, alg); - return 0; - } - - LOG_ERR("%s: Unsupported encryption algorithm %d", __func__, alg); - return 0; -} - -static enum chan_width drv2supp_chan_width(int width) -{ - switch (width) { - case NRF_WIFI_CHAN_WIDTH_20_NOHT: - return CHAN_WIDTH_20_NOHT; - case NRF_WIFI_CHAN_WIDTH_20: - return CHAN_WIDTH_20; - case NRF_WIFI_CHAN_WIDTH_40: - return CHAN_WIDTH_40; - case NRF_WIFI_CHAN_WIDTH_80: - return CHAN_WIDTH_80; - case NRF_WIFI_CHAN_WIDTH_80P80: - return CHAN_WIDTH_80P80; - case NRF_WIFI_CHAN_WIDTH_160: - return CHAN_WIDTH_160; - default: - break; - } - return CHAN_WIDTH_UNKNOWN; -} - -void nrf_wifi_wpa_supp_event_proc_scan_start(void *if_priv) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - - vif_ctx_zep = if_priv; - - if (vif_ctx_zep->supp_drv_if_ctx && vif_ctx_zep->supp_callbk_fns.scan_start) { - vif_ctx_zep->supp_callbk_fns.scan_start(vif_ctx_zep->supp_drv_if_ctx); - } -} - -void nrf_wifi_wpa_supp_event_proc_scan_done(void *if_priv, - struct nrf_wifi_umac_event_trigger_scan *scan_done_event, - unsigned int event_len, - int aborted) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - union wpa_event_data event; - struct scan_info *info = NULL; - - vif_ctx_zep = if_priv; - - memset(&event, 0, sizeof(event)); - - info = &event.scan_info; - - info->aborted = aborted; - info->external_scan = 0; - info->nl_scan_event = 1; - - if (vif_ctx_zep->supp_drv_if_ctx && - vif_ctx_zep->supp_callbk_fns.scan_done) { - vif_ctx_zep->supp_callbk_fns.scan_done(vif_ctx_zep->supp_drv_if_ctx, - &event); - } - k_work_cancel_delayable(&vif_ctx_zep->scan_timeout_work); - vif_ctx_zep->scan_in_progress = false; - k_sem_give(&wait_for_scan_resp_sem); -} - -void nrf_wifi_wpa_supp_event_proc_scan_res(void *if_priv, - struct nrf_wifi_umac_event_new_scan_results *scan_res, - unsigned int event_len, - bool more_res) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct wpa_scan_res *r = NULL; - const unsigned char *ie = NULL; - const unsigned char *beacon_ie = NULL; - unsigned int ie_len = 0; - unsigned int beacon_ie_len = 0; - unsigned char *pos = NULL; - - vif_ctx_zep = if_priv; - - if (scan_res->valid_fields & NRF_WIFI_EVENT_NEW_SCAN_RESULTS_IES_VALID) { - ie = scan_res->ies; - ie_len = scan_res->ies_len; - } - - if (scan_res->valid_fields & NRF_WIFI_EVENT_NEW_SCAN_RESULTS_BEACON_IES_VALID) { - beacon_ie = scan_res->ies + scan_res->ies_len; - beacon_ie_len = scan_res->beacon_ies_len; - } - - r = k_calloc(sizeof(*r) + ie_len + beacon_ie_len, sizeof(char)); - - if (!r) { - LOG_ERR("%s: Unable to allocate memory for scan result", __func__); - return; - } - - if (scan_res->valid_fields & NRF_WIFI_EVENT_NEW_SCAN_RESULTS_MAC_ADDR_VALID) { - memcpy(r->bssid, scan_res->mac_addr, ETH_ALEN); - } - - r->freq = scan_res->frequency; - - if (scan_res->valid_fields & NRF_WIFI_EVENT_NEW_SCAN_RESULTS_BEACON_INTERVAL_VALID) { - r->beacon_int = scan_res->beacon_interval; - } - - r->caps = scan_res->capability; - - r->flags |= WPA_SCAN_NOISE_INVALID; - - if (scan_res->signal.signal_type == NRF_WIFI_SIGNAL_TYPE_MBM) { - r->level = scan_res->signal.signal.mbm_signal; - r->level /= 100; /* mBm to dBm */ - r->flags |= (WPA_SCAN_LEVEL_DBM | WPA_SCAN_QUAL_INVALID); - } else if (scan_res->signal.signal_type == NRF_WIFI_SIGNAL_TYPE_UNSPEC) { - r->level = scan_res->signal.signal.unspec_signal; - r->flags |= WPA_SCAN_QUAL_INVALID; - } else { - r->flags |= (WPA_SCAN_LEVEL_INVALID | WPA_SCAN_QUAL_INVALID); - } - - if (scan_res->valid_fields & NRF_WIFI_EVENT_NEW_SCAN_RESULTS_IES_TSF_VALID) { - r->tsf = scan_res->ies_tsf; - } - - if (scan_res->valid_fields & NRF_WIFI_EVENT_NEW_SCAN_RESULTS_BEACON_IES_TSF_VALID) { - if (scan_res->beacon_ies_tsf > r->tsf) { - r->tsf = scan_res->beacon_ies_tsf; - } - } - - if (scan_res->seen_ms_ago) { - r->age = scan_res->seen_ms_ago; - } - - r->ie_len = ie_len; - - pos = (unsigned char *)(r + 1); - - if (ie) { - memcpy(pos, ie, ie_len); - - pos += ie_len; - } - - r->beacon_ie_len = beacon_ie_len; - - if (beacon_ie) { - memcpy(pos, beacon_ie, beacon_ie_len); - } - - if (scan_res->valid_fields & NRF_WIFI_EVENT_NEW_SCAN_RESULTS_STATUS_VALID) { - switch (scan_res->status) { - case NRF_WIFI_BSS_STATUS_ASSOCIATED: - r->flags |= WPA_SCAN_ASSOCIATED; - break; - default: - break; - } - } - - if (vif_ctx_zep->supp_drv_if_ctx && vif_ctx_zep->supp_callbk_fns.scan_res) { - vif_ctx_zep->supp_callbk_fns.scan_res(vif_ctx_zep->supp_drv_if_ctx, r, more_res); - } - - if (!more_res) { - vif_ctx_zep->scan_in_progress = false; - } - - k_free(r); -} - -void nrf_wifi_wpa_supp_event_proc_auth_resp(void *if_priv, - struct nrf_wifi_umac_event_mlme *auth_resp, - unsigned int event_len) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - union wpa_event_data event; - const struct ieee80211_mgmt *mgmt = NULL; - const unsigned char *frame = NULL; - unsigned int frame_len = 0; - - vif_ctx_zep = if_priv; - - frame = auth_resp->frame.frame; - frame_len = auth_resp->frame.frame_len; - mgmt = (const struct ieee80211_mgmt *)frame; - - if (frame_len < 4 + (2 * NRF_WIFI_ETH_ADDR_LEN)) { - LOG_ERR("%s: MLME event too short", __func__); - return; - } - - - if (frame_len < 24 + sizeof(mgmt->u.auth)) { - LOG_ERR("%s: Authentication response frame too short", __func__); - return; - } - - memset(&event, 0, sizeof(event)); - - memcpy(event.auth.peer, mgmt->sa, ETH_ALEN); - - event.auth.auth_type = le_to_host16(mgmt->u.auth.auth_alg); - - event.auth.auth_transaction = le_to_host16(mgmt->u.auth.auth_transaction); - - event.auth.status_code = le_to_host16(mgmt->u.auth.status_code); - - if (frame_len > 24 + sizeof(mgmt->u.auth)) { - event.auth.ies = mgmt->u.auth.variable; - event.auth.ies_len = (frame_len - 24 - sizeof(mgmt->u.auth)); - } - - if (vif_ctx_zep->supp_drv_if_ctx && vif_ctx_zep->supp_callbk_fns.auth_resp) { - vif_ctx_zep->supp_callbk_fns.auth_resp(vif_ctx_zep->supp_drv_if_ctx, &event); - } -} - -void nrf_wifi_wpa_supp_event_proc_assoc_resp(void *if_priv, - struct nrf_wifi_umac_event_mlme *assoc_resp, - unsigned int event_len) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - union wpa_event_data event; - const struct ieee80211_mgmt *mgmt = NULL; - const unsigned char *frame = NULL; - unsigned int frame_len = 0; - unsigned short status = WLAN_STATUS_UNSPECIFIED_FAILURE; - - vif_ctx_zep = if_priv; - - frame = assoc_resp->frame.frame; - frame_len = assoc_resp->frame.frame_len; - mgmt = (const struct ieee80211_mgmt *)frame; - - if (frame_len < 24 + sizeof(mgmt->u.assoc_resp)) { - LOG_ERR("%s: Association response frame too short", __func__); - return; - } - - memset(&event, 0, sizeof(event)); - - status = le_to_host16(mgmt->u.assoc_resp.status_code); - - if (status != WLAN_STATUS_SUCCESS) { - event.assoc_reject.bssid = mgmt->bssid; - - if (frame_len > 24 + sizeof(mgmt->u.assoc_resp)) { - event.assoc_reject.resp_ies = (unsigned char *)mgmt->u.assoc_resp.variable; - event.assoc_reject.resp_ies_len = - (frame_len - 24 - sizeof(mgmt->u.assoc_resp)); - } - - event.assoc_reject.status_code = status; - } else { - event.assoc_info.addr = mgmt->bssid; - event.assoc_info.resp_frame = frame; - event.assoc_info.resp_frame_len = frame_len; - event.assoc_info.freq = vif_ctx_zep->assoc_freq; - - if (frame_len > 24 + sizeof(mgmt->u.assoc_resp)) { - event.assoc_info.resp_ies = (unsigned char *)mgmt->u.assoc_resp.variable; - event.assoc_info.resp_ies_len = - (frame_len - 24 - sizeof(mgmt->u.assoc_resp)); - } - - if (assoc_resp->req_ie_len > 0) { - event.assoc_info.req_ies = (unsigned char *)assoc_resp->req_ie; - event.assoc_info.req_ies_len = assoc_resp->req_ie_len; - } - - } - - if (vif_ctx_zep->supp_drv_if_ctx && - vif_ctx_zep->supp_callbk_fns.assoc_resp) { - vif_ctx_zep->supp_callbk_fns.assoc_resp(vif_ctx_zep->supp_drv_if_ctx, - &event, status); - } -} - -void nrf_wifi_wpa_supp_event_proc_deauth(void *if_priv, - struct nrf_wifi_umac_event_mlme *deauth, - unsigned int event_len) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - union wpa_event_data event; - const struct ieee80211_mgmt *mgmt = NULL; - const unsigned char *frame = NULL; - unsigned int frame_len = 0; - - vif_ctx_zep = if_priv; - - frame = deauth->frame.frame; - frame_len = deauth->frame.frame_len; - mgmt = (const struct ieee80211_mgmt *)frame; - - if (frame_len < 24 + sizeof(mgmt->u.deauth)) { - LOG_ERR("%s: Deauthentication frame too short", __func__); - return; - } - - memset(&event, 0, sizeof(event)); - - event.deauth_info.addr = &mgmt->sa[0]; - event.deauth_info.reason_code = le_to_host16(mgmt->u.deauth.reason_code); - if (frame + frame_len > mgmt->u.deauth.variable) { - event.deauth_info.ie = mgmt->u.deauth.variable; - event.deauth_info.ie_len = (frame + frame_len - mgmt->u.deauth.variable); - } - - if (vif_ctx_zep->supp_drv_if_ctx && vif_ctx_zep->supp_callbk_fns.deauth) { - vif_ctx_zep->supp_callbk_fns.deauth(vif_ctx_zep->supp_drv_if_ctx, - &event, mgmt); - } -} - -void nrf_wifi_wpa_supp_event_proc_disassoc(void *if_priv, - struct nrf_wifi_umac_event_mlme *disassoc, - unsigned int event_len) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - union wpa_event_data event; - const struct ieee80211_mgmt *mgmt = NULL; - const unsigned char *frame = NULL; - unsigned int frame_len = 0; - - vif_ctx_zep = if_priv; - - frame = disassoc->frame.frame; - frame_len = disassoc->frame.frame_len; - mgmt = (const struct ieee80211_mgmt *)frame; - - if (frame_len < 24 + sizeof(mgmt->u.disassoc)) { - LOG_ERR("%s: Disassociation frame too short", __func__); - return; - } - - memset(&event, 0, sizeof(event)); - - event.disassoc_info.addr = &mgmt->sa[0]; - event.disassoc_info.reason_code = le_to_host16(mgmt->u.disassoc.reason_code); - if (frame + frame_len > mgmt->u.disassoc.variable) { - event.disassoc_info.ie = mgmt->u.disassoc.variable; - event.disassoc_info.ie_len = (frame + frame_len - mgmt->u.disassoc.variable); - } - - if (vif_ctx_zep->supp_drv_if_ctx && vif_ctx_zep->supp_callbk_fns.disassoc) { - vif_ctx_zep->supp_callbk_fns.disassoc(vif_ctx_zep->supp_drv_if_ctx, &event); - } - - (void) nrf_wifi_twt_teardown_flows(vif_ctx_zep, 0, NRF_WIFI_MAX_TWT_FLOWS); -} - -void *nrf_wifi_wpa_supp_dev_init(void *supp_drv_if_ctx, const char *iface_name, - struct zep_wpa_supp_dev_callbk_fns *supp_callbk_fns) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - const struct device *device = device_get_binding(iface_name); - - if (!device) { - LOG_ERR("%s: Interface %s not found", __func__, iface_name); - return NULL; - } - - vif_ctx_zep = device->data; - - if (!vif_ctx_zep || !vif_ctx_zep->rpu_ctx_zep) { - LOG_ERR("%s: Interface %s not properly initialized", __func__, iface_name); - return NULL; - } - - /* Needed to make sure that during initialization, commands like setting regdomain - * does not access it. - */ - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - vif_ctx_zep->supp_drv_if_ctx = supp_drv_if_ctx; - - memcpy(&vif_ctx_zep->supp_callbk_fns, supp_callbk_fns, - sizeof(vif_ctx_zep->supp_callbk_fns)); - - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return vif_ctx_zep; -} - -void nrf_wifi_wpa_supp_dev_deinit(void *if_priv) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - - vif_ctx_zep = if_priv; - - vif_ctx_zep->supp_drv_if_ctx = NULL; -} - -int nrf_wifi_wpa_supp_scan2(void *if_priv, struct wpa_driver_scan_params *params) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_umac_scan_info *scan_info = NULL; - int indx = 0; - int ret = -1; - int num_freqs = 0; - - if (!if_priv || !params) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep->rpu_ctx) { - LOG_ERR("%s: RPU context not initialized", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - if (vif_ctx_zep->scan_in_progress) { - LOG_ERR("%s: Scan already in progress", __func__); - ret = -EBUSY; - goto out; - } - - if (params->freqs) { - for (indx = 0; params->freqs[indx]; indx++) - num_freqs++; - } - - scan_info = k_calloc(sizeof(*scan_info) + (num_freqs * sizeof(unsigned int)), - sizeof(char)); - - if (!scan_info) { - LOG_ERR("%s: Unable to allocate memory for scan info", __func__); - ret = -ENOMEM; - goto out; - } - - memset(scan_info, 0x0, sizeof(*scan_info)); - - if (params->freqs) { - for (indx = 0; params->freqs[indx]; indx++) { - scan_info->scan_params.center_frequency[indx] = - params->freqs[indx]; - } - scan_info->scan_params.num_scan_channels = indx; - } - - if (params->filter_ssids) { - scan_info->scan_params.num_scan_ssids = params->num_filter_ssids; - - for (indx = 0; indx < params->num_filter_ssids; indx++) { - memcpy(scan_info->scan_params.scan_ssids[indx].nrf_wifi_ssid, - params->filter_ssids[indx].ssid, - params->filter_ssids[indx].ssid_len); - - scan_info->scan_params.scan_ssids[indx].nrf_wifi_ssid_len = - params->filter_ssids[indx].ssid_len; - } - } - - scan_info->scan_reason = SCAN_CONNECT; - - /* Copy extra_ies */ - if (params->extra_ies_len && params->extra_ies_len <= NRF_WIFI_MAX_IE_LEN) { - memcpy(scan_info->scan_params.ie.ie, params->extra_ies, params->extra_ies_len); - scan_info->scan_params.ie.ie_len = params->extra_ies_len; - } else if (params->extra_ies_len) { - LOG_ERR("%s: extra_ies_len %d is greater than max IE len %d", - __func__, params->extra_ies_len, NRF_WIFI_MAX_IE_LEN); - goto out; - } - - status = nrf_wifi_fmac_scan(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, scan_info); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: Scan trigger failed", __func__); - goto out; - } - - vif_ctx_zep->scan_type = SCAN_CONNECT; - vif_ctx_zep->scan_in_progress = true; - - k_work_schedule(&vif_ctx_zep->scan_timeout_work, - K_SECONDS(CONFIG_WIFI_NRF700X_SCAN_TIMEOUT_S)); - - ret = 0; -out: - if (scan_info) - k_free(scan_info); - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -int nrf_wifi_wpa_supp_scan_abort(void *if_priv) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - int sem_ret; - - vif_ctx_zep = if_priv; - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - return -1; - } - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return -1; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - if (!vif_ctx_zep->scan_in_progress) { - LOG_ERR("%s:Ignore scan abort, no scan in progress", __func__); - goto out; - } - - status = nrf_wifi_fmac_abort_scan(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_abort_scan failed", __func__); - goto out; - } - - k_sem_reset(&wait_for_scan_resp_sem); - sem_ret = k_sem_take(&wait_for_scan_resp_sem, K_MSEC(RPU_RESP_EVENT_TIMEOUT)); - if (sem_ret) { - LOG_ERR("%s: Timedout waiting for scan abort response, ret = %d", - __func__, sem_ret); - status = NRF_WIFI_STATUS_FAIL; - goto out; - } - -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return status; -} - -int nrf_wifi_wpa_supp_scan_results_get(void *if_priv) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - int ret = -1; - - if (!if_priv) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - status = nrf_wifi_fmac_scan_res_get(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, - SCAN_CONNECT); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_scan_res_get failed", __func__); - goto out; - } - - ret = 0; -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -int nrf_wifi_wpa_supp_deauthenticate(void *if_priv, const char *addr, unsigned short reason_code) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_umac_disconn_info deauth_info; - int ret = -1; - - if ((!if_priv) || (!addr)) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - memset(&deauth_info, 0, sizeof(deauth_info)); - - deauth_info.reason_code = reason_code; - - memcpy(deauth_info.mac_addr, addr, sizeof(deauth_info.mac_addr)); - - status = nrf_wifi_fmac_deauth(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, &deauth_info); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_deauth failed", __func__); - goto out; - } - - ret = nrf_wifi_twt_teardown_flows(vif_ctx_zep, 0, NRF_WIFI_MAX_TWT_FLOWS); -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -int nrf_wifi_wpa_supp_add_key(struct nrf_wifi_umac_key_info *key_info, enum wpa_alg alg, - int key_idx, - int defkey, const unsigned char *seq, size_t seq_len, - const unsigned char *key, size_t key_len) -{ - unsigned int suite = 0; - - suite = wpa_alg_to_cipher_suite(alg, key_len); - - if (!suite) { - return -1; - } - - if (defkey && alg == WPA_ALG_BIP_CMAC_128) { - key_info->nrf_wifi_flags = NRF_WIFI_KEY_DEFAULT_MGMT; - } else if (defkey) { - key_info->nrf_wifi_flags = NRF_WIFI_KEY_DEFAULT; - } - - key_info->key_idx = key_idx; - key_info->cipher_suite = suite; - - if (key && key_len) { - memcpy(key_info->key.nrf_wifi_key, key, key_len); - key_info->key.nrf_wifi_key_len = key_len; - } - if (seq && seq_len) { - memcpy(key_info->seq.nrf_wifi_seq, seq, seq_len); - key_info->seq.nrf_wifi_seq_len = seq_len; - } - - return 0; -} - -int nrf_wifi_wpa_supp_authenticate(void *if_priv, struct wpa_driver_auth_params *params, - struct wpa_bss *curr_bss) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_umac_auth_info auth_info; - int ret = -1; - int type; - int count = 0; - int max_ie_len = 0; - - if ((!if_priv) || (!params)) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - -#ifdef CONFIG_NRF700X_RAW_DATA_RX - if (vif_ctx_zep->if_type == NRF_WIFI_IFTYPE_MONITOR) { - LOG_ERR("%s: Interface is in Monitor mode - cannot connect to a BSS", __func__); - goto out; - } -#endif /* CONFIG_NRF700X_RAW_DATA_RX */ - - memset(&auth_info, 0, sizeof(auth_info)); - - - if (params->bssid) { - memcpy(auth_info.nrf_wifi_bssid, params->bssid, ETH_ALEN); - } - - if (params->freq) { - auth_info.frequency = params->freq; - } - - if (params->ssid) { - memcpy(auth_info.ssid.nrf_wifi_ssid, params->ssid, params->ssid_len); - - auth_info.ssid.nrf_wifi_ssid_len = params->ssid_len; - } - - if (params->ie) { - max_ie_len = (params->ie_len > NRF_WIFI_MAX_IE_LEN) ? - NRF_WIFI_MAX_IE_LEN : params->ie_len; - memcpy(&auth_info.ie.ie, params->ie, max_ie_len); - auth_info.ie.ie_len = max_ie_len; - } else { - auth_info.scan_width = 0; /* hard coded */ - auth_info.nrf_wifi_signal = curr_bss->level; - auth_info.capability = curr_bss->caps; - auth_info.beacon_interval = curr_bss->beacon_int; - auth_info.tsf = curr_bss->tsf; - auth_info.from_beacon = 0; /* hard coded */ - } - - if (params->auth_data) { - auth_info.sae.sae_data_len = params->auth_data_len; - - memcpy(auth_info.sae.sae_data, params->auth_data, params->auth_data_len); - } - - type = get_nrf_wifi_auth_type(params->auth_alg); - - if (type != NRF_WIFI_AUTHTYPE_MAX) { - auth_info.auth_type = type; - } - - if (type == NRF_WIFI_AUTHTYPE_SHARED_KEY) { - size_t key_len = params->wep_key_len[params->wep_tx_keyidx]; - struct nrf_wifi_umac_key_info *key_info = &auth_info.key_info; - - key_info->cipher_suite = wpa_alg_to_cipher_suite(params->auth_alg, key_len); - memcpy(key_info->key.nrf_wifi_key, - params->wep_key[params->wep_tx_keyidx], - key_len); - key_info->key.nrf_wifi_key_len = key_len; - key_info->valid_fields |= NRF_WIFI_KEY_VALID | NRF_WIFI_KEY_IDX_VALID | - NRF_WIFI_CIPHER_SUITE_VALID; - } - - if (params->local_state_change) { - auth_info.nrf_wifi_flags |= NRF_WIFI_CMD_AUTHENTICATE_LOCAL_STATE_CHANGE; - } - - status = nrf_wifi_fmac_auth(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, &auth_info); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: MLME command failed (auth): count=%d ret=%d", __func__, count, ret); - count++; - ret = -1; - } else { - LOG_DBG("%s:Authentication request sent successfully", __func__); - ret = 0; - } -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -int nrf_wifi_wpa_supp_associate(void *if_priv, struct wpa_driver_associate_params *params) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_umac_assoc_info assoc_info; - int ret = -1; - - if ((!if_priv) || (!params)) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - memset(&assoc_info, 0, sizeof(assoc_info)); - - if (params->bssid) { - memcpy(assoc_info.nrf_wifi_bssid, params->bssid, sizeof(assoc_info.nrf_wifi_bssid)); - } - - if (params->freq.freq) { - assoc_info.center_frequency = params->freq.freq; - vif_ctx_zep->assoc_freq = params->freq.freq; - } else { - vif_ctx_zep->assoc_freq = 0; - } - - if (params->prev_bssid) { - assoc_info.prev_bssid_flag = 1; - memcpy(assoc_info.prev_bssid, params->prev_bssid, ETH_ALEN); - } - - if (params->ssid) { - assoc_info.ssid.nrf_wifi_ssid_len = params->ssid_len; - - memcpy(assoc_info.ssid.nrf_wifi_ssid, params->ssid, params->ssid_len); - - } - - if (params->wpa_ie) { - assoc_info.wpa_ie.ie_len = params->wpa_ie_len; - memcpy(assoc_info.wpa_ie.ie, params->wpa_ie, params->wpa_ie_len); - } - - assoc_info.control_port = 1; - - if (params->mgmt_frame_protection == MGMT_FRAME_PROTECTION_REQUIRED) { - assoc_info.use_mfp = NRF_WIFI_MFP_REQUIRED; - } - - if (params->bss_max_idle_period) { - assoc_info.bss_max_idle_time = params->bss_max_idle_period; - } - - status = nrf_wifi_fmac_assoc(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, &assoc_info); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: MLME command failed (assoc)", __func__); - } else { - LOG_DBG("%s: Association request sent successfully", __func__); - ret = 0; - } - -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -int nrf_wifi_wpa_supp_set_key(void *if_priv, const unsigned char *ifname, enum wpa_alg alg, - const unsigned char *addr, int key_idx, int set_tx, - const unsigned char *seq, size_t seq_len, const unsigned char *key, - size_t key_len) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_umac_key_info key_info; - const unsigned char *mac_addr = NULL; - unsigned int suite; - int ret = -1; - - - if ((!if_priv) || (!ifname)) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep->rpu_ctx) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - /* Can happen in a positive case where "net if down" is completed, but WPA - * supplicant is still deleting keys. - */ - if (!rpu_ctx_zep->rpu_ctx) { - goto out; - } - - memset(&key_info, 0, sizeof(key_info)); - - if (alg != WPA_ALG_NONE) { - suite = wpa_alg_to_cipher_suite(alg, key_len); - - if (!suite) { - goto out; - } - - memcpy(key_info.key.nrf_wifi_key, key, key_len); - - key_info.key.nrf_wifi_key_len = key_len; - key_info.cipher_suite = suite; - - key_info.valid_fields |= (NRF_WIFI_CIPHER_SUITE_VALID | NRF_WIFI_KEY_VALID); - } - - if (seq && seq_len) { - memcpy(key_info.seq.nrf_wifi_seq, seq, seq_len); - - key_info.seq.nrf_wifi_seq_len = seq_len; - key_info.valid_fields |= NRF_WIFI_SEQ_VALID; - } - - - /* TODO: Implement/check set_tx */ - if (addr && !is_broadcast_ether_addr(addr)) { - mac_addr = addr; - key_info.key_type = NRF_WIFI_KEYTYPE_PAIRWISE; - key_info.valid_fields |= NRF_WIFI_KEY_TYPE_VALID; - } else if (addr && is_broadcast_ether_addr(addr)) { - mac_addr = NULL; - key_info.key_type = NRF_WIFI_KEYTYPE_GROUP; - key_info.valid_fields |= NRF_WIFI_KEY_TYPE_VALID; - key_info.nrf_wifi_flags |= NRF_WIFI_KEY_DEFAULT_TYPE_MULTICAST; - } - - key_info.key_idx = key_idx; - key_info.valid_fields |= NRF_WIFI_KEY_IDX_VALID; - - if (alg == WPA_ALG_NONE) { - status = nrf_wifi_fmac_del_key(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, - &key_info, mac_addr); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_del_key failed", __func__); - } else { - ret = 0; - } - } else { - status = nrf_wifi_fmac_add_key(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, - &key_info, mac_addr); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_add_key failed", __func__); - } else { - ret = 0; - } - } - - /* - * If we failed or don't need to set the default TX key (below), - * we're done here. - */ - if (ret || !set_tx || alg == WPA_ALG_NONE) { - goto out; - } - - - memset(&key_info, 0, sizeof(key_info)); - - key_info.key_idx = key_idx; - key_info.valid_fields |= NRF_WIFI_KEY_IDX_VALID; - - if (alg == WPA_ALG_BIP_CMAC_128 || alg == WPA_ALG_BIP_GMAC_128 || - alg == WPA_ALG_BIP_GMAC_256 || alg == WPA_ALG_BIP_CMAC_256) { - key_info.nrf_wifi_flags = NRF_WIFI_KEY_DEFAULT_MGMT; - } else { - key_info.nrf_wifi_flags = NRF_WIFI_KEY_DEFAULT; - } - - if (addr && is_broadcast_ether_addr(addr)) { - key_info.nrf_wifi_flags |= NRF_WIFI_KEY_DEFAULT_TYPE_MULTICAST; - } else if (addr) { - key_info.nrf_wifi_flags |= NRF_WIFI_KEY_DEFAULT_TYPE_UNICAST; - } - - status = nrf_wifi_fmac_set_key(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, &key_info); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_set_key failed", __func__); - ret = -1; - } else { - ret = 0; - } -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -int nrf_wifi_wpa_set_supp_port(void *if_priv, int authorized, char *bssid) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_umac_chg_sta_info chg_sta_info; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - int ret = -1; - - if (!if_priv || !bssid) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - if (vif_ctx_zep->if_op_state != NRF_WIFI_FMAC_IF_OP_STATE_UP) { - LOG_DBG("%s: Interface not UP, ignoring", __func__); - ret = 0; - goto out; - } - - memset(&chg_sta_info, 0x0, sizeof(chg_sta_info)); - - memcpy(chg_sta_info.mac_addr, bssid, ETH_ALEN); - - vif_ctx_zep->authorized = authorized; - - if (authorized) { - /* BIT(NL80211_STA_FLAG_AUTHORIZED) */ - chg_sta_info.sta_flags2.nrf_wifi_mask = 1 << 1; - /* BIT(NL80211_STA_FLAG_AUTHORIZED) */ - chg_sta_info.sta_flags2.nrf_wifi_set = 1 << 1; - } - - status = nrf_wifi_fmac_chg_sta(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, &chg_sta_info); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_chg_sta failed", __func__); - ret = -1; - goto out; - } - - ret = 0; -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -int nrf_wifi_wpa_supp_signal_poll(void *if_priv, struct wpa_signal_info *si, unsigned char *bssid) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - enum nrf_wifi_status ret = NRF_WIFI_STATUS_FAIL; - int sem_ret; - int rssi_record_elapsed_time_ms = 0; - - if (!if_priv || !si || !bssid) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - - vif_ctx_zep->signal_info = si; - - rssi_record_elapsed_time_ms = - nrf_wifi_osal_time_elapsed_us(vif_ctx_zep->rssi_record_timestamp_us) / 1000; - - if (rssi_record_elapsed_time_ms > CONFIG_NRF700X_RSSI_STALE_TIMEOUT_MS) { - ret = nrf_wifi_fmac_get_station(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, bssid); - if (ret != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: Failed to send get station info command", __func__); - goto out; - } - - sem_ret = k_sem_take(&wait_for_event_sem, K_MSEC(RPU_RESP_EVENT_TIMEOUT)); - if (sem_ret) { - LOG_ERR("%s: Failed to get station info, ret = %d", __func__, sem_ret); - ret = NRF_WIFI_STATUS_FAIL; - goto out; - } - } else { - si->current_signal = (int)vif_ctx_zep->rssi; - } - - ret = nrf_wifi_fmac_get_interface(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx); - if (ret != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: Failed to send get interface info command", __func__); - goto out; - } - - sem_ret = k_sem_take(&wait_for_event_sem, K_MSEC(RPU_RESP_EVENT_TIMEOUT)); - if (sem_ret) { - LOG_ERR("%s: Failed to get interface info, ret = %d", __func__, sem_ret); - ret = NRF_WIFI_STATUS_FAIL; - goto out; - } - vif_ctx_zep->signal_info->frequency = vif_ctx_zep->assoc_freq; -out: - vif_ctx_zep->signal_info = NULL; - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -void nrf_wifi_wpa_supp_event_proc_get_sta(void *if_priv, - struct nrf_wifi_umac_event_new_station *info, - unsigned int event_len) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct wpa_signal_info *signal_info = NULL; - - if (!if_priv || !info) { - LOG_ERR("%s: Invalid params", __func__); - goto out; - } - - vif_ctx_zep = if_priv; - if (!vif_ctx_zep) { - LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - goto out; - } - -#ifdef CONFIG_NRF700X_AP_MODE - vif_ctx_zep->inactive_time_sec = info->sta_info.inactive_time; -#endif /* CONFIG_NRF700X_AP_MODE */ - - signal_info = vif_ctx_zep->signal_info; - /* Semaphore timedout */ - if (!signal_info) { - goto out; - } - - if (info->sta_info.valid_fields & NRF_WIFI_STA_INFO_SIGNAL_VALID) { - signal_info->current_signal = info->sta_info.signal; - } else { - signal_info->current_signal = -WPA_INVALID_NOISE; - } - - if (info->sta_info.valid_fields & NRF_WIFI_STA_INFO_SIGNAL_AVG_VALID) { - signal_info->avg_signal = info->sta_info.signal_avg; - } else { - signal_info->avg_signal = -WPA_INVALID_NOISE; - } - - if (info->sta_info.valid_fields & NRF_WIFI_STA_INFO_RX_BEACON_SIGNAL_AVG_VALID) { - signal_info->avg_beacon_signal = info->sta_info.rx_beacon_signal_avg; - } else { - signal_info->avg_beacon_signal = -WPA_INVALID_NOISE; - } - - signal_info->current_txrate = 0; - - if (info->sta_info.valid_fields & NRF_WIFI_STA_INFO_TX_BITRATE_VALID) { - if (info->sta_info.tx_bitrate.valid_fields & NRF_WIFI_RATE_INFO_BITRATE_VALID) { - signal_info->current_txrate = info->sta_info.tx_bitrate.bitrate * 100; - } - } -out: - k_sem_give(&wait_for_event_sem); -} - -void nrf_wifi_wpa_supp_event_proc_get_if(void *if_priv, - struct nrf_wifi_interface_info *info, - unsigned int event_len) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_chan_definition *chan_def_info = NULL; - struct wpa_signal_info *signal_info = NULL; - - if (!if_priv || !info) { - LOG_ERR("%s: Invalid params", __func__); - k_sem_give(&wait_for_event_sem); - return; - } - - vif_ctx_zep = if_priv; - signal_info = vif_ctx_zep->signal_info; - - /* Semaphore timedout */ - if (!signal_info) { - LOG_DBG("%s: Get interface Semaphore timedout", __func__); - return; - } - - chan_def_info = (struct nrf_wifi_chan_definition *)(&info->chan_def); - signal_info->chanwidth = drv2supp_chan_width(chan_def_info->width); - signal_info->center_frq1 = chan_def_info->center_frequency1; - signal_info->center_frq2 = chan_def_info->center_frequency2; - - k_sem_give(&wait_for_event_sem); -} - -void nrf_wifi_wpa_supp_event_mgmt_tx_status(void *if_priv, - struct nrf_wifi_umac_event_mlme *mlme_event, - unsigned int event_len) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - bool acked = false; - - if (!if_priv) { - LOG_ERR("%s: Missing interface context", __func__); - return; - } - - vif_ctx_zep = if_priv; - - if (!mlme_event) { - LOG_ERR("%s: Missing MLME event data", __func__); - return; - } - - acked = mlme_event->nrf_wifi_flags & NRF_WIFI_EVENT_MLME_ACK ? true : false; - LOG_DBG("%s: Mgmt frame %llx tx status: %s", - __func__, mlme_event->cookie, acked ? "ACK" : "NOACK"); - - if (vif_ctx_zep->supp_drv_if_ctx && - vif_ctx_zep->supp_callbk_fns.mgmt_tx_status) { - vif_ctx_zep->supp_callbk_fns.mgmt_tx_status(vif_ctx_zep->supp_drv_if_ctx, - mlme_event->frame.frame, - mlme_event->frame.frame_len, - acked); - } -} - -void nrf_wifi_wpa_supp_event_proc_unprot_mgmt(void *if_priv, - struct nrf_wifi_umac_event_mlme *unprot_mgmt, - unsigned int event_len) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - union wpa_event_data event; - const struct ieee80211_mgmt *mgmt = NULL; - const unsigned char *frame = NULL; - unsigned int frame_len = 0; - int cmd_evnt = 0; - - vif_ctx_zep = if_priv; - - frame = unprot_mgmt->frame.frame; - frame_len = unprot_mgmt->frame.frame_len; - - mgmt = (const struct ieee80211_mgmt *)frame; - cmd_evnt = ((struct nrf_wifi_umac_hdr *)unprot_mgmt)->cmd_evnt; - - if (frame_len < 24 + sizeof(mgmt->u.deauth)) { - LOG_ERR("%s: Unprotected mgmt frame too short", __func__); - return; - } - - memset(&event, 0, sizeof(event)); - - event.unprot_deauth.sa = &mgmt->sa[0]; - event.unprot_deauth.da = &mgmt->da[0]; - - if (cmd_evnt == NRF_WIFI_UMAC_EVENT_UNPROT_DEAUTHENTICATE) { - event.unprot_deauth.reason_code = le_to_host16(mgmt->u.deauth.reason_code); - if (vif_ctx_zep->supp_drv_if_ctx && vif_ctx_zep->supp_callbk_fns.unprot_deauth) { - vif_ctx_zep->supp_callbk_fns.unprot_deauth(vif_ctx_zep->supp_drv_if_ctx, - &event); - } - } else if (cmd_evnt == NRF_WIFI_UMAC_EVENT_UNPROT_DISASSOCIATE) { - event.unprot_disassoc.reason_code = le_to_host16(mgmt->u.deauth.reason_code); - if (vif_ctx_zep->supp_drv_if_ctx && vif_ctx_zep->supp_callbk_fns.unprot_disassoc) { - vif_ctx_zep->supp_callbk_fns.unprot_disassoc(vif_ctx_zep->supp_drv_if_ctx, - &event); - } - } -} - -int nrf_wifi_nl80211_send_mlme(void *if_priv, const u8 *data, - size_t data_len, int noack, - unsigned int freq, int no_cck, - int offchanok, - unsigned int wait_time, - int cookie) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_umac_mgmt_tx_info *mgmt_tx_info = NULL; - unsigned int timeout = 0; - - if (!if_priv || !data) { - LOG_ERR("%s: Invalid params", __func__); - return -1; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return -1; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - k_mutex_lock(&mgmt_tx_lock, K_FOREVER); - - mgmt_tx_info = k_calloc(sizeof(*mgmt_tx_info), sizeof(char)); - - if (!mgmt_tx_info) { - LOG_ERR("%s: Unable to allocate memory", __func__); - goto out; - } - - if (offchanok) - mgmt_tx_info->nrf_wifi_flags |= NRF_WIFI_CMD_FRAME_OFFCHANNEL_TX_OK; - - if (noack) - mgmt_tx_info->nrf_wifi_flags |= NRF_WIFI_CMD_FRAME_DONT_WAIT_FOR_ACK; - - if (no_cck) - mgmt_tx_info->nrf_wifi_flags |= NRF_WIFI_CMD_FRAME_TX_NO_CCK_RATE; - - if (freq) - mgmt_tx_info->frequency = freq; - - if (wait_time) - mgmt_tx_info->dur = wait_time; - - if (data_len) { - memcpy(mgmt_tx_info->frame.frame, data, data_len); - mgmt_tx_info->frame.frame_len = data_len; - } - - mgmt_tx_info->freq_params.frequency = freq; - mgmt_tx_info->freq_params.channel_width = NRF_WIFI_CHAN_WIDTH_20; - mgmt_tx_info->freq_params.center_frequency1 = freq; - mgmt_tx_info->freq_params.center_frequency2 = 0; - mgmt_tx_info->freq_params.channel_type = NRF_WIFI_CHAN_HT20; - - /* Going to RPU */ - mgmt_tx_info->host_cookie = cookie; - vif_ctx_zep->cookie_resp_received = false; - - LOG_DBG("%s: Sending frame to RPU: cookie=%d wait_time=%d no_ack=%d", __func__, - cookie, wait_time, noack); - status = nrf_wifi_fmac_mgmt_tx(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - mgmt_tx_info); - - if (status == NRF_WIFI_STATUS_FAIL) { - LOG_ERR("%s: nrf_wifi_fmac_mgmt_tx failed", __func__); - goto out; - } - - /* Both are needed as we use this to send_action where noack is hardcoded - * to 0 always. - */ - if (wait_time || !noack) { - if (!noack && !wait_time) { - wait_time = ACTION_FRAME_RESP_TIMEOUT_MS; - } - - while (!vif_ctx_zep->cookie_resp_received && - timeout++ < wait_time) { - k_sleep(K_MSEC(1)); - } - - if (!vif_ctx_zep->cookie_resp_received) { - LOG_ERR("%s: cookie response not received (%dms)", __func__, - timeout); - status = NRF_WIFI_STATUS_FAIL; - goto out; - } - status = NRF_WIFI_STATUS_SUCCESS; - } - -out: - if (mgmt_tx_info) - k_free(mgmt_tx_info); - k_mutex_unlock(&mgmt_tx_lock); - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return status; -} - -enum nrf_wifi_status nrf_wifi_parse_sband( - struct nrf_wifi_event_supported_band *event, - struct wpa_supp_event_supported_band *band - ) -{ - int count; - - if (event && (event->nrf_wifi_n_bitrates == 0 || event->nrf_wifi_n_channels == 0)) { - return NRF_WIFI_STATUS_FAIL; - } - memset(band, 0, sizeof(*band)); - - band->wpa_supp_n_channels = event->nrf_wifi_n_channels; - band->wpa_supp_n_bitrates = event->nrf_wifi_n_bitrates; - - for (count = 0; count < band->wpa_supp_n_channels; count++) { - struct wpa_supp_event_channel *chan = &band->channels[count]; - - if (count >= WPA_SUPP_SBAND_MAX_CHANNELS) { - LOG_ERR("%s: Failed to add channel", __func__); - break; - } - - chan->wpa_supp_flags = event->channels[count].nrf_wifi_flags; - chan->wpa_supp_max_power = event->channels[count].nrf_wifi_max_power; - chan->wpa_supp_time = event->channels[count].nrf_wifi_time; - chan->dfs_cac_msec = event->channels[count].dfs_cac_msec; - chan->ch_valid = event->channels[count].ch_valid; - chan->center_frequency = event->channels[count].center_frequency; - chan->dfs_state = event->channels[count].dfs_state; - } - - for (count = 0; count < band->wpa_supp_n_bitrates; count++) { - struct wpa_supp_event_rate *rate = &band->bitrates[count]; - - if (count >= WPA_SUPP_SBAND_MAX_RATES) { - LOG_ERR("%s: Failed to add bitrate", __func__); - break; - } - - rate->wpa_supp_flags = event->bitrates[count].nrf_wifi_flags; - rate->wpa_supp_bitrate = event->bitrates[count].nrf_wifi_bitrate; - } - - band->ht_cap.wpa_supp_ht_supported = event->ht_cap.nrf_wifi_ht_supported; - band->ht_cap.wpa_supp_cap = event->ht_cap.nrf_wifi_cap; - band->ht_cap.mcs.wpa_supp_rx_highest = event->ht_cap.mcs.nrf_wifi_rx_highest; - - for (count = 0; count < WPA_SUPP_HT_MCS_MASK_LEN; count++) { - band->ht_cap.mcs.wpa_supp_rx_mask[count] = - event->ht_cap.mcs.nrf_wifi_rx_mask[count]; - } - - band->ht_cap.mcs.wpa_supp_tx_params = event->ht_cap.mcs.nrf_wifi_tx_params; - - for (count = 0; count < NRF_WIFI_HT_MCS_RES_LEN; count++) { - - if (count >= WPA_SUPP_HT_MCS_RES_LEN) { - LOG_ERR("%s: Failed to add reserved bytes", __func__); - break; - } - - band->ht_cap.mcs.wpa_supp_reserved[count] = - event->ht_cap.mcs.nrf_wifi_reserved[count]; - } - - band->ht_cap.wpa_supp_ampdu_factor = event->ht_cap.nrf_wifi_ampdu_factor; - band->ht_cap.wpa_supp_ampdu_density = event->ht_cap.nrf_wifi_ampdu_density; - - band->vht_cap.wpa_supp_vht_supported = event->vht_cap.nrf_wifi_vht_supported; - band->vht_cap.wpa_supp_cap = event->vht_cap.nrf_wifi_cap; - - band->vht_cap.vht_mcs.rx_mcs_map = event->vht_cap.vht_mcs.rx_mcs_map; - band->vht_cap.vht_mcs.rx_highest = event->vht_cap.vht_mcs.rx_highest; - band->vht_cap.vht_mcs.tx_mcs_map = event->vht_cap.vht_mcs.tx_mcs_map; - band->vht_cap.vht_mcs.tx_highest = event->vht_cap.vht_mcs.tx_highest; - - band->band = event->band; - - return WLAN_STATUS_SUCCESS; -} - -void nrf_wifi_wpa_supp_event_get_wiphy(void *if_priv, - struct nrf_wifi_event_get_wiphy *wiphy_info, - unsigned int event_len) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct wpa_supp_event_supported_band band; - - if (!if_priv || !wiphy_info || !event_len) { - LOG_ERR("%s: Invalid parameters", __func__); - return; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - - memset(&band, 0, sizeof(band)); - - for (int i = 0; i < NRF_WIFI_EVENT_GET_WIPHY_NUM_BANDS; i++) { - if (nrf_wifi_parse_sband(&wiphy_info->sband[i], &band) != WLAN_STATUS_SUCCESS) { - continue; - } - if (vif_ctx_zep->supp_drv_if_ctx && vif_ctx_zep->supp_callbk_fns.get_wiphy_res) { - vif_ctx_zep->supp_callbk_fns.get_wiphy_res(vif_ctx_zep->supp_drv_if_ctx, - &band); - } - } - - if ((wiphy_info->params_valid & NRF_WIFI_GET_WIPHY_VALID_EXTENDED_CAPABILITIES) && - rpu_ctx_zep->extended_capa == NULL) { - - rpu_ctx_zep->extended_capa = k_malloc(wiphy_info->extended_capabilities_len); - - if (rpu_ctx_zep->extended_capa) { - memcpy(rpu_ctx_zep->extended_capa, wiphy_info->extended_capabilities, - wiphy_info->extended_capabilities_len); - } - - rpu_ctx_zep->extended_capa_mask = k_malloc(wiphy_info->extended_capabilities_len); - - if (rpu_ctx_zep->extended_capa_mask) { - memcpy(rpu_ctx_zep->extended_capa_mask, - wiphy_info->extended_capabilities_mask, - wiphy_info->extended_capabilities_len); - } else { - free(rpu_ctx_zep->extended_capa); - rpu_ctx_zep->extended_capa = NULL; - rpu_ctx_zep->extended_capa_len = 0; - } - } - - if (vif_ctx_zep->supp_drv_if_ctx && vif_ctx_zep->supp_callbk_fns.get_wiphy_res) { - vif_ctx_zep->supp_callbk_fns.get_wiphy_res(vif_ctx_zep->supp_drv_if_ctx, NULL); - } -} - -int nrf_wifi_supp_get_wiphy(void *if_priv) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - - if (!if_priv) { - LOG_ERR("%s: Missing interface context", __func__); - return -1; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return -1; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - status = nrf_wifi_fmac_get_wiphy(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_get_wiphy failed", __func__); - goto out; - } -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return status; -} - -int nrf_wifi_supp_register_frame(void *if_priv, - u16 type, const u8 *match, size_t match_len, - bool multicast) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_umac_mgmt_frame_info frame_info; - - if (!if_priv || !match || !match_len) { - LOG_ERR("%s: Invalid parameters", __func__); - return -1; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return -1; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - memset(&frame_info, 0, sizeof(frame_info)); - - frame_info.frame_type = type; - frame_info.frame_match.frame_match_len = match_len; - memcpy(frame_info.frame_match.frame_match, match, match_len); - - status = nrf_wifi_fmac_register_frame(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, - &frame_info); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_register_frame failed", __func__); - goto out; - } -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return status; -} - -void nrf_wifi_wpa_supp_event_mgmt_rx_callbk_fn(void *if_priv, - struct nrf_wifi_umac_event_mlme *mlme_event, - unsigned int event_len) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - - if (!if_priv) { - LOG_ERR("%s: Missing interface context", __func__); - return; - } - - vif_ctx_zep = if_priv; - - if (!mlme_event || !event_len) { - LOG_ERR("%s: Missing MLME event data", __func__); - return; - } - - if (vif_ctx_zep->supp_drv_if_ctx && vif_ctx_zep->supp_callbk_fns.mgmt_rx) { - vif_ctx_zep->supp_callbk_fns.mgmt_rx(vif_ctx_zep->supp_drv_if_ctx, - mlme_event->frame.frame, - mlme_event->frame.frame_len, - mlme_event->frequency, - mlme_event->rx_signal_dbm); - } -} - -int nrf_wifi_supp_get_capa(void *if_priv, struct wpa_driver_capa *capa) -{ - enum nrf_wifi_status status = NRF_WIFI_STATUS_SUCCESS; - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - - if (!if_priv || !capa) { - LOG_ERR("%s: Invalid parameters", __func__); - return -1; - } - - memset(capa, 0, sizeof(*capa)); - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return -1; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - /* TODO: Get these from RPU*/ - /* Use SME */ - capa->flags = 0; - capa->flags |= WPA_DRIVER_FLAGS_SME; - capa->flags |= WPA_DRIVER_FLAGS_SAE; - capa->flags |= WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE; - capa->rrm_flags |= WPA_DRIVER_FLAGS_SUPPORT_RRM; - capa->rrm_flags |= WPA_DRIVER_FLAGS_SUPPORT_BEACON_REPORT; - if (IS_ENABLED(CONFIG_NRF700X_AP_MODE)) { - capa->flags |= WPA_DRIVER_FLAGS_AP; - } - - capa->enc |= WPA_DRIVER_CAPA_ENC_WEP40 | - WPA_DRIVER_CAPA_ENC_WEP104 | - WPA_DRIVER_CAPA_ENC_TKIP | - WPA_DRIVER_CAPA_ENC_CCMP | - WPA_DRIVER_CAPA_ENC_CCMP | - WPA_DRIVER_CAPA_ENC_CCMP_256 | - WPA_DRIVER_CAPA_ENC_GCMP_256; - - if (rpu_ctx_zep->extended_capa && rpu_ctx_zep->extended_capa_mask) { - capa->extended_capa = rpu_ctx_zep->extended_capa; - capa->extended_capa_mask = rpu_ctx_zep->extended_capa_mask; - capa->extended_capa_len = rpu_ctx_zep->extended_capa_len; - } -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return status; -} - - -void nrf_wifi_wpa_supp_event_mac_chgd(void *if_priv) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - - if (!if_priv) { - LOG_ERR("%s: Invalid parameters", __func__); - return; - } - - vif_ctx_zep = if_priv; - - if (vif_ctx_zep->supp_drv_if_ctx && vif_ctx_zep->supp_callbk_fns.mac_changed) { - vif_ctx_zep->supp_callbk_fns.mac_changed(vif_ctx_zep->supp_drv_if_ctx); - } - -} - - -int nrf_wifi_supp_get_conn_info(void *if_priv, struct wpa_conn_info *info) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; - enum nrf_wifi_status ret = NRF_WIFI_STATUS_FAIL; - int sem_ret; - - if (!if_priv || !info) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; - - vif_ctx_zep->conn_info = info; - ret = nrf_wifi_fmac_get_conn_info(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx); - if (ret != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_get_conn_info failed", __func__); - goto out; - } - - sem_ret = k_sem_take(&wait_for_event_sem, K_MSEC(RPU_RESP_EVENT_TIMEOUT)); - if (sem_ret) { - LOG_ERR("%s: Timeout: failed to get connection info, ret = %d", __func__, sem_ret); - ret = NRF_WIFI_STATUS_FAIL; - goto out; - } - -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - - -void nrf_wifi_supp_event_proc_get_conn_info(void *if_priv, - struct nrf_wifi_umac_event_conn_info *info, - unsigned int event_len) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct wpa_conn_info *conn_info = NULL; - - if (!if_priv || !info) { - LOG_ERR("%s: Invalid params", __func__); - k_sem_give(&wait_for_event_sem); - return; - } - vif_ctx_zep = if_priv; - conn_info = vif_ctx_zep->conn_info; - - conn_info->beacon_interval = info->beacon_interval; - conn_info->dtim_period = info->dtim_interval; - conn_info->twt_capable = info->twt_capable; - k_sem_give(&wait_for_event_sem); -} - -#ifdef CONFIG_NRF700X_AP_MODE -static int nrf_wifi_vif_state_change(struct nrf_wifi_vif_ctx_zep *vif_ctx_zep, - enum nrf_wifi_fmac_if_op_state state) -{ - struct nrf_wifi_umac_chg_vif_state_info vif_state_info = {0}; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - unsigned int timeout = 0; - struct nrf_wifi_fmac_vif_ctx *vif_ctx = NULL; - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_fmac_dev_ctx_def *def_dev_ctx = NULL; - int ret = -1; - - if (!vif_ctx_zep) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - def_dev_ctx = wifi_dev_priv(rpu_ctx_zep->rpu_ctx); - vif_ctx = def_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx]; - - vif_state_info.state = state; - vif_state_info.if_index = vif_ctx_zep->vif_idx; - vif_ctx->ifflags = false; - status = nrf_wifi_fmac_chg_vif_state(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - &vif_state_info); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_chg_vif_state failed", - __func__); - goto out; - } - - while (!vif_ctx->ifflags && timeout++ < SET_IFACE_EVENT_TIMEOUT_MS) { - k_sleep(K_MSEC(1)); - } - - if (!vif_ctx->ifflags) { - LOG_ERR("%s: set interface state event not received (%dms)", __func__, timeout); - goto out; - } - ret = 0; -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -static int nrf_wifi_iftype_change(struct nrf_wifi_vif_ctx_zep *vif_ctx_zep, int iftype) -{ - struct nrf_wifi_umac_chg_vif_attr_info chg_vif_info = {0}; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - int ret = -1; - unsigned int timeout = 0; - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - - if (!vif_ctx_zep) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - ret = nrf_wifi_vif_state_change(vif_ctx_zep, NRF_WIFI_FMAC_IF_OP_STATE_DOWN); - if (ret) { - LOG_ERR("%s: Failed to set interface down", __func__); - goto out; - } - - chg_vif_info.iftype = iftype; - vif_ctx_zep->set_if_event_received = false; - vif_ctx_zep->set_if_status = 0; - status = nrf_wifi_fmac_chg_vif(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, &chg_vif_info); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_chg_vif failed", __func__); - goto out; - } - - while (!vif_ctx_zep->set_if_event_received && - timeout++ < SET_IFACE_EVENT_TIMEOUT_MS) { - k_sleep(K_MSEC(1)); - } - - if (!vif_ctx_zep->set_if_event_received) { - LOG_ERR("%s: set interface event not received (%dms)", __func__, timeout); - goto out; - } - - if (vif_ctx_zep->set_if_status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: set interface failed: %d", __func__, vif_ctx_zep->set_if_status); - goto out; - } - - ret = nrf_wifi_vif_state_change(vif_ctx_zep, NRF_WIFI_FMAC_IF_OP_STATE_UP); - if (ret) { - LOG_ERR("%s: Failed to set interface up", __func__); - goto out; - } - ret = 0; -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -static int nrf_wifi_wait_for_carrier_status(struct nrf_wifi_vif_ctx_zep *vif_ctx_zep, - enum nrf_wifi_fmac_if_carr_state carrier_status) -{ - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - int ret = -1; - unsigned int timeout = 0; - - if (!vif_ctx_zep) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - while (vif_ctx_zep->if_carr_state != carrier_status && - timeout++ < CARR_ON_TIMEOUT_MS) { - k_sleep(K_MSEC(1)); - } - - if (vif_ctx_zep->if_carr_state != carrier_status) { - LOG_ERR("%s: Carrier %s event not received in %dms", __func__, - carrier_status == NRF_WIFI_FMAC_IF_CARR_STATE_ON ? "ON" : "OFF", - timeout); - goto out; - } - - ret = 0; -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -int nrf_wifi_wpa_supp_init_ap(void *if_priv, struct wpa_driver_associate_params *params) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - - int ret = -1; - - if (!if_priv || !params) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - - if (params->mode != IEEE80211_MODE_AP) { - LOG_ERR("%s: Invalid mode", __func__); - return ret; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - ret = nrf_wifi_iftype_change(vif_ctx_zep, NRF_WIFI_IFTYPE_AP); - if (ret) { - LOG_ERR("%s: Failed to set interface type to AP: %d", __func__, ret); - goto out; - } - -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -static int wpas_cipher_to_nrf(int cipher) -{ - switch (cipher) { - case WPA_CIPHER_NONE: - return 0; - case WPA_CIPHER_WEP40: - return NRF_WIFI_FMAC_CIPHER_SUITE_WEP40; - case WPA_CIPHER_WEP104: - return NRF_WIFI_FMAC_CIPHER_SUITE_WEP104; - case WPA_CIPHER_TKIP: - return NRF_WIFI_FMAC_CIPHER_SUITE_TKIP; - case WPA_CIPHER_CCMP: - return NRF_WIFI_FMAC_CIPHER_SUITE_CCMP; - case WPA_CIPHER_CCMP_256: - return NRF_WIFI_FMAC_CIPHER_SUITE_CCMP_256; - default: - return -1; - } -} - -static int nrf_wifi_set_beacon_data(const struct wpa_driver_ap_params *params, - struct nrf_wifi_beacon_data *beacon_data) -{ - int ret = -1; - - if (params->head_len > ARRAY_SIZE(beacon_data->head)) { - LOG_ERR("%s: head_len too big", __func__); - goto out; - } - - if (params->tail_len > ARRAY_SIZE(beacon_data->tail)) { - LOG_ERR("%s: tail_len too big", __func__); - goto out; - } - - if (params->proberesp_len > ARRAY_SIZE(beacon_data->probe_resp)) { - LOG_ERR("%s: proberesp_len too big", __func__); - goto out; - } - - beacon_data->head_len = params->head_len; - beacon_data->tail_len = params->tail_len; - beacon_data->probe_resp_len = params->proberesp_len; - - if (params->head_len) { - memcpy(&beacon_data->head, params->head, - params->head_len); - } - - if (params->tail_len) { - memcpy(&beacon_data->tail, params->tail, - params->tail_len); - } - - if (params->proberesp_len) { - memcpy(&beacon_data->probe_resp, params->proberesp_ies, - params->proberesp_len); - } - - ret = 0; -out: - return ret; -} - -int nrf_wifi_supp_register_mgmt_frame(void *if_priv, - u16 frame_type, size_t match_len, const u8 *match) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - struct nrf_wifi_umac_mgmt_frame_info mgmt_frame_info = {0}; - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - int ret = -1; - - if (!if_priv || (match_len && !match)) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - mgmt_frame_info.frame_type = frame_type; - mgmt_frame_info.frame_match.frame_match_len = match_len; - if (match_len >= NRF_WIFI_FRAME_MATCH_MAX_LEN) { - LOG_ERR("%s: match_len too big: %d (max %d)", __func__, match_len, - NRF_WIFI_FRAME_MATCH_MAX_LEN); - goto out; - } - memcpy(mgmt_frame_info.frame_match.frame_match, match, match_len); - - status = nrf_wifi_fmac_mgmt_frame_reg(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - &mgmt_frame_info); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_mgmt_frame_reg failed", __func__); - goto out; - } - - ret = 0; -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -/* As per current design default is always STA */ -static int is_ap_dynamic_iface(struct nrf_wifi_vif_ctx_zep *vif_ctx_zep) -{ - return (vif_ctx_zep->vif_idx != 0); -} - -static int nrf_wifi_set_bss(struct nrf_wifi_vif_ctx_zep *vif_ctx_zep, - struct wpa_driver_ap_params *params) -{ - struct nrf_wifi_umac_bss_info bss_info = {0}; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - int ret = -1; - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - int i; - - if (!vif_ctx_zep || !params) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - if (params->basic_rates) { - for (i = 0; params->basic_rates[i] != -1; i++) { - if (i >= ARRAY_SIZE(bss_info.basic_rates)) { - LOG_ERR("%s: basic_rates too big: %d (max %d)", __func__, i, - ARRAY_SIZE(bss_info.basic_rates)); - goto out; - } - bss_info.basic_rates[i] = params->basic_rates[i]; - } - bss_info.num_basic_rates = i; - } - bss_info.p2p_go_ctwindow = params->p2p_go_ctwindow; - bss_info.ht_opmode = params->ht_opmode; - bss_info.nrf_wifi_cts = params->cts_protect; - bss_info.preamble = params->preamble; - bss_info.nrf_wifi_slot = params->short_slot_time; - bss_info.ap_isolate = params->isolate; - - status = nrf_wifi_fmac_set_bss(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, &bss_info); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_set_bss failed", __func__); - goto out; - } - - ret = 0; -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - - -static enum nrf_wifi_chan_width wpa_supp_chan_width_to_nrf(enum hostapd_hw_mode mode, - int bandwidth, int cfreq1, int cfreq2) -{ - switch (bandwidth) { - case 20: - if (mode == HOSTAPD_MODE_IEEE80211B) { - return NRF_WIFI_CHAN_WIDTH_20_NOHT; - } else { - return NRF_WIFI_CHAN_WIDTH_20; - }; - case 40: - return NRF_WIFI_CHAN_WIDTH_40; - case 80: - if (cfreq2) { - return NRF_WIFI_CHAN_WIDTH_80P80; - } else { - return NRF_WIFI_CHAN_WIDTH_80; - } - case 160: - return NRF_WIFI_CHAN_WIDTH_160; - }; - - return NRF_WIFI_CHAN_WIDTH_20; -} - -int nrf_wifi_wpa_supp_start_ap(void *if_priv, struct wpa_driver_ap_params *params) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - int ret = -1; - struct nrf_wifi_umac_start_ap_info start_ap_info = {0}; - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - int ch_width = 0; - - if (!if_priv || !params) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - nrf_wifi_set_beacon_data(params, &start_ap_info.beacon_data); - start_ap_info.beacon_interval = params->beacon_int; - start_ap_info.dtim_period = params->dtim_period; - start_ap_info.ssid.nrf_wifi_ssid_len = params->ssid_len; - memcpy(start_ap_info.ssid.nrf_wifi_ssid, params->ssid, params->ssid_len); - for (int i = 0; i < 32; i++) { - if ((params->pairwise_ciphers & BIT(i)) && - start_ap_info.connect_common_info.num_cipher_suites_pairwise < 7) { - if (wpas_cipher_to_nrf(i) < 0) { - LOG_DBG("%s: Unsupported cipher %d ignored", __func__, i); - continue; - } - start_ap_info.connect_common_info.cipher_suites_pairwise[i] = - wpas_cipher_to_nrf(i); - start_ap_info.connect_common_info.num_cipher_suites_pairwise++; - } - } - - ch_width = wpa_supp_chan_width_to_nrf(params->freq->mode, params->freq->bandwidth, - params->freq->center_freq1, params->freq->center_freq2); - - start_ap_info.freq_params.frequency = params->freq->freq; - start_ap_info.freq_params.channel_width = ch_width; - start_ap_info.freq_params.center_frequency1 = params->freq->center_freq1; - start_ap_info.freq_params.center_frequency2 = params->freq->center_freq2; - start_ap_info.freq_params.channel_type = params->freq->ht_enabled ? NRF_WIFI_CHAN_HT20 : - NRF_WIFI_CHAN_NO_HT; - start_ap_info.freq_params.valid_fields = NRF_WIFI_SET_FREQ_PARAMS_FREQ_VALID | - NRF_WIFI_SET_FREQ_PARAMS_CHANNEL_WIDTH_VALID | - NRF_WIFI_SET_FREQ_PARAMS_CENTER_FREQ1_VALID | - NRF_WIFI_SET_FREQ_PARAMS_CENTER_FREQ2_VALID | - NRF_WIFI_SET_FREQ_PARAMS_CHANNEL_TYPE_VALID; - - vif_ctx_zep->if_carr_state = NRF_WIFI_FMAC_IF_CARR_STATE_OFF; - status = nrf_wifi_fmac_start_ap(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, &start_ap_info); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_start_ap failed", __func__); - goto out; - } - - ret = nrf_wifi_wait_for_carrier_status(vif_ctx_zep, NRF_WIFI_FMAC_IF_CARR_STATE_ON); - if (ret) { - goto out; - } - - ret = nrf_wifi_set_bss(vif_ctx_zep, params); - if (ret) { - LOG_ERR("%s: Failed to set BSS", __func__); - goto out; - } - - ret = 0; -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -int nrf_wifi_wpa_supp_change_beacon(void *if_priv, struct wpa_driver_ap_params *params) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - int ret = -1; - struct nrf_wifi_umac_set_beacon_info chg_bcn_info = {0}; - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - - if (!if_priv || !params) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - nrf_wifi_set_beacon_data(params, &chg_bcn_info.beacon_data); - - status = nrf_wifi_fmac_chg_bcn(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, &chg_bcn_info); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_chg_bcn failed", __func__); - goto out; - } - - ret = 0; -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -int nrf_wifi_wpa_supp_stop_ap(void *if_priv) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - int ret = -1; - - if (!if_priv) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - status = nrf_wifi_fmac_stop_ap(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_stop_ap failed", __func__); - goto out; - } - - ret = nrf_wifi_wait_for_carrier_status(vif_ctx_zep, NRF_WIFI_FMAC_IF_CARR_STATE_OFF); - if (ret) { - goto out; - } - - ret = 0; -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -int nrf_wifi_wpa_supp_deinit_ap(void *if_priv) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - int ret = -1; - - if (!if_priv) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_DBG("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - status = nrf_wifi_wpa_supp_stop_ap(if_priv); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: Failed to stop AP", __func__); - goto out; - } - - if (!is_ap_dynamic_iface(vif_ctx_zep)) { - ret = nrf_wifi_iftype_change(vif_ctx_zep, NRF_WIFI_IFTYPE_STATION); - if (ret) { - LOG_ERR("%s: Failed to set interface type to STATION: %d", __func__, ret); - goto out; - } - } - ret = 0; -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -int nrf_wifi_sta_flags_to_nrf(int wpas_sta_flags) -{ - int nrf_sta_flags = 0; - - if (wpas_sta_flags & WPA_STA_AUTHORIZED) { - nrf_sta_flags |= NRF_WIFI_STA_FLAG_AUTHORIZED; - } - if (wpas_sta_flags & WPA_STA_WMM) { - nrf_sta_flags |= NRF_WIFI_STA_FLAG_WME; - } - if (wpas_sta_flags & WPA_STA_SHORT_PREAMBLE) { - nrf_sta_flags |= NRF_WIFI_STA_FLAG_SHORT_PREAMBLE; - } - if (wpas_sta_flags & WPA_STA_MFP) { - nrf_sta_flags |= NRF_WIFI_STA_FLAG_MFP; - } - if (wpas_sta_flags & WPA_STA_TDLS_PEER) { - nrf_sta_flags |= NRF_WIFI_STA_FLAG_TDLS_PEER; - } - /* Note: Do not set flags > NRF_WIFI_STA_FLAG_TDLS_PEER, else - * nrf_wifi_fmac_chg_sta will fail. This is equivalent to not - * setting WPA_DRIVER_FLAGS_FULL_AP_CLIENT_STATE flag. - */ - - return nrf_sta_flags; -} - -int nrf_wifi_wpa_supp_sta_add(void *if_priv, struct hostapd_sta_add_params *params) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - struct nrf_wifi_umac_add_sta_info sta_info = {0}; - int ret = -1; - int i; - - if (!if_priv || !params) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - sta_info.nrf_wifi_listen_interval = params->listen_interval; - sta_info.aid = params->aid; - sta_info.sta_capability = params->capability; - sta_info.supp_rates.nrf_wifi_num_rates = params->supp_rates_len; - /* TODO: sta_info.supp_rates.band */ - for (i = 0; i < params->supp_rates_len; i++) { - sta_info.supp_rates.rates[i] = params->supp_rates[i] & 0x7f; - } - - sta_info.ext_capability.ext_capability_len = params->ext_capab_len; - if (params->ext_capab_len >= NRF_WIFI_EXT_CAPABILITY_MAX_LEN) { - LOG_ERR("%s: ext_capab_len too big: %d (max %d)", __func__, - params->ext_capab_len, NRF_WIFI_EXT_CAPABILITY_MAX_LEN); - goto out; - } - memcpy(sta_info.ext_capability.ext_capability, params->ext_capab, - params->ext_capab_len); - - sta_info.supported_channels.supported_channels_len = params->supp_channels_len; - if (params->supp_channels_len >= NRF_WIFI_SUPPORTED_CHANNELS_MAX_LEN) { - LOG_ERR("%s: supp_channels_len too big: %d (max %d)", __func__, - params->supp_channels_len, NRF_WIFI_SUPPORTED_CHANNELS_MAX_LEN); - goto out; - } - memcpy(sta_info.supported_channels.supported_channels, params->supp_channels, - params->supp_channels_len); - - sta_info.supported_oper_classes.supported_oper_classes_len = params->supp_oper_classes_len; - if (params->supp_oper_classes_len >= NRF_WIFI_OPER_CLASSES_MAX_LEN) { - LOG_ERR("%s: supp_oper_classes_len too big: %d (max %d)", __func__, - params->supp_oper_classes_len, NRF_WIFI_OPER_CLASSES_MAX_LEN); - goto out; - } - memcpy(sta_info.supported_oper_classes.supported_oper_classes, params->supp_oper_classes, - params->supp_oper_classes_len); - - sta_info.sta_flags2.nrf_wifi_set = nrf_wifi_sta_flags_to_nrf(params->flags); - sta_info.sta_flags2.nrf_wifi_mask = sta_info.sta_flags2.nrf_wifi_set | - nrf_wifi_sta_flags_to_nrf(params->flags_mask); - - if (params->ht_capabilities) { - memcpy(sta_info.ht_capability, - params->ht_capabilities, - sizeof(sta_info.ht_capability)); - } - - if (params->vht_capabilities) { - memcpy(sta_info.vht_capability, - params->vht_capabilities, - sizeof(sta_info.vht_capability)); - } - - memcpy(sta_info.mac_addr, params->addr, sizeof(sta_info.mac_addr)); - - LOG_DBG("nrf_wifi_wpa_supp_sta_add: %x, %x", - sta_info.sta_flags2.nrf_wifi_set, sta_info.sta_flags2.nrf_wifi_mask); - - if (params->set) { - status = nrf_wifi_fmac_chg_sta(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - (struct nrf_wifi_umac_chg_sta_info *)&sta_info); - } else { - status = nrf_wifi_fmac_add_sta(rpu_ctx_zep->rpu_ctx, - vif_ctx_zep->vif_idx, - &sta_info); - } - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_add_sta failed", __func__); - goto out; - } - - ret = 0; -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -int nrf_wifi_wpa_supp_sta_remove(void *if_priv, const u8 *addr) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_umac_del_sta_info del_sta = {0}; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - int ret = -1; - - if (!if_priv || !addr) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_DBG("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - memcpy(del_sta.mac_addr, addr, sizeof(del_sta.mac_addr)); - - status = nrf_wifi_fmac_del_sta(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, &del_sta); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_del_sta failed", __func__); - goto out; - } - - ret = 0; - -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -int nrf_wifi_wpa_supp_sta_set_flags(void *if_priv, const u8 *addr, - unsigned int total_flags, unsigned int flags_or, - unsigned int flags_and) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_umac_chg_sta_info chg_sta = {0}; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - int ret = -1; - - if (!if_priv || !addr) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_DBG("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - memcpy(chg_sta.mac_addr, addr, sizeof(chg_sta.mac_addr)); - - chg_sta.sta_flags2.nrf_wifi_mask = nrf_wifi_sta_flags_to_nrf(flags_or | ~flags_and); - chg_sta.sta_flags2.nrf_wifi_set = nrf_wifi_sta_flags_to_nrf(flags_or); - - LOG_DBG("nrf_wifi_wpa_supp_sta_set_flags %x, %x", - chg_sta.sta_flags2.nrf_wifi_set, chg_sta.sta_flags2.nrf_wifi_mask); - - status = nrf_wifi_fmac_chg_sta(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, &chg_sta); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_chg_sta failed", __func__); - goto out; - } - - ret = 0; - -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return ret; -} - -int nrf_wifi_wpa_supp_sta_get_inact_sec(void *if_priv, const u8 *addr) -{ - struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; - struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; - int ret = -1, sem_ret; - int inactive_time_sec = -1; - - if (!if_priv || !addr) { - LOG_ERR("%s: Invalid params", __func__); - return ret; - } - - vif_ctx_zep = if_priv; - rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { - LOG_DBG("%s: rpu_ctx_zep is NULL", __func__); - return ret; - } - - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if (!rpu_ctx_zep->rpu_ctx) { - LOG_DBG("%s: RPU context not initialized", __func__); - goto out; - } - - status = nrf_wifi_fmac_get_station(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, - (unsigned char *) addr); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: nrf_wifi_fmac_get_station failed", __func__); - goto out; - } - - sem_ret = k_sem_take(&wait_for_event_sem, K_MSEC(RPU_RESP_EVENT_TIMEOUT)); - if (sem_ret) { - LOG_ERR("%s: Timed out to get station info, ret = %d", __func__, sem_ret); - ret = NRF_WIFI_STATUS_FAIL; - goto out; - } - - inactive_time_sec = vif_ctx_zep->inactive_time_sec; -out: - k_mutex_unlock(&vif_ctx_zep->vif_lock); - return inactive_time_sec; -} -#endif /* CONFIG_NRF700X_AP_MODE */ From 5f1f671373ceb2511028139cea6a57053829d40a Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 5 Aug 2024 20:42:56 +0530 Subject: [PATCH 02/25] manifest: Use Zephyr hostap Now that nRF70 support is upstream, switch to upstream hostap. Signed-off-by: Chaitanya Tata --- west.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/west.yml b/west.yml index 9d222fa27094..705b97c19fe5 100644 --- a/west.yml +++ b/west.yml @@ -97,6 +97,7 @@ manifest: - hal_nordic - hal_st # required for ST sensors (unrelated to STM32 MCUs) - hal_wurthelektronik + - hostap - liblc3 - libmetal - littlefs @@ -120,15 +121,6 @@ manifest: # # Some of these are also Zephyr modules which have NCS-specific # changes. - - name: hostap - repo-path: sdk-hostap - path: modules/lib/hostap - revision: 3b64b3bf9957f3b1515d58429b89589d234dcaaf - userdata: - ncs: - upstream-url: https://w1.fi/cgit/hostap/ - upstream-sha: e792f38db8471f35ee94f109a4093dece8f78c6a - compare-by-default: true - name: wfa-qt-control-app repo-path: sdk-wi-fiquicktrack-controlappc path: modules/lib/wfa-qt-control-app From 490b52f49be06816a79dd10e154df476aee8f641 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 5 Aug 2024 20:49:19 +0530 Subject: [PATCH 03/25] treewide: Migrate to nRF70 upstream driver Upstream driver namespace is renamed from nrf700x -> nrf70. Signed-off-by: Chaitanya Tata --- .../asset_tracker_v2/Kconfig.sysbuild | 2 +- .../boards/thingy91x_nrf9151_ns.conf | 4 +- .../overlay-nrf7002ek-wifi-scan-only.conf | 4 +- applications/asset_tracker_v2/sample.yaml | 8 +- .../doc/matter_bridge_description.rst | 8 +- applications/matter_bridge/sample.yaml | 10 +- .../matter_weather_station/Kconfig.sysbuild | 2 +- .../matter_weather_station/README.rst | 4 +- .../matter_weather_station/sample.yaml | 2 +- boards/nordic/nrf7002dk/Kconfig.sysbuild | 2 +- boards/nordic/thingy91x/CMakeLists.txt | 2 +- .../nrf700x_nrf54h20dk/Kconfig.defconfig | 2 +- .../nrf700x_nrf54l15pdk/Kconfig.defconfig | 2 +- cmake/partition_manager.cmake | 2 +- cmake/sysbuild/nrf700x.cmake | 8 +- .../software_maturity_features.yaml | 20 +-- .../software_maturity_scanner.py | 2 +- .../sysbuild/sysbuild_forced_options.rst | 10 +- doc/nrf/drivers.rst | 1 - doc/nrf/drivers/wifi/nrf700x/nrf700x.rst | 154 ------------------ .../getting_started/memory_optimization.rst | 4 +- .../advanced_modes/promiscuous_operation.rst | 4 +- .../wifi/advanced_modes/raw_tx_operation.rst | 2 +- .../advanced_modes/sniffer_rx_operation.rst | 4 +- doc/nrf/protocols/wifi/regulatory_support.rst | 2 +- doc/nrf/protocols/wifi/sap_mode/sap.rst | 2 +- .../wifi/scan_mode/scan_operation.rst | 2 +- .../protocols/wifi/stack_configuration.rst | 94 +++++------ .../migration/migration_sysbuild.rst | 18 +- .../releases/release-notes-2.4.0.rst | 2 +- .../releases/release-notes-2.6.0.rst | 2 +- lib/location/scan_wifi.c | 2 +- samples/Kconfig | 16 +- .../overlay-nrf700x-wifi-scan-only.conf | 4 +- samples/cellular/location/sample.yaml | 10 +- .../lwm2m_client/overlay-assist-wifi.conf | 2 +- samples/cellular/modem_shell/README.rst | 8 +- .../overlay-nrf700x-wifi-scan-only.conf | 4 +- samples/cellular/modem_shell/sample.yaml | 24 +-- .../overlay-nrf7002ek-wifi-scan-only.conf | 4 +- .../overlay_nrf7002ek_wifi_coap_no_lte.conf | 4 +- .../overlay_nrf7002ek_wifi_no_lte.conf | 4 +- .../sysbuild_nrf700x-wifi-conn.conf | 4 +- .../sysbuild_nrf700x-wifi-scan.conf | 4 +- .../boards/nrf7002dk_nrf5340_cpuapp.conf | 4 +- .../dfu/ota/ota_image_processor_base_impl.h | 4 +- samples/matter/light_bulb/Kconfig.sysbuild | 2 +- samples/matter/light_switch/Kconfig.sysbuild | 2 +- samples/matter/lock/Kconfig.sysbuild | 2 +- samples/matter/lock/README.rst | 6 +- samples/matter/lock/sample.yaml | 2 +- samples/matter/template/Kconfig.sysbuild | 2 +- samples/matter/template/README.rst | 2 +- samples/matter/template/sample.yaml | 2 +- samples/matter/thermostat/Kconfig.sysbuild | 2 +- .../matter/window_covering/Kconfig.sysbuild | 2 +- .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 6 +- samples/net/azure_iot_hub/README.rst | 1 - .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 8 +- .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 6 +- .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 8 +- .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 6 +- .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 8 +- .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 8 +- .../mqtt/src/modules/network/Kconfig.network | 2 +- .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 6 +- samples/wifi/ble_coex/prj.conf | 6 +- samples/wifi/ble_coex/src/main.c | 12 +- samples/wifi/ble_coex/sysbuild.conf | 2 +- samples/wifi/monitor/prj.conf | 4 +- samples/wifi/monitor/sysbuild.conf | 4 +- samples/wifi/promiscuous/prj.conf | 4 +- samples/wifi/promiscuous/sysbuild.conf | 4 +- samples/wifi/provisioning/ble/prj.conf | 2 +- samples/wifi/provisioning/ble/sysbuild.conf | 2 +- samples/wifi/provisioning/softap/prj.conf | 8 +- samples/wifi/radio_test/prj.conf | 4 +- samples/wifi/radio_test/sample.yaml | 4 +- .../src/nrf_wifi_radio_test_shell.c | 8 +- samples/wifi/radio_test/sysbuild.conf | 4 +- samples/wifi/raw_tx_packet/prj.conf | 4 +- samples/wifi/raw_tx_packet/sysbuild.conf | 4 +- samples/wifi/scan/prj.conf | 2 +- samples/wifi/scan/src/main.c | 8 +- samples/wifi/scan/sysbuild.conf | 4 +- samples/wifi/shell/CMakeLists.txt | 4 +- samples/wifi/shell/overlay-monitor-mode.conf | 2 +- .../wifi/shell/overlay-promiscuous-mode.conf | 2 +- samples/wifi/shell/overlay-raw-tx.conf | 2 +- samples/wifi/shell/overlay-sap.conf | 4 +- samples/wifi/shell/overlay-zperf.conf | 4 +- samples/wifi/shell/prj.conf | 6 +- samples/wifi/shell/sample.yaml | 18 +- samples/wifi/shell/sysbuild.conf | 2 +- samples/wifi/shutdown/prj.conf | 2 +- samples/wifi/shutdown/sysbuild.conf | 2 +- samples/wifi/softap/README.rst | 2 +- samples/wifi/softap/prj.conf | 4 +- samples/wifi/softap/sysbuild.conf | 2 +- samples/wifi/sta/Kconfig | 2 +- samples/wifi/sta/README.rst | 4 +- samples/wifi/sta/prj.conf | 4 +- samples/wifi/sta/src/main.c | 4 +- samples/wifi/sta/sysbuild.conf | 2 +- samples/wifi/thread_coex/prj.conf | 6 +- samples/wifi/thread_coex/src/main.c | 10 +- .../wifi/thread_coex/src/ot_coex_functions.c | 4 +- samples/wifi/thread_coex/sysbuild.conf | 2 +- .../throughput/overlay-high-performance.conf | 12 +- .../wifi/throughput/overlay-iot-devices.conf | 14 +- .../throughput/overlay-memory-optimized.conf | 14 +- samples/wifi/throughput/overlay-rx-prio.conf | 14 +- samples/wifi/throughput/overlay-tx-prio.conf | 14 +- samples/wifi/throughput/prj.conf | 6 +- samples/wifi/throughput/sysbuild.conf | 2 +- samples/wifi/twt/prj.conf | 6 +- samples/wifi/twt/sysbuild.conf | 2 +- samples/wifi/wfa_qt_app/prj.conf | 2 +- samples/wifi/wfa_qt_app/sysbuild.conf | 2 +- .../overlay-nrf70-driver-debug.conf | 2 +- subsys/mpsl/cx/Kconfig | 4 +- subsys/net/lib/softap_wifi_provision/Kconfig | 2 +- sysbuild/CMakeLists.txt | 6 +- sysbuild/Kconfig.dfu | 2 +- sysbuild/Kconfig.wifi | 24 +-- sysbuild/Kconfig.zip | 2 +- .../lib/location/location_lib_autoconf_ext.h | 2 +- 127 files changed, 363 insertions(+), 519 deletions(-) delete mode 100644 doc/nrf/drivers/wifi/nrf700x/nrf700x.rst diff --git a/applications/asset_tracker_v2/Kconfig.sysbuild b/applications/asset_tracker_v2/Kconfig.sysbuild index d256f5e26330..39426561f59b 100644 --- a/applications/asset_tracker_v2/Kconfig.sysbuild +++ b/applications/asset_tracker_v2/Kconfig.sysbuild @@ -13,7 +13,7 @@ config SECURE_BOOT_APPCORE || BOARD_NRF9151DK_NRF9151_NS \ || BOARD_NRF9161DK_NRF9161_NS -config WIFI_NRF700X +config WIFI_NRF70 default y if BOARD_THINGY91X_NRF9151_NS config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY diff --git a/applications/asset_tracker_v2/boards/thingy91x_nrf9151_ns.conf b/applications/asset_tracker_v2/boards/thingy91x_nrf9151_ns.conf index 3096f5ef7848..7e995f9841e2 100644 --- a/applications/asset_tracker_v2/boards/thingy91x_nrf9151_ns.conf +++ b/applications/asset_tracker_v2/boards/thingy91x_nrf9151_ns.conf @@ -30,8 +30,8 @@ CONFIG_ADXL367_ACTIVITY_TIME=0 # configs for Wi-Fi CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y -CONFIG_WIFI_NRF700X_SKIP_LOCAL_ADMIN_MAC=y +CONFIG_WIFI_NRF70=y +CONFIG_WIFI_NRF70_SKIP_LOCAL_ADMIN_MAC=y # Align this with CONFIG_LOCATION_METHOD_WIFI_SCANNING_RESULTS_MAX_CNT CONFIG_NRF_WIFI_SCAN_MAX_BSS_CNT=10 diff --git a/applications/asset_tracker_v2/overlay-nrf7002ek-wifi-scan-only.conf b/applications/asset_tracker_v2/overlay-nrf7002ek-wifi-scan-only.conf index 35d1507e4df1..ff7daa2e4709 100644 --- a/applications/asset_tracker_v2/overlay-nrf7002ek-wifi-scan-only.conf +++ b/applications/asset_tracker_v2/overlay-nrf7002ek-wifi-scan-only.conf @@ -19,8 +19,8 @@ CONFIG_DK_LIBRARY=n # Actual configs for the Wi-Fi CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y -CONFIG_WIFI_NRF700X_SKIP_LOCAL_ADMIN_MAC=y +CONFIG_WIFI_NRF70=y +CONFIG_WIFI_NRF70_SKIP_LOCAL_ADMIN_MAC=y # Align this with CONFIG_LOCATION_METHOD_WIFI_SCANNING_RESULTS_MAX_CNT CONFIG_NRF_WIFI_SCAN_MAX_BSS_CNT=20 diff --git a/applications/asset_tracker_v2/sample.yaml b/applications/asset_tracker_v2/sample.yaml index e310535a21fe..879dfbc71298 100644 --- a/applications/asset_tracker_v2/sample.yaml +++ b/applications/asset_tracker_v2/sample.yaml @@ -329,7 +329,7 @@ tests: - nrf9160dk/nrf9160/ns platform_allow: nrf9160dk/nrf9160/ns extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE=overlay-nrf7002ek-wifi-scan-only.conf - SB_CONFIG_WIFI_NRF700X=y SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_applications_asset_tracker_v2 applications.asset_tracker_v2.nrf7002ek_wifi.nrf9161dk: sysbuild: true @@ -338,7 +338,7 @@ tests: - nrf9161dk/nrf9161/ns platform_allow: nrf9161dk/nrf9161/ns extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE=overlay-nrf7002ek-wifi-scan-only.conf - SB_CONFIG_WIFI_NRF700X=y SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_applications_asset_tracker_v2 applications.asset_tracker_v2.nrf7002ek_wifi.nrf9151dk: sysbuild: true @@ -347,7 +347,7 @@ tests: - nrf9151dk/nrf9151/ns platform_allow: nrf9151dk/nrf9151/ns extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE=overlay-nrf7002ek-wifi-scan-only.conf - SB_CONFIG_WIFI_NRF700X=y SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_applications_asset_tracker_v2 applications.asset_tracker_v2.nrf7002ek_wifi-debug: sysbuild: true @@ -362,7 +362,7 @@ tests: - nrf9151dk/nrf9151/ns extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE="overlay-nrf7002ek-wifi-scan-only.conf;overlay-debug.conf" - SB_CONFIG_WIFI_NRF700X=y SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_applications_asset_tracker_v2 # Configuration which will be used by the positioning CI integration job to verify PRs diff --git a/applications/matter_bridge/doc/matter_bridge_description.rst b/applications/matter_bridge/doc/matter_bridge_description.rst index bd07849d2d0f..dece32456de5 100644 --- a/applications/matter_bridge/doc/matter_bridge_description.rst +++ b/applications/matter_bridge/doc/matter_bridge_description.rst @@ -543,7 +543,7 @@ Build the target using the following command in the project directory to enable .. parsed-literal:: :class: highlight - west build -b nrf54h20dk/nrf54h20/cpuapp -- -DSB_CONFIG_WIFI_NRF700X=y -DCONFIG_CHIP_WIFI=y -Dmatter_bridge_SHIELD=nrf700x_nrf54h20dk -DCONFIG_BRIDGED_DEVICE_BT=y -DEXTRA_CONF_FILE="overlay-bt_max_connections_app.conf" -Dipc_radio_EXTRA_CONF_FILE="overlay-bt_max_connections_net.conf" + west build -b nrf54h20dk/nrf54h20/cpuapp -- -DSB_CONFIG_WIFI_NRF70=y -DCONFIG_CHIP_WIFI=y -Dmatter_bridge_SHIELD=nrf700x_nrf54h20dk -DCONFIG_BRIDGED_DEVICE_BT=y -DEXTRA_CONF_FILE="overlay-bt_max_connections_app.conf" -Dipc_radio_EXTRA_CONF_FILE="overlay-bt_max_connections_net.conf" .. _matter_bridge_app_bt_security: @@ -627,7 +627,7 @@ For example: .. code-block:: console - west build -b nrf5340dk/nrf5340/cpuapp -p -- -Dmatter_bridge_SHIELD=nrf7002ek -DSB_CONFIG_WIFI_PATCHES_EXT_FLASH_STORE=y -DSB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_WIFI_FW_PATCH=y -DSB_CONFIG_WIFI_NRF700X=y -Dmcuboot_CONFIG_UPDATEABLE_IMAGE_NUMBER=3 + west build -b nrf5340dk/nrf5340/cpuapp -p -- -Dmatter_bridge_SHIELD=nrf7002ek -DSB_CONFIG_WIFI_PATCHES_EXT_FLASH_STORE=y -DSB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_WIFI_FW_PATCH=y -DSB_CONFIG_WIFI_NRF70=y -Dmcuboot_CONFIG_UPDATEABLE_IMAGE_NUMBER=3 To use the nRF54H20 DK with the ``nrf7002ek`` shield (2.4 GHz or 5 GHz), follow the :ref:`ug_nrf7002eb_nrf54h20dk_gs` user guide to connect all required pins. @@ -635,7 +635,7 @@ Once connected, run the following command to build the sample: .. code-block:: console - west build -b nrf54h20dk/nrf54h20/cpuapp -p -- -DSB_CONFIG_WIFI_NRF700X=y -DCONFIG_CHIP_WIFI=y -Dmatter_bridge_SHIELD=nrf700x_nrf54h20dk + west build -b nrf54h20dk/nrf54h20/cpuapp -p -- -DSB_CONFIG_WIFI_NRF70=y -DCONFIG_CHIP_WIFI=y -Dmatter_bridge_SHIELD=nrf700x_nrf54h20dk Selecting a configuration ========================= @@ -656,7 +656,7 @@ To enable the Matter smart plug functionality, run the following command: .. code-block:: console - west build -b nrf54h20dk/nrf54h20/cpuapp -p -- -DSB_CONFIG_WIFI_NRF700X=y -DCONFIG_CHIP_WIFI=y -Dmatter_bridge_SHIELD=nrf700x_nrf54h20dk -DCONFIG_BRIDGED_DEVICE_BT=y -Dmatter_bridge_SNIPPET=onoff_plug + west build -b nrf54h20dk/nrf54h20/cpuapp -p -- -DSB_CONFIG_WIFI_NRF70=y -DCONFIG_CHIP_WIFI=y -Dmatter_bridge_SHIELD=nrf700x_nrf54h20dk -DCONFIG_BRIDGED_DEVICE_BT=y -Dmatter_bridge_SNIPPET=onoff_plug .. group-tab:: nRF70 DKs diff --git a/applications/matter_bridge/sample.yaml b/applications/matter_bridge/sample.yaml index 2f4b5033dcb6..bea1ad0e0315 100644 --- a/applications/matter_bridge/sample.yaml +++ b/applications/matter_bridge/sample.yaml @@ -55,7 +55,7 @@ tests: sysbuild: true build_only: true extra_args: matter_bridge_SHIELD=nrf7002ek SB_CONFIG_WIFI_PATCHES_EXT_FLASH_STORE=y - mcuboot_CONFIG_UPDATEABLE_IMAGE_NUMBER=3 SB_CONFIG_WIFI_NRF700X=y + mcuboot_CONFIG_UPDATEABLE_IMAGE_NUMBER=3 SB_CONFIG_WIFI_NRF70=y SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_WIFI_FW_PATCH=y CONFIG_CHIP_DFU_OVER_BT_SMP=y integration_platforms: @@ -75,7 +75,7 @@ tests: applications.matter_bridge.nrf54h20.br_ble: sysbuild: true build_only: true - extra_args: SB_CONFIG_WIFI_NRF700X=y + extra_args: SB_CONFIG_WIFI_NRF70=y CONFIG_CHIP_WIFI=y matter_bridge_SHIELD=nrf700x_nrf54h20dk CONFIG_BRIDGED_DEVICE_BT=y @@ -86,7 +86,7 @@ tests: applications.matter_bridge.nrf54h20: sysbuild: true build_only: true - extra_args: SB_CONFIG_WIFI_NRF700X=y + extra_args: SB_CONFIG_WIFI_NRF70=y CONFIG_CHIP_WIFI=y matter_bridge_SHIELD=nrf700x_nrf54h20dk CONFIG_BRIDGED_DEVICE_SIMULATED=y @@ -97,7 +97,7 @@ tests: applications.matter_bridge.nrf54h20.br_ble.smart_plug: sysbuild: true build_only: true - extra_args: SB_CONFIG_WIFI_NRF700X=y + extra_args: SB_CONFIG_WIFI_NRF70=y CONFIG_CHIP_WIFI=y matter_bridge_SHIELD=nrf700x_nrf54h20dk CONFIG_BRIDGED_DEVICE_BT=y @@ -109,7 +109,7 @@ tests: applications.matter_bridge.nrf54h20.smart_plug: sysbuild: true build_only: true - extra_args: SB_CONFIG_WIFI_NRF700X=y + extra_args: SB_CONFIG_WIFI_NRF70=y CONFIG_CHIP_WIFI=y matter_bridge_SHIELD=nrf700x_nrf54h20dk CONFIG_BRIDGED_DEVICE_SIMULATED=y diff --git a/applications/matter_weather_station/Kconfig.sysbuild b/applications/matter_weather_station/Kconfig.sysbuild index 326edcf3032d..0676f40964f1 100644 --- a/applications/matter_weather_station/Kconfig.sysbuild +++ b/applications/matter_weather_station/Kconfig.sysbuild @@ -11,7 +11,7 @@ config NRF_DEFAULT_IPC_RADIO # Enable IEEE802.15.4 serialization to network core # This config automatically pulls in the `overlay-802154.conf` in the ipc_radio image config NETCORE_IPC_RADIO_IEEE802154 - default y if !WIFI_NRF700X + default y if !WIFI_NRF70 # Enable Bluetooth serialization to network core # This config automatically pulls in the `overlay-bt_hci_ipc.conf` in the ipc_radio image diff --git a/applications/matter_weather_station/README.rst b/applications/matter_weather_station/README.rst index f916bc8d1b8b..eb603dc18a12 100644 --- a/applications/matter_weather_station/README.rst +++ b/applications/matter_weather_station/README.rst @@ -210,7 +210,7 @@ To build this application to work with the nRF7002 Wi-Fi expansion board: .. group-tab:: nRF Connect for VS Code To build the application in the nRF Connect for VS Code IDE for Thingy:53 with the nRF7002 EB attached, add the expansion board and the file suffix variables in the build configuration's :guilabel:`Extra CMake arguments` and rebuild the build configuration. - For example: ``-- -Dmatter_weather_station_SHIELD=nrf7002eb -DFILE_SUFFIX=release -DSB_CONFIG_WIFI_NRF700X=y``. + For example: ``-- -Dmatter_weather_station_SHIELD=nrf7002eb -DFILE_SUFFIX=release -DSB_CONFIG_WIFI_NRF70=y``. .. group-tab:: Command line @@ -218,7 +218,7 @@ To build this application to work with the nRF7002 Wi-Fi expansion board: .. code-block:: console - west build -b thingy53/nrf5340/cpuapp -- -Dmatter_weather_station_SHIELD=nrf7002eb -DFILE_SUFFIX=release -DSB_CONFIG_WIFI_NRF700X=y + west build -b thingy53/nrf5340/cpuapp -- -Dmatter_weather_station_SHIELD=nrf7002eb -DFILE_SUFFIX=release -DSB_CONFIG_WIFI_NRF70=y Generating factory data ======================= diff --git a/applications/matter_weather_station/sample.yaml b/applications/matter_weather_station/sample.yaml index a8d5a35abf72..816ff21cdfdd 100644 --- a/applications/matter_weather_station/sample.yaml +++ b/applications/matter_weather_station/sample.yaml @@ -50,7 +50,7 @@ tests: sysbuild: true build_only: true extra_args: matter_weather_station_SHIELD=nrf7002eb FILE_SUFFIX=release - SB_CONFIG_WIFI_NRF700X=y CONFIG_CHIP_WIFI=y + SB_CONFIG_WIFI_NRF70=y CONFIG_CHIP_WIFI=y platform_allow: thingy53/nrf5340/cpuapp platform_exclude: thingy53/nrf5340/cpuapp/ns integration_platforms: diff --git a/boards/nordic/nrf7002dk/Kconfig.sysbuild b/boards/nordic/nrf7002dk/Kconfig.sysbuild index 0d57b33a58f4..852dd74a9459 100644 --- a/boards/nordic/nrf7002dk/Kconfig.sysbuild +++ b/boards/nordic/nrf7002dk/Kconfig.sysbuild @@ -1,5 +1,5 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -config WIFI_NRF700X +config WIFI_NRF70 default y if SOC_NRF5340_CPUAPP_QKAA diff --git a/boards/nordic/thingy91x/CMakeLists.txt b/boards/nordic/thingy91x/CMakeLists.txt index dd914b447ec4..bacd5959a64a 100644 --- a/boards/nordic/thingy91x/CMakeLists.txt +++ b/boards/nordic/thingy91x/CMakeLists.txt @@ -3,7 +3,7 @@ # Copyright (c) 2024 Nordic Semiconductor # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -if(CONFIG_WIFI_NRF700X) +if(CONFIG_WIFI_NRF70) if(CONFIG_BOARD_THINGY91X_NRF9151 OR CONFIG_BOARD_THINGY91X_NRF9151_NS) zephyr_library() zephyr_library_sources(nrf70_support.c) diff --git a/boards/shields/nrf700x_nrf54h20dk/Kconfig.defconfig b/boards/shields/nrf700x_nrf54h20dk/Kconfig.defconfig index b7120a284924..3de124ae9ce1 100644 --- a/boards/shields/nrf700x_nrf54h20dk/Kconfig.defconfig +++ b/boards/shields/nrf700x_nrf54h20dk/Kconfig.defconfig @@ -12,7 +12,7 @@ config NETWORKING config WIFI default y -config WIFI_NRF700X +config WIFI_NRF70 default y config NRFX_GPIOTE diff --git a/boards/shields/nrf700x_nrf54l15pdk/Kconfig.defconfig b/boards/shields/nrf700x_nrf54l15pdk/Kconfig.defconfig index 0fe7c7b115ba..9336253fd8f8 100644 --- a/boards/shields/nrf700x_nrf54l15pdk/Kconfig.defconfig +++ b/boards/shields/nrf700x_nrf54l15pdk/Kconfig.defconfig @@ -12,7 +12,7 @@ config NETWORKING config WIFI default y -config WIFI_NRF700X +config WIFI_NRF70 default y config NRFX_GPIOTE diff --git a/cmake/partition_manager.cmake b/cmake/partition_manager.cmake index 235e4b820698..30f1fe006e46 100644 --- a/cmake/partition_manager.cmake +++ b/cmake/partition_manager.cmake @@ -519,7 +519,7 @@ if (CONFIG_SECURE_BOOT AND CONFIG_BOOTLOADER_MCUBOOT) endif() # Calculate absolute address for the wi-fi firmware patch location. -if (CONFIG_WIFI_NRF700X AND CONFIG_NRF_WIFI_PATCHES_EXT_FLASH_STORE) +if (CONFIG_WIFI_NRF70 AND CONFIG_NRF_WIFI_PATCHES_EXT_FLASH_STORE) if(DEFINED ext_flash_dev) get_filename_component(qspi_node ${ext_flash_dev} DIRECTORY) else() diff --git a/cmake/sysbuild/nrf700x.cmake b/cmake/sysbuild/nrf700x.cmake index 77edb6a6801b..cab2389dba80 100644 --- a/cmake/sysbuild/nrf700x.cmake +++ b/cmake/sysbuild/nrf700x.cmake @@ -10,13 +10,13 @@ function(setup_nrf700x_xip_data) set(OS_AGNOSTIC_BASE ${ZEPHYR_NRFXLIB_MODULE_DIR}/nrf_wifi) - if(SB_CONFIG_WIFI_NRF700X_SYSTEM_MODE) + if(SB_CONFIG_WIFI_NRF70_SYSTEM_MODE) set(NRF70_PATCH ${OS_AGNOSTIC_BASE}/fw_bins/default/nrf70.bin) - elseif(SB_CONFIG_WIFI_NRF700X_RADIO_TEST) + elseif(SB_CONFIG_WIFI_NRF70_RADIO_TEST) set(NRF70_PATCH ${OS_AGNOSTIC_BASE}/fw_bins/radio_test/nrf70.bin) - elseif(SB_CONFIG_WIFI_NRF700X_SCAN_ONLY) + elseif(SB_CONFIG_WIFI_NRF70_SCAN_ONLY) set(NRF70_PATCH ${OS_AGNOSTIC_BASE}/fw_bins/scan_only/nrf70.bin) - elseif(SB_CONFIG_WIFI_NRF700X_SYSTEM_WITH_RAW_MODES) + elseif(SB_CONFIG_WIFI_NRF70_SYSTEM_WITH_RAW_MODES) set(NRF70_PATCH ${OS_AGNOSTIC_BASE}/fw_bins/system_with_raw/nrf70.bin) else() # Error diff --git a/doc/_scripts/software_maturity/software_maturity_features.yaml b/doc/_scripts/software_maturity/software_maturity_features.yaml index 1c0ab7b7a6fc..867218fc1065 100644 --- a/doc/_scripts/software_maturity/software_maturity_features.yaml +++ b/doc/_scripts/software_maturity/software_maturity_features.yaml @@ -12,7 +12,7 @@ top_table: - BOARD_NRF9151DK_NRF9151_NS Matter: CHIP Wi-Fi: - rule: WIFI && WIFI_NRF700X + rule: WIFI && WIFI_NRF70 boards_and_shields: - SHIELD_NRF7002EK - SHIELD_NRF7002EK_NRF7000 @@ -67,7 +67,7 @@ features: Thread TCP: OPENTHREAD_TCP_ENABLE matter: Matter over Thread: CHIP && NET_L2_OPENTHREAD - Matter over Wi-Fi: CHIP && WIFI_NRF700X + Matter over Wi-Fi: CHIP && WIFI_NRF70 Matter commissioning over IP: CHIP Matter commissioning over Bluetooth LE with QR code onboarding: CHIP && BT Matter commissioning over Bluetooth LE with NFC onboarding: CHIP && BT && CHIP_NFC_COMMISSIONING @@ -77,7 +77,7 @@ features: NET_L2_OPENTHREAD && OPENTHREAD_MTD_SED wifi: STA Mode: - rule: WPA_SUPP && WIFI_NRF700X + rule: WPA_SUPP && WIFI_NRF70 boards_and_shields: - SHIELD_NRF7002EK - SHIELD_NRF7002EK_NRF7000 @@ -88,7 +88,7 @@ features: - BOARD_NRF7002DK_NRF5340_CPUAPP - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 Scan only (for location accuracy): - rule: WIFI_NRF700X && !WPA_SUPP + rule: WIFI_NRF70 && !WPA_SUPP boards_and_shields: - SHIELD_NRF7002EK - SHIELD_NRF7002EK_NRF7000 @@ -97,7 +97,7 @@ features: - BOARD_NRF7002DK_NRF5340_CPUAPP - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 Bluetooth LE coexistence: - rule: WIFI_NRF700X && NRF700X_SR_COEX + rule: WIFI_NRF70 && NRF700X_SR_COEX boards_and_shields: - SHIELD_NRF7002EK - SHIELD_NRF7002EK_NRF7001 @@ -105,11 +105,11 @@ features: - BOARD_NRF7002DK_NRF5340_CPUAPP - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 Thread coexistence: - rule: WIFI_NRF700X && OPENTHREAD + rule: WIFI_NRF70 && OPENTHREAD boards_and_shields: - BOARD_NRF7002DK_NRF5340_CPUAPP SoftAP Mode (for Wi-Fi provisioning): - rule: WIFI_NRF700X && NRF700X_AP_MODE && WPA_SUPP_AP + rule: WIFI_NRF70 && NRF700X_AP_MODE && WPA_SUPP_AP boards_and_shields: - SHIELD_NRF7002EK - SHIELD_NRF7002EK_NRF7000 @@ -118,7 +118,7 @@ features: - BOARD_NRF7002DK_NRF5340_CPUAPP - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 Monitor Mode: - rule: WIFI_NRF700X && NRF700X_RAW_DATA_RX + rule: WIFI_NRF70 && NRF700X_RAW_DATA_RX boards_and_shields: - SHIELD_NRF7002EK - SHIELD_NRF7002EK_NRF7000 @@ -127,7 +127,7 @@ features: - BOARD_NRF7002DK_NRF5340_CPUAPP - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 TX injection Mode: - rule: WIFI_NRF700X && NRF700X_RAW_DATA_TX + rule: WIFI_NRF70 && NRF700X_RAW_DATA_TX boards_and_shields: - SHIELD_NRF7002EK - SHIELD_NRF7002EK_NRF7000 @@ -136,7 +136,7 @@ features: - BOARD_NRF7002DK_NRF5340_CPUAPP - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 Promiscuous Mode: - rule: WIFI_NRF700X && NRF700X_PROMISC_DATA_RX + rule: WIFI_NRF70 && NRF700X_PROMISC_DATA_RX boards_and_shields: - SHIELD_NRF7002EK - SHIELD_NRF7002EK_NRF7001 diff --git a/doc/_scripts/software_maturity/software_maturity_scanner.py b/doc/_scripts/software_maturity/software_maturity_scanner.py index 6743824077c7..7f08df51d2ba 100644 --- a/doc/_scripts/software_maturity/software_maturity_scanner.py +++ b/doc/_scripts/software_maturity/software_maturity_scanner.py @@ -59,7 +59,7 @@ Matter over Thread: CHIP && NET_L2_OPENTHREAD wifi: STA Mode: - rule: WPA_SUPP && WIFI_NRF700X + rule: WPA_SUPP && WIFI_NRF70 boards_and_shields: - SHIELD_NRF7002EK - BOARD_NRF7002DK_NRF5340_CPUAPP diff --git a/doc/nrf/app_dev/config_and_build/sysbuild/sysbuild_forced_options.rst b/doc/nrf/app_dev/config_and_build/sysbuild/sysbuild_forced_options.rst index feab02855037..2768ae589ff0 100644 --- a/doc/nrf/app_dev/config_and_build/sysbuild/sysbuild_forced_options.rst +++ b/doc/nrf/app_dev/config_and_build/sysbuild/sysbuild_forced_options.rst @@ -18,7 +18,7 @@ Trying to change them directly in an image will result in the new value being ov +-------------------------------------------------------------------------+---------------------------------------------------------------------------+-------------------------+ | :kconfig:option:`CONFIG_BT_FAST_PAIR` + ``SB_CONFIG_BT_FAST_PAIR`` | Main application | +-------------------------------------------------------------------------+---------------------------------------------------------------------------+ | -| :kconfig:option:`CONFIG_WIFI_NRF700X` + ``SB_CONFIG_WIFI_NRF700X`` | | +| :kconfig:option:`CONFIG_WIFI_NRF70` + ``SB_CONFIG_WIFI_NRF70`` | | +-------------------------------------------------------------------------+---------------------------------------------------------------------------+ | | :kconfig:option:`CONFIG_NRF_WIFI_PATCHES_EXT_FLASH_DISABLED` + ``SB_CONFIG_WIFI_PATCHES_EXT_FLASH_DISABLED`` | | +-------------------------------------------------------------------------+---------------------------------------------------------------------------+ | @@ -26,13 +26,13 @@ Trying to change them directly in an image will result in the new value being ov +-------------------------------------------------------------------------+---------------------------------------------------------------------------+ | | :kconfig:option:`CONFIG_NRF_WIFI_PATCHES_EXT_FLASH_STORE` + ``SB_CONFIG_WIFI_PATCHES_EXT_FLASH_STORE`` | | +-------------------------------------------------------------------------+---------------------------------------------------------------------------+ | -| :kconfig:option:`CONFIG_NRF700X_SYSTEM_MODE` + ``SB_CONFIG_WIFI_NRF700X_SYSTEM_MODE`` | | +| :kconfig:option:`CONFIG_NRF70_SYSTEM_MODE` + ``SB_CONFIG_WIFI_NRF70_SYSTEM_MODE`` | | +-------------------------------------------------------------------------+---------------------------------------------------------------------------+ | -| :kconfig:option:`CONFIG_NRF700X_SCAN_ONLY` + ``SB_CONFIG_WIFI_NRF700X_SCAN_ONLY`` | | +| :kconfig:option:`CONFIG_NRF70_SCAN_ONLY` + ``SB_CONFIG_WIFI_NRF70_SCAN_ONLY`` | | +-------------------------------------------------------------------------+---------------------------------------------------------------------------+ | -| :kconfig:option:`CONFIG_NRF700X_RADIO_TEST` + ``SB_CONFIG_WIFI_NRF700X_RADIO_TEST`` | | +| :kconfig:option:`CONFIG_NRF70_RADIO_TEST` + ``SB_CONFIG_WIFI_NRF70_RADIO_TEST`` | | +-------------------------------------------------------------------------+---------------------------------------------------------------------------+ | -| :kconfig:option:`CONFIG_NRF700X_SYSTEM_WITH_RAW_MODES` + ``SB_CONFIG_WIFI_NRF700X_SYSTEM_WITH_RAW_MODES`` | | +| :kconfig:option:`CONFIG_NRF70_SYSTEM_WITH_RAW_MODES` + ``SB_CONFIG_WIFI_NRF70_SYSTEM_WITH_RAW_MODES`` | | +-------------------------------------------------------------------------+---------------------------------------------------------------------------+ | | :kconfig:option:`CONFIG_NRF_WIFI_FW_PATCH_DFU` + ``SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_WIFI_FW_PATCH`` | | +-------------------------------------------------------------------------+---------------------------------------------------------------------------+ | diff --git a/doc/nrf/drivers.rst b/doc/nrf/drivers.rst index 3f646c0eee04..683863e6fcfb 100644 --- a/doc/nrf/drivers.rst +++ b/doc/nrf/drivers.rst @@ -16,4 +16,3 @@ Here you can find documentation for drivers in the |NCS|, including API document :glob: drivers/* - drivers/wifi/nrf700x/* diff --git a/doc/nrf/drivers/wifi/nrf700x/nrf700x.rst b/doc/nrf/drivers/wifi/nrf700x/nrf700x.rst deleted file mode 100644 index 14f1ebcc84e9..000000000000 --- a/doc/nrf/drivers/wifi/nrf700x/nrf700x.rst +++ /dev/null @@ -1,154 +0,0 @@ -.. _nrf700x_wifi: - -nRF Wi-Fi driver -################ - -.. contents:: - :local: - :depth: 2 - -The nRF Wi-Fi driver implements the Wi-Fi® protocol for the nRF70 FullMAC Series of devices. -FullMAC devices implement the Wi-Fi protocol in the chipset. -The driver configures the chipset and transfers the frames to and from the device to the networking stack. - -nRF70 Series device is a companion IC and can be used with any Nordic Semiconductor System-on-Chips (SoCs), such as the nRF53 and nRF91 Series SoCs. - -You can enable the driver by using the :kconfig:option:`CONFIG_WIFI_NRF700X` Kconfig option. - -Architecture -************* - -The following figure illustrates the architecture of the nRF Wi-Fi driver. - -.. figure:: /images/nrf700x_wifi_driver.svg - :alt: nRF Wi-Fi driver block diagram - :align: center - :figclass: align-center - - nRF Wi-Fi driver architecture overview - -Design overview -*************** - -The nRF Wi-Fi driver follows an OS agnostic design, and the driver implementation is split into OS agnostic and OS (Zephyr) specific code. -The OS agnostic code is located in the :file:`sdk-nrfxlib/nrf_wifi/` folder and the Zephyr OS port is located in the :file:`drivers/wifi/nrf700x/` folder. - -The driver supports two modes of operation: - -Wi-Fi mode -========== -In this mode, the driver is designed to be used with the Zephyr networking stack. -It is implemented as a network interface driver. - -The driver supports the following IEEE 802.11 features: - -* Wi-Fi 6 (802.11ax) support -* WPA3â„¢/WPA2â„¢ personal security -* IEEE 802.11 Power Save modes -* Scan-only mode -* IEEE 802.11 :term:`Station mode (STA)` -* :term:`Software-enabled Access Point (SoftAP or SAP)` mode - -The Wi-Fi Direct® mode feature is in the driver code but is not yet supported. - -Except for scan-only mode, the driver uses the host access point daemon (hostapd) to implement AP Media Access Control (MAC) Sublayer Management Entity (AP MLME) and wpa_supplicant to implement 802.1X supplicant. - -Radio Test mode -=============== -The nRF Wi-Fi driver supports Radio Test mode, which you can use to test the RF performance of the nRF70 Series device. -This is a build time option that you can enable using the :kconfig:option:`CONFIG_NRF700X_RADIO_TEST` Kconfig option. - -For more details about using this driver in Radio Test mode, see :ref:`wifi_radio_test`. - -Driver to nRF70 Series device communication -******************************************* - -The driver communicates with the nRF70 Series device using the QSPI/SPI interface. -The driver uses the QSPI/SPI interface to send commands to the nRF70 Series device, and to transfer data to and from the device. -The nRF7002 DK uses QSPI, whereas the nRF7002 EK uses SPI. - -To connect the nRF7002 EK to the SoC, the ``nrf7002ek`` shield is required. - -Configuration -************* - -The nRF Wi-Fi driver has the following configuration options: - -Kconfig configuration -===================== - -.. options-from-kconfig:: - :show-type: - -Devicetree Specification configuration -====================================== - -The maximum transmit power achieved on a nRF70 Series device-based product depends on the frequency band and operating channel. -This varies from chip to chip as well as over different :term:`Printed Circuit Board (PCB)` designs. - -Multiple calibrations and checks are implemented to ensure consistency across channels and devices. -However, these values have a dependency on PCB design, which may result in Error Vector Magnitude (EVM) and spectral mask failures. -To avoid this problem, you can specify the power ceiling at which the EVM and spectral mask are met for a given PCB design. -Additionally, build-time parameters are made available to drivers through the DTS overlay file. - -The following code snippet shows an example of the DTS overlay file: - -.. code-block:: devicetree - - / - { - nrf70_tx_power_ceiling: nrf70_tx_power_ceiling_node { - status = "okay"; - compatible = "nordic,nrf700x-tx-power-ceiling"; - max-pwr-2g-dsss = <0x54>; - max-pwr-2g-mcs0 = <0x40>; - max-pwr-2g-mcs7 = <0x40>; - max-pwr-5g-low-mcs0 = <0x38>; - max-pwr-5g-low-mcs7 = <0x38>; - max-pwr-5g-mid-mcs0 = <0x38>; - max-pwr-5g-mid-mcs7 = <0x38>; - max-pwr-5g-high-mcs0 = <0x38>; - max-pwr-5g-high-mcs7 = <0x38>; - }; - - }; - - -The following table lists the parameters (8-bit unsigned values) defined in the DTS overlay board files: - -.. list-table:: DTS file parameters - :header-rows: 1 - - * - DTS parameter - - Description - * - max-pwr-2g-dsss - - Transmit power ceiling for DSSS data rate in 0.25 dBm steps. - This is applicable for all DSSS data rates. - * - max-pwr-2g-mcs0 - - Transmit power ceiling for MCS0 data rate in 2.4 GHz band in steps of 0.25 dBm steps. - * - max-pwr-2g-mcs7 - - Transmit power ceiling for MCS7 data rate in 2.4 GHz band in steps of 0.25 dBm steps. - * - max-pwr-5g-low-mcs0 - - Transmit power ceiling for MCS0 in lower 5 GHz frequency band in steps of 0.25 dBm. - Lower 5 GHz frequency band refers to channels from 36 to 64. - * - max-pwr-5g-low-mcs7 - - Transmit power ceiling for MCS7 in lower 5 GHz frequency band in steps of 0.25 dBm. - * - max-pwr-5g-mid-mcs0 - - Transmit power ceiling for MCS0 in mid 5 GHz frequency band in steps of 0.25 dBm. - Mid 5 GHz frequency band refers to channels from 100 to 132. - * - max-pwr-5g-mid-mcs7 - - Transmit power ceiling for MCS7 in mid 5 GHz frequency band in steps of 0.25 dBm. - * - max-pwr-5g-high-mcs0 - - Transmit power ceiling for MCS0 in high 5 GHz frequency band in steps of 0.25 dBm. - High 5 GHz frequency band refers to channels from 136 to 177. - * - max-pwr-5g-mid-mcs7 - - Transmit power ceiling for MCS7 in mid 5 GHz frequency band in steps of 0.25 dBm. - - -API documentation -***************** - -After the nRF Wi-Fi driver has been initialized, the application will see it as an Ethernet interface. -To use the Ethernet interface, the application can use `Zephyr Network APIs`_. - -See the :ref:`nrfxlib:nrf_wifi_driver` to learn more about various modes of low-level API. diff --git a/doc/nrf/protocols/matter/getting_started/memory_optimization.rst b/doc/nrf/protocols/matter/getting_started/memory_optimization.rst index 229ebc4404bf..1b2b7bef66c4 100644 --- a/doc/nrf/protocols/matter/getting_started/memory_optimization.rst +++ b/doc/nrf/protocols/matter/getting_started/memory_optimization.rst @@ -401,9 +401,9 @@ The following table presents the possible threads used in a Matter application a | | | Processing Wi-Fi task queue | | | | For Matter over Wi-Fi only. | +---------------------+------------------------------------------------------------------+----------------------------------------------------------------+ -| nrf700x_bh_wq | :kconfig:option:`CONFIG_NRF700X_BH_WQ_STACK_SIZE` | nRF700x Wi-Fi driver work queue. | +| nrf700x_bh_wq | :kconfig:option:`CONFIG_NRF70_BH_WQ_STACK_SIZE` | nRF700x Wi-Fi driver work queue. | +---------------------+------------------------------------------------------------------+----------------------------------------------------------------+ -| nrf700x_intr_wq | :kconfig:option:`CONFIG_NRF700X_IRQ_WQ_STACK_SIZE` | Interrupts processing generated by the nRF700X Wi-Fi radio. | +| nrf700x_intr_wq | :kconfig:option:`CONFIG_NRF70_IRQ_WQ_STACK_SIZE` | Interrupts processing generated by the nRF700X Wi-Fi radio. | +---------------------+------------------------------------------------------------------+----------------------------------------------------------------+ | mbox_wq | :kconfig:option:`CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE` | Inter Processor Communication. | | | | For multi-processors targets only. | diff --git a/doc/nrf/protocols/wifi/advanced_modes/promiscuous_operation.rst b/doc/nrf/protocols/wifi/advanced_modes/promiscuous_operation.rst index 846ac1d3a26b..0e0ef1067c39 100644 --- a/doc/nrf/protocols/wifi/advanced_modes/promiscuous_operation.rst +++ b/doc/nrf/protocols/wifi/advanced_modes/promiscuous_operation.rst @@ -16,7 +16,7 @@ In Promiscuous mode of operation, all received IEEE 802.11 packets that belong t Enabling Promiscuous mode ************************* -To use the Promiscuous mode feature in your applications, you must enable the :kconfig:option:`CONFIG_NRF700X_PROMISC_DATA_RX` Kconfig option in the project configuration. +To use the Promiscuous mode feature in your applications, you must enable the :kconfig:option:`CONFIG_NRF70_PROMISC_DATA_RX` Kconfig option in the project configuration. .. _ug_nrf70_developing_promiscuous_mode_operation: @@ -138,7 +138,7 @@ TX injection mode can be enabled concurrently with Promiscuous mode on the nRF70 TX injection mode allows the transmission of a raw 802.11 transmit packet. Raw IEEE 802.11 packets are packets that are not modified by the 802.11 Medium Access Control (MAC) layer during transmission by the nRF70 Series device. -To use the TX injection mode in your application, you need to enable the :kconfig:option:`CONFIG_NRF700X_RAW_DATA_TX` Kconfig option in the project configuration. +To use the TX injection mode in your application, you need to enable the :kconfig:option:`CONFIG_NRF70_RAW_DATA_TX` Kconfig option in the project configuration. TX injection mode can be enabled during runtime by invoking the API ``net_eth_txinjection_mode``. The API has the following parameters as described below. diff --git a/doc/nrf/protocols/wifi/advanced_modes/raw_tx_operation.rst b/doc/nrf/protocols/wifi/advanced_modes/raw_tx_operation.rst index 824087ac2f4e..a94e9aa43641 100644 --- a/doc/nrf/protocols/wifi/advanced_modes/raw_tx_operation.rst +++ b/doc/nrf/protocols/wifi/advanced_modes/raw_tx_operation.rst @@ -18,7 +18,7 @@ The MAC layer on the nRF70 Series device will transmit the raw 802.11 packets ov Enabling raw packet transmit feature ************************************ -To use the raw packet transmit feature in your applications, you must enable the :kconfig:option:`CONFIG_NRF700X_RAW_DATA_TX` Kconfig option in the project configuration. +To use the raw packet transmit feature in your applications, you must enable the :kconfig:option:`CONFIG_NRF70_RAW_DATA_TX` Kconfig option in the project configuration. .. _ug_nrf70_developing_tx_injection_mode: diff --git a/doc/nrf/protocols/wifi/advanced_modes/sniffer_rx_operation.rst b/doc/nrf/protocols/wifi/advanced_modes/sniffer_rx_operation.rst index 4b1c3fa4a37e..4bcc3ee298ba 100644 --- a/doc/nrf/protocols/wifi/advanced_modes/sniffer_rx_operation.rst +++ b/doc/nrf/protocols/wifi/advanced_modes/sniffer_rx_operation.rst @@ -19,7 +19,7 @@ The raw RX header contains parameters of the received packet, including data rat Enabling Monitor mode ********************* -To use the Monitor mode in your application, you need to enable the :kconfig:option:`CONFIG_NRF700X_RAW_DATA_RX` Kconfig option in the project configuration. +To use the Monitor mode in your application, you need to enable the :kconfig:option:`CONFIG_NRF70_RAW_DATA_RX` Kconfig option in the project configuration. .. _ug_nrf70_developing_monitor_mode_operation: @@ -153,7 +153,7 @@ TX injection mode can be enabled for operation when the nRF70 Series device is c TX injection mode allows the transmission of a raw 802.11 transmit packet. Raw IEEE 802.11 packets are packets that are not modified by the 802.11 Medium Access Control (MAC) layer during transmission by the nRF70 Series device. -To use the TX injection mode in your application, you need to enable the :kconfig:option:`CONFIG_NRF700X_RAW_DATA_TX` Kconfig option in the project configuration. +To use the TX injection mode in your application, you need to enable the :kconfig:option:`CONFIG_NRF70_RAW_DATA_TX` Kconfig option in the project configuration. TX injection mode can be enabled during runtime by invoking the API ``net_eth_txinjection_mode``. The API has the following parameters as described below. diff --git a/doc/nrf/protocols/wifi/regulatory_support.rst b/doc/nrf/protocols/wifi/regulatory_support.rst index 53b4b28e84e6..49699da2f70e 100644 --- a/doc/nrf/protocols/wifi/regulatory_support.rst +++ b/doc/nrf/protocols/wifi/regulatory_support.rst @@ -272,7 +272,7 @@ You can configure the regulatory domain through build time or run time. Build time ========== -Use the :kconfig:option:`CONFIG_NRF700X_REG_DOMAIN` Kconfig option to set the regulatory region. +Use the :kconfig:option:`CONFIG_NRF70_REG_DOMAIN` Kconfig option to set the regulatory region. The regulatory region will take an ISO/IEC alpha-2 country code for the country in which the device is expected to operate. The beacon's regulatory region (if present) will be given higher precedence over the Kconfig option. diff --git a/doc/nrf/protocols/wifi/sap_mode/sap.rst b/doc/nrf/protocols/wifi/sap_mode/sap.rst index 2c5942fcfeac..ea90037c3d16 100644 --- a/doc/nrf/protocols/wifi/sap_mode/sap.rst +++ b/doc/nrf/protocols/wifi/sap_mode/sap.rst @@ -30,7 +30,7 @@ The SAP mode in the nRF70 Series devices provides SoftAP support with the follow Enabling the SAP mode ********************* -You can enable the SAP mode by setting the :kconfig:option:`CONFIG_NRF700X_AP_MODE` and :kconfig:option:`CONFIG_WPA_SUPP_AP` Kconfig options in the application project configuration file. +You can enable the SAP mode by setting the :kconfig:option:`CONFIG_NRF70_AP_MODE` and :kconfig:option:`CONFIG_WPA_SUPP_AP` Kconfig options in the application project configuration file. SAP mode configuration diff --git a/doc/nrf/protocols/wifi/scan_mode/scan_operation.rst b/doc/nrf/protocols/wifi/scan_mode/scan_operation.rst index 38e835c1b7de..202acec1da4b 100644 --- a/doc/nrf/protocols/wifi/scan_mode/scan_operation.rst +++ b/doc/nrf/protocols/wifi/scan_mode/scan_operation.rst @@ -145,7 +145,7 @@ The following controls can fine-tune the time taken and power consumed by a scan | :c:member:`wifi_scan_params.chan` * - Skip locally administered MAC addresses - | Build time: - | :kconfig:option:`CONFIG_WIFI_NRF700X_SKIP_LOCAL_ADMIN_MAC` + | :kconfig:option:`CONFIG_WIFI_NRF70_SKIP_LOCAL_ADMIN_MAC` Scan robustness *************** diff --git a/doc/nrf/protocols/wifi/stack_configuration.rst b/doc/nrf/protocols/wifi/stack_configuration.rst index f72fbcec9b21..511eac9daecd 100644 --- a/doc/nrf/protocols/wifi/stack_configuration.rst +++ b/doc/nrf/protocols/wifi/stack_configuration.rst @@ -69,19 +69,19 @@ The nRF Wi-Fi driver provides the following software configurations to fine-tune - Memory savings - This specifies the inclusion of the WPA supplicant module. Disabling this flag restricts the nRF Wi-Fi driver's functionality to STA scan only. - * - :kconfig:option:`CONFIG_NRF700X_AP_MODE` + * - :kconfig:option:`CONFIG_NRF70_AP_MODE` - ``y`` or ``n`` - Enable or disable Access Point (AP) mode - Memory savings - This specifies the inclusion of the AP mode module. Disabling this flag restricts the nRF Wi-Fi driver's functionality to :term:`Station mode (STA)` only. - * - :kconfig:option:`CONFIG_NRF700X_P2P_MODE` + * - :kconfig:option:`CONFIG_NRF70_P2P_MODE` - ``y`` or ``n`` - Enable or disable Wi-Fi direct mode - Memory Savings - This specifies the inclusion of the P2P mode module. Disabling this flag restricts the nRF Wi-Fi driver's functionality to STA or AP mode only. - * - :kconfig:option:`CONFIG_NRF700X_MAX_TX_TOKENS` + * - :kconfig:option:`CONFIG_NRF70_MAX_TX_TOKENS` - ``5``, ``10``, ``11``, ``12`` - Maximum number of TX tokens. These are distributed across all WMM® access categories (including a pool for all). @@ -90,27 +90,27 @@ The nRF Wi-Fi driver provides the following software configurations to fine-tune More tokens imply more concurrent transmit opportunities for RPU but can lead to poor aggregation performance if the pipeline is not saturated. But to saturate the pipeline, a greater number of networking stack buffers, or queue depth, is required. - * - :kconfig:option:`CONFIG_NRF700X_MAX_TX_AGGREGATION` + * - :kconfig:option:`CONFIG_NRF70_MAX_TX_AGGREGATION` - ``1`` to ``Unlimited`` (based on available memory in nRF70 Series device) - Maximum number of frames that are coalesced into a single Wi-Fi frame (for example, MPDU's in an A-MPDU, or MSDU's in an A-MSDU). The coalescing greatly improves the throughput for small frames or under high traffic load. - Performance tuning and Memory savings - This specifies the maximum number of frames that can be coalesced into a single Wi-Fi frame. More frames imply more coalescing opportunities but can add latency to the TX path as we wait for more frames to arrive. - * - :kconfig:option:`CONFIG_NRF700X_RX_NUM_BUFS` + * - :kconfig:option:`CONFIG_NRF70_RX_NUM_BUFS` - ``1`` to ``Unlimited`` (based on available memory in nRF70 Series device) - Number of RX buffers - Memory savings - This specifies the number of RX buffers that can be used by the nRF Wi-Fi driver. The number of buffers must be enough to keep up with the RX traffic, otherwise packets might be dropped. - * - :kconfig:option:`CONFIG_NRF700X_TX_MAX_DATA_SIZE` + * - :kconfig:option:`CONFIG_NRF70_TX_MAX_DATA_SIZE` - ``64`` to ``1600`` - Maximum TX data size - Memory savings - This specifies the maximum size of Wi-Fi protocol frames that can be transmitted. Large frame sizes imply more memory usage but can efficiently utilize the bandwidth. If the application does not need to send large frames, then this can be reduced to save memory. - * - :kconfig:option:`CONFIG_NRF700X_RX_MAX_DATA_SIZE` + * - :kconfig:option:`CONFIG_NRF70_RX_MAX_DATA_SIZE` - ``64`` to ``1600`` - Maximum RX data size - Memory savings @@ -129,30 +129,30 @@ nRF70 Series packet memory The nRF70 Series device chipset has a special memory called the packet memory to store the Wi-Fi protocol frames for both TX and RX. The various configuration options that control the size of the packet memory are listed below: -* :kconfig:option:`CONFIG_NRF700X_TX_MAX_DATA_SIZE` -* :kconfig:option:`CONFIG_NRF700X_RX_MAX_DATA_SIZE` -* :kconfig:option:`CONFIG_NRF700X_MAX_TX_TOKENS` -* :kconfig:option:`CONFIG_NRF700X_MAX_TX_AGGREGATION` -* :kconfig:option:`CONFIG_NRF700X_RX_NUM_BUFS` +* :kconfig:option:`CONFIG_NRF70_TX_MAX_DATA_SIZE` +* :kconfig:option:`CONFIG_NRF70_RX_MAX_DATA_SIZE` +* :kconfig:option:`CONFIG_NRF70_MAX_TX_TOKENS` +* :kconfig:option:`CONFIG_NRF70_MAX_TX_AGGREGATION` +* :kconfig:option:`CONFIG_NRF70_RX_NUM_BUFS` The packet memory is divided into two parts, one for TX and one for RX. The size of the TX packet memory is calculated as follows: .. code-block:: none - (CONFIG_NRF700X_TX_MAX_DATA_SIZE + 52 ) * CONFIG_NRF700X_MAX_TX_TOKENS * CONFIG_NRF700X_MAX_TX_AGGREGATION + (CONFIG_NRF70_TX_MAX_DATA_SIZE + 52 ) * CONFIG_NRF70_MAX_TX_TOKENS * CONFIG_NRF70_MAX_TX_AGGREGATION The size of the RX packet memory is calculated as follows: .. code-block:: none - CONFIG_NRF700X_RX_MAX_DATA_SIZE * CONFIG_NRF700X_RX_NUM_BUFS + CONFIG_NRF70_RX_MAX_DATA_SIZE * CONFIG_NRF70_RX_NUM_BUFS The total packet memory size is calculated as follows: .. code-block:: none - (CONFIG_NRF700X_TX_MAX_DATA_SIZE + 52 ) * CONFIG_NRF700X_MAX_TX_TOKENS * CONFIG_NRF700X_MAX_TX_AGGREGATION + - CONFIG_NRF700X_RX_MAX_DATA_SIZE * CONFIG_NRF700X_RX_NUM_BUFS + (CONFIG_NRF70_TX_MAX_DATA_SIZE + 52 ) * CONFIG_NRF70_MAX_TX_TOKENS * CONFIG_NRF70_MAX_TX_AGGREGATION + + CONFIG_NRF70_RX_MAX_DATA_SIZE * CONFIG_NRF70_RX_NUM_BUFS There is a build time check to ensure that the total packet memory size does not exceed the available packet memory size in the nRF70 Series chip. @@ -177,8 +177,8 @@ The nRF Wi-Fi driver can be used in the following profiles (not an exhaustive li * - STA scan only - Scan only - ``CONFIG_WPA_SUPP=n`` - ``CONFIG_NRF700X_AP_MODE=n`` - ``CONFIG_NRF700X_P2P_MODE=n`` + ``CONFIG_NRF70_AP_MODE=n`` + ``CONFIG_NRF70_P2P_MODE=n`` ``CONFIG_NET_PKT_TX_COUNT=1`` ``CONFIG_NET_PKT_RX_COUNT=1`` ``CONFIG_NET_BUF_TX_COUNT=1`` @@ -188,19 +188,19 @@ The nRF Wi-Fi driver can be used in the following profiles (not an exhaustive li * - :abbr:`STA (Station)` mode - IoT devices - ``CONFIG_WPA_SUPP=y`` - ``CONFIG_NRF700X_AP_MODE=n`` - ``CONFIG_NRF700X_P2P_MODE=n`` + ``CONFIG_NRF70_AP_MODE=n`` + ``CONFIG_NRF70_P2P_MODE=n`` ``CONFIG_NET_PKT_TX_COUNT=6`` ``CONFIG_NET_PKT_RX_COUNT=6`` ``CONFIG_NET_BUF_TX_COUNT=12`` ``CONFIG_NET_BUF_RX_COUNT=6`` - ``CONFIG_NRF700X_RX_NUM_BUFS=6`` + ``CONFIG_NRF70_RX_NUM_BUFS=6`` ``CONFIG_NET_BUF_DATA_SIZE=800`` ``CONFIG_HEAP_MEM_POOL_SIZE=230000`` ``CONFIG_SPEED_OPTIMIZATIONS=y`` - ``CONFIG_NRF700X_UTIL=n`` - ``CONFIG_NRF700X_MAX_TX_AGGREGATION=1`` - ``CONFIG_NRF700X_MAX_TX_TOKENS=5`` + ``CONFIG_NRF70_UTIL=n`` + ``CONFIG_NRF70_MAX_TX_AGGREGATION=1`` + ``CONFIG_NRF70_MAX_TX_TOKENS=5`` - IoT devices - ``TCP-TX: 5.2 Mbps`` ``TCP-RX: 3.4 Mbps`` @@ -209,19 +209,19 @@ The nRF Wi-Fi driver can be used in the following profiles (not an exhaustive li * - :abbr:`STA (Station)` mode - Memory optimized :abbr:`STA (Station)` mode - ``CONFIG_WPA_SUPP=y`` - ``CONFIG_NRF700X_AP_MODE=n`` - ``CONFIG_NRF700X_P2P_MODE=n`` + ``CONFIG_NRF70_AP_MODE=n`` + ``CONFIG_NRF70_P2P_MODE=n`` ``CONFIG_NET_PKT_TX_COUNT=6`` ``CONFIG_NET_PKT_RX_COUNT=6`` ``CONFIG_NET_BUF_TX_COUNT=12`` ``CONFIG_NET_BUF_RX_COUNT=6`` - ``CONFIG_NRF700X_RX_NUM_BUFS=6`` + ``CONFIG_NRF70_RX_NUM_BUFS=6`` ``CONFIG_NET_BUF_DATA_SIZE=500`` ``CONFIG_HEAP_MEM_POOL_SIZE=230000`` ``CONFIG_SPEED_OPTIMIZATIONS=y`` - ``CONFIG_NRF700X_UTIL=n`` - ``CONFIG_NRF700X_MAX_TX_AGGREGATION=1`` - ``CONFIG_NRF700X_MAX_TX_TOKENS=5`` + ``CONFIG_NRF70_UTIL=n`` + ``CONFIG_NRF70_MAX_TX_AGGREGATION=1`` + ``CONFIG_NRF70_MAX_TX_TOKENS=5`` - Sensors with low data requirements - ``TCP-TX: 0.3 Mbps`` ``TCP-RX: 1.5 Mbps`` @@ -230,8 +230,8 @@ The nRF Wi-Fi driver can be used in the following profiles (not an exhaustive li * - :abbr:`STA (Station)` mode - High performance :abbr:`STA (Station)` mode - ``CONFIG_WPA_SUPP=y`` - ``CONFIG_NRF700X_AP_MODE=n`` - ``CONFIG_NRF700X_P2P_MODE=n`` + ``CONFIG_NRF70_AP_MODE=n`` + ``CONFIG_NRF70_P2P_MODE=n`` ``CONFIG_NET_PKT_TX_COUNT=30`` ``CONFIG_NET_PKT_RX_COUNT=30`` ``CONFIG_NET_BUF_TX_COUNT=60`` @@ -239,9 +239,9 @@ The nRF Wi-Fi driver can be used in the following profiles (not an exhaustive li ``CONFIG_NET_BUF_DATA_SIZE=1100`` ``CONFIG_HEAP_MEM_POOL_SIZE=230000`` ``CONFIG_SPEED_OPTIMIZATIONS=y`` - ``CONFIG_NRF700X_UTIL=n`` - ``CONFIG_NRF700X_MAX_TX_AGGREGATION=9`` - ``CONFIG_NRF700X_MAX_TX_TOKENS=12`` + ``CONFIG_NRF70_UTIL=n`` + ``CONFIG_NRF70_MAX_TX_AGGREGATION=9`` + ``CONFIG_NRF70_MAX_TX_TOKENS=12`` - High data rate IoT devices - ``TCP-TX: 14.2 Mbps`` ``TCP-RX: 7.4 Mbps`` @@ -250,19 +250,19 @@ The nRF Wi-Fi driver can be used in the following profiles (not an exhaustive li * - :abbr:`STA (Station)` mode - TX prioritized :abbr:`STA (Station)` mode - ``CONFIG_WPA_SUPP=y`` - ``CONFIG_NRF700X_AP_MODE=n`` - ``CONFIG_NRF700X_P2P_MODE=n`` + ``CONFIG_NRF70_AP_MODE=n`` + ``CONFIG_NRF70_P2P_MODE=n`` ``CONFIG_NET_PKT_TX_COUNT=32`` ``CONFIG_NET_PKT_RX_COUNT=10`` ``CONFIG_NET_BUF_TX_COUNT=64`` ``CONFIG_NET_BUF_RX_COUNT=10`` - ``CONFIG_NRF700X_RX_NUM_BUFS=10`` + ``CONFIG_NRF70_RX_NUM_BUFS=10`` ``CONFIG_NET_BUF_DATA_SIZE=1100`` ``CONFIG_HEAP_MEM_POOL_SIZE=230000`` ``CONFIG_SPEED_OPTIMIZATIONS=y`` - ``CONFIG_NRF700X_UTIL=n`` - ``CONFIG_NRF700X_MAX_TX_AGGREGATION=9`` - ``CONFIG_NRF700X_MAX_TX_TOKENS=12`` + ``CONFIG_NRF70_UTIL=n`` + ``CONFIG_NRF70_MAX_TX_AGGREGATION=9`` + ``CONFIG_NRF70_MAX_TX_TOKENS=12`` - Sensors with high data rate - ``TCP-TX: 9.2 Mbps`` ``TCP-RX: 3.6 Mbps`` @@ -271,19 +271,19 @@ The nRF Wi-Fi driver can be used in the following profiles (not an exhaustive li * - :abbr:`STA (Station)` mode - RX prioritized :abbr:`STA (Station)` mode - ``CONFIG_WPA_SUPP=y`` - ``CONFIG_NRF700X_AP_MODE=n`` - ``CONFIG_NRF700X_P2P_MODE=n`` + ``CONFIG_NRF70_AP_MODE=n`` + ``CONFIG_NRF70_P2P_MODE=n`` ``CONFIG_NET_PKT_TX_COUNT=5`` ``CONFIG_NET_PKT_RX_COUNT=64`` ``CONFIG_NET_BUF_TX_COUNT=10`` ``CONFIG_NET_BUF_RX_COUNT=64`` - ``CONFIG_NRF700X_RX_NUM_BUFS=64`` + ``CONFIG_NRF70_RX_NUM_BUFS=64`` ``CONFIG_NET_BUF_DATA_SIZE=1100`` ``CONFIG_HEAP_MEM_POOL_SIZE=230000`` ``CONFIG_SPEED_OPTIMIZATIONS=y`` - ``CONFIG_NRF700X_UTIL=n`` - ``CONFIG_NRF700X_MAX_TX_AGGREGATION=2`` - ``CONFIG_NRF700X_MAX_TX_TOKENS=5`` + ``CONFIG_NRF70_UTIL=n`` + ``CONFIG_NRF70_MAX_TX_AGGREGATION=2`` + ``CONFIG_NRF70_MAX_TX_TOKENS=5`` - Display devices streaming data - ``TCP-TX: 5.3 Mbps`` ``TCP-RX: 7.9 Mbps`` diff --git a/doc/nrf/releases_and_maturity/migration/migration_sysbuild.rst b/doc/nrf/releases_and_maturity/migration/migration_sysbuild.rst index 3a1ea1f7a1ee..710bb25d30ec 100644 --- a/doc/nrf/releases_and_maturity/migration/migration_sysbuild.rst +++ b/doc/nrf/releases_and_maturity/migration/migration_sysbuild.rst @@ -255,24 +255,24 @@ Applications must enable these options if they generate factory data or need an .. _child_parent_to_sysbuild_migration_nrf700x: -nRF700x -======= +nRF70 Series +============ -Support for nRF700x operating mode and firmware storage has moved to sysbuild. +Support for the nRF70 Series operating mode and firmware storage has moved to sysbuild. The following Kconfig options are available: +----------------------------------------------------------------+-----------------------------------------------------------------------------+ | Kconfig option | Description | +================================================================+=============================================================================+ -| ``SB_CONFIG_WIFI_NRF700X`` | Enable Wifi support for nRF700x | +| ``SB_CONFIG_WIFI_NRF70`` | Enable Wifi support for the nRF70 Series devices | +----------------------------------------------------------------+-----------------------------------------------------------------------------+ -| ``SB_CONFIG_WIFI_NRF700X_SYSTEM_MODE`` | Use system mode firmware patches and set application to this mode | +| ``SB_CONFIG_WIFI_NRF70_SYSTEM_MODE`` | Use system mode firmware patches and set application to this mode | +----------------------------------------------------------------+-----------------------------------------------------------------------------+ -| ``SB_CONFIG_WIFI_NRF700X_SCAN_ONLY`` | Use scan-only mode firmware patches and set application to this mode | +| ``SB_CONFIG_WIFI_NRF70_SCAN_ONLY`` | Use Scan-only mode firmware patches and set application to this mode | +----------------------------------------------------------------+-----------------------------------------------------------------------------+ -| ``SB_CONFIG_WIFI_NRF700X_RADIO_TEST`` | Use radio test mode firmware patches and set application to this mode | +| ``SB_CONFIG_WIFI_NRF70_RADIO_TEST`` | Use Radio Test mode firmware patches and set application to this mode | +----------------------------------------------------------------+-----------------------------------------------------------------------------+ -| ``SB_CONFIG_WIFI_NRF700X_SYSTEM_WITH_RAW_MODES`` | Use system with raw modes firmware patches and set application to this mode | +| ``SB_CONFIG_WIFI_NRF70_SYSTEM_WITH_RAW_MODES`` | Use system with Raw modes firmware patches and set application to this mode | +----------------------------------------------------------------+-----------------------------------------------------------------------------+ | ``SB_CONFIG_WIFI_PATCHES_EXT_FLASH_DISABLED`` | Load firmware patches directly from ram (default) | +----------------------------------------------------------------+-----------------------------------------------------------------------------+ @@ -304,7 +304,7 @@ The following Kconfig options are available: +-------------------------------------------------------------------+---------------------------------------------------+ | ``SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_MCUBOOT`` | Include MCUboot update in package | +-------------------------------------------------------------------+---------------------------------------------------+ -| ``SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_WIFI_FW_PATCH`` | Include nRF7000x firmware patch update in package | +| ``SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_WIFI_FW_PATCH`` | Include nRF70 firmware patch update in package | +-------------------------------------------------------------------+---------------------------------------------------+ You must update your application to select the required Kconfig options at the sysbuild level to have this file generated. diff --git a/doc/nrf/releases_and_maturity/releases/release-notes-2.4.0.rst b/doc/nrf/releases_and_maturity/releases/release-notes-2.4.0.rst index 630697cd785a..6f5724bd6647 100644 --- a/doc/nrf/releases_and_maturity/releases/release-notes-2.4.0.rst +++ b/doc/nrf/releases_and_maturity/releases/release-notes-2.4.0.rst @@ -653,7 +653,7 @@ Drivers This section provides detailed lists of changes by :ref:`driver `. -* Added :ref:`nrf700x_wifi`. +* Added nRF Wi-Fi driver. Libraries ========= diff --git a/doc/nrf/releases_and_maturity/releases/release-notes-2.6.0.rst b/doc/nrf/releases_and_maturity/releases/release-notes-2.6.0.rst index 3076320558c2..572172aa6a91 100644 --- a/doc/nrf/releases_and_maturity/releases/release-notes-2.6.0.rst +++ b/doc/nrf/releases_and_maturity/releases/release-notes-2.6.0.rst @@ -998,7 +998,7 @@ Wi-Fi drivers * OS agnostic code is moved to |NCS| (``sdk-nrfxlib``) repository. - * Low-level API documentation is now available on the :ref:`Wi-Fi driver API `. + * Low-level API documentation is now available on the ``Wi-Fi driver API``. * The Wi-Fi interface is now renamed and registered as a devicetree instance. diff --git a/lib/location/scan_wifi.c b/lib/location/scan_wifi.c index 5b6285f4d2f7..f667664b5c4a 100644 --- a/lib/location/scan_wifi.c +++ b/lib/location/scan_wifi.c @@ -214,7 +214,7 @@ int scan_wifi_init(void) const struct device *wifi_dev; wifi_iface = NULL; -#if defined(CONFIG_WIFI_NRF700X) +#if defined(CONFIG_WIFI_NRF70) wifi_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_wifi)); #else wifi_dev = DEVICE_DT_GET(DT_CHOSEN(ncs_location_wifi)); diff --git a/samples/Kconfig b/samples/Kconfig index 8ebec34b1070..4b9b6eb6c6b5 100644 --- a/samples/Kconfig +++ b/samples/Kconfig @@ -19,7 +19,7 @@ config NCS_SAMPLES_DEFAULTS if SOC_SERIES_NRF53X -config NRF700X_RADIO_TEST_COMBO +config NRF70_RADIO_TEST_COMBO bool "Enable radio test combo build for nRF5340" depends on SOC_NRF5340_CPUAPP select BOARD_ENABLE_CPUNET @@ -34,9 +34,9 @@ config NCS_SAMPLE_EMPTY_APP_CORE_CHILD_IMAGE config NCS_INCLUDE_RPMSG_CHILD_IMAGE bool "Include RPMsg sample on netcore" - depends on SOC_NRF5340_CPUAPP && (BT_HCI_IPC || NRF_802154_SER_HOST || BT_RPC || NRF700X_RADIO_TEST_COMBO) + depends on SOC_NRF5340_CPUAPP && (BT_HCI_IPC || NRF_802154_SER_HOST || BT_RPC || NRF70_RADIO_TEST_COMBO) select PARTITION_MANAGER_ENABLED - default y if BT_HCI_IPC || NRF_802154_SER_HOST || BT_RPC || NRF700X_RADIO_TEST_COMBO + default y if BT_HCI_IPC || NRF_802154_SER_HOST || BT_RPC || NRF70_RADIO_TEST_COMBO help Enabling this setting will include a network stack to run on the network core and communicate over RPMsg with the application core. @@ -74,35 +74,35 @@ if NCS_INCLUDE_RPMSG_CHILD_IMAGE config NCS_SAMPLE_MULTIPROTOCOL_RPMSG_CHILD_IMAGE bool - depends on BT_HCI_IPC && NRF_802154_SER_HOST && !BT_RPC && !NRF700X_RADIO_TEST_COMBO + depends on BT_HCI_IPC && NRF_802154_SER_HOST && !BT_RPC && !NRF70_RADIO_TEST_COMBO default y help multiprotocol_rpmsg sample as a child image (network core). config NCS_SAMPLE_HCI_IPC_CHILD_IMAGE bool - depends on BT_HCI_IPC && !NRF_802154_SER_HOST && !BT_RPC && !NRF700X_RADIO_TEST_COMBO + depends on BT_HCI_IPC && !NRF_802154_SER_HOST && !BT_RPC && !NRF70_RADIO_TEST_COMBO default y help hci_ipc sample as a child image (network core). config NCS_SAMPLE_802154_RPMSG_CHILD_IMAGE bool - depends on NRF_802154_SER_HOST && !BT_HCI_IPC && !BT_RPC && !NRF700X_RADIO_TEST_COMBO + depends on NRF_802154_SER_HOST && !BT_HCI_IPC && !BT_RPC && !NRF70_RADIO_TEST_COMBO default y help 802154_rpmsg sample as a child image (network core). config NCS_SAMPLE_RPC_HOST_CHILD_IMAGE bool - depends on BT_RPC && !NRF700X_RADIO_TEST_COMBO + depends on BT_RPC && !NRF70_RADIO_TEST_COMBO default y help rpc_host sample as a child image (network core). config NCS_SAMPLE_PERIPHERAL_RADIO_TEST_CHILD_IMAGE bool "Add peripheral radio_test sample as a child image" - depends on NRF700X_RADIO_TEST_COMBO + depends on NRF70_RADIO_TEST_COMBO default y select PARTITION_MANAGER_ENABLED help diff --git a/samples/cellular/location/overlay-nrf700x-wifi-scan-only.conf b/samples/cellular/location/overlay-nrf700x-wifi-scan-only.conf index 04a94d6d4263..b00d65a3f0a9 100644 --- a/samples/cellular/location/overlay-nrf700x-wifi-scan-only.conf +++ b/samples/cellular/location/overlay-nrf700x-wifi-scan-only.conf @@ -21,8 +21,8 @@ CONFIG_LOCATION_WORKQUEUE_STACK_SIZE=8192 # Actual configs for the Wi-Fi CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y -CONFIG_WIFI_NRF700X_SKIP_LOCAL_ADMIN_MAC=y +CONFIG_WIFI_NRF70=y +CONFIG_WIFI_NRF70_SKIP_LOCAL_ADMIN_MAC=y # Align this with CONFIG_LOCATION_METHOD_WIFI_SCANNING_RESULTS_MAX_CNT. # Also see comments for CONFIG_HEAP_MEM_POOL_SIZE. CONFIG_NRF_WIFI_SCAN_MAX_BSS_CNT=60 diff --git a/samples/cellular/location/sample.yaml b/samples/cellular/location/sample.yaml index b19f663aeaae..9f5160789fcf 100644 --- a/samples/cellular/location/sample.yaml +++ b/samples/cellular/location/sample.yaml @@ -42,7 +42,7 @@ tests: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns extra_args: SHIELD=nrf7002ek OVERLAY_CONFIG=overlay-nrf700x-wifi-scan-only.conf - SB_CONFIG_WIFI_NRF700X=y SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.location.nrf7000ek_wifi: sysbuild: true @@ -56,8 +56,8 @@ tests: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns extra_args: SHIELD=nrf7002ek_nrf7000 OVERLAY_CONFIG=overlay-nrf700x-wifi-scan-only.conf - CONFIG_WPA_SUPP=n SB_CONFIG_WIFI_NRF700X=y - SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + CONFIG_WPA_SUPP=n SB_CONFIG_WIFI_NRF70=y + SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.location.nrf7001ek_wifi: sysbuild: true @@ -71,7 +71,7 @@ tests: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns extra_args: SHIELD=nrf7002ek_nrf7001 OVERLAY_CONFIG=overlay-nrf700x-wifi-scan-only.conf - SB_CONFIG_WIFI_NRF700X=y SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.location.thingy91x_wifi: sysbuild: true @@ -82,7 +82,7 @@ tests: - thingy91x/nrf9151/ns extra_args: OVERLAY_CONFIG=overlay-nrf700x-wifi-scan-only.conf DTC_OVERLAY_FILE=thingy91x_wifi.overlay - SB_CONFIG_WIFI_NRF700X=y SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular # Configuration which will be used by the CI positioning integration job to verify PRs diff --git a/samples/cellular/lwm2m_client/overlay-assist-wifi.conf b/samples/cellular/lwm2m_client/overlay-assist-wifi.conf index 789e9bd3af25..e3af40f6620f 100644 --- a/samples/cellular/lwm2m_client/overlay-assist-wifi.conf +++ b/samples/cellular/lwm2m_client/overlay-assist-wifi.conf @@ -37,7 +37,7 @@ CONFIG_DK_LIBRARY=n # Actual configs for the Wi-Fi CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y +CONFIG_WIFI_NRF70=y CONFIG_NET_L2_WIFI_MGMT=y # Scan only using offload API diff --git a/samples/cellular/modem_shell/README.rst b/samples/cellular/modem_shell/README.rst index ade404af38c8..bc100dd2c92c 100644 --- a/samples/cellular/modem_shell/README.rst +++ b/samples/cellular/modem_shell/README.rst @@ -1066,13 +1066,13 @@ To program the certificates and connect to nRF Cloud, complete the following ste nRF91 Series DK with nRF7002 EK Wi-Fi support ============================================= -To build the MoSh sample for an nRF91 Series DK with nRF7002 EK Wi-Fi support, use the ``-DSHIELD=nrf7002ek``, ``-DEXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf``, ``-DSB_CONFIG_WIFI_NRF700X=y`` and ``-DSB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y`` options. +To build the MoSh sample for an nRF91 Series DK with nRF7002 EK Wi-Fi support, use the ``-DSHIELD=nrf7002ek``, ``-DEXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf``, ``-DSB_CONFIG_WIFI_NRF70=y`` and ``-DSB_CONFIG_WIFI_NRF70_SCAN_ONLY=y`` options. For example: .. parsed-literal:: :class: highlight - west build -p -b *board_target* -- -DSHIELD=nrf7002ek -DEXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf -DSB_CONFIG_WIFI_NRF700X=y -DSB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + west build -p -b *board_target* -- -DSHIELD=nrf7002ek -DEXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf -DSB_CONFIG_WIFI_NRF70=y -DSB_CONFIG_WIFI_NRF70_SCAN_ONLY=y |board_target| @@ -1081,12 +1081,12 @@ See :ref:`cmake_options` for more instructions on how to add these options. Thingy:91 X Wi-Fi support ========================= -To build the MoSh sample with Thingy:91 X Wi-Fi support, use the ``-DDTC_OVERLAY_FILE=thingy91x_wifi.overlay``, ``-DEXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf``, ``-DSB_CONFIG_WIFI_NRF700X=y``, and ``-DSB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y`` options. +To build the MoSh sample with Thingy:91 X Wi-Fi support, use the ``-DDTC_OVERLAY_FILE=thingy91x_wifi.overlay``, ``-DEXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf``, ``-DSB_CONFIG_WIFI_NRF70=y``, and ``-DSB_CONFIG_WIFI_NRF70_SCAN_ONLY=y`` options. For example: .. code-block:: console - west build -p -b thingy91x/nrf9151/ns -- -DDTC_OVERLAY_FILE=thingy91x_wifi.overlay -DEXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf -DSB_CONFIG_WIFI_NRF700X=y -DSB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + west build -p -b thingy91x/nrf9151/ns -- -DDTC_OVERLAY_FILE=thingy91x_wifi.overlay -DEXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf -DSB_CONFIG_WIFI_NRF70=y -DSB_CONFIG_WIFI_NRF70_SCAN_ONLY=y See :ref:`cmake_options` for more instructions on how to add these options. diff --git a/samples/cellular/modem_shell/overlay-nrf700x-wifi-scan-only.conf b/samples/cellular/modem_shell/overlay-nrf700x-wifi-scan-only.conf index 24ef4465e9e4..985addc4cc52 100644 --- a/samples/cellular/modem_shell/overlay-nrf700x-wifi-scan-only.conf +++ b/samples/cellular/modem_shell/overlay-nrf700x-wifi-scan-only.conf @@ -31,8 +31,8 @@ CONFIG_MOSH_CURL=n # Actual configs for the Wi-Fi CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y -CONFIG_WIFI_NRF700X_SKIP_LOCAL_ADMIN_MAC=y +CONFIG_WIFI_NRF70=y +CONFIG_WIFI_NRF70_SKIP_LOCAL_ADMIN_MAC=y # Align this with CONFIG_LOCATION_METHOD_WIFI_SCANNING_RESULTS_MAX_CNT. # Also see comments for CONFIG_HEAP_MEM_POOL_SIZE. CONFIG_NRF_WIFI_SCAN_MAX_BSS_CNT=50 diff --git a/samples/cellular/modem_shell/sample.yaml b/samples/cellular/modem_shell/sample.yaml index 1f25b1802bbc..9f44090c16c9 100644 --- a/samples/cellular/modem_shell/sample.yaml +++ b/samples/cellular/modem_shell/sample.yaml @@ -96,7 +96,7 @@ tests: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf - SB_CONFIG_WIFI_NRF700X=y SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.modem_shell.nrf7000ek_wifi: sysbuild: true @@ -110,8 +110,8 @@ tests: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns extra_args: SHIELD=nrf7002ek_nrf7000 EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf - CONFIG_WPA_SUPP=n SB_CONFIG_WIFI_NRF700X=y - SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + CONFIG_WPA_SUPP=n SB_CONFIG_WIFI_NRF70=y + SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.modem_shell.nrf7001ek_wifi: sysbuild: true @@ -125,7 +125,7 @@ tests: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns extra_args: SHIELD=nrf7002ek_nrf7001 EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf - SB_CONFIG_WIFI_NRF700X=y SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.modem_shell.nrf7002ek_wifi-debug: sysbuild: true @@ -140,7 +140,7 @@ tests: - nrf9161dk/nrf9161/ns extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE="overlay-nrf700x-wifi-scan-only.conf;overlay-debug.conf" - SB_CONFIG_WIFI_NRF700X=y SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.modem_shell.app_fota: sysbuild: true @@ -271,7 +271,7 @@ tests: - CONFIG_NRF_CLOUD_PGPS_TRANSPORT_NONE=y extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE="overlay-cloud_mqtt.conf;overlay-pgps.conf;overlay-nrf700x-wifi-scan-only.conf" - SB_CONFIG_WIFI_NRF700X=y SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y integration_platforms: - nrf9151dk/nrf9151/ns - nrf9160dk/nrf9160/ns @@ -334,7 +334,7 @@ tests: - thingy91x/nrf9151/ns extra_args: EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf DTC_OVERLAY_FILE=thingy91x_wifi.overlay - SB_CONFIG_WIFI_NRF700X=y SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.modem_shell.modem_trace_shell_ext_flash: sysbuild: true @@ -382,7 +382,7 @@ tests: - CONFIG_LOCATION_METHOD_CELLULAR=n - CONFIG_LOCATION_METHOD_WIFI=y extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf - SB_CONFIG_WIFI_NRF700X=y SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.modem_shell.location_wifi_cellular_no_gnss: sysbuild: true @@ -400,7 +400,7 @@ tests: - CONFIG_LOCATION_METHOD_CELLULAR=y - CONFIG_LOCATION_METHOD_WIFI=y extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf - SB_CONFIG_WIFI_NRF700X=y SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.modem_shell.location_wifi_no_cellular_no_gnss: sysbuild: true @@ -418,7 +418,7 @@ tests: - CONFIG_LOCATION_METHOD_CELLULAR=n - CONFIG_LOCATION_METHOD_WIFI=y extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf - SB_CONFIG_WIFI_NRF700X=y SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.modem_shell.location_gnss_no_wifi_no_cellular: sysbuild: true @@ -471,7 +471,7 @@ tests: - CONFIG_LOCATION_METHOD_CELLULAR=y - CONFIG_LOCATION_METHOD_WIFI=y extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf - SB_CONFIG_WIFI_NRF700X=y SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.modem_shell.location_gnss_no_wifi_no_cellular_details: sysbuild: true @@ -507,7 +507,7 @@ tests: - CONFIG_LOCATION_METHOD_CELLULAR=y - CONFIG_LOCATION_METHOD_WIFI=y extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf - SB_CONFIG_WIFI_NRF700X=y SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y + SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.modem_shell.location_gnss_cellular_no_wifi_details: sysbuild: true diff --git a/samples/cellular/nrf_cloud_multi_service/overlay-nrf7002ek-wifi-scan-only.conf b/samples/cellular/nrf_cloud_multi_service/overlay-nrf7002ek-wifi-scan-only.conf index a4c5b57b6c07..e84ee9454f34 100644 --- a/samples/cellular/nrf_cloud_multi_service/overlay-nrf7002ek-wifi-scan-only.conf +++ b/samples/cellular/nrf_cloud_multi_service/overlay-nrf7002ek-wifi-scan-only.conf @@ -16,8 +16,8 @@ CONFIG_LOCATION_WORKQUEUE_STACK_SIZE=8192 # Enable Wi-Fi drivers CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y -CONFIG_WIFI_NRF700X_SKIP_LOCAL_ADMIN_MAC=y +CONFIG_WIFI_NRF70=y +CONFIG_WIFI_NRF70_SKIP_LOCAL_ADMIN_MAC=y # Align this with CONFIG_LOCATION_METHOD_WIFI_SCANNING_RESULTS_MAX_CNT. # Also see comments for CONFIG_HEAP_MEM_POOL_SIZE. CONFIG_NRF_WIFI_SCAN_MAX_BSS_CNT=20 diff --git a/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_coap_no_lte.conf b/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_coap_no_lte.conf index 10b9c1188699..1c46ad792c4f 100644 --- a/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_coap_no_lte.conf +++ b/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_coap_no_lte.conf @@ -88,8 +88,8 @@ CONFIG_NET_SOCKETS_DNS_TIMEOUT=30000 ## Enable Wi-Fi drivers, (and the native NET stack so that the location library can access them) CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y -CONFIG_WIFI_NRF700X_SKIP_LOCAL_ADMIN_MAC=y +CONFIG_WIFI_NRF70=y +CONFIG_WIFI_NRF70_SKIP_LOCAL_ADMIN_MAC=y ## Enable Wi-Fi conn_mgr bindings CONFIG_L2_WIFI_CONNECTIVITY=y diff --git a/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_no_lte.conf b/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_no_lte.conf index ffe96f02e7b8..03d0e616c8da 100644 --- a/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_no_lte.conf +++ b/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_no_lte.conf @@ -87,8 +87,8 @@ CONFIG_NET_SOCKETS_DNS_TIMEOUT=30000 ## Enable Wi-Fi drivers, (and the native NET stack so that the location library can access them) CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y -CONFIG_WIFI_NRF700X_SKIP_LOCAL_ADMIN_MAC=y +CONFIG_WIFI_NRF70=y +CONFIG_WIFI_NRF70_SKIP_LOCAL_ADMIN_MAC=y ## Enable Wi-Fi conn_mgr bindings CONFIG_L2_WIFI_CONNECTIVITY=y diff --git a/samples/cellular/nrf_cloud_multi_service/sysbuild_nrf700x-wifi-conn.conf b/samples/cellular/nrf_cloud_multi_service/sysbuild_nrf700x-wifi-conn.conf index e7faf6f71cc4..4d19da213751 100644 --- a/samples/cellular/nrf_cloud_multi_service/sysbuild_nrf700x-wifi-conn.conf +++ b/samples/cellular/nrf_cloud_multi_service/sysbuild_nrf700x-wifi-conn.conf @@ -4,8 +4,8 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -SB_CONFIG_WIFI_NRF700X=y -SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=n +SB_CONFIG_WIFI_NRF70=y +SB_CONFIG_WIFI_NRF70_SCAN_ONLY=n # MCUboot disabled for Wi-Fi connectivity builds in order to save flash SB_CONFIG_BOOTLOADER_NONE=y diff --git a/samples/cellular/nrf_cloud_multi_service/sysbuild_nrf700x-wifi-scan.conf b/samples/cellular/nrf_cloud_multi_service/sysbuild_nrf700x-wifi-scan.conf index 09662438152d..66837a35384d 100644 --- a/samples/cellular/nrf_cloud_multi_service/sysbuild_nrf700x-wifi-scan.conf +++ b/samples/cellular/nrf_cloud_multi_service/sysbuild_nrf700x-wifi-scan.conf @@ -4,8 +4,8 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -SB_CONFIG_WIFI_NRF700X=y -SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y +SB_CONFIG_WIFI_NRF70=y +SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y # MCUboot enabled for scan-only Wi-Fi builds SB_CONFIG_BOOTLOADER_MCUBOOT=y diff --git a/samples/debug/memfault/boards/nrf7002dk_nrf5340_cpuapp.conf b/samples/debug/memfault/boards/nrf7002dk_nrf5340_cpuapp.conf index 7699fc95b93a..32db8ab62f32 100644 --- a/samples/debug/memfault/boards/nrf7002dk_nrf5340_cpuapp.conf +++ b/samples/debug/memfault/boards/nrf7002dk_nrf5340_cpuapp.conf @@ -55,8 +55,8 @@ CONFIG_NET_TC_TX_COUNT=1 # Wi-Fi CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y -CONFIG_WIFI_NRF700X_LOG_LEVEL_ERR=y +CONFIG_WIFI_NRF70=y +CONFIG_WIFI_NRF70_LOG_LEVEL_ERR=y CONFIG_WIFI_MGMT_EXT=y CONFIG_NET_L2_WIFI_SHELL=y CONFIG_NET_SHELL=y diff --git a/samples/matter/common/src/dfu/ota/ota_image_processor_base_impl.h b/samples/matter/common/src/dfu/ota/ota_image_processor_base_impl.h index 8a56a4449989..209658e5703f 100644 --- a/samples/matter/common/src/dfu/ota/ota_image_processor_base_impl.h +++ b/samples/matter/common/src/dfu/ota/ota_image_processor_base_impl.h @@ -6,10 +6,10 @@ #pragma once -#ifdef CONFIG_WIFI_NRF700X +#ifdef CONFIG_WIFI_NRF70 #include using OTAImageProcessorBaseImpl = chip::DeviceLayer::OTAImageProcessorImplWiFi; #else #include using OTAImageProcessorBaseImpl = chip::DeviceLayer::OTAImageProcessorImpl; -#endif /* CONFIG_WIFI_NRF700X */ +#endif /* CONFIG_WIFI_NRF70 */ diff --git a/samples/matter/light_bulb/Kconfig.sysbuild b/samples/matter/light_bulb/Kconfig.sysbuild index a80885725bab..9fd4fe138afe 100644 --- a/samples/matter/light_bulb/Kconfig.sysbuild +++ b/samples/matter/light_bulb/Kconfig.sysbuild @@ -11,7 +11,7 @@ config NRF_DEFAULT_IPC_RADIO # Enable IEEE802.15.4 serialization to network core # This config automatically pulls in the `overlay-802154.conf` in the ipc_radio image config NETCORE_IPC_RADIO_IEEE802154 - default y if SOC_SERIES_NRF53X && !WIFI_NRF700X + default y if SOC_SERIES_NRF53X && !WIFI_NRF70 # Enable Bluetooth serialization to network core # This config automatically pulls in the `overlay-bt_hci_ipc.conf` in the ipc_radio image diff --git a/samples/matter/light_switch/Kconfig.sysbuild b/samples/matter/light_switch/Kconfig.sysbuild index a80885725bab..9fd4fe138afe 100644 --- a/samples/matter/light_switch/Kconfig.sysbuild +++ b/samples/matter/light_switch/Kconfig.sysbuild @@ -11,7 +11,7 @@ config NRF_DEFAULT_IPC_RADIO # Enable IEEE802.15.4 serialization to network core # This config automatically pulls in the `overlay-802154.conf` in the ipc_radio image config NETCORE_IPC_RADIO_IEEE802154 - default y if SOC_SERIES_NRF53X && !WIFI_NRF700X + default y if SOC_SERIES_NRF53X && !WIFI_NRF70 # Enable Bluetooth serialization to network core # This config automatically pulls in the `overlay-bt_hci_ipc.conf` in the ipc_radio image diff --git a/samples/matter/lock/Kconfig.sysbuild b/samples/matter/lock/Kconfig.sysbuild index 0c2b074489aa..b1214cce675b 100644 --- a/samples/matter/lock/Kconfig.sysbuild +++ b/samples/matter/lock/Kconfig.sysbuild @@ -11,7 +11,7 @@ config NRF_DEFAULT_IPC_RADIO # Enable IEEE802.15.4 serialization to network core # This config automatically pulls in the `overlay-802154.conf` in the ipc_radio image config NETCORE_IPC_RADIO_IEEE802154 - default y if (SOC_SERIES_NRF53X || SOC_SERIES_NRF54HX) && !WIFI_NRF700X + default y if (SOC_SERIES_NRF53X || SOC_SERIES_NRF54HX) && !WIFI_NRF70 # Enable Bluetooth serialization to network core # This config automatically pulls in the `overlay-bt_hci_ipc.conf` in the ipc_radio image diff --git a/samples/matter/lock/README.rst b/samples/matter/lock/README.rst index dd8934131fe8..091eac393fe9 100644 --- a/samples/matter/lock/README.rst +++ b/samples/matter/lock/README.rst @@ -134,7 +134,7 @@ For example: .. code-block:: console - west build -b nrf5340dk/nrf5340/cpuapp -p -- -Dlock_SHIELD=nrf7002ek -Dipc_radio_SHIELD=nrf7002ek_coex -DFILE_SUFFIX=thread_wifi_switched -DSB_CONFIG_WIFI_PATCHES_EXT_FLASH_STORE=y -DSB_CONFIG_MCUBOOT_UPDATEABLE_IMAGES=3 -DCONFIG_CHIP_DFU_OVER_BT_SMP=y -DSB_CONFIG_WIFI_NRF700X=y -DSB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_WIFI_FW_PATCH=y + west build -b nrf5340dk/nrf5340/cpuapp -p -- -Dlock_SHIELD=nrf7002ek -Dipc_radio_SHIELD=nrf7002ek_coex -DFILE_SUFFIX=thread_wifi_switched -DSB_CONFIG_WIFI_PATCHES_EXT_FLASH_STORE=y -DSB_CONFIG_MCUBOOT_UPDATEABLE_IMAGES=3 -DCONFIG_CHIP_DFU_OVER_BT_SMP=y -DSB_CONFIG_WIFI_NRF70=y -DSB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_WIFI_FW_PATCH=y .. _matter_lock_sample_ble_nus: @@ -434,7 +434,7 @@ See `Configuration`_ for information about building the sample with the DFU supp .. code-block:: console - west build -b nrf54h20dk/nrf54h20/cpuapp -p -- -DSB_CONFIG_WIFI_NRF700X=y -DCONFIG_CHIP_WIFI=y -Dlock_SHIELD=nrf700x_nrf54h20dk + west build -b nrf54h20dk/nrf54h20/cpuapp -p -- -DSB_CONFIG_WIFI_NRF70=y -DCONFIG_CHIP_WIFI=y -Dlock_SHIELD=nrf700x_nrf54h20dk Selecting a configuration ========================= @@ -766,7 +766,7 @@ To test this feature, complete the following steps: .. code-block:: console - west build -b nrf5340dk/nrf5340/cpuapp -- -DFILE_SUFFIX=thread_wifi_switched -Dlock_SHIELD=nrf7002ek -Dipc_radio_SHIELD=nrf7002ek_coex -DSB_CONFIG_WIFI_NRF700X=y + west build -b nrf5340dk/nrf5340/cpuapp -- -DFILE_SUFFIX=thread_wifi_switched -Dlock_SHIELD=nrf7002ek -Dipc_radio_SHIELD=nrf7002ek_coex -DSB_CONFIG_WIFI_NRF70=y #. |connect_terminal_ANSI| #. Program the application to the kit using the following command: diff --git a/samples/matter/lock/sample.yaml b/samples/matter/lock/sample.yaml index a6c28e5edec4..33c41135d79a 100644 --- a/samples/matter/lock/sample.yaml +++ b/samples/matter/lock/sample.yaml @@ -72,7 +72,7 @@ tests: extra_args: lock_SHIELD=nrf7002ek multiprotocol_rpmsg_SHIELD=nrf7002ek_coex FILE_SUFFIX=thread_wifi_switched SB_CONFIG_WIFI_PATCHES_EXT_FLASH_STORE=y SB_CONFIG_MCUBOOT_UPDATEABLE_IMAGES=3 CONFIG_CHIP_DFU_OVER_BT_SMP=y - SB_CONFIG_WIFI_NRF700X=y SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_WIFI_FW_PATCH=y + SB_CONFIG_WIFI_NRF70=y SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_WIFI_FW_PATCH=y integration_platforms: - nrf5340dk/nrf5340/cpuapp platform_allow: nrf5340dk/nrf5340/cpuapp diff --git a/samples/matter/template/Kconfig.sysbuild b/samples/matter/template/Kconfig.sysbuild index 0c2b074489aa..b1214cce675b 100644 --- a/samples/matter/template/Kconfig.sysbuild +++ b/samples/matter/template/Kconfig.sysbuild @@ -11,7 +11,7 @@ config NRF_DEFAULT_IPC_RADIO # Enable IEEE802.15.4 serialization to network core # This config automatically pulls in the `overlay-802154.conf` in the ipc_radio image config NETCORE_IPC_RADIO_IEEE802154 - default y if (SOC_SERIES_NRF53X || SOC_SERIES_NRF54HX) && !WIFI_NRF700X + default y if (SOC_SERIES_NRF53X || SOC_SERIES_NRF54HX) && !WIFI_NRF70 # Enable Bluetooth serialization to network core # This config automatically pulls in the `overlay-bt_hci_ipc.conf` in the ipc_radio image diff --git a/samples/matter/template/README.rst b/samples/matter/template/README.rst index dd9a314e3062..7d8cc05766c4 100644 --- a/samples/matter/template/README.rst +++ b/samples/matter/template/README.rst @@ -180,7 +180,7 @@ To use nrf54H20 DK with the ``nrf7002ek`` shield attached (2.4 GHz or 5 GHz), fo .. code-block:: console - west build -b nrf54h20dk/nrf54h20/cpuapp -p -- -DSB_CONFIG_WIFI_NRF700X=y -DCONFIG_CHIP_WIFI=y -Dtemplate_SHIELD=nrf700x_nrf54h20dk + west build -b nrf54h20dk/nrf54h20/cpuapp -p -- -DSB_CONFIG_WIFI_NRF70=y -DCONFIG_CHIP_WIFI=y -Dtemplate_SHIELD=nrf700x_nrf54h20dk Selecting a configuration ========================= diff --git a/samples/matter/template/sample.yaml b/samples/matter/template/sample.yaml index 1ba339f2824f..5af93c27e900 100644 --- a/samples/matter/template/sample.yaml +++ b/samples/matter/template/sample.yaml @@ -71,7 +71,7 @@ tests: sample.matter.template.nrf54h20.nrf7002eb: sysbuild: true build_only: true - extra_args: SB_CONFIG_WIFI_NRF700X=y template_SHIELD=nrf700x_nrf54h20dk + extra_args: SB_CONFIG_WIFI_NRF70=y template_SHIELD=nrf700x_nrf54h20dk CONFIG_CHIP_WIFI=y CONFIG_CHIP_BOOTLOADER_NONE=y CONFIG_CHIP_OTA_REQUESTOR=n SB_CONFIG_MATTER_OTA=n CONFIG_LTO=y CONFIG_ISR_TABLES_LOCAL_DECLARATION=y diff --git a/samples/matter/thermostat/Kconfig.sysbuild b/samples/matter/thermostat/Kconfig.sysbuild index a631ac470e1d..8943dc8b4e93 100644 --- a/samples/matter/thermostat/Kconfig.sysbuild +++ b/samples/matter/thermostat/Kconfig.sysbuild @@ -11,7 +11,7 @@ config NRF_DEFAULT_IPC_RADIO # Enable IEEE802.15.4 serialization to network core # This config automatically pulls in the `overlay-802154.conf` in the ipc_radio image config NETCORE_IPC_RADIO_IEEE802154 - default y if SOC_SERIES_NRF53X && !WIFI_NRF700X + default y if SOC_SERIES_NRF53X && !WIFI_NRF70 # Enable Bluetooth serialization to network core # This config automatically pulls in the `overlay-bt_hci_ipc.conf` in the ipc_radio image diff --git a/samples/matter/window_covering/Kconfig.sysbuild b/samples/matter/window_covering/Kconfig.sysbuild index a80885725bab..9fd4fe138afe 100644 --- a/samples/matter/window_covering/Kconfig.sysbuild +++ b/samples/matter/window_covering/Kconfig.sysbuild @@ -11,7 +11,7 @@ config NRF_DEFAULT_IPC_RADIO # Enable IEEE802.15.4 serialization to network core # This config automatically pulls in the `overlay-802154.conf` in the ipc_radio image config NETCORE_IPC_RADIO_IEEE802154 - default y if SOC_SERIES_NRF53X && !WIFI_NRF700X + default y if SOC_SERIES_NRF53X && !WIFI_NRF70 # Enable Bluetooth serialization to network core # This config automatically pulls in the `overlay-bt_hci_ipc.conf` in the ipc_radio image diff --git a/samples/net/aws_iot/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/aws_iot/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index cccd88943313..a6cc39aa683d 100644 --- a/samples/net/aws_iot/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/aws_iot/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -18,12 +18,12 @@ CONFIG_HW_ID_LIBRARY_SOURCE_NET_MAC=y CONFIG_POSIX_MAX_FDS=25 # Optimize Wi-Fi stack to save some memory -CONFIG_NRF700X_RX_NUM_BUFS=16 -CONFIG_NRF700X_MAX_TX_AGGREGATION=4 +CONFIG_NRF70_RX_NUM_BUFS=16 +CONFIG_NRF70_MAX_TX_AGGREGATION=4 # Wi-Fi CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y +CONFIG_WIFI_NRF70=y CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y CONFIG_FLASH=y diff --git a/samples/net/azure_iot_hub/README.rst b/samples/net/azure_iot_hub/README.rst index b5243e45d0d4..0b547a26d7fc 100644 --- a/samples/net/azure_iot_hub/README.rst +++ b/samples/net/azure_iot_hub/README.rst @@ -260,5 +260,4 @@ It uses the following libraries and secure firmware component for nRF91 Series b It uses the following libraries for nRF7 Series builds: * :ref:`nrf_security` -* :ref:`nrf700x_wifi` * :ref:`lib_wifi_credentials` diff --git a/samples/net/azure_iot_hub/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/azure_iot_hub/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index aa6f3a4f595d..28345e1b64a3 100644 --- a/samples/net/azure_iot_hub/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/azure_iot_hub/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -18,13 +18,13 @@ CONFIG_HEAP_MEM_POOL_SIZE=81920 CONFIG_NET_RX_STACK_SIZE=2048 # Optimize Wi-Fi stack to save some memory -CONFIG_NRF700X_RX_NUM_BUFS=16 -CONFIG_NRF700X_MAX_TX_AGGREGATION=4 +CONFIG_NRF70_RX_NUM_BUFS=16 +CONFIG_NRF70_MAX_TX_AGGREGATION=4 # Wi-Fi CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y -CONFIG_WIFI_NRF700X_LOG_LEVEL_ERR=y +CONFIG_WIFI_NRF70=y +CONFIG_WIFI_NRF70_LOG_LEVEL_ERR=y CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y CONFIG_FLASH_PAGE_LAYOUT=y diff --git a/samples/net/coap_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/coap_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index fea05a47d07e..1c5f9067a09e 100644 --- a/samples/net/coap_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/coap_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -19,12 +19,12 @@ CONFIG_PM_PARTITION_SIZE_TFM_SRAM=0xc000 CONFIG_PM_PARTITION_SIZE_TFM=0x20000 # Optimize Wi-Fi stack to save some memory -CONFIG_NRF700X_RX_NUM_BUFS=16 -CONFIG_NRF700X_MAX_TX_AGGREGATION=4 +CONFIG_NRF70_RX_NUM_BUFS=16 +CONFIG_NRF70_MAX_TX_AGGREGATION=4 # Wi-Fi CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y +CONFIG_WIFI_NRF70=y CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y CONFIG_NET_L2_WIFI_SHELL=y diff --git a/samples/net/download/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/download/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index a54ae580caa8..7dd2cd728096 100644 --- a/samples/net/download/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/download/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -13,8 +13,8 @@ CONFIG_MAIN_STACK_SIZE=4096 CONFIG_LOG=y # Optimize Wi-Fi stack to save some memory -CONFIG_NRF700X_RX_NUM_BUFS=16 -CONFIG_NRF700X_MAX_TX_AGGREGATION=4 +CONFIG_NRF70_RX_NUM_BUFS=16 +CONFIG_NRF70_MAX_TX_AGGREGATION=4 # Zephyr NET Connection Manager connectivity layer. CONFIG_L2_WIFI_CONNECTIVITY=y @@ -23,8 +23,8 @@ CONFIG_L2_WIFI_CONNECTIVITY_AUTO_CONNECT=n # Wi-Fi CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y -CONFIG_WIFI_NRF700X_LOG_LEVEL_ERR=y +CONFIG_WIFI_NRF70=y +CONFIG_WIFI_NRF70_LOG_LEVEL_ERR=y CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y diff --git a/samples/net/http_server/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/http_server/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index 2dbbe74ae62a..1e011480db61 100644 --- a/samples/net/http_server/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/http_server/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -11,12 +11,12 @@ CONFIG_PM_PARTITION_SIZE_TFM=0x20000 # Optimize Wi-Fi stack to save some memory CONFIG_HEAP_MEM_POOL_SIZE=81920 -CONFIG_NRF700X_RX_NUM_BUFS=16 -CONFIG_NRF700X_MAX_TX_AGGREGATION=4 +CONFIG_NRF70_RX_NUM_BUFS=16 +CONFIG_NRF70_MAX_TX_AGGREGATION=4 # Wi-Fi CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y +CONFIG_WIFI_NRF70=y CONFIG_WPA_SUPP=y CONFIG_NET_L2_ETHERNET=y diff --git a/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index bd12d2ed3a83..9bed9d0074cc 100644 --- a/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -11,13 +11,13 @@ CONFIG_HEAP_MEM_POOL_SIZE=81920 CONFIG_NET_RX_STACK_SIZE=2048 # Optimize Wi-Fi stack to save some memory -CONFIG_NRF700X_RX_NUM_BUFS=16 -CONFIG_NRF700X_MAX_TX_AGGREGATION=4 +CONFIG_NRF70_RX_NUM_BUFS=16 +CONFIG_NRF70_MAX_TX_AGGREGATION=4 # Wi-Fi CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y -CONFIG_WIFI_NRF700X_LOG_LEVEL_ERR=y +CONFIG_WIFI_NRF70=y +CONFIG_WIFI_NRF70_LOG_LEVEL_ERR=y CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y diff --git a/samples/net/mqtt/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/mqtt/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index 5c51873853a3..45edaeb3fa3d 100644 --- a/samples/net/mqtt/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/mqtt/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -19,13 +19,13 @@ CONFIG_HW_ID_LIBRARY_SOURCE_NET_MAC=y CONFIG_DK_LIBRARY=y # Optimize Wi-Fi stack to save some memory -CONFIG_NRF700X_RX_NUM_BUFS=16 -CONFIG_NRF700X_MAX_TX_AGGREGATION=4 +CONFIG_NRF70_RX_NUM_BUFS=16 +CONFIG_NRF70_MAX_TX_AGGREGATION=4 # Wi-Fi CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y -CONFIG_WIFI_NRF700X_LOG_LEVEL_ERR=y +CONFIG_WIFI_NRF70=y +CONFIG_WIFI_NRF70_LOG_LEVEL_ERR=y CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y diff --git a/samples/net/mqtt/src/modules/network/Kconfig.network b/samples/net/mqtt/src/modules/network/Kconfig.network index 0e9d52ed7578..ec0d7ae21822 100644 --- a/samples/net/mqtt/src/modules/network/Kconfig.network +++ b/samples/net/mqtt/src/modules/network/Kconfig.network @@ -5,7 +5,7 @@ # menu "Network" - depends on NRF_MODEM_LIB_NET_IF || (WIFI_NRF700X && WIFI_MGMT_EXT) || BOARD_NATIVE_SIM + depends on NRF_MODEM_LIB_NET_IF || (WIFI_NRF70 && WIFI_MGMT_EXT) || BOARD_NATIVE_SIM config MQTT_SAMPLE_NETWORK_THREAD_STACK_SIZE int "Thread stack size" diff --git a/samples/net/udp/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/udp/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index ccdd2b1f86b3..cafcf374f7da 100644 --- a/samples/net/udp/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/udp/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -10,13 +10,13 @@ CONFIG_HEAP_MEM_POOL_SIZE=81920 # Wi-Fi CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y +CONFIG_WIFI_NRF70=y CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y # Optimize Wi-Fi stack to save some memory -CONFIG_NRF700X_RX_NUM_BUFS=16 -CONFIG_NRF700X_MAX_TX_AGGREGATION=4 +CONFIG_NRF70_RX_NUM_BUFS=16 +CONFIG_NRF70_MAX_TX_AGGREGATION=4 # Shell CONFIG_SHELL=y diff --git a/samples/wifi/ble_coex/prj.conf b/samples/wifi/ble_coex/prj.conf index c27436d89193..657a6320e960 100644 --- a/samples/wifi/ble_coex/prj.conf +++ b/samples/wifi/ble_coex/prj.conf @@ -5,7 +5,7 @@ # CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y +CONFIG_WIFI_NRF70=y # WPA supplicant CONFIG_WPA_SUPP=y @@ -110,8 +110,8 @@ CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y CONFIG_DK_LIBRARY=y CONFIG_DK_LIBRARY_DYNAMIC_BUTTON_HANDLERS=y -CONFIG_NRF700X_MAX_TX_PENDING_QLEN=12 -CONFIG_NRF700X_QSPI_LOW_POWER=n +CONFIG_NRF70_MAX_TX_PENDING_QLEN=12 +CONFIG_NRF70_QSPI_LOW_POWER=n #Added to fix BLE crash in coex enable cases. CONFIG_NRF_RPC=n diff --git a/samples/wifi/ble_coex/src/main.c b/samples/wifi/ble_coex/src/main.c index ec8e77519af4..7909414b2a4a 100644 --- a/samples/wifi/ble_coex/src/main.c +++ b/samples/wifi/ble_coex/src/main.c @@ -332,10 +332,10 @@ int main(void) int ret = 0; bool test_wlan = IS_ENABLED(CONFIG_TEST_TYPE_WLAN); bool test_ble = IS_ENABLED(CONFIG_TEST_TYPE_BLE); -#ifdef CONFIG_NRF700X_SR_COEX +#ifdef CONFIG_NRF70_SR_COEX enum nrf_wifi_pta_wlan_op_band wlan_band; bool separate_antennas = IS_ENABLED(CONFIG_COEX_SEP_ANTENNAS); -#endif /* CONFIG_NRF700X_SR_COEX */ +#endif /* CONFIG_NRF70_SR_COEX */ bool is_sr_protocol_ble = IS_ENABLED(CONFIG_SR_PROTOCOL_BLE); #if !defined(CONFIG_COEX_SEP_ANTENNAS) && \ @@ -368,14 +368,14 @@ int main(void) LOG_INF("test_wlan = %d and test_ble = %d\n", test_wlan, test_ble); -#ifdef CONFIG_NRF700X_SR_COEX_RF_SWITCH +#ifdef CONFIG_NRF70_SR_COEX_RF_SWITCH /* Configure SR side (nRF5340 side) switch for nRF700x DK */ ret = nrf_wifi_config_sr_switch(separate_antennas); if (ret != 0) { LOG_ERR("Unable to configure SR side switch: %d\n", ret); goto err; } -#endif /* CONFIG_NRF700X_SR_COEX_RF_SWITCH */ +#endif /* CONFIG_NRF70_SR_COEX_RF_SWITCH */ if (test_wlan) { /* Wi-Fi connection */ @@ -389,7 +389,7 @@ int main(void) goto err; } -#ifdef CONFIG_NRF700X_SR_COEX +#ifdef CONFIG_NRF70_SR_COEX /* Configure Coexistence Hardware */ LOG_INF("\n"); LOG_INF("Configuring non-PTA registers.\n"); @@ -411,7 +411,7 @@ int main(void) LOG_ERR("Failed to configure PTA coex hardware: %d\n", ret); goto err; } -#endif /* CONFIG_NRF700X_SR_COEX */ +#endif /* CONFIG_NRF70_SR_COEX */ } if (test_ble) { diff --git a/samples/wifi/ble_coex/sysbuild.conf b/samples/wifi/ble_coex/sysbuild.conf index 32948cdda47c..d9e7bee8f47b 100644 --- a/samples/wifi/ble_coex/sysbuild.conf +++ b/samples/wifi/ble_coex/sysbuild.conf @@ -4,4 +4,4 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -SB_CONFIG_WIFI_NRF700X=y +SB_CONFIG_WIFI_NRF70=y diff --git a/samples/wifi/monitor/prj.conf b/samples/wifi/monitor/prj.conf index 1e6270728cd2..6f064ed5626a 100644 --- a/samples/wifi/monitor/prj.conf +++ b/samples/wifi/monitor/prj.conf @@ -4,11 +4,11 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y +CONFIG_WIFI_NRF70=y CONFIG_NRF_WIFI_LOW_POWER=n # Enable raw data RX for nRF700x for monitor mode -CONFIG_NRF700X_RAW_DATA_RX=y +CONFIG_NRF70_RAW_DATA_RX=y # WPA supplicant CONFIG_WPA_SUPP=y diff --git a/samples/wifi/monitor/sysbuild.conf b/samples/wifi/monitor/sysbuild.conf index 9baef711d1ff..7a8ca50b9fb0 100644 --- a/samples/wifi/monitor/sysbuild.conf +++ b/samples/wifi/monitor/sysbuild.conf @@ -4,5 +4,5 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -SB_CONFIG_WIFI_NRF700X=y -SB_CONFIG_WIFI_NRF700X_SYSTEM_WITH_RAW_MODES=y +SB_CONFIG_WIFI_NRF70=y +SB_CONFIG_WIFI_NRF70_SYSTEM_WITH_RAW_MODES=y diff --git a/samples/wifi/promiscuous/prj.conf b/samples/wifi/promiscuous/prj.conf index 9091e1f81a9b..4f3222bc0ee4 100644 --- a/samples/wifi/promiscuous/prj.conf +++ b/samples/wifi/promiscuous/prj.conf @@ -4,14 +4,14 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y +CONFIG_WIFI_NRF70=y # WPA supplicant CONFIG_WPA_SUPP=y # Promiscuous mode CONFIG_NET_PROMISCUOUS_MODE=y -CONFIG_NRF700X_PROMISC_DATA_RX=y +CONFIG_NRF70_PROMISC_DATA_RX=y CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y diff --git a/samples/wifi/promiscuous/sysbuild.conf b/samples/wifi/promiscuous/sysbuild.conf index 9baef711d1ff..7a8ca50b9fb0 100644 --- a/samples/wifi/promiscuous/sysbuild.conf +++ b/samples/wifi/promiscuous/sysbuild.conf @@ -4,5 +4,5 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -SB_CONFIG_WIFI_NRF700X=y -SB_CONFIG_WIFI_NRF700X_SYSTEM_WITH_RAW_MODES=y +SB_CONFIG_WIFI_NRF70=y +SB_CONFIG_WIFI_NRF70_SYSTEM_WITH_RAW_MODES=y diff --git a/samples/wifi/provisioning/ble/prj.conf b/samples/wifi/provisioning/ble/prj.conf index a31ca1ea07cf..a3e456bdf29c 100644 --- a/samples/wifi/provisioning/ble/prj.conf +++ b/samples/wifi/provisioning/ble/prj.conf @@ -4,7 +4,7 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y +CONFIG_WIFI_NRF70=y # WPA supplicant CONFIG_WPA_SUPP=y diff --git a/samples/wifi/provisioning/ble/sysbuild.conf b/samples/wifi/provisioning/ble/sysbuild.conf index 32948cdda47c..d9e7bee8f47b 100644 --- a/samples/wifi/provisioning/ble/sysbuild.conf +++ b/samples/wifi/provisioning/ble/sysbuild.conf @@ -4,4 +4,4 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -SB_CONFIG_WIFI_NRF700X=y +SB_CONFIG_WIFI_NRF70=y diff --git a/samples/wifi/provisioning/softap/prj.conf b/samples/wifi/provisioning/softap/prj.conf index bed3bb262534..d2a7dcd2e3de 100644 --- a/samples/wifi/provisioning/softap/prj.conf +++ b/samples/wifi/provisioning/softap/prj.conf @@ -11,13 +11,13 @@ CONFIG_PM_PARTITION_SIZE_TFM=0x1c000 # Optimize Wi-Fi stack to save some memory. CONFIG_HEAP_MEM_POOL_SIZE=81920 -CONFIG_NRF700X_RX_NUM_BUFS=16 -CONFIG_NRF700X_MAX_TX_AGGREGATION=4 +CONFIG_NRF70_RX_NUM_BUFS=16 +CONFIG_NRF70_MAX_TX_AGGREGATION=4 # Wi-Fi CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y -CONFIG_NRF700X_AP_MODE=y +CONFIG_WIFI_NRF70=y +CONFIG_NRF70_AP_MODE=y CONFIG_WPA_SUPP=y CONFIG_WPA_SUPP_AP=y CONFIG_NET_L2_ETHERNET=y diff --git a/samples/wifi/radio_test/prj.conf b/samples/wifi/radio_test/prj.conf index 5039b7c6d249..efc2ad3aeca1 100644 --- a/samples/wifi/radio_test/prj.conf +++ b/samples/wifi/radio_test/prj.conf @@ -4,8 +4,8 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y -CONFIG_NRF700X_RADIO_TEST=y +CONFIG_WIFI_NRF70=y +CONFIG_NRF70_RADIO_TEST=y #CONFIG_INIT_STACKS=y diff --git a/samples/wifi/radio_test/sample.yaml b/samples/wifi/radio_test/sample.yaml index 112ac3e8a6fd..98d582af81d2 100644 --- a/samples/wifi/radio_test/sample.yaml +++ b/samples/wifi/radio_test/sample.yaml @@ -21,7 +21,7 @@ tests: sample.nrf7002.radio_test_combo: sysbuild: true build_only: true - extra_args: CONFIG_NRF700X_RADIO_TEST_COMBO=y + extra_args: CONFIG_NRF70_RADIO_TEST_COMBO=y integration_platforms: - nrf7002dk/nrf5340/cpuapp platform_allow: nrf7002dk/nrf5340/cpuapp @@ -29,7 +29,7 @@ tests: sample.nrf5340.radio_test_combo: sysbuild: true build_only: true - extra_args: SHIELD=nrf7002ek CONFIG_NRF700X_RADIO_TEST_COMBO=y + extra_args: SHIELD=nrf7002ek CONFIG_NRF70_RADIO_TEST_COMBO=y integration_platforms: - nrf5340dk/nrf5340/cpuapp platform_allow: nrf5340dk/nrf5340/cpuapp diff --git a/samples/wifi/radio_test/src/nrf_wifi_radio_test_shell.c b/samples/wifi/radio_test/src/nrf_wifi_radio_test_shell.c index 5f0909f63b5e..0706900dc1e7 100644 --- a/samples/wifi/radio_test/src/nrf_wifi_radio_test_shell.c +++ b/samples/wifi/radio_test/src/nrf_wifi_radio_test_shell.c @@ -1376,7 +1376,7 @@ static int nrf_wifi_radio_test_set_rx(const struct shell *shell, return 0; } -#ifdef CONFIG_NRF700X_SR_COEX_RF_SWITCH +#ifdef CONFIG_NRF70_SR_COEX_RF_SWITCH static int nrf_wifi_radio_test_sr_ant_switch_ctrl(const struct shell *shell, size_t argc, const char *argv[]) @@ -1394,7 +1394,7 @@ static int nrf_wifi_radio_test_sr_ant_switch_ctrl(const struct shell *shell, return sr_ant_switch(val); } -#endif /* CONFIG_NRF700X_SR_COEX_RF_SWITCH */ +#endif /* CONFIG_NRF70_SR_COEX_RF_SWITCH */ static int nrf_wifi_radio_test_rx_cap(const struct shell *shell, size_t argc, @@ -2379,7 +2379,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE( nrf_wifi_radio_test_set_rx, 2, 0), -#ifdef CONFIG_NRF700X_SR_COEX_RF_SWITCH +#ifdef CONFIG_NRF70_SR_COEX_RF_SWITCH SHELL_CMD_ARG(sr_ant_switch_ctrl, NULL, "0 - Switch set to use the BLE antenna\n" @@ -2387,7 +2387,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE( nrf_wifi_radio_test_sr_ant_switch_ctrl, 2, 0), -#endif /* CONFIG_NRF700X_SR_COEX_RF_SWITCH */ +#endif /* CONFIG_NRF70_SR_COEX_RF_SWITCH */ SHELL_CMD_ARG(rx_lna_gain, NULL, " - LNA gain to be configured.\n" diff --git a/samples/wifi/radio_test/sysbuild.conf b/samples/wifi/radio_test/sysbuild.conf index 30e84c648c69..a5af2663d0db 100644 --- a/samples/wifi/radio_test/sysbuild.conf +++ b/samples/wifi/radio_test/sysbuild.conf @@ -4,5 +4,5 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -SB_CONFIG_WIFI_NRF700X=y -SB_CONFIG_WIFI_NRF700X_RADIO_TEST=y +SB_CONFIG_WIFI_NRF70=y +SB_CONFIG_WIFI_NRF70_RADIO_TEST=y diff --git a/samples/wifi/raw_tx_packet/prj.conf b/samples/wifi/raw_tx_packet/prj.conf index 2ae5594c39d8..be06580b2653 100644 --- a/samples/wifi/raw_tx_packet/prj.conf +++ b/samples/wifi/raw_tx_packet/prj.conf @@ -4,9 +4,9 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y +CONFIG_WIFI_NRF70=y CONFIG_NRF_WIFI_LOW_POWER=n -CONFIG_NRF700X_RAW_DATA_TX=y +CONFIG_NRF70_RAW_DATA_TX=y # WPA supplicant CONFIG_WPA_SUPP=y diff --git a/samples/wifi/raw_tx_packet/sysbuild.conf b/samples/wifi/raw_tx_packet/sysbuild.conf index 9baef711d1ff..7a8ca50b9fb0 100644 --- a/samples/wifi/raw_tx_packet/sysbuild.conf +++ b/samples/wifi/raw_tx_packet/sysbuild.conf @@ -4,5 +4,5 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -SB_CONFIG_WIFI_NRF700X=y -SB_CONFIG_WIFI_NRF700X_SYSTEM_WITH_RAW_MODES=y +SB_CONFIG_WIFI_NRF70=y +SB_CONFIG_WIFI_NRF70_SYSTEM_WITH_RAW_MODES=y diff --git a/samples/wifi/scan/prj.conf b/samples/wifi/scan/prj.conf index fd70bfa2487a..6e505f55db7a 100644 --- a/samples/wifi/scan/prj.conf +++ b/samples/wifi/scan/prj.conf @@ -4,7 +4,7 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y +CONFIG_WIFI_NRF70=y CONFIG_NET_L2_WIFI_MGMT=y CONFIG_HEAP_MEM_POOL_SIZE=25000 diff --git a/samples/wifi/scan/src/main.c b/samples/wifi/scan/src/main.c index 1738895be478..0eb85e16fe8b 100644 --- a/samples/wifi/scan/src/main.c +++ b/samples/wifi/scan/src/main.c @@ -109,13 +109,13 @@ static struct net_mgmt_event_callback wifi_shell_mgmt_cb; K_SEM_DEFINE(scan_sem, 0, 1); -#if defined CONFIG_WIFI_NRF700X_SKIP_LOCAL_ADMIN_MAC +#if defined CONFIG_WIFI_NRF70_SKIP_LOCAL_ADMIN_MAC static bool local_mac_check(const uint8_t *const mac) { return ((mac[0] & 0x02) || ((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x5E))); } -#endif /* CONFIG_WIFI_NRF700X_SKIP_LOCAL_ADMIN_MAC */ +#endif /* CONFIG_WIFI_NRF70_SKIP_LOCAL_ADMIN_MAC */ static void handle_wifi_scan_result(struct net_mgmt_event_callback *cb) { @@ -134,9 +134,9 @@ static void handle_wifi_scan_result(struct net_mgmt_event_callback *cb) strncpy(ssid_print, entry->ssid, sizeof(ssid_print) - 1); ssid_print[sizeof(ssid_print) - 1] = '\0'; -#if defined CONFIG_WIFI_NRF700X_SKIP_LOCAL_ADMIN_MAC +#if defined CONFIG_WIFI_NRF70_SKIP_LOCAL_ADMIN_MAC __ASSERT(!local_mac_check(entry->mac), "Locally administered MAC found: %s\n", ssid_print); -#endif /* CONFIG_WIFI_NRF700X_SKIP_LOCAL_ADMIN_MAC */ +#endif /* CONFIG_WIFI_NRF70_SKIP_LOCAL_ADMIN_MAC */ printk("%-4d | %-32s %-5u | %-4u | %-4d | %-5s | %s\n", scan_result, ssid_print, entry->ssid_length, diff --git a/samples/wifi/scan/sysbuild.conf b/samples/wifi/scan/sysbuild.conf index cb753f32ccc8..1f6da431255e 100644 --- a/samples/wifi/scan/sysbuild.conf +++ b/samples/wifi/scan/sysbuild.conf @@ -4,5 +4,5 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -SB_CONFIG_WIFI_NRF700X=y -SB_CONFIG_WIFI_NRF700X_SCAN_ONLY=y +SB_CONFIG_WIFI_NRF70=y +SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y diff --git a/samples/wifi/shell/CMakeLists.txt b/samples/wifi/shell/CMakeLists.txt index 3d5156b65943..a0230bfd1857 100644 --- a/samples/wifi/shell/CMakeLists.txt +++ b/samples/wifi/shell/CMakeLists.txt @@ -14,12 +14,12 @@ target_include_directories( PRIVATE ${ZEPHYR_BASE}/../nrfxlib/) -target_sources_ifdef(CONFIG_NRF700X_RAW_DATA_TX +target_sources_ifdef(CONFIG_NRF70_RAW_DATA_TX app PRIVATE src/wifi_raw_tx_pkt_shell.c) -target_sources_ifdef(CONFIG_NRF700X_PROMISC_DATA_RX +target_sources_ifdef(CONFIG_NRF70_PROMISC_DATA_RX app PRIVATE src/wifi_promiscuous_shell.c) diff --git a/samples/wifi/shell/overlay-monitor-mode.conf b/samples/wifi/shell/overlay-monitor-mode.conf index a226a8f96db5..ca380ef6d797 100644 --- a/samples/wifi/shell/overlay-monitor-mode.conf +++ b/samples/wifi/shell/overlay-monitor-mode.conf @@ -1 +1 @@ -CONFIG_NRF700X_RAW_DATA_RX=y +CONFIG_NRF70_RAW_DATA_RX=y diff --git a/samples/wifi/shell/overlay-promiscuous-mode.conf b/samples/wifi/shell/overlay-promiscuous-mode.conf index f2b161fc5f8c..7c43d074c396 100644 --- a/samples/wifi/shell/overlay-promiscuous-mode.conf +++ b/samples/wifi/shell/overlay-promiscuous-mode.conf @@ -1,2 +1,2 @@ -CONFIG_NRF700X_PROMISC_DATA_RX=y +CONFIG_NRF70_PROMISC_DATA_RX=y CONFIG_NET_PROMISCUOUS_MODE=y diff --git a/samples/wifi/shell/overlay-raw-tx.conf b/samples/wifi/shell/overlay-raw-tx.conf index db5853dc54bc..b7064ffcfd28 100644 --- a/samples/wifi/shell/overlay-raw-tx.conf +++ b/samples/wifi/shell/overlay-raw-tx.conf @@ -1,2 +1,2 @@ -CONFIG_NRF700X_RAW_DATA_TX=y +CONFIG_NRF70_RAW_DATA_TX=y CONFIG_LOG_MODE_IMMEDIATE=y diff --git a/samples/wifi/shell/overlay-sap.conf b/samples/wifi/shell/overlay-sap.conf index 7d1bdc32b529..5d98cdc2f405 100644 --- a/samples/wifi/shell/overlay-sap.conf +++ b/samples/wifi/shell/overlay-sap.conf @@ -1,4 +1,4 @@ -CONFIG_NRF700X_AP_MODE=y +CONFIG_NRF70_AP_MODE=y CONFIG_WPA_SUPP_AP=y CONFIG_NET_ZPERF=y @@ -10,7 +10,7 @@ CONFIG_NET_BUF_RX_COUNT=10 CONFIG_NET_BUF_TX_COUNT=20 CONFIG_HEAP_MEM_POOL_SIZE=180000 CONFIG_NET_BUF_DATA_SIZE=1500 -CONFIG_NRF700X_QSPI_LOW_POWER=n +CONFIG_NRF70_QSPI_LOW_POWER=n CONFIG_NET_ZPERF_MAX_PACKET_SIZE=1500 # Necessary for zperf_tcp_receiver.c diff --git a/samples/wifi/shell/overlay-zperf.conf b/samples/wifi/shell/overlay-zperf.conf index 718c11c847e7..b72e2229a28c 100644 --- a/samples/wifi/shell/overlay-zperf.conf +++ b/samples/wifi/shell/overlay-zperf.conf @@ -14,7 +14,7 @@ CONFIG_NET_BUF_RX_COUNT=30 CONFIG_NET_BUF_TX_COUNT=58 CONFIG_HEAP_MEM_POOL_SIZE=230000 CONFIG_NET_BUF_DATA_SIZE=1100 -CONFIG_NRF700X_QSPI_LOW_POWER=n +CONFIG_NRF70_QSPI_LOW_POWER=n # To enable optimization configuration options CONFIG_PICOLIBC_USE_MODULE=y CONFIG_SPEED_OPTIMIZATIONS=y @@ -28,4 +28,4 @@ CONFIG_WIFI_CREDENTIALS=n CONFIG_FLASH=n CONFIG_NVS=n CONFIG_SETTINGS=n -CONFIG_NRF700X_UTIL=y +CONFIG_NRF70_UTIL=y diff --git a/samples/wifi/shell/prj.conf b/samples/wifi/shell/prj.conf index 3c0bb1e89c98..404c8cb69d73 100644 --- a/samples/wifi/shell/prj.conf +++ b/samples/wifi/shell/prj.conf @@ -4,7 +4,7 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y +CONFIG_WIFI_NRF70=y # WPA supplicant CONFIG_WPA_SUPP=y @@ -33,8 +33,8 @@ CONFIG_NET_PKT_TX_COUNT=8 CONFIG_NET_BUF_RX_COUNT=16 CONFIG_NET_BUF_TX_COUNT=16 CONFIG_NET_BUF_DATA_SIZE=128 -CONFIG_NRF700X_RX_NUM_BUFS=16 -CONFIG_NRF700X_MAX_TX_AGGREGATION=4 +CONFIG_NRF70_RX_NUM_BUFS=16 +CONFIG_NRF70_MAX_TX_AGGREGATION=4 # nRF700x is main consumer: (16 + 8) * 1600 = ~40KB + ~40KB control path (experimental) CONFIG_HEAP_MEM_POOL_SIZE=80000 CONFIG_NET_TC_TX_COUNT=1 diff --git a/samples/wifi/shell/sample.yaml b/samples/wifi/shell/sample.yaml index f10c025e44c3..58b44a1f61d3 100644 --- a/samples/wifi/shell/sample.yaml +++ b/samples/wifi/shell/sample.yaml @@ -206,7 +206,7 @@ tests: build_only: true extra_args: EXTRA_CONF_FILE=overlay-zperf.conf - CONFIG_NRF700X_UTIL=y + CONFIG_NRF70_UTIL=y CONFIG_WPA_CLI=y CONFIG_NET_IPV4_FRAGMENT=y CONFIG_NET_IPV4_FRAGMENT_MAX_PKT=24 @@ -221,7 +221,7 @@ tests: extra_args: SHIELD=nrf7002ek_nrf7001 EXTRA_CONF_FILE=overlay-zperf.conf - CONFIG_NRF700X_UTIL=y + CONFIG_NRF70_UTIL=y CONFIG_WPA_CLI=y CONFIG_NET_IPV4_FRAGMENT=y CONFIG_NET_IPV4_FRAGMENT_MAX_PKT=24 @@ -235,7 +235,7 @@ tests: build_only: true extra_args: EXTRA_CONF_FILE=overlay-zperf.conf - CONFIG_NRF700X_UTIL=y + CONFIG_NRF70_UTIL=y CONFIG_WPA_CLI=y CONFIG_NET_IPV4_FRAGMENT=y CONFIG_NET_IPV4_FRAGMENT_MAX_PKT=24 @@ -250,7 +250,7 @@ tests: extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE=overlay-zperf.conf - CONFIG_NRF700X_UTIL=y + CONFIG_NRF70_UTIL=y CONFIG_WPA_CLI=y CONFIG_NET_IPV4_FRAGMENT=y CONFIG_NET_IPV4_FRAGMENT_MAX_PKT=24 @@ -264,7 +264,7 @@ tests: extra_args: nrf_wifi_shell_SNIPPET="nrf70-driver-verbose-debug;wpa-supplicant-debug" EXTRA_CONF_FILE=overlay-zperf.conf - CONFIG_NRF700X_UTIL=y + CONFIG_NRF70_UTIL=y CONFIG_WPA_CLI=y CONFIG_NET_IPV4_FRAGMENT=y CONFIG_NET_IPV4_FRAGMENT_MAX_PKT=24 @@ -285,7 +285,7 @@ tests: build_only: true extra_args: EXTRA_CONF_FILE=overlay-raw-tx.conf - SB_CONFIG_WIFI_NRF700X_SYSTEM_WITH_RAW_MODES=y + SB_CONFIG_WIFI_NRF70_SYSTEM_WITH_RAW_MODES=y integration_platforms: - nrf7002dk/nrf5340/cpuapp platform_allow: nrf7002dk/nrf5340/cpuapp @@ -295,7 +295,7 @@ tests: build_only: true extra_args: EXTRA_CONF_FILE=overlay-monitor-mode.conf - SB_CONFIG_WIFI_NRF700X_SYSTEM_WITH_RAW_MODES=y + SB_CONFIG_WIFI_NRF70_SYSTEM_WITH_RAW_MODES=y integration_platforms: - nrf7002dk/nrf5340/cpuapp platform_allow: nrf7002dk/nrf5340/cpuapp @@ -305,7 +305,7 @@ tests: build_only: true extra_args: EXTRA_CONF_FILE=overlay-promiscuous-mode.conf - SB_CONFIG_WIFI_NRF700X_SYSTEM_WITH_RAW_MODES=y + SB_CONFIG_WIFI_NRF70_SYSTEM_WITH_RAW_MODES=y integration_platforms: - nrf7002dk/nrf5340/cpuapp platform_allow: nrf7002dk/nrf5340/cpuapp @@ -315,7 +315,7 @@ tests: build_only: true extra_args: EXTRA_CONF_FILE=overlay-promiscuous-mode.conf - SB_CONFIG_WIFI_NRF700X_SYSTEM_WITH_RAW_MODES=y + SB_CONFIG_WIFI_NRF70_SYSTEM_WITH_RAW_MODES=y integration_platforms: - nrf7002dk/nrf5340/cpuapp/nrf7001 platform_allow: nrf7002dk/nrf5340/cpuapp/nrf7001 diff --git a/samples/wifi/shell/sysbuild.conf b/samples/wifi/shell/sysbuild.conf index 32948cdda47c..d9e7bee8f47b 100644 --- a/samples/wifi/shell/sysbuild.conf +++ b/samples/wifi/shell/sysbuild.conf @@ -4,4 +4,4 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -SB_CONFIG_WIFI_NRF700X=y +SB_CONFIG_WIFI_NRF70=y diff --git a/samples/wifi/shutdown/prj.conf b/samples/wifi/shutdown/prj.conf index 36864978b084..bf679a42c729 100644 --- a/samples/wifi/shutdown/prj.conf +++ b/samples/wifi/shutdown/prj.conf @@ -4,7 +4,7 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y +CONFIG_WIFI_NRF70=y CONFIG_NET_L2_WIFI_MGMT=y CONFIG_HEAP_MEM_POOL_SIZE=25000 diff --git a/samples/wifi/shutdown/sysbuild.conf b/samples/wifi/shutdown/sysbuild.conf index 32948cdda47c..d9e7bee8f47b 100644 --- a/samples/wifi/shutdown/sysbuild.conf +++ b/samples/wifi/shutdown/sysbuild.conf @@ -4,4 +4,4 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -SB_CONFIG_WIFI_NRF700X=y +SB_CONFIG_WIFI_NRF70=y diff --git a/samples/wifi/softap/README.rst b/samples/wifi/softap/README.rst index 870351da6418..2896ca8e0000 100644 --- a/samples/wifi/softap/README.rst +++ b/samples/wifi/softap/README.rst @@ -25,7 +25,7 @@ Then, the sample lists the connected devices. You can enable the SoftAP mode by setting the below configuration options in the sample project configuration file: -* :kconfig:option:`CONFIG_NRF700X_AP_MODE`: Enables access point mode support. +* :kconfig:option:`CONFIG_NRF70_AP_MODE`: Enables access point mode support. * :kconfig:option:`CONFIG_WPA_SUPP_AP`: Enables access point support. The sample uses the :ref:`lib_wifi_ready` library to check Wi-Fi readiness. diff --git a/samples/wifi/softap/prj.conf b/samples/wifi/softap/prj.conf index 97ba89e3e170..37bac8d96499 100644 --- a/samples/wifi/softap/prj.conf +++ b/samples/wifi/softap/prj.conf @@ -4,14 +4,14 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y +CONFIG_WIFI_NRF70=y # WPA supplicant CONFIG_WPA_SUPP=y CONFIG_WIFI_READY_LIB=y # Soft AP -CONFIG_NRF700X_AP_MODE=y +CONFIG_NRF70_AP_MODE=y CONFIG_WPA_SUPP_AP=y CONFIG_WPA_SUPP_LOG_LEVEL_INF=y diff --git a/samples/wifi/softap/sysbuild.conf b/samples/wifi/softap/sysbuild.conf index 32948cdda47c..d9e7bee8f47b 100644 --- a/samples/wifi/softap/sysbuild.conf +++ b/samples/wifi/softap/sysbuild.conf @@ -4,4 +4,4 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -SB_CONFIG_WIFI_NRF700X=y +SB_CONFIG_WIFI_NRF70=y diff --git a/samples/wifi/sta/Kconfig b/samples/wifi/sta/Kconfig index 2f738998501e..be7900a68680 100644 --- a/samples/wifi/sta/Kconfig +++ b/samples/wifi/sta/Kconfig @@ -12,7 +12,7 @@ config CONNECTION_IDLE_TIMEOUT int "Time to be waited for a station to connect" default 30 -config NRF700X_QSPI_ENCRYPTION_KEY +config NRF70_QSPI_ENCRYPTION_KEY string "16 bytes QSPI encryption key, only for testing purposes" depends on BOARD_NRF7002DK_NRF5340_CPUAPP help diff --git a/samples/wifi/sta/README.rst b/samples/wifi/sta/README.rst index fed113b4ab54..6cf312358438 100644 --- a/samples/wifi/sta/README.rst +++ b/samples/wifi/sta/README.rst @@ -62,7 +62,7 @@ Quad Serial Peripheral Interface (QSPI) encryption ************************************************** This sample demonstrates QSPI encryption API usage. -You can set the key using the :kconfig:option:`CONFIG_NRF700X_QSPI_ENCRYPTION_KEY` Kconfig option. +You can set the key using the :kconfig:option:`CONFIG_NRF70_QSPI_ENCRYPTION_KEY` Kconfig option. If encryption of the QSPI traffic is required for the production devices, matching keys must be programmed in both the nRF7002 OTP and non-volatile storage associated with the host. The key from non-volatile storage must be set as the encryption key using the APIs. @@ -193,7 +193,7 @@ Application's network connection will be lost during the recovery process, and i Testing ======= -To test RPU recovery, you must build the sample with :kconfig:option:`CONFIG_SHELL` and :kconfig:option:`CONFIG_NRF700X_UTIL` Kconfig options. +To test RPU recovery, you must build the sample with :kconfig:option:`CONFIG_SHELL` and :kconfig:option:`CONFIG_NRF70_UTIL` Kconfig options. #. Trigger RPU recovery using the following command: diff --git a/samples/wifi/sta/prj.conf b/samples/wifi/sta/prj.conf index 426a44a2093a..8b9a00536331 100644 --- a/samples/wifi/sta/prj.conf +++ b/samples/wifi/sta/prj.conf @@ -4,7 +4,7 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y +CONFIG_WIFI_NRF70=y # WPA supplicant CONFIG_WPA_SUPP=y @@ -34,7 +34,7 @@ CONFIG_NET_PKT_TX_COUNT=8 CONFIG_NET_BUF_RX_COUNT=8 CONFIG_NET_BUF_TX_COUNT=16 CONFIG_NET_BUF_DATA_SIZE=128 -CONFIG_NRF700X_RX_NUM_BUFS=16 +CONFIG_NRF70_RX_NUM_BUFS=16 CONFIG_HEAP_MEM_POOL_SIZE=90000 CONFIG_NET_TC_TX_COUNT=1 diff --git a/samples/wifi/sta/src/main.c b/samples/wifi/sta/src/main.c index 1a8334d802ad..96ceeabb5a12 100644 --- a/samples/wifi/sta/src/main.c +++ b/samples/wifi/sta/src/main.c @@ -257,11 +257,11 @@ int start_app(void) { #if defined(CONFIG_BOARD_NRF7002DK_NRF7001_NRF5340_CPUAPP) || \ defined(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP) - if (strlen(CONFIG_NRF700X_QSPI_ENCRYPTION_KEY)) { + if (strlen(CONFIG_NRF70_QSPI_ENCRYPTION_KEY)) { int ret; char key[QSPI_KEY_LEN_BYTES]; - ret = bytes_from_str(CONFIG_NRF700X_QSPI_ENCRYPTION_KEY, key, sizeof(key)); + ret = bytes_from_str(CONFIG_NRF70_QSPI_ENCRYPTION_KEY, key, sizeof(key)); if (ret) { LOG_ERR("Failed to parse encryption key: %d\n", ret); return 0; diff --git a/samples/wifi/sta/sysbuild.conf b/samples/wifi/sta/sysbuild.conf index 32948cdda47c..d9e7bee8f47b 100644 --- a/samples/wifi/sta/sysbuild.conf +++ b/samples/wifi/sta/sysbuild.conf @@ -4,4 +4,4 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -SB_CONFIG_WIFI_NRF700X=y +SB_CONFIG_WIFI_NRF70=y diff --git a/samples/wifi/thread_coex/prj.conf b/samples/wifi/thread_coex/prj.conf index ccdaae1c134f..12a729e512e9 100644 --- a/samples/wifi/thread_coex/prj.conf +++ b/samples/wifi/thread_coex/prj.conf @@ -4,7 +4,7 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y +CONFIG_WIFI_NRF70=y # WPA supplicant CONFIG_WPA_SUPP=y @@ -72,9 +72,9 @@ CONFIG_NET_CONFIG_MY_IPV4_GW="192.168.1.1" CONFIG_WIFI_ZPERF_PKT_SIZE=1024 CONFIG_WIFI_ZPERF_RATE=10000 -CONFIG_NRF700X_MAX_TX_PENDING_QLEN=12 +CONFIG_NRF70_MAX_TX_PENDING_QLEN=12 CONFIG_NRF_WIFI_LOW_POWER=y -CONFIG_NRF700X_QSPI_LOW_POWER=n +CONFIG_NRF70_QSPI_LOW_POWER=n CONFIG_LOG_BUFFER_SIZE=2048 CONFIG_NET_MGMT_EVENT_QUEUE_TIMEOUT=5000 diff --git a/samples/wifi/thread_coex/src/main.c b/samples/wifi/thread_coex/src/main.c index 358c068cd10a..5d470d218311 100644 --- a/samples/wifi/thread_coex/src/main.c +++ b/samples/wifi/thread_coex/src/main.c @@ -43,14 +43,14 @@ int main(void) return -1; } -#if !defined(CONFIG_COEX_SEP_ANTENNAS) && !(CONFIG_NRF700X_SR_COEX_RF_SWITCH) +#if !defined(CONFIG_COEX_SEP_ANTENNAS) && !(CONFIG_NRF70_SR_COEX_RF_SWITCH) BUILD_ASSERT("Shared antenna support is not available with nRF7002 shields"); #endif /* register callback functions */ wifi_init(); -#ifdef CONFIG_NRF700X_SR_COEX_RF_SWITCH +#ifdef CONFIG_NRF70_SR_COEX_RF_SWITCH /* Configure SR side (nRF5340 side) switch in nRF700x */ /* LOG_INF("Configure SR side switch"); */ ret = nrf_wifi_config_sr_switch(is_ant_mode_sep); @@ -58,9 +58,9 @@ int main(void) LOG_ERR("Unable to configure SR side switch: %d", ret); return ret; } -#endif /* CONFIG_NRF700X_SR_COEX_RF_SWITCH */ +#endif /* CONFIG_NRF70_SR_COEX_RF_SWITCH */ -#if defined(CONFIG_NRF700X_SR_COEX) +#if defined(CONFIG_NRF70_SR_COEX) /* Configure non-PTA registers of Coexistence Hardware */ /* LOG_INF("Configuring non-PTA registers."); */ ret = nrf_wifi_coex_config_non_pta(is_ant_mode_sep, is_sr_protocol_ble); @@ -68,7 +68,7 @@ int main(void) LOG_ERR("Configuring non-PTA registers of CoexHardware FAIL"); return ret; } -#endif /* CONFIG_NRF700X_SR_COEX */ +#endif /* CONFIG_NRF70_SR_COEX */ ret = wifi_tput_ot_tput(test_wifi, is_ant_mode_sep, test_thread, is_ot_client, is_wifi_server, is_wifi_zperf_udp, is_ot_zperf_udp, diff --git a/samples/wifi/thread_coex/src/ot_coex_functions.c b/samples/wifi/thread_coex/src/ot_coex_functions.c index f3b6515daef2..aa13a73ee906 100644 --- a/samples/wifi/thread_coex/src/ot_coex_functions.c +++ b/samples/wifi/thread_coex/src/ot_coex_functions.c @@ -697,9 +697,9 @@ int wifi_tput_ot_tput(bool test_wifi, bool is_ant_mode_sep, bool test_thread, bo LOG_ERR("further is not meaningful. So, exiting the test"); return ret; } -#if defined(CONFIG_NRF700X_SR_COEX) +#if defined(CONFIG_NRF70_SR_COEX) config_pta(is_ant_mode_sep, is_ot_client, is_wifi_server, is_sr_protocol_ble); -#endif/* CONFIG_NRF700X_SR_COEX */ +#endif/* CONFIG_NRF70_SR_COEX */ } if (test_thread) { LOG_INF("Thread operating channel = %d", CONFIG_OT_CHANNEL); diff --git a/samples/wifi/thread_coex/sysbuild.conf b/samples/wifi/thread_coex/sysbuild.conf index 32948cdda47c..d9e7bee8f47b 100644 --- a/samples/wifi/thread_coex/sysbuild.conf +++ b/samples/wifi/thread_coex/sysbuild.conf @@ -4,4 +4,4 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -SB_CONFIG_WIFI_NRF700X=y +SB_CONFIG_WIFI_NRF70=y diff --git a/samples/wifi/throughput/overlay-high-performance.conf b/samples/wifi/throughput/overlay-high-performance.conf index 76976d86ce87..918fae392509 100644 --- a/samples/wifi/throughput/overlay-high-performance.conf +++ b/samples/wifi/throughput/overlay-high-performance.conf @@ -1,5 +1,5 @@ -CONFIG_NRF700X_AP_MODE=n -CONFIG_NRF700X_P2P_MODE=n +CONFIG_NRF70_AP_MODE=n +CONFIG_NRF70_P2P_MODE=n CONFIG_NET_PKT_TX_COUNT=30 CONFIG_NET_PKT_RX_COUNT=30 CONFIG_NET_BUF_TX_COUNT=60 @@ -7,10 +7,10 @@ CONFIG_NET_BUF_RX_COUNT=30 CONFIG_NET_BUF_DATA_SIZE=1100 CONFIG_HEAP_MEM_POOL_SIZE=230000 CONFIG_SPEED_OPTIMIZATIONS=y -CONFIG_NRF700X_QSPI_LOW_POWER=n -CONFIG_NRF700X_UTIL=n -CONFIG_NRF700X_MAX_TX_AGGREGATION=9 -CONFIG_NRF700X_MAX_TX_TOKENS=12 +CONFIG_NRF70_QSPI_LOW_POWER=n +CONFIG_NRF70_UTIL=n +CONFIG_NRF70_MAX_TX_AGGREGATION=9 +CONFIG_NRF70_MAX_TX_TOKENS=12 CONFIG_POSIX_MAX_FDS=20 CONFIG_NET_SOCKETS_POLL_MAX=20 # Sockets: select + poll take up more stack diff --git a/samples/wifi/throughput/overlay-iot-devices.conf b/samples/wifi/throughput/overlay-iot-devices.conf index 01826244dca5..1c6ab2231723 100644 --- a/samples/wifi/throughput/overlay-iot-devices.conf +++ b/samples/wifi/throughput/overlay-iot-devices.conf @@ -1,17 +1,17 @@ -CONFIG_NRF700X_AP_MODE=n -CONFIG_NRF700X_P2P_MODE=n +CONFIG_NRF70_AP_MODE=n +CONFIG_NRF70_P2P_MODE=n CONFIG_NET_PKT_TX_COUNT=6 CONFIG_NET_PKT_RX_COUNT=6 CONFIG_NET_BUF_TX_COUNT=12 CONFIG_NET_BUF_RX_COUNT=6 -CONFIG_NRF700X_RX_NUM_BUFS=6 +CONFIG_NRF70_RX_NUM_BUFS=6 CONFIG_NET_BUF_DATA_SIZE=800 CONFIG_HEAP_MEM_POOL_SIZE=230000 CONFIG_SPEED_OPTIMIZATIONS=y -CONFIG_NRF700X_QSPI_LOW_POWER=n -CONFIG_NRF700X_UTIL=n -CONFIG_NRF700X_MAX_TX_AGGREGATION=1 -CONFIG_NRF700X_MAX_TX_TOKENS=5 +CONFIG_NRF70_QSPI_LOW_POWER=n +CONFIG_NRF70_UTIL=n +CONFIG_NRF70_MAX_TX_AGGREGATION=1 +CONFIG_NRF70_MAX_TX_TOKENS=5 CONFIG_POSIX_MAX_FDS=20 CONFIG_NET_SOCKETS_POLL_MAX=20 # Sockets: select + poll take up more stack diff --git a/samples/wifi/throughput/overlay-memory-optimized.conf b/samples/wifi/throughput/overlay-memory-optimized.conf index a9fef166df7d..e5fa6ca28bf9 100644 --- a/samples/wifi/throughput/overlay-memory-optimized.conf +++ b/samples/wifi/throughput/overlay-memory-optimized.conf @@ -1,17 +1,17 @@ -CONFIG_NRF700X_AP_MODE=n -CONFIG_NRF700X_P2P_MODE=n +CONFIG_NRF70_AP_MODE=n +CONFIG_NRF70_P2P_MODE=n CONFIG_NET_PKT_TX_COUNT=6 CONFIG_NET_PKT_RX_COUNT=6 CONFIG_NET_BUF_TX_COUNT=12 CONFIG_NET_BUF_RX_COUNT=6 -CONFIG_NRF700X_RX_NUM_BUFS=6 +CONFIG_NRF70_RX_NUM_BUFS=6 CONFIG_NET_BUF_DATA_SIZE=500 CONFIG_HEAP_MEM_POOL_SIZE=230000 CONFIG_SPEED_OPTIMIZATIONS=y -CONFIG_NRF700X_QSPI_LOW_POWER=n -CONFIG_NRF700X_UTIL=n -CONFIG_NRF700X_MAX_TX_AGGREGATION=1 -CONFIG_NRF700X_MAX_TX_TOKENS=5 +CONFIG_NRF70_QSPI_LOW_POWER=n +CONFIG_NRF70_UTIL=n +CONFIG_NRF70_MAX_TX_AGGREGATION=1 +CONFIG_NRF70_MAX_TX_TOKENS=5 CONFIG_POSIX_MAX_FDS=20 CONFIG_NET_SOCKETS_POLL_MAX=20 # Sockets: select + poll take up more stack diff --git a/samples/wifi/throughput/overlay-rx-prio.conf b/samples/wifi/throughput/overlay-rx-prio.conf index bbe8edd3576a..5184ba081339 100644 --- a/samples/wifi/throughput/overlay-rx-prio.conf +++ b/samples/wifi/throughput/overlay-rx-prio.conf @@ -1,17 +1,17 @@ -CONFIG_NRF700X_AP_MODE=n -CONFIG_NRF700X_P2P_MODE=n +CONFIG_NRF70_AP_MODE=n +CONFIG_NRF70_P2P_MODE=n CONFIG_NET_PKT_TX_COUNT=5 CONFIG_NET_PKT_RX_COUNT=64 CONFIG_NET_BUF_TX_COUNT=10 CONFIG_NET_BUF_RX_COUNT=64 -CONFIG_NRF700X_RX_NUM_BUFS=64 +CONFIG_NRF70_RX_NUM_BUFS=64 CONFIG_NET_BUF_DATA_SIZE=1100 CONFIG_HEAP_MEM_POOL_SIZE=230000 CONFIG_SPEED_OPTIMIZATIONS=y -CONFIG_NRF700X_QSPI_LOW_POWER=n -CONFIG_NRF700X_UTIL=n -CONFIG_NRF700X_MAX_TX_AGGREGATION=2 -CONFIG_NRF700X_MAX_TX_TOKENS=5 +CONFIG_NRF70_QSPI_LOW_POWER=n +CONFIG_NRF70_UTIL=n +CONFIG_NRF70_MAX_TX_AGGREGATION=2 +CONFIG_NRF70_MAX_TX_TOKENS=5 CONFIG_POSIX_MAX_FDS=20 CONFIG_NET_SOCKETS_POLL_MAX=20 # Sockets: select + poll take up more stack diff --git a/samples/wifi/throughput/overlay-tx-prio.conf b/samples/wifi/throughput/overlay-tx-prio.conf index bf46d78f624b..2c97254bc5ce 100644 --- a/samples/wifi/throughput/overlay-tx-prio.conf +++ b/samples/wifi/throughput/overlay-tx-prio.conf @@ -1,17 +1,17 @@ -CONFIG_NRF700X_AP_MODE=n -CONFIG_NRF700X_P2P_MODE=n +CONFIG_NRF70_AP_MODE=n +CONFIG_NRF70_P2P_MODE=n CONFIG_NET_PKT_TX_COUNT=32 CONFIG_NET_PKT_RX_COUNT=10 CONFIG_NET_BUF_TX_COUNT=64 CONFIG_NET_BUF_RX_COUNT=10 -CONFIG_NRF700X_RX_NUM_BUFS=10 +CONFIG_NRF70_RX_NUM_BUFS=10 CONFIG_NET_BUF_DATA_SIZE=1100 CONFIG_HEAP_MEM_POOL_SIZE=230000 CONFIG_SPEED_OPTIMIZATIONS=y -CONFIG_NRF700X_QSPI_LOW_POWER=n -CONFIG_NRF700X_UTIL=n -CONFIG_NRF700X_MAX_TX_AGGREGATION=9 -CONFIG_NRF700X_MAX_TX_TOKENS=12 +CONFIG_NRF70_QSPI_LOW_POWER=n +CONFIG_NRF70_UTIL=n +CONFIG_NRF70_MAX_TX_AGGREGATION=9 +CONFIG_NRF70_MAX_TX_TOKENS=12 CONFIG_POSIX_MAX_FDS=20 CONFIG_NET_SOCKETS_POLL_MAX=20 # Sockets: select + poll take up more stack diff --git a/samples/wifi/throughput/prj.conf b/samples/wifi/throughput/prj.conf index dc9e2138af36..4679a6f4859a 100644 --- a/samples/wifi/throughput/prj.conf +++ b/samples/wifi/throughput/prj.conf @@ -4,7 +4,7 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y +CONFIG_WIFI_NRF70=y # WPA supplicant CONFIG_WPA_SUPP=y @@ -35,8 +35,8 @@ CONFIG_NET_PKT_TX_COUNT=8 CONFIG_NET_BUF_RX_COUNT=16 CONFIG_NET_BUF_TX_COUNT=16 CONFIG_NET_BUF_DATA_SIZE=128 -CONFIG_NRF700X_RX_NUM_BUFS=16 -CONFIG_NRF700X_MAX_TX_AGGREGATION=4 +CONFIG_NRF70_RX_NUM_BUFS=16 +CONFIG_NRF70_MAX_TX_AGGREGATION=4 # nRF700x is main consumer: (16 + 8) * 1600 = ~40KB + ~40KB control path (experimental) CONFIG_HEAP_MEM_POOL_SIZE=80000 CONFIG_NET_TC_TX_COUNT=1 diff --git a/samples/wifi/throughput/sysbuild.conf b/samples/wifi/throughput/sysbuild.conf index 32948cdda47c..d9e7bee8f47b 100644 --- a/samples/wifi/throughput/sysbuild.conf +++ b/samples/wifi/throughput/sysbuild.conf @@ -4,4 +4,4 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -SB_CONFIG_WIFI_NRF700X=y +SB_CONFIG_WIFI_NRF70=y diff --git a/samples/wifi/twt/prj.conf b/samples/wifi/twt/prj.conf index c0c088debe64..035649ad9e80 100644 --- a/samples/wifi/twt/prj.conf +++ b/samples/wifi/twt/prj.conf @@ -4,7 +4,7 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y +CONFIG_WIFI_NRF70=y # WPA supplicant CONFIG_WPA_SUPP=y @@ -33,8 +33,8 @@ CONFIG_NET_BUF_RX_COUNT=16 CONFIG_NET_BUF_DATA_SIZE=1500 CONFIG_HEAP_MEM_POOL_SIZE=180000 #CONFIG_SPEED_OPTIMIZATIONS=y -#CONFIG_NRF700X_MAX_TX_AGGREGATION=9 -#CONFIG_NRF700X_MAX_TX_TOKENS=12 +#CONFIG_NRF70_MAX_TX_AGGREGATION=9 +#CONFIG_NRF70_MAX_TX_TOKENS=12 CONFIG_NET_TC_TX_COUNT=1 # Below configs will increase tcp connection timeout diff --git a/samples/wifi/twt/sysbuild.conf b/samples/wifi/twt/sysbuild.conf index 32948cdda47c..d9e7bee8f47b 100644 --- a/samples/wifi/twt/sysbuild.conf +++ b/samples/wifi/twt/sysbuild.conf @@ -4,4 +4,4 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -SB_CONFIG_WIFI_NRF700X=y +SB_CONFIG_WIFI_NRF70=y diff --git a/samples/wifi/wfa_qt_app/prj.conf b/samples/wifi/wfa_qt_app/prj.conf index 8aab6aa34036..4a4bd07e0aab 100644 --- a/samples/wifi/wfa_qt_app/prj.conf +++ b/samples/wifi/wfa_qt_app/prj.conf @@ -4,7 +4,7 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # CONFIG_WIFI=y -CONFIG_WIFI_NRF700X=y +CONFIG_WIFI_NRF70=y CONFIG_WFA_QT_CONTROL_APP=y # Ideally this has to be done in the QT module, but we already override this in the # hostap module (7), so, hostap will override QT module's settings, so, we have to diff --git a/samples/wifi/wfa_qt_app/sysbuild.conf b/samples/wifi/wfa_qt_app/sysbuild.conf index 32948cdda47c..d9e7bee8f47b 100644 --- a/samples/wifi/wfa_qt_app/sysbuild.conf +++ b/samples/wifi/wfa_qt_app/sysbuild.conf @@ -4,4 +4,4 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -SB_CONFIG_WIFI_NRF700X=y +SB_CONFIG_WIFI_NRF70=y diff --git a/snippets/nrf70-driver-debug/overlay-nrf70-driver-debug.conf b/snippets/nrf70-driver-debug/overlay-nrf70-driver-debug.conf index 51633ff7ef53..ae4a07865cc9 100644 --- a/snippets/nrf70-driver-debug/overlay-nrf70-driver-debug.conf +++ b/snippets/nrf70-driver-debug/overlay-nrf70-driver-debug.conf @@ -9,7 +9,7 @@ CONFIG_SHELL_STACK_SIZE=4600 CONFIG_NET_SHELL=y CONFIG_SHELL_GETOPT=y CONFIG_SHELL_CMDS_RESIZE=n -CONFIG_NRF700X_UTIL=y +CONFIG_NRF70_UTIL=y CONFIG_NET_L2_WIFI_SHELL=y CONFIG_NET_STATISTICS=y CONFIG_NET_STATISTICS_WIFI=y diff --git a/subsys/mpsl/cx/Kconfig b/subsys/mpsl/cx/Kconfig index da062a3352a1..6e4b157df42d 100644 --- a/subsys/mpsl/cx/Kconfig +++ b/subsys/mpsl/cx/Kconfig @@ -13,7 +13,7 @@ config MPSL_CX_ANY_SUPPORT help Indicates that the device tree contains a nrf_radio_coex node. -config MPSL_CX_NRF700X_SUPPORT +config MPSL_CX_NRF70_SUPPORT bool default $(dt_nodelabel_has_compat,nrf_radio_coex,$(DT_COMPAT_CX_NRF700X)) help @@ -57,7 +57,7 @@ choice MPSL_CX_CHOICE prompt "Radio Coexistence interface implementation" config MPSL_CX_NRF700X - depends on MPSL_CX_NRF700X_SUPPORT + depends on MPSL_CX_NRF70_SUPPORT select NRFX_GPIOTE if !MPSL_CX_PIN_FORWARDER select GPIO if !MPSL_CX_PIN_FORWARDER imply NRF_RPC if SOC_SERIES_NRF53X diff --git a/subsys/net/lib/softap_wifi_provision/Kconfig b/subsys/net/lib/softap_wifi_provision/Kconfig index a2e5fedded95..515d569818cb 100644 --- a/subsys/net/lib/softap_wifi_provision/Kconfig +++ b/subsys/net/lib/softap_wifi_provision/Kconfig @@ -8,7 +8,7 @@ menuconfig SOFTAP_WIFI_PROVISION bool "SoftAP Wi-Fi provision library [EXPERIMENTAL]" select EXPERIMENTAL depends on NANOPB - depends on NRF700X_AP_MODE + depends on NRF70_AP_MODE depends on WPA_SUPP_AP depends on SMF depends on NET_DHCPV4_SERVER diff --git a/sysbuild/CMakeLists.txt b/sysbuild/CMakeLists.txt index cfebc303868e..f29f54fcd999 100644 --- a/sysbuild/CMakeLists.txt +++ b/sysbuild/CMakeLists.txt @@ -358,8 +358,8 @@ function(${SYSBUILD_CURRENT_MODULE_NAME}_pre_cmake) set_config_bool(${DEFAULT_IMAGE} CONFIG_BT_FAST_PAIR n) endif() - if(SB_CONFIG_WIFI_NRF700X) - set_config_bool(${DEFAULT_IMAGE} CONFIG_WIFI_NRF700X y) + if(SB_CONFIG_WIFI_NRF70) + set_config_bool(${DEFAULT_IMAGE} CONFIG_WIFI_NRF70 y) foreach(config WIFI_PATCHES_EXT_FLASH_DISABLED WIFI_PATCHES_EXT_FLASH_XIP WIFI_PATCHES_EXT_FLASH_STORE) @@ -381,7 +381,7 @@ function(${SYSBUILD_CURRENT_MODULE_NAME}_pre_cmake) set_config_bool(${DEFAULT_IMAGE} CONFIG_NRF_WIFI_FW_PATCH_DFU ${SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_WIFI_FW_PATCH}) endif() else() - set_config_bool(${DEFAULT_IMAGE} CONFIG_WIFI_NRF700X n) + set_config_bool(${DEFAULT_IMAGE} CONFIG_WIFI_NRF70 n) endif() if(SB_CONFIG_ZEPHYR_CONNECTEDHOMEIP_MODULE) diff --git a/sysbuild/Kconfig.dfu b/sysbuild/Kconfig.dfu index 59c62f53e650..6bbe5ff6616e 100644 --- a/sysbuild/Kconfig.dfu +++ b/sysbuild/Kconfig.dfu @@ -32,7 +32,7 @@ config DFU_MULTI_IMAGE_PACKAGE_WIFI_FW_PATCH bool "nRF70 firmware patch" depends on PARTITION_MANAGER depends on BOOTLOADER_MCUBOOT - depends on WIFI_NRF700X + depends on WIFI_NRF70 depends on (WIFI_PATCHES_EXT_FLASH_XIP || WIFI_PATCHES_EXT_FLASH_STORE) help Enabling this option adds support for Device Firmware Update (DFU) for the nRF70 Series diff --git a/sysbuild/Kconfig.wifi b/sysbuild/Kconfig.wifi index 398033674bf6..937166fbed11 100644 --- a/sysbuild/Kconfig.wifi +++ b/sysbuild/Kconfig.wifi @@ -4,32 +4,32 @@ menu "Wi-Fi" -menuconfig WIFI_NRF700X +menuconfig WIFI_NRF70 bool "nRF700x" -if WIFI_NRF700X +if WIFI_NRF70 -choice WIFI_NRF700X_OPER_MODES +choice WIFI_NRF70_OPER_MODES bool "nRF700x operating mode" - default WIFI_NRF700X_SYSTEM_MODE + default WIFI_NRF70_SYSTEM_MODE help Select the operating mode of the nRF700x driver -config WIFI_NRF700X_SYSTEM_MODE - bool "Enable nRF700X system mode" +config WIFI_NRF70_SYSTEM_MODE + bool "Enable nRF70 system mode" help Select this option to enable system mode of the nRF700x driver -config WIFI_NRF700X_SCAN_ONLY - bool "Enable nRF700X scan only mode" +config WIFI_NRF70_SCAN_ONLY + bool "Enable nRF70 scan only mode" help Select this option to enable scan only mode of the nRF700x driver -config WIFI_NRF700X_RADIO_TEST +config WIFI_NRF70_RADIO_TEST bool "Radio test mode of the nRF700x driver" -config WIFI_NRF700X_SYSTEM_WITH_RAW_MODES - bool "Enable nRF700X system mode with raw modes" +config WIFI_NRF70_SYSTEM_WITH_RAW_MODES + bool "Enable nRF70 system mode with raw modes" help Select this option to enable system mode of the nRF700x driver with raw modes @@ -60,6 +60,6 @@ config WIFI_PATCHES_EXT_FLASH_STORE endchoice -endif # WIFI_NRF700X +endif # WIFI_NRF70 endmenu diff --git a/sysbuild/Kconfig.zip b/sysbuild/Kconfig.zip index 6dceed6e33a5..0d50fcfc1ab1 100644 --- a/sysbuild/Kconfig.zip +++ b/sysbuild/Kconfig.zip @@ -33,7 +33,7 @@ config DFU_ZIP_NET config DFU_ZIP_WIFI_FW_PATCH bool "nRF70 firmware patch" depends on PARTITION_MANAGER - depends on WIFI_NRF700X + depends on WIFI_NRF70 depends on (WIFI_PATCHES_EXT_FLASH_XIP || WIFI_PATCHES_EXT_FLASH_STORE) default y help diff --git a/tests/lib/location/location_lib_autoconf_ext.h b/tests/lib/location/location_lib_autoconf_ext.h index 83f7cbb8d29c..43cefac9c382 100644 --- a/tests/lib/location/location_lib_autoconf_ext.h +++ b/tests/lib/location/location_lib_autoconf_ext.h @@ -9,7 +9,7 @@ */ #define CONFIG_NRF_MODEM_LIB 1 -#define CONFIG_WIFI_NRF700X 1 +#define CONFIG_WIFI_NRF70 1 #define CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS 0 #define CONFIG_WIFI_MGMT_RAW_SCAN_RESULT_LENGTH 10 #define CONFIG_NET_MGMT_EVENT 1 From ea3aac182856cdfe5476095926e010e53684dcb1 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 5 Aug 2024 20:50:44 +0530 Subject: [PATCH 04/25] boards: shields: Use upstream nRF7002EK shields nRF70 EK shields are now upstreamed. Signed-off-by: Chaitanya Tata --- boards/shields/nrf7002ek/Kconfig.shield | 8 ---- .../boards/nrf52840dk_nrf52840.overlay | 5 --- .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 16 ------- .../boards/nrf9151dk_nrf9151.overlay | 6 --- .../boards/nrf9151dk_nrf9151_ns.overlay | 6 --- .../boards/nrf9160dk_nrf9160_ns.overlay | 39 ---------------- .../boards/nrf9161dk_nrf9161.overlay | 6 --- .../boards/nrf9161dk_nrf9161_ns.overlay | 6 --- .../boards/thingy53_nrf5340_cpuapp.overlay | 5 --- boards/shields/nrf7002ek/nrf7002ek.overlay | 45 ------------------- .../shields/nrf7002ek/nrf7002ek_coex.overlay | 16 ------- .../shields/nrf7002ek_nrf7000/Kconfig.shield | 13 ------ .../boards/nrf52840dk_nrf52840.overlay | 5 --- .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 16 ------- .../boards/nrf9151dk_nrf9151.overlay | 6 --- .../boards/nrf9151dk_nrf9151_ns.overlay | 6 --- .../boards/nrf9160dk_nrf9160_ns.overlay | 39 ---------------- .../boards/nrf9161dk_nrf9161.overlay | 6 --- .../boards/nrf9161dk_nrf9161_ns.overlay | 6 --- .../boards/thingy53_nrf5340_cpuapp.overlay | 5 --- .../nrf7002ek_nrf7000.overlay | 45 ------------------- .../nrf7002ek_nrf7000_coex.overlay | 16 ------- .../shields/nrf7002ek_nrf7001/Kconfig.shield | 11 ----- .../boards/nrf52840dk_nrf52840.overlay | 5 --- .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 16 ------- .../boards/nrf9151dk_nrf9151.overlay | 6 --- .../boards/nrf9151dk_nrf9151_ns.overlay | 6 --- .../boards/nrf9160dk_nrf9160_ns.overlay | 39 ---------------- .../boards/nrf9161dk_nrf9161.overlay | 6 --- .../boards/nrf9161dk_nrf9161_ns.overlay | 6 --- .../boards/thingy53_nrf5340_cpuapp.overlay | 5 --- .../nrf7002ek_nrf7001.overlay | 45 ------------------- .../nrf7002ek_nrf7001_coex.overlay | 16 ------- samples/matter/lock/README.rst | 4 +- samples/matter/lock/sample.yaml | 2 +- samples/wifi/ble_coex/README.rst | 4 +- samples/wifi/ble_coex/sample.yaml | 6 +-- samples/wifi/thread_coex/README.rst | 4 +- samples/wifi/thread_coex/prj.conf | 2 + samples/wifi/thread_coex/sample.yaml | 4 +- 40 files changed, 14 insertions(+), 494 deletions(-) delete mode 100644 boards/shields/nrf7002ek/Kconfig.shield delete mode 100644 boards/shields/nrf7002ek/boards/nrf52840dk_nrf52840.overlay delete mode 100644 boards/shields/nrf7002ek/boards/nrf5340dk_nrf5340_cpuapp.overlay delete mode 100644 boards/shields/nrf7002ek/boards/nrf9151dk_nrf9151.overlay delete mode 100644 boards/shields/nrf7002ek/boards/nrf9151dk_nrf9151_ns.overlay delete mode 100644 boards/shields/nrf7002ek/boards/nrf9160dk_nrf9160_ns.overlay delete mode 100644 boards/shields/nrf7002ek/boards/nrf9161dk_nrf9161.overlay delete mode 100644 boards/shields/nrf7002ek/boards/nrf9161dk_nrf9161_ns.overlay delete mode 100644 boards/shields/nrf7002ek/boards/thingy53_nrf5340_cpuapp.overlay delete mode 100644 boards/shields/nrf7002ek/nrf7002ek.overlay delete mode 100644 boards/shields/nrf7002ek/nrf7002ek_coex.overlay delete mode 100644 boards/shields/nrf7002ek_nrf7000/Kconfig.shield delete mode 100644 boards/shields/nrf7002ek_nrf7000/boards/nrf52840dk_nrf52840.overlay delete mode 100644 boards/shields/nrf7002ek_nrf7000/boards/nrf5340dk_nrf5340_cpuapp.overlay delete mode 100644 boards/shields/nrf7002ek_nrf7000/boards/nrf9151dk_nrf9151.overlay delete mode 100644 boards/shields/nrf7002ek_nrf7000/boards/nrf9151dk_nrf9151_ns.overlay delete mode 100644 boards/shields/nrf7002ek_nrf7000/boards/nrf9160dk_nrf9160_ns.overlay delete mode 100644 boards/shields/nrf7002ek_nrf7000/boards/nrf9161dk_nrf9161.overlay delete mode 100644 boards/shields/nrf7002ek_nrf7000/boards/nrf9161dk_nrf9161_ns.overlay delete mode 100644 boards/shields/nrf7002ek_nrf7000/boards/thingy53_nrf5340_cpuapp.overlay delete mode 100644 boards/shields/nrf7002ek_nrf7000/nrf7002ek_nrf7000.overlay delete mode 100644 boards/shields/nrf7002ek_nrf7000/nrf7002ek_nrf7000_coex.overlay delete mode 100644 boards/shields/nrf7002ek_nrf7001/Kconfig.shield delete mode 100644 boards/shields/nrf7002ek_nrf7001/boards/nrf52840dk_nrf52840.overlay delete mode 100644 boards/shields/nrf7002ek_nrf7001/boards/nrf5340dk_nrf5340_cpuapp.overlay delete mode 100644 boards/shields/nrf7002ek_nrf7001/boards/nrf9151dk_nrf9151.overlay delete mode 100644 boards/shields/nrf7002ek_nrf7001/boards/nrf9151dk_nrf9151_ns.overlay delete mode 100644 boards/shields/nrf7002ek_nrf7001/boards/nrf9160dk_nrf9160_ns.overlay delete mode 100644 boards/shields/nrf7002ek_nrf7001/boards/nrf9161dk_nrf9161.overlay delete mode 100644 boards/shields/nrf7002ek_nrf7001/boards/nrf9161dk_nrf9161_ns.overlay delete mode 100644 boards/shields/nrf7002ek_nrf7001/boards/thingy53_nrf5340_cpuapp.overlay delete mode 100644 boards/shields/nrf7002ek_nrf7001/nrf7002ek_nrf7001.overlay delete mode 100644 boards/shields/nrf7002ek_nrf7001/nrf7002ek_nrf7001_coex.overlay diff --git a/boards/shields/nrf7002ek/Kconfig.shield b/boards/shields/nrf7002ek/Kconfig.shield deleted file mode 100644 index e041e8f44057..000000000000 --- a/boards/shields/nrf7002ek/Kconfig.shield +++ /dev/null @@ -1,8 +0,0 @@ -# -# Copyright (c) 2023 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -config SHIELD_NRF7002EK - def_bool $(shields_list_contains,nrf7002ek) diff --git a/boards/shields/nrf7002ek/boards/nrf52840dk_nrf52840.overlay b/boards/shields/nrf7002ek/boards/nrf52840dk_nrf52840.overlay deleted file mode 100644 index da54dfdde269..000000000000 --- a/boards/shields/nrf7002ek/boards/nrf52840dk_nrf52840.overlay +++ /dev/null @@ -1,5 +0,0 @@ -/* Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - #include "../nrf7002ek_coex.overlay" diff --git a/boards/shields/nrf7002ek/boards/nrf5340dk_nrf5340_cpuapp.overlay b/boards/shields/nrf7002ek/boards/nrf5340dk_nrf5340_cpuapp.overlay deleted file mode 100644 index 06770a0bc229..000000000000 --- a/boards/shields/nrf7002ek/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ -#include "../nrf7002ek_coex.overlay" - -/* This node by default forwards the UART1 pins to CPUNET, but as UART1 uses - * same pins as bucken and iovdd-ctrl, we need these pins to be controlled by - * the CPUAPP. Since a child node of gpio_fwd cannot be disabled, hence - * the entire node is disabled. If the application needs to forward other pins - * to the CPUNET, it should create a separate instance of nrf-gpio-forwarder - * and use it instead. - */ -&gpio_fwd { - status = "disabled"; -}; diff --git a/boards/shields/nrf7002ek/boards/nrf9151dk_nrf9151.overlay b/boards/shields/nrf7002ek/boards/nrf9151dk_nrf9151.overlay deleted file mode 100644 index 7ebbb062c193..000000000000 --- a/boards/shields/nrf7002ek/boards/nrf9151dk_nrf9151.overlay +++ /dev/null @@ -1,6 +0,0 @@ -/* Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include diff --git a/boards/shields/nrf7002ek/boards/nrf9151dk_nrf9151_ns.overlay b/boards/shields/nrf7002ek/boards/nrf9151dk_nrf9151_ns.overlay deleted file mode 100644 index 7ebbb062c193..000000000000 --- a/boards/shields/nrf7002ek/boards/nrf9151dk_nrf9151_ns.overlay +++ /dev/null @@ -1,6 +0,0 @@ -/* Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include diff --git a/boards/shields/nrf7002ek/boards/nrf9160dk_nrf9160_ns.overlay b/boards/shields/nrf7002ek/boards/nrf9160dk_nrf9160_ns.overlay deleted file mode 100644 index b84f12d3dc76..000000000000 --- a/boards/shields/nrf7002ek/boards/nrf9160dk_nrf9160_ns.overlay +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/* Disabled because of conflicts on P0.00 and P0.01 - Arduino pins D0 and D1 - * (iovdd-ctrl-gpios and bucken-gpios in nrf7002ek, respectively). */ -&uart1 { - status = "disabled"; -}; - -/* Typically we use GPIO extender to resolve these conflicts but the - * GPIO pin used by extender itself conflicts with Wi-Fi (0.6), so, - * disable LEDs and Button0/1. - */ -&led0 { - status = "disabled"; -}; - -&led1 { - status = "disabled"; -}; - -&led2 { - status = "disabled"; -}; - -&led3 { - status = "disabled"; -}; - -&button0 { - status = "disabled"; -}; - -&button1 { - status = "disabled"; -}; diff --git a/boards/shields/nrf7002ek/boards/nrf9161dk_nrf9161.overlay b/boards/shields/nrf7002ek/boards/nrf9161dk_nrf9161.overlay deleted file mode 100644 index b9b798252066..000000000000 --- a/boards/shields/nrf7002ek/boards/nrf9161dk_nrf9161.overlay +++ /dev/null @@ -1,6 +0,0 @@ -/* Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include diff --git a/boards/shields/nrf7002ek/boards/nrf9161dk_nrf9161_ns.overlay b/boards/shields/nrf7002ek/boards/nrf9161dk_nrf9161_ns.overlay deleted file mode 100644 index b9b798252066..000000000000 --- a/boards/shields/nrf7002ek/boards/nrf9161dk_nrf9161_ns.overlay +++ /dev/null @@ -1,6 +0,0 @@ -/* Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include diff --git a/boards/shields/nrf7002ek/boards/thingy53_nrf5340_cpuapp.overlay b/boards/shields/nrf7002ek/boards/thingy53_nrf5340_cpuapp.overlay deleted file mode 100644 index da54dfdde269..000000000000 --- a/boards/shields/nrf7002ek/boards/thingy53_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,5 +0,0 @@ -/* Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - #include "../nrf7002ek_coex.overlay" diff --git a/boards/shields/nrf7002ek/nrf7002ek.overlay b/boards/shields/nrf7002ek/nrf7002ek.overlay deleted file mode 100644 index dc34d9245fdf..000000000000 --- a/boards/shields/nrf7002ek/nrf7002ek.overlay +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ -#include - -/ { - nordic_wlan0: nordic_wlan0 { - compatible = "nordic,wlan0"; - status = "okay"; - }; - - chosen { - zephyr,wifi = &nordic_wlan0; - }; - - nrf70_tx_power_ceiling: nrf70_tx_power_ceiling_node { - status = "okay"; - compatible = "nordic,nrf700x-tx-power-ceiling"; - max-pwr-2g-dsss = <0x54>; - max-pwr-2g-mcs0 = <0x40>; - max-pwr-2g-mcs7 = <0x40>; - max-pwr-5g-low-mcs0 = <0x34>; - max-pwr-5g-low-mcs7 = <0x34>; - max-pwr-5g-mid-mcs0 = <0x34>; - max-pwr-5g-mid-mcs7 = <0x34>; - max-pwr-5g-high-mcs0 = <0x30>; - max-pwr-5g-high-mcs7 = <0x30>; - }; -}; - -&arduino_spi { - status = "okay"; - - nrf700x: nrf7002@0 { - compatible = "nordic,nrf700x-spi"; - status = "okay"; - reg = <0>; - spi-max-frequency = ; - - iovdd-ctrl-gpios = <&arduino_header 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* D0 */ - bucken-gpios = <&arduino_header 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* D1 */ - host-irq-gpios = <&arduino_header 13 GPIO_ACTIVE_HIGH>; /* D7 */ - }; -}; diff --git a/boards/shields/nrf7002ek/nrf7002ek_coex.overlay b/boards/shields/nrf7002ek/nrf7002ek_coex.overlay deleted file mode 100644 index d6489dee9800..000000000000 --- a/boards/shields/nrf7002ek/nrf7002ek_coex.overlay +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/ { - nrf_radio_coex: nrf7002-coex { - status = "okay"; - compatible = "nordic,nrf700x-coex"; - status0-gpios = <&arduino_header 8 GPIO_ACTIVE_HIGH>; /* D2 */ - req-gpios = <&arduino_header 9 GPIO_ACTIVE_HIGH>; /* D3 */ - grant-gpios = <&arduino_header 10 (GPIO_PULL_DOWN | GPIO_ACTIVE_LOW)>; /* D4 */ - swctrl1-gpios = <&arduino_header 12 GPIO_ACTIVE_HIGH>; /* D6 */ - srrf-switch-gpios = <&arduino_header 14 GPIO_ACTIVE_HIGH>; /* D8 */ - }; -}; diff --git a/boards/shields/nrf7002ek_nrf7000/Kconfig.shield b/boards/shields/nrf7002ek_nrf7000/Kconfig.shield deleted file mode 100644 index 324389f498ab..000000000000 --- a/boards/shields/nrf7002ek_nrf7000/Kconfig.shield +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (c) 2023 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -config SHIELD_NRF7002EK_NRF7000 - def_bool $(shields_list_contains,nrf7002ek_nrf7000) - depends on !WPA_SUPP - -config BOARD_NRF7000 - bool - default y if SHIELD_NRF7002EK_NRF7000 diff --git a/boards/shields/nrf7002ek_nrf7000/boards/nrf52840dk_nrf52840.overlay b/boards/shields/nrf7002ek_nrf7000/boards/nrf52840dk_nrf52840.overlay deleted file mode 100644 index 89219e71d3a8..000000000000 --- a/boards/shields/nrf7002ek_nrf7000/boards/nrf52840dk_nrf52840.overlay +++ /dev/null @@ -1,5 +0,0 @@ -/* Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - #include "../nrf7002ek_nrf7000_coex.overlay" diff --git a/boards/shields/nrf7002ek_nrf7000/boards/nrf5340dk_nrf5340_cpuapp.overlay b/boards/shields/nrf7002ek_nrf7000/boards/nrf5340dk_nrf5340_cpuapp.overlay deleted file mode 100644 index 9d888bd42755..000000000000 --- a/boards/shields/nrf7002ek_nrf7000/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - #include "../nrf7002ek_nrf7000_coex.overlay" - -/* This node by default forwards the UART1 pins to CPUNET, but as UART1 uses - * same pins as bucken and iovdd-ctrl, we need these pins to be controlled by - * the CPUAPP. Since a child node of gpio_fwd cannot be disabled, hence - * the entire node is disabled. If the application needs to forward other pins - * to the CPUNET, it should create a separate instance of nrf-gpio-forwarder - * and use it instead. - */ -&gpio_fwd { - status = "disabled"; -}; diff --git a/boards/shields/nrf7002ek_nrf7000/boards/nrf9151dk_nrf9151.overlay b/boards/shields/nrf7002ek_nrf7000/boards/nrf9151dk_nrf9151.overlay deleted file mode 100644 index 7ebbb062c193..000000000000 --- a/boards/shields/nrf7002ek_nrf7000/boards/nrf9151dk_nrf9151.overlay +++ /dev/null @@ -1,6 +0,0 @@ -/* Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include diff --git a/boards/shields/nrf7002ek_nrf7000/boards/nrf9151dk_nrf9151_ns.overlay b/boards/shields/nrf7002ek_nrf7000/boards/nrf9151dk_nrf9151_ns.overlay deleted file mode 100644 index 7ebbb062c193..000000000000 --- a/boards/shields/nrf7002ek_nrf7000/boards/nrf9151dk_nrf9151_ns.overlay +++ /dev/null @@ -1,6 +0,0 @@ -/* Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include diff --git a/boards/shields/nrf7002ek_nrf7000/boards/nrf9160dk_nrf9160_ns.overlay b/boards/shields/nrf7002ek_nrf7000/boards/nrf9160dk_nrf9160_ns.overlay deleted file mode 100644 index b84f12d3dc76..000000000000 --- a/boards/shields/nrf7002ek_nrf7000/boards/nrf9160dk_nrf9160_ns.overlay +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/* Disabled because of conflicts on P0.00 and P0.01 - Arduino pins D0 and D1 - * (iovdd-ctrl-gpios and bucken-gpios in nrf7002ek, respectively). */ -&uart1 { - status = "disabled"; -}; - -/* Typically we use GPIO extender to resolve these conflicts but the - * GPIO pin used by extender itself conflicts with Wi-Fi (0.6), so, - * disable LEDs and Button0/1. - */ -&led0 { - status = "disabled"; -}; - -&led1 { - status = "disabled"; -}; - -&led2 { - status = "disabled"; -}; - -&led3 { - status = "disabled"; -}; - -&button0 { - status = "disabled"; -}; - -&button1 { - status = "disabled"; -}; diff --git a/boards/shields/nrf7002ek_nrf7000/boards/nrf9161dk_nrf9161.overlay b/boards/shields/nrf7002ek_nrf7000/boards/nrf9161dk_nrf9161.overlay deleted file mode 100644 index b9b798252066..000000000000 --- a/boards/shields/nrf7002ek_nrf7000/boards/nrf9161dk_nrf9161.overlay +++ /dev/null @@ -1,6 +0,0 @@ -/* Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include diff --git a/boards/shields/nrf7002ek_nrf7000/boards/nrf9161dk_nrf9161_ns.overlay b/boards/shields/nrf7002ek_nrf7000/boards/nrf9161dk_nrf9161_ns.overlay deleted file mode 100644 index b9b798252066..000000000000 --- a/boards/shields/nrf7002ek_nrf7000/boards/nrf9161dk_nrf9161_ns.overlay +++ /dev/null @@ -1,6 +0,0 @@ -/* Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include diff --git a/boards/shields/nrf7002ek_nrf7000/boards/thingy53_nrf5340_cpuapp.overlay b/boards/shields/nrf7002ek_nrf7000/boards/thingy53_nrf5340_cpuapp.overlay deleted file mode 100644 index 89219e71d3a8..000000000000 --- a/boards/shields/nrf7002ek_nrf7000/boards/thingy53_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,5 +0,0 @@ -/* Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - #include "../nrf7002ek_nrf7000_coex.overlay" diff --git a/boards/shields/nrf7002ek_nrf7000/nrf7002ek_nrf7000.overlay b/boards/shields/nrf7002ek_nrf7000/nrf7002ek_nrf7000.overlay deleted file mode 100644 index 6c900a684432..000000000000 --- a/boards/shields/nrf7002ek_nrf7000/nrf7002ek_nrf7000.overlay +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ -#include - -/ { - nordic_wlan0: nordic_wlan0 { - compatible = "nordic,wlan0"; - status = "okay"; - }; - - chosen { - zephyr,wifi = &nordic_wlan0; - }; - - nrf70_tx_power_ceiling: nrf70_tx_power_ceiling_node { - status = "okay"; - compatible = "nordic,nrf700x-tx-power-ceiling"; - max-pwr-2g-dsss = <0x54>; - max-pwr-2g-mcs0 = <0x40>; - max-pwr-2g-mcs7 = <0x40>; - max-pwr-5g-low-mcs0 = <0x34>; - max-pwr-5g-low-mcs7 = <0x34>; - max-pwr-5g-mid-mcs0 = <0x34>; - max-pwr-5g-mid-mcs7 = <0x34>; - max-pwr-5g-high-mcs0 = <0x30>; - max-pwr-5g-high-mcs7 = <0x30>; - }; -}; - -&arduino_spi { - status = "okay"; - - nrf700x: nrf7000@0 { - compatible = "nordic,nrf700x-spi"; - status = "okay"; - reg = <0>; - spi-max-frequency = ; - - iovdd-ctrl-gpios = <&arduino_header 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* D0 */ - bucken-gpios = <&arduino_header 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* D1 */ - host-irq-gpios = <&arduino_header 13 GPIO_ACTIVE_HIGH>; /* D7 */ - }; -}; diff --git a/boards/shields/nrf7002ek_nrf7000/nrf7002ek_nrf7000_coex.overlay b/boards/shields/nrf7002ek_nrf7000/nrf7002ek_nrf7000_coex.overlay deleted file mode 100644 index 31173eb1e76d..000000000000 --- a/boards/shields/nrf7002ek_nrf7000/nrf7002ek_nrf7000_coex.overlay +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/ { - nrf_radio_coex: nrf7000-coex { - status = "okay"; - compatible = "nordic,nrf700x-coex"; - status0-gpios = <&arduino_header 8 GPIO_ACTIVE_HIGH>; /* D2 */ - req-gpios = <&arduino_header 9 GPIO_ACTIVE_HIGH>; /* D3 */ - grant-gpios = <&arduino_header 10 (GPIO_PULL_DOWN | GPIO_ACTIVE_LOW)>; /* D4 */ - swctrl1-gpios = <&arduino_header 12 GPIO_ACTIVE_HIGH>; /* D6 */ - srrf-switch-gpios = <&arduino_header 14 GPIO_ACTIVE_HIGH>; /* D8 */ - }; -}; diff --git a/boards/shields/nrf7002ek_nrf7001/Kconfig.shield b/boards/shields/nrf7002ek_nrf7001/Kconfig.shield deleted file mode 100644 index f157e0208456..000000000000 --- a/boards/shields/nrf7002ek_nrf7001/Kconfig.shield +++ /dev/null @@ -1,11 +0,0 @@ -# -# Copyright (c) 2023 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# -config SHIELD_NRF7002EK_NRF7001 - def_bool $(shields_list_contains,nrf7002ek_nrf7001) - -config NRF70_2_4G_ONLY - bool - default y if SHIELD_NRF7002EK_NRF7001 diff --git a/boards/shields/nrf7002ek_nrf7001/boards/nrf52840dk_nrf52840.overlay b/boards/shields/nrf7002ek_nrf7001/boards/nrf52840dk_nrf52840.overlay deleted file mode 100644 index 00d734c80d55..000000000000 --- a/boards/shields/nrf7002ek_nrf7001/boards/nrf52840dk_nrf52840.overlay +++ /dev/null @@ -1,5 +0,0 @@ -/* Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - #include "../nrf7002ek_nrf7001_coex.overlay" diff --git a/boards/shields/nrf7002ek_nrf7001/boards/nrf5340dk_nrf5340_cpuapp.overlay b/boards/shields/nrf7002ek_nrf7001/boards/nrf5340dk_nrf5340_cpuapp.overlay deleted file mode 100644 index eab245fc372b..000000000000 --- a/boards/shields/nrf7002ek_nrf7001/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - #include "../nrf7002ek_nrf7001_coex.overlay" - -/* This node by default forwards the UART1 pins to CPUNET, but as UART1 uses - * same pins as bucken and iovdd-ctrl, we need these pins to be controlled by - * the CPUAPP. Since a child node of gpio_fwd cannot be disabled, hence - * the entire node is disabled. If the application needs to forward other pins - * to the CPUNET, it should create a separate instance of nrf-gpio-forwarder - * and use it instead. - */ -&gpio_fwd { - status = "disabled"; -}; diff --git a/boards/shields/nrf7002ek_nrf7001/boards/nrf9151dk_nrf9151.overlay b/boards/shields/nrf7002ek_nrf7001/boards/nrf9151dk_nrf9151.overlay deleted file mode 100644 index 7ebbb062c193..000000000000 --- a/boards/shields/nrf7002ek_nrf7001/boards/nrf9151dk_nrf9151.overlay +++ /dev/null @@ -1,6 +0,0 @@ -/* Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include diff --git a/boards/shields/nrf7002ek_nrf7001/boards/nrf9151dk_nrf9151_ns.overlay b/boards/shields/nrf7002ek_nrf7001/boards/nrf9151dk_nrf9151_ns.overlay deleted file mode 100644 index 7ebbb062c193..000000000000 --- a/boards/shields/nrf7002ek_nrf7001/boards/nrf9151dk_nrf9151_ns.overlay +++ /dev/null @@ -1,6 +0,0 @@ -/* Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include diff --git a/boards/shields/nrf7002ek_nrf7001/boards/nrf9160dk_nrf9160_ns.overlay b/boards/shields/nrf7002ek_nrf7001/boards/nrf9160dk_nrf9160_ns.overlay deleted file mode 100644 index b84f12d3dc76..000000000000 --- a/boards/shields/nrf7002ek_nrf7001/boards/nrf9160dk_nrf9160_ns.overlay +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/* Disabled because of conflicts on P0.00 and P0.01 - Arduino pins D0 and D1 - * (iovdd-ctrl-gpios and bucken-gpios in nrf7002ek, respectively). */ -&uart1 { - status = "disabled"; -}; - -/* Typically we use GPIO extender to resolve these conflicts but the - * GPIO pin used by extender itself conflicts with Wi-Fi (0.6), so, - * disable LEDs and Button0/1. - */ -&led0 { - status = "disabled"; -}; - -&led1 { - status = "disabled"; -}; - -&led2 { - status = "disabled"; -}; - -&led3 { - status = "disabled"; -}; - -&button0 { - status = "disabled"; -}; - -&button1 { - status = "disabled"; -}; diff --git a/boards/shields/nrf7002ek_nrf7001/boards/nrf9161dk_nrf9161.overlay b/boards/shields/nrf7002ek_nrf7001/boards/nrf9161dk_nrf9161.overlay deleted file mode 100644 index b9b798252066..000000000000 --- a/boards/shields/nrf7002ek_nrf7001/boards/nrf9161dk_nrf9161.overlay +++ /dev/null @@ -1,6 +0,0 @@ -/* Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include diff --git a/boards/shields/nrf7002ek_nrf7001/boards/nrf9161dk_nrf9161_ns.overlay b/boards/shields/nrf7002ek_nrf7001/boards/nrf9161dk_nrf9161_ns.overlay deleted file mode 100644 index b9b798252066..000000000000 --- a/boards/shields/nrf7002ek_nrf7001/boards/nrf9161dk_nrf9161_ns.overlay +++ /dev/null @@ -1,6 +0,0 @@ -/* Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include diff --git a/boards/shields/nrf7002ek_nrf7001/boards/thingy53_nrf5340_cpuapp.overlay b/boards/shields/nrf7002ek_nrf7001/boards/thingy53_nrf5340_cpuapp.overlay deleted file mode 100644 index 00d734c80d55..000000000000 --- a/boards/shields/nrf7002ek_nrf7001/boards/thingy53_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,5 +0,0 @@ -/* Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - #include "../nrf7002ek_nrf7001_coex.overlay" diff --git a/boards/shields/nrf7002ek_nrf7001/nrf7002ek_nrf7001.overlay b/boards/shields/nrf7002ek_nrf7001/nrf7002ek_nrf7001.overlay deleted file mode 100644 index 9722b22bc71b..000000000000 --- a/boards/shields/nrf7002ek_nrf7001/nrf7002ek_nrf7001.overlay +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ -#include - -/ { - nordic_wlan0: nordic_wlan0 { - compatible = "nordic,wlan0"; - status = "okay"; - }; - - chosen { - zephyr,wifi = &nordic_wlan0; - }; - - nrf70_tx_power_ceiling: nrf70_tx_power_ceiling_node { - status = "okay"; - compatible = "nordic,nrf700x-tx-power-ceiling"; - max-pwr-2g-dsss = <0x54>; - max-pwr-2g-mcs0 = <0x40>; - max-pwr-2g-mcs7 = <0x40>; - max-pwr-5g-low-mcs0 = <0x34>; - max-pwr-5g-low-mcs7 = <0x34>; - max-pwr-5g-mid-mcs0 = <0x34>; - max-pwr-5g-mid-mcs7 = <0x34>; - max-pwr-5g-high-mcs0 = <0x30>; - max-pwr-5g-high-mcs7 = <0x30>; - }; -}; - -&arduino_spi { - status = "okay"; - - nrf700x: nrf7001@0 { - compatible = "nordic,nrf700x-spi"; - status = "okay"; - reg = <0>; - spi-max-frequency = ; - - iovdd-ctrl-gpios = <&arduino_header 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* D0 */ - bucken-gpios = <&arduino_header 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* D1 */ - host-irq-gpios = <&arduino_header 13 GPIO_ACTIVE_HIGH>; /* D7 */ - }; -}; diff --git a/boards/shields/nrf7002ek_nrf7001/nrf7002ek_nrf7001_coex.overlay b/boards/shields/nrf7002ek_nrf7001/nrf7002ek_nrf7001_coex.overlay deleted file mode 100644 index a6f208a7b510..000000000000 --- a/boards/shields/nrf7002ek_nrf7001/nrf7002ek_nrf7001_coex.overlay +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/ { - nrf_radio_coex: nrf7001-coex { - status = "okay"; - compatible = "nordic,nrf700x-coex"; - status0-gpios = <&arduino_header 8 GPIO_ACTIVE_HIGH>; /* D2 */ - req-gpios = <&arduino_header 9 GPIO_ACTIVE_HIGH>; /* D3 */ - grant-gpios = <&arduino_header 10 (GPIO_PULL_DOWN | GPIO_ACTIVE_LOW)>; /* D4 */ - swctrl1-gpios = <&arduino_header 12 GPIO_ACTIVE_HIGH>; /* D6 */ - srrf-switch-gpios = <&arduino_header 14 GPIO_ACTIVE_HIGH>; /* D8 */ - }; -}; diff --git a/samples/matter/lock/README.rst b/samples/matter/lock/README.rst index 091eac393fe9..bddb1b5b4d13 100644 --- a/samples/matter/lock/README.rst +++ b/samples/matter/lock/README.rst @@ -134,7 +134,7 @@ For example: .. code-block:: console - west build -b nrf5340dk/nrf5340/cpuapp -p -- -Dlock_SHIELD=nrf7002ek -Dipc_radio_SHIELD=nrf7002ek_coex -DFILE_SUFFIX=thread_wifi_switched -DSB_CONFIG_WIFI_PATCHES_EXT_FLASH_STORE=y -DSB_CONFIG_MCUBOOT_UPDATEABLE_IMAGES=3 -DCONFIG_CHIP_DFU_OVER_BT_SMP=y -DSB_CONFIG_WIFI_NRF70=y -DSB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_WIFI_FW_PATCH=y + west build -b nrf5340dk/nrf5340/cpuapp -p -- -Dlock_SHIELD=nrf7002ek -DFILE_SUFFIX=thread_wifi_switched -DSB_CONFIG_WIFI_PATCHES_EXT_FLASH_STORE=y -DSB_CONFIG_MCUBOOT_UPDATEABLE_IMAGES=3 -DCONFIG_CHIP_DFU_OVER_BT_SMP=y -DSB_CONFIG_WIFI_NRF70=y -DSB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_WIFI_FW_PATCH=y .. _matter_lock_sample_ble_nus: @@ -766,7 +766,7 @@ To test this feature, complete the following steps: .. code-block:: console - west build -b nrf5340dk/nrf5340/cpuapp -- -DFILE_SUFFIX=thread_wifi_switched -Dlock_SHIELD=nrf7002ek -Dipc_radio_SHIELD=nrf7002ek_coex -DSB_CONFIG_WIFI_NRF70=y + west build -b nrf5340dk/nrf5340/cpuapp -- -DFILE_SUFFIX=thread_wifi_switched -Dlock_SHIELD=nrf7002ek -DSB_CONFIG_WIFI_NRF70=y #. |connect_terminal_ANSI| #. Program the application to the kit using the following command: diff --git a/samples/matter/lock/sample.yaml b/samples/matter/lock/sample.yaml index 33c41135d79a..d26e7b6a5330 100644 --- a/samples/matter/lock/sample.yaml +++ b/samples/matter/lock/sample.yaml @@ -69,7 +69,7 @@ tests: sample.matter.lock.thread_wifi_switched.lto.smp_dfu: sysbuild: true build_only: true - extra_args: lock_SHIELD=nrf7002ek multiprotocol_rpmsg_SHIELD=nrf7002ek_coex + extra_args: lock_SHIELD=nrf7002ek FILE_SUFFIX=thread_wifi_switched SB_CONFIG_WIFI_PATCHES_EXT_FLASH_STORE=y SB_CONFIG_MCUBOOT_UPDATEABLE_IMAGES=3 CONFIG_CHIP_DFU_OVER_BT_SMP=y SB_CONFIG_WIFI_NRF70=y SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_WIFI_FW_PATCH=y diff --git a/samples/wifi/ble_coex/README.rst b/samples/wifi/ble_coex/README.rst index c63c8e6049cd..005265e1398d 100644 --- a/samples/wifi/ble_coex/README.rst +++ b/samples/wifi/ble_coex/README.rst @@ -169,13 +169,13 @@ Add the following SHIELD options for the nRF7002 EK and nRF7001 EK. .. code-block:: console - -DSHIELD=nrf7002ek -Dipc_radio_SHIELD=nrf7002ek_coex + -DSHIELD=nrf7002ek * For nRF7001 EK: .. code-block:: console - -DSHIELD=nrf7002ek_nrf7001 -Dipc_radio_SHIELD=nrf7002ek_nrf7001_coex + -DSHIELD=nrf7002ek_nrf7001 The generated HEX file to be used is :file:`ble_coex/build/merged.hex`. diff --git a/samples/wifi/ble_coex/sample.yaml b/samples/wifi/ble_coex/sample.yaml index 93191594c76a..b59120a6bcf8 100644 --- a/samples/wifi/ble_coex/sample.yaml +++ b/samples/wifi/ble_coex/sample.yaml @@ -36,7 +36,7 @@ tests: build_only: true integration_platforms: - nrf5340dk/nrf5340/cpuapp - extra_args: SHIELD=nrf7002ek ipc_radio_SHIELD=nrf7002ek_coex + extra_args: SHIELD=nrf7002ek CONFIG_MPSL_CX=y ipc_radio_CONFIG_MPSL_CX=y CONFIG_COEX_SEP_ANTENNAS=y platform_allow: nrf5340dk/nrf5340/cpuapp @@ -46,7 +46,7 @@ tests: build_only: true integration_platforms: - nrf5340dk/nrf5340/cpuapp - extra_args: SHIELD=nrf7002ek_nrf7001 ipc_radio_SHIELD=nrf7002ek_nrf7001_coex + extra_args: SHIELD=nrf7002ek_nrf7001 CONFIG_MPSL_CX=y ipc_radio_CONFIG_MPSL_CX=y CONFIG_COEX_SEP_ANTENNAS=y platform_allow: nrf5340dk/nrf5340/cpuapp @@ -54,7 +54,7 @@ tests: sample.nrf7002_eb.thingy53.ble_coex: sysbuild: true build_only: true - extra_args: ble_coex_SHIELD=nrf7002eb ipc_radio_SHIELD=nrf7002eb_coex + extra_args: ble_coex_SHIELD=nrf7002eb CONFIG_MPSL_CX=y ipc_radio_CONFIG_MPSL_CX=y CONFIG_COEX_SEP_ANTENNAS=y integration_platforms: diff --git a/samples/wifi/thread_coex/README.rst b/samples/wifi/thread_coex/README.rst index 9f96f018b324..11edfa3249e2 100644 --- a/samples/wifi/thread_coex/README.rst +++ b/samples/wifi/thread_coex/README.rst @@ -179,13 +179,13 @@ Add the following SHIELD options for the nRF7002 EK and nRF7001 EK. .. code-block:: console - -DSHIELD=nrf7002ek -Dipc_radio_SHIELD=nrf7002ek_coex + -DSHIELD=nrf7002ek * For nRF7001 EK: .. code-block:: console - -DSHIELD=nrf7002ek_nrf7001 -Dipc_radio_SHIELD=nrf7002ek_nrf7001_coex + -DSHIELD=nrf7002ek_nrf7001 * Overlay files diff --git a/samples/wifi/thread_coex/prj.conf b/samples/wifi/thread_coex/prj.conf index 12a729e512e9..234f791b3d4a 100644 --- a/samples/wifi/thread_coex/prj.conf +++ b/samples/wifi/thread_coex/prj.conf @@ -5,6 +5,8 @@ # CONFIG_WIFI=y CONFIG_WIFI_NRF70=y +CONFIG_NRF70_SR_COEX=y +CONFIG_NRF70_SR_COEX_RF_SWITCH=y # WPA supplicant CONFIG_WPA_SUPP=y diff --git a/samples/wifi/thread_coex/sample.yaml b/samples/wifi/thread_coex/sample.yaml index 86f81c78fcff..0d54a1e47acd 100644 --- a/samples/wifi/thread_coex/sample.yaml +++ b/samples/wifi/thread_coex/sample.yaml @@ -28,7 +28,7 @@ tests: build_only: true integration_platforms: - nrf5340dk/nrf5340/cpuapp - extra_args: SHIELD=nrf7002ek ipc_radio_SHIELD=nrf7002ek_coex + extra_args: SHIELD=nrf7002ek CONFIG_MPSL_CX=y ipc_radio_CONFIG_MPSL_CX=y CONFIG_COEX_SEP_ANTENNAS=y EXTRA_CONF_FILE="overlay-wifi-udp-client-thread-udp-client.conf" @@ -39,7 +39,7 @@ tests: build_only: true integration_platforms: - nrf5340dk/nrf5340/cpuapp - extra_args: SHIELD=nrf7002ek_nrf7001 ipc_radio_SHIELD=nrf7002ek_nrf7001_coex + extra_args: SHIELD=nrf7002ek_nrf7001 CONFIG_MPSL_CX=y ipc_radio_CONFIG_MPSL_CX=y CONFIG_COEX_SEP_ANTENNAS=y EXTRA_CONF_FILE="overlay-wifi-udp-client-thread-udp-client.conf" From 63d4376163c20ba564747e3ae4e02e3ce93b1f51 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 5 Aug 2024 22:56:23 +0530 Subject: [PATCH 05/25] treewide: Migrate to upstream Zephyr WPA supplicant nRF70 now uses upstream Zephyr WPA supplicant. Signed-off-by: Chaitanya Tata --- .../boards/thingy91x_nrf9151_ns.conf | 2 +- .../overlay-nrf7002ek-wifi-scan-only.conf | 2 +- .../software_maturity_features.yaml | 2 +- .../getting_started/memory_optimization.rst | 4 ++-- doc/nrf/protocols/wifi/sap_mode/sap.rst | 2 +- doc/nrf/protocols/wifi/stack_configuration.rst | 14 +++++++------- .../releases/release-notes-2.6.0.rst | 2 +- modules/hostap/Kconfig | 8 ++++---- modules/wfa-qt/src/wpas_events.c | 8 ++++---- .../overlay-nrf700x-wifi-scan-only.conf | 2 +- samples/cellular/location/sample.yaml | 2 +- .../lwm2m_client/overlay-assist-wifi.conf | 2 +- .../overlay-nrf700x-wifi-scan-only.conf | 2 +- samples/cellular/modem_shell/sample.yaml | 2 +- .../overlay-nrf7002ek-wifi-scan-only.conf | 2 +- .../overlay_nrf7002ek_wifi_coap_no_lte.conf | 2 +- .../overlay_nrf7002ek_wifi_no_lte.conf | 2 +- .../boards/nrf7002dk_nrf5340_cpuapp.conf | 4 ++-- .../matter/lock/prj_thread_wifi_switched.conf | 2 +- .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 2 +- .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 4 ++-- .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 2 +- .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 4 ++-- .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 2 +- .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 4 ++-- .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 4 ++-- .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 2 +- samples/wifi/ble_coex/prj.conf | 2 +- samples/wifi/monitor/prj.conf | 2 +- samples/wifi/promiscuous/prj.conf | 2 +- samples/wifi/provisioning/ble/prj.conf | 2 +- samples/wifi/provisioning/softap/prj.conf | 4 ++-- samples/wifi/raw_tx_packet/prj.conf | 2 +- samples/wifi/scan/sample.yaml | 2 +- samples/wifi/shell/overlay-sap.conf | 2 +- samples/wifi/shell/overlay-scan-only.conf | 2 +- samples/wifi/shell/prj.conf | 4 ++-- samples/wifi/shell/sample.yaml | 18 ++++++++++++------ samples/wifi/softap/README.rst | 2 +- samples/wifi/softap/prj.conf | 6 +++--- samples/wifi/sta/prj.conf | 2 +- samples/wifi/thread_coex/prj.conf | 2 +- samples/wifi/throughput/prj.conf | 4 ++-- samples/wifi/twt/prj.conf | 2 +- samples/wifi/wfa_qt_app/prj.conf | 6 +++--- .../overlay-nrf70-driver-debug.conf | 2 +- subsys/net/l2_wifi_if_conn/l2_wifi_conn.c | 4 ++-- subsys/net/lib/softap_wifi_provision/Kconfig | 2 +- subsys/net/lib/wifi_mgmt_ext/Kconfig | 2 +- subsys/net/lib/wifi_ready/Kconfig | 2 +- subsys/net/lib/wifi_ready/wifi_ready.c | 8 ++++---- 51 files changed, 91 insertions(+), 85 deletions(-) diff --git a/applications/asset_tracker_v2/boards/thingy91x_nrf9151_ns.conf b/applications/asset_tracker_v2/boards/thingy91x_nrf9151_ns.conf index 7e995f9841e2..921d74856023 100644 --- a/applications/asset_tracker_v2/boards/thingy91x_nrf9151_ns.conf +++ b/applications/asset_tracker_v2/boards/thingy91x_nrf9151_ns.conf @@ -50,7 +50,7 @@ CONFIG_NRF_MODEM_LIB_SHMEM_TX_SIZE=4096 CONFIG_NRF_MODEM_LIB_SHMEM_RX_SIZE=4096 # Scan only using offload API -CONFIG_WPA_SUPP=n +CONFIG_WIFI_NM_WPA_SUPPLICANT=n # For nRF9160 the default is socket interface CONFIG_NET_DEFAULT_IF_ETHERNET=y diff --git a/applications/asset_tracker_v2/overlay-nrf7002ek-wifi-scan-only.conf b/applications/asset_tracker_v2/overlay-nrf7002ek-wifi-scan-only.conf index ff7daa2e4709..92bda281627b 100644 --- a/applications/asset_tracker_v2/overlay-nrf7002ek-wifi-scan-only.conf +++ b/applications/asset_tracker_v2/overlay-nrf7002ek-wifi-scan-only.conf @@ -41,7 +41,7 @@ CONFIG_NRF_MODEM_LIB_SHMEM_TX_SIZE=4096 CONFIG_NRF_MODEM_LIB_SHMEM_RX_SIZE=4096 # Scan only using offload API -CONFIG_WPA_SUPP=n +CONFIG_WIFI_NM_WPA_SUPPLICANT=n # For nRF9160 the default is socket interface CONFIG_NET_DEFAULT_IF_ETHERNET=y diff --git a/doc/_scripts/software_maturity/software_maturity_features.yaml b/doc/_scripts/software_maturity/software_maturity_features.yaml index 867218fc1065..103faca531a9 100644 --- a/doc/_scripts/software_maturity/software_maturity_features.yaml +++ b/doc/_scripts/software_maturity/software_maturity_features.yaml @@ -109,7 +109,7 @@ features: boards_and_shields: - BOARD_NRF7002DK_NRF5340_CPUAPP SoftAP Mode (for Wi-Fi provisioning): - rule: WIFI_NRF70 && NRF700X_AP_MODE && WPA_SUPP_AP + rule: WIFI_NRF70 && NRF700X_AP_MODE && WIFI_NM_WPA_SUPPLICANT_AP boards_and_shields: - SHIELD_NRF7002EK - SHIELD_NRF7002EK_NRF7000 diff --git a/doc/nrf/protocols/matter/getting_started/memory_optimization.rst b/doc/nrf/protocols/matter/getting_started/memory_optimization.rst index 1b2b7bef66c4..1cca9750399d 100644 --- a/doc/nrf/protocols/matter/getting_started/memory_optimization.rst +++ b/doc/nrf/protocols/matter/getting_started/memory_optimization.rst @@ -393,11 +393,11 @@ The following table presents the possible threads used in a Matter application a | net_mgmt | :kconfig:option:`CONFIG_NET_MGMT_EVENT_STACK_SIZE` | Zephyr network management event processing thread stack. | | | | For Matter over Wi-Fi only. | +---------------------+------------------------------------------------------------------+----------------------------------------------------------------+ -| wpa_supplicant_main | :kconfig:option:`CONFIG_WPA_SUPP_THREAD_STACK_SIZE` | WPA supplicant main thread. | +| wpa_supplicant_main | :kconfig:option:`CONFIG_WIFI_NM_WPA_SUPPLICANT_THREAD_STACK_SIZE`| WPA supplicant main thread. | | | | Processing Wi-Fi requests and connections. | | | | For Matter over Wi-Fi only. | +---------------------+------------------------------------------------------------------+----------------------------------------------------------------+ -| wpa_supplicant_wq | :kconfig:option:`CONFIG_WPA_SUPP_WQ_STACK_SIZE` | WPA supplicant work queue thread. | +| wpa_supplicant_wq | :kconfig:option:`CONFIG_WIFI_NM_WPA_SUPPLICANT_WQ_STACK_SIZE` | WPA supplicant work queue thread. | | | | Processing Wi-Fi task queue | | | | For Matter over Wi-Fi only. | +---------------------+------------------------------------------------------------------+----------------------------------------------------------------+ diff --git a/doc/nrf/protocols/wifi/sap_mode/sap.rst b/doc/nrf/protocols/wifi/sap_mode/sap.rst index ea90037c3d16..1a3fcdea4d7c 100644 --- a/doc/nrf/protocols/wifi/sap_mode/sap.rst +++ b/doc/nrf/protocols/wifi/sap_mode/sap.rst @@ -30,7 +30,7 @@ The SAP mode in the nRF70 Series devices provides SoftAP support with the follow Enabling the SAP mode ********************* -You can enable the SAP mode by setting the :kconfig:option:`CONFIG_NRF70_AP_MODE` and :kconfig:option:`CONFIG_WPA_SUPP_AP` Kconfig options in the application project configuration file. +You can enable the SAP mode by setting the :kconfig:option:`CONFIG_NRF70_AP_MODE` and :kconfig:option:`CONFIG_WIFI_NM_WPA_SUPPLICANT_AP` Kconfig options in the application project configuration file. SAP mode configuration diff --git a/doc/nrf/protocols/wifi/stack_configuration.rst b/doc/nrf/protocols/wifi/stack_configuration.rst index 511eac9daecd..4e85c2921515 100644 --- a/doc/nrf/protocols/wifi/stack_configuration.rst +++ b/doc/nrf/protocols/wifi/stack_configuration.rst @@ -63,7 +63,7 @@ The nRF Wi-Fi driver provides the following software configurations to fine-tune - Description - Impact - Purpose - * - :kconfig:option:`CONFIG_WPA_SUPP` + * - :kconfig:option:`CONFIG_WIFI_NM_WPA_SUPPLICANT` - ``y`` or ``n`` - Enable or disable Wi-Fi Protected Access (WPAâ„¢) supplicant - Memory savings @@ -176,7 +176,7 @@ The nRF Wi-Fi driver can be used in the following profiles (not an exhaustive li - Throughputs * - STA scan only - Scan only - - ``CONFIG_WPA_SUPP=n`` + - ``CONFIG_WIFI_NM_WPA_SUPPLICANT=n`` ``CONFIG_NRF70_AP_MODE=n`` ``CONFIG_NRF70_P2P_MODE=n`` ``CONFIG_NET_PKT_TX_COUNT=1`` @@ -187,7 +187,7 @@ The nRF Wi-Fi driver can be used in the following profiles (not an exhaustive li - ``N/A`` * - :abbr:`STA (Station)` mode - IoT devices - - ``CONFIG_WPA_SUPP=y`` + - ``CONFIG_WIFI_NM_WPA_SUPPLICANT=y`` ``CONFIG_NRF70_AP_MODE=n`` ``CONFIG_NRF70_P2P_MODE=n`` ``CONFIG_NET_PKT_TX_COUNT=6`` @@ -208,7 +208,7 @@ The nRF Wi-Fi driver can be used in the following profiles (not an exhaustive li ``UDP-RX: 4.1 Mbps`` * - :abbr:`STA (Station)` mode - Memory optimized :abbr:`STA (Station)` mode - - ``CONFIG_WPA_SUPP=y`` + - ``CONFIG_WIFI_NM_WPA_SUPPLICANT=y`` ``CONFIG_NRF70_AP_MODE=n`` ``CONFIG_NRF70_P2P_MODE=n`` ``CONFIG_NET_PKT_TX_COUNT=6`` @@ -229,7 +229,7 @@ The nRF Wi-Fi driver can be used in the following profiles (not an exhaustive li ``UDP-RX: 0.5 Mbps`` * - :abbr:`STA (Station)` mode - High performance :abbr:`STA (Station)` mode - - ``CONFIG_WPA_SUPP=y`` + - ``CONFIG_WIFI_NM_WPA_SUPPLICANT=y`` ``CONFIG_NRF70_AP_MODE=n`` ``CONFIG_NRF70_P2P_MODE=n`` ``CONFIG_NET_PKT_TX_COUNT=30`` @@ -249,7 +249,7 @@ The nRF Wi-Fi driver can be used in the following profiles (not an exhaustive li ``UDP-RX: 12.4 Mbps`` * - :abbr:`STA (Station)` mode - TX prioritized :abbr:`STA (Station)` mode - - ``CONFIG_WPA_SUPP=y`` + - ``CONFIG_WIFI_NM_WPA_SUPPLICANT=y`` ``CONFIG_NRF70_AP_MODE=n`` ``CONFIG_NRF70_P2P_MODE=n`` ``CONFIG_NET_PKT_TX_COUNT=32`` @@ -270,7 +270,7 @@ The nRF Wi-Fi driver can be used in the following profiles (not an exhaustive li ``UDP-RX: 12.8 Mbps`` * - :abbr:`STA (Station)` mode - RX prioritized :abbr:`STA (Station)` mode - - ``CONFIG_WPA_SUPP=y`` + - ``CONFIG_WIFI_NM_WPA_SUPPLICANT=y`` ``CONFIG_NRF70_AP_MODE=n`` ``CONFIG_NRF70_P2P_MODE=n`` ``CONFIG_NET_PKT_TX_COUNT=5`` diff --git a/doc/nrf/releases_and_maturity/releases/release-notes-2.6.0.rst b/doc/nrf/releases_and_maturity/releases/release-notes-2.6.0.rst index 572172aa6a91..6385206f3d38 100644 --- a/doc/nrf/releases_and_maturity/releases/release-notes-2.6.0.rst +++ b/doc/nrf/releases_and_maturity/releases/release-notes-2.6.0.rst @@ -845,7 +845,7 @@ Matter samples * Disabled the following features: * :ref:`ug_matter_configuring_read_client` in most Matter samples using the new :kconfig:option:`CONFIG_CHIP_ENABLE_READ_CLIENT` Kconfig option. - * WPA supplicant advanced features in all Matter samples using the :kconfig:option:`CONFIG_WPA_SUPP_ADVANCED_FEATURES` Kconfig option. + * WPA supplicant advanced features in all Matter samples using the ``CONFIG_WPA_SUPP_ADVANCED_FEATURES`` Kconfig option. This saves roughly 25 KB of flash memory for firmware images with Wi-Fi support. * Added ``matter_shell`` shell commands set to gather the current information about the NVS settings backend, such as current usage, free space, and peak usage value. diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 7ffbc0eeb2b3..b4c2eaa0714f 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -5,7 +5,7 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -menuconfig WPA_SUPP +menuconfig WIFI_NM_WPA_SUPPLICANT bool "WPA supplicant support" # Need full POSIX from libc, Zephyr's POSIX support is only partial select POSIX_CLOCK @@ -21,7 +21,7 @@ menuconfig WPA_SUPP help WPA supplicant implements 802.1X related functions. -if WPA_SUPP +if WIFI_NM_WPA_SUPPLICANT config COMMON_LIBC_MALLOC_ARENA_SIZE default 40000 if WPA_SUPP_AP @@ -216,7 +216,7 @@ config NET_MGMT_EVENT_STACK_SIZE config NET_SOCKETS_POLL_MAX default 6 -module = WPA_SUPP +module = WIFI_NM_WPA_SUPPLICANT module-str = WPA supplicant source "subsys/logging/Kconfig.template.log_config" @@ -266,4 +266,4 @@ config WPA_SUPP_NW_SEL_RELIABILITY Select the network based on reliability. endchoice -endif # WPA_SUPP +endif # WIFI_NM_WPA_SUPPLICANT diff --git a/modules/wfa-qt/src/wpas_events.c b/modules/wfa-qt/src/wpas_events.c index 41f6d2426f87..f9660ed9f0ec 100644 --- a/modules/wfa-qt/src/wpas_events.c +++ b/modules/wfa-qt/src/wpas_events.c @@ -28,7 +28,7 @@ LOG_MODULE_REGISTER(wpas_event, CONFIG_WFA_QT_LOG_LEVEL); /* TODO: Handle other events */ -#define WPA_SUPP_EVENTS (NET_EVENT_WPA_SUPP_READY) +#define WPA_SUPP_EVENTS (NET_EVENT_SUPPLICANT_READY) static struct net_mgmt_event_callback net_wpa_supp_cb; @@ -44,7 +44,7 @@ static void wpa_supp_event_handler(struct net_mgmt_event_callback *cb, { /* TODO: Handle other events */ switch (mgmt_event) { - case NET_EVENT_WPA_SUPP_READY: + case NET_EVENT_SUPPLICANT_READY: handle_wpa_supp_ready(cb); break; default: @@ -55,7 +55,7 @@ static void wpa_supp_event_handler(struct net_mgmt_event_callback *cb, int wait_for_wpa_s_ready(void) { - struct wpa_supplicant *wpa_s = z_wpas_get_handle_by_ifname(CONFIG_WFA_QT_DEFAULT_INTERFACE); + struct wpa_supplicant *wpa_s = zephyr_get_handle_by_ifname(CONFIG_WFA_QT_DEFAULT_INTERFACE); int ret; if (wpa_s) { @@ -70,7 +70,7 @@ int wait_for_wpa_s_ready(void) return -1; } - wpa_s = z_wpas_get_handle_by_ifname(CONFIG_WFA_QT_DEFAULT_INTERFACE); + wpa_s = zephyr_get_handle_by_ifname(CONFIG_WFA_QT_DEFAULT_INTERFACE); if (!wpa_s) { LOG_INF("WPA Supplicant ready event received, but no handle found for %s", CONFIG_WFA_QT_DEFAULT_INTERFACE); diff --git a/samples/cellular/location/overlay-nrf700x-wifi-scan-only.conf b/samples/cellular/location/overlay-nrf700x-wifi-scan-only.conf index b00d65a3f0a9..84c9d09ca697 100644 --- a/samples/cellular/location/overlay-nrf700x-wifi-scan-only.conf +++ b/samples/cellular/location/overlay-nrf700x-wifi-scan-only.conf @@ -31,7 +31,7 @@ CONFIG_NRF_WIFI_SCAN_MAX_BSS_CNT=60 CONFIG_NEWLIB_LIBC=y # Scan only using offload API -CONFIG_WPA_SUPP=n +CONFIG_WIFI_NM_WPA_SUPPLICANT=n # For nRF9160 the default is socket interface CONFIG_NET_DEFAULT_IF_ETHERNET=y diff --git a/samples/cellular/location/sample.yaml b/samples/cellular/location/sample.yaml index 9f5160789fcf..fd87d9bfe11f 100644 --- a/samples/cellular/location/sample.yaml +++ b/samples/cellular/location/sample.yaml @@ -56,7 +56,7 @@ tests: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns extra_args: SHIELD=nrf7002ek_nrf7000 OVERLAY_CONFIG=overlay-nrf700x-wifi-scan-only.conf - CONFIG_WPA_SUPP=n SB_CONFIG_WIFI_NRF70=y + CONFIG_WIFI_NM_WPA_SUPPLICANT=n SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.location.nrf7001ek_wifi: diff --git a/samples/cellular/lwm2m_client/overlay-assist-wifi.conf b/samples/cellular/lwm2m_client/overlay-assist-wifi.conf index e3af40f6620f..4b9dd361718b 100644 --- a/samples/cellular/lwm2m_client/overlay-assist-wifi.conf +++ b/samples/cellular/lwm2m_client/overlay-assist-wifi.conf @@ -41,7 +41,7 @@ CONFIG_WIFI_NRF70=y CONFIG_NET_L2_WIFI_MGMT=y # Scan only using offload API -CONFIG_WPA_SUPP=n +CONFIG_WIFI_NM_WPA_SUPPLICANT=n # For nRF9160 the default is socket interface CONFIG_NET_DEFAULT_IF_ETHERNET=y diff --git a/samples/cellular/modem_shell/overlay-nrf700x-wifi-scan-only.conf b/samples/cellular/modem_shell/overlay-nrf700x-wifi-scan-only.conf index 985addc4cc52..5626ecf5248b 100644 --- a/samples/cellular/modem_shell/overlay-nrf700x-wifi-scan-only.conf +++ b/samples/cellular/modem_shell/overlay-nrf700x-wifi-scan-only.conf @@ -49,7 +49,7 @@ CONFIG_NET_MGMT_EVENT_QUEUE_SIZE=50 CONFIG_NEWLIB_LIBC=y # Scan only using offload API -CONFIG_WPA_SUPP=n +CONFIG_WIFI_NM_WPA_SUPPLICANT=n # For nRF9160 the default is socket interface CONFIG_NET_DEFAULT_IF_ETHERNET=y diff --git a/samples/cellular/modem_shell/sample.yaml b/samples/cellular/modem_shell/sample.yaml index 9f44090c16c9..299c1928fbf3 100644 --- a/samples/cellular/modem_shell/sample.yaml +++ b/samples/cellular/modem_shell/sample.yaml @@ -110,7 +110,7 @@ tests: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns extra_args: SHIELD=nrf7002ek_nrf7000 EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf - CONFIG_WPA_SUPP=n SB_CONFIG_WIFI_NRF70=y + CONFIG_WIFI_NM_WPA_SUPPLICANT=n SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.modem_shell.nrf7001ek_wifi: diff --git a/samples/cellular/nrf_cloud_multi_service/overlay-nrf7002ek-wifi-scan-only.conf b/samples/cellular/nrf_cloud_multi_service/overlay-nrf7002ek-wifi-scan-only.conf index e84ee9454f34..ab2b0845cd28 100644 --- a/samples/cellular/nrf_cloud_multi_service/overlay-nrf7002ek-wifi-scan-only.conf +++ b/samples/cellular/nrf_cloud_multi_service/overlay-nrf7002ek-wifi-scan-only.conf @@ -27,7 +27,7 @@ CONFIG_NET_IF_MAX_IPV4_COUNT=2 CONFIG_NET_IF_MAX_IPV6_COUNT=2 # But disable the supplicant, since we don't need connectivity -CONFIG_WPA_SUPP=n +CONFIG_WIFI_NM_WPA_SUPPLICANT=n CONFIG_MBEDTLS=n # Stack/heap tweaks needed to support Wi-Fi. diff --git a/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_coap_no_lte.conf b/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_coap_no_lte.conf index 1c46ad792c4f..c5d06fd0f004 100644 --- a/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_coap_no_lte.conf +++ b/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_coap_no_lte.conf @@ -110,7 +110,7 @@ CONFIG_FLASH_MAP=y ## Enable Wi-Fi networking and native networking stack # Note: WPA_SUPP requires 24kB of unused RAM in the final build. # Memory allocations in this overlay are fine-tuned with that fact in mind. -CONFIG_WPA_SUPP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y CONFIG_NET_L2_ETHERNET=y CONFIG_NET_NATIVE=y CONFIG_NRF_SECURITY=y diff --git a/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_no_lte.conf b/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_no_lte.conf index 03d0e616c8da..2fd7e3bb6a33 100644 --- a/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_no_lte.conf +++ b/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_no_lte.conf @@ -112,7 +112,7 @@ CONFIG_FLASH_MAP=y ## Enable Wi-Fi networking and native networking stack # Note: WPA_SUPP requires 24kB of unused RAM in the final build. # Memory allocations in this overlay are fine-tuned with that fact in mind. -CONFIG_WPA_SUPP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y CONFIG_NET_L2_ETHERNET=y CONFIG_NET_NATIVE=y CONFIG_NRF_SECURITY=y diff --git a/samples/debug/memfault/boards/nrf7002dk_nrf5340_cpuapp.conf b/samples/debug/memfault/boards/nrf7002dk_nrf5340_cpuapp.conf index 32db8ab62f32..24269e040bcf 100644 --- a/samples/debug/memfault/boards/nrf7002dk_nrf5340_cpuapp.conf +++ b/samples/debug/memfault/boards/nrf7002dk_nrf5340_cpuapp.conf @@ -67,8 +67,8 @@ CONFIG_SHELL=y CONFIG_SHELL_STACK_SIZE=6144 # WPA -CONFIG_WPA_SUPP=y -CONFIG_WPA_SUPP_LOG_LEVEL_INF=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_INF=y # Settings subsystem CONFIG_NVS=y diff --git a/samples/matter/lock/prj_thread_wifi_switched.conf b/samples/matter/lock/prj_thread_wifi_switched.conf index cac123f8e9e7..cff59b16d2ab 100644 --- a/samples/matter/lock/prj_thread_wifi_switched.conf +++ b/samples/matter/lock/prj_thread_wifi_switched.conf @@ -38,7 +38,7 @@ CONFIG_CHIP_FACTORY_RESET_ERASE_NVS=n # Do not restore initial transport on fact # Reduce application size CONFIG_USE_SEGGER_RTT=n -CONFIG_WPA_SUPP_ADVANCED_FEATURES=n +CONFIG_WIFI_NM_WPA_SUPPLICANT_ADVANCED_FEATURES=n CONFIG_CHIP_NFC_COMMISSIONING=n CONFIG_MATTER_LOG_LEVEL_INF=y CONFIG_CHIP_APP_LOG_LEVEL=3 diff --git a/samples/net/aws_iot/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/aws_iot/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index a6cc39aa683d..377d5f7e84fb 100644 --- a/samples/net/aws_iot/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/aws_iot/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -35,7 +35,7 @@ CONFIG_SHELL=y CONFIG_SHELL_STACK_SIZE=6144 # WPA -CONFIG_WPA_SUPP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y # NET sockets CONFIG_NET_L2_ETHERNET=y diff --git a/samples/net/azure_iot_hub/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/azure_iot_hub/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index 28345e1b64a3..681ec49f7226 100644 --- a/samples/net/azure_iot_hub/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/azure_iot_hub/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -34,8 +34,8 @@ CONFIG_SHELL=y CONFIG_SHELL_STACK_SIZE=6144 # WPA -CONFIG_WPA_SUPP=y -CONFIG_WPA_SUPP_LOG_LEVEL_ERR=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_ERR=y # Zephyr NET Connection Manager Connectivity layer. CONFIG_L2_WIFI_CONNECTIVITY=y diff --git a/samples/net/coap_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/coap_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index 1c5f9067a09e..38676b40e7f4 100644 --- a/samples/net/coap_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/coap_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -40,7 +40,7 @@ CONFIG_SHELL=y CONFIG_SHELL_STACK_SIZE=6144 # WPA -CONFIG_WPA_SUPP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y CONFIG_MBEDTLS_HEAP_SIZE=16384 # NET sockets diff --git a/samples/net/download/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/download/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index 7dd2cd728096..2e83d7217f7c 100644 --- a/samples/net/download/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/download/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -33,8 +33,8 @@ CONFIG_SHELL=y CONFIG_SHELL_STACK_SIZE=6144 # WPA -CONFIG_WPA_SUPP=y -CONFIG_WPA_SUPP_LOG_LEVEL_ERR=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_ERR=y # NET sockets CONFIG_NET_L2_ETHERNET=y diff --git a/samples/net/http_server/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/http_server/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index 1e011480db61..ca0672866271 100644 --- a/samples/net/http_server/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/http_server/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -17,7 +17,7 @@ CONFIG_NRF70_MAX_TX_AGGREGATION=4 # Wi-Fi CONFIG_WIFI=y CONFIG_WIFI_NRF70=y -CONFIG_WPA_SUPP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y CONFIG_NET_L2_ETHERNET=y # IP address config diff --git a/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index 9bed9d0074cc..bf7a8ddb35c3 100644 --- a/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -26,8 +26,8 @@ CONFIG_SHELL=y CONFIG_SHELL_STACK_SIZE=6144 # WPA supplicant -CONFIG_WPA_SUPP=y -CONFIG_WPA_SUPP_LOG_LEVEL_ERR=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_ERR=y # Zephyr NET Connection Manager connectivity layer CONFIG_L2_WIFI_CONNECTIVITY=y diff --git a/samples/net/mqtt/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/mqtt/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index 45edaeb3fa3d..7bdc5993e58a 100644 --- a/samples/net/mqtt/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/mqtt/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -39,8 +39,8 @@ CONFIG_L2_WIFI_CONNECTIVITY_AUTO_CONNECT=n CONFIG_L2_WIFI_CONNECTIVITY_AUTO_DOWN=n # WPA -CONFIG_WPA_SUPP=y -CONFIG_WPA_SUPP_LOG_LEVEL_ERR=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_ERR=y CONFIG_MBEDTLS_HEAP_SIZE=16384 # NET sockets diff --git a/samples/net/udp/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/udp/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index cafcf374f7da..b2ce9a977de0 100644 --- a/samples/net/udp/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/udp/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -23,7 +23,7 @@ CONFIG_SHELL=y CONFIG_SHELL_STACK_SIZE=6144 # WPA -CONFIG_WPA_SUPP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y CONFIG_MBEDTLS_HEAP_SIZE=16384 # NET sockets diff --git a/samples/wifi/ble_coex/prj.conf b/samples/wifi/ble_coex/prj.conf index 657a6320e960..792fede992bb 100644 --- a/samples/wifi/ble_coex/prj.conf +++ b/samples/wifi/ble_coex/prj.conf @@ -8,7 +8,7 @@ CONFIG_WIFI=y CONFIG_WIFI_NRF70=y # WPA supplicant -CONFIG_WPA_SUPP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y # Networking CONFIG_NETWORKING=y diff --git a/samples/wifi/monitor/prj.conf b/samples/wifi/monitor/prj.conf index 6f064ed5626a..1bff86b8e8e2 100644 --- a/samples/wifi/monitor/prj.conf +++ b/samples/wifi/monitor/prj.conf @@ -11,7 +11,7 @@ CONFIG_NRF_WIFI_LOW_POWER=n CONFIG_NRF70_RAW_DATA_RX=y # WPA supplicant -CONFIG_WPA_SUPP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y # Networking CONFIG_NETWORKING=y diff --git a/samples/wifi/promiscuous/prj.conf b/samples/wifi/promiscuous/prj.conf index 4f3222bc0ee4..7b12c96f27a3 100644 --- a/samples/wifi/promiscuous/prj.conf +++ b/samples/wifi/promiscuous/prj.conf @@ -7,7 +7,7 @@ CONFIG_WIFI=y CONFIG_WIFI_NRF70=y # WPA supplicant -CONFIG_WPA_SUPP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y # Promiscuous mode CONFIG_NET_PROMISCUOUS_MODE=y diff --git a/samples/wifi/provisioning/ble/prj.conf b/samples/wifi/provisioning/ble/prj.conf index a3e456bdf29c..33c9eda1fd35 100644 --- a/samples/wifi/provisioning/ble/prj.conf +++ b/samples/wifi/provisioning/ble/prj.conf @@ -7,7 +7,7 @@ CONFIG_WIFI=y CONFIG_WIFI_NRF70=y # WPA supplicant -CONFIG_WPA_SUPP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y # Networking CONFIG_NETWORKING=y diff --git a/samples/wifi/provisioning/softap/prj.conf b/samples/wifi/provisioning/softap/prj.conf index d2a7dcd2e3de..0afc370f8ff7 100644 --- a/samples/wifi/provisioning/softap/prj.conf +++ b/samples/wifi/provisioning/softap/prj.conf @@ -18,8 +18,8 @@ CONFIG_NRF70_MAX_TX_AGGREGATION=4 CONFIG_WIFI=y CONFIG_WIFI_NRF70=y CONFIG_NRF70_AP_MODE=y -CONFIG_WPA_SUPP=y -CONFIG_WPA_SUPP_AP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_AP=y CONFIG_NET_L2_ETHERNET=y CONFIG_WIFI_CREDENTIALS=y diff --git a/samples/wifi/raw_tx_packet/prj.conf b/samples/wifi/raw_tx_packet/prj.conf index be06580b2653..462fcf3f0bd8 100644 --- a/samples/wifi/raw_tx_packet/prj.conf +++ b/samples/wifi/raw_tx_packet/prj.conf @@ -9,7 +9,7 @@ CONFIG_NRF_WIFI_LOW_POWER=n CONFIG_NRF70_RAW_DATA_TX=y # WPA supplicant -CONFIG_WPA_SUPP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y diff --git a/samples/wifi/scan/sample.yaml b/samples/wifi/scan/sample.yaml index fae57d2333cc..e4bcbca6d385 100644 --- a/samples/wifi/scan/sample.yaml +++ b/samples/wifi/scan/sample.yaml @@ -48,7 +48,7 @@ tests: sample.nrf7000_eks.scan: sysbuild: true build_only: true - extra_args: SHIELD=nrf7002ek_nrf7000 CONFIG_WPA_SUPP=n + extra_args: SHIELD=nrf7002ek_nrf7000 CONFIG_WIFI_NM_WPA_SUPPLICANT=n integration_platforms: - nrf9160dk/nrf9160/ns platform_allow: nrf9160dk/nrf9160/ns diff --git a/samples/wifi/shell/overlay-sap.conf b/samples/wifi/shell/overlay-sap.conf index 5d98cdc2f405..9315603d65ba 100644 --- a/samples/wifi/shell/overlay-sap.conf +++ b/samples/wifi/shell/overlay-sap.conf @@ -1,5 +1,5 @@ CONFIG_NRF70_AP_MODE=y -CONFIG_WPA_SUPP_AP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_AP=y CONFIG_NET_ZPERF=y CONFIG_POSIX_MAX_FDS=16 diff --git a/samples/wifi/shell/overlay-scan-only.conf b/samples/wifi/shell/overlay-scan-only.conf index ff8e0651d526..c4fe84c8dbac 100644 --- a/samples/wifi/shell/overlay-scan-only.conf +++ b/samples/wifi/shell/overlay-scan-only.conf @@ -1,5 +1,5 @@ # Scan only using offload API -CONFIG_WPA_SUPP=n +CONFIG_WIFI_NM_WPA_SUPPLICANT=n # In 9160 default is socket interface CONFIG_NET_DEFAULT_IF_ETHERNET=y CONFIG_MBEDTLS=n diff --git a/samples/wifi/shell/prj.conf b/samples/wifi/shell/prj.conf index 404c8cb69d73..2ddc27f51a35 100644 --- a/samples/wifi/shell/prj.conf +++ b/samples/wifi/shell/prj.conf @@ -7,7 +7,7 @@ CONFIG_WIFI=y CONFIG_WIFI_NRF70=y # WPA supplicant -CONFIG_WPA_SUPP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y CONFIG_NET_L2_WIFI_SHELL=y # Networking @@ -63,7 +63,7 @@ CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING=y CONFIG_DEBUG_COREDUMP_MEMORY_DUMP_MIN=y CONFIG_SHELL_CMDS_RESIZE=n #CONFIG_DEBUG=y -CONFIG_WPA_SUPP_LOG_LEVEL_INF=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_INF=y # Kernel options CONFIG_ENTROPY_GENERATOR=y diff --git a/samples/wifi/shell/sample.yaml b/samples/wifi/shell/sample.yaml index 58b44a1f61d3..1ebc9f8ece92 100644 --- a/samples/wifi/shell/sample.yaml +++ b/samples/wifi/shell/sample.yaml @@ -14,7 +14,7 @@ tests: sample.nrf7002.shell.disable_adv_features: sysbuild: true build_only: true - extra_args: -DCONFIG_WPA_SUPP_ADVANCED_FEATURES=n + extra_args: -DCONFIG_WIFI_NM_WPA_SUPPLICANT_ADVANCED_FEATURES=n integration_platforms: - nrf7002dk/nrf5340/cpuapp platform_allow: nrf7002dk/nrf5340/cpuapp @@ -38,7 +38,7 @@ tests: sample.nrf7000_eks.shell: sysbuild: true build_only: true - extra_args: SHIELD=nrf7002ek_nrf7000 CONFIG_WPA_SUPP=n + extra_args: SHIELD=nrf7002ek_nrf7000 CONFIG_WIFI_NM_WPA_SUPPLICANT=n integration_platforms: - nrf5340dk/nrf5340/cpuapp - nrf52840dk/nrf52840 @@ -64,7 +64,10 @@ tests: sample.nrf7000_eks_cpunet.shell: sysbuild: true build_only: true - extra_args: SHIELD=nrf7002ek_nrf7000 CONFIG_BOARD_ENABLE_CPUNET=y CONFIG_WPA_SUPP=n + extra_args: + - SHIELD=nrf7002ek_nrf7000 + - CONFIG_BOARD_ENABLE_CPUNET=y + - CONFIG_WIFI_NM_WPA_SUPPLICANT=n integration_platforms: - nrf5340dk/nrf5340/cpuapp platform_allow: nrf5340dk/nrf5340/cpuapp @@ -120,7 +123,10 @@ tests: sample.nrf7000.shell.scan_only_91: sysbuild: true build_only: true - extra_args: EXTRA_CONF_FILE=overlay-scan-only.conf SHIELD=nrf7002ek_nrf7000 CONFIG_WPA_SUPP=n + extra_args: + - EXTRA_CONF_FILE=overlay-scan-only.conf + - SHIELD=nrf7002ek_nrf7000 + - CONFIG_WIFI_NM_WPA_SUPPLICANT=n integration_platforms: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns @@ -132,7 +138,7 @@ tests: sample.nrf7002.shell.scan_only_thingy91x: sysbuild: true build_only: true - extra_args: EXTRA_CONF_FILE=overlay-scan-only.conf CONFIG_WPA_SUPP=n + extra_args: EXTRA_CONF_FILE=overlay-scan-only.conf CONFIG_WIFI_NM_WPA_SUPPLICANT=n platform_allow: - thingy91x/nrf9151/ns tags: ci_build sysbuild ci_samples_wifi @@ -330,7 +336,7 @@ tests: tags: ci_build sysbuild ci_samples_wifi sample.nrf7002.shell.psa: build_only: true - extra_args: CONFIG_WPA_SUPP_CRYPTO_PSA=y + extra_args: CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_LEGACY_NCS_PSA=y integration_platforms: - nrf7002dk/nrf5340/cpuapp platform_allow: nrf7002dk/nrf5340/cpuapp diff --git a/samples/wifi/softap/README.rst b/samples/wifi/softap/README.rst index 2896ca8e0000..0a2ae45f61b1 100644 --- a/samples/wifi/softap/README.rst +++ b/samples/wifi/softap/README.rst @@ -26,7 +26,7 @@ Then, the sample lists the connected devices. You can enable the SoftAP mode by setting the below configuration options in the sample project configuration file: * :kconfig:option:`CONFIG_NRF70_AP_MODE`: Enables access point mode support. -* :kconfig:option:`CONFIG_WPA_SUPP_AP`: Enables access point support. +* :kconfig:option:`CONFIG_WIFI_NM_WPA_SUPPLICANT_AP`: Enables access point support. The sample uses the :ref:`lib_wifi_ready` library to check Wi-Fi readiness. To use the :ref:`lib_wifi_ready` library, enable the :kconfig:option:`CONFIG_WIFI_READY_LIB` Kconfig option. diff --git a/samples/wifi/softap/prj.conf b/samples/wifi/softap/prj.conf index 37bac8d96499..bcb7da96d689 100644 --- a/samples/wifi/softap/prj.conf +++ b/samples/wifi/softap/prj.conf @@ -7,14 +7,14 @@ CONFIG_WIFI=y CONFIG_WIFI_NRF70=y # WPA supplicant -CONFIG_WPA_SUPP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y CONFIG_WIFI_READY_LIB=y # Soft AP CONFIG_NRF70_AP_MODE=y -CONFIG_WPA_SUPP_AP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_AP=y -CONFIG_WPA_SUPP_LOG_LEVEL_INF=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_INF=y # Networking CONFIG_NETWORKING=y diff --git a/samples/wifi/sta/prj.conf b/samples/wifi/sta/prj.conf index 8b9a00536331..2ca89df28be8 100644 --- a/samples/wifi/sta/prj.conf +++ b/samples/wifi/sta/prj.conf @@ -7,7 +7,7 @@ CONFIG_WIFI=y CONFIG_WIFI_NRF70=y # WPA supplicant -CONFIG_WPA_SUPP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y CONFIG_WIFI_READY_LIB=y CONFIG_NRF_WIFI_RPU_RECOVERY=y diff --git a/samples/wifi/thread_coex/prj.conf b/samples/wifi/thread_coex/prj.conf index 234f791b3d4a..1d366603463f 100644 --- a/samples/wifi/thread_coex/prj.conf +++ b/samples/wifi/thread_coex/prj.conf @@ -9,7 +9,7 @@ CONFIG_NRF70_SR_COEX=y CONFIG_NRF70_SR_COEX_RF_SWITCH=y # WPA supplicant -CONFIG_WPA_SUPP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y # Networking CONFIG_NETWORKING=y diff --git a/samples/wifi/throughput/prj.conf b/samples/wifi/throughput/prj.conf index 4679a6f4859a..2d643de7d57d 100644 --- a/samples/wifi/throughput/prj.conf +++ b/samples/wifi/throughput/prj.conf @@ -7,7 +7,7 @@ CONFIG_WIFI=y CONFIG_WIFI_NRF70=y # WPA supplicant -CONFIG_WPA_SUPP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y CONFIG_NET_L2_WIFI_SHELL=y CONFIG_NET_ZPERF=y @@ -65,7 +65,7 @@ CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING=y CONFIG_DEBUG_COREDUMP_MEMORY_DUMP_MIN=y CONFIG_SHELL_CMDS_RESIZE=n #CONFIG_DEBUG=y -CONFIG_WPA_SUPP_LOG_LEVEL_INF=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_INF=y # Kernel options CONFIG_ENTROPY_GENERATOR=y diff --git a/samples/wifi/twt/prj.conf b/samples/wifi/twt/prj.conf index 035649ad9e80..eb6853dda8ca 100644 --- a/samples/wifi/twt/prj.conf +++ b/samples/wifi/twt/prj.conf @@ -7,7 +7,7 @@ CONFIG_WIFI=y CONFIG_WIFI_NRF70=y # WPA supplicant -CONFIG_WPA_SUPP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y diff --git a/samples/wifi/wfa_qt_app/prj.conf b/samples/wifi/wfa_qt_app/prj.conf index 4a4bd07e0aab..490dd1fa7049 100644 --- a/samples/wifi/wfa_qt_app/prj.conf +++ b/samples/wifi/wfa_qt_app/prj.conf @@ -12,7 +12,7 @@ CONFIG_WFA_QT_CONTROL_APP=y CONFIG_POSIX_MAX_FDS=16 # WPA supplicant -CONFIG_WPA_SUPP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y CONFIG_NET_L2_WIFI_SHELL=y # System settings @@ -69,7 +69,7 @@ CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING=y CONFIG_DEBUG_COREDUMP_MEMORY_DUMP_MIN=y CONFIG_SHELL_CMDS_RESIZE=n #CONFIG_DEBUG=y -CONFIG_WPA_SUPP_LOG_LEVEL_INF=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_INF=y # Kernel options CONFIG_ENTROPY_GENERATOR=y @@ -106,4 +106,4 @@ CONFIG_SHELL_BACKEND_DUMMY=y CONFIG_NRF_WIFI_LOW_POWER=n # This is needed for WPA3 PMKSA caching test cases -CONFIG_WPA_SUPP_EAPOL=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_EAPOL=y diff --git a/snippets/nrf70-driver-debug/overlay-nrf70-driver-debug.conf b/snippets/nrf70-driver-debug/overlay-nrf70-driver-debug.conf index ae4a07865cc9..8a55b731096c 100644 --- a/snippets/nrf70-driver-debug/overlay-nrf70-driver-debug.conf +++ b/snippets/nrf70-driver-debug/overlay-nrf70-driver-debug.conf @@ -18,4 +18,4 @@ CONFIG_SYS_HEAP_RUNTIME_STATS=y CONFIG_LOG=y CONFIG_LOG_MODE_IMMEDIATE=y CONFIG_PRINTK=y -CONFIG_WIFI_NRF700X_LOG_LEVEL_DBG=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_DBG=y diff --git a/subsys/net/l2_wifi_if_conn/l2_wifi_conn.c b/subsys/net/l2_wifi_if_conn/l2_wifi_conn.c index a676ce3cb120..7a1a722ca222 100644 --- a/subsys/net/l2_wifi_if_conn/l2_wifi_conn.c +++ b/subsys/net/l2_wifi_if_conn/l2_wifi_conn.c @@ -18,7 +18,7 @@ LOG_MODULE_REGISTER(l2_wifi_mgr_conn); #define WIFI_SHELL_MGMT_EVENTS (NET_EVENT_WIFI_CONNECT_RESULT | \ NET_EVENT_WIFI_DISCONNECT_RESULT) -#define WPA_SUPP_EVENTS (NET_EVENT_WPA_SUPP_READY) +#define WPA_SUPP_EVENTS (NET_EVENT_SUPPLICANT_READY) static struct net_mgmt_event_callback net_l2_mgmt_cb; static struct net_mgmt_event_callback net_wpa_supp_cb; @@ -98,7 +98,7 @@ static void wpa_supp_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { - case NET_EVENT_WPA_SUPP_READY: + case NET_EVENT_SUPPLICANT_READY: k_sem_give(&wpa_supp_ready_sem); break; default: diff --git a/subsys/net/lib/softap_wifi_provision/Kconfig b/subsys/net/lib/softap_wifi_provision/Kconfig index 515d569818cb..79fb2d1e6ca7 100644 --- a/subsys/net/lib/softap_wifi_provision/Kconfig +++ b/subsys/net/lib/softap_wifi_provision/Kconfig @@ -9,7 +9,7 @@ menuconfig SOFTAP_WIFI_PROVISION select EXPERIMENTAL depends on NANOPB depends on NRF70_AP_MODE - depends on WPA_SUPP_AP + depends on WIFI_NM_WPA_SUPPLICANT_AP depends on SMF depends on NET_DHCPV4_SERVER depends on TLS_CREDENTIALS diff --git a/subsys/net/lib/wifi_mgmt_ext/Kconfig b/subsys/net/lib/wifi_mgmt_ext/Kconfig index 04591e5b53df..4d619f692a85 100644 --- a/subsys/net/lib/wifi_mgmt_ext/Kconfig +++ b/subsys/net/lib/wifi_mgmt_ext/Kconfig @@ -6,7 +6,7 @@ config WIFI_MGMT_EXT bool "Extended commands for Wi-Fi management" - depends on WPA_SUPP + depends on WIFI_NM_WPA_SUPPLICANT depends on WIFI_CREDENTIALS default y help diff --git a/subsys/net/lib/wifi_ready/Kconfig b/subsys/net/lib/wifi_ready/Kconfig index 9e90c442a158..69a5f477fe88 100644 --- a/subsys/net/lib/wifi_ready/Kconfig +++ b/subsys/net/lib/wifi_ready/Kconfig @@ -7,7 +7,7 @@ menuconfig WIFI_READY_LIB bool "Wi-Fi ready event handling library" select EXPERIMENTAL - depends on WPA_SUPP + depends on WIFI_NM_WPA_SUPPLICANT depends on NET_MGMT help Enable WiFi ready management subsystem that allows the application to diff --git a/subsys/net/lib/wifi_ready/wifi_ready.c b/subsys/net/lib/wifi_ready/wifi_ready.c index cbe21e6e5631..d8d2b7fc1aca 100644 --- a/subsys/net/lib/wifi_ready/wifi_ready.c +++ b/subsys/net/lib/wifi_ready/wifi_ready.c @@ -22,8 +22,8 @@ static wifi_ready_callback_t wifi_ready_callbacks[CONFIG_WIFI_READY_MAX_CALLBACK static unsigned char callback_count; static K_MUTEX_DEFINE(wifi_ready_mutex); -#define WPA_SUPP_EVENTS (NET_EVENT_WPA_SUPP_READY) | \ - (NET_EVENT_WPA_SUPP_NOT_READY) +#define WPA_SUPP_EVENTS (NET_EVENT_SUPPLICANT_READY) | \ + (NET_EVENT_SUPPLICANT_NOT_READY) static struct net_mgmt_event_callback net_wpa_supp_cb; @@ -68,10 +68,10 @@ static void wpa_supp_event_handler(struct net_mgmt_event_callback *cb, LOG_DBG("Event received: %d", mgmt_event); switch (mgmt_event) { - case NET_EVENT_WPA_SUPP_READY: + case NET_EVENT_SUPPLICANT_READY: handle_wpa_supp_event(iface, true); break; - case NET_EVENT_WPA_SUPP_NOT_READY: + case NET_EVENT_SUPPLICANT_NOT_READY: handle_wpa_supp_event(iface, false); break; default: From 2d8842d585cee471ebd25363b3e557e6c6a2571f Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 6 Aug 2024 00:43:19 +0530 Subject: [PATCH 06/25] modules: hostap: Remove hostap module Migrate to using Zephyr upstream. Signed-off-by: Chaitanya Tata --- CODEOWNERS | 1 - modules/CMakeLists.txt | 1 - modules/Kconfig | 1 - modules/hostap/CMakeLists.txt | 398 ---------- modules/hostap/Kconfig | 269 ------- modules/hostap/module.yml | 3 - modules/hostap/src/supp_api.c | 1003 -------------------------- modules/hostap/src/supp_api.h | 199 ----- modules/hostap/src/supp_events.c | 462 ------------ modules/hostap/src/supp_events.h | 150 ---- modules/hostap/src/supp_main.c | 640 ---------------- modules/hostap/src/supp_main.h | 21 - modules/hostap/src/utils/wpa_debug.c | 416 ----------- modules/hostap/src/utils/wpa_debug.h | 389 ---------- modules/hostap/src/wpa_cli.c | 41 -- 15 files changed, 3994 deletions(-) delete mode 100644 modules/hostap/CMakeLists.txt delete mode 100644 modules/hostap/Kconfig delete mode 100644 modules/hostap/module.yml delete mode 100644 modules/hostap/src/supp_api.c delete mode 100644 modules/hostap/src/supp_api.h delete mode 100644 modules/hostap/src/supp_events.c delete mode 100644 modules/hostap/src/supp_events.h delete mode 100644 modules/hostap/src/supp_main.c delete mode 100644 modules/hostap/src/supp_main.h delete mode 100644 modules/hostap/src/utils/wpa_debug.c delete mode 100644 modules/hostap/src/utils/wpa_debug.h delete mode 100644 modules/hostap/src/wpa_cli.c diff --git a/CODEOWNERS b/CODEOWNERS index 3c31d4130305..f1134cae7b72 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -156,7 +156,6 @@ Kconfig* @tejlmand /lib/sample_rate_converter/ @nrfconnect/ncs-audio /lib/tone/ @nrfconnect/ncs-audio /modules/ @tejlmand -/modules/hostap/ @krish2718 @jukkar @rado17 @sachinthegreen @rlubos /modules/mcuboot/ @de-nordic @nordicjm /modules/cjson/ @nrfconnect/ncs-cia @plskeggs @sigvartmh /modules/trusted-firmware-m/ @frkv @Vge0rge @vili-nordic diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index eb053de26d92..8bee96ecc1d4 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -8,5 +8,4 @@ add_subdirectory_ifdef(CONFIG_BUILD_WITH_TFM trusted-firmware-m) add_subdirectory_ifdef(CONFIG_MEMFAULT memfault-firmware-sdk) add_subdirectory_ifdef(CONFIG_MCUBOOT mcuboot/hooks) add_subdirectory_ifdef(CONFIG_COREMARK coremark) -add_subdirectory(hostap) add_subdirectory(wfa-qt) diff --git a/modules/Kconfig b/modules/Kconfig index eddd40978ef6..f9f1ca41417a 100644 --- a/modules/Kconfig +++ b/modules/Kconfig @@ -5,5 +5,4 @@ # osource "$(NCS_MEMFAULT_FIRMWARE_SDK_KCONFIG)" -rsource "hostap/Kconfig" rsource "wfa-qt/Kconfig" diff --git a/modules/hostap/CMakeLists.txt b/modules/hostap/CMakeLists.txt deleted file mode 100644 index 888a3fa47d2d..000000000000 --- a/modules/hostap/CMakeLists.txt +++ /dev/null @@ -1,398 +0,0 @@ -# -# Copyright (c) 2022 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -if(CONFIG_WPA_SUPP) - -zephyr_library() - -set(HOSTAP_BASE ${CMAKE_CURRENT_SOURCE_DIR}/../../../modules/lib/hostap) -set(WPA_SUPPLICANT_BASE ${HOSTAP_BASE}/wpa_supplicant) -set(COMMON_SRC_BASE ${HOSTAP_BASE}/src) - -set(CMAKE_EXE_LINKER_FLAGS "--specs=nosys.specs -lnosys") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMISSING_SYSCALL_NAMES") - -zephyr_compile_definitions( - CONFIG_ZEPHYR -) - -zephyr_include_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/src - ${HOSTAP_BASE}/ - ${WPA_SUPPLICANT_BASE}/ - ${COMMON_SRC_BASE}/ -) - -zephyr_library_compile_definitions( - TLS_DEFAULT_CIPHERS=\""DEFAULT:!EXP:!LOW"\" - CONFIG_SHA256 - CONFIG_SME - CONFIG_NO_CONFIG_WRITE - CONFIG_NO_CONFIG_BLOBS - CONFIG_WPA_S_ZEPHYR_L2_WIFI_MGMT - CONFIG_CTRL_IFACE - CONFIG_CTRL_IFACE_ZEPHYR - CONFIG_NO_RANDOM_POOL - CONFIG_SUITEB192 -) - - -zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_CRYPTO_NONE - CONFIG_NO_PBKDF2 -) - -zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_NO_DEBUG - CONFIG_NO_STDOUT_DEBUG -) - -zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_ROBUST_AV - CONFIG_ROBUST_AV -) - -zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_WMM_AC - CONFIG_WMM_AC -) - -zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_RRM - CONFIG_RRM -) - -zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_MBO - CONFIG_MBO -) - -zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_WNM - CONFIG_WNM -) - -zephyr_library_include_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/src - ${HOSTAP_BASE}/ - ${COMMON_SRC_BASE}/utils - ${COMMON_SRC_BASE}/drivers - ${HOSTAP_BASE}/src - ${ZEPHYR_BASE}/include - ${ZEPHYR_BASE}/include/net -) - -zephyr_library_sources( - ${COMMON_SRC_BASE}/common/wpa_common.c - ${COMMON_SRC_BASE}/common/ieee802_11_common.c - ${COMMON_SRC_BASE}/common/hw_features_common.c - ${COMMON_SRC_BASE}/common/wpa_ctrl.c - ${COMMON_SRC_BASE}/common/cli.c - - ${COMMON_SRC_BASE}/drivers/driver_common.c - ${COMMON_SRC_BASE}/drivers/drivers.c - ${COMMON_SRC_BASE}/l2_packet/l2_packet_zephyr.c - ${COMMON_SRC_BASE}/drivers/driver_zephyr.c - ${COMMON_SRC_BASE}/utils/common.c - ${COMMON_SRC_BASE}/utils/wpabuf.c - ${COMMON_SRC_BASE}/utils/bitfield.c - ${COMMON_SRC_BASE}/utils/eloop.c - ${COMMON_SRC_BASE}/utils/os_zephyr.c - ${WPA_SUPPLICANT_BASE}/config.c - ${WPA_SUPPLICANT_BASE}/notify.c - ${WPA_SUPPLICANT_BASE}/bss.c - ${WPA_SUPPLICANT_BASE}/eap_register.c - ${WPA_SUPPLICANT_BASE}/config_none.c - ${WPA_SUPPLICANT_BASE}/sme.c - ${WPA_SUPPLICANT_BASE}/wpa_supplicant.c - ${WPA_SUPPLICANT_BASE}/events.c - ${WPA_SUPPLICANT_BASE}/bssid_ignore.c - ${WPA_SUPPLICANT_BASE}/wpas_glue.c - ${WPA_SUPPLICANT_BASE}/scan.c - ${WPA_SUPPLICANT_BASE}/ctrl_iface.c - ${WPA_SUPPLICANT_BASE}/wpa_cli_cmds.c - ${WPA_SUPPLICANT_BASE}/ctrl_iface_zephyr.c - ${WPA_SUPPLICANT_BASE}/wpa_cli_zephyr.c - # Zephyr main - src/supp_main.c - src/utils/wpa_debug.c - src/supp_api.c - src/supp_events.c -) - -# Advanced features -zephyr_library_sources_ifdef(CONFIG_WPA_SUPP_RRM - ${WPA_SUPPLICANT_BASE}/op_classes.c - ${WPA_SUPPLICANT_BASE}/rrm.c -) -zephyr_library_sources_ifdef(CONFIG_WPA_SUPP_WMM_AC - ${WPA_SUPPLICANT_BASE}/wmm_ac.c -) -zephyr_library_sources_ifdef(CONFIG_WPA_SUPP_ROBUST_AV - ${WPA_SUPPLICANT_BASE}/robust_av.c -) -zephyr_library_sources_ifdef(CONFIG_WPA_SUPP_MBO - ${WPA_SUPPLICANT_BASE}/mbo.c -) -zephyr_library_sources_ifdef(CONFIG_WPA_SUPP_WNM - ${WPA_SUPPLICANT_BASE}/wnm_sta.c -) - -zephyr_library_sources_ifdef(CONFIG_WPA_CLI - src/wpa_cli.c -) - -zephyr_library_sources_ifdef(CONFIG_WPA_SUPP_AP - ${WPA_SUPPLICANT_BASE}/ap.c - ${COMMON_SRC_BASE}/ap/ap_config.c - ${COMMON_SRC_BASE}/ap/ap_drv_ops.c - ${COMMON_SRC_BASE}/ap/ap_list.c - ${COMMON_SRC_BASE}/ap/ap_mlme.c - ${COMMON_SRC_BASE}/ap/authsrv.c - ${COMMON_SRC_BASE}/ap/beacon.c - ${COMMON_SRC_BASE}/ap/bss_load.c - ${COMMON_SRC_BASE}/ap/dfs.c - ${COMMON_SRC_BASE}/ap/drv_callbacks.c - ${COMMON_SRC_BASE}/ap/eap_user_db.c - ${COMMON_SRC_BASE}/ap/hostapd.c - ${COMMON_SRC_BASE}/ap/hw_features.c - ${COMMON_SRC_BASE}/ap/ieee802_11_auth.c - ${COMMON_SRC_BASE}/ap/ieee802_11.c - ${COMMON_SRC_BASE}/ap/ieee802_11_he.c - ${COMMON_SRC_BASE}/ap/ieee802_11_ht.c - ${COMMON_SRC_BASE}/ap/ieee802_11_shared.c - ${COMMON_SRC_BASE}/ap/ieee802_11_vht.c - ${COMMON_SRC_BASE}/ap/ieee802_1x.c - ${COMMON_SRC_BASE}/ap/neighbor_db.c - ${COMMON_SRC_BASE}/ap/p2p_hostapd.c - ${COMMON_SRC_BASE}/ap/pmksa_cache_auth.c - ${COMMON_SRC_BASE}/ap/preauth_auth.c - ${COMMON_SRC_BASE}/ap/rrm.c - ${COMMON_SRC_BASE}/ap/sta_info.c - ${COMMON_SRC_BASE}/ap/tkip_countermeasures.c - ${COMMON_SRC_BASE}/ap/utils.c - ${COMMON_SRC_BASE}/ap/wmm.c - - ${COMMON_SRC_BASE}/ap/wpa_auth.c - ${COMMON_SRC_BASE}/ap/wpa_auth_ie.c - ${COMMON_SRC_BASE}/ap/wpa_auth_ft.c - ${COMMON_SRC_BASE}/ap/wpa_auth_glue.c - - ${COMMON_SRC_BASE}/eap_common/eap_common.c - ${COMMON_SRC_BASE}/eap_server/eap_server.c - ${COMMON_SRC_BASE}/eap_server/eap_server_identity.c - ${COMMON_SRC_BASE}/eap_server/eap_server_methods.c - ${COMMON_SRC_BASE}/eapol_auth/eapol_auth_sm.c - ${COMMON_SRC_BASE}/ap/mbo_ap.c - ${COMMON_SRC_BASE}/ap/ctrl_iface_ap.c - ${COMMON_SRC_BASE}/utils/crc32.c -) - -zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_AP - CONFIG_AP - CONFIG_NO_RADIUS - CONFIG_NO_VLAN - CONFIG_NO_ACCOUNTING - NEED_AP_MLME - CONFIG_IEEE80211AX - CONFIG_EAP_SERVER - CONFIG_EAP_SERVER_IDENTITY -) - - -zephyr_library_sources_ifdef(CONFIG_WPA_SUPP_CRYPTO_NONE - ${COMMON_SRC_BASE}/crypto/crypto_none.c - ${COMMON_SRC_BASE}/crypto/tls_none.c -) - -zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_CRYPTO_NONE - CONFIG_NO_WPA - CONFIG_CRYPTO_INTERNAL -) - -zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_CRYPTO_WEP - CONFIG_WEP -) - -zephyr_library_sources_ifndef(CONFIG_WPA_SUPP_CRYPTO_NONE - ${COMMON_SRC_BASE}/common/wpa_common.c - ${COMMON_SRC_BASE}/rsn_supp/wpa.c - ${COMMON_SRC_BASE}/rsn_supp/preauth.c - ${COMMON_SRC_BASE}/rsn_supp/wpa_ie.c - - ${COMMON_SRC_BASE}/crypto/crypto_mbedtls-bignum.c - ${COMMON_SRC_BASE}/crypto/crypto_mbedtls-ec.c - ${COMMON_SRC_BASE}/crypto/crypto_mbedtls.c - ${COMMON_SRC_BASE}/crypto/aes-wrap.c - ${COMMON_SRC_BASE}/crypto/aes-unwrap.c - ${COMMON_SRC_BASE}/crypto/rc4.c - #${COMMON_SRC_BASE}/crypto/random.c - ${COMMON_SRC_BASE}/crypto/sha1-prf.c - ${COMMON_SRC_BASE}/crypto/sha256-prf.c - ${COMMON_SRC_BASE}/crypto/sha256-prf.c - ${COMMON_SRC_BASE}/crypto/sha384-prf.c -) - -zephyr_library_sources_ifndef(CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE - ${COMMON_SRC_BASE}/crypto/tls_none.c -) - -zephyr_library_sources_ifdef(CONFIG_WPA_SUPP_WPA3 - ${COMMON_SRC_BASE}/common/sae.c - ${COMMON_SRC_BASE}/common/dragonfly.c - - ${COMMON_SRC_BASE}/crypto/dh_groups.c - ${COMMON_SRC_BASE}/crypto/sha256-kdf.c -) - -zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_WPA3 - CONFIG_SAE - CONFIG_ECC -) - -zephyr_library_include_directories_ifndef(CONFIG_WPA_SUPP_CRYPTO_NONE - ${CMAKE_SOURCE_DIR} -) - -zephyr_library_sources_ifdef(CONFIG_WPA_SUPP_P2P - ${WPA_SUPPLICANT_BASE}/p2p_supplicant.c - ${WPA_SUPPLICANT_BASE}/p2p_supplicant_sd.c - ${COMMON_SRC_BASE}/p2p/p2p.c - ${COMMON_SRC_BASE}/p2p/p2p_utils.c - ${COMMON_SRC_BASE}/p2p/p2p_parse.c - ${COMMON_SRC_BASE}/p2p/p2p_build.c - ${COMMON_SRC_BASE}/p2p/p2p_go_neg.c - ${COMMON_SRC_BASE}/p2p/p2p_sd.c - ${COMMON_SRC_BASE}/p2p/p2p_pd.c - ${COMMON_SRC_BASE}/p2p/p2p_invitation.c - ${COMMON_SRC_BASE}/p2p/p2p_dev_disc.c - ${COMMON_SRC_BASE}/p2p/p2p_group.c - ${COMMON_SRC_BASE}/ap/p2p_hostapd.c - ${COMMON_SRC_BASE}/common/gas.c - ${WPA_SUPPLICANT_BASE}/gas_query.c - ${WPA_SUPPLICANT_BASE}/offchannel.c -) -zephyr_library_sources_ifdef(CONFIG_WPA_SUPP_WPS - ${WPA_SUPPLICANT_BASE}/wps_supplicant.c - ${COMMON_SRC_BASE}/utils/uuid.c - ${COMMON_SRC_BASE}/eap_peer/eap_wsc.c - ${COMMON_SRC_BASE}/eap_common/eap_wsc_common.c - ${COMMON_SRC_BASE}/wps/wps.c - ${COMMON_SRC_BASE}/ap/wps_hostapd.c - ${COMMON_SRC_BASE}/wps/wps_common.c - ${COMMON_SRC_BASE}/wps/wps_attr_parse.c - ${COMMON_SRC_BASE}/wps/wps_attr_build.c - ${COMMON_SRC_BASE}/wps/wps_attr_process.c - ${COMMON_SRC_BASE}/wps/wps_dev_attr.c - ${COMMON_SRC_BASE}/wps/wps_enrollee.c - ${COMMON_SRC_BASE}/wps/wps_registrar.c - ${COMMON_SRC_BASE}/crypto/dh_groups.c - ${COMMON_SRC_BASE}/crypto/dh_group5.c -) - -zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_P2P - CONFIG_P2P - CONFIG_GAS - CONFIG_OFFCHANNEL -) - -zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_WPS - CONFIG_WPS - EAP_WSC -) - -zephyr_library_sources_ifdef(CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE - ${COMMON_SRC_BASE}/crypto/tls_mbedtls.c - - ${COMMON_SRC_BASE}/eap_peer/eap_tls.c - ${COMMON_SRC_BASE}/eap_peer/eap_tls_common.c - - - ${COMMON_SRC_BASE}/eap_peer/eap_peap.c - ${COMMON_SRC_BASE}/eap_common/eap_peap_common.c - ${COMMON_SRC_BASE}/eap_peer/eap_ttls.c - ${COMMON_SRC_BASE}/eap_peer/eap_md5.c - ${COMMON_SRC_BASE}/eap_peer/eap_mschapv2.c - ${COMMON_SRC_BASE}/eap_common/chap.c - ${COMMON_SRC_BASE}/eap_peer/mschapv2.c - ${COMMON_SRC_BASE}/eap_peer/eap_leap.c - - ${COMMON_SRC_BASE}/eap_peer/eap_psk.c - ${COMMON_SRC_BASE}/eap_common/eap_psk_common.c - - ${COMMON_SRC_BASE}/eap_peer/eap_fast.c - ${COMMON_SRC_BASE}/eap_peer/eap_fast_pac.c - ${COMMON_SRC_BASE}/eap_common/eap_fast_common.c - - ${COMMON_SRC_BASE}/eap_peer/eap_pax.c - ${COMMON_SRC_BASE}/eap_common/eap_pax_common.c - - ${COMMON_SRC_BASE}/eap_peer/eap_sake.c - ${COMMON_SRC_BASE}/eap_common/eap_sake_common.c - - ${COMMON_SRC_BASE}/eap_peer/eap_gpsk.c - ${COMMON_SRC_BASE}/eap_common/eap_gpsk_common.c - - ${COMMON_SRC_BASE}/eap_peer/eap_pwd.c - ${COMMON_SRC_BASE}/eap_common/eap_pwd_common.c - - ${COMMON_SRC_BASE}/eap_peer/eap_eke.c - ${COMMON_SRC_BASE}/eap_common/eap_eke_common.c - - ${COMMON_SRC_BASE}/eap_peer/eap_ikev2.c - ${COMMON_SRC_BASE}/eap_peer/ikev2.c - ${COMMON_SRC_BASE}/eap_common/eap_ikev2_common.c - ${COMMON_SRC_BASE}/eap_common/ikev2_common.c - - # common - ${COMMON_SRC_BASE}/crypto/sha384-tlsprf.c - ${COMMON_SRC_BASE}/crypto/sha256-tlsprf.c - ${COMMON_SRC_BASE}/crypto/sha1-tlsprf.c - ${COMMON_SRC_BASE}/crypto/sha1-tprf.c - ${COMMON_SRC_BASE}/crypto/ms_funcs.c - ${COMMON_SRC_BASE}/crypto/aes-eax.c - # MD4 removed from MbedTLS - ${COMMON_SRC_BASE}/crypto/md4-internal - ${COMMON_SRC_BASE}/crypto/aes-encblock.c - -) - -zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_CRYPTO_ENTERPRISE - CONFIG_EAP_TLS - CONFIG_IEEE8021X_EAPOL - CONFIG_EAP_PEAP - CONFIG_EAP_TTLS - CONFIG_EAP_MD5 - CONFIG_EAP_MSCHAPv2 - CONFIG_EAP_LEAP - CONFIG_EAP_PSK - CONFIG_EAP_FAST - CONFIG_EAP_PAX - CONFIG_EAP_SAKE - CONFIG_EAP_GPSK - CONFIG_EAP_PWD - CONFIG_EAP_EKE - CONFIG_EAP_IKEv2 -) - -zephyr_library_sources_ifdef(CONFIG_WPA_SUPP_EAPOL - ${COMMON_SRC_BASE}/eapol_supp/eapol_supp_sm.c - ${COMMON_SRC_BASE}/eap_peer/eap.c - ${COMMON_SRC_BASE}/eap_peer/eap_methods.c - ${COMMON_SRC_BASE}/eap_common/eap_common.c - ${COMMON_SRC_BASE}/rsn_supp/pmksa_cache.c -) - -zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_EAPOL - IEEE8021X_EAPOL -) - -zephyr_library_compile_definitions_ifdef(CONFIG_WPA_SUPP_NW_SEL_RELIABILITY - CONFIG_NW_SEL_RELIABILITY -) - -zephyr_library_include_directories_ifdef(CONFIG_WPA_SUPP_CRYPTO_LEGACY_MBEDTLS - ${CMAKE_CURRENT_SOURCE_DIR}/../../../modules/crypto/mbedtls/include - ${CMAKE_CURRENT_SOURCE_DIR}/../../../modules/crypto/mbedtls/include/mbedtls - ${CMAKE_CURRENT_SOURCE_DIR}/../../../modules/crypto/mbedtls/include/mbedtls/configs -) -zephyr_compile_definitions_ifdef(CONFIG_WPA_SUPP_CRYPTO_LEGACY_MBEDTLS - MBEDTLS_CONFIG_FILE="${CMAKE_CURRENT_SOURCE_DIR}/../../../zephyr/modules/mbedtls/configs/${CONFIG_MBEDTLS_CFG_FILE}" -) -endif() diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig deleted file mode 100644 index b4c2eaa0714f..000000000000 --- a/modules/hostap/Kconfig +++ /dev/null @@ -1,269 +0,0 @@ -# Nordic WiFi driver for nRF52840 and nRF5340 -# -# Copyright (c) 2022 Nordic Semiconductor -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -menuconfig WIFI_NM_WPA_SUPPLICANT - bool "WPA supplicant support" - # Need full POSIX from libc, Zephyr's POSIX support is only partial - select POSIX_CLOCK - select POSIX_SIGNAL - select POSIX_API - select NET_SOCKETS - select NET_SOCKETS_PACKET - select NET_SOCKETPAIR - select NET_L2_WIFI_MGMT - select WIFI_NM - select EXPERIMENTAL if !SOC_SERIES_NRF53X && !SOC_SERIES_NRF91X - select COMMON_LIBC_MALLOC - help - WPA supplicant implements 802.1X related functions. - -if WIFI_NM_WPA_SUPPLICANT - -config COMMON_LIBC_MALLOC_ARENA_SIZE - default 40000 if WPA_SUPP_AP - # 8192 for MbedTLS heap - default 21808 if MBEDTLS_ENABLE_HEAP - # 30K is mandatory, but might need more for long duration use cases - default 30000 - -# Hidden as these are mandatory for WFA certification -config WPA_SUPP_WMM_AC - bool - default y - -config WPA_SUPP_MBO - bool - default y - -# Memory optimizations -config WPA_SUPP_ADVANCED_FEATURES - bool "Enable advanced features" - default y - -if WPA_SUPP_ADVANCED_FEATURES - -config WPA_SUPP_ROBUST_AV - bool "Robust Audio Video streaming support" - default y - -config WPA_SUPP_WNM - bool "Wireless Network Management support" - default y - -config WPA_SUPP_RRM - bool "Radio Resource Management support" - default y -endif - -config WPA_SUPP_MGD_IFACES_PREFIXES - string "WPA supplicant managed interfaces prefixes" - default "wlan,esp,nordic_wlan" - -config WPA_SUPP_THREAD_STACK_SIZE - int "Stack size for wpa_supplicant thread" - default 5200 - -config WPA_SUPP_WQ_STACK_SIZE - int "Stack size for wpa_supplicant workqueue" - default 4400 - -config WPA_SUPP_WQ_PRIORITY - int "Priority for wpa_supplicant workqueue" - default 7 - -config WPA_SUPP_CRYPTO_WEP - bool "WEP (Legacy crypto) support" - -choice WPA_SUPP_CRYPTO_BACKEND - prompt "WPA supplicant crypto implementation" - default WPA_SUPP_CRYPTO_PSA if BUILD_WITH_TFM - default WPA_SUPP_CRYPTO_LEGACY if !BUILD_WITH_TFM - help - Select the crypto implementation to use for WPA supplicant. - -# To easily manage the crypto dependencies we separate the crypto -# implementations into two Kconfig options. One for the legacy crypto -# and one for the PSA crypto. -config WPA_SUPP_CRYPTO_PSA - bool "PSA Crypto support for WiFi" - select MBEDTLS - select NRF_SECURITY - select PSA_WANT_GENERATE_RANDOM - # Legacy crypto, still needed - select MBEDTLS_SHA1_C - select MBEDTLS_LEGACY_CRYPTO_C - select MBEDTLS_CMAC_C - select MBEDTLS_GCM_C - select MBEDTLS_TLS_LIBRARY - select MBEDTLS_PK_C - select MBEDTLS_PK_WRITE_C - select MBEDTLS_X509_LIBRARY - select MBEDTLS_X509_CRT_PARSE_C - select MBEDTLS_CIPHER_C - select MBEDTLS_CIPHER_MODE_CTR - select MBEDTLS_CIPHER_MODE_CBC - select MBEDTLS_SSL_TLS_C - select MBEDTLS_ECP_C - select MBEDTLS_CTR_DRBG_C - select MBEDTLS_KEY_EXCHANGE_ALL_ENABLED - select MBEDTLS_MD_C - select MBEDTLS_CIPHER_PADDING_PKCS7 - select MBEDTLS_PKCS5_C - -config WPA_SUPP_CRYPTO_LEGACY - bool "Legacy Crypto support for WiFi using nRF security" - select MBEDTLS - select NRF_SECURITY - select MBEDTLS_CIPHER_MODE_CBC - select MBEDTLS_CIPHER_MODE_CTR - select MBEDTLS_LEGACY_CRYPTO_C - select MBEDTLS_SHA1_C - select MBEDTLS_ECP_C - select MBEDTLS_CTR_DRBG_C - select MBEDTLS_PK_C - select MBEDTLS_PKCS5_C - select MBEDTLS_CIPHER_PADDING_PKCS7 - select MBEDTLS_PK_WRITE_C - select MBEDTLS_KEY_EXCHANGE_ALL_ENABLED - -config WPA_SUPP_CRYPTO_LEGACY_MBEDTLS - bool "Legacy Crypto support for WiFi using vanilla MbedTLS" - select MBEDTLS - select MBEDTLS_CIPHER_MODE_CTR_ENABLED - select MBEDTLS_CIPHER_MODE_CBC_ENABLED - select MBEDTLS_ECP_C - select MBEDTLS_ECP_ALL_ENABLED - select MBEDTLS_MAC_CMAC_ENABLED - select MBEDTLS_PKCS5_C - select MBEDTLS_PK_WRITE_C - select MBEDTLS_ECDH_C - select MBEDTLS_ECDSA_C - select MBEDTLS_ECJPAKE_C - select MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED - select MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED - select MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED - select MBEDTLS_KEY_EXCHANGE_ALL_ENABLED - -config WPA_SUPP_CRYPTO_NONE - bool "No Crypto support for WiFi" - -endchoice - -# To fix MAC_MD5 Kconfig warning -config NET_TCP_ISN_RFC6528 - default n if !WPA_SUPP_CRYPTO_NONE - -config WPA_SUPP_CRYPTO_ENTERPRISE - bool "Enterprise Crypto support for WiFi" - depends on !WPA_SUPP_CRYPTO_NONE - -config WPA_SUPP_WPA3 - bool "WPA3 support" - depends on !WPA_SUPP_CRYPTO_NONE - default y - -config WPA_SUPP_AP - bool "AP mode support" - -config WPA_SUPP_WPS - bool "WPS support" - depends on !WPA_SUPP_CRYPTO_NONE - -config WPA_SUPP_P2P - bool "P2P mode support" - select WPA_SUPP_AP - select WPA_SUPP_WPS - -config WPA_SUPP_EAPOL - bool "Enable EAPoL supplicant" - -config WPA_CLI - bool "CLI support for wpa_supplicant" - default n - -config NET_SOCKETPAIR_BUFFER_SIZE - default 4096 - -config POSIX_MAX_FDS - # l2_packet - 1 - # ctrl_iface - 2 * socketpairs = 4(local and global) - # z_wpa_event_sock - 1 socketpair = 2 - # Remaining left for the applications running in default configuration - default 16 if !POSIX_API - -config BSS_MAX_IDLE_TIME - int "BSS max idle timeout in seconds" - range 0 64000 - default 300 - help - BSS max idle timeout is the period for which AP may keep a client - in associated state while there is no traffic from that particular - client. Set 0 to disable inclusion of BSS max idle time tag in - association request. If a non-zero value is set, STA can suggest a - timeout by including BSS max idle period in the association request. - AP may choose to consider or ignore the STA's preferred value. - Ref: Sec 11.21.13 of IEEE Std 802.11â„¢-2020 - -# Control interface is stack heavy (buffers + snprintfs) -# Making calls to RPU from net_mgmt callbacks (status - RSSI) -config NET_MGMT_EVENT_STACK_SIZE - default 4400 - -config NET_SOCKETS_POLL_MAX - default 6 - -module = WIFI_NM_WPA_SUPPLICANT -module-str = WPA supplicant -source "subsys/logging/Kconfig.template.log_config" - -config WPA_SUPP_DEBUG_LEVEL - int "Min compiled-in debug message level for WPA supplicant" - default 0 if WPA_SUPP_LOG_LEVEL_DBG # MSG_EXCESSIVE - default 3 if WPA_SUPP_LOG_LEVEL_INF # MSG_INFO - default 4 if WPA_SUPP_LOG_LEVEL_WRN # MSG_WARNING - default 5 if WPA_SUPP_LOG_LEVEL_ERR # MSG_ERROR - default 6 - help - Minimum priority level of a debug message emitted by WPA supplicant that - is compiled-in the firmware. See wpa_debug.h file of the supplicant for - available levels and functions for emitting the messages. Note that - runtime filtering can also be configured in addition to the compile-time - filtering. - -# Debug logs need more buffer space -config LOG_BUFFER_SIZE - default 4096 if WPA_SUPP_LOG_LEVEL_DBG - default 2048 - -# Without this logs are logs independent of buffer size -if WPA_SUPP_LOG_LEVEL_DBG - choice LOG_MODE - default LOG_MODE_IMMEDIATE - endchoice -endif - -config WPA_SUPP_NO_DEBUG - bool "Disable printing of debug messages, saves code size significantly" - -choice WPA_SUPP_NW_SEL - prompt "WPA supplicant Network selection criterion" - default WPA_SUPP_NW_SEL_THROUGHPUT - help - Select the network selection method for the supplicant. - -config WPA_SUPP_NW_SEL_THROUGHPUT - bool "Throughput based network selection" - help - Select the network based on throughput. - -config WPA_SUPP_NW_SEL_RELIABILITY - bool "Reliability based network selection" - help - Select the network based on reliability. -endchoice - -endif # WIFI_NM_WPA_SUPPLICANT diff --git a/modules/hostap/module.yml b/modules/hostap/module.yml deleted file mode 100644 index 9c43bc6e5fd6..000000000000 --- a/modules/hostap/module.yml +++ /dev/null @@ -1,3 +0,0 @@ -build: - cmake: ./zephyr - kconfig: ./zephyr/Kconfig diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c deleted file mode 100644 index ba2faf8c3ccf..000000000000 --- a/modules/hostap/src/supp_api.c +++ /dev/null @@ -1,1003 +0,0 @@ -/** - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ -#include - -#include -#include -#include - -#include "includes.h" -#include "common.h" -#include "common/defs.h" -#include "wpa_supplicant/config.h" -#include "wpa_supplicant_i.h" -#include "driver_i.h" - -#include "supp_main.h" -#include "supp_api.h" -#include "wpa_cli_zephyr.h" -#include "supp_events.h" - -extern struct k_sem wpa_supplicant_ready_sem; -extern struct wpa_global *global; - -enum requested_ops { - CONNECT = 0, - DISCONNECT -}; - -enum status_thread_state { - STATUS_THREAD_STOPPED = 0, - STATUS_THREAD_RUNNING, -}; - -#define OP_STATUS_POLLING_INTERVAL 1 - -#define CONNECTION_SUCCESS 0 -#define CONNECTION_FAILURE 1 -#define CONNECTION_TERMINATED 2 - -#define DISCONNECT_TIMEOUT_MS 5000 - -#define _wpa_cli_cmd_v(cmd, ...) \ - do { \ - ret = z_wpa_cli_cmd_v(cmd, ##__VA_ARGS__); \ - if (ret < 0) { \ - wpa_printf(MSG_ERROR, "Failed to execute wpa_cli command: %s", cmd); \ - goto out; \ - } \ - } while (0) - -K_MUTEX_DEFINE(wpa_supplicant_mutex); - - -struct wpa_supp_api_ctrl { - const struct device *dev; - enum requested_ops requested_op; - enum status_thread_state status_thread_state; - int connection_timeout; /* in seconds */ - struct k_work_sync sync; - bool terminate; -}; - -static struct wpa_supp_api_ctrl wpa_supp_api_ctrl; - -static void supp_shell_connect_status(struct k_work *work); - -static K_WORK_DELAYABLE_DEFINE(wpa_supp_status_work, - supp_shell_connect_status); - -static inline struct wpa_supplicant *get_wpa_s_handle(const struct device *dev) -{ - return z_wpas_get_handle_by_ifname(dev->name); -} - -#define WPA_SUPP_STATE_POLLING_MS 10 -static int wait_for_disconnect_complete(const struct device *dev) -{ - int ret = 0; - int attempts = 0; - struct wpa_supplicant *wpa_s = get_wpa_s_handle(dev); - unsigned int max_attempts = DISCONNECT_TIMEOUT_MS / WPA_SUPP_STATE_POLLING_MS; - - if (!wpa_s) { - ret = -ENODEV; - wpa_printf(MSG_ERROR, "Failed to get wpa_s handle"); - goto out; - } - - while (wpa_s->wpa_state != WPA_DISCONNECTED) { - if (attempts++ > max_attempts) { - ret = -ETIMEDOUT; - wpa_printf(MSG_WARNING, "Failed to disconnect from network"); - break; - } - k_sleep(K_MSEC(WPA_SUPP_STATE_POLLING_MS)); - } -out: - return ret; -} - -static void supp_shell_connect_status(struct k_work *work) -{ - static int seconds_counter; - int ret = CONNECTION_SUCCESS; - int conn_result = CONNECTION_FAILURE; - struct wpa_supplicant *wpa_s; - struct wpa_supp_api_ctrl *ctrl = &wpa_supp_api_ctrl; - - k_mutex_lock(&wpa_supplicant_mutex, K_FOREVER); - - if (ctrl->status_thread_state == STATUS_THREAD_RUNNING && ctrl->terminate) { - ret = CONNECTION_TERMINATED; - goto out; - } - - wpa_s = get_wpa_s_handle(ctrl->dev); - if (!wpa_s) { - ret = CONNECTION_FAILURE; - goto out; - } - - if (ctrl->requested_op == CONNECT && wpa_s->wpa_state != WPA_COMPLETED) { - if (ctrl->connection_timeout > 0 && seconds_counter++ > ctrl->connection_timeout) { - wpa_printf(MSG_ERROR, "Connection timed out, timeout: %d seconds", - ctrl->connection_timeout); - _wpa_cli_cmd_v("disconnect"); - conn_result = -ETIMEDOUT; - send_wifi_mgmt_event(wpa_s->ifname, NET_EVENT_WIFI_CMD_CONNECT_RESULT, - (void *)&conn_result, sizeof(int)); - ret = CONNECTION_FAILURE; - goto out; - } - - k_work_reschedule_for_queue(&z_wpas_wq, &wpa_supp_status_work, - K_SECONDS(OP_STATUS_POLLING_INTERVAL)); - ctrl->status_thread_state = STATUS_THREAD_RUNNING; - k_mutex_unlock(&wpa_supplicant_mutex); - return; - } -out: - seconds_counter = 0; - - ctrl->status_thread_state = STATUS_THREAD_STOPPED; - k_mutex_unlock(&wpa_supplicant_mutex); -} - -static struct hostapd_hw_modes *get_mode_by_band(struct wpa_supplicant *wpa_s, uint8_t band) -{ - enum hostapd_hw_mode hw_mode; - bool is_6ghz = (band == WIFI_FREQ_BAND_6_GHZ) ? true : false; - - if (band == WIFI_FREQ_BAND_2_4_GHZ) { - hw_mode = HOSTAPD_MODE_IEEE80211G; - } else if ((band == WIFI_FREQ_BAND_5_GHZ) || - (band == WIFI_FREQ_BAND_6_GHZ)) { - hw_mode = HOSTAPD_MODE_IEEE80211A; - } else { - return NULL; - } - - return get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes, hw_mode, is_6ghz); -} - -static int wpa_supp_supported_channels(struct wpa_supplicant *wpa_s, uint8_t band, char **chan_list) -{ - struct hostapd_hw_modes *mode = NULL; - int i; - int offset, retval; - int size; - char *_chan_list; - - mode = get_mode_by_band(wpa_s, band); - if (!mode) { - wpa_printf(MSG_ERROR, "Unsupported or invalid band: %d", band); - return -EINVAL; - } - - size = ((mode->num_channels) * CHAN_NUM_LEN) + 1; - _chan_list = os_malloc(size); - if (!_chan_list) { - wpa_printf(MSG_ERROR, "Mem alloc failed for channel list\n"); - return -ENOMEM; - } - - retval = 0; - offset = 0; - for (i = 0; i < mode->num_channels; i++) { - retval = snprintf(_chan_list + offset, CHAN_NUM_LEN, " %d", mode->channels[i].freq); - offset += retval; - } - *chan_list = _chan_list; - - return 0; -} - -static int wpa_supp_band_chan_compat(struct wpa_supplicant *wpa_s, uint8_t band, uint8_t channel) -{ - struct hostapd_hw_modes *mode = NULL; - int i; - - mode = get_mode_by_band(wpa_s, band); - if (!mode) { - wpa_printf(MSG_ERROR, "Unsupported or invalid band: %d", band); - return -EINVAL; - } - - for (i = 0; i < mode->num_channels; i++) { - if (mode->channels[i].chan == channel) { - return mode->channels[i].freq; - } - } - - wpa_printf(MSG_ERROR, "Channel %d not supported for band %d", channel, band); - - return -EINVAL; -} - -static inline void wpa_supp_restart_status_work(void) -{ - /* Terminate synchronously */ - wpa_supp_api_ctrl.terminate = 1; - k_work_flush_delayable(&wpa_supp_status_work, - &wpa_supp_api_ctrl.sync); - wpa_supp_api_ctrl.terminate = 0; - - /* Start afresh */ - k_work_reschedule_for_queue(&z_wpas_wq, &wpa_supp_status_work, - K_MSEC(10)); -} - -static inline int chan_to_freq(int chan) -{ - /* We use global channel list here and also use the widest - * op_class for 5GHz channels as there is no user input - * for these (yet). - */ - int freq = -1; - int op_classes[] = {81, 82, 128}; - int op_classes_size = ARRAY_SIZE(op_classes); - - for (int i = 0; i < op_classes_size; i++) { - freq = ieee80211_chan_to_freq(NULL, op_classes[i], chan); - if (freq > 0) { - break; - } - } - - if (freq <= 0) { - wpa_printf(MSG_ERROR, "Invalid channel %d", chan); - return -1; - } - - return freq; -} - -static inline enum wifi_frequency_bands wpas_band_to_zephyr(enum wpa_radio_work_band band) -{ - switch (band) { - case BAND_2_4_GHZ: - return WIFI_FREQ_BAND_2_4_GHZ; - case BAND_5_GHZ: - return WIFI_FREQ_BAND_5_GHZ; - default: - return WIFI_FREQ_BAND_UNKNOWN; - } -} - -static inline enum wifi_security_type wpas_key_mgmt_to_zephyr(int key_mgmt, int proto) -{ - switch (key_mgmt) { - case WPA_KEY_MGMT_NONE: - return WIFI_SECURITY_TYPE_NONE; - case WPA_KEY_MGMT_PSK: - if (proto == WPA_PROTO_RSN) { - return WIFI_SECURITY_TYPE_PSK; - } else { - return WIFI_SECURITY_TYPE_WPA_PSK; - } - case WPA_KEY_MGMT_PSK_SHA256: - return WIFI_SECURITY_TYPE_PSK_SHA256; - case WPA_KEY_MGMT_SAE: - return WIFI_SECURITY_TYPE_SAE; - default: - return WIFI_SECURITY_TYPE_UNKNOWN; - } -} - -static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s, - struct wifi_connect_req_params *params, bool mode_ap) -{ - int ret; - struct add_network_resp resp = {0}; - char *chan_list = NULL; - struct net_eth_addr mac = {0}; - - _wpa_cli_cmd_v("remove_network all"); - ret = z_wpa_ctrl_add_network(&resp); - if (ret) { - wpa_printf(MSG_ERROR, "Failed to add network"); - goto out; - } - - wpa_printf(MSG_DEBUG, "NET added: %d\n", resp.network_id); - - if (mode_ap) { - _wpa_cli_cmd_v("set_network %d mode 2", resp.network_id); - } - - _wpa_cli_cmd_v("set_network %d ssid \"%s\"", resp.network_id, params->ssid); - _wpa_cli_cmd_v("set_network %d scan_ssid 1", resp.network_id); - _wpa_cli_cmd_v("set_network %d key_mgmt NONE", resp.network_id); - _wpa_cli_cmd_v("set_network %d ieee80211w 0", resp.network_id); - if (params->band != WIFI_FREQ_BAND_UNKNOWN) { - ret = wpa_supp_supported_channels(wpa_s, params->band, &chan_list); - if (ret < 0) { - goto rem_net; - } - - if (chan_list) { - _wpa_cli_cmd_v("set_network %d scan_freq%s", resp.network_id, chan_list); - os_free(chan_list); - } - } - - if (params->security != WIFI_SECURITY_TYPE_NONE) { - /* SAP - only open and WPA2-PSK are supported for now */ - if (mode_ap && params->security != WIFI_SECURITY_TYPE_PSK) { - ret = -1; - wpa_printf(MSG_ERROR, "Unsupported security type: %d", - params->security); - goto rem_net; - } - - /* Except for WPA-PSK, rest all are under WPA2 */ - if (params->security != WIFI_SECURITY_TYPE_WPA_PSK) { - _wpa_cli_cmd_v("set_network %d proto RSN", - resp.network_id); - } - - if (params->security == WIFI_SECURITY_TYPE_SAE) { - if (params->sae_password) { - _wpa_cli_cmd_v("set_network %d sae_password \"%s\"", - resp.network_id, params->sae_password); - } else { - _wpa_cli_cmd_v("set_network %d sae_password \"%s\"", - resp.network_id, params->psk); - } - _wpa_cli_cmd_v("set_network %d key_mgmt SAE", - resp.network_id); - } else if (params->security == WIFI_SECURITY_TYPE_PSK_SHA256) { - _wpa_cli_cmd_v("set_network %d psk \"%s\"", - resp.network_id, params->psk); - _wpa_cli_cmd_v("set_network %d key_mgmt WPA-PSK-SHA256", - resp.network_id); - } else if (params->security == WIFI_SECURITY_TYPE_PSK || - params->security == WIFI_SECURITY_TYPE_WPA_PSK) { - _wpa_cli_cmd_v("set_network %d psk \"%s\"", - resp.network_id, params->psk); - _wpa_cli_cmd_v("set_network %d key_mgmt WPA-PSK", - resp.network_id); - if (params->security == WIFI_SECURITY_TYPE_WPA_PSK) { - _wpa_cli_cmd_v("set_network %d proto WPA", - resp.network_id); - } - } else if (params->security == WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL) { - if (params->sae_password) { - _wpa_cli_cmd_v("set_network %d sae_password \"%s\"", - resp.network_id, params->sae_password); - } - _wpa_cli_cmd_v("set_network %d psk \"%s\"", - resp.network_id, params->psk); - _wpa_cli_cmd_v("set_network %d key_mgmt WPA-PSK WPA-PSK-SHA256 SAE", - resp.network_id); - _wpa_cli_cmd_v("set_network %d proto WPA RSN", - resp.network_id); - } else { - ret = -1; - wpa_printf(MSG_ERROR, "Unsupported security type: %d", - params->security); - goto rem_net; - } - - if (params->mfp) { - _wpa_cli_cmd_v("set_network %d ieee80211w %d", - resp.network_id, params->mfp); - } - } - - if (params->channel != WIFI_CHANNEL_ANY) { - int freq; - - if (params->band != WIFI_FREQ_BAND_UNKNOWN) { - freq = wpa_supp_band_chan_compat(wpa_s, params->band, params->channel); - if (freq < 0) { - goto rem_net; - } - } else { - freq = chan_to_freq(params->channel); - if (freq < 0) { - ret = -1; - wpa_printf(MSG_ERROR, "Invalid channel %d", - params->channel); - goto rem_net; - } - } - if (mode_ap) { - _wpa_cli_cmd_v("set_network %d frequency %d", - resp.network_id, freq); - } else { - _wpa_cli_cmd_v("set_network %d scan_freq %d", - resp.network_id, freq); - } - } - - memcpy((void *)&mac, params->bssid, WIFI_MAC_ADDR_LEN); - if (net_eth_is_addr_broadcast(&mac) || - net_eth_is_addr_multicast(&mac)) { - wpa_printf(MSG_ERROR, "Invalid BSSID. Configuration " - "of multicast or broadcast MAC is not allowed."); - ret = -EINVAL; - goto rem_net; - } - - if (!net_eth_is_addr_unspecified(&mac)) { - char bssid_str[MAC_STR_LEN] = {0}; - - snprintf(bssid_str, MAC_STR_LEN, "%02x:%02x:%02x:%02x:%02x:%02x", - params->bssid[0], params->bssid[1], params->bssid[2], - params->bssid[3], params->bssid[4], params->bssid[5]); - _wpa_cli_cmd_v("set_network %d bssid %s", - resp.network_id, bssid_str); - } - - /* Set the default maximum inactivity time for the BSS to - * as configured by user. - */ - _wpa_cli_cmd_v("set_network %d ap_max_inactivity %d", - resp.network_id, CONFIG_WIFI_MGMT_AP_STA_INACTIVITY_TIMEOUT); - - /* enable and select network */ - _wpa_cli_cmd_v("enable_network %d", resp.network_id); - _wpa_cli_cmd_v("select_network %d", resp.network_id); - - return 0; -rem_net: - _wpa_cli_cmd_v("remove_network %d", resp.network_id); -out: - return ret; -} - -static int wpas_disconnect_network(const struct device *dev, int cur_mode) -{ - int ret = 0; - struct net_if *iface = net_if_lookup_by_dev(dev); - struct wpa_supplicant *wpa_s; - bool is_ap = false; - - if (!iface) { - ret = -EINVAL; - wpa_printf(MSG_ERROR, "Device %s not found", dev->name); - goto out; - } - - wpa_s = get_wpa_s_handle(dev); - if (!wpa_s) { - ret = -1; - wpa_printf(MSG_ERROR, "Interface %s not found", dev->name); - goto out; - } - - k_mutex_lock(&wpa_supplicant_mutex, K_FOREVER); - - if (wpa_s->current_ssid && wpa_s->current_ssid->mode != cur_mode) { - ret = -EBUSY; - wpa_printf(MSG_ERROR, "Interface %s is not in %s mode", dev->name, - cur_mode == WPAS_MODE_INFRA ? "STA" : "AP"); - goto out; - } - - is_ap = (cur_mode == WPAS_MODE_AP); - - wpa_supp_api_ctrl.dev = dev; - wpa_supp_api_ctrl.requested_op = DISCONNECT; - _wpa_cli_cmd_v("disconnect"); - -out: - k_mutex_unlock(&wpa_supplicant_mutex); - - if (ret) { - wpa_printf(MSG_ERROR, "Disconnect failed: %s", - strerror(-ret)); - return ret; - } - - wpa_supp_restart_status_work(); - - ret = wait_for_disconnect_complete(dev); -#ifdef CONFIG_AP - if (is_ap) { - send_wifi_mgmt_ap_status(wpa_s, NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT, - ret == 0 ? WIFI_STATUS_AP_SUCCESS : WIFI_STATUS_AP_FAIL); - } else { -#else - { -#endif /* CONFIG_AP */ - wifi_mgmt_raise_disconnect_complete_event(iface, ret); - } - - return ret; -} - -/* Public API */ -int z_wpa_supplicant_connect(const struct device *dev, - struct wifi_connect_req_params *params) -{ - struct wpa_supplicant *wpa_s; - int ret = 0; - - if (!net_if_is_admin_up(net_if_lookup_by_dev(dev))) { - wpa_printf(MSG_ERROR, - "Interface %s is down, dropping connect", - dev->name); - return -1; - } - - k_mutex_lock(&wpa_supplicant_mutex, K_FOREVER); - - wpa_s = get_wpa_s_handle(dev); - if (!wpa_s) { - ret = -1; - wpa_printf(MSG_ERROR, "Interface %s not found", dev->name); - goto out; - } - - /* Allow connect in STA mode only even if we are connected already */ - if (wpa_s->current_ssid && wpa_s->current_ssid->mode != WPAS_MODE_INFRA) { - ret = -EBUSY; - wpa_printf(MSG_ERROR, "Interface %s is not in STA mode", dev->name); - goto out; - } - - ret = wpas_add_and_config_network(wpa_s, params, false); - if (ret) { - wpa_printf(MSG_ERROR, "Failed to add and configure network for STA mode: %d", ret); - goto out; - } - - wpa_supp_api_ctrl.dev = dev; - wpa_supp_api_ctrl.requested_op = CONNECT; - wpa_supp_api_ctrl.connection_timeout = params->timeout; - - goto out; -out: - k_mutex_unlock(&wpa_supplicant_mutex); - - if (!ret) { - wpa_supp_restart_status_work(); - } - - return ret; -} - -int z_wpa_supplicant_disconnect(const struct device *dev) -{ - return wpas_disconnect_network(dev, WPAS_MODE_INFRA); -} - -int z_wpa_supplicant_status(const struct device *dev, - struct wifi_iface_status *status) -{ - struct wpa_supplicant *wpa_s; - int ret = -1; - struct wpa_signal_info *si = NULL; - struct wpa_conn_info *conn_info = NULL; - - k_mutex_lock(&wpa_supplicant_mutex, K_FOREVER); - - wpa_s = get_wpa_s_handle(dev); - if (!wpa_s) { - wpa_printf(MSG_ERROR, "Interface %s not found", dev->name); - goto out; - } - - si = os_zalloc(sizeof(struct wpa_signal_info)); - if (!si) { - wpa_printf(MSG_ERROR, "Failed to allocate memory for signal info"); - goto out; - } - - status->state = wpa_s->wpa_state; /* 1-1 Mapping */ - - if (wpa_s->wpa_state >= WPA_ASSOCIATED) { - struct wpa_ssid *ssid = wpa_s->current_ssid; - u8 channel; - struct signal_poll_resp signal_poll; - u8 *_ssid = ssid->ssid; - size_t ssid_len = ssid->ssid_len; - struct status_resp cli_status; - bool is_ap; - int proto; - int key_mgmt; - - if (!ssid) { - wpa_printf(MSG_ERROR, "Failed to get current ssid"); - goto out; - } - - is_ap = ssid->mode == WPAS_MODE_AP; - /* For AP its always the configured one */ - proto = is_ap ? ssid->proto : wpa_s->wpa_proto; - key_mgmt = is_ap ? ssid->key_mgmt : wpa_s->key_mgmt; - os_memcpy(status->bssid, wpa_s->bssid, WIFI_MAC_ADDR_LEN); - status->band = wpas_band_to_zephyr(wpas_freq_to_band(wpa_s->assoc_freq)); - status->security = wpas_key_mgmt_to_zephyr(key_mgmt, proto); - status->mfp = ssid->ieee80211w; /* Same mapping */ - ieee80211_freq_to_chan(wpa_s->assoc_freq, &channel); - status->channel = channel; - - if (ssid_len == 0) { - int _res = z_wpa_ctrl_status(&cli_status); - - if (_res < 0) - ssid_len = 0; - else - ssid_len = cli_status.ssid_len; - _ssid = cli_status.ssid; - } - os_memcpy(status->ssid, _ssid, ssid_len); - status->ssid_len = ssid_len; - status->iface_mode = ssid->mode; - if (wpa_s->connection_set == 1) { - status->link_mode = wpa_s->connection_he ? WIFI_6 : - wpa_s->connection_vht ? WIFI_5 : - wpa_s->connection_ht ? WIFI_4 : - wpa_s->connection_g ? WIFI_3 : - wpa_s->connection_a ? WIFI_2 : - wpa_s->connection_b ? WIFI_1 : - WIFI_0; - } else { - status->link_mode = WIFI_LINK_MODE_UNKNOWN; - } - - status->rssi = -WPA_INVALID_NOISE; - if (status->iface_mode == WIFI_MODE_INFRA) { - ret = z_wpa_ctrl_signal_poll(&signal_poll); - if (!ret) { - status->rssi = signal_poll.rssi; - } else { - wpa_printf(MSG_WARNING, "%s:Failed to read RSSI\n", - __func__); - ret = 0; - } - } - - conn_info = os_zalloc(sizeof(struct wpa_conn_info)); - if (!conn_info) { - wpa_printf(MSG_ERROR, "%s:Failed to allocate memory\n", - __func__); - ret = -ENOMEM; - goto out; - } - ret = wpa_drv_get_conn_info(wpa_s, conn_info); - if (!ret) { - status->beacon_interval = conn_info->beacon_interval; - status->dtim_period = conn_info->dtim_period; - status->twt_capable = conn_info->twt_capable; - } else { - wpa_printf(MSG_WARNING, "%s: Failed to get connection info\n", - __func__); - status->beacon_interval = 0; - status->dtim_period = 0; - status->twt_capable = false; - ret = 0; - } - os_free(conn_info); - } else { - ret = 0; - } -out: - os_free(si); - k_mutex_unlock(&wpa_supplicant_mutex); - return ret; -} - -/* Below APIs are not natively supported by WPA supplicant, so, - * these are just wrappers around driver offload APIs. But it is - * transparent to the user. - * - * In the future these might be implemented natively by the WPA - * supplicant. - */ - -static const struct wifi_mgmt_ops *const get_wifi_mgmt_api(const struct device *dev) -{ - struct net_wifi_mgmt_offload *off_api = - (struct net_wifi_mgmt_offload *) dev->api; - - return off_api ? off_api->wifi_mgmt_api : NULL; -} - -int z_wpa_supplicant_scan(const struct device *dev, struct wifi_scan_params *params, - scan_result_cb_t cb) -{ - const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_mgmt_api(dev); - - if (!wifi_mgmt_api || !wifi_mgmt_api->scan) { - wpa_printf(MSG_ERROR, "Scan not supported"); - return -ENOTSUP; - } - - return wifi_mgmt_api->scan(dev, params, cb); -} - -#ifdef CONFIG_NET_STATISTICS_WIFI -int z_wpa_supplicant_get_stats(const struct device *dev, - struct net_stats_wifi *stats) -{ - const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_mgmt_api(dev); - - if (!wifi_mgmt_api || !wifi_mgmt_api->get_stats) { - wpa_printf(MSG_ERROR, "Get stats not supported"); - return -ENOTSUP; - } - - return wifi_mgmt_api->get_stats(dev, stats); -} - -int z_wpa_supplicant_reset_stats(const struct device *dev) -{ - const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_mgmt_api(dev); - - if (!wifi_mgmt_api || !wifi_mgmt_api->reset_stats) { - wpa_printf(MSG_ERROR, "Reset stats not supported"); - return -ENOTSUP; - } - - return wifi_mgmt_api->reset_stats(dev); -} -#endif /* CONFIG_NET_STATISTICS_WIFI */ - -int z_wpa_supplicant_set_power_save(const struct device *dev, - struct wifi_ps_params *params) -{ - const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_mgmt_api(dev); - - if (!wifi_mgmt_api || !wifi_mgmt_api->set_power_save) { - wpa_printf(MSG_ERROR, "Set power save not supported"); - return -ENOTSUP; - } - - return wifi_mgmt_api->set_power_save(dev, params); -} - -int z_wpa_supplicant_set_twt(const struct device *dev, - struct wifi_twt_params *params) -{ - const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_mgmt_api(dev); - - if (!wifi_mgmt_api || !wifi_mgmt_api->set_twt) { - wpa_printf(MSG_ERROR, "Set TWT not supported"); - return -ENOTSUP; - } - - return wifi_mgmt_api->set_twt(dev, params); -} - -int z_wpa_supplicant_get_power_save_config(const struct device *dev, - struct wifi_ps_config *config) -{ - const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_mgmt_api(dev); - - if (!wifi_mgmt_api || !wifi_mgmt_api->get_power_save_config) { - wpa_printf(MSG_ERROR, "Get power save config not supported"); - return -ENOTSUP; - } - - return wifi_mgmt_api->get_power_save_config(dev, config); -} - -int z_wpa_supplicant_reg_domain(const struct device *dev, - struct wifi_reg_domain *reg_domain) -{ - const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_mgmt_api(dev); - - if (!wifi_mgmt_api || !wifi_mgmt_api->reg_domain) { - wpa_printf(MSG_ERROR, "Regulatory domain not supported"); - return -ENOTSUP; - } - - return wifi_mgmt_api->reg_domain(dev, reg_domain); -} - -int z_wpa_supplicant_mode(const struct device *dev, - struct wifi_mode_info *mode) -{ - const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_mgmt_api(dev); - - if (!wifi_mgmt_api || !wifi_mgmt_api->mode) { - wpa_printf(MSG_ERROR, "Setting mode not supported"); - return -ENOTSUP; - } - - return wifi_mgmt_api->mode(dev, mode); -} - -int z_wpa_supplicant_filter(const struct device *dev, - struct wifi_filter_info *filter) -{ - const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_mgmt_api(dev); - - if (!wifi_mgmt_api || !wifi_mgmt_api->filter) { - wpa_printf(MSG_ERROR, "Setting filter not supported"); - return -ENOTSUP; - } - - return wifi_mgmt_api->filter(dev, filter); -} - -int z_wpa_supplicant_channel(const struct device *dev, - struct wifi_channel_info *channel) -{ - const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_mgmt_api(dev); - - if (!wifi_mgmt_api || !wifi_mgmt_api->channel) { - wpa_printf(MSG_ERROR, "Setting channel not supported"); - return -ENOTSUP; - } - - return wifi_mgmt_api->channel(dev, channel); -} - -int z_wpa_supplicant_set_rts_threshold(const struct device *dev, - unsigned int rts_threshold) -{ - const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_mgmt_api(dev); - - if (!wifi_mgmt_api || !wifi_mgmt_api->set_rts_threshold) { - wpa_printf(MSG_ERROR, "Set RTS not supported"); - return -ENOTSUP; - } - - return wifi_mgmt_api->set_rts_threshold(dev, rts_threshold); -} - -#ifdef CONFIG_AP -int z_wpa_supplicant_ap_enable(const struct device *dev, - struct wifi_connect_req_params *params) -{ - struct wpa_supplicant *wpa_s; - int ret = 0; - - if (!net_if_is_admin_up(net_if_lookup_by_dev(dev))) { - wpa_printf(MSG_ERROR, - "Interface %s is down, dropping connect", - dev->name); - return -1; - } - - k_mutex_lock(&wpa_supplicant_mutex, K_FOREVER); - - wpa_s = get_wpa_s_handle(dev); - if (!wpa_s) { - ret = -1; - wpa_printf(MSG_ERROR, "Interface %s not found", dev->name); - goto out; - } - - if (wpa_s->wpa_state != WPA_DISCONNECTED) { - ret = -EBUSY; - wpa_printf(MSG_ERROR, "Interface %s is not in disconnected state", dev->name); - goto out; - } - - /* No need to check for existing network to join for SoftAP*/ - wpa_s->conf->ap_scan = 2; - /* Set BSS parameter max_num_sta to default configured value */ - wpa_s->conf->max_num_sta = CONFIG_WIFI_MGMT_AP_MAX_NUM_STA; - - ret = wpas_add_and_config_network(wpa_s, params, true); - if (ret) { - wpa_printf(MSG_ERROR, "Failed to add and configure network for AP mode: %d", ret); - goto out; - } - -out: - k_mutex_unlock(&wpa_supplicant_mutex); - - return ret; -} - -int z_wpa_supplicant_ap_disable(const struct device *dev) -{ - struct wpa_supplicant *wpa_s; - int ret = -1; - - k_mutex_lock(&wpa_supplicant_mutex, K_FOREVER); - - wpa_s = get_wpa_s_handle(dev); - if (!wpa_s) { - ret = -1; - wpa_printf(MSG_ERROR, "Interface %s not found", dev->name); - goto out; - } - - ret = wpas_disconnect_network(dev, WPAS_MODE_AP); - if (ret) { - wpa_printf(MSG_ERROR, "Failed to disconnect from network"); - goto out; - } - - /* Restore ap_scan to default value */ - wpa_s->conf->ap_scan = 1; - -out: - k_mutex_unlock(&wpa_supplicant_mutex); - return ret; -} - -int z_wpa_supplicant_ap_sta_disconnect(const struct device *dev, - const uint8_t *mac_addr) -{ - struct wpa_supplicant *wpa_s; - int ret = -1; - - k_mutex_lock(&wpa_supplicant_mutex, K_FOREVER); - - wpa_s = get_wpa_s_handle(dev); - if (!wpa_s) { - ret = -1; - wpa_printf(MSG_ERROR, "Interface %s not found", dev->name); - goto out; - } - - if (!mac_addr) { - ret = -EINVAL; - wpa_printf(MSG_ERROR, "Invalid MAC address"); - goto out; - } - - _wpa_cli_cmd_v("disassociate %02x:%02x:%02x:%02x:%02x:%02x", - mac_addr[0], mac_addr[1], mac_addr[2], - mac_addr[3], mac_addr[4], mac_addr[5]); - -out: - k_mutex_unlock(&wpa_supplicant_mutex); - return ret; -} - -int z_wpa_supplicant_ap_config_params(const struct device *dev, - struct wifi_ap_config_params *params) -{ - struct wpa_supplicant *wpa_s; - int ret = -1; - struct wpa_ssid *ssid = NULL; - - k_mutex_lock(&wpa_supplicant_mutex, K_FOREVER); - - if (!params) { - wpa_printf(MSG_ERROR, "AP config param NULL"); - goto out; - } - - wpa_s = get_wpa_s_handle(dev); - if (!wpa_s) { - wpa_printf(MSG_ERROR, "Interface %s not found", dev->name); - goto out; - } - - ssid = wpa_s->current_ssid; - if (!ssid) { - wpa_printf(MSG_ERROR, "AP is not operational"); - goto out; - } - - if (params->type & WIFI_AP_CONFIG_PARAM_MAX_INACTIVITY) { - _wpa_cli_cmd_v("set_network %d ap_max_inactivity %d", - ssid->id, params->max_inactivity); - } - - if (params->type & WIFI_AP_CONFIG_PARAM_MAX_NUM_STA) { - /* Build time value has higher precedence than runtime configuration value. - * Check if build time value is exceeded. - */ - if (params->max_num_sta > CONFIG_WIFI_MGMT_AP_MAX_NUM_STA) { - ret = -EINVAL; - wpa_printf(MSG_ERROR, "Invalid max_num_sta: %d", - params->max_num_sta); - goto out; - } else { - _wpa_cli_cmd_v("set max_num_sta %d", params->max_num_sta); - ret = 0; - } - } -out: - k_mutex_unlock(&wpa_supplicant_mutex); - - return ret; -} - -#endif /* CONFIG_AP */ diff --git a/modules/hostap/src/supp_api.h b/modules/hostap/src/supp_api.h deleted file mode 100644 index 8646df1906c6..000000000000 --- a/modules/hostap/src/supp_api.h +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - * - */ - -#ifndef ZEPHYR_SUPP_MGMT_H -#define ZEPHYR_SUPP_MGMT_H - -#include - -#define MAX_SSID_LEN 32 -#define MAC_ADDR_LEN 6 -#define MAC_STR_LEN 18 /* for ':' or '-' separated MAC address string */ -#define CHAN_NUM_LEN 6 /* for space-separated channel numbers string */ - -/** - * @brief Request a connection - * - * @param dev: Wi-Fi interface name to use - * @param params: Connection details - * - * @return: 0 for OK; -1 for ERROR - */ -int z_wpa_supplicant_connect(const struct device *dev, - struct wifi_connect_req_params *params); -/** - * @brief Forces station to disconnect and stops any subsequent scan - * or connection attempts - * - * @param dev: Wi-Fi interface name to use - * - * @return: 0 for OK; -1 for ERROR - */ -int z_wpa_supplicant_disconnect(const struct device *dev); - -/** - * @brief - * - * @param dev: Wi-Fi interface name to use - * @param status: Status structure to fill - * - * @return: 0 for OK; -1 for ERROR - */ -int z_wpa_supplicant_status(const struct device *dev, - struct wifi_iface_status *status); - -/** - * @brief Request a scan - * - * @param dev Wi-Fi interface name to use - * @param params Scan parameters - * @param cb Callback to be called for each scan result - * - * @return 0 for OK; -1 for ERROR - */ -int z_wpa_supplicant_scan(const struct device *dev, struct wifi_scan_params *params, - scan_result_cb_t cb); - -#if defined(CONFIG_NET_STATISTICS_WIFI) || defined(__DOXYGEN__) -/** - * @brief Get Wi-Fi statistics - * - * @param dev Wi-Fi interface name to use - * @param stats Pointer to stats structure to fill - * - * @return 0 for OK; -1 for ERROR - */ -int z_wpa_supplicant_get_stats(const struct device *dev, - struct net_stats_wifi *stats); -/** - * @brief Reset Wi-Fi statistics - * - * @param dev Wi-Fi interface name to use - * - * @return 0 for OK; -1 for ERROR - */ -int z_wpa_supplicant_reset_stats(const struct device *dev); -#endif /* CONFIG_NET_STATISTICS_WIFI || __DOXYGEN__ */ - -/** - * @brief Set Wi-Fi power save configuration - * - * @param dev Wi-Fi interface name to use - * @param params Power save parameters to set - * - * @return 0 for OK; -1 for ERROR - */ -int z_wpa_supplicant_set_power_save(const struct device *dev, - struct wifi_ps_params *params); - -/** - * @brief Set Wi-Fi TWT parameters - * - * @param dev Wi-Fi interface name to use - * @param params TWT parameters to set - * @return 0 for OK; -1 for ERROR - */ -int z_wpa_supplicant_set_twt(const struct device *dev, - struct wifi_twt_params *params); - -/** - * @brief Get Wi-Fi power save configuration - * - * @param dev Wi-Fi interface name to use - * @param config Address of power save configuration to fill - * @return 0 for OK; -1 for ERROR - */ -int z_wpa_supplicant_get_power_save_config(const struct device *dev, - struct wifi_ps_config *config); - -/** - * @brief Set Wi-Fi Regulatory domain - * - * @param dev Wi-Fi interface name to use - * @param reg_domain Regulatory domain to set - * @return 0 for OK; -1 for ERROR - */ -int z_wpa_supplicant_reg_domain(const struct device *dev, - struct wifi_reg_domain *reg_domain); - -/** - * @brief Set Wi-Fi mode of operation - * - * @param dev Wi-Fi interface name to use - * @param mode Mode setting to set - * @return 0 for OK; -1 for ERROR - */ -int z_wpa_supplicant_mode(const struct device *dev, - struct wifi_mode_info *mode); - -/** - * @brief Set Wi-Fi packet filter for sniffing operation - * - * @param dev Wi-Fi interface name to use - * @param filter Filter settings to set - * @return 0 for OK; -1 for ERROR - */ -int z_wpa_supplicant_filter(const struct device *dev, - struct wifi_filter_info *filter); - -/** - * @brief Set Wi-Fi channel for monitor or TX injection mode - * - * @param dev Wi-Fi interface name to use - * @param channel Channel settings to set - * @return 0 for OK; -1 for ERROR - */ -int z_wpa_supplicant_channel(const struct device *dev, - struct wifi_channel_info *channel); - -/** - * @brief Set Wi-Fi RTS threshold - * - * @param dev Wi-Fi interface handle to use - * @param rts_threshold RTS threshold to set - * @return 0 for OK; -1 for ERROR - */ -int z_wpa_supplicant_set_rts_threshold(const struct device *dev, - unsigned int rts_threshold); - -#ifdef CONFIG_AP -/** - * @brief Set Wi-Fi AP configuration - * - * @param dev Wi-Fi interface name to use - * @param params AP configuration parameters to set - * @return 0 for OK; -1 for ERROR - */ -int z_wpa_supplicant_ap_enable(const struct device *dev, - struct wifi_connect_req_params *params); - -/** - * @brief Disable Wi-Fi AP - * @param dev Wi-Fi interface name to use - * @return 0 for OK; -1 for ERROR - */ -int z_wpa_supplicant_ap_disable(const struct device *dev); - -/** - * @brief Set Wi-Fi AP STA disconnect - * @param dev Wi-Fi interface name to use - * @param mac_addr MAC address of the station to disconnect - * @return 0 for OK; -1 for ERROR - */ -int z_wpa_supplicant_ap_sta_disconnect(const struct device *dev, - const uint8_t *mac_addr); - -/** - * @brief Set Wi-Fi AP config parameter - * @param dev Wi-Fi interface name to use - * @param params AP parameters to be configured - * @return 0 for OK; -1 for ERROR - */ -int z_wpa_supplicant_ap_config_params(const struct device *dev, - struct wifi_ap_config_params *params); -#endif /* CONFIG_AP */ -#endif /* ZEPHYR_SUPP_MGMT_H */ diff --git a/modules/hostap/src/supp_events.c b/modules/hostap/src/supp_events.c deleted file mode 100644 index 2d6cf896e2f0..000000000000 --- a/modules/hostap/src/supp_events.c +++ /dev/null @@ -1,462 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include "supp_events.h" - -#include "includes.h" -#include "common.h" -#include "common/ieee802_11_defs.h" -#include "wpa_supplicant_i.h" - -#ifdef CONFIG_AP -#include "ap/sta_info.h" -#include "ap/ieee802_11.h" -#include "ap/hostapd.h" -#endif /* CONFIG_AP */ - -#include - -/* Re-defines MAC2STR with address of the element */ -#define MACADDR2STR(a) &(a)[0], &(a)[1], &(a)[2], &(a)[3], &(a)[4], &(a)[5] - -static const struct wpa_supp_event_info { - const char *event_str; - enum supp_event_num event; -} wpa_supp_event_info[] = { - { "CTRL-EVENT-CONNECTED", WPA_SUPP_EVENT_CONNECTED }, - { "CTRL-EVENT-DISCONNECTED", WPA_SUPP_EVENT_DISCONNECTED }, - { "CTRL-EVENT-ASSOC-REJECT", WPA_SUPP_EVENT_ASSOC_REJECT }, - { "CTRL-EVENT-AUTH-REJECT", WPA_SUPP_EVENT_AUTH_REJECT }, - { "CTRL-EVENT-SSID-TEMP-DISABLED", WPA_SUPP_EVENT_SSID_TEMP_DISABLED }, - { "CTRL-EVENT-SSID-REENABLED", WPA_SUPP_EVENT_SSID_REENABLED }, - { "CTRL-EVENT-BSS-ADDED", WPA_SUPP_EVENT_BSS_ADDED }, - { "CTRL-EVENT-BSS-REMOVED", WPA_SUPP_EVENT_BSS_REMOVED }, - { "CTRL-EVENT-TERMINATING", WPA_SUPP_EVENT_TERMINATING }, - { "CTRL-EVENT-SCAN-STARTED", WPA_SUPP_EVENT_SCAN_STARTED }, - { "CTRL-EVENT-SCAN-FAILED", WPA_SUPP_EVENT_SCAN_FAILED }, - { "CTRL-EVENT-NETWORK-NOT-FOUND", WPA_SUPP_EVENT_NETWORK_NOT_FOUND }, - { "CTRL-EVENT-NETWORK-ADDED", WPA_SUPP_EVENT_NETWORK_ADDED }, - { "CTRL-EVENT-NETWORK-REMOVED", WPA_SUPP_EVENT_NETWORK_REMOVED }, - { "CTRL-EVENT-DSCP-POLICY", WPA_SUPP_EVENT_DSCP_POLICY }, -}; - -static void copy_mac_addr(const unsigned int *src, uint8_t *dst) -{ - int i; - - for (i = 0; i < ETH_ALEN; i++) { - dst[i] = src[i]; - } -} - -static enum wifi_conn_status wpas_to_wifi_mgmt_conn_status(int status) -{ - switch (status) { - case WLAN_STATUS_SUCCESS: - return WIFI_STATUS_CONN_SUCCESS; - case WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT: - return WIFI_STATUS_CONN_WRONG_PASSWORD; - /* Handle non-supplicant errors */ - case -ETIMEDOUT: - return WIFI_STATUS_CONN_TIMEOUT; - default: - return WIFI_STATUS_CONN_FAIL; - } -} - -static enum wifi_disconn_reason wpas_to_wifi_mgmt_diconn_status(int status) -{ - switch (status) { - case WLAN_STATUS_SUCCESS: - return WIFI_REASON_DISCONN_SUCCESS; - case WLAN_REASON_DEAUTH_LEAVING: - return WIFI_REASON_DISCONN_AP_LEAVING; - case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY: - return WIFI_REASON_DISCONN_INACTIVITY; - case WLAN_REASON_UNSPECIFIED: - /* fall through */ - default: - return WIFI_REASON_DISCONN_UNSPECIFIED; - } -} - -static int wpa_supp_process_status(struct supp_int_event_data *event_data, char *wpa_supp_status) -{ - int ret = 1; /* For cases where parsing is not being done*/ - int i; - union supp_event_data *data; - unsigned int tmp_mac_addr[ETH_ALEN]; - unsigned int event_prefix_len; - char *event_no_prefix; - struct wpa_supp_event_info event_info; - - data = (union supp_event_data *)event_data->data; - - for (i = 0; i < ARRAY_SIZE(wpa_supp_event_info); i++) { - if (strncmp(wpa_supp_status, wpa_supp_event_info[i].event_str, - strlen(wpa_supp_event_info[i].event_str)) == 0) { - event_info = wpa_supp_event_info[i]; - break; - } - } - - if (i >= ARRAY_SIZE(wpa_supp_event_info)) { - /* This is not a bug but rather implementation gap (intentional or not) */ - wpa_printf(MSG_DEBUG, "Event not supported: %s\n", wpa_supp_status); - return -ENOTSUP; - } - - /* Skip the event prefix and a space */ - event_prefix_len = strlen(event_info.event_str) + 1; - event_no_prefix = wpa_supp_status + event_prefix_len; - event_data->event = event_info.event; - - switch (event_data->event) { - case WPA_SUPP_EVENT_CONNECTED: - ret = sscanf(event_no_prefix, "- Connection to" - MACSTR, MACADDR2STR(tmp_mac_addr)); - event_data->data_len = sizeof(data->connected); - copy_mac_addr(tmp_mac_addr, data->connected.bssid); - break; - case WPA_SUPP_EVENT_DISCONNECTED: - ret = sscanf(event_no_prefix, - MACSTR" reason=%d", MACADDR2STR(tmp_mac_addr), - &data->disconnected.reason_code); - event_data->data_len = sizeof(data->disconnected); - copy_mac_addr(tmp_mac_addr, data->disconnected.bssid); - break; - case WPA_SUPP_EVENT_ASSOC_REJECT: - /* TODO */ - break; - case WPA_SUPP_EVENT_AUTH_REJECT: - ret = sscanf(event_no_prefix, MACSTR - " auth_type=%u auth_transaction=%u status_code=%u", - MACADDR2STR(tmp_mac_addr), - &data->auth_reject.auth_type, - &data->auth_reject.auth_transaction, - &data->auth_reject.status_code); - event_data->data_len = sizeof(data->auth_reject); - copy_mac_addr(tmp_mac_addr, data->auth_reject.bssid); - break; - case WPA_SUPP_EVENT_SSID_TEMP_DISABLED: - ret = sscanf(event_no_prefix, - "id=%d ssid=%s auth_failures=%u duration=%d reason=%s", - &data->temp_disabled.id, data->temp_disabled.ssid, - &data->temp_disabled.auth_failures, - &data->temp_disabled.duration, - data->temp_disabled.reason_code); - event_data->data_len = sizeof(data->temp_disabled); - break; - case WPA_SUPP_EVENT_SSID_REENABLED: - ret = sscanf(event_no_prefix, - "id=%d ssid=%s", &data->reenabled.id, - data->reenabled.ssid); - event_data->data_len = sizeof(data->reenabled); - break; - case WPA_SUPP_EVENT_BSS_ADDED: - ret = sscanf(event_no_prefix, "%u "MACSTR, - &data->bss_added.id, - MACADDR2STR(tmp_mac_addr)); - copy_mac_addr(tmp_mac_addr, data->bss_added.bssid); - event_data->data_len = sizeof(data->bss_added); - break; - case WPA_SUPP_EVENT_BSS_REMOVED: - ret = sscanf(event_no_prefix, - "%u "MACSTR, - &data->bss_removed.id, - MACADDR2STR(tmp_mac_addr)); - event_data->data_len = sizeof(data->bss_removed); - copy_mac_addr(tmp_mac_addr, data->bss_removed.bssid); - break; - case WPA_SUPP_EVENT_TERMINATING: - case WPA_SUPP_EVENT_SCAN_STARTED: - case WPA_SUPP_EVENT_SCAN_FAILED: - case WPA_SUPP_EVENT_NETWORK_NOT_FOUND: - case WPA_SUPP_EVENT_NETWORK_ADDED: - case WPA_SUPP_EVENT_NETWORK_REMOVED: - strncpy(data->supp_event_str, event_info.event_str, - sizeof(data->supp_event_str)-1); - event_data->data_len = strlen(data->supp_event_str) + 1; - case WPA_SUPP_EVENT_DSCP_POLICY: - /* TODO */ - break; - default: - break; - } - - if (ret <= 0) { - wpa_printf(MSG_ERROR, "%s Parse failed: %s", - event_info.event_str, strerror(errno)); - } - - return ret; -} - -#ifdef CONFIG_WPA_SUPP_AP -static int config_ap_param_skip_inactivity_poll(struct wpa_supplicant *wpa_s) -{ - int i; - int ret = -ENOENT; - - if (!wpa_s || !wpa_s->ap_iface || !wpa_s->current_ssid) { - ret = -ENODEV; - goto out; - } - - for (i = 0; i < wpa_s->ap_iface->num_bss; i++) { - struct hostapd_data *hapd = NULL; - struct hostapd_bss_config *bss_conf = NULL; - - hapd = wpa_s->ap_iface->bss[i]; - if (!hapd) { - continue; - } - bss_conf = hapd->conf; - if (!bss_conf) { - continue; - } - - if (os_memcmp(bss_conf->ssid.ssid, - wpa_s->current_ssid->ssid, - wpa_s->current_ssid->ssid_len) != 0) { - continue; - } - - bss_conf->skip_inactivity_poll = - WIFI_MGMT_SKIP_INACTIVITY_POLL; - /* If at least one BSS is found, return success */ - ret = 0; - } -out: - - return ret; -} -#endif - -int send_wifi_mgmt_conn_event(void *ctx, int status_code) -{ - struct wpa_supplicant *wpa_s = ctx; - int status = wpas_to_wifi_mgmt_conn_status(status_code); - enum net_event_wifi_cmd event; -#ifdef CONFIG_WPA_SUPP_AP - int err = -1; -#endif - - if (!wpa_s || !wpa_s->current_ssid) { - return -EINVAL; - } - - if (wpa_s->current_ssid->mode == WPAS_MODE_AP) { - event = NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT; -#ifdef CONFIG_WPA_SUPP_AP - if (status == WLAN_STATUS_SUCCESS) { - err = config_ap_param_skip_inactivity_poll(wpa_s); - if (err) { - wpa_printf(MSG_WARNING, - "Unable to configure skip_inactivity_poll parameter " - "err: %s", strerror(-err)); - } - } -#endif - } else { - event = NET_EVENT_WIFI_CMD_CONNECT_RESULT; - } - - return send_wifi_mgmt_event(wpa_s->ifname, - event, - (void *)&status, - sizeof(int)); -} - -int send_wifi_mgmt_disc_event(void *ctx, int reason_code) -{ - struct wpa_supplicant *wpa_s = ctx; - int status = wpas_to_wifi_mgmt_diconn_status(reason_code); - enum net_event_wifi_cmd event; - - if (!wpa_s || !wpa_s->current_ssid) { - return -EINVAL; - } - - if (wpa_s->wpa_state >= WPA_COMPLETED) { - if (wpa_s->current_ssid->mode == WPAS_MODE_AP) { - event = NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT; - } else { - event = NET_EVENT_WIFI_CMD_DISCONNECT_RESULT; - } - } else { - if (wpa_s->current_ssid->mode == WPAS_MODE_AP) { - event = NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT; - } else { - event = NET_EVENT_WIFI_CMD_CONNECT_RESULT; - } - } - - return send_wifi_mgmt_event(wpa_s->ifname, - event, - (void *)&status, - sizeof(int)); -} - -#ifdef CONFIG_AP - -static enum wifi_link_mode get_sta_link_mode(struct wpa_supplicant *wpa_s, struct sta_info *sta) -{ - if (sta->flags & WLAN_STA_HE) { - return WIFI_6; - } else if (sta->flags & WLAN_STA_VHT) { - return WIFI_5; - } else if (sta->flags & WLAN_STA_HT) { - return WIFI_4; - } else if (sta->flags & WLAN_STA_NONERP) { - return WIFI_1; - } else if (wpa_s->assoc_freq > 4000) { - return WIFI_2; - } else if (wpa_s->assoc_freq > 2000) { - return WIFI_3; - } else { - return WIFI_LINK_MODE_UNKNOWN; - } -} - -static bool is_twt_capable(struct wpa_supplicant *wpa_s, struct sta_info *sta) -{ - return hostapd_get_he_twt_responder(wpa_s->ap_iface->bss[0], IEEE80211_MODE_AP); -} - -int send_wifi_mgmt_ap_status(void *ctx, - enum net_event_wifi_cmd event, enum wifi_ap_status ap_status) -{ - struct wpa_supplicant *wpa_s = ctx; - int status = ap_status; - - return send_wifi_mgmt_event(wpa_s->ifname, - event, - (void *)&status, - sizeof(int)); -} - -int send_wifi_mgmt_ap_sta_event(void *ctx, - enum net_event_wifi_cmd event, void *data) -{ - struct sta_info *sta = data; - struct wpa_supplicant *wpa_s = ctx; - struct wifi_ap_sta_info sta_info = { 0 }; - - if (!wpa_s || !sta) { - return -EINVAL; - } - - memcpy(sta_info.mac, sta->addr, sizeof(sta_info.mac)); - - if (event == NET_EVENT_WIFI_CMD_AP_STA_CONNECTED) { - sta_info.link_mode = get_sta_link_mode(wpa_s, sta); - sta_info.twt_capable = is_twt_capable(wpa_s, sta); - } - - return send_wifi_mgmt_event(wpa_s->ifname, - event, - (void *)&sta_info, - sizeof(sta_info)); -} -#endif /* CONFIG_AP */ - -int send_wifi_mgmt_event(const char *ifname, enum net_event_wifi_cmd event, - void *wpa_supp_status, size_t len) -{ - const struct device *dev = device_get_binding(ifname); - struct net_if *iface = net_if_lookup_by_dev(dev); - union supp_event_data data; - struct supp_int_event_data event_data; - - if (!iface) { - wpa_printf(MSG_ERROR, "Could not find iface for %s", ifname); - return -ENODEV; - } - - switch (event) { - case NET_EVENT_WIFI_CMD_CONNECT_RESULT: - wifi_mgmt_raise_connect_result_event(iface, - *(int *)wpa_supp_status); - break; - case NET_EVENT_WIFI_CMD_DISCONNECT_RESULT: - wifi_mgmt_raise_disconnect_result_event(iface, - *(int *)wpa_supp_status); - break; -#ifdef CONFIG_AP - case NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT: - wifi_mgmt_raise_ap_enable_result_event(iface, - *(int *)wpa_supp_status); - break; - case NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT: - wifi_mgmt_raise_ap_disable_result_event(iface, - *(int *)wpa_supp_status); - break; - case NET_EVENT_WIFI_CMD_AP_STA_CONNECTED: - wifi_mgmt_raise_ap_sta_connected_event(iface, - (struct wifi_ap_sta_info *)wpa_supp_status); - break; - case NET_EVENT_WIFI_CMD_AP_STA_DISCONNECTED: - wifi_mgmt_raise_ap_sta_disconnected_event(iface, - (struct wifi_ap_sta_info *)wpa_supp_status); - break; -#endif /* CONFIG_AP */ - case NET_EVENT_WPA_SUPP_CMD_INT_EVENT: - event_data.data = &data; - if (wpa_supp_process_status(&event_data, (char *)wpa_supp_status) > 0) { - net_mgmt_event_notify_with_info(NET_EVENT_WPA_SUPP_INT_EVENT, - iface, &event_data, sizeof(event_data)); - } - break; - default: - wpa_printf(MSG_ERROR, "Unsupported event %d", event); - return -EINVAL; - } - - return 0; -} - -int generate_supp_state_event(const char *ifname, enum net_event_wpa_supp_cmd event, int status) -{ - /* TODO: Replace device_get_binding. */ - const struct device *dev = device_get_binding(ifname); - - if (!dev) { - wpa_printf(MSG_ERROR, "Could not find device for %s", ifname); - return -ENODEV; - } - - struct net_if *iface = net_if_lookup_by_dev(dev); - - if (!iface) { - wpa_printf(MSG_ERROR, "Could not find iface for %s", ifname); - return -ENODEV; - } - - switch (event) { - case NET_EVENT_WPA_SUPP_CMD_READY: - net_mgmt_event_notify(NET_EVENT_WPA_SUPP_READY, iface); - break; - case NET_EVENT_WPA_SUPP_CMD_NOT_READY: - net_mgmt_event_notify(NET_EVENT_WPA_SUPP_NOT_READY, iface); - break; - case NET_EVENT_WPA_SUPP_CMD_IFACE_ADDED: - net_mgmt_event_notify(NET_EVENT_WPA_SUPP_IFACE_ADDED, iface); - break; - case NET_EVENT_WPA_SUPP_CMD_IFACE_REMOVING: - net_mgmt_event_notify(NET_EVENT_WPA_SUPP_IFACE_REMOVING, iface); - break; - case NET_EVENT_WPA_SUPP_CMD_IFACE_REMOVED: - net_mgmt_event_notify_with_info(NET_EVENT_WPA_SUPP_IFACE_REMOVED, - iface, &status, sizeof(status)); - break; - default: - wpa_printf(MSG_ERROR, "Unsupported event %d", event); - return -EINVAL; - } - - return 0; -} diff --git a/modules/hostap/src/supp_events.h b/modules/hostap/src/supp_events.h deleted file mode 100644 index da090a3a931b..000000000000 --- a/modules/hostap/src/supp_events.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#ifndef __SUPP_EVENTS_H__ -#define __SUPP_EVENTS_H__ - -#include - -/* Connectivity Events */ -#define _NET_MGMT_WPA_SUPP_LAYER NET_MGMT_LAYER_L2 -#define _NET_MGMT_WPA_SUPP_CODE 0x157 -#define _NET_MGMT_WPA_SUPP_BASE (NET_MGMT_LAYER(_NET_MGMT_WPA_SUPP_LAYER) | \ - NET_MGMT_LAYER_CODE(_NET_MGMT_WPA_SUPP_CODE) | \ - NET_MGMT_IFACE_BIT) -#define _NET_MGMT_WPA_SUPP_EVENT (NET_MGMT_EVENT_BIT | _NET_MGMT_WPA_SUPP_BASE) - -enum net_event_wpa_supp_cmd { - NET_EVENT_WPA_SUPP_CMD_READY = 1, - NET_EVENT_WPA_SUPP_CMD_NOT_READY, - NET_EVENT_WPA_SUPP_CMD_IFACE_ADDED, - NET_EVENT_WPA_SUPP_CMD_IFACE_REMOVING, - NET_EVENT_WPA_SUPP_CMD_IFACE_REMOVED, - NET_EVENT_WPA_SUPP_CMD_INT_EVENT, - NET_EVENT_WPA_SUPP_CMD_MAX -}; - -#define NET_EVENT_WPA_SUPP_READY \ - (_NET_MGMT_WPA_SUPP_EVENT | NET_EVENT_WPA_SUPP_CMD_READY) - -#define NET_EVENT_WPA_SUPP_NOT_READY \ - (_NET_MGMT_WPA_SUPP_EVENT | NET_EVENT_WPA_SUPP_CMD_NOT_READY) - -#define NET_EVENT_WPA_SUPP_IFACE_ADDED \ - (_NET_MGMT_WPA_SUPP_EVENT | NET_EVENT_WPA_SUPP_CMD_IFACE_ADDED) - -#define NET_EVENT_WPA_SUPP_IFACE_REMOVED \ - (_NET_MGMT_WPA_SUPP_EVENT | NET_EVENT_WPA_SUPP_CMD_IFACE_REMOVED) - -#define NET_EVENT_WPA_SUPP_IFACE_REMOVING \ - (_NET_MGMT_WPA_SUPP_EVENT | NET_EVENT_WPA_SUPP_CMD_IFACE_REMOVING) - -#define NET_EVENT_WPA_SUPP_INT_EVENT \ - (_NET_MGMT_WPA_SUPP_EVENT | NET_EVENT_WPA_SUPP_CMD_INT_EVENT) - -int send_wifi_mgmt_conn_event(void *ctx, int status_code); -int send_wifi_mgmt_disc_event(void *ctx, int reason_code); -int send_wifi_mgmt_event(const char *ifname, enum net_event_wifi_cmd event, void *status, - size_t len); -int generate_supp_state_event(const char *ifname, enum net_event_wpa_supp_cmd event, int status); -#ifdef CONFIG_AP -int send_wifi_mgmt_ap_status(void *ctx, - enum net_event_wifi_cmd event, enum wifi_ap_status); -int send_wifi_mgmt_ap_sta_event(void *ctx, - enum net_event_wifi_cmd event, void *data); -#endif /* CONFIG_AP */ - -#define REASON_CODE_LEN 18 -#define NM_WIFI_EVENT_STR_LEN 64 -#define ETH_ALEN 6 - -union supp_event_data { - struct supp_event_auth_reject { - int auth_type; - int auth_transaction; - int status_code; - uint8_t bssid[ETH_ALEN]; - } auth_reject; - - struct supp_event_connected { - uint8_t bssid[ETH_ALEN]; - char ssid[WIFI_SSID_MAX_LEN]; - int id; - } connected; - - struct supp_event_disconnected { - uint8_t bssid[ETH_ALEN]; - int reason_code; - int locally_generated; - } disconnected; - - struct supp_event_assoc_reject { - int status_code; - int reason_code; - } assoc_reject; - - struct supp_event_temp_disabled { - int id; - char ssid[WIFI_SSID_MAX_LEN]; - unsigned int auth_failures; - unsigned int duration; - char reason_code[REASON_CODE_LEN]; - } temp_disabled; - - struct supp_event_reenabled { - int id; - char ssid[WIFI_SSID_MAX_LEN]; - } reenabled; - - struct supp_event_bss_added { - unsigned int id; - uint8_t bssid[ETH_ALEN]; - } bss_added; - - struct supp_event_bss_removed { - unsigned int id; - uint8_t bssid[ETH_ALEN]; - } bss_removed; - - struct supp_event_network_added { - unsigned int id; - } network_added; - - struct supp_event_network_removed { - unsigned int id; - } network_removed; - - char supp_event_str[NM_WIFI_EVENT_STR_LEN]; -}; - -enum supp_event_num { - WPA_SUPP_EVENT_CONNECTED, - WPA_SUPP_EVENT_DISCONNECTED, - WPA_SUPP_EVENT_ASSOC_REJECT, - WPA_SUPP_EVENT_AUTH_REJECT, - WPA_SUPP_EVENT_TERMINATING, - WPA_SUPP_EVENT_SSID_TEMP_DISABLED, - WPA_SUPP_EVENT_SSID_REENABLED, - WPA_SUPP_EVENT_SCAN_STARTED, - WPA_SUPP_EVENT_SCAN_RESULTS, - WPA_SUPP_EVENT_SCAN_FAILED, - WPA_SUPP_EVENT_BSS_ADDED, - WPA_SUPP_EVENT_BSS_REMOVED, - WPA_SUPP_EVENT_NETWORK_NOT_FOUND, - WPA_SUPP_EVENT_NETWORK_ADDED, - WPA_SUPP_EVENT_NETWORK_REMOVED, - WPA_SUPP_EVENT_DSCP_POLICY, -}; - - - -struct supp_int_event_data { - enum supp_event_num event; - void *data; - size_t data_len; -}; - -#endif /* __SUPP_EVENTS_H__ */ diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c deleted file mode 100644 index 11397fe94ec9..000000000000 --- a/modules/hostap/src/supp_main.c +++ /dev/null @@ -1,640 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/* - * WPA Supplicant / main() function for Zephyr OS - * Copyright (c) 2003-2013, Jouni Malinen - * - * This software may be distributed under the terms of the BSD license. - * See README for more details. - */ - -#include -#include -LOG_MODULE_REGISTER(wpa_supplicant, LOG_LEVEL_DBG); - -#if defined(CONFIG_MBEDTLS_PLATFORM_C) && \ - !defined(CONFIG_WPA_SUPP_CRYPTO_NONE) && \ - !defined(CONFIG_MBEDTLS_ENABLE_HEAP) -#include -#endif /* !CONFIG_WPA_SUPP_CRYPTO_NONE && !CONFIG_MBEDTLS_ENABLE_HEAP */ - -#include - -#include "includes.h" -#include "common.h" -#include "eloop.h" -#include "wpa_supplicant/config.h" -#include "wpa_supplicant_i.h" - -#include "fst/fst.h" -#include "includes.h" -#include "p2p_supplicant.h" -#include "driver_i.h" - -#include "supp_main.h" -#include "supp_events.h" -#include "wpa_cli_zephyr.h" - -#include "supp_api.h" - -K_SEM_DEFINE(z_wpas_ready_sem, 0, 1); -#include - -static struct net_mgmt_event_callback cb; -struct k_mutex iface_up_mutex; - -struct wpa_global *global; - -static int z_wpas_event_sockpair[2]; - -static void z_wpas_start(void); -static void z_wpas_iface_work_handler(struct k_work *item); - -static K_THREAD_STACK_DEFINE(z_wpa_s_thread_stack, - CONFIG_WPA_SUPP_THREAD_STACK_SIZE); -static struct k_thread z_wpa_s_tid; - -static K_THREAD_STACK_DEFINE(z_wpas_wq_stack, - CONFIG_WPA_SUPP_WQ_STACK_SIZE); - -/* TODO: Debug why using system workqueue blocks the driver dedicated - * workqueue? - */ -struct k_work_q z_wpas_wq; -static K_WORK_DEFINE(z_wpas_iface_work, - z_wpas_iface_work_handler); - -K_MUTEX_DEFINE(z_wpas_event_mutex); - -static const struct wifi_mgmt_ops wpa_supp_ops = { - .scan = z_wpa_supplicant_scan, - .connect = z_wpa_supplicant_connect, - .disconnect = z_wpa_supplicant_disconnect, - .iface_status = z_wpa_supplicant_status, -#ifdef CONFIG_NET_STATISTICS_WIFI - .get_stats = z_wpa_supplicant_get_stats, - .reset_stats = z_wpa_supplicant_reset_stats, -#endif - .set_power_save = z_wpa_supplicant_set_power_save, - .set_twt = z_wpa_supplicant_set_twt, - .get_power_save_config = z_wpa_supplicant_get_power_save_config, - .reg_domain = z_wpa_supplicant_reg_domain, - .mode = z_wpa_supplicant_mode, - .filter = z_wpa_supplicant_filter, - .channel = z_wpa_supplicant_channel, - .set_rts_threshold = z_wpa_supplicant_set_rts_threshold, -#ifdef CONFIG_AP - .ap_enable = z_wpa_supplicant_ap_enable, - .ap_disable = z_wpa_supplicant_ap_disable, - .ap_sta_disconnect = z_wpa_supplicant_ap_sta_disconnect, - .ap_config_params = z_wpa_supplicant_ap_config_params, -#endif /* CONFIG_AP */ -}; - -DEFINE_WIFI_NM_INSTANCE(wpa_supplicant, &wpa_supp_ops); - -#ifdef CONFIG_MATCH_IFACE -static int z_wpas_init_match(struct wpa_global *global) -{ - /* - * The assumption is that the first driver is the primary driver and - * will handle the arrival / departure of interfaces. - */ - if (wpa_drivers[0]->global_init && !global->drv_priv[0]) { - global->drv_priv[0] = wpa_drivers[0]->global_init(global); - if (!global->drv_priv[0]) { - wpa_printf(MSG_ERROR, - "Failed to initialize driver '%s'", - wpa_drivers[0]->name); - return -1; - } - } - - return 0; -} -#endif /* CONFIG_MATCH_IFACE */ - -struct wpa_supplicant *z_wpas_get_handle_by_ifname(const char *ifname) -{ - struct wpa_supplicant *wpa_s = NULL; - int ret = k_sem_take(&z_wpas_ready_sem, K_SECONDS(2)); - - if (ret) { - wpa_printf(MSG_ERROR, "%s: WPA supplicant not ready: %d", __func__, ret); - return NULL; - } - - k_sem_give(&z_wpas_ready_sem); - - wpa_s = wpa_supplicant_get_iface(global, ifname); - if (!wpa_s) { - wpa_printf(MSG_ERROR, - "%s: Unable to get wpa_s handle for %s\n", __func__, ifname); - return NULL; - } - - return wpa_s; -} - -static int z_wpas_get_iface_count(void) -{ - struct wpa_supplicant *wpa_s; - unsigned int count = 0; - - for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) { - count += 1; - } - return count; -} - -#define Z_WPA_S_IFACE_NOTIFY_TIMEOUT_MS 1000 -#define Z_WPA_S_IFACE_NOTIFY_RETRY_MS 10 - -static int z_wpas_add_interface(const char *ifname) -{ - struct wpa_supplicant *wpa_s; - struct net_if *iface; - int ret = -1; - int retry = 0, count = Z_WPA_S_IFACE_NOTIFY_TIMEOUT_MS / Z_WPA_S_IFACE_NOTIFY_RETRY_MS; - - wpa_printf(MSG_DEBUG, "Adding interface %s\n", ifname); - - iface = net_if_lookup_by_dev(device_get_binding(ifname)); - if (!iface) { - wpa_printf(MSG_ERROR, "Failed to get net_if handle for %s", ifname); - goto err; - } - - ret = z_wpa_cli_global_cmd_v("interface_add %s %s %s %s", - ifname, "zephyr", "zephyr", "zephyr"); - if (ret) { - wpa_printf(MSG_ERROR, "Failed to add interface: %s", ifname); - goto err; - } - - /* This cannot be through control interface as need the handle */ - while (retry++ < count && !wpa_supplicant_get_iface(global, ifname)) { - k_sleep(K_MSEC(Z_WPA_S_IFACE_NOTIFY_RETRY_MS)); - } - - wpa_s = wpa_supplicant_get_iface(global, ifname); - if (wpa_s == NULL) { - wpa_printf(MSG_ERROR, "Failed to add iface: %s", ifname); - goto err; - } - - wpa_s->conf->filter_ssids = 1; - wpa_s->conf->ap_scan = 1; - wpa_s->conf->sae_pwe = 2; - - /* Default interface, kick start wpa_supplicant */ - if (z_wpas_get_iface_count() == 1) { - k_mutex_unlock(&iface_up_mutex); - } - - ret = z_wpa_ctrl_init(wpa_s); - if (ret) { - wpa_printf(MSG_ERROR, "Failed to initialize control interface"); - goto err; - } - - ret = wifi_nm_register_mgd_iface(wifi_nm_get_instance("wpa_supplicant"), iface); - - if (ret) { - wpa_printf(MSG_ERROR, "Failed to register mgd iface with native stack: %s (%d)", - ifname, ret); - goto err; - } - - generate_supp_state_event(ifname, NET_EVENT_WPA_SUPP_CMD_IFACE_ADDED, 0); - - if (z_wpas_get_iface_count() == 1) { - generate_supp_state_event(ifname, NET_EVENT_WPA_SUPP_CMD_READY, 0); - } - - return 0; -err: - return ret; -} - -static int z_wpas_remove_interface(const char *ifname) -{ - int ret = -1; - union wpa_event_data *event = os_zalloc(sizeof(*event)); - struct wpa_supplicant *wpa_s = wpa_supplicant_get_iface(global, ifname); - struct net_if *iface = net_if_lookup_by_dev(device_get_binding(ifname)); - - int retry = 0, count = Z_WPA_S_IFACE_NOTIFY_TIMEOUT_MS / Z_WPA_S_IFACE_NOTIFY_RETRY_MS; - - if (!event) { - wpa_printf(MSG_ERROR, "Failed to allocate event data"); - goto err; - } - - if (!wpa_s) { - wpa_printf(MSG_ERROR, "Failed to get wpa_s handle for %s", ifname); - goto err; - } - - if (!iface) { - wpa_printf(MSG_ERROR, "Failed to get net_if handle for %s", ifname); - goto err; - } - - generate_supp_state_event(ifname, NET_EVENT_WPA_SUPP_CMD_IFACE_REMOVING, 0); - wpa_printf(MSG_DEBUG, "Remove interface %s\n", ifname); - - if (sizeof(event->interface_status.ifname) < strlen(ifname)) { - wpa_printf(MSG_ERROR, "Interface name too long: %s (max: %d)", - ifname, sizeof(event->interface_status.ifname)); - goto err; - } - - os_memcpy(event->interface_status.ifname, ifname, strlen(ifname)); - event->interface_status.ievent = EVENT_INTERFACE_REMOVED; - - struct wpa_supplicant_event_msg msg = { - .global = true, - .ctx = global, - .event = EVENT_INTERFACE_STATUS, - .data = event, - }; - - ret = z_wpas_send_event(&msg); - if (ret) { - wpa_printf(MSG_ERROR, "Failed to send event: %d", ret); - goto err; - } - - while (retry++ < count && - wpa_s->wpa_state != WPA_INTERFACE_DISABLED) { - k_sleep(K_MSEC(Z_WPA_S_IFACE_NOTIFY_RETRY_MS)); - } - - if (wpa_s->wpa_state != WPA_INTERFACE_DISABLED) { - wpa_printf(MSG_ERROR, "Failed to notify remove interface: %s", ifname); - generate_supp_state_event(ifname, NET_EVENT_WPA_SUPP_CMD_IFACE_REMOVED, - -1); - goto err; - } - - z_wpa_ctrl_deinit(wpa_s); - - ret = z_wpa_cli_global_cmd_v("interface_remove %s", ifname); - if (ret) { - wpa_printf(MSG_ERROR, "Failed to remove interface: %s", ifname); - generate_supp_state_event(ifname, NET_EVENT_WPA_SUPP_CMD_IFACE_REMOVED, - -EINVAL); - goto err; - } - - ret = wifi_nm_unregister_mgd_iface(wifi_nm_get_instance("wpa_supplicant"), iface); - if (ret) { - wpa_printf(MSG_ERROR, "Failed to unregister mgd iface with native stack: %s (%d)", - ifname, ret); - goto err; - } - - - if (z_wpas_get_iface_count() == 0) { - generate_supp_state_event(ifname, NET_EVENT_WPA_SUPP_CMD_NOT_READY, 0); - } - - generate_supp_state_event(ifname, NET_EVENT_WPA_SUPP_CMD_IFACE_REMOVED, 0); - - return 0; -err: - if (event) { - os_free(event); - } - return ret; -} - -static void iface_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) -{ - const char *ifname = iface->if_dev->dev->name; - char *prefix; - char mgd_if_prefix[] = CONFIG_WPA_SUPP_MGD_IFACES_PREFIXES; - bool found = false; - - if (sizeof(mgd_if_prefix) > 0) { - prefix = strtok(mgd_if_prefix, ","); - - while (prefix) { - if (strncmp(ifname, prefix, strlen(prefix)) == 0) { - found = true; - break; - } - prefix = strtok(NULL, ","); - } - - if (!found) { - wpa_printf(MSG_DEBUG, "No matching prefix found for %s", ifname); - return; - } - } - - wpa_printf(MSG_DEBUG, "Event: %d", mgmt_event); - if (mgmt_event == NET_EVENT_IF_ADMIN_UP) { - z_wpas_add_interface(ifname); - } else if (mgmt_event == NET_EVENT_IF_ADMIN_DOWN) { - z_wpas_remove_interface(ifname); - } -} - -static void register_iface_events(void) -{ - k_mutex_init(&iface_up_mutex); - - k_mutex_lock(&iface_up_mutex, K_FOREVER); - net_mgmt_init_event_callback(&cb, iface_event_handler, - NET_EVENT_IF_ADMIN_UP | NET_EVENT_IF_ADMIN_DOWN); - net_mgmt_add_event_callback(&cb); -} - -static void wait_for_interface_up(const char *iface_name) -{ - if (z_wpas_get_iface_count() == 0) { - k_mutex_lock(&iface_up_mutex, K_FOREVER); - } -} - -#include "config.h" -static void iface_cb(struct net_if *iface, void *user_data) -{ - const char *ifname = iface->if_dev->dev->name; - const struct device *wifi_dev = NULL; - - wifi_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_wifi)); - if (!wifi_dev) { - wpa_printf(MSG_ERROR, "Device instance not found"); - return; - } - - if (ifname == NULL) { - return; - } - - if (strncmp(ifname, wifi_dev->name, strlen(ifname)) != 0) { - return; - } - - /* Check default interface */ - if (net_if_is_admin_up(iface)) { - z_wpas_add_interface(ifname); - } - - register_iface_events(); -} - - -static void z_wpas_iface_work_handler(struct k_work *item) -{ - ARG_UNUSED(item); - const struct device *wifi_dev = NULL; - - wifi_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_wifi)); - if (!wifi_dev) { - wpa_printf(MSG_ERROR, "Device instance not found"); - return; - } - - int ret = k_sem_take(&z_wpas_ready_sem, K_SECONDS(5)); - - if (ret) { - wpa_printf(MSG_ERROR, "Timed out waiting for wpa_supplicant"); - return; - } - - net_if_foreach(iface_cb, NULL); - wait_for_interface_up(wifi_dev->name); - - k_sem_give(&z_wpas_ready_sem); -} - -static void z_wpas_event_sock_handler(int sock, void *eloop_ctx, void *sock_ctx) -{ - int ret; - - ARG_UNUSED(eloop_ctx); - ARG_UNUSED(sock_ctx); - struct wpa_supplicant_event_msg msg; - - ret = recv(sock, &msg, sizeof(msg), 0); - - if (ret < 0) { - wpa_printf(MSG_ERROR, "Failed to recv the message: %s", strerror(errno)); - return; - } - - if (ret != sizeof(msg)) { - wpa_printf(MSG_ERROR, "Received incomplete message: got: %d, expected:%d", - ret, sizeof(msg)); - return; - } - - wpa_printf(MSG_DEBUG, "Passing message %d to wpa_supplicant", msg.event); - - if (msg.global) { - wpa_supplicant_event_global(msg.ctx, msg.event, msg.data); - } else { - wpa_supplicant_event(msg.ctx, msg.event, msg.data); - } - - if (msg.data) { - union wpa_event_data *data = msg.data; - - /* Free up deep copied data */ - if (msg.event == EVENT_AUTH) { - os_free((char *)data->auth.ies); - } else if (msg.event == EVENT_RX_MGMT) { - os_free((char *)data->rx_mgmt.frame); - } else if (msg.event == EVENT_TX_STATUS) { - os_free((char *)data->tx_status.data); - } else if (msg.event == EVENT_ASSOC) { - os_free((char *)data->assoc_info.addr); - os_free((char *)data->assoc_info.req_ies); - os_free((char *)data->assoc_info.resp_ies); - os_free((char *)data->assoc_info.resp_frame); - } else if (msg.event == EVENT_ASSOC_REJECT) { - os_free((char *)data->assoc_reject.bssid); - os_free((char *)data->assoc_reject.resp_ies); - } else if (msg.event == EVENT_DEAUTH) { - os_free((char *)data->deauth_info.addr); - os_free((char *)data->deauth_info.ie); - } else if (msg.event == EVENT_DISASSOC) { - os_free((char *)data->disassoc_info.addr); - os_free((char *)data->disassoc_info.ie); - } else if (msg.event == EVENT_UNPROT_DEAUTH) { - os_free((char *)data->unprot_deauth.sa); - os_free((char *)data->unprot_deauth.da); - } else if (msg.event == EVENT_UNPROT_DISASSOC) { - os_free((char *)data->unprot_disassoc.sa); - os_free((char *)data->unprot_disassoc.da); - } - os_free(msg.data); - } -} - -static int register_wpa_event_sock(void) -{ - int ret; - - ret = socketpair(AF_UNIX, SOCK_STREAM, 0, z_wpas_event_sockpair); - - if (ret != 0) { - wpa_printf(MSG_ERROR, "Failed to initialize socket: %s", strerror(errno)); - return -1; - } - - eloop_register_read_sock(z_wpas_event_sockpair[0], z_wpas_event_sock_handler, NULL, NULL); - - return 0; -} - -int z_wpas_send_event(const struct wpa_supplicant_event_msg *msg) -{ - int ret = -1; - unsigned int retry = 0; - - k_mutex_lock(&z_wpas_event_mutex, K_FOREVER); - - if (z_wpas_event_sockpair[1] < 0) { - goto err; - } - -retry_send: - ret = send(z_wpas_event_sockpair[1], msg, sizeof(*msg), 0); - if (ret < 0) { - if (errno == EINTR || errno == EAGAIN || errno == EBUSY || errno == EWOULDBLOCK) { - k_msleep(2); - if (retry++ < 3) { - goto retry_send; - } else { - wpa_printf(MSG_WARNING, "Event send fail (max retries): %s", - strerror(errno)); - goto err; - } - } else { - wpa_printf(MSG_WARNING, "Event send fail: %s", - strerror(errno)); - goto err; - } - } - - ret = 0; -err: - k_mutex_unlock(&z_wpas_event_mutex); - return ret; -} - -static void z_wpas_start(void) -{ - struct wpa_params params; - int exitcode = -1; - const struct device *wifi_dev = NULL; - - wifi_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_wifi)); - if (!wifi_dev) { - wpa_printf(MSG_ERROR, "Device instance not found"); - return; - } - -#if defined(CONFIG_MBEDTLS_PLATFORM_C) && \ - !defined(CONFIG_WPA_SUPP_CRYPTO_NONE) && \ - !defined(CONFIG_MBEDTLS_ENABLE_HEAP) - /* Needed for crypto operation as default is no-op and fails */ - mbedtls_platform_set_calloc_free(calloc, free); -#endif /* !CONFIG_WPA_SUPP_CRYPTO_NONE && !CONFIG_MBEDTLS_ENABLE_HEAP */ - - k_work_queue_init(&z_wpas_wq); - - k_work_queue_start(&z_wpas_wq, - z_wpas_wq_stack, - K_THREAD_STACK_SIZEOF(z_wpas_wq_stack), - CONFIG_WPA_SUPP_WQ_PRIORITY, - NULL); - - k_thread_name_set(&z_wpas_wq.thread, "wpa_supplicant_wq"); - - os_memset(¶ms, 0, sizeof(params)); - params.wpa_debug_level = CONFIG_WPA_SUPP_DEBUG_LEVEL; - - exitcode = 0; - global = wpa_supplicant_init(¶ms); - if (global == NULL) { - wpa_printf(MSG_ERROR, "Failed to initialize wpa_supplicant"); - exitcode = -1; - goto out; - } else { - wpa_printf(MSG_INFO, "Successfully initialized " - "wpa_supplicant"); - } - - if (fst_global_init()) { - wpa_printf(MSG_ERROR, "Failed to initialize FST"); - exitcode = -1; - goto out; - } - -#if defined(CONFIG_FST) && defined(CONFIG_CTRL_IFACE) - if (!fst_global_add_ctrl(fst_ctrl_cli)) { - wpa_printf(MSG_WARNING, "Failed to add CLI FST ctrl"); - } -#endif - z_global_wpa_ctrl_init(); - - register_wpa_event_sock(); - - k_work_submit_to_queue(&z_wpas_wq, &z_wpas_iface_work); - -#ifdef CONFIG_MATCH_IFACE - if (exitcode == 0) { - exitcode = z_wpas_init_match(global); - } -#endif /* CONFIG_MATCH_IFACE */ - - if (exitcode == 0) { - k_sem_give(&z_wpas_ready_sem); - exitcode = wpa_supplicant_run(global); - } - - generate_supp_state_event(wifi_dev->name, NET_EVENT_WPA_SUPP_CMD_NOT_READY, 0); - eloop_unregister_read_sock(z_wpas_event_sockpair[0]); - - z_global_wpa_ctrl_deinit(); - wpa_supplicant_deinit(global); - - fst_global_deinit(); - - close(z_wpas_event_sockpair[0]); - close(z_wpas_event_sockpair[1]); - -out: -#ifdef CONFIG_MATCH_IFACE - os_free(params.match_ifaces); -#endif /* CONFIG_MATCH_IFACE */ - os_free(params.pid_file); - - wpa_printf(MSG_INFO, "z_wpas_start: exitcode %d", exitcode); -} - -static int z_wpas_init(void) -{ - k_thread_create(&z_wpa_s_tid, z_wpa_s_thread_stack, - CONFIG_WPA_SUPP_THREAD_STACK_SIZE, - (k_thread_entry_t)z_wpas_start, - NULL, NULL, NULL, - 0, 0, K_NO_WAIT); - - k_thread_name_set(&z_wpa_s_tid, "wpa_supplicant_main"); - - return 0; -} - -SYS_INIT(z_wpas_init, APPLICATION, 0); diff --git a/modules/hostap/src/supp_main.h b/modules/hostap/src/supp_main.h deleted file mode 100644 index de71f86bd2be..000000000000 --- a/modules/hostap/src/supp_main.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#ifndef __SUPP_MAIN_H_ -#define __SUPP_MAIN_H_ - -#include "wpa_supplicant_i.h" - -struct wpa_supplicant *z_wpas_get_handle_by_ifname(const char *ifname); -struct wpa_supplicant_event_msg { - bool global; - void *ctx; - unsigned int event; - void *data; -}; -int z_wpas_send_event(const struct wpa_supplicant_event_msg *msg); -extern struct k_work_q z_wpas_wq; -#endif /* __SUPP_MAIN_H_ */ diff --git a/modules/hostap/src/utils/wpa_debug.c b/modules/hostap/src/utils/wpa_debug.c deleted file mode 100644 index 7d42857fae13..000000000000 --- a/modules/hostap/src/utils/wpa_debug.c +++ /dev/null @@ -1,416 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/* - * wpa_supplicant/hostapd / Debug prints - * Copyright (c) 2002-2013, Jouni Malinen - * - * This software may be distributed under the terms of the BSD license. - * See README for more details. - */ - -#include -#include - -#include "wpa_debug.h" - -#include - -#define WPA_DEBUG_MAX_LINE_LENGTH 256 - -LOG_MODULE_REGISTER(wpa_supp, CONFIG_WPA_SUPP_LOG_LEVEL); - -int wpa_debug_level = MSG_INFO; -int wpa_debug_show_keys; -int wpa_debug_timestamp; - -#ifndef CONFIG_NO_STDOUT_DEBUG - -void wpa_printf_impl(int level, const char *fmt, ...) -{ - va_list ap; - char buffer[WPA_DEBUG_MAX_LINE_LENGTH]; - - if (level < wpa_debug_level) - return; - - va_start(ap, fmt); - vsnprintf(buffer, sizeof(buffer), fmt, ap); - va_end(ap); - - switch (level) { - case MSG_ERROR: - LOG_ERR("%s", buffer); - break; - case MSG_WARNING: - LOG_WRN("%s", buffer); - break; - case MSG_INFO: - LOG_INF("%s", buffer); - break; - case MSG_DEBUG: - case MSG_MSGDUMP: - case MSG_EXCESSIVE: - LOG_DBG("%s", buffer); - break; - default: - break; - } - - forced_memzero(buffer, sizeof(buffer)); -} - -static void _wpa_hexdump(int level, const char *title, const u8 *buf, size_t len, int show) -{ - size_t i; - const char *content; - char *content_buf = NULL; - - if (level < wpa_debug_level) - return; - - if (buf == NULL) { - content = " [NULL]"; - } else if (show) { - content = content_buf = os_malloc(3 * len + 1); - - if (content == NULL) { - wpa_printf(MSG_ERROR, "wpa_hexdump: Failed to allocate message buffer"); - return; - } - - for (i = 0; i < len; i++) { - os_snprintf(&content_buf[i * 3], 4, " %02x", buf[i]); - } - } else { - content = " [REMOVED]"; - } - - wpa_printf(level, "%s - hexdump(len=%lu):%s", title, (unsigned long)len, content); - bin_clear_free(content_buf, 3 * len + 1); -} - -void wpa_hexdump_impl(int level, const char *title, const void *buf, size_t len) -{ - _wpa_hexdump(level, title, buf, len, 1); -} - -void wpa_hexdump_key_impl(int level, const char *title, const void *buf, size_t len) -{ - _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys); -} - -static void _wpa_hexdump_ascii(int level, const char *title, const void *buf, size_t len, int show) -{ - const char *content; - - if (level < wpa_debug_level) { - return; - } - - if (buf == NULL) { - content = " [NULL]"; - } else if (show) { - content = ""; - } else { - content = " [REMOVED]"; - } - - wpa_printf(level, "%s - hexdump_ascii(len=%lu):%s", title, (unsigned long)len, content); - - if (buf == NULL || !show) { - return; - } - - switch (level) { - case MSG_ERROR: - LOG_HEXDUMP_ERR(buf, len, ""); - break; - case MSG_WARNING: - LOG_HEXDUMP_WRN(buf, len, ""); - break; - case MSG_INFO: - LOG_HEXDUMP_INF(buf, len, ""); - break; - case MSG_DEBUG: - case MSG_MSGDUMP: - case MSG_EXCESSIVE: - LOG_HEXDUMP_DBG(buf, len, ""); - break; - default: - break; - } -} - -void wpa_hexdump_ascii_impl(int level, const char *title, const void *buf, size_t len) -{ - _wpa_hexdump_ascii(level, title, buf, len, 1); -} - -void wpa_hexdump_ascii_key_impl(int level, const char *title, const void *buf, size_t len) -{ - _wpa_hexdump_ascii(level, title, buf, len, wpa_debug_show_keys); -} - -#endif /* CONFIG_NO_STDOUT_DEBUG */ - -#ifndef CONFIG_NO_WPA_MSG - -static wpa_msg_cb_func wpa_msg_cb; - -void wpa_msg_register_cb(wpa_msg_cb_func func) -{ - wpa_msg_cb = func; -} - -static wpa_msg_get_ifname_func wpa_msg_ifname_cb; - -void wpa_msg_register_ifname_cb(wpa_msg_get_ifname_func func) -{ - wpa_msg_ifname_cb = func; -} - -void wpa_msg_impl(void *ctx, int level, const char *fmt, ...) -{ - va_list ap; - char *buf; - int buflen; - int len; - char prefix[130]; - - va_start(ap, fmt); - buflen = vsnprintf(NULL, 0, fmt, ap) + 1; - va_end(ap); - - buf = os_malloc(buflen); - if (buf == NULL) { - wpa_printf(MSG_ERROR, "wpa_msg: Failed to allocate message buffer"); - return; - } - va_start(ap, fmt); - prefix[0] = '\0'; - if (wpa_msg_ifname_cb) { - const char *ifname = wpa_msg_ifname_cb(ctx); - - if (ifname) { - int res = os_snprintf(prefix, sizeof(prefix), "%s: ", ifname); - - if (os_snprintf_error(sizeof(prefix), res)) - prefix[0] = '\0'; - } - } - len = vsnprintf(buf, buflen, fmt, ap); - va_end(ap); - wpa_printf(level, "%s%s", prefix, buf); - if (wpa_msg_cb) - wpa_msg_cb(ctx, level, WPA_MSG_PER_INTERFACE, buf, len); - bin_clear_free(buf, buflen); -} - -void wpa_msg_ctrl_impl(void *ctx, int level, const char *fmt, ...) -{ - va_list ap; - char *buf; - int buflen; - int len; - - if (!wpa_msg_cb) - return; - - va_start(ap, fmt); - buflen = vsnprintf(NULL, 0, fmt, ap) + 1; - va_end(ap); - - buf = os_malloc(buflen); - if (buf == NULL) { - wpa_printf(MSG_ERROR, "wpa_msg_ctrl: Failed to allocate message buffer"); - return; - } - va_start(ap, fmt); - len = vsnprintf(buf, buflen, fmt, ap); - va_end(ap); - wpa_msg_cb(ctx, level, WPA_MSG_PER_INTERFACE, buf, len); - bin_clear_free(buf, buflen); -} - -void wpa_msg_global_impl(void *ctx, int level, const char *fmt, ...) -{ - va_list ap; - char *buf; - int buflen; - int len; - - va_start(ap, fmt); - buflen = vsnprintf(NULL, 0, fmt, ap) + 1; - va_end(ap); - - buf = os_malloc(buflen); - if (buf == NULL) { - wpa_printf(MSG_ERROR, "wpa_msg_global: Failed to allocate message buffer"); - return; - } - va_start(ap, fmt); - len = vsnprintf(buf, buflen, fmt, ap); - va_end(ap); - wpa_printf(level, "%s", buf); - if (wpa_msg_cb) - wpa_msg_cb(ctx, level, WPA_MSG_GLOBAL, buf, len); - bin_clear_free(buf, buflen); -} - -void wpa_msg_global_ctrl_impl(void *ctx, int level, const char *fmt, ...) -{ - va_list ap; - char *buf; - int buflen; - int len; - - if (!wpa_msg_cb) - return; - - va_start(ap, fmt); - buflen = vsnprintf(NULL, 0, fmt, ap) + 1; - va_end(ap); - - buf = os_malloc(buflen); - if (buf == NULL) { - wpa_printf(MSG_ERROR, "wpa_msg_global_ctrl: Failed to allocate message buffer"); - return; - } - va_start(ap, fmt); - len = vsnprintf(buf, buflen, fmt, ap); - va_end(ap); - wpa_msg_cb(ctx, level, WPA_MSG_GLOBAL, buf, len); - bin_clear_free(buf, buflen); -} - -void wpa_msg_no_global_impl(void *ctx, int level, const char *fmt, ...) -{ - va_list ap; - char *buf; - int buflen; - int len; - - va_start(ap, fmt); - buflen = vsnprintf(NULL, 0, fmt, ap) + 1; - va_end(ap); - - buf = os_malloc(buflen); - if (buf == NULL) { - wpa_printf(MSG_ERROR, "wpa_msg_no_global: Failed to allocate message buffer"); - return; - } - va_start(ap, fmt); - len = vsnprintf(buf, buflen, fmt, ap); - va_end(ap); - wpa_printf(level, "%s", buf); - if (wpa_msg_cb) - wpa_msg_cb(ctx, level, WPA_MSG_NO_GLOBAL, buf, len); - bin_clear_free(buf, buflen); -} - -void wpa_msg_global_only_impl(void *ctx, int level, const char *fmt, ...) -{ - va_list ap; - char *buf; - int buflen; - int len; - - va_start(ap, fmt); - buflen = vsnprintf(NULL, 0, fmt, ap) + 1; - va_end(ap); - - buf = os_malloc(buflen); - if (buf == NULL) { - wpa_printf(MSG_ERROR, "%s: Failed to allocate message buffer", __func__); - return; - } - va_start(ap, fmt); - len = vsnprintf(buf, buflen, fmt, ap); - va_end(ap); - wpa_printf(level, "%s", buf); - if (wpa_msg_cb) - wpa_msg_cb(ctx, level, WPA_MSG_ONLY_GLOBAL, buf, len); - os_free(buf); -} - -#endif /* CONFIG_NO_WPA_MSG */ - -#ifndef CONFIG_NO_HOSTAPD_LOGGER - -static hostapd_logger_cb_func hostapd_logger_cb; - -void hostapd_logger_register_cb(hostapd_logger_cb_func func) -{ - hostapd_logger_cb = func; -} - -void hostapd_logger(void *ctx, const u8 *addr, unsigned int module, int level, const char *fmt, ...) -{ - va_list ap; - char *buf; - int buflen; - int len; - - va_start(ap, fmt); - buflen = vsnprintf(NULL, 0, fmt, ap) + 1; - va_end(ap); - - buf = os_malloc(buflen); - if (buf == NULL) { - wpa_printf(MSG_ERROR, "hostapd_logger: Failed to allocate message buffer"); - return; - } - va_start(ap, fmt); - len = vsnprintf(buf, buflen, fmt, ap); - va_end(ap); - if (hostapd_logger_cb) - hostapd_logger_cb(ctx, addr, module, level, buf, len); - else if (addr) - wpa_printf(MSG_DEBUG, "hostapd_logger: STA " MACSTR " - %s", MAC2STR(addr), buf); - else - wpa_printf(MSG_DEBUG, "hostapd_logger: %s", buf); - bin_clear_free(buf, buflen); -} - -#endif /* CONFIG_NO_HOSTAPD_LOGGER */ - -const char *debug_level_str(int level) -{ - switch (level) { - case MSG_EXCESSIVE: - return "EXCESSIVE"; - case MSG_MSGDUMP: - return "MSGDUMP"; - case MSG_DEBUG: - return "DEBUG"; - case MSG_INFO: - return "INFO"; - case MSG_WARNING: - return "WARNING"; - case MSG_ERROR: - return "ERROR"; - default: - return "?"; - } -} - -int str_to_debug_level(const char *s) -{ - if (os_strcasecmp(s, "EXCESSIVE") == 0) - return MSG_EXCESSIVE; - if (os_strcasecmp(s, "MSGDUMP") == 0) - return MSG_MSGDUMP; - if (os_strcasecmp(s, "DEBUG") == 0) - return MSG_DEBUG; - if (os_strcasecmp(s, "INFO") == 0) - return MSG_INFO; - if (os_strcasecmp(s, "WARNING") == 0) - return MSG_WARNING; - if (os_strcasecmp(s, "ERROR") == 0) - return MSG_ERROR; - return -1; -} diff --git a/modules/hostap/src/utils/wpa_debug.h b/modules/hostap/src/utils/wpa_debug.h deleted file mode 100644 index c065ffe467d0..000000000000 --- a/modules/hostap/src/utils/wpa_debug.h +++ /dev/null @@ -1,389 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/* - * wpa_supplicant/hostapd / Debug prints - * Copyright (c) 2002-2013, Jouni Malinen - * - * This software may be distributed under the terms of the BSD license. - * See README for more details. - */ - -#ifndef WPA_DEBUG_H -#define WPA_DEBUG_H - -#include - -#include - -extern int wpa_debug_level; -extern int wpa_debug_show_keys; -extern int wpa_debug_timestamp; - -enum { MSG_EXCESSIVE, MSG_MSGDUMP, MSG_DEBUG, MSG_INFO, MSG_WARNING, MSG_ERROR }; - -/** - * wpa_debug_level_enabled - determine if the given priority level is enabled - * by compile-time configuration. - * - * @level: priority level of a message - */ -#define wpa_debug_level_enabled(level) (CONFIG_WPA_SUPP_DEBUG_LEVEL <= (level)) - -/** - * wpa_debug_cond_run - run the action if the given condition is met - * - * @cond: condition expression - * @action: action to run - */ -#define wpa_debug_cond_run(cond, action) \ - do { \ - if (cond) { \ - action; \ - } \ - } while (0) - - -#ifdef CONFIG_NO_STDOUT_DEBUG - -#define wpa_printf(args...) do { } while (0) -#define wpa_hexdump(l, t, b, e) do { } while (0) -#define wpa_hexdump_buf(l, t, b) do { } while (0) -#define wpa_hexdump_key(l, t, b, le) do { } while (0) -#define wpa_hexdump_buf_key(l, t, b) do { } while (0) -#define wpa_hexdump_ascii(l, t, b, le) do { } while (0) -#define wpa_hexdump_ascii_key(l, t, b, le) do { } while (0) -#define wpa_dbg(args...) do { } while (0) - -#else /* CONFIG_NO_STDOUT_DEBUG */ - -/** - * wpa_printf - conditional printf - * - * @level: priority level (MSG_*) of the message - * @fmt: printf format string, followed by optional arguments - * - * This function is used to print conditional debugging and error messages. - * The output is directed to Zephyr logging subsystem. - */ -#define wpa_printf(level, fmt, ...) \ - wpa_debug_cond_run(wpa_debug_level_enabled(level), \ - wpa_printf_impl(level, fmt, ##__VA_ARGS__)) - -void wpa_printf_impl(int level, const char *fmt, ...) PRINTF_FORMAT(2, 3); - -/** - * wpa_hexdump - conditional hex dump - * - * @level: priority level (MSG_*) of the message - * @title: title of the message - * @buf: data buffer to be dumped - * @len: length of the buffer - * - * This function is used to print conditional debugging and error messages. - * The output is directed to Zephyr logging subsystem. The contents of buf is - * printed out as hex dump. - */ -#define wpa_hexdump(level, title, buf, len) \ - wpa_debug_cond_run(wpa_debug_level_enabled(level), wpa_hexdump_impl(level, title, buf, len)) - -void wpa_hexdump_impl(int level, const char *title, const void *buf, size_t len); - -static inline void wpa_hexdump_buf(int level, const char *title, const struct wpabuf *buf) -{ - wpa_hexdump(level, title, buf ? wpabuf_head(buf) : NULL, buf ? wpabuf_len(buf) : 0); -} - -/** - * wpa_hexdump_key - conditional hex dump, hide keys - * - * @level: priority level (MSG_*) of the message - * @title: title of the message - * @buf: data buffer to be dumped - * @len: length of the buffer - * - * This function is used to print conditional debugging and error messages. - * The output is directed to Zephyr logging subsystem. The contents of buf is - * printed out as hex dump. This works like wpa_hexdump(), but by default, does - * not include secret keys (passwords, etc.) in debug output. - */ -#define wpa_hexdump_key(level, title, buf, len) \ - wpa_debug_cond_run(wpa_debug_level_enabled(level), \ - wpa_hexdump_key_impl(level, title, buf, len)) - -void wpa_hexdump_key_impl(int level, const char *title, const void *buf, size_t len); - -static inline void wpa_hexdump_buf_key(int level, const char *title, const struct wpabuf *buf) -{ - wpa_hexdump_key(level, title, buf ? wpabuf_head(buf) : NULL, buf ? wpabuf_len(buf) : 0); -} - -/** - * wpa_hexdump_ascii - conditional hex dump - * - * @level: priority level (MSG_*) of the message - * @title: title of the message - * @buf: data buffer to be dumped - * @len: length of the buffer - * - * This function is used to print conditional debugging and error messages. - * The output is directed to Zephyr logging subsystem. The contents of buf is - * printed out as hex dump with both the hex numbers and ASCII characters (for - * printable range) shown. 16 bytes per line will be shown. - */ -#define wpa_hexdump_ascii(level, title, buf, len) \ - wpa_debug_cond_run(wpa_debug_level_enabled(level), \ - wpa_hexdump_ascii_impl(level, title, buf, len)) - -void wpa_hexdump_ascii_impl(int level, const char *title, const void *buf, size_t len); - -/** - * wpa_hexdump_ascii_key - conditional hex dump, hide keys - * @level: priority level (MSG_*) of the message - * @title: title of the message - * @buf: data buffer to be dumped - * @len: length of the buffer - * - * This function is used to print conditional debugging and error messages. - * The output is directed to Zephyr logging subsystem. The contents of buf is - * printed out as hex dump with both the hex numbers and ASCII characters (for - * printable range) shown. 16 bytes per line will be shown. This works like - * wpa_hexdump_ascii(), but by default, does not include secret keys - * (passwords, etc.) in debug output. - */ -#define wpa_hexdump_ascii_key(level, title, buf, len) \ - wpa_debug_cond_run(wpa_debug_level_enabled(level), \ - wpa_hexdump_ascii_key_impl(level, title, buf, len)); - -void wpa_hexdump_ascii_key_impl(int level, const char *title, const void *buf, size_t len); - -/* - * wpa_dbg() behaves like wpa_msg(), but it can be removed from build to reduce - * binary size. As such, it should be used with debugging messages that are not - * needed in the control interface while wpa_msg() has to be used for anything - * that needs to shown to control interface monitors. - */ -#define wpa_dbg(args...) wpa_msg(args) - -#endif /* CONFIG_NO_STDOUT_DEBUG */ - - -#ifdef CONFIG_NO_WPA_MSG - -#define wpa_msg(args...) do { } while (0) -#define wpa_msg_ctrl(args...) do { } while (0) -#define wpa_msg_global(args...) do { } while (0) -#define wpa_msg_global_ctrl(args...) do { } while (0) -#define wpa_msg_no_global(args...) do { } while (0) -#define wpa_msg_global_only(args...) do { } while (0) -#define wpa_msg_register_cb(f) do { } while (0) -#define wpa_msg_register_ifname_cb(f) do { } while (0) - -#else /* CONFIG_NO_WPA_MSG */ - -/** - * wpa_msg - Conditional printf for default target and ctrl_iface monitors - * - * @ctx: Pointer to context data; this is the ctx variable registered - * with struct wpa_driver_ops::init() - * @level: priority level (MSG_*) of the message - * @fmt: printf format string, followed by optional arguments - * - * This function is used to print conditional debugging and error messages. - * The output is directed to Zephyr logging subsystem. This function is like - * wpa_printf(), but it also sends the same message to all attached ctrl_iface - * monitors. - */ -#define wpa_msg(ctx, level, fmt, ...) \ - wpa_debug_cond_run(wpa_debug_level_enabled(level), \ - wpa_msg_impl(ctx, level, fmt, ##__VA_ARGS__)) - -void wpa_msg_impl(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4); - -/** - * wpa_msg_ctrl - Conditional printf for ctrl_iface monitors - * - * @ctx: Pointer to context data; this is the ctx variable registered - * with struct wpa_driver_ops::init() - * @level: priority level (MSG_*) of the message - * @fmt: printf format string, followed by optional arguments - * - * This function is used to print conditional debugging and error messages. - * This function is like wpa_msg(), but it sends the output only to the - * attached ctrl_iface monitors. In other words, it can be used for frequent - * events that do not need to be sent to syslog. - */ -#define wpa_msg_ctrl(ctx, level, fmt, ...) \ - wpa_debug_cond_run(wpa_debug_level_enabled(level), \ - wpa_msg_ctrl_impl(ctx, level, fmt, ##__VA_ARGS__)) - -void wpa_msg_ctrl_impl(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4); - -/** - * wpa_msg_global - Global printf for ctrl_iface monitors - * - * @ctx: Pointer to context data; this is the ctx variable registered - * with struct wpa_driver_ops::init() - * @level: priority level (MSG_*) of the message - * @fmt: printf format string, followed by optional arguments - * - * This function is used to print conditional debugging and error messages. - * This function is like wpa_msg(), but it sends the output as a global event, - * i.e., without being specific to an interface. For backwards compatibility, - * an old style event is also delivered on one of the interfaces (the one - * specified by the context data). - */ -#define wpa_msg_global(ctx, level, fmt, ...) \ - wpa_debug_cond_run(wpa_debug_level_enabled(level), \ - wpa_msg_global_impl(ctx, level, fmt, ##__VA_ARGS__)) - -void wpa_msg_global_impl(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4); - -/** - * wpa_msg_global_ctrl - Conditional global printf for ctrl_iface monitors - * - * @ctx: Pointer to context data; this is the ctx variable registered - * with struct wpa_driver_ops::init() - * @level: priority level (MSG_*) of the message - * @fmt: printf format string, followed by optional arguments - * - * This function is used to print conditional debugging and error messages. - * This function is like wpa_msg_global(), but it sends the output only to the - * attached global ctrl_iface monitors. In other words, it can be used for - * frequent events that do not need to be sent to syslog. - */ -#define wpa_msg_global_ctrl(ctx, level, fmt, ...) \ - wpa_debug_cond_run(wpa_debug_level_enabled(level), \ - wpa_msg_global_ctrl_impl(ctx, level, fmt, ##__VA_ARGS__)) - -void wpa_msg_global_ctrl_impl(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4); - -/** - * wpa_msg_no_global - Conditional printf for ctrl_iface monitors - * - * @ctx: Pointer to context data; this is the ctx variable registered - * with struct wpa_driver_ops::init() - * @level: priority level (MSG_*) of the message - * @fmt: printf format string, followed by optional arguments - * - * This function is used to print conditional debugging and error messages. - * This function is like wpa_msg(), but it does not send the output as a global - * event. - */ -#define wpa_msg_no_global(ctx, level, fmt, ...) \ - wpa_debug_cond_run(wpa_debug_level_enabled(level), \ - wpa_msg_no_global_impl(ctx, level, fmt, ##__VA_ARGS__)) - -void wpa_msg_no_global_impl(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4); - -/** - * wpa_msg_global_only - Conditional printf for ctrl_iface monitors - * - * @ctx: Pointer to context data; this is the ctx variable registered - * with struct wpa_driver_ops::init() - * @level: priority level (MSG_*) of the message - * @fmt: printf format string, followed by optional arguments - * - * This function is used to print conditional debugging and error messages. - * This function is like wpa_msg_global(), but it sends the output only as a - * global event. - */ -#define wpa_msg_global_only(ctx, level, fmt, ...) \ - wpa_debug_cond_run(wpa_debug_level_enabled(level), \ - wpa_msg_global_only_impl(ctx, level, fmt, ##__VA_ARGS__)) - -void wpa_msg_global_only_impl(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4); - -enum wpa_msg_type { - WPA_MSG_PER_INTERFACE, - WPA_MSG_GLOBAL, - WPA_MSG_NO_GLOBAL, - WPA_MSG_ONLY_GLOBAL, -}; - -typedef void (*wpa_msg_cb_func)(void *ctx, int level, enum wpa_msg_type type, const char *txt, - size_t len); - -/** - * wpa_msg_register_cb - Register callback function for wpa_msg() messages - * @func: Callback function (%NULL to unregister) - */ -void wpa_msg_register_cb(wpa_msg_cb_func func); - -typedef const char * (*wpa_msg_get_ifname_func)(void *ctx); -void wpa_msg_register_ifname_cb(wpa_msg_get_ifname_func func); - -#endif /* CONFIG_NO_WPA_MSG */ - - -#ifdef CONFIG_NO_HOSTAPD_LOGGER - -#define hostapd_logger(args...) do { } while (0) -#define hostapd_logger_register_cb(f) do { } while (0) - -#else /* CONFIG_NO_HOSTAPD_LOGGER */ - -#define HOSTAPD_MODULE_IEEE80211 0x00000001 -#define HOSTAPD_MODULE_IEEE8021X 0x00000002 -#define HOSTAPD_MODULE_RADIUS 0x00000004 -#define HOSTAPD_MODULE_WPA 0x00000008 -#define HOSTAPD_MODULE_DRIVER 0x00000010 -#define HOSTAPD_MODULE_MLME 0x00000040 - -enum hostapd_logger_level { - HOSTAPD_LEVEL_DEBUG_VERBOSE = 0, - HOSTAPD_LEVEL_DEBUG = 1, - HOSTAPD_LEVEL_INFO = 2, - HOSTAPD_LEVEL_NOTICE = 3, - HOSTAPD_LEVEL_WARNING = 4 -}; - -void hostapd_logger(void *ctx, const u8 *addr, unsigned int module, int level, const char *fmt, ...) - PRINTF_FORMAT(5, 6); - -typedef void (*hostapd_logger_cb_func)(void *ctx, const u8 *addr, unsigned int module, int level, - const char *txt, size_t len); - -/** - * hostapd_logger_register_cb - Register callback function for hostapd_logger() - * @func: Callback function (NULL to unregister) - */ -void hostapd_logger_register_cb(hostapd_logger_cb_func func); - -#endif /* CONFIG_NO_HOSTAPD_LOGGER */ - - -/* CONFIG_DEBUG_FILE is not supported by Zephyr */ - -static inline int wpa_debug_open_file(const char *path) { return 0; } -static inline int wpa_debug_reopen_file(void) { return 0; } -static inline void wpa_debug_close_file(void) {} -static inline void wpa_debug_setup_stdout(void) {} - - -/* CONFIG_DEBUG_SYSLOG is not supported by Zephyr */ - -static inline void wpa_debug_open_syslog(void) {} -static inline void wpa_debug_close_syslog(void) {} - - -/* CONFIG_DEBUG_LINUX_TRACING is not supported by Zephyr */ - -static inline int wpa_debug_open_linux_tracing(void) { return 0; } -static inline void wpa_debug_close_linux_tracing(void) {} - - -#ifdef EAPOL_TEST -#define WPA_ASSERT __ASSERT -#else -#define WPA_ASSERT(a) do {} while (0) -#endif - - -const char *debug_level_str(int level); -int str_to_debug_level(const char *s); - -#endif /* WPA_DEBUG_H */ diff --git a/modules/hostap/src/wpa_cli.c b/modules/hostap/src/wpa_cli.c deleted file mode 100644 index d65fa5d882c7..000000000000 --- a/modules/hostap/src/wpa_cli.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/* @file - * @brief wpa_cli implementation for Zephyr OS - */ - -#include -#include -#include - -#include "wpa_cli_zephyr.h" - -static int cmd_wpa_cli(const struct shell *sh, - size_t argc, - const char *argv[]) -{ - ARG_UNUSED(sh); - - if (argc == 1) { - shell_error(sh, "Missing argument"); - return -EINVAL; - } - - argv[argc] = "interactive"; - argc++; - - /* Remove wpa_cli from the argument list */ - return z_wpa_ctrl_zephyr_cmd(argc - 1, &argv[1]); -} - -/* Persisting with "wpa_cli" naming for compatibility with Wi-Fi - * certification applications and scripts. - */ -SHELL_CMD_REGISTER(wpa_cli, - NULL, - "wpa_cli commands (only for internal use)", - cmd_wpa_cli); From 9a99b620da97ce1e54ee14d8b47d74470c22710f Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 6 Aug 2024 00:50:03 +0530 Subject: [PATCH 07/25] boards: Remove nRF7002DK board This board is upstreamed to Zephyr. Signed-off-by: Chaitanya Tata --- boards/nordic/nrf7002dk/CMakeLists.txt | 12 - boards/nordic/nrf7002dk/Kconfig | 85 ----- boards/nordic/nrf7002dk/Kconfig.defconfig | 81 ----- boards/nordic/nrf7002dk/Kconfig.nrf7002dk | 10 - boards/nordic/nrf7002dk/Kconfig.sysbuild | 5 - boards/nordic/nrf7002dk/board.cmake | 22 -- boards/nordic/nrf7002dk/board.yml | 15 - .../nrf5340_cpuapp_common-pinctrl.dtsi | 127 -------- .../nrf7002dk/nrf5340_cpuapp_common.dtsi | 292 ------------------ .../nrf5340_cpuapp_nrf7001_common.dtsi | 292 ------------------ .../nrf5340_cpuapp_nrf7001_partition_conf.dts | 60 ---- .../nrf5340_cpuapp_partition_conf.dts | 60 ---- .../nrf7002dk/nrf5340_cpunet_nrf7001_reset.c | 59 ---- .../nordic/nrf7002dk/nrf5340_cpunet_reset.c | 59 ---- ...340_nrf7001_shared_sram_planning_conf.dtsi | 30 -- .../nrf5340_shared_sram_planning_conf.dts | 30 -- .../nrf7002dk_nrf5340_cpuapp-pinctrl.dtsi | 19 -- .../nrf7002dk/nrf7002dk_nrf5340_cpuapp.dts | 39 --- .../nrf7002dk/nrf7002dk_nrf5340_cpuapp.yaml | 19 -- .../nrf7002dk_nrf5340_cpuapp_defconfig | 23 -- .../nrf7002dk_nrf5340_cpuapp_nrf7001.dts | 32 -- .../nrf7002dk_nrf5340_cpuapp_nrf7001.yaml | 19 -- ...nrf7002dk_nrf5340_cpuapp_nrf7001_defconfig | 24 -- .../nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts | 29 -- .../nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml | 18 -- ...7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig | 27 -- .../nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts | 42 --- .../nrf7002dk_nrf5340_cpuapp_ns.yaml | 18 -- .../nrf7002dk_nrf5340_cpuapp_ns_defconfig | 26 -- .../nrf7002dk_nrf5340_cpunet-pinctrl.dtsi | 56 ---- .../nrf7002dk/nrf7002dk_nrf5340_cpunet.dts | 172 ----------- .../nrf7002dk/nrf7002dk_nrf5340_cpunet.yaml | 13 - .../nrf7002dk_nrf5340_cpunet_defconfig | 20 -- .../nrf7002dk_nrf5340_cpunet_nrf7001.dts | 172 ----------- .../nrf7002dk_nrf5340_cpunet_nrf7001.yaml | 13 - ...nrf7002dk_nrf5340_cpunet_nrf7001_defconfig | 21 -- boards/nordic/nrf7002dk/pre_dt_board.cmake | 8 - 37 files changed, 2049 deletions(-) delete mode 100644 boards/nordic/nrf7002dk/CMakeLists.txt delete mode 100644 boards/nordic/nrf7002dk/Kconfig delete mode 100644 boards/nordic/nrf7002dk/Kconfig.defconfig delete mode 100644 boards/nordic/nrf7002dk/Kconfig.nrf7002dk delete mode 100644 boards/nordic/nrf7002dk/Kconfig.sysbuild delete mode 100644 boards/nordic/nrf7002dk/board.cmake delete mode 100644 boards/nordic/nrf7002dk/board.yml delete mode 100644 boards/nordic/nrf7002dk/nrf5340_cpuapp_common-pinctrl.dtsi delete mode 100644 boards/nordic/nrf7002dk/nrf5340_cpuapp_common.dtsi delete mode 100644 boards/nordic/nrf7002dk/nrf5340_cpuapp_nrf7001_common.dtsi delete mode 100644 boards/nordic/nrf7002dk/nrf5340_cpuapp_nrf7001_partition_conf.dts delete mode 100644 boards/nordic/nrf7002dk/nrf5340_cpuapp_partition_conf.dts delete mode 100644 boards/nordic/nrf7002dk/nrf5340_cpunet_nrf7001_reset.c delete mode 100644 boards/nordic/nrf7002dk/nrf5340_cpunet_reset.c delete mode 100644 boards/nordic/nrf7002dk/nrf5340_nrf7001_shared_sram_planning_conf.dtsi delete mode 100644 boards/nordic/nrf7002dk/nrf5340_shared_sram_planning_conf.dts delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp-pinctrl.dtsi delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp.dts delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp.yaml delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_defconfig delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001.dts delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001.yaml delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_defconfig delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet-pinctrl.dtsi delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet.dts delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet.yaml delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_defconfig delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_nrf7001.dts delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_nrf7001.yaml delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_nrf7001_defconfig delete mode 100644 boards/nordic/nrf7002dk/pre_dt_board.cmake diff --git a/boards/nordic/nrf7002dk/CMakeLists.txt b/boards/nordic/nrf7002dk/CMakeLists.txt deleted file mode 100644 index 325ca1162bf3..000000000000 --- a/boards/nordic/nrf7002dk/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2022 Nordic Semiconductor ASA. -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -if(CONFIG_BOARD_ENABLE_CPUNET) - if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP OR CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS) - zephyr_library() - zephyr_library_sources(nrf5340_cpunet_reset.c) - elseif(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 OR CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS_NRF7001) - zephyr_library() - zephyr_library_sources(nrf5340_cpunet_nrf7001_reset.c) - endif() -endif() diff --git a/boards/nordic/nrf7002dk/Kconfig b/boards/nordic/nrf7002dk/Kconfig deleted file mode 100644 index 92b9de9f1184..000000000000 --- a/boards/nordic/nrf7002dk/Kconfig +++ /dev/null @@ -1,85 +0,0 @@ -# nRF5340 DK board configuration - -# Copyright (c) 2022 Nordic Semiconductor ASA -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -config IPM_NRFX - default IPM - -config MBOX_NRFX_IPC - default MBOX - -if BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF5340_CPUAPP_NS \ - || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -config BOARD_ENABLE_DCDC_APP - bool "Enable Application MCU DCDC converter" - select SOC_DCDC_NRF53X_APP - default y - -config BOARD_ENABLE_DCDC_NET - bool "Enable Network MCU DCDC converter" - select SOC_DCDC_NRF53X_NET - default y - -config BOARD_ENABLE_DCDC_HV - bool "Enable High Voltage DCDC converter" - select SOC_DCDC_NRF53X_HV - default y - -config HEAP_MEM_POOL_SIZE - default 4096 if BT_HCI_IPC - -config BT_HCI_VS - default y if BT - -config BOARD_ENABLE_CPUNET - bool "Enable nRF53 Network MCU" - select SOC_NRF_GPIO_FORWARDER_FOR_NRF5340 if \ - $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_GPIO_FORWARDER)) - help - This option enables releasing the Network 'force off' signal, which - as a consequence will power up the Network MCU during system boot. - Additionally, the option allocates GPIO pins that will be used by UARTE - of the Network MCU. - Note: GPIO pin allocation can only be configured by the secure Application - MCU firmware, so when this option is used with the non-secure version of - the board, the application needs to take into consideration, that the - secure firmware image must already have configured GPIO allocation for the - Network MCU. - default y if (BT || NRF_802154_SER_HOST) - -config DOMAIN_CPUNET_BOARD - string - default "nrf7002dk/nrf5340/cpunet" if BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF5340_CPUAPP_NS - default "nrf7002dk/nrf5340/cpunet/nrf7001" if BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - depends on BOARD_ENABLE_CPUNET - help - The board which will be used for CPUNET domain when creating a multi - image application where one or more images should be located on - another board. For example hci_ipc on the nRF5340_cpunet for - Bluetooth applications. - -endif # BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF5340_CPUAPP_NS -# || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -if BOARD_NRF7002DK_NRF5340_CPUNET || BOARD_NRF7002DK_NRF5340_CPUNET_NRF7001 - -# BT_CTLR depends on BT. When BT is enabled we should default to also -# enabling the controller. -config BT_CTLR - default y if BT - -config BT_ECC - default y if BT - -config DOMAIN_CPUAPP_BOARD - string - default "nrf7002dk/nrf5340/cpuapp" if BOARD_NRF7002DK_NRF5340_CPUNET - default "nrf7002dk/nrf5340/cpuapp/nrf7001" if BOARD_NRF7002DK_NRF5340_CPUNET_NRF7001 - help - The board which will be used for CPUAPP domain when creating a multi - image application where one or more images should be located on - another board. - -endif # BOARD_NRF7002DK_NRF5340_CPUNET || BOARD_NRF7002DK_NRF5340_CPUNET_NRF7001 diff --git a/boards/nordic/nrf7002dk/Kconfig.defconfig b/boards/nordic/nrf7002dk/Kconfig.defconfig deleted file mode 100644 index e8f2bb4b3cf4..000000000000 --- a/boards/nordic/nrf7002dk/Kconfig.defconfig +++ /dev/null @@ -1,81 +0,0 @@ -# nRF5340 DK nRF5340 board configuration - -# Copyright (c) 2022 Nordic Semiconductor ASA -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -if BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF5340_CPUAPP_NS \ - || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -# By default, if we build for a Non-Secure version of the board, -# force building with TF-M as the Secure Execution Environment. -config BUILD_WITH_TFM - default y if BOARD_NRF7002DK_NRF5340_CPUAPP_NS - # Temporarily disable building Non-Secure images with TF-M support by - # default. - # default y if BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - default n - -if BUILD_WITH_TFM - -# By default, if we build with TF-M, instruct build system to -# flash the combined TF-M (Secure) & Zephyr (Non Secure) image -config TFM_FLASH_MERGED_BINARY - bool - default y - -endif # BUILD_WITH_TFM - -# Code Partition: -# -# For the secure version of the board the firmware is linked at the beginning -# of the flash, or into the code-partition defined in DT if it is intended to -# be loaded by MCUboot. If the secure firmware is to be combined with a non- -# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always -# be restricted to the size of its code partition. -# -# For the non-secure version of the board, the firmware -# must be linked into the code-partition (non-secure) defined in DT, regardless. -# Apply this configuration below by setting the Kconfig symbols used by -# the linker according to the information extracted from DT partitions. - -# SRAM Partition: -# -# If the secure firmware is to be combined with a non-secure image -# (TRUSTED_EXECUTION_SECURE=y), the secure FW image SRAM shall always -# be restricted to the secure image SRAM partition (sram-secure-partition). -# Otherwise (if TRUSTED_EXECUTION_SECURE is not set) the whole zephyr,sram -# may be used by the image. -# -# For the non-secure version of the board, the firmware image SRAM is -# always restricted to the allocated non-secure SRAM partition. -# -# Workaround for not being able to have commas in macro arguments -DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition -DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition - -if (BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001) && TRUSTED_EXECUTION_SECURE - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -config SRAM_SIZE - default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM_PARTITION),0,K) - -endif # (BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001) && TRUSTED_EXECUTION_SECURE - -if BOARD_NRF7002DK_NRF5340_CPUAPP_NS || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -config FLASH_LOAD_OFFSET - default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -endif # BOARD_NRF7002DK_NRF5340_CPUAPP_NS || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -endif # BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF5340_CPUAPP_NS - -# Hidden (Internal use only) -config NRF70_2_4G_ONLY - bool - default y if BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS || BOARD_NRF7002DK_NRF5340_CPUNET_NRF7001 diff --git a/boards/nordic/nrf7002dk/Kconfig.nrf7002dk b/boards/nordic/nrf7002dk/Kconfig.nrf7002dk deleted file mode 100644 index 670cb682f973..000000000000 --- a/boards/nordic/nrf7002dk/Kconfig.nrf7002dk +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -config BOARD_NRF7002DK - select SOC_NRF5340_CPUNET_QKAA if BOARD_NRF7002DK_NRF5340_CPUNET \ - || BOARD_NRF7002DK_NRF5340_CPUNET_NRF7001 - select SOC_NRF5340_CPUAPP_QKAA if BOARD_NRF7002DK_NRF5340_CPUAPP \ - || BOARD_NRF7002DK_NRF5340_CPUAPP_NS \ - || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 \ - || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS diff --git a/boards/nordic/nrf7002dk/Kconfig.sysbuild b/boards/nordic/nrf7002dk/Kconfig.sysbuild deleted file mode 100644 index 852dd74a9459..000000000000 --- a/boards/nordic/nrf7002dk/Kconfig.sysbuild +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -config WIFI_NRF70 - default y if SOC_NRF5340_CPUAPP_QKAA diff --git a/boards/nordic/nrf7002dk/board.cmake b/boards/nordic/nrf7002dk/board.cmake deleted file mode 100644 index 09f52c4933c7..000000000000 --- a/boards/nordic/nrf7002dk/board.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) 2023 Nordic Semiconductor ASA -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS OR CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS_NRF7001) - set(TFM_PUBLIC_KEY_FORMAT "full") -endif() - -if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP OR CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS - OR CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 OR CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS_NRF7001) - board_runner_args(jlink "--device=nrf5340_xxaa_app" "--speed=4000") -endif() - -if(CONFIG_TFM_FLASH_MERGED_BINARY) - set_property(TARGET runners_yaml_props_target PROPERTY hex_file "${CMAKE_BINARY_DIR}/tfm_merged.hex") -endif() - -if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUNET OR CONFIG_BOARD_NRF7002DK_NRF5340_CPUNET_NRF7001) - board_runner_args(jlink "--device=nrf5340_xxaa_net" "--speed=4000") -endif() - -include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) -include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/nordic/nrf7002dk/board.yml b/boards/nordic/nrf7002dk/board.yml deleted file mode 100644 index 336d914ceecf..000000000000 --- a/boards/nordic/nrf7002dk/board.yml +++ /dev/null @@ -1,15 +0,0 @@ -board: - name: nrf7002dk - vendor: nordic - socs: - - name: nrf5340 - variants: - - name: ns - cpucluster: cpuapp - # nRF7002 companion IC in nRF7001 emulation mode on nRF7002dk - - name: nrf7001 - cpucluster: cpuapp - variants: - - name: ns - - name: nrf7001 - cpucluster: cpunet diff --git a/boards/nordic/nrf7002dk/nrf5340_cpuapp_common-pinctrl.dtsi b/boards/nordic/nrf7002dk/nrf5340_cpuapp_common-pinctrl.dtsi deleted file mode 100644 index f68ffe7c397f..000000000000 --- a/boards/nordic/nrf7002dk/nrf5340_cpuapp_common-pinctrl.dtsi +++ /dev/null @@ -1,127 +0,0 @@ -&pinctrl { - i2c1_default: i2c1_default { - group1 { - psels = , - ; - }; - }; - - i2c1_sleep: i2c1_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - uart0_default: uart0_default { - group1 { - psels = , - ; - }; - group2 { - psels = , - ; - bias-pull-up; - }; - }; - - uart0_sleep: uart0_sleep { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; - - pwm0_default: pwm0_default { - group1 { - psels = ; - }; - }; - - pwm0_sleep: pwm0_sleep { - group1 { - psels = ; - low-power-enable; - }; - }; - - qspi_default: qspi_default { - group1 { - psels = , - , - , - , - , - ; - }; - }; - - qspi_sleep: qspi_sleep { - group1 { - psels = , - , - , - , - , - ; - low-power-enable; - }; - }; - - uart1_default: uart1_default { - group1 { - psels = ; - }; - group2 { - psels = ; - bias-pull-up; - }; - }; - - uart1_sleep: uart1_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - spi3_default: spi3_default { - group1 { - psels = , - , - ; - }; - }; - - spi3_sleep: spi3_sleep { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - - spi4_default: spi4_default { - group1 { - psels = , - , - ; - }; - }; - - spi4_sleep: spi4_sleep { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - -}; diff --git a/boards/nordic/nrf7002dk/nrf5340_cpuapp_common.dtsi b/boards/nordic/nrf7002dk/nrf5340_cpuapp_common.dtsi deleted file mode 100644 index 7b1a4ef1c509..000000000000 --- a/boards/nordic/nrf7002dk/nrf5340_cpuapp_common.dtsi +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ -#include "nrf5340_cpuapp_common-pinctrl.dtsi" - -/ { - - chosen { - zephyr,console = &uart0; - zephyr,shell-uart = &uart0; - zephyr,uart-mcumgr = &uart0; - zephyr,bt-mon-uart = &uart0; - zephyr,bt-c2h-uart = &uart0; - zephyr,bt-hci-ipc = &ipc0; - nordic,802154-spinel-ipc = &ipc0; - zephyr,ieee802154 = &ieee802154; - }; - - leds { - compatible = "gpio-leds"; - led0: led_0 { - gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; - label = "Green LED 0"; - }; - led1: led_1 { - gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>; - label = "Green LED 1"; - }; - }; - - pwmleds { - compatible = "pwm-leds"; - pwm_led0: pwm_led_0 { - pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; - }; - }; - - buttons { - compatible = "gpio-keys"; - button0: button_0 { - gpios = <&gpio1 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 1"; - }; - button1: button_1 { - gpios = <&gpio1 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 2"; - }; - }; - - arduino_header: connector { - compatible = "arduino-header-r3"; - #gpio-cells = <2>; - gpio-map-mask = <0xffffffff 0xffffffc0>; - gpio-map-pass-thru = <0 0x3f>; - gpio-map = <0 0 &gpio0 4 0>, /* A0 */ - <1 0 &gpio0 5 0>, /* A1 */ - <2 0 &gpio0 6 0>, /* A2 */ - <3 0 &gpio0 7 0>, /* A3 */ - <4 0 &gpio0 25 0>, /* A4 */ - <5 0 &gpio0 26 0>, /* A5 */ - <6 0 &gpio1 0 0>, /* D0 */ - <7 0 &gpio1 1 0>, /* D1 */ - <8 0 &gpio1 4 0>, /* D2 */ - <9 0 &gpio1 5 0>, /* D3 */ - <10 0 &gpio1 6 0>, /* D4 */ - <11 0 &gpio1 7 0>, /* D5 */ - <12 0 &gpio1 8 0>, /* D6 */ - <13 0 &gpio1 9 0>, /* D7 */ - <14 0 &gpio1 10 0>, /* D8 */ - <15 0 &gpio1 11 0>, /* D9 */ - <16 0 &gpio1 12 0>, /* D10 */ - <17 0 &gpio1 13 0>, /* D11 */ - <18 0 &gpio1 14 0>, /* D12 */ - <19 0 &gpio1 15 0>, /* D13 */ - <20 0 &gpio1 2 0>, /* D14 */ - <21 0 &gpio1 3 0>; /* D15 */ - }; - - arduino_adc: analog-connector { - compatible = "arduino,uno-adc"; - #io-channel-cells = <1>; - io-channel-map = <0 &adc 0>, /* A0 = P0.4 = AIN0 */ - <1 &adc 1>, /* A1 = P0.5 = AIN1 */ - <2 &adc 2>, /* A2 = P0.6 = AIN2 */ - <3 &adc 3>, /* A3 = P0.7 = AIN3 */ - <4 &adc 4>, /* A4 = P0.25 = AIN4 */ - <5 &adc 5>; /* A5 = P0.26 = AIN5 */ - }; - - gpio_fwd: nrf-gpio-forwarder { - compatible = "nordic,nrf-gpio-forwarder"; - status = "okay"; - uart { - gpios = <&gpio1 1 0>, <&gpio1 0 0>, <&gpio1 5 0>, <&gpio1 4 0>; - }; - }; - - nrf_radio_coex: nrf7002-coex { - status = "okay"; - compatible = "nordic,nrf700x-coex"; - req-gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>; - status0-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>; - grant-gpios = <&gpio0 24 (GPIO_PULL_DOWN | GPIO_ACTIVE_LOW)>; - swctrl1-gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>; - srrf-switch-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; - }; - - nordic_wlan0: nordic_wlan0 { - compatible = "nordic,wlan0"; - status = "okay"; - }; - - /* These aliases are provided for compatibility with samples */ - aliases { - led0 = &led0; - led1 = &led1; - pwm-led0 = &pwm_led0; - sw0 = &button0; - sw1 = &button1; - bootloader-led0 = &led0; - mcuboot-button0 = &button0; - mcuboot-led0 = &led0; - }; -}; - -&adc { - status = "okay"; -}; - -&gpiote { - status = "okay"; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; - -arduino_i2c: &i2c1 { - compatible = "nordic,nrf-twim"; - status = "okay"; - pinctrl-0 = <&i2c1_default>; - pinctrl-1 = <&i2c1_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&uart0 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart0_default>; - pinctrl-1 = <&uart0_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&pwm0 { - status = "okay"; - pinctrl-0 = <&pwm0_default>; - pinctrl-1 = <&pwm0_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&spi4 { - compatible = "nordic,nrf-spim"; - status = "okay"; - pinctrl-0 = <&spi4_default>; - pinctrl-1 = <&spi4_sleep>; - pinctrl-names = "default", "sleep"; - cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; - mx25r64: mx25r6435f@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <33000000>; - jedec-id = [c2 28 17]; - sfdp-bfp = [ - e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb - ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52 - 10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 68 44 - 30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff - ]; - size = <67108864>; - has-dpd; - t-enter-dpd = <10000>; - t-exit-dpd = <5000>; - }; -}; - -&qspi { - status = "okay"; - - pinctrl-0 = <&qspi_default>; - pinctrl-1 = <&qspi_sleep>; - pinctrl-names = "default", "sleep"; - nrf700x: nrf7002@1 { - status = "okay"; - compatible = "nordic,nrf700x-qspi"; - reg = <1>; - sck-frequency = <24000000>; - quad-mode; - /* Wi-Fi Pins used */ - iovdd-ctrl-gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>; - bucken-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; - host-irq-gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>; - }; -}; - -arduino_serial: &uart1 { - compatible = "nordic,nrf-uarte"; - current-speed = <115200>; - pinctrl-0 = <&uart1_default>; - pinctrl-1 = <&uart1_sleep>; - pinctrl-names = "default", "sleep"; -}; - -arduino_spi: &spi3 { - compatible = "nordic,nrf-spim"; - cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */ - pinctrl-0 = <&spi3_default>; - pinctrl-1 = <&spi3_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&flash0 { - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x00010000>; - }; - slot0_partition: partition@10000 { - label = "image-0"; - }; - slot0_ns_partition: partition@50000 { - label = "image-0-nonsecure"; - }; - slot1_partition: partition@80000 { - label = "image-1"; - }; - slot1_ns_partition: partition@c0000 { - label = "image-1-nonsecure"; - }; - scratch_partition: partition@f0000 { - label = "image-scratch"; - reg = <0x000f0000 0xa000>; - }; - storage_partition: partition@fa000 { - label = "storage"; - reg = <0x000fa000 0x00006000>; - }; - }; -}; - -&ieee802154 { - status = "okay"; -}; - -zephyr_udc0: &usbd { - compatible = "nordic,nrf-usbd"; - status = "okay"; -}; - -/ { - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - sram0_image: image@20000000 { - /* Zephyr image(s) memory */ - }; - - sram0_s: image_s@20000000 { - /* Secure image memory */ - }; - - sram0_ns: image_ns@20040000 { - /* Non-Secure image memory */ - }; - }; -}; - -/* Include partition configuration file */ -#include "nrf5340_cpuapp_partition_conf.dts" diff --git a/boards/nordic/nrf7002dk/nrf5340_cpuapp_nrf7001_common.dtsi b/boards/nordic/nrf7002dk/nrf5340_cpuapp_nrf7001_common.dtsi deleted file mode 100644 index e81d5ce8df4d..000000000000 --- a/boards/nordic/nrf7002dk/nrf5340_cpuapp_nrf7001_common.dtsi +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ -#include "nrf5340_cpuapp_common-pinctrl.dtsi" - -/ { - - chosen { - zephyr,console = &uart0; - zephyr,shell-uart = &uart0; - zephyr,uart-mcumgr = &uart0; - zephyr,bt-mon-uart = &uart0; - zephyr,bt-c2h-uart = &uart0; - zephyr,bt-hci-ipc = &ipc0; - nordic,802154-spinel-ipc = &ipc0; - zephyr,ieee802154 = &ieee802154; - }; - - leds { - compatible = "gpio-leds"; - led0: led_0 { - gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; - label = "Green LED 0"; - }; - led1: led_1 { - gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>; - label = "Green LED 1"; - }; - }; - - pwmleds { - compatible = "pwm-leds"; - pwm_led0: pwm_led_0 { - pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; - }; - }; - - buttons { - compatible = "gpio-keys"; - button0: button_0 { - gpios = <&gpio1 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 1"; - }; - button1: button_1 { - gpios = <&gpio1 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 2"; - }; - }; - - arduino_header: connector { - compatible = "arduino-header-r3"; - #gpio-cells = <2>; - gpio-map-mask = <0xffffffff 0xffffffc0>; - gpio-map-pass-thru = <0 0x3f>; - gpio-map = <0 0 &gpio0 4 0>, /* A0 */ - <1 0 &gpio0 5 0>, /* A1 */ - <2 0 &gpio0 6 0>, /* A2 */ - <3 0 &gpio0 7 0>, /* A3 */ - <4 0 &gpio0 25 0>, /* A4 */ - <5 0 &gpio0 26 0>, /* A5 */ - <6 0 &gpio1 0 0>, /* D0 */ - <7 0 &gpio1 1 0>, /* D1 */ - <8 0 &gpio1 4 0>, /* D2 */ - <9 0 &gpio1 5 0>, /* D3 */ - <10 0 &gpio1 6 0>, /* D4 */ - <11 0 &gpio1 7 0>, /* D5 */ - <12 0 &gpio1 8 0>, /* D6 */ - <13 0 &gpio1 9 0>, /* D7 */ - <14 0 &gpio1 10 0>, /* D8 */ - <15 0 &gpio1 11 0>, /* D9 */ - <16 0 &gpio1 12 0>, /* D10 */ - <17 0 &gpio1 13 0>, /* D11 */ - <18 0 &gpio1 14 0>, /* D12 */ - <19 0 &gpio1 15 0>, /* D13 */ - <20 0 &gpio1 2 0>, /* D14 */ - <21 0 &gpio1 3 0>; /* D15 */ - }; - - arduino_adc: analog-connector { - compatible = "arduino,uno-adc"; - #io-channel-cells = <1>; - io-channel-map = <0 &adc 0>, /* A0 = P0.4 = AIN0 */ - <1 &adc 1>, /* A1 = P0.5 = AIN1 */ - <2 &adc 2>, /* A2 = P0.6 = AIN2 */ - <3 &adc 3>, /* A3 = P0.7 = AIN3 */ - <4 &adc 4>, /* A4 = P0.25 = AIN4 */ - <5 &adc 5>; /* A5 = P0.26 = AIN5 */ - }; - - gpio_fwd: nrf-gpio-forwarder { - compatible = "nordic,nrf-gpio-forwarder"; - status = "okay"; - uart { - gpios = <&gpio1 1 0>, <&gpio1 0 0>, <&gpio1 5 0>, <&gpio1 4 0>; - }; - }; - - nrf_radio_coex: nrf7001-coex { - status = "okay"; - compatible = "nordic,nrf700x-coex"; - req-gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>; - status0-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>; - grant-gpios = <&gpio0 24 (GPIO_PULL_DOWN | GPIO_ACTIVE_LOW)>; - swctrl1-gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>; - srrf-switch-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; - }; - - nordic_wlan0: nordic_wlan0 { - compatible = "nordic,wlan0"; - status = "okay"; - }; - - /* These aliases are provided for compatibility with samples */ - aliases { - led0 = &led0; - led1 = &led1; - pwm-led0 = &pwm_led0; - sw0 = &button0; - sw1 = &button1; - bootloader-led0 = &led0; - mcuboot-button0 = &button0; - mcuboot-led0 = &led0; - }; -}; - -&adc { - status = "okay"; -}; - -&gpiote { - status = "okay"; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; - -arduino_i2c: &i2c1 { - compatible = "nordic,nrf-twim"; - status = "okay"; - pinctrl-0 = <&i2c1_default>; - pinctrl-1 = <&i2c1_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&uart0 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart0_default>; - pinctrl-1 = <&uart0_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&pwm0 { - status = "okay"; - pinctrl-0 = <&pwm0_default>; - pinctrl-1 = <&pwm0_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&spi4 { - compatible = "nordic,nrf-spim"; - status = "okay"; - pinctrl-0 = <&spi4_default>; - pinctrl-1 = <&spi4_sleep>; - pinctrl-names = "default", "sleep"; - cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; - mx25r64: mx25r6435f@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <33000000>; - jedec-id = [c2 28 17]; - sfdp-bfp = [ - e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb - ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52 - 10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 68 44 - 30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff - ]; - size = <67108864>; - has-dpd; - t-enter-dpd = <10000>; - t-exit-dpd = <5000>; - }; -}; - -&qspi { - status = "okay"; - - pinctrl-0 = <&qspi_default>; - pinctrl-1 = <&qspi_sleep>; - pinctrl-names = "default", "sleep"; - nrf700x: nrf7001@1 { - status = "okay"; - compatible = "nordic,nrf700x-qspi"; - reg = <1>; - sck-frequency = <24000000>; - quad-mode; - /* Wi-Fi Pins used */ - iovdd-ctrl-gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>; - bucken-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; - host-irq-gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>; - }; -}; - -arduino_serial: &uart1 { - compatible = "nordic,nrf-uarte"; - current-speed = <115200>; - pinctrl-0 = <&uart1_default>; - pinctrl-1 = <&uart1_sleep>; - pinctrl-names = "default", "sleep"; -}; - -arduino_spi: &spi3 { - compatible = "nordic,nrf-spim"; - cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */ - pinctrl-0 = <&spi3_default>; - pinctrl-1 = <&spi3_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&flash0 { - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x00010000>; - }; - slot0_partition: partition@10000 { - label = "image-0"; - }; - slot0_ns_partition: partition@50000 { - label = "image-0-nonsecure"; - }; - slot1_partition: partition@80000 { - label = "image-1"; - }; - slot1_ns_partition: partition@c0000 { - label = "image-1-nonsecure"; - }; - scratch_partition: partition@f0000 { - label = "image-scratch"; - reg = <0x000f0000 0xa000>; - }; - storage_partition: partition@fa000 { - label = "storage"; - reg = <0x000fa000 0x00006000>; - }; - }; -}; - -&ieee802154 { - status = "okay"; -}; - -zephyr_udc0: &usbd { - compatible = "nordic,nrf-usbd"; - status = "okay"; -}; - -/ { - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - sram0_image: image@20000000 { - /* Zephyr image(s) memory */ - }; - - sram0_s: image_s@20000000 { - /* Secure image memory */ - }; - - sram0_ns: image_ns@20040000 { - /* Non-Secure image memory */ - }; - }; -}; - -/* Include partition configuration file */ -#include "nrf5340_cpuapp_partition_conf.dts" diff --git a/boards/nordic/nrf7002dk/nrf5340_cpuapp_nrf7001_partition_conf.dts b/boards/nordic/nrf7002dk/nrf5340_cpuapp_nrf7001_partition_conf.dts deleted file mode 100644 index 6d0657c379bd..000000000000 --- a/boards/nordic/nrf7002dk/nrf5340_cpuapp_nrf7001_partition_conf.dts +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/* - * Default Flash planning for nrf7002dk_nrf7001_nrf5340 CPUAPP (Application MCU). - * - * Zephyr build for nRF5340 with ARM TrustZone-M support, - * implies building Secure and Non-Secure Zephyr images. - * - * Secure image will be placed, by default, in flash0 - * (or in slot0, if MCUboot is present). - * Secure image will use sram0 for system memory. - * - * Non-Secure image will be placed in slot0_ns, and use - * sram0_ns for system memory. - * - * Note that the Secure image only requires knowledge of - * the beginning of the Non-Secure image (not its size). - */ - -&slot0_partition { - reg = <0x00010000 0x40000>; -}; - -&slot0_ns_partition { - reg = <0x00050000 0x30000>; -}; - -&slot1_partition { - reg = <0x00080000 0x40000>; -}; - -&slot1_ns_partition { - reg = <0x000c0000 0x30000>; -}; - -/* Default SRAM planning when building for nRF5340 with - * ARM TrustZone-M support - * - Lowest 256 kB SRAM allocated to Secure image (sram0_s) - * - Middle 192 kB allocated to Non-Secure image (sram0_ns) - * - Upper 64 kB SRAM allocated as Shared memory (sram0_shared) - * (see nrf5340_shared_sram_planning_conf.dts) - */ -&sram0_image { - reg = <0x20000000 DT_SIZE_K(448)>; -}; - -&sram0_s { - reg = <0x20000000 DT_SIZE_K(256)>; -}; - -&sram0_ns { - reg = <0x20040000 DT_SIZE_K(192)>; -}; - -/* Include shared RAM configuration file */ -#include "nrf5340_shared_sram_planning_conf.dts" diff --git a/boards/nordic/nrf7002dk/nrf5340_cpuapp_partition_conf.dts b/boards/nordic/nrf7002dk/nrf5340_cpuapp_partition_conf.dts deleted file mode 100644 index ec1e2556db62..000000000000 --- a/boards/nordic/nrf7002dk/nrf5340_cpuapp_partition_conf.dts +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/* - * Default Flash planning for nrf7002dk_nrf5340 CPUAPP (Application MCU). - * - * Zephyr build for nRF5340 with ARM TrustZone-M support, - * implies building Secure and Non-Secure Zephyr images. - * - * Secure image will be placed, by default, in flash0 - * (or in slot0, if MCUboot is present). - * Secure image will use sram0 for system memory. - * - * Non-Secure image will be placed in slot0_ns, and use - * sram0_ns for system memory. - * - * Note that the Secure image only requires knowledge of - * the beginning of the Non-Secure image (not its size). - */ - -&slot0_partition { - reg = <0x00010000 0x40000>; -}; - -&slot0_ns_partition { - reg = <0x00050000 0x30000>; -}; - -&slot1_partition { - reg = <0x00080000 0x40000>; -}; - -&slot1_ns_partition { - reg = <0x000c0000 0x30000>; -}; - -/* Default SRAM planning when building for nRF5340 with - * ARM TrustZone-M support - * - Lowest 256 kB SRAM allocated to Secure image (sram0_s) - * - Middle 192 kB allocated to Non-Secure image (sram0_ns) - * - Upper 64 kB SRAM allocated as Shared memory (sram0_shared) - * (see nrf5340_shared_sram_planning_conf.dts) - */ -&sram0_image { - reg = <0x20000000 DT_SIZE_K(448)>; -}; - -&sram0_s { - reg = <0x20000000 DT_SIZE_K(256)>; -}; - -&sram0_ns { - reg = <0x20040000 DT_SIZE_K(192)>; -}; - -/* Include shared RAM configuration file */ -#include "nrf5340_shared_sram_planning_conf.dts" diff --git a/boards/nordic/nrf7002dk/nrf5340_cpunet_nrf7001_reset.c b/boards/nordic/nrf7002dk/nrf5340_cpunet_nrf7001_reset.c deleted file mode 100644 index 32d093597aed..000000000000 --- a/boards/nordic/nrf7002dk/nrf5340_cpunet_nrf7001_reset.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA. - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include -#include -#include - -#include -#include - -LOG_MODULE_REGISTER(nrf7002dk_nrf5340_cpuapp_nrf7001, CONFIG_LOG_DEFAULT_LEVEL); - -#if defined(CONFIG_BT_CTLR_DEBUG_PINS_CPUAPP) -#include <../subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/debug.h> -#endif - -static void remoteproc_mgr_config(void) -{ -#if defined(CONFIG_BT_CTLR_DEBUG_PINS_CPUAPP) && \ - (!defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(CONFIG_BUILD_WITH_TFM)) - /* Route Bluetooth Controller Debug Pins */ - DEBUG_SETUP(); -#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(CONFIG_BUILD_WITH_TFM) */ - -#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) - /* Retain nRF5340 Network MCU in Secure domain (bus - * accesses by Network MCU will have Secure attribute set). - */ - NRF_SPU->EXTDOMAIN[0].PERM = BIT(4); -#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */ -} - -static int remoteproc_mgr_boot(void) -{ - - /* Secure domain may configure permissions for the Network MCU. */ - remoteproc_mgr_config(); - -#if !defined(CONFIG_TRUSTED_EXECUTION_SECURE) - /* - * Building Zephyr with CONFIG_TRUSTED_EXECUTION_SECURE=y implies - * building also a Non-Secure image. The Non-Secure image will, in - * this case do the remainder of actions to properly configure and - * boot the Network MCU. - */ - - /* Release the Network MCU, 'Release force off signal' */ - nrf_reset_network_force_off(NRF_RESET, false); - - LOG_DBG("Network MCU released."); -#endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ - - return 0; -} - -SYS_INIT(remoteproc_mgr_boot, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); diff --git a/boards/nordic/nrf7002dk/nrf5340_cpunet_reset.c b/boards/nordic/nrf7002dk/nrf5340_cpunet_reset.c deleted file mode 100644 index a699b3e9bf0d..000000000000 --- a/boards/nordic/nrf7002dk/nrf5340_cpunet_reset.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA. - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include -#include -#include - -#include -#include - -LOG_MODULE_REGISTER(nrf7002dk_nrf5340_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); - -#if defined(CONFIG_BT_CTLR_DEBUG_PINS_CPUAPP) -#include <../subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/debug.h> -#endif - -static void remoteproc_mgr_config(void) -{ -#if defined(CONFIG_BT_CTLR_DEBUG_PINS_CPUAPP) && \ - (!defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(CONFIG_BUILD_WITH_TFM)) - /* Route Bluetooth Controller Debug Pins */ - DEBUG_SETUP(); -#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(CONFIG_BUILD_WITH_TFM) */ - -#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) - /* Retain nRF5340 Network MCU in Secure domain (bus - * accesses by Network MCU will have Secure attribute set). - */ - NRF_SPU->EXTDOMAIN[0].PERM = BIT(4); -#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */ -} - -static int remoteproc_mgr_boot(void) -{ - - /* Secure domain may configure permissions for the Network MCU. */ - remoteproc_mgr_config(); - -#if !defined(CONFIG_TRUSTED_EXECUTION_SECURE) - /* - * Building Zephyr with CONFIG_TRUSTED_EXECUTION_SECURE=y implies - * building also a Non-Secure image. The Non-Secure image will, in - * this case do the remainder of actions to properly configure and - * boot the Network MCU. - */ - - /* Release the Network MCU, 'Release force off signal' */ - nrf_reset_network_force_off(NRF_RESET, false); - - LOG_DBG("Network MCU released."); -#endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ - - return 0; -} - -SYS_INIT(remoteproc_mgr_boot, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); diff --git a/boards/nordic/nrf7002dk/nrf5340_nrf7001_shared_sram_planning_conf.dtsi b/boards/nordic/nrf7002dk/nrf5340_nrf7001_shared_sram_planning_conf.dtsi deleted file mode 100644 index eae3bdcce226..000000000000 --- a/boards/nordic/nrf7002dk/nrf5340_nrf7001_shared_sram_planning_conf.dtsi +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/* Default shared SRAM planning when building for nRF5340. - * This file is included by both nRF5340 CPUAPP (Application MCU) - * and nRF5340 CPUNET (Network MCU). - * - 64 kB SRAM allocated as Shared memory (sram0_shared) - * - Region defined after the image SRAM of Application MCU - */ - -/ { - chosen { - /* shared memory reserved for the inter-processor communication */ - zephyr,ipc_shm = &sram0_shared; - }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - sram0_shared: memory@20070000 { - /* SRAM allocated to shared memory */ - reg = <0x20070000 0x10000>; - }; - }; -}; diff --git a/boards/nordic/nrf7002dk/nrf5340_shared_sram_planning_conf.dts b/boards/nordic/nrf7002dk/nrf5340_shared_sram_planning_conf.dts deleted file mode 100644 index c030a1e962ca..000000000000 --- a/boards/nordic/nrf7002dk/nrf5340_shared_sram_planning_conf.dts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/* Default shared SRAM planning when building for nRF5340. - * This file is included by both nRF5340 CPUAPP (Application MCU) - * and nRF5340 CPUNET (Network MCU). - * - 64 kB SRAM allocated as Shared memory (sram0_shared) - * - Region defined after the image SRAM of Application MCU - */ - -/ { - chosen { - /* shared memory reserved for the inter-processor communication */ - zephyr,ipc_shm = &sram0_shared; - }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - sram0_shared: memory@20070000 { - /* SRAM allocated to shared memory */ - reg = <0x20070000 0x10000>; - }; - }; -}; diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp-pinctrl.dtsi b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp-pinctrl.dtsi deleted file mode 100644 index 950ccad422dc..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp-pinctrl.dtsi +++ /dev/null @@ -1,19 +0,0 @@ -&pinctrl { - spi2_default: spi2_default { - group1 { - psels = , - , - ; - }; - }; - - spi2_sleep: spi2_sleep { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - -}; diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp.dts b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp.dts deleted file mode 100644 index eb12e33add74..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp.dts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/dts-v1/; -#include -#include "nrf5340_cpuapp_common.dtsi" -#include "nrf7002dk_nrf5340_cpuapp-pinctrl.dtsi" - -/ { - model = "Nordic NRF7002 DK NRF5340 Application"; - compatible = "nordic,nrf7002-dk-nrf5340-cpuapp"; - - chosen { - zephyr,sram = &sram0_image; - zephyr,flash = &flash0; - zephyr,code-partition = &slot0_partition; - zephyr,sram-secure-partition = &sram0_s; - zephyr,sram-non-secure-partition = &sram0_ns; - zephyr,wifi = &nordic_wlan0; - zephyr,bt-hci = &bt_hci_ipc0; - }; - - nrf70_tx_power_ceiling: nrf70_tx_power_ceiling_node { - status = "okay"; - compatible = "nordic,nrf700x-tx-power-ceiling"; - max-pwr-2g-dsss = <0x54>; - max-pwr-2g-mcs0 = <0x40>; - max-pwr-2g-mcs7 = <0x40>; - max-pwr-5g-low-mcs0 = <0x24>; - max-pwr-5g-low-mcs7 = <0x24>; - max-pwr-5g-mid-mcs0 = <0x2C>; - max-pwr-5g-mid-mcs7 = <0x2C>; - max-pwr-5g-high-mcs0 = <0x34>; - max-pwr-5g-high-mcs7 = <0x34>; - }; -}; diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp.yaml b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp.yaml deleted file mode 100644 index d9f5e8d889aa..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp.yaml +++ /dev/null @@ -1,19 +0,0 @@ -identifier: nrf7002dk/nrf5340/cpuapp -name: NRF7002-DK-NRF5340-application-MCU -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 448 -flash: 1024 -supported: - - gpio - - i2c - - i2s - - pwm - - watchdog - - usb_cdc - - usb_device - - netif:openthread diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_defconfig b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_defconfig deleted file mode 100644 index 31c4812463db..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_defconfig +++ /dev/null @@ -1,23 +0,0 @@ -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -# Enable MPU -CONFIG_ARM_MPU=y - -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - -# Enable TrustZone-M -CONFIG_ARM_TRUSTZONE_M=y - -# enable GPIO -CONFIG_GPIO=y - -# enable PINCTRL -CONFIG_PINCTRL=y - -# Enable uart driver -CONFIG_SERIAL=y - -# enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001.dts b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001.dts deleted file mode 100644 index 1505d6181834..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001.dts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/dts-v1/; -#include -#include "nrf5340_cpuapp_nrf7001_common.dtsi" -#include "nrf7002dk_nrf5340_cpuapp-pinctrl.dtsi" - -/ { - model = "Nordic NRF7002 DK (emulating NRF7001) NRF5340 Application"; - compatible = "nordic,nrf7002-dk-nrf5340-cpuapp"; - - chosen { - zephyr,sram = &sram0_image; - zephyr,flash = &flash0; - zephyr,code-partition = &slot0_partition; - zephyr,sram-secure-partition = &sram0_s; - zephyr,sram-non-secure-partition = &sram0_ns; - zephyr,wifi = &nordic_wlan0; - }; - - nrf70_tx_power_ceiling: nrf70_tx_power_ceiling_node { - status = "okay"; - compatible = "nordic,nrf700x-tx-power-ceiling"; - max-pwr-2g-dsss = <0x54>; - max-pwr-2g-mcs0 = <0x40>; - max-pwr-2g-mcs7 = <0x40>; - }; -}; diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001.yaml b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001.yaml deleted file mode 100644 index 6c57c3064b72..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001.yaml +++ /dev/null @@ -1,19 +0,0 @@ -identifier: nrf7002dk/nrf5340/cpuapp/nrf7001 -name: NRF7002-DK-NRF7001-NRF5340-application-MCU -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 448 -flash: 1024 -supported: - - gpio - - i2c - - i2s - - pwm - - watchdog - - usb_cdc - - usb_device - - netif:openthread diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_defconfig b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_defconfig deleted file mode 100644 index bc7bcbe657f0..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_defconfig +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2023 Nordic Semiconductor ASA -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -# Enable MPU -CONFIG_ARM_MPU=y - -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - -# Enable TrustZone-M -CONFIG_ARM_TRUSTZONE_M=y - -# enable GPIO -CONFIG_GPIO=y - -# enable PINCTRL -CONFIG_PINCTRL=y - -# Enable uart driver -CONFIG_SERIAL=y - -# enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts deleted file mode 100644 index 9ab33f7e69f4..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/dts-v1/; -#include -#include "nrf5340_cpuapp_nrf7001_common.dtsi" - -/ { - model = "Nordic NRF5340 DK NRF5340 Application"; - compatible = "nordic,nrf5340-dk-nrf5340-cpuapp"; - - chosen { - zephyr,sram = &sram0_ns; - zephyr,flash = &flash0; - zephyr,code-partition = &slot0_ns_partition; - zephyr,wifi = &nordic_wlan0; - }; - - nrf70_tx_power_ceiling: nrf70_tx_power_ceiling_node { - status = "okay"; - compatible = "nordic,nrf700x-tx-power-ceiling"; - max-pwr-2g-dsss = <0x54>; - max-pwr-2g-mcs0 = <0x40>; - max-pwr-2g-mcs7 = <0x40>; - }; -}; diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml deleted file mode 100644 index 1302d2be8ed0..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml +++ /dev/null @@ -1,18 +0,0 @@ -identifier: nrf7002dk/nrf5340/cpuapp/nrf7001_ns -name: NRF7002-DK-NRF7001-NRF5340-application-MCU-Non-Secure -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 192 -flash: 192 -supported: - - gpio - - i2c - - pwm - - watchdog - - usb_cdc - - usb_device - - netif:openthread diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig deleted file mode 100644 index e37dfba0f6a7..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2023 Nordic Semiconductor ASA -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -# Enable MPU -CONFIG_ARM_MPU=y - -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - -# Enable TrustZone-M -CONFIG_ARM_TRUSTZONE_M=y - -# This Board implies building Non-Secure firmware -CONFIG_TRUSTED_EXECUTION_NONSECURE=y - -# enable GPIO -CONFIG_GPIO=y - -# enable PINCTRL -CONFIG_PINCTRL=y - -# Enable uart driver -CONFIG_SERIAL=y - -# enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts deleted file mode 100644 index 1d8edda1e874..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/dts-v1/; -#include -#include "nrf5340_cpuapp_common.dtsi" - -/ { - model = "Nordic NRF5340 DK NRF5340 Application"; - compatible = "nordic,nrf5340-dk-nrf5340-cpuapp"; - - chosen { - zephyr,sram = &sram0_ns; - zephyr,flash = &flash0; - zephyr,code-partition = &slot0_ns_partition; - zephyr,entropy = &psa_rng; - zephyr,wifi = &nordic_wlan0; - zephyr,bt-hci = &bt_hci_ipc0; - }; - - psa_rng: psa-rng { - compatible = "zephyr,psa-crypto-rng"; - status = "okay"; - }; - - nrf70_tx_power_ceiling: nrf70_tx_power_ceiling_node { - status = "okay"; - compatible = "nordic,nrf700x-tx-power-ceiling"; - max-pwr-2g-dsss = <0x54>; - max-pwr-2g-mcs0 = <0x40>; - max-pwr-2g-mcs7 = <0x40>; - max-pwr-5g-low-mcs0 = <0x24>; - max-pwr-5g-low-mcs7 = <0x24>; - max-pwr-5g-mid-mcs0 = <0x2C>; - max-pwr-5g-mid-mcs7 = <0x2C>; - max-pwr-5g-high-mcs0 = <0x34>; - max-pwr-5g-high-mcs7 = <0x34>; - }; -}; diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml deleted file mode 100644 index e6c1afd8546b..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml +++ /dev/null @@ -1,18 +0,0 @@ -identifier: nrf7002dk/nrf5340/cpuapp/ns -name: NRF7002-DK-NRF5340-application-MCU-Non-Secure -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 192 -flash: 192 -supported: - - gpio - - i2c - - pwm - - watchdog - - usb_cdc - - usb_device - - netif:openthread diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig deleted file mode 100644 index f3e5e3ab9cd9..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig +++ /dev/null @@ -1,26 +0,0 @@ -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -# Enable MPU -CONFIG_ARM_MPU=y - -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - -# Enable TrustZone-M -CONFIG_ARM_TRUSTZONE_M=y - -# This Board implies building Non-Secure firmware -CONFIG_TRUSTED_EXECUTION_NONSECURE=y - -# enable GPIO -CONFIG_GPIO=y - -# enable PINCTRL -CONFIG_PINCTRL=y - -# Enable uart driver -CONFIG_SERIAL=y - -# enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet-pinctrl.dtsi b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet-pinctrl.dtsi deleted file mode 100644 index b597b9ff0e2f..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet-pinctrl.dtsi +++ /dev/null @@ -1,56 +0,0 @@ -&pinctrl { - uart0_default: uart0_default { - group1 { - psels = , - ; - }; - group2 { - psels = , - ; - bias-pull-up; - }; - }; - - uart0_sleep: uart0_sleep { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; - - i2c0_default: i2c0_default { - group1 { - psels = , - ; - }; - }; - - i2c0_sleep: i2c0_sleep { - group1 { - psels = , - ; - low-power-enable; - }; - }; - - spi0_default: spi0_default { - group1 { - psels = , - , - ; - }; - }; - - spi0_sleep: spi0_sleep { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - -}; diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet.dts b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet.dts deleted file mode 100644 index af63d6859dd5..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet.dts +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/dts-v1/; -#include -#include "nrf7002dk_nrf5340_cpunet-pinctrl.dtsi" - -/ { - model = "Nordic NRF7002 DK NRF5340 Network"; - compatible = "nordic,nrf7002-dk-nrf5340-cpunet"; - - chosen { - zephyr,console = &uart0; - zephyr,shell-uart = &uart0; - zephyr,uart-mcumgr = &uart0; - zephyr,bt-mon-uart = &uart0; - zephyr,bt-c2h-uart = &uart0; - zephyr,bt-hci-ipc = &ipc0; - nordic,802154-spinel-ipc = &ipc0; - zephyr,sram = &sram1; - zephyr,flash = &flash1; - zephyr,code-partition = &slot0_partition; - }; - - leds { - compatible = "gpio-leds"; - led0: led_0 { - gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; - label = "Green LED 0"; - }; - led1: led_1 { - gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>; - label = "Green LED 1"; - }; - }; - - buttons { - compatible = "gpio-keys"; - button0: button_0 { - gpios = <&gpio1 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 1"; - }; - button1: button_1 { - gpios = <&gpio1 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 2"; - }; - }; - - arduino_header: connector { - compatible = "arduino-header-r3"; - #gpio-cells = <2>; - gpio-map-mask = <0xffffffff 0xffffffc0>; - gpio-map-pass-thru = <0 0x3f>; - gpio-map = <0 0 &gpio0 4 0>, /* A0 */ - <1 0 &gpio0 5 0>, /* A1 */ - <2 0 &gpio0 6 0>, /* A2 */ - <3 0 &gpio0 7 0>, /* A3 */ - <4 0 &gpio0 25 0>, /* A4 */ - <5 0 &gpio0 26 0>, /* A5 */ - <6 0 &gpio1 0 0>, /* D0 */ - <7 0 &gpio1 1 0>, /* D1 */ - <8 0 &gpio1 4 0>, /* D2 */ - <9 0 &gpio1 5 0>, /* D3 */ - <10 0 &gpio1 6 0>, /* D4 */ - <11 0 &gpio1 7 0>, /* D5 */ - <12 0 &gpio1 8 0>, /* D6 */ - <13 0 &gpio1 9 0>, /* D7 */ - <14 0 &gpio1 10 0>, /* D8 */ - <15 0 &gpio1 11 0>, /* D9 */ - <16 0 &gpio1 12 0>, /* D10 */ - <17 0 &gpio1 13 0>, /* D11 */ - <18 0 &gpio1 14 0>, /* D12 */ - <19 0 &gpio1 15 0>, /* D13 */ - <20 0 &gpio1 2 0>, /* D14 */ - <21 0 &gpio1 3 0>; /* D15 */ - }; - - nrf_radio_coex: nrf7002-coex { - status = "okay"; - compatible = "nordic,nrf700x-coex"; - req-gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>; - status0-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>; - grant-gpios = <&gpio0 24 (GPIO_PULL_DOWN | GPIO_ACTIVE_LOW)>; - swctrl1-gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>; - }; - - /* These aliases are provided for compatibility with samples */ - aliases { - led0 = &led0; - led1 = &led1; - sw0 = &button0; - sw1 = &button1; - bootloader-led0 = &led0; - }; -}; - -&gpiote { - status = "okay"; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; - -&uart0 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart0_default>; - pinctrl-1 = <&uart0_sleep>; - pinctrl-names = "default", "sleep"; -}; - -arduino_serial: &uart0{}; - -arduino_i2c: &i2c0 { - compatible = "nordic,nrf-twim"; - /* Cannot be used together with uart0. */ - /* status = "okay"; */ - pinctrl-0 = <&i2c0_default>; - pinctrl-1 = <&i2c0_sleep>; - pinctrl-names = "default", "sleep"; -}; - -arduino_spi: &spi0 { - compatible = "nordic,nrf-spim"; - /* Cannot be used together with uart0. */ - /* status = "okay"; */ - cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */ - pinctrl-0 = <&spi0_default>; - pinctrl-1 = <&spi0_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&flash1 { - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0xc000>; - }; - slot0_partition: partition@c000 { - label = "image-0"; - reg = <0x0000C000 0x12000>; - }; - slot1_partition: partition@1e000 { - label = "image-1"; - reg = <0x0001E000 0x12000>; - }; - scratch_partition: partition@30000 { - label = "image-scratch"; - reg = <0x00030000 0xa000>; - }; - storage_partition: partition@3a000 { - label = "storage"; - reg = <0x0003a000 0x6000>; - }; - }; -}; - -/* Include shared RAM configuration file */ -#include "nrf5340_shared_sram_planning_conf.dts" diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet.yaml b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet.yaml deleted file mode 100644 index c048c452bce5..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet.yaml +++ /dev/null @@ -1,13 +0,0 @@ -identifier: nrf7002dk/nrf5340/cpunet -name: NRF7002-DK-NRF5340-network-MCU -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 64 -flash: 256 -supported: - - gpio - - watchdog diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_defconfig b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_defconfig deleted file mode 100644 index c7d468fb82d1..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_defconfig +++ /dev/null @@ -1,20 +0,0 @@ -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -# Enable MPU -CONFIG_ARM_MPU=y - -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - -# enable GPIO -CONFIG_GPIO=y - -# enable PINCTRL -CONFIG_PINCTRL=y - -# Enable uart driver -CONFIG_SERIAL=y - -# enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_nrf7001.dts b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_nrf7001.dts deleted file mode 100644 index 21cf1efcb56a..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_nrf7001.dts +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/dts-v1/; -#include -#include "nrf7002dk_nrf5340_cpunet-pinctrl.dtsi" - -/ { - model = "Nordic NRF7002 DK (emulating NRF7001) NRF5340 Network"; - compatible = "nordic,nrf7002-dk-nrf5340-cpunet"; - - chosen { - zephyr,console = &uart0; - zephyr,shell-uart = &uart0; - zephyr,uart-mcumgr = &uart0; - zephyr,bt-mon-uart = &uart0; - zephyr,bt-c2h-uart = &uart0; - zephyr,bt-hci-ipc = &ipc0; - nordic,802154-spinel-ipc = &ipc0; - zephyr,sram = &sram1; - zephyr,flash = &flash1; - zephyr,code-partition = &slot0_partition; - }; - - leds { - compatible = "gpio-leds"; - led0: led_0 { - gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; - label = "Green LED 0"; - }; - led1: led_1 { - gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>; - label = "Green LED 1"; - }; - }; - - buttons { - compatible = "gpio-keys"; - button0: button_0 { - gpios = <&gpio1 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 1"; - }; - button1: button_1 { - gpios = <&gpio1 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - label = "Push button 2"; - }; - }; - - arduino_header: connector { - compatible = "arduino-header-r3"; - #gpio-cells = <2>; - gpio-map-mask = <0xffffffff 0xffffffc0>; - gpio-map-pass-thru = <0 0x3f>; - gpio-map = <0 0 &gpio0 4 0>, /* A0 */ - <1 0 &gpio0 5 0>, /* A1 */ - <2 0 &gpio0 6 0>, /* A2 */ - <3 0 &gpio0 7 0>, /* A3 */ - <4 0 &gpio0 25 0>, /* A4 */ - <5 0 &gpio0 26 0>, /* A5 */ - <6 0 &gpio1 0 0>, /* D0 */ - <7 0 &gpio1 1 0>, /* D1 */ - <8 0 &gpio1 4 0>, /* D2 */ - <9 0 &gpio1 5 0>, /* D3 */ - <10 0 &gpio1 6 0>, /* D4 */ - <11 0 &gpio1 7 0>, /* D5 */ - <12 0 &gpio1 8 0>, /* D6 */ - <13 0 &gpio1 9 0>, /* D7 */ - <14 0 &gpio1 10 0>, /* D8 */ - <15 0 &gpio1 11 0>, /* D9 */ - <16 0 &gpio1 12 0>, /* D10 */ - <17 0 &gpio1 13 0>, /* D11 */ - <18 0 &gpio1 14 0>, /* D12 */ - <19 0 &gpio1 15 0>, /* D13 */ - <20 0 &gpio1 2 0>, /* D14 */ - <21 0 &gpio1 3 0>; /* D15 */ - }; - - nrf_radio_coex: nrf7001-coex { - status = "okay"; - compatible = "nordic,nrf700x-coex"; - req-gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>; - status0-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>; - grant-gpios = <&gpio0 24 (GPIO_PULL_DOWN | GPIO_ACTIVE_LOW)>; - swctrl1-gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>; - }; - - /* These aliases are provided for compatibility with samples */ - aliases { - led0 = &led0; - led1 = &led1; - sw0 = &button0; - sw1 = &button1; - bootloader-led0 = &led0; - }; -}; - -&gpiote { - status = "okay"; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; - -&uart0 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart0_default>; - pinctrl-1 = <&uart0_sleep>; - pinctrl-names = "default", "sleep"; -}; - -arduino_serial: &uart0{}; - -arduino_i2c: &i2c0 { - compatible = "nordic,nrf-twim"; - /* Cannot be used together with uart0. */ - /* status = "okay"; */ - pinctrl-0 = <&i2c0_default>; - pinctrl-1 = <&i2c0_sleep>; - pinctrl-names = "default", "sleep"; -}; - -arduino_spi: &spi0 { - compatible = "nordic,nrf-spim"; - /* Cannot be used together with uart0. */ - /* status = "okay"; */ - cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */ - pinctrl-0 = <&spi0_default>; - pinctrl-1 = <&spi0_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&flash1 { - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0xc000>; - }; - slot0_partition: partition@c000 { - label = "image-0"; - reg = <0x0000C000 0x12000>; - }; - slot1_partition: partition@1e000 { - label = "image-1"; - reg = <0x0001E000 0x12000>; - }; - scratch_partition: partition@30000 { - label = "image-scratch"; - reg = <0x00030000 0xa000>; - }; - storage_partition: partition@3a000 { - label = "storage"; - reg = <0x0003a000 0x6000>; - }; - }; -}; - -/* Include shared RAM configuration file */ -#include "nrf5340_nrf7001_shared_sram_planning_conf.dtsi" diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_nrf7001.yaml b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_nrf7001.yaml deleted file mode 100644 index aab6e826591e..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_nrf7001.yaml +++ /dev/null @@ -1,13 +0,0 @@ -identifier: nrf7002dk/nrf5340/cpunet/nrf7001 -name: NRF7002-DK-NRF7001-NRF5340-network-MCU -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 64 -flash: 256 -supported: - - gpio - - watchdog diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_nrf7001_defconfig b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_nrf7001_defconfig deleted file mode 100644 index 9d05078d7af7..000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet_nrf7001_defconfig +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2023 Nordic Semiconductor ASA -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -# Enable MPU -CONFIG_ARM_MPU=y - -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - -# enable GPIO -CONFIG_GPIO=y - -# enable PINCTRL -CONFIG_PINCTRL=y - -# Enable uart driver -CONFIG_SERIAL=y - -# enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y diff --git a/boards/nordic/nrf7002dk/pre_dt_board.cmake b/boards/nordic/nrf7002dk/pre_dt_board.cmake deleted file mode 100644 index 69136ab35076..000000000000 --- a/boards/nordic/nrf7002dk/pre_dt_board.cmake +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2022 Nordic Semiconductor ASA -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -# Suppress "unique_unit_address_if_enabled" to handle the following overlaps: -# - flash-controller@39000 & kmu@39000 -# - power@5000 & clock@5000 -# - /reserved-memory/image@20000000 & /reserved-memory/image_s@20000000 -list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") From 274e61d264d49d0d70ec91ec5e3a02a7d939a273 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 6 Aug 2024 01:56:22 +0530 Subject: [PATCH 08/25] manifest: Pull in dependent changes for nRF70 upstream These changes are necessary for migration of nRF70 to upstream. Signed-off-by: Chaitanya Tata --- west.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/west.yml b/west.yml index 705b97c19fe5..be04754283c7 100644 --- a/west.yml +++ b/west.yml @@ -72,7 +72,7 @@ manifest: # https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/modules.html - name: zephyr repo-path: sdk-zephyr - revision: 8bd088c7c2936dbc94eddd5ede980d45a341e73d + revision: pull/1939/head import: # In addition to the zephyr repository itself, NCS also # imports the contents of zephyr/west.yml at the above @@ -149,7 +149,7 @@ manifest: - name: nrfxlib repo-path: sdk-nrfxlib path: nrfxlib - revision: 8f5ca6fee77c5572e3a6583981a3016efc06a794 + revision: pull/1424/head - name: trusted-firmware-m repo-path: sdk-trusted-firmware-m path: modules/tee/tf-m/trusted-firmware-m @@ -161,7 +161,7 @@ manifest: - name: matter repo-path: sdk-connectedhomeip path: modules/lib/matter - revision: b6d6e9a8885ce8390e1847e7a986ecbbdcbc277d + revision: pull/469/head west-commands: scripts/west/west-commands.yml submodules: - name: nlio From c4712eb75ea8501d43d77cac861d344971209bac Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 6 Aug 2024 02:02:06 +0530 Subject: [PATCH 09/25] treewide: Fix CMake warning for nRF70 driver heap nRF70 driver is the primary user for kernel heap and already sets a higher value which is typical, but for some configurations e.g., scan-only we need to set it to lower value to optimize memory, so, enable the option to ignore minimum mandated value from driver and instead use the value from the sample. Signed-off-by: Chaitanya Tata --- .../asset_tracker_v2/overlay-nrf7002ek-wifi-scan-only.conf | 1 + samples/cellular/location/overlay-nrf700x-wifi-scan-only.conf | 1 + samples/cellular/lwm2m_client/overlay-assist-wifi.conf | 1 + samples/cellular/modem_shell/overlay-nrf700x-wifi-scan-only.conf | 1 + .../overlay-nrf7002ek-wifi-scan-only.conf | 1 + .../overlay_nrf7002ek_wifi_coap_no_lte.conf | 1 + .../nrf_cloud_multi_service/overlay_nrf7002ek_wifi_no_lte.conf | 1 + samples/wifi/provisioning/softap/prj.conf | 1 + samples/wifi/radio_test/prj.conf | 1 + samples/wifi/scan/prj.conf | 1 + samples/wifi/shell/overlay-scan-only.conf | 1 + samples/wifi/shell/prj.conf | 1 + samples/wifi/shutdown/prj.conf | 1 + samples/wifi/sta/prj.conf | 1 + samples/wifi/throughput/prj.conf | 1 + 15 files changed, 15 insertions(+) diff --git a/applications/asset_tracker_v2/overlay-nrf7002ek-wifi-scan-only.conf b/applications/asset_tracker_v2/overlay-nrf7002ek-wifi-scan-only.conf index 92bda281627b..f7ffc98a2cb0 100644 --- a/applications/asset_tracker_v2/overlay-nrf7002ek-wifi-scan-only.conf +++ b/applications/asset_tracker_v2/overlay-nrf7002ek-wifi-scan-only.conf @@ -35,6 +35,7 @@ CONFIG_LOCATION_METHOD_WIFI_SCANNING_RESULTS_MAX_CNT=20 CONFIG_LOCATION_WORKQUEUE_STACK_SIZE=8192 # Needed to handle more scan results CONFIG_HEAP_MEM_POOL_SIZE=60000 +CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y # Not for LTE throughput testing CONFIG_NRF_MODEM_LIB_SHMEM_TX_SIZE=4096 diff --git a/samples/cellular/location/overlay-nrf700x-wifi-scan-only.conf b/samples/cellular/location/overlay-nrf700x-wifi-scan-only.conf index 84c9d09ca697..5a62d5af5d67 100644 --- a/samples/cellular/location/overlay-nrf700x-wifi-scan-only.conf +++ b/samples/cellular/location/overlay-nrf700x-wifi-scan-only.conf @@ -66,3 +66,4 @@ CONFIG_NET_MGMT_EVENT_STACK_SIZE=1024 # Heap allocation should be changed when CONFIG_LOCATION_METHOD_WIFI_SCANNING_RESULTS_MAX_CNT # and CONFIG_NRF_WIFI_SCAN_MAX_BSS_CNT (which should be the same value) are changed. CONFIG_HEAP_MEM_POOL_SIZE=40000 +CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y diff --git a/samples/cellular/lwm2m_client/overlay-assist-wifi.conf b/samples/cellular/lwm2m_client/overlay-assist-wifi.conf index 4b9dd361718b..e197ee2f00fd 100644 --- a/samples/cellular/lwm2m_client/overlay-assist-wifi.conf +++ b/samples/cellular/lwm2m_client/overlay-assist-wifi.conf @@ -29,6 +29,7 @@ CONFIG_LWM2M_RW_SENML_CBOR_RECORDS=40 # Needed to handle more scan results CONFIG_HEAP_MEM_POOL_SIZE=60000 +CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y # Does not work with buttons&LEDs CONFIG_APP_PUSH_BUTTON=n diff --git a/samples/cellular/modem_shell/overlay-nrf700x-wifi-scan-only.conf b/samples/cellular/modem_shell/overlay-nrf700x-wifi-scan-only.conf index 5626ecf5248b..7075101ff748 100644 --- a/samples/cellular/modem_shell/overlay-nrf700x-wifi-scan-only.conf +++ b/samples/cellular/modem_shell/overlay-nrf700x-wifi-scan-only.conf @@ -84,3 +84,4 @@ CONFIG_NET_MGMT_EVENT_STACK_SIZE=1024 # and CONFIG_NRF_WIFI_SCAN_MAX_BSS_CNT (which should be the same value) are changed. # In modem shell, it looks like 10 APs requires ~4500 bytes to give some rough numbers. CONFIG_HEAP_MEM_POOL_SIZE=40000 +CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y diff --git a/samples/cellular/nrf_cloud_multi_service/overlay-nrf7002ek-wifi-scan-only.conf b/samples/cellular/nrf_cloud_multi_service/overlay-nrf7002ek-wifi-scan-only.conf index ab2b0845cd28..896c1a6d47cb 100644 --- a/samples/cellular/nrf_cloud_multi_service/overlay-nrf7002ek-wifi-scan-only.conf +++ b/samples/cellular/nrf_cloud_multi_service/overlay-nrf7002ek-wifi-scan-only.conf @@ -35,6 +35,7 @@ CONFIG_MBEDTLS=n # Heap allocation should be changed when CONFIG_LOCATION_METHOD_WIFI_SCANNING_RESULTS_MAX_CNT # and CONFIG_NRF_WIFI_SCAN_MAX_BSS_CNT (which should be the same value) are changed. CONFIG_HEAP_MEM_POOL_SIZE=40000 +CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y CONFIG_MAIN_STACK_SIZE=2048 CONFIG_NET_MGMT_EVENT_STACK_SIZE=2048 diff --git a/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_coap_no_lte.conf b/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_coap_no_lte.conf index c5d06fd0f004..dc0ec7a79eb9 100644 --- a/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_coap_no_lte.conf +++ b/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_coap_no_lte.conf @@ -153,6 +153,7 @@ CONFIG_NRF_WIFI_SCAN_MAX_BSS_CNT=10 CONFIG_LOCATION_METHOD_WIFI_SCANNING_RESULTS_MAX_CNT=10 # Add 256 bytes for each additional scanning result, assuming sane SSID lengths CONFIG_HEAP_MEM_POOL_SIZE=138000 +CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y ## Miscellaneous resource allocation tweaks needed to support Wi-Fi. CONFIG_MAIN_STACK_SIZE=2048 diff --git a/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_no_lte.conf b/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_no_lte.conf index 2fd7e3bb6a33..cce446e04efc 100644 --- a/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_no_lte.conf +++ b/samples/cellular/nrf_cloud_multi_service/overlay_nrf7002ek_wifi_no_lte.conf @@ -151,6 +151,7 @@ CONFIG_NRF_WIFI_SCAN_MAX_BSS_CNT=20 CONFIG_LOCATION_METHOD_WIFI_SCANNING_RESULTS_MAX_CNT=20 # Add 256 bytes for each additional scanning result, assuming sane SSID lengths CONFIG_HEAP_MEM_POOL_SIZE=138000 +CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y ## Miscellaneous resource allocation tweaks needed to support Wi-Fi. CONFIG_MAIN_STACK_SIZE=2048 diff --git a/samples/wifi/provisioning/softap/prj.conf b/samples/wifi/provisioning/softap/prj.conf index 0afc370f8ff7..9c79237a3ab5 100644 --- a/samples/wifi/provisioning/softap/prj.conf +++ b/samples/wifi/provisioning/softap/prj.conf @@ -11,6 +11,7 @@ CONFIG_PM_PARTITION_SIZE_TFM=0x1c000 # Optimize Wi-Fi stack to save some memory. CONFIG_HEAP_MEM_POOL_SIZE=81920 +CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y CONFIG_NRF70_RX_NUM_BUFS=16 CONFIG_NRF70_MAX_TX_AGGREGATION=4 diff --git a/samples/wifi/radio_test/prj.conf b/samples/wifi/radio_test/prj.conf index efc2ad3aeca1..00a4d3a310bf 100644 --- a/samples/wifi/radio_test/prj.conf +++ b/samples/wifi/radio_test/prj.conf @@ -14,6 +14,7 @@ CONFIG_MAIN_STACK_SIZE=4096 CONFIG_SHELL_STACK_SIZE=4096 #64K memory needed for IQ sample captures. CONFIG_HEAP_MEM_POOL_SIZE=98304 +CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y # Debugging diff --git a/samples/wifi/scan/prj.conf b/samples/wifi/scan/prj.conf index 6e505f55db7a..ab298fb55477 100644 --- a/samples/wifi/scan/prj.conf +++ b/samples/wifi/scan/prj.conf @@ -7,6 +7,7 @@ CONFIG_WIFI=y CONFIG_WIFI_NRF70=y CONFIG_NET_L2_WIFI_MGMT=y CONFIG_HEAP_MEM_POOL_SIZE=25000 +CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y # System settings CONFIG_ASSERT=y diff --git a/samples/wifi/shell/overlay-scan-only.conf b/samples/wifi/shell/overlay-scan-only.conf index c4fe84c8dbac..7e7055ef91d6 100644 --- a/samples/wifi/shell/overlay-scan-only.conf +++ b/samples/wifi/shell/overlay-scan-only.conf @@ -20,3 +20,4 @@ CONFIG_NET_PKT_RX_COUNT=1 CONFIG_NET_PKT_TX_COUNT=1 # Needed to handle more scan results CONFIG_HEAP_MEM_POOL_SIZE=25000 +CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y diff --git a/samples/wifi/shell/prj.conf b/samples/wifi/shell/prj.conf index 2ddc27f51a35..6fdfc216603c 100644 --- a/samples/wifi/shell/prj.conf +++ b/samples/wifi/shell/prj.conf @@ -37,6 +37,7 @@ CONFIG_NRF70_RX_NUM_BUFS=16 CONFIG_NRF70_MAX_TX_AGGREGATION=4 # nRF700x is main consumer: (16 + 8) * 1600 = ~40KB + ~40KB control path (experimental) CONFIG_HEAP_MEM_POOL_SIZE=80000 +CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y CONFIG_NET_TC_TX_COUNT=1 CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=4 diff --git a/samples/wifi/shutdown/prj.conf b/samples/wifi/shutdown/prj.conf index bf679a42c729..0c6221a0ce79 100644 --- a/samples/wifi/shutdown/prj.conf +++ b/samples/wifi/shutdown/prj.conf @@ -7,6 +7,7 @@ CONFIG_WIFI=y CONFIG_WIFI_NRF70=y CONFIG_NET_L2_WIFI_MGMT=y CONFIG_HEAP_MEM_POOL_SIZE=25000 +CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y # Networking CONFIG_NETWORKING=y diff --git a/samples/wifi/sta/prj.conf b/samples/wifi/sta/prj.conf index 2ca89df28be8..fe5a28fff88d 100644 --- a/samples/wifi/sta/prj.conf +++ b/samples/wifi/sta/prj.conf @@ -36,6 +36,7 @@ CONFIG_NET_BUF_TX_COUNT=16 CONFIG_NET_BUF_DATA_SIZE=128 CONFIG_NRF70_RX_NUM_BUFS=16 CONFIG_HEAP_MEM_POOL_SIZE=90000 +CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y CONFIG_NET_TC_TX_COUNT=1 CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=1 diff --git a/samples/wifi/throughput/prj.conf b/samples/wifi/throughput/prj.conf index 2d643de7d57d..2924f762ea08 100644 --- a/samples/wifi/throughput/prj.conf +++ b/samples/wifi/throughput/prj.conf @@ -39,6 +39,7 @@ CONFIG_NRF70_RX_NUM_BUFS=16 CONFIG_NRF70_MAX_TX_AGGREGATION=4 # nRF700x is main consumer: (16 + 8) * 1600 = ~40KB + ~40KB control path (experimental) CONFIG_HEAP_MEM_POOL_SIZE=80000 +CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y CONFIG_NET_TC_TX_COUNT=1 CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=4 From f4cf5c5b89273627a581df1bd9aa5b33115f533e Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 7 Aug 2024 00:48:17 +0530 Subject: [PATCH 10/25] samples: wifi: shell: Increase kernel heap nRF70 upstream driver now needs more heap, not sure about the cause, but without this OOM messages during boot are seen. Signed-off-by: Chaitanya Tata --- samples/wifi/shell/prj.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/wifi/shell/prj.conf b/samples/wifi/shell/prj.conf index 6fdfc216603c..782265df1769 100644 --- a/samples/wifi/shell/prj.conf +++ b/samples/wifi/shell/prj.conf @@ -36,7 +36,7 @@ CONFIG_NET_BUF_DATA_SIZE=128 CONFIG_NRF70_RX_NUM_BUFS=16 CONFIG_NRF70_MAX_TX_AGGREGATION=4 # nRF700x is main consumer: (16 + 8) * 1600 = ~40KB + ~40KB control path (experimental) -CONFIG_HEAP_MEM_POOL_SIZE=80000 +CONFIG_HEAP_MEM_POOL_SIZE=90000 CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y CONFIG_NET_TC_TX_COUNT=1 From b7b8ac6325bbd96f3d945337b6232c6a68e0f6c9 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 7 Aug 2024 13:26:28 +0530 Subject: [PATCH 11/25] migration: Add notes for nRF70 upstream switch Document changes that affect customer samples or applications. Signed-off-by: Chaitanya Tata --- .../migration/migration_guide_2.8.rst | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/doc/nrf/releases_and_maturity/migration/migration_guide_2.8.rst b/doc/nrf/releases_and_maturity/migration/migration_guide_2.8.rst index a43fb6f1aac6..d5b88d0c046b 100644 --- a/doc/nrf/releases_and_maturity/migration/migration_guide_2.8.rst +++ b/doc/nrf/releases_and_maturity/migration/migration_guide_2.8.rst @@ -53,6 +53,29 @@ Serial LTE Modem (SLM) * ``AT#XSOCKETOPT=1,53,`` with ``AT#XSOCKETOPT=1,61,4`` to indicate ``RAI_ONGOING``. * ``AT#XSOCKETOPT=1,54,`` with ``AT#XSOCKETOPT=1,61,5`` to indicate ``RAI_WAIT_MORE``. +nRF70 Series +------------ + +.. toggle:: + + * The nRF70 Series support is now part of Zephyr upstream and it requires the following changes: + + * The nRF70 Series driver namespace has been renamed from ``NRF700X`` to ``NRF70``. + For example, ``CONFIG_NRF700X_RAW_DATA_RX`` to ``CONIFG_NRF70_RAW_DATA_RX``. + Update your application configurations to use the new namespace. + * The nRF70 Series driver now uses per-module kernel heap with a higher default. + If a sample or an application uses the kernel heap but uses less than the default size, a build warning is displayed. + Use the :kconfig:option:`CONFIG_HEAP_MEM_POOL_IGNORE_MIN` Kconfig option and enable it to suppress the warning. + + * The WPA supplicant is also now part of Zephy upstream and it requires the following changes: + + * The WPA supplicant namespace has been renamed from ``WPA_SUPP`` to ``WIFI_NM_WPA_SUPPLICANT``. + For example, ``CONFIG_WPA_SUPP=y`` to ``CONFIG_WIFI_NM_WPA_SUPPLICANT=y``. + Update your application configurations to use the new namespace. + + * The SR co-existence feature should now be explicitly enabled using the :kconfig:option:`CONFIG_NRF70_SR_COEX` Kconfig option. + The RF switch feature should be enabled using the :kconfig:option:`CONFIG_NRF70_SR_COEX_RF_SWITCH` Kconfig option. + Libraries ========= From 309d90ff4b4d48d84a0490372931b84bbc364b35 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 9 Aug 2024 18:40:10 +0530 Subject: [PATCH 12/25] doc: changelog: Update with upstream migration Update Drivers, Wi-Fi protocols and documentation with notes about upstream migration. Signed-off-by: Chaitanya Tata --- .../releases/release-notes-changelog.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst b/doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst index 70ba3febe5dd..be689c7b8c04 100644 --- a/doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst +++ b/doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst @@ -180,7 +180,7 @@ Zigbee Wi-Fi ----- -|no_changes_yet_note| +* The WPA supplicant is now switched to Zephyr upstream's fork instead of |NCS|. Applications ============ @@ -490,7 +490,7 @@ This section provides detailed lists of changes by :ref:`driver `. Wi-Fi drivers ------------- -|no_changes_yet_note| +* nRF70 Series Wi-Fi driver is upstreamed to Zephyr, so, removed from the |NCS|. Libraries ========= @@ -824,6 +824,7 @@ Documentation * Removed the Device configuration guides section and moved its contents to :ref:`ug_app_dev`. * The Advanced building procedures page and moved its contents to the :ref:`building` page. + * nRF70 Series support is upstreamed to Zephyr, hence the documentation is removed from the |NCS|. * Updated: From baa841dc23654f7c8f8da98e3b4f6ef74bbcf737 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Sun, 11 Aug 2024 21:39:05 +0530 Subject: [PATCH 13/25] treewide: Use nRF7000 for scan only With latest upstream, scan only mode now only works with nRF7000. Signed-off-by: Chaitanya Tata --- applications/asset_tracker_v2/sample.yaml | 8 ++-- samples/cellular/location/sample.yaml | 16 +------ samples/cellular/modem_shell/sample.yaml | 30 ++++--------- .../nrf_cloud_multi_service/sample.yaml | 4 +- samples/wifi/scan/sample.yaml | 44 +++---------------- 5 files changed, 21 insertions(+), 81 deletions(-) diff --git a/applications/asset_tracker_v2/sample.yaml b/applications/asset_tracker_v2/sample.yaml index 879dfbc71298..cd5132b22229 100644 --- a/applications/asset_tracker_v2/sample.yaml +++ b/applications/asset_tracker_v2/sample.yaml @@ -328,7 +328,7 @@ tests: integration_platforms: - nrf9160dk/nrf9160/ns platform_allow: nrf9160dk/nrf9160/ns - extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE=overlay-nrf7002ek-wifi-scan-only.conf + extra_args: SHIELD=nrf7002ek_nrf7000 EXTRA_CONF_FILE=overlay-nrf7002ek-wifi-scan-only.conf SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_applications_asset_tracker_v2 applications.asset_tracker_v2.nrf7002ek_wifi.nrf9161dk: @@ -337,7 +337,7 @@ tests: integration_platforms: - nrf9161dk/nrf9161/ns platform_allow: nrf9161dk/nrf9161/ns - extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE=overlay-nrf7002ek-wifi-scan-only.conf + extra_args: SHIELD=nrf7002ek_nrf7000 EXTRA_CONF_FILE=overlay-nrf7002ek-wifi-scan-only.conf SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_applications_asset_tracker_v2 applications.asset_tracker_v2.nrf7002ek_wifi.nrf9151dk: @@ -346,7 +346,7 @@ tests: integration_platforms: - nrf9151dk/nrf9151/ns platform_allow: nrf9151dk/nrf9151/ns - extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE=overlay-nrf7002ek-wifi-scan-only.conf + extra_args: SHIELD=nrf7002ek_nrf7000 EXTRA_CONF_FILE=overlay-nrf7002ek-wifi-scan-only.conf SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_applications_asset_tracker_v2 applications.asset_tracker_v2.nrf7002ek_wifi-debug: @@ -360,7 +360,7 @@ tests: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns - nrf9151dk/nrf9151/ns - extra_args: SHIELD=nrf7002ek + extra_args: SHIELD=nrf7002ek_nrf7000 EXTRA_CONF_FILE="overlay-nrf7002ek-wifi-scan-only.conf;overlay-debug.conf" SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_applications_asset_tracker_v2 diff --git a/samples/cellular/location/sample.yaml b/samples/cellular/location/sample.yaml index fd87d9bfe11f..746e1c0932ca 100644 --- a/samples/cellular/location/sample.yaml +++ b/samples/cellular/location/sample.yaml @@ -41,7 +41,7 @@ tests: - nrf9151dk/nrf9151/ns - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns - extra_args: SHIELD=nrf7002ek OVERLAY_CONFIG=overlay-nrf700x-wifi-scan-only.conf + extra_args: SHIELD=nrf7002ek_nrf7000 OVERLAY_CONFIG=overlay-nrf700x-wifi-scan-only.conf SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.location.nrf7000ek_wifi: @@ -59,20 +59,6 @@ tests: CONFIG_WIFI_NM_WPA_SUPPLICANT=n SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular - sample.cellular.location.nrf7001ek_wifi: - sysbuild: true - build_only: true - integration_platforms: - - nrf9151dk/nrf9151/ns - - nrf9160dk/nrf9160/ns - - nrf9161dk/nrf9161/ns - platform_allow: - - nrf9151dk/nrf9151/ns - - nrf9160dk/nrf9160/ns - - nrf9161dk/nrf9161/ns - extra_args: SHIELD=nrf7002ek_nrf7001 OVERLAY_CONFIG=overlay-nrf700x-wifi-scan-only.conf - SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y - tags: ci_build sysbuild ci_samples_cellular sample.cellular.location.thingy91x_wifi: sysbuild: true build_only: true diff --git a/samples/cellular/modem_shell/sample.yaml b/samples/cellular/modem_shell/sample.yaml index 299c1928fbf3..a8e912d5e5f1 100644 --- a/samples/cellular/modem_shell/sample.yaml +++ b/samples/cellular/modem_shell/sample.yaml @@ -95,7 +95,7 @@ tests: - nrf9151dk/nrf9151/ns - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns - extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf + extra_args: SHIELD=nrf7002ek_nrf7000 EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.modem_shell.nrf7000ek_wifi: @@ -113,20 +113,6 @@ tests: CONFIG_WIFI_NM_WPA_SUPPLICANT=n SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular - sample.cellular.modem_shell.nrf7001ek_wifi: - sysbuild: true - build_only: true - integration_platforms: - - nrf9151dk/nrf9151/ns - - nrf9160dk/nrf9160/ns - - nrf9161dk/nrf9161/ns - platform_allow: - - nrf9151dk/nrf9151/ns - - nrf9160dk/nrf9160/ns - - nrf9161dk/nrf9161/ns - extra_args: SHIELD=nrf7002ek_nrf7001 EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf - SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y - tags: ci_build sysbuild ci_samples_cellular sample.cellular.modem_shell.nrf7002ek_wifi-debug: sysbuild: true build_only: true @@ -138,7 +124,7 @@ tests: - nrf9151dk/nrf9151/ns - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns - extra_args: SHIELD=nrf7002ek + extra_args: SHIELD=nrf7002ek_nrf7000 EXTRA_CONF_FILE="overlay-nrf700x-wifi-scan-only.conf;overlay-debug.conf" SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular @@ -269,7 +255,7 @@ tests: extra_configs: - CONFIG_LOCATION_SERVICE_EXTERNAL=y - CONFIG_NRF_CLOUD_PGPS_TRANSPORT_NONE=y - extra_args: SHIELD=nrf7002ek + extra_args: SHIELD=nrf7002ek_nrf7000 EXTRA_CONF_FILE="overlay-cloud_mqtt.conf;overlay-pgps.conf;overlay-nrf700x-wifi-scan-only.conf" SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y integration_platforms: @@ -381,7 +367,7 @@ tests: - CONFIG_LOCATION_METHOD_GNSS=y - CONFIG_LOCATION_METHOD_CELLULAR=n - CONFIG_LOCATION_METHOD_WIFI=y - extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf + extra_args: SHIELD=nrf7002ek_nrf7000 EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.modem_shell.location_wifi_cellular_no_gnss: @@ -399,7 +385,7 @@ tests: - CONFIG_LOCATION_METHOD_GNSS=n - CONFIG_LOCATION_METHOD_CELLULAR=y - CONFIG_LOCATION_METHOD_WIFI=y - extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf + extra_args: SHIELD=nrf7002ek_nrf7000 EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.modem_shell.location_wifi_no_cellular_no_gnss: @@ -417,7 +403,7 @@ tests: - CONFIG_LOCATION_METHOD_GNSS=n - CONFIG_LOCATION_METHOD_CELLULAR=n - CONFIG_LOCATION_METHOD_WIFI=y - extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf + extra_args: SHIELD=nrf7002ek_nrf7000 EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.modem_shell.location_gnss_no_wifi_no_cellular: @@ -470,7 +456,7 @@ tests: - CONFIG_LOCATION_METHOD_GNSS=y - CONFIG_LOCATION_METHOD_CELLULAR=y - CONFIG_LOCATION_METHOD_WIFI=y - extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf + extra_args: SHIELD=nrf7002ek_nrf7000 EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.modem_shell.location_gnss_no_wifi_no_cellular_details: @@ -506,7 +492,7 @@ tests: - CONFIG_LOCATION_METHOD_GNSS=n - CONFIG_LOCATION_METHOD_CELLULAR=y - CONFIG_LOCATION_METHOD_WIFI=y - extra_args: SHIELD=nrf7002ek EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf + extra_args: SHIELD=nrf7002ek_nrf7000 EXTRA_CONF_FILE=overlay-nrf700x-wifi-scan-only.conf SB_CONFIG_WIFI_NRF70=y SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y tags: ci_build sysbuild ci_samples_cellular sample.cellular.modem_shell.location_gnss_cellular_no_wifi_details: diff --git a/samples/cellular/nrf_cloud_multi_service/sample.yaml b/samples/cellular/nrf_cloud_multi_service/sample.yaml index 338f3f47d5b8..8522e71c880a 100644 --- a/samples/cellular/nrf_cloud_multi_service/sample.yaml +++ b/samples/cellular/nrf_cloud_multi_service/sample.yaml @@ -84,7 +84,7 @@ tests: - nrf9151dk/nrf9151/ns - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns - extra_args: nrf_cloud_multi_service_SHIELD=nrf7002ek + extra_args: nrf_cloud_multi_service_SHIELD=nrf7002ek_nrf7000 EXTRA_CONF_FILE="overlay-nrf7002ek-wifi-scan-only.conf" SB_CONF_FILE="sysbuild_nrf700x-wifi-scan.conf" tags: ci_build sysbuild ci_samples_cellular @@ -94,7 +94,7 @@ tests: integration_platforms: - nrf5340dk/nrf5340/cpuapp/ns platform_allow: nrf5340dk/nrf5340/cpuapp/ns - extra_args: nrf_cloud_multi_service_SHIELD=nrf7002ek + extra_args: nrf_cloud_multi_service_SHIELD=nrf7002ek_nrf7000 EXTRA_CONF_FILE="overlay_nrf7002ek_wifi_no_lte.conf" SB_CONF_FILE="sysbuild_nrf700x-wifi-conn.conf" tags: ci_build sysbuild ci_samples_cellular diff --git a/samples/wifi/scan/sample.yaml b/samples/wifi/scan/sample.yaml index e4bcbca6d385..e6149a200652 100644 --- a/samples/wifi/scan/sample.yaml +++ b/samples/wifi/scan/sample.yaml @@ -3,25 +3,10 @@ sample: application name: Wi-Fi scan tests: - sample.nrf7002.scan: - sysbuild: true - build_only: true - integration_platforms: - - nrf7002dk/nrf5340/cpuapp - platform_allow: nrf7002dk/nrf5340/cpuapp - tags: ci_build sysbuild ci_samples_wifi - sample.nrf7001.scan: - sysbuild: true - build_only: true - integration_platforms: - - nrf7002dk/nrf5340/cpuapp/nrf7001 - platform_allow: nrf7002dk/nrf5340/cpuapp/nrf7001 - tags: ci_build sysbuild ci_samples_wifi - skip: true - sample.nrf7002_eks.scan: + sample.nrf7000_eks.scan: sysbuild: true build_only: true - extra_args: SHIELD=nrf7002ek + extra_args: SHIELD=nrf7002ek_nrf7000 integration_platforms: - nrf5340dk/nrf5340/cpuapp - nrf52840dk/nrf52840 @@ -33,10 +18,10 @@ tests: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns tags: ci_build sysbuild ci_samples_wifi - sample.nrf7002_eks.raw_scan: + sample.nrf7000_eks.raw_scan: sysbuild: true build_only: true - extra_args: SHIELD=nrf7002ek CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS=y + extra_args: SHIELD=nrf7002ek_nrf7000 CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS=y integration_platforms: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns @@ -45,24 +30,6 @@ tests: - nrf9161dk/nrf9161/ns - nrf9151dk/nrf9151/ns tags: ci_build sysbuild ci_samples_wifi - sample.nrf7000_eks.scan: - sysbuild: true - build_only: true - extra_args: SHIELD=nrf7002ek_nrf7000 CONFIG_WIFI_NM_WPA_SUPPLICANT=n - integration_platforms: - - nrf9160dk/nrf9160/ns - platform_allow: nrf9160dk/nrf9160/ns - tags: ci_build sysbuild ci_samples_wifi - sample.nrf7001_eks.scan: - sysbuild: true - build_only: true - extra_args: SHIELD=nrf7002ek_nrf7001 - integration_platforms: - - nrf5340dk/nrf5340/cpuapp - - nrf52840dk/nrf52840 - - nrf9160dk/nrf9160/ns - platform_allow: nrf5340dk/nrf5340/cpuapp nrf52840dk/nrf52840 nrf9160dk/nrf9160/ns - tags: ci_build sysbuild ci_samples_wifi sample.nrf7002_eb.thingy53.scan: sysbuild: true build_only: true @@ -71,8 +38,9 @@ tests: - thingy53/nrf5340/cpuapp platform_allow: thingy53/nrf5340/cpuapp tags: ci_build sysbuild ci_samples_wifi - sample.thingy91x_nrf7002.scan: + sample.thingy91x_nrf7000.scan: sysbuild: true build_only: true platform_allow: thingy91x/nrf9151/ns + extra_args: SHIELD=nrf7002ek_nrf7000 tags: ci_build sysbuild ci_samples_wifi From 918f41ff74b085a89cc7ee93e7c6afa9bbcd6ec5 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Sun, 11 Aug 2024 21:56:36 +0530 Subject: [PATCH 14/25] ci: Quarantine nRF7002 unsupported boards These are still unsupported in nRF70 upstream. Signed-off-by: Chaitanya Tata --- scripts/quarantine_integration.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/quarantine_integration.yaml b/scripts/quarantine_integration.yaml index 4080f6444c6c..25377b91d749 100644 --- a/scripts/quarantine_integration.yaml +++ b/scripts/quarantine_integration.yaml @@ -1394,3 +1394,10 @@ platforms: - thingy53/nrf5340/cpuapp/ns comment: "Configurations excluded to limit resources usage in integration builds" + +- scenarios: + - ".*nrf7002eb.*" + - ".*nrf7002_eb.*" + - ".thingy91x_nrf700.*" + - ".thingy91x_wifi.*" + comment: "nRF7002EB, Thingy91x are not support in the upstream nRF70 driver yet" From 5f2b5f9b84816691041693edd43cc3b12e2ae919 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 13 Aug 2024 19:17:43 +0530 Subject: [PATCH 15/25] manifest: tf-m: Pull fix for build with nrfx 3.6.0 Pull fix an issue with 54L and nrfx 3.6.0.i Signed-off-by: Chaitanya Tata --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index be04754283c7..bef422a59ee7 100644 --- a/west.yml +++ b/west.yml @@ -153,7 +153,7 @@ manifest: - name: trusted-firmware-m repo-path: sdk-trusted-firmware-m path: modules/tee/tf-m/trusted-firmware-m - revision: 44ba9acb4b1968b305a8eb687cfa4d80903d68b1 + revision: pull/167/head - name: psa-arch-tests repo-path: sdk-psa-arch-tests path: modules/tee/tf-m/psa-arch-tests From 20c5da668a546aa1a1424f0956bcf5b64c94933f Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 13 Aug 2024 23:28:48 +0530 Subject: [PATCH 16/25] samples: wifi: Fix Raw mode build Remove the driver header dependency and inline the structures for now, this needs to be properly fixed in the future where nRF70 driver should have public headers. Signed-off-by: Chaitanya Tata --- samples/wifi/raw_tx_packet/CMakeLists.txt | 4 --- samples/wifi/raw_tx_packet/src/main.c | 12 ++++++- samples/wifi/shell/CMakeLists.txt | 5 --- .../wifi/shell/src/wifi_raw_tx_pkt_shell.c | 34 ++++++++++++++++++- 4 files changed, 44 insertions(+), 11 deletions(-) diff --git a/samples/wifi/raw_tx_packet/CMakeLists.txt b/samples/wifi/raw_tx_packet/CMakeLists.txt index f1ed5c64315a..923f5d3e7069 100644 --- a/samples/wifi/raw_tx_packet/CMakeLists.txt +++ b/samples/wifi/raw_tx_packet/CMakeLists.txt @@ -10,10 +10,6 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(nrf_wifi_raw_tx_packet) target_include_directories(app PUBLIC ${ZEPHYR_BASE}/subsys/net/ip) -target_include_directories( - app - PRIVATE - ${ZEPHYR_BASE}/../nrfxlib/) target_sources_ifdef(CONFIG_RAW_TX_PKT_SAMPLE_CONNECTION_MODE app diff --git a/samples/wifi/raw_tx_packet/src/main.c b/samples/wifi/raw_tx_packet/src/main.c index 10f73c575396..ef6b48389b12 100644 --- a/samples/wifi/raw_tx_packet/src/main.c +++ b/samples/wifi/raw_tx_packet/src/main.c @@ -19,7 +19,6 @@ LOG_MODULE_REGISTER(raw_tx_packet, CONFIG_LOG_DEFAULT_LEVEL); #endif #include -#include #include "net_private.h" #include "wifi_connection.h" @@ -30,6 +29,7 @@ LOG_MODULE_REGISTER(raw_tx_packet, CONFIG_LOG_DEFAULT_LEVEL); #define IEEE80211_SEQ_CTRL_SEQ_NUM_MASK 0xFFF0 #define IEEE80211_SEQ_NUMBER_INC BIT(4) /* 0-3 is fragment number */ +#define NRF_WIFI_MAGIC_NUM_RAWTX 0x12345678 struct beacon { uint16_t frame_control; @@ -75,6 +75,16 @@ static struct beacon test_beacon_frame = { } }; +/* TODO: Copied from nRF70 Wi-Fi driver, need to be moved to a common place */ +struct raw_tx_pkt_header { + unsigned int magic_num; + unsigned char data_rate; + unsigned short packet_length; + unsigned char tx_mode; + unsigned char queue; + unsigned char raw_tx_flag; +}; + #ifdef CONFIG_RAW_TX_PKT_SAMPLE_NON_CONNECTED_MODE static void wifi_set_channel(void) { diff --git a/samples/wifi/shell/CMakeLists.txt b/samples/wifi/shell/CMakeLists.txt index a0230bfd1857..156aadf59ecf 100644 --- a/samples/wifi/shell/CMakeLists.txt +++ b/samples/wifi/shell/CMakeLists.txt @@ -9,11 +9,6 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(nrf_wifi_shell) -target_include_directories( - app - PRIVATE - ${ZEPHYR_BASE}/../nrfxlib/) - target_sources_ifdef(CONFIG_NRF70_RAW_DATA_TX app PRIVATE diff --git a/samples/wifi/shell/src/wifi_raw_tx_pkt_shell.c b/samples/wifi/shell/src/wifi_raw_tx_pkt_shell.c index a58d9ce5bfde..129e9b0a0ac8 100644 --- a/samples/wifi/shell/src/wifi_raw_tx_pkt_shell.c +++ b/samples/wifi/shell/src/wifi_raw_tx_pkt_shell.c @@ -16,11 +16,43 @@ LOG_MODULE_REGISTER(raw_tx_pkt, CONFIG_LOG_DEFAULT_LEVEL); #include "net_private.h" -#include #define BEACON_PAYLOAD_LENGTH 256 #define IEEE80211_SEQ_CTRL_SEQ_NUM_MASK 0xFFF0 #define IEEE80211_SEQ_NUMBER_INC BIT(4) /* 0-3 is fragment number */ +#define NRF_WIFI_MAGIC_NUM_RAWTX 0x12345678 + +/* TODO: Copied from nRF70 Wi-Fi driver, need to be moved to a common place */ + +/** + * @brief Transmit modes for raw packets. + * + */ +enum nrf_wifi_fmac_rawtx_mode { + /** Legacy mode. */ + NRF_WIFI_FMAC_RAWTX_MODE_LEGACY, + /** HT mode. */ + NRF_WIFI_FMAC_RAWTX_MODE_HT, + /** VHT mode. */ + NRF_WIFI_FMAC_RAWTX_MODE_VHT, + /** HE SU mode. */ + NRF_WIFI_FMAC_RAWTX_MODE_HE_SU, + /** HE ER SU mode. */ + NRF_WIFI_FMAC_RAWTX_MODE_HE_ER_SU, + /** HE TB mode. */ + NRF_WIFI_FMAC_RAWTX_MODE_HE_TB, + /** Throughput max. */ + NRF_WIFI_FMAC_RAWTX_MODE_MAX +}; + +struct raw_tx_pkt_header { + unsigned int magic_num; + unsigned char data_rate; + unsigned short packet_length; + unsigned char tx_mode; + unsigned char queue; + unsigned char raw_tx_flag; +}; struct raw_tx_pkt_header raw_tx_pkt; From 9a3c642ff7a807d45626e37fddd115a9b288171b Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 13 Aug 2024 23:57:01 +0530 Subject: [PATCH 17/25] samples: wifi: coex: Explicitly enable co-existence With the upstream nRF70 driver, the co-ex is not auto-enabled based on the DTS, this was implemented improperly, now user has to explicitly choose to enable co-existence. Signed-off-by: Chaitanya Tata --- samples/wifi/ble_coex/prj.conf | 2 ++ samples/wifi/provisioning/ble/prj.conf | 2 ++ 2 files changed, 4 insertions(+) diff --git a/samples/wifi/ble_coex/prj.conf b/samples/wifi/ble_coex/prj.conf index 792fede992bb..428dc6294ac1 100644 --- a/samples/wifi/ble_coex/prj.conf +++ b/samples/wifi/ble_coex/prj.conf @@ -6,6 +6,8 @@ CONFIG_WIFI=y CONFIG_WIFI_NRF70=y +CONFIG_NRF70_SR_COEX=y +CONFIG_NRF70_SR_COEX_RF_SWITCH=y # WPA supplicant CONFIG_WIFI_NM_WPA_SUPPLICANT=y diff --git a/samples/wifi/provisioning/ble/prj.conf b/samples/wifi/provisioning/ble/prj.conf index 33c9eda1fd35..6cbc451cfdca 100644 --- a/samples/wifi/provisioning/ble/prj.conf +++ b/samples/wifi/provisioning/ble/prj.conf @@ -5,6 +5,8 @@ # CONFIG_WIFI=y CONFIG_WIFI_NRF70=y +CONFIG_NRF70_SR_COEX=y +CONFIG_NRF70_SR_COEX_RF_SWITCH=y # WPA supplicant CONFIG_WIFI_NM_WPA_SUPPLICANT=y From a9b277c94b943bc420a52f38a45f124e58292e88 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 14 Aug 2024 02:06:15 +0530 Subject: [PATCH 18/25] ci: quanratine: Disable Matter for nRF7002DK Almost all matter samples rely on PM which needs EXT_FLASH support for nRF70 which isn't supported yet, so, Quarnatine them for now. Signed-off-by: Chaitanya Tata --- scripts/quarantine_integration.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/quarantine_integration.yaml b/scripts/quarantine_integration.yaml index 25377b91d749..21fbb4760b9c 100644 --- a/scripts/quarantine_integration.yaml +++ b/scripts/quarantine_integration.yaml @@ -1401,3 +1401,17 @@ - ".thingy91x_nrf700.*" - ".thingy91x_wifi.*" comment: "nRF7002EB, Thingy91x are not support in the upstream nRF70 driver yet" + +- scenarios: + - ".*matter.*" + platforms: + - nrf7002dk/nrf5340/cpuapp + - nrf7002dk/nrf5340/cpuapp/ns + - nrf7002dk/nrf5340/cpuapp/nrf7001 + - nrf7002dk/nrf5340/cpuapp/nrf7001/ns + comment: "Matter is not supported in the upstream nRF70 driver yet" + +- scenarios: + - ".*matter.*wifi.*" + - ".*matter.*bridge.*" + comment: "Matter is not supported in the upstream nRF70 driver yet" From 0ab5b1ad88fec791658819fbcdcc7ce4de49e6fa Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Sun, 18 Aug 2024 00:35:14 +0530 Subject: [PATCH 19/25] ci: Quarantine TF-M TF-M still has few build issues with nrfx 3.6.0, so, temporarily disable. Signed-off-by: Chaitanya Tata --- scripts/quarantine_integration.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/quarantine_integration.yaml b/scripts/quarantine_integration.yaml index 21fbb4760b9c..45aa36b05526 100644 --- a/scripts/quarantine_integration.yaml +++ b/scripts/quarantine_integration.yaml @@ -1415,3 +1415,7 @@ - ".*matter.*wifi.*" - ".*matter.*bridge.*" comment: "Matter is not supported in the upstream nRF70 driver yet" + +- scenarios: + - ".*tfm.*" + comment: "TF-M doesn't work with nrfx 3.6.0 yet" From 5a6367e02a282680c0c3c4126803b91564df6ccf Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Sun, 18 Aug 2024 13:41:28 +0530 Subject: [PATCH 20/25] ci: Quarantine Thingy and Wi-Fi tests Thingy is not supported yet for nRF70 companion chips. Signed-off-by: Chaitanya Tata --- scripts/quarantine_integration.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/quarantine_integration.yaml b/scripts/quarantine_integration.yaml index 45aa36b05526..9662f2dd2bb9 100644 --- a/scripts/quarantine_integration.yaml +++ b/scripts/quarantine_integration.yaml @@ -1419,3 +1419,9 @@ - scenarios: - ".*tfm.*" comment: "TF-M doesn't work with nrfx 3.6.0 yet" + +- scenarios: + - applications.asset_tracker_v2.nrf_cloud + - ".*thingy.*nrf70.*" + - ".*thingy.*wifi.*" + comment: "Thingy is not supported in the upstream nRF70 driver yet" From f0d959f9278e38c9d21a0c8f12bd12f327a4562b Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Sun, 18 Aug 2024 13:51:07 +0530 Subject: [PATCH 21/25] samples: Remove unsupported platforms from integration Though these platforms are excluded for Wi-Fi tags, twister still fails as this is still part of integration platforms, remove it to fix the twister. Signed-off-by: Chaitanya Tata --- samples/net/aws_iot/sample.yaml | 2 -- samples/net/azure_iot_hub/sample.yaml | 4 ---- samples/net/coap_client/sample.yaml | 2 -- samples/net/download/sample.yaml | 2 -- samples/net/http_server/sample.yaml | 4 ---- samples/net/https_client/sample.yaml | 2 -- samples/net/mqtt/sample.yaml | 4 ---- samples/net/udp/sample.yaml | 2 -- samples/wifi/provisioning/softap/sample.yaml | 2 -- samples/wifi/shell/sample.yaml | 6 ------ 10 files changed, 30 deletions(-) diff --git a/samples/net/aws_iot/sample.yaml b/samples/net/aws_iot/sample.yaml index ba7b33b7916d..bff98553c810 100644 --- a/samples/net/aws_iot/sample.yaml +++ b/samples/net/aws_iot/sample.yaml @@ -11,7 +11,6 @@ tests: - nrf9161dk/nrf9161/ns - nrf9151dk/nrf9151/ns - thingy91/nrf9160/ns - - nrf7002dk/nrf5340/cpuapp/ns - native_sim platform_allow: - nrf9160dk/nrf9160/ns @@ -19,5 +18,4 @@ tests: - nrf9151dk/nrf9151/ns - thingy91/nrf9160/ns - thingy91x/nrf9151/ns - - nrf7002dk/nrf5340/cpuapp/ns - native_sim diff --git a/samples/net/azure_iot_hub/sample.yaml b/samples/net/azure_iot_hub/sample.yaml index f42394ee5891..27955163bc9e 100644 --- a/samples/net/azure_iot_hub/sample.yaml +++ b/samples/net/azure_iot_hub/sample.yaml @@ -8,13 +8,11 @@ tests: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns - nrf9151dk/nrf9151/ns - - nrf7002dk/nrf5340/cpuapp/ns - native_sim platform_allow: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns - nrf9151dk/nrf9151/ns - - nrf7002dk/nrf5340/cpuapp/ns - native_sim tags: ci_build sysbuild ci_samples_net sample.net.azure_iot_hub.dps: @@ -24,12 +22,10 @@ tests: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns - nrf9151dk/nrf9151/ns - - nrf7002dk/nrf5340/cpuapp/ns platform_allow: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns - nrf9151dk/nrf9151/ns - - nrf7002dk/nrf5340/cpuapp/ns extra_args: OVERLAY_CONFIG=overlay-dps.conf extra_configs: - CONFIG_AZURE_IOT_HUB_DPS_ID_SCOPE="test-scope" diff --git a/samples/net/coap_client/sample.yaml b/samples/net/coap_client/sample.yaml index 884ba64afcab..b1e7676207f6 100644 --- a/samples/net/coap_client/sample.yaml +++ b/samples/net/coap_client/sample.yaml @@ -10,13 +10,11 @@ tests: - nrf9161dk/nrf9161/ns - nrf9151dk/nrf9151/ns - thingy91/nrf9160/ns - - nrf7002dk/nrf5340/cpuapp/ns - native_sim platform_allow: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns - nrf9151dk/nrf9151/ns - thingy91/nrf9160/ns - - nrf7002dk/nrf5340/cpuapp/ns - native_sim tags: ci_build sysbuild ci_samples_net diff --git a/samples/net/download/sample.yaml b/samples/net/download/sample.yaml index 8f269203659f..5e3e400bbb18 100644 --- a/samples/net/download/sample.yaml +++ b/samples/net/download/sample.yaml @@ -23,10 +23,8 @@ tests: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns - nrf9151dk/nrf9151/ns - - nrf7002dk/nrf5340/cpuapp/ns platform_allow: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns - nrf9151dk/nrf9151/ns - - nrf7002dk/nrf5340/cpuapp/ns tags: ci_build sysbuild ci_samples_net diff --git a/samples/net/http_server/sample.yaml b/samples/net/http_server/sample.yaml index f9eda281f0c8..039c254b97d0 100644 --- a/samples/net/http_server/sample.yaml +++ b/samples/net/http_server/sample.yaml @@ -4,15 +4,11 @@ tests: sample.net.http_server.wifi: sysbuild: true build_only: true - integration_platforms: - - nrf7002dk/nrf5340/cpuapp/ns platform_allow: nrf7002dk/nrf5340/cpuapp/ns tags: ci_build sysbuild ci_samples_net sample.net.http_server.wifi.tls: sysbuild: true build_only: true - integration_platforms: - - nrf7002dk/nrf5340/cpuapp/ns platform_allow: nrf7002dk/nrf5340/cpuapp/ns extra_args: OVERLAY_CONFIG=overlay-tls-nrf7002dk.conf tags: ci_build sysbuild ci_samples_net diff --git a/samples/net/https_client/sample.yaml b/samples/net/https_client/sample.yaml index 087335040fa1..f13e59210532 100644 --- a/samples/net/https_client/sample.yaml +++ b/samples/net/https_client/sample.yaml @@ -8,13 +8,11 @@ tests: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns - nrf9151dk/nrf9151/ns - - nrf7002dk/nrf5340/cpuapp/ns - native_sim platform_allow: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns - nrf9151dk/nrf9151/ns - - nrf7002dk/nrf5340/cpuapp/ns - native_sim tags: ci_build sysbuild ci_samples_net sample.net.https_client.lte.tfm-mbedtls: diff --git a/samples/net/mqtt/sample.yaml b/samples/net/mqtt/sample.yaml index 49f35e97a44e..57cb5354c19f 100644 --- a/samples/net/mqtt/sample.yaml +++ b/samples/net/mqtt/sample.yaml @@ -11,22 +11,18 @@ tests: - nrf9151dk/nrf9151/ns - thingy91/nrf9160/ns - thingy91x/nrf9151/ns - - nrf7002dk/nrf5340/cpuapp/ns platform_allow: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns - nrf9151dk/nrf9151/ns - thingy91/nrf9160/ns - thingy91x/nrf9151/ns - - nrf7002dk/nrf5340/cpuapp/ns - native_sim tags: ci_build sysbuild ci_samples_net sample.net.mqtt.nrf70.tls: sysbuild: true build_only: true build_on_all: true - integration_platforms: - - nrf7002dk/nrf5340/cpuapp/ns platform_allow: nrf7002dk/nrf5340/cpuapp/ns tags: ci_build sysbuild ci_samples_net extra_args: EXTRA_CONF_FILE=overlay-tls-nrf70.conf diff --git a/samples/net/udp/sample.yaml b/samples/net/udp/sample.yaml index 57d74fefa040..b423ce2bd39a 100644 --- a/samples/net/udp/sample.yaml +++ b/samples/net/udp/sample.yaml @@ -9,13 +9,11 @@ tests: - nrf9161dk/nrf9161/ns - nrf9151dk/nrf9151/ns - thingy91/nrf9160/ns - - nrf7002dk/nrf5340/cpuapp/ns platform_allow: - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns - nrf9151dk/nrf9151/ns - thingy91/nrf9160/ns - - nrf7002dk/nrf5340/cpuapp/ns tags: ci_build sysbuild ci_samples_net sample.net.udp.emulation: sysbuild: true diff --git a/samples/wifi/provisioning/softap/sample.yaml b/samples/wifi/provisioning/softap/sample.yaml index 09b0c239b3fb..8eef7714c1e8 100644 --- a/samples/wifi/provisioning/softap/sample.yaml +++ b/samples/wifi/provisioning/softap/sample.yaml @@ -4,7 +4,5 @@ tests: sample.softap.wifi.provision: sysbuild: true build_only: true - integration_platforms: - - nrf7002dk/nrf5340/cpuapp/ns platform_allow: nrf7002dk/nrf5340/cpuapp/ns tags: ci_build sysbuild ci_samples_wifi diff --git a/samples/wifi/shell/sample.yaml b/samples/wifi/shell/sample.yaml index 1ebc9f8ece92..eb7b75d27502 100644 --- a/samples/wifi/shell/sample.yaml +++ b/samples/wifi/shell/sample.yaml @@ -161,8 +161,6 @@ tests: sample.nrf7002_ns.shell: sysbuild: true build_only: true - integration_platforms: - - nrf7002dk/nrf5340/cpuapp/ns platform_allow: nrf7002dk/nrf5340/cpuapp/ns tags: sysbuild ci_samples_wifi sample.nrf7002_eb.thingy53.shell: @@ -202,8 +200,6 @@ tests: sysbuild: true build_only: true extra_args: SHIELD=nrf700x_nrf54h20dk - integration_platforms: - - nrf54h20dk/nrf54h20/cpuapp platform_allow: nrf54h20dk/nrf54h20/cpuapp tags: ci_build sysbuild ci_samples_wifi # Used by QA and also acts as a memory stress test @@ -330,8 +326,6 @@ tests: sysbuild: true build_only: true extra_args: SHIELD=nrf700x_nrf54l15pdk - integration_platforms: - - nrf54l15pdk/nrf54l15/cpuapp platform_allow: nrf54l15pdk/nrf54l15/cpuapp tags: ci_build sysbuild ci_samples_wifi sample.nrf7002.shell.psa: From 46bec8455f3692f08f43704f5e3daca342935fd2 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Sun, 18 Aug 2024 13:54:33 +0530 Subject: [PATCH 22/25] doc: Fix missing tag In latest nrfxlib this tag is removed, so, remove the reference to fix the doc build. Signed-off-by: Chaitanya Tata --- doc/nrf/releases_and_maturity/releases/release-notes-1.8.0.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/nrf/releases_and_maturity/releases/release-notes-1.8.0.rst b/doc/nrf/releases_and_maturity/releases/release-notes-1.8.0.rst index 9c925806c346..fa71e4200f48 100644 --- a/doc/nrf/releases_and_maturity/releases/release-notes-1.8.0.rst +++ b/doc/nrf/releases_and_maturity/releases/release-notes-1.8.0.rst @@ -89,6 +89,7 @@ These changes are valid for :ref:`nrfxlib:softdevice_controller`. This interface is typically implemented in the Wi-Fi products. * Experimental support for a 1-wire PTA interface for external radio coexistence for the nRF52 Series. This interface is specific to Nordic Semiconductor's nRF91 Series. + See ``nrfxlib:bluetooth_coex`` for more information. * Support for the Simple GPIO Front-End Module implementation on the nRF53 Series. Bluetooth mesh From 6aecabc4161417ebfb57910cc18e47fd73b1fcc0 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 19 Aug 2024 00:16:07 +0530 Subject: [PATCH 23/25] samples: wifi: Remove raw modes for nRF7000 As of now the raw mode is couple with system mode which is unsupported for nRF7000, so, remove them. Signed-off-by: Chaitanya Tata --- samples/wifi/monitor/sample.yaml | 9 --------- samples/wifi/raw_tx_packet/sample.yaml | 9 --------- 2 files changed, 18 deletions(-) diff --git a/samples/wifi/monitor/sample.yaml b/samples/wifi/monitor/sample.yaml index 2bfe89cc983d..af079e77d209 100644 --- a/samples/wifi/monitor/sample.yaml +++ b/samples/wifi/monitor/sample.yaml @@ -18,15 +18,6 @@ tests: - nrf5340dk/nrf5340/cpuapp platform_allow: nrf5340dk/nrf5340/cpuapp tags: ci_build sysbuild ci_samples_wifi - sample.nrf7000.monitor: - sysbuild: true - build_only: true - extra_args: - SHIELD=nrf7002ek_nrf7000 - integration_platforms: - - nrf5340dk/nrf5340/cpuapp - platform_allow: nrf5340dk/nrf5340/cpuapp - tags: ci_build sysbuild ci_samples_wifi sample.nrf7001.monitor: sysbuild: true build_only: true diff --git a/samples/wifi/raw_tx_packet/sample.yaml b/samples/wifi/raw_tx_packet/sample.yaml index 331b3de840f4..25d25db1cd9e 100644 --- a/samples/wifi/raw_tx_packet/sample.yaml +++ b/samples/wifi/raw_tx_packet/sample.yaml @@ -18,15 +18,6 @@ tests: - nrf5340dk/nrf5340/cpuapp platform_allow: nrf5340dk/nrf5340/cpuapp tags: ci_build sysbuild ci_samples_wifi - sample.nrf7000.raw_tx_packet: - sysbuild: true - build_only: true - extra_args: - SHIELD=nrf7002ek_nrf7000 - integration_platforms: - - nrf5340dk/nrf5340/cpuapp - platform_allow: nrf5340dk/nrf5340/cpuapp - tags: ci_build sysbuild ci_samples_wifi sample.nrf7001.raw_tx_packet: sysbuild: true build_only: true From b7db6f3bef78e167fa96ad8cefe40167339099ce Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 19 Aug 2024 02:05:20 +0530 Subject: [PATCH 24/25] samples: wifi: shutdown: Fix build errors Shutdown sample assumes default nRF70 mode is scan and doesn't support any other mode. With the migration to upstream scan only is limited to nRF7000 shield, so, remove other combinations. Also, add nRF7000 with 5340 as this was the main usecase for testing this sample. Signed-off-by: Chaitanya Tata --- samples/wifi/shutdown/README.rst | 8 ++++---- samples/wifi/shutdown/sample.yaml | 26 ++------------------------ 2 files changed, 6 insertions(+), 28 deletions(-) diff --git a/samples/wifi/shutdown/README.rst b/samples/wifi/shutdown/README.rst index a1d6bbb4382d..b479638f9135 100644 --- a/samples/wifi/shutdown/README.rst +++ b/samples/wifi/shutdown/README.rst @@ -50,12 +50,12 @@ Building and running .. include:: /includes/build_and_run_ns.txt -To build for the nRF7002 DK, use the ``nrf7002dk/nrf5340/cpuapp`` board target. +To build for the nRF7000 EK, use the ``nrf5340dk/nrf5340/cpuapp`` board target. The following is an example of the CLI command to demonstrate Wi-Fi shutdown: .. code-block:: console - west build -b nrf7002dk/nrf5340/cpuapp + west build -b nrf5340dk/nrf5340/cpuapp -- -DSHIELD=nrf7002ek_nrf7000 Disable auto-start of the Wi-Fi driver -------------------------------------- @@ -65,7 +65,7 @@ You can disable it by setting the :kconfig:option:`CONFIG_NRF_WIFI_IF_AUTO_START .. code-block:: console - west build -b nrf7002dk/nrf5340/cpuapp -DCONFIG_NRF_WIFI_IF_AUTO_START=n + west build -b nrf5340dk/nrf5340/cpuapp -- -DSHIELD=nrf7002ek_nrf7000 -DCONFIG_NRF_WIFI_IF_AUTO_START=n With this configuration, the Wi-Fi network interface is not automatically brought up by the Zephyr networking stack. You must press **Button 1** to bring up the Wi-Fi network interface. @@ -85,7 +85,7 @@ Testing *** Booting Zephyr OS build v3.3.99-ncs1-26-ge405279d2134 *** [00:00:00.440,460] wifi_nrf: Firmware (v1.2.8.1) booted successfully - [00:00:00.638,397] scan: Starting nrf7002dk_nrf5340_cpuapp with CPU frequency: 64 MHz + [00:00:00.638,397] scan: Starting nrf5340dk_nrf5340_cpuapp with CPU frequency: 64 MHz [00:00:00.642,608] scan: Scan requested diff --git a/samples/wifi/shutdown/sample.yaml b/samples/wifi/shutdown/sample.yaml index 6da8422ce797..2e53602dae9d 100644 --- a/samples/wifi/shutdown/sample.yaml +++ b/samples/wifi/shutdown/sample.yaml @@ -3,38 +3,16 @@ sample: application name: Wi-Fi shutdown tests: - sample.nrf7002.shutdown: - sysbuild: true - build_only: true - integration_platforms: - - nrf7002dk/nrf5340/cpuapp - platform_allow: nrf7002dk/nrf5340/cpuapp - tags: ci_build sysbuild ci_samples_wifi - sample.nrf7001.shutdown: - sysbuild: true - build_only: true - integration_platforms: - - nrf7002dk/nrf5340/cpuapp/nrf7001 - platform_allow: nrf7002dk/nrf5340/cpuapp/nrf7001 - tags: ci_build sysbuild ci_samples_wifi - skip: true - sample.nrf7002_eks.shutdown: - sysbuild: true - build_only: true - extra_args: SHIELD=nrf7002ek - integration_platforms: - - nrf5340dk/nrf5340/cpuapp - - nrf52840dk/nrf52840 - platform_allow: nrf5340dk/nrf5340/cpuapp nrf52840dk/nrf52840 - tags: ci_build sysbuild ci_samples_wifi sample.nrf7000_location.shutdown: sysbuild: true build_only: true extra_args: SHIELD=nrf7002ek_nrf7000 integration_platforms: + - nrf5340dk/nrf5340/cpuapp - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns platform_allow: + - nrf5340dk/nrf5340/cpuapp - nrf9160dk/nrf9160/ns - nrf9161dk/nrf9161/ns - nrf9151dk/nrf9151/ns From 3fcd22a32743d860abfca4ff8353e8dadec83f9c Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 22 Aug 2024 01:11:15 +0530 Subject: [PATCH 25/25] ci: quarantine: Quarantine few mysterious memory overflows These overflows are only happening in the CI, locally the same twister command works fine, quarantine them for now, and investigate later. Signed-off-by: Chaitanya Tata --- scripts/quarantine_integration.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/quarantine_integration.yaml b/scripts/quarantine_integration.yaml index 9662f2dd2bb9..9b9b4e8c4c4a 100644 --- a/scripts/quarantine_integration.yaml +++ b/scripts/quarantine_integration.yaml @@ -1425,3 +1425,13 @@ - ".*thingy.*nrf70.*" - ".*thingy.*wifi.*" comment: "Thingy is not supported in the upstream nRF70 driver yet" + +- scenarios: + - sample.cellular.modem_shell.location_service_ext_pgps_nrf7002ek_wifi + - sample.cellular.nrf7002ek_wifi.scan + - sample.cellular.nrf7002ek_wifi.conn + platforms: + - nrf9161dk/nrf9161/ns + - nrf5340dk/nrf5340/cpuapp/ns + - nrf9151dk/nrf9151/ns + comment: "Unknown failures using NS (TF-M), unable to replicate locally, temporarily excluded"