drivers: wifi: add Bouffalo Lab BL61x WiFi driver#109435
Conversation
|
The following west manifest projects have changed revision in this Pull Request:
Additional metadata changed:
⛔ DNM label due to: 1 project with PR revision, 1 project with metadata changes and 10 blob changes Note: This message is automatically posted and updated by the Manifest GitHub Action. |
37c9b96 to
b0649cf
Compare
There was a problem hiding this comment.
Pull request overview
Adds WiFi support for Bouffalo Lab BL616/BL618-based boards by introducing a new drivers/wifi/bflb driver that interfaces with the vendor WL80211/MACSW blobs (via a shim layer) and integrates with Zephyr’s wifi_mgmt + wifi_nm (hostap/wpa_supplicant) infrastructure. The PR also adjusts BL61x SoC/DT memory layout to reserve WiFi shared RAM, wires up blob linking/selection, and introduces build-only test coverage variants.
Changes:
- Add BL61x WiFi driver implementation (STA/AP/scan + hostap bridge) under
drivers/wifi/bflb/bl61x/. - Add BL61x WiFi platform + linker section support in
soc/bflb/bl61x/and a HAL shim for required blob entry points. - Enable WiFi device nodes and memory overlays for several BL61x boards; add build-only tests for multiple MACSW variants.
Reviewed changes
Copilot reviewed 52 out of 52 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| west.yml | Updates hal_bouffalolab module revision (currently set to a PR ref). |
| tests/net/wifi/wifi_nm/testcase.yaml | Excludes additional BL61x boards from wifi_nm tests due to blob build requirements. |
| tests/drivers/wifi/bflb/testcase.yaml | Adds build-only test matrix for the new BFLB WiFi driver and MACSW variants. |
| tests/drivers/wifi/bflb/src/main.c | Minimal build-only test application entry point. |
| tests/drivers/wifi/bflb/prj.conf | Test config enabling WiFi + networking stack for build coverage. |
| tests/drivers/wifi/bflb/CMakeLists.txt | Test CMake wiring for the build-only application. |
| soc/bflb/bl61x/wifi/bflb_wl80211_platform.c | Implements WL80211 platform hooks (MAC, heap, country, time, randomness). |
| soc/bflb/bl61x/wifi/bflb_wifi_sections.ld | Adds linker sections for WiFi shared RAM and blob version section placement. |
| soc/bflb/bl61x/wifi/bflb_wifi_platform.c | Implements MACSW task/thread + IRQ plumbing and low-power stubs. |
| soc/bflb/bl61x/Kconfig | Adds BL61x PHY/RF retention memory sizing option for BLE/WiFi. |
| soc/bflb/bl61x/CMakeLists.txt | Adds WiFi platform sources/linker sections and linker options when WiFi is enabled. |
| soc/bflb/bl61x/bflb_rf.c | Extends RF init and adds RF TLV parsing/loading support shared by BLE/WiFi. |
| modules/hal_bouffalolab/src/bl61x/CMakeLists.txt | Selects and links WiFi blob libraries (wl80211/macsw variants) and shared phyrf blob. |
| modules/hal_bouffalolab/shim/wifi/wl80211_rtos_port.c | Provides RTOS abstraction layer required by the WiFi blobs. |
| modules/hal_bouffalolab/shim/wifi/wl80211_port.c | Provides supplicant bridge symbols and assoc-IE/hostap-private glue for blobs. |
| modules/hal_bouffalolab/shim/wifi/CMakeLists.txt | Builds WiFi shim sources and no-blob stubs conditionally. |
| modules/hal_bouffalolab/shim/wifi/blob_stubs.c | Link-time stubs for CONFIG_BUILD_ONLY_NO_BLOBS=y builds. |
| modules/hal_bouffalolab/shim/CMakeLists.txt | Adds shim WiFi subdirectory when WiFi is enabled. |
| modules/hal_bouffalolab/Kconfig | Introduces BFLB_WL80211_SHIM Kconfig symbol for the WiFi blob shim. |
| modules/hal_bouffalolab/CMakeLists.txt | Ensures shim subtree is included when CONFIG_BFLB_WIFI is enabled. |
| dts/riscv/bflb/bl61x.dtsi | Adds BL61x WiFi device node and adjusts SRAM region compatibility. |
| dts/riscv/bflb/bl61x_em_32kb_wifi.dtsi | New DT snippet to carve WRAM for WiFi shared RAM and reduce sram1 size. |
| dts/bindings/wifi/bflb,bl61x-wifi.yaml | New devicetree binding for the BL61x WiFi MAC. |
| drivers/wifi/Kconfig | Wires the new BFLB WiFi Kconfig into the WiFi driver menu. |
| drivers/wifi/CMakeLists.txt | Adds BFLB WiFi driver subdirectory to the WiFi build. |
| drivers/wifi/bflb/Kconfig.bflb_wifi | Adds top-level BFLB WiFi enable option and common selects. |
| drivers/wifi/bflb/CMakeLists.txt | Adds include paths and BL61x subdir for the BFLB WiFi driver. |
| drivers/wifi/bflb/bl61x/Kconfig | Adds BL61x WiFi tuning options (MACSW variant, BA params, task settings, etc.). |
| drivers/wifi/bflb/bl61x/CMakeLists.txt | Adds BL61x driver sources (net/mgmt/scan/ap/wpa bridge). |
| drivers/wifi/bflb/bl61x/bflb_wifi.h | Defines driver device context and shared declarations. |
| drivers/wifi/bflb/bl61x/bflb_wifi_wpa_supp.h | Defines hostap bridge context and ops declarations. |
| drivers/wifi/bflb/bl61x/bflb_wifi_wpa_supp.c | Implements zep_wpa_supp_dev_ops bridge and SAE external-auth handling. |
| drivers/wifi/bflb/bl61x/bflb_wifi_scan.h | Declares scan and beacon/RSN cache helpers. |
| drivers/wifi/bflb/bl61x/bflb_wifi_scan.c | Implements scan result conversion and RSN/RSNXE/privacy caching. |
| drivers/wifi/bflb/bl61x/bflb_wifi_net.h | Declares event posting entry point used by the blob layer. |
| drivers/wifi/bflb/bl61x/bflb_wifi_net.c | Implements net_if offload driver, TX/RX paths, event dispatch, EAPOL handling. |
| drivers/wifi/bflb/bl61x/bflb_wifi_mgmt.h | Declares wifi_mgmt_ops table. |
| drivers/wifi/bflb/bl61x/bflb_wifi_mgmt.c | Implements wifi management APIs: scan/status/reg-domain/version/ps/mode/channel. |
| drivers/wifi/bflb/bl61x/bflb_wifi_ie.h | Provides small helpers for RSN/WPA IE serialization. |
| drivers/wifi/bflb/bl61x/bflb_wifi_blob_api.h | Centralizes extern declarations for blob-facing symbols and callbacks. |
| drivers/wifi/bflb/bl61x/bflb_wifi_ap.h | Declares AP bridge and hostapd ops (guarded by AP config). |
| drivers/wifi/bflb/bl61x/bflb_wifi_ap.c | Implements AP mode bridge + hostapd-related operations. |
| drivers/bluetooth/hci/Kconfig.bflb | Removes duplicated BL61x RF retention memory option (moved to SoC Kconfig). |
| boards/sipeed/maix_m0s_dock/maix_m0s.dtsi | Enables WiFi node and switches to WiFi-capable WRAM partition DT snippet. |
| boards/sipeed/maix_m0s_dock/maix_m0s_dock.yaml | Updates board supported features and test ignore tags (netif:wifi). |
| boards/bflb/bl61x/bl618g0/bl618g0.dts | Enables WiFi node and switches to WiFi-capable WRAM partition DT snippet. |
| boards/bflb/bl61x/bl618g0/bl618g0.yaml | Updates board supported features and test ignore tags (netif:wifi). |
| boards/aithinker/ai_m62_12f_kit/ai_m62_12f.dtsi | Enables WiFi node and switches to WiFi-capable WRAM partition DT snippet. |
| boards/aithinker/ai_m62_12f_kit/ai_m62_12f_kit.yaml | Updates board supported features and test ignore tags (netif:wifi). |
| boards/aithinker/ai_m61_32s_kit/ai_m61_32s.dtsi | Enables WiFi node and switches to WiFi-capable WRAM partition DT snippet. |
| boards/aithinker/ai_m61_32s_kit/ai_m61_32s_kit.yaml | Updates board supported features and test ignore tags (netif:wifi). |
| boards/qcom/qcc744m_evk/qcc744m.dtsi | Removes zephyr,itcm chosen entry consistent with BL61x ITCM usage changes. |
398c0d9 to
e2fa07d
Compare
e2fa07d to
d8f0aee
Compare
josuah
left a comment
There was a problem hiding this comment.
Just a few random things for me who is unaware of all the working of WiFi.
Thank you again for all the work!
|
Just confirming that it still works on a ai_m61_32s module: |
@josuah Note that this will ping your local machine and the packets will not leave the host |
|
this is embarrassing... I pasted the wrong snippet. My ISP filters IPv4 ping somehow, so in the meantime, just pinging the gateway: |
Replace the ITCM memory region with plain RAM for code relocation. The sram1 region no longer needs a dedicated "ITCM" identity since WiFi firmware will reclaim part of that address space. Using the generic RAM relocation target keeps the same XIP-avoidance behavior while freeing sram1 for flexible partitioning. Remove the zephyr,itcm chosen node from all bl61x and qcc744m boards. Signed-off-by: William Markezana <william.markezana@gmail.com>
Add the wifi0 node for the BL61x WiFi MAC peripheral at 0x24b08000 with its devicetree binding. Introduce bl61x_em_32kb_wifi.dtsi which carves 128 KB from WRAM for WiFi MAC shared structures (TX/RX descriptors, IPC) via the non-cached bus-remap alias, and scales sram1 down to 32 KB. Signed-off-by: William Markezana <william.markezana@gmail.com>
Switch bl61x board DTS includes from bl61x_em_32kb.dtsi to bl61x_em_32kb_wifi.dtsi to reserve the WiFi shared-memory region, and enable the wifi0 node on all bl61x-based boards. Signed-off-by: William Markezana <william.markezana@gmail.com>
Extend bflb_rf_init() to support WiFi mode (WL_API_MODE_ALL) with TX power targets and country code configuration when CONFIG_BFLB_WIFI is enabled. Add WiFi platform glue: MAC ISR wiring, task creation, low-power stubs, wl80211 RTOS primitives (heap, RNG, timers), and the linker section for WiFi shared RAM. Introduce CONFIG_BFLB_BL61X_WL_RMEM_SIZE for PHY/RF retention memory sizing. Signed-off-by: William Markezana <william.markezana@gmail.com>
Add wl80211 RTOS shim (semaphores, mutexes, timers, lock/unlock) and supplicant bridge for the macsw blob. Refactor bl61x blob linkage: share libbl616_phyrf.a between BLE and WiFi, add MACSW variant selection (default/bridge/ack/coex), and link wl80211 and macsw libraries when CONFIG_BFLB_WIFI is enabled. Signed-off-by: William Markezana <william.markezana@gmail.com>
Add a native Zephyr WiFi driver for the BL616/BL618 SoC family. The driver interfaces with the vendor macsw blob through wl80211 and implements the Zephyr wifi_mgmt API for station connect/disconnect, scanning, and AP mode. WPA supplicant integration is provided via the hostap subsystem. Signed-off-by: William Markezana <william.markezana@gmail.com>
Point hal_bouffalolab to pull/22/head which includes the WiFi MAC software blobs (macsw, wl80211, phyrf) needed by the BL61x WiFi driver. Signed-off-by: William Markezana <william.markezana@gmail.com>
Add build-only test suite covering MACSW firmware variants (default, bridge, ack, coex) and AP mode for all BL61x WiFi-capable boards. Signed-off-by: William Markezana <william.markezana@gmail.com>
|



Summary
Add WiFi support for the Bouffalo Lab BL616/BL618 SoC family.
The driver interfaces with the vendor macsw binary blob through the wl80211 layer and implements the Zephyr
wifi_mgmtAPI:Supported station security types:
Supported access point security types:
Authentication is handled by the upstream hostap/wpa_supplicant subsystem (
WIFI_NM_WPA_SUPPLICANT), not the vendor fork. The driver implementszep_wpa_supp_dev_opsto bridge hostap with the vendor MAC layer. This required a lot of reverse engineering and glue which I tried to comment as much as possible.To facilitate WiFi RAM requirements, legacy ITCM relocations have been moved to RAM, this we be cleaned once rebased on #107223.
Test plan
ai_m61_32s_kit,ai_m62_12f_kit,bl618g0,maix_m0s_dockwifi scanwifi connect -s <ssid> -p <passphrase> -k <key type>wifi statusnet ifacenet dhcpv4 client start 1(should be automatic)net pingto gateway and external hostBL61x WiFi blobs architecture
graph TB subgraph Zephyr["Zephyr"] APP["Application"] MGMT["wifi_mgmt · net_if · net_pkt"] end WPA["hostap<br/>WPA supplicant · SAE · 4WHS"] DRV["WiFi Driver<br/>drivers/wifi/bflb/bl61x/"] PORT["Shim<br>wl80211_port.c<br/>blob → driver callbacks"] PLAT["Platform — soc/bflb/bl61x/wifi/<br/>wifi_task · IRQ · clock"] subgraph Blobs["Binary Blobs"] WL80211[/"<b>libwl80211</b><br/>Upper MAC<br/>scan · connect · 802.11 SM"/] MACSW[/"<b>libmacsw</b><br/>Lower MAC<br/>TX/RX · DMA · FW event loop<br/><i>default │ bridge │ ack │ coex</i>"/] PHYRF[/"<b>libbl616_phyrf</b><br/>PHY · RF calibration<br/><i>shared with BLE</i>"/] end HW["BL616 WiFi MAC + RF"] APP --> MGMT MGMT --> DRV WPA -- "driver_ops" --> DRV DRV -- "events" --> WPA DRV -- "wl80211_cntrl · wl80211_mac_*" --> WL80211 WL80211 -- "wpa_cbs" --> PORT PORT -- "eapol_input" --> DRV WL80211 -- "ke_msg · MAC ops" --> MACSW MACSW -- "task suspend/resume · IRQ" --> PLAT PLAT -- "wifi_main · interrupt0_handler" --> MACSW MACSW --> PHYRF MACSW & PHYRF --> HW classDef zephyr fill:#2563eb,color:#fff,stroke:#1d4ed8 classDef driver fill:#7c3aed,color:#fff,stroke:#6d28d9 classDef hostap fill:#059669,color:#fff,stroke:#047857 classDef shim fill:#d97706,color:#fff,stroke:#b45309 classDef plat fill:#dc2626,color:#fff,stroke:#b91c1c classDef blob fill:#4b5563,color:#fff,stroke:#374151 classDef hw fill:#1f2937,color:#fff,stroke:#111827 class APP,MGMT zephyr class DRV driver class WPA hostap class PORT shim class PLAT plat class WL80211,MACSW,PHYRF blob class HW hw