Commit graph

720 commits

Author SHA1 Message Date
Chaitanya Tata
6f7fbf8451 drivers: wifi: Fix the NULL check
Check for RPU context as well.

To fix this properly we need more fixes to be backported, but this
should suffice for now.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-10-17 09:45:34 +02:00
Chaitanya Tata
ed7c10ead3 drivers: wifi: Add quiet period for RPU recovery
This is to avoid successive recoveries in case we get successive
watchdog interrupts from the RPU.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-10-17 09:45:34 +02:00
Chaitanya Tata
ce521b89ee drivers: wifi: Ignore parallel recovery requests
During recovery we might get further watchdog interrupts causing
multiple recovery requests, ignore them if a recovery is already in
progress.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-10-17 09:45:34 +02:00
Chaitanya Tata
c1afe97e94 drivers: wifi: Increase the propogation delay
In order for the interface down to propagate and cleanup it needs more
time, using Shell 10ms was working due to human delay, but
programatically this needs higher delay.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-10-17 09:45:34 +02:00
Chaitanya Tata
1e5db78afc drivers: wifi: Add support for separate debugs for RPU recovery
These are helpful for debugging RPU recovery only.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-10-17 09:45:34 +02:00
Chaitanya Tata
a23184c473 drivers: wifi: Add a sanity check for RPU comms
Before proceeding with RPU bringup, do a sanity check by reading a known
signature to make sure the Host-RPU comms are operational.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-10-17 09:45:34 +02:00
Chaitanya Tata
04ddd6d2b0 drivers: wifi: nrf700x: Ignore all failures in iface down
In case RPU is stuck and need a recovery, the failures in interface down
should be ignored as they are expected and we should proceed with device
removal that in turn removes power to the RPU.

TODO: This works for single VIF, but needs more thought for multi-VIF.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-10-17 09:45:34 +02:00
Chaitanya Tata
5ad7339311 drivers: wifi: Fix RPU recovery not being triggered
During watchdog (or any) interrupt processing, RPU accesses are being
made and they assert the wakeup_now flag this causes RPU recovery to not
trigger.

New false or true recovery detection algo:

 Check the time difference b/w last de-assert and assert, and if it
 exceeds minimum time needed for RPU to enter sleep, then not the
 timestamp. This timestamp will be used to compare when a watchdog
 interrupt is received and see if during the last window if host has
 given a chance for RPU to attempt sleep, if yes, then attempt recovery
 else ignore watchdog.

Also, add a Kconfig for the 10s active time that triggers recovery, this
needs to be passed to the FW (once we have enough patch memory).

Also, add a Kconfig for the minimum time needed for RPU to attempt sleep
in positive case.

Also, add a new _ms API for time stamp fetch, this is to avoid
precision loss when converting to and from ms to us and also makes code
readable by avoiding *1000 and /1000.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-10-17 09:45:34 +02:00
Sylvio Alves
59f0418d2e soc: esp32: unify runtime heap usage
This commit applies several changes in the way "heap_runtime"
feature is used. It can't be split due to bisectability issues.

Whenever the feature is enabled, a new heap is created and
custom malloc/calloc/free functions are added into the build
system. Those functions are currently used for internal Wi-Fi and BLE
drivers only.

Such changes are described below:

1) Rename heap.c to esp_heap_runtime.c for better readability.
2) Rename RUNTIME_HEAP to HEAP_RUNTIME to make it similar to what is
available in Zephyr.
3) Add runtime heap to BT as such as Wi-Fi.

Fixes #79490
Fixes #79470

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-10-17 09:45:02 +02:00
Sylvio Alves
882ac1d088 drivers: esp32: wifi/bt: modify init call return error
Update both Wi-FI and BLE init codes to return proper
error code and logging when it is missing heap.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-10-17 09:45:02 +02:00
TOKITA Hiroshi
3c4789aca3 drivers: wifi: eswifi: Resolve the dependency on RING_BUFFER
`eswifi-uart` uses the ring buffer library, but the dependency is
not indicated.
Specify `select RING_BUFFER` to resolve the dependency.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2024-10-16 12:27:05 +02:00
TOKITA Hiroshi
01f4c20fdc drivers: wifi: eswifi: Specify POSIX-2008 to use strnlen()
`_POSIX_C_SOURCE` must be specified to use the `strnlen()` function
in string.h. Make sure to specify this explicitly.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2024-10-16 12:27:05 +02:00
Chaitanya Tata
cb1ea80c02 drivers: nrfwifi: Add provision to handle FW blobs externally
The FW blobs are contentious topic in OSS, so, add a provision to use
external tooling (e.g., NCS) to handle FW blobs for advanced usecases
(e.g., storing in external flash).

This won't be used upstream, only built-in or build-only are supported.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-10-16 09:57:39 +02:00
Maochen Wang
d916d7287d drivers: wifi: nxp: fix build error
Fix build error of undefined 'nxp_wifi_ret_t'.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-10-16 09:56:04 +02:00
Kapil Bhatt
28b74947e0 wifi: Add wrapper APIs for offloaded raw TX feature
Add wrapper APIs for the offloaded raw TX feature supported
by nRF70 devices.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-10-15 19:06:52 +01:00
Kapil Bhatt
5c3cc3730a drivers: nrfwifi: Create separate offloaded raw tx mode
Create separate offloaded raw tx mode which will work
as stand-alone compile-time mode.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-10-15 19:06:52 +01:00
Chaitanya Tata
b40cb4c46c drivers: nrfwifi: Use Zephyr tooling to load nRF70 FW file
Instead of relying on INCBIN macros which do not properly add
dependencies, e.g., modifying FW file doesn't trigger rebuild.

Use the Zephyr cmake tooling to load the FW patch file as a header.

This also improves memory report where the patch target is clearly
visible instead of a hidden section.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-10-15 19:04:29 +01:00
Chaitanya Tata
7f9be54897 Revert "drivers: nrfwifi: Fix rebuilding when FW blobs are changes"
This reverts commit e2e96acebf.
This will be properly fixes by adding a target for nRF70.bin and
removing INCBIN approach.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-10-15 19:04:29 +01:00
Chaitanya Tata
80db01f3bf drivers: nrfwifi: Fix random MAC address setting
Random MAC address setting can never be configured as the two defaults
cover all cases. Fix the defaults, now the order is

* Fixed
* OTP (default, in case of no config)
* Random

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-10-10 14:57:27 -04:00
Marcio Ribeiro
c20e43caaf drivers: wifi: esp32: adc2 init code calibration
Add call to adc2_init_code_calibration during wifi initialization on
esp32s2 and esp32c3

Signed-off-by: Marcio Ribeiro <marcio.ribeiro@espressif.com>
2024-10-09 09:43:58 +02:00
Chaitanya Tata
e2e96acebf drivers: nrfwifi: Fix rebuilding when FW blobs are changes
Whenever FW blobs are updated manually, we need to tell cmake to
auto-build the source files to use the latest firmware without doing a
pristine build.

This adds a custom target to be run with nRF Wi-Fi driver and updates
timestamp of fw_load.c to rebuild whenevr the blob is updated.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-10-08 16:58:52 +02:00
Chaitanya Tata
d15b7b5b3a drivers: wifi: nrf: Remove unused linker script
This script is needed only when external flash is used to store nRF70
firmware patches. This also uses PM which is supported only in NCS.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-10-08 16:58:52 +02:00
Chaitanya Tata
f20e2d68b0 drivers: wifi: Add support to override FW load
For using external flash the tooling is only available in NCS, so, use
the existing Kconfig option to override the FW loading.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-10-08 16:58:52 +02:00
Chaitanya Tata
3cd4700132 drivers: nrfwifi: Fix the indentation
The Cmake indentation is two spaces.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-10-08 16:58:52 +02:00
Raffael Rostagno
565005c27a drivers: wifi: esp32: Check blobs dependency
Checks blobs presence as dependency to allow driver build.
Goal is to avoid building in environment where blobs won't
be present (e.g GitHub CI environment).

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-09-30 16:57:50 -05:00
Gang Li
caf86128b7 drivers: wifi: nxp: add AP configuration cmd support
Implement NXP AP configuration parameter operations.

Signed-off-by: Gang Li <gang.li_1@nxp.com>
2024-09-27 10:56:57 +01:00
Bjarki Arge Andreasen
3ed1b40688 drivers: wifi: nrfwifi: determine shared iovdd and bucken from dt
Currently a user, or a shield definition, must select a Kconfig to
signal that the iovdd_ctrl and bucken GPIOs are connected to the same
pin. We can instead check this in the driver by simply checking if
the iovdd_ctrl_spec and bucken_spec are the same pin.

Update the nrfwifi driver and remove the redundant
NRF_WIFI_COMBINED_BUCKEN_IOVDD_GPIO config.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2024-09-19 18:27:36 +01:00
Pisit Sawangvonganan
a9800e2ea7 style: drivers: adjust return usage in void functions
For code clarity, this commit adjusts the use of `return` statements
in functions with a void return type as follows:
- Transform `return foo();` into separate statements:
  `foo();`
  `return;`
- Remove unnecessary `return` statements when
  they don't affect control flow.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-09-18 09:56:16 +02:00
Kapil Bhatt
be295a7f02 drivers: nrfwifi: Get RTS threshold
Add api support to get RTS threshold.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-09-13 13:42:26 +02:00
Sylvio Alves
b4117f97d3 drivers: wifi: fix esp32 build error
There is a regression caused by #76177, which
causes build to fail due to missing includes and others.
This wraps it with proper checks and fixes wifi scan call.

This also remove unused variable present in the same driver.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-09-11 20:14:07 -04:00
Pisit Sawangvonganan
847a4eaad2 style: drivers: comply with MISRA C:2012 Rule 15.6
Add missing braces to comply with MISRA C:2012 Rule 15.6 and
also following Zephyr's style guideline.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-09-11 07:40:35 -04:00
Maochen Wang
a206ab0ac3 drivers: wifi: nxp: add Kconfig to enable Wi-Fi features
Add some default Wi-Fi Kconfig for NXP driver.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-09-10 11:44:03 +02:00
Maochen Wang
55ee1ae4a9 drivers: wifi: nxp: update the correct Macro config.
For Soft-AP case, use CONFIG_WIFI_NM_HOSTAPD_AP to replace the
CONFIG_WIFI_NM_WPA_SUPPLICANT macro.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-09-10 11:44:03 +02:00
Sylvio Alves
8233b70ece espressif: clean up unused code
Remove all entries that as not being used.
This also update hal to re-enable warning flags
as such as -Wno-unused-variable.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-09-09 13:55:39 -04:00
Daniel Mangum
a80af336c2 drivers: wifi: esp_at: only log errors in active mode with full IPD
Removes constant error logging when parsing IPD headers in active mode and
waiting on remote IP and port. Currently an error message is logged for
every character in the remote IP and port until the full length obtained.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
2024-09-06 12:04:49 -05:00
Muhammad Haziq
91b688a666 driver: wifi: esp32: add APSTA support
The ESP32 Wi-Fi driver previously did not support APSTA mode,
enabling AP mode would disable STA mode and vice versa.
Support for APSTA has been added by introducing additional
network interface: one for STA (Interface 2) and one for
AP (Interface 1). The CONFIG_ESP32_WIFI_AP_STA_MODE option in
Kconfig now allows enabling or disabling this support.

Signed-off-by: Muhammad Haziq <muhammad.haziq@zintechnologies.com>
2024-09-06 11:28:15 -04:00
Daniel Mangum
126e3ee6c3 driver: wifi: esp_at: fix typo in CIPDINFO option
Fixes typo in the CIPDINFO option description.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
2024-09-05 09:49:33 +02:00
Maochen Wang
d5a5f072a9 drivers: wifi: nxp: link the library of hostap
When build with the psa_crypto_driver, it will try to include common.h
of mbedtls, but actually include the common.h from hostap, and causes
build error of undefined symbol. Now link the library of hostap to use
the header file in /utils path, to fix the build error.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-09-04 09:53:12 +02:00
Nazar Palamar
7a31df456f drivers: wifi/airoc: Update condition to enable NET_STATISTICS
Updated condition to enable NET_STATISTICS. Changed
CONFIG_NET_STATISTICS_ETHERNET to CONFIG_NET_STATISTICS_WIFI
in airoc_wifi.c

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-09-03 10:43:10 +02:00
Chaitanya Tata
803f59f3e1 drivers: wifi: nrf: Add support for twister CI build
Add a mode to build the driver without FW blobs, this is mainly for
twister to run and catch any build issues without depending on any FW
blobs.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-09-02 12:31:06 -04:00
Gang Li
e1d20235d3 drivers: wifi: nxp: change the dormant state
1) After the wifi driver successfully connects to the AP,
the dormant state should be set to OFF.
Once a deauth/disassoc frame is received or link lost occurs,
the dormant state should be set to ON.
2) Enable CONFIG_NET_TC_SKIP_FOR_HIGH_PRIO and CONFIG_NET_CONTEXT_PRIORITY
to push high priority packets directly to network driver.

Signed-off-by: Gang Li <gang.li_1@nxp.com>
2024-08-29 18:03:48 +02:00
Kapil Bhatt
6aea527c65 drivers: wifi: Add overrun count in statistics
Add overrun count in statistics. It will represent
the number of packets dropped either at received and
sent due to lack of buffer memory.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-08-28 13:59:59 -04:00
Raffael Rostagno
91f8487845 wifi: esp32c2: Add support
Added wifi support to ESP32C2 and ESP8684

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-26 14:44:37 -04:00
Valerio Setti
98ddf107fa mbedtls: rename CONFIG_MBEDTLS_ZEPHYR_ENTROPY and move it
- Slightly improve the name of this kconfig adding the suffix
  _POLL in order to highlight that this adds a callback
  function used to poll data.

- Description was also updated to point out that this symbols
  might not only use the (secure) entropy driver, but also
  generic number generators, some of which are not really
  secure.

- The symbol was move from Kconfig to Kconfig.tls-generic because
  this is where MBEDTLS_ENTROPY_C is located and since
  MBEDTLS_ENTROPY_HARDWARE_ALT depends on the former (it only
  makes sense if the entropy module is also enabled), we add
  also the "depends on".

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-08-24 07:16:51 -04:00
Chaitanya Tata
22a1846e8e drivers: wifi: Fix AP mode build
Pass the AP mode configuration based on Zephyr's Kconfig to the OS
agnostic code.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-08-22 14:23:56 -04:00
Chaitanya Tata
56055ac4a8 drivers: wifi: Fix monitor mode handling
Monitor mode relies on core Wi-Fi management functions, so, the file
should be included for both system and system with raw modes.

Fix this by adding a hidden symbol.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-08-22 14:23:56 -04:00
Chaitanya Tata
464cc9e161 drivers: wifi: Fix duplicate file inclusion
If Wi-Fi management is enabled, then independent of modes scan
functionality is always included.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-08-22 14:23:56 -04:00
Chaitanya Tata
eea8f67b91 drivers: wifi: Wait for clock divider to take effect
This is a fix from QSPI-NOR driver to wait for clock divider change to
be applied and take effect.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-08-22 14:23:56 -04:00
Chaitanya Tata
ed58af2ccd drivers: wifi: Fix QSPI clock dividers
For less than 32MHz using HFCLK192M, /2 divider should be used and only
for Anamoly159 /1 divider should be used.

Without this fix 8MHz clock in DTS uses 16MHz clock.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-08-22 14:23:56 -04:00
Kapil Bhatt
e5a665d4aa drivers: wifi: Add tx packets drop count calculation
[SHEL-1063] Add calculation of drop packets in tx due to
lack of buffer memory.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2024-08-22 14:23:56 -04:00