From 6f13e008d21d453db486f707f47340a0a17e650b Mon Sep 17 00:00:00 2001 From: Markus Fritsche Date: Wed, 22 Apr 2026 14:27:00 +0200 Subject: [PATCH 0/6] bes2600: staging-prep cleanup for PineTab2 (BES2600WM) This is the danctnix-layout variant of the bes2600 staging-prep series. All six patches target `drivers/staging/bes2600/` in `codeberg.org/DanctNIX/linux-pinetab2` at tag `v6.19.10-danctnix1`. Apply cleanly, `checkpatch.pl --no-tree --strict` clean. The Mobian `bes2600-dkms` variant of this series (same content, paths rooted at `bes2600/` rather than `drivers/staging/bes2600/`) lives at `git.reauktion.de/marfrit/bes2600-dkms` branch `bes2600/staging-prep-series`. If you maintain both trees, you may prefer to apply there and propagate to the danctnix in-tree copy. ## Background The BES2600 Linux driver descends from the ST-Ericsson CW1200 driver in mainline (`drivers/net/wireless/st/cw1200/`). Same author -- Dmitry Tarnyagin; shared WSM host<->firmware protocol plumbing; shared SDIO bus backend. Kconfig ancestry markers survive: `CONFIG_BES2600_USE_STE_EXTENSIONS` (STE = ST-Ericsson), `CONFIG_BES2600_WSM_DEBUG` (WSM). ST-Ericsson was wound down in 2013; Bestechnic (founded 2015) appears to have inherited or licensed the CW1200 IP. No linux-wireless RFC has ever linked the two chips. The series fixes observable defects on a PineTab2 running the danctnix kernel 6.19.10-danctnix1-1 and removes two upstream blockers. Each patch is independently testable and bisectable; the order below preserves dependencies. ## What the series does * 1/6 -- Replace `filp_open()` + `kernel_read()` in the factory- calibration read path with `request_firmware()`. Repoint the FACTORY_PATH macro to the firmware-class name (`bes2600/bes2600_factory.txt`). Kills a kernel-mainline anti-pattern and the `(NULL device *): read and check /lib/firmware/bes2600_factory.txt error` boot spam. * 2/6 -- Default `STANDARD_FACTORY_EFUSE_FLAG` from y to n. The shipped `bes2600_factory.txt` on PineTab2 contains 30 calibration fields; the driver was expecting 31 (including a `##select_efuse_flag` section absent from this firmware). Also unguards the `wsm_save_factory_txt_to_mcu()` prototype in `wsm.h` which was inconsistently wrapped in `#if defined(STANDARD_FACTORY_EFUSE_FLAG)` while its definition in `wsm.c` and its call site in `sta.c` were ungated. * 3/6 -- Thread `struct device *` through `factory_section_read_file()` via a module-local setter invoked at SDIO probe. `request_firmware()` now receives a real device pointer; `(NULL device *):` no longer prefixes factory-related diagnostics. * 4/6 -- Gate the device-end of the low-power transition on successful per-VIF firmware handshake. Pre-patch: `bes2600_pwr_enter_lp_mode()` called `bes2600_pwr_device_enter_lp_mode()` unconditionally even when `wait_for_completion_timeout()` returned 0. On PineTab2 this recurred every 5-10 s in idle-associated state, flooded dmesg, and cascaded into `sdio_tx_work` WARN splats. Post-patch: `-ETIMEDOUT` returned cleanly, dmesg silent, SDIO stable. * 5/6 -- Remove the custom `/dev/bes2600` character-device interface. `file_operations`, open/read/write/release, `bes2600_op_*` command- dispatch table, `bes2600_load_uevent`, cdev registration in the init path -- 519 lines deleted. In-kernel accessors (`is_signal_mode`, `get_fw_type`, etc., 13 call sites) and the `fw_type` module parameter are preserved. * 6/6 -- Flip `CONFIG_BES2600_TESTMODE` default from n to y. Also fixes accumulated bit-rot revealed by enabling the flag: shim macros in `bes_log.h` for the legacy `bes2600_info/err/warn/dbg/err_with_cond` family, `BES2600_DBG_*` constants defined as 0, 3 TSM/roam-delay helpers marked `static`. ## Testing Reference hardware: Pine64 PineTab2 (BES2600WM + Rockchip RK3566, MAC `8a:2e:77:1f:ec:05`). Host kernel: linux-pinetab2 6.19.10-danctnix1-1 with `CONFIG_NL80211_TESTMODE=y`. Full stack applied, verified over 3+ reboots: WiFi associates and passes traffic on both 2.4 GHz (newton / ch11) and 5 GHz (TelekomHotspot@ERGO / ch36). Per-patch outcomes in post-reboot dmesg: - 1/6: `read and check /lib/firmware/bes2600_factory.txt error` -- gone - 2/6: `bes2600_factory.txt parse fail` / `factory cali data get failed.` -- gone - 3/6: `(NULL device *):` prefix on factory lines -- gone - 4/6: `wait pm ind timeout` (pre-patch 20-30 msgs / 5 min) -- 0 per 5 min; `sdio_tx_work` WARN splat (pre-patch 2+ / 5 min) -- 0 per 5 min; `[RX] Receive failure: 4.` -- gone - 5/6: `/dev/bes2600` -- absent; driver continues to associate - 6/6: `iw phy0` lists `testmode` under *Supported commands* ## Known limitations / out of scope - `factory_section_write_file()` still uses `kernel_write()` + `filp_open()` for calibration persistence. Conversion to debugfs/nl80211 is a follow-up. - `bes_chardev.c` still contains DPD-to-file read/write paths (gated by `BES2600_WRITE_DPD_TO_FILE`, off by default -- dead code in default builds). Same treatment needed. - `bes_fw.c:587` unconditionally creates `/lib/firmware/bes2002_fw_write.bin` via `filp_open()` for debug observation. Must go before a future drivers/net/wireless/st/ promotion. - `bes_cdev` singleton still holds `sig_mode`/`fw_type`. Migrating fw_type from module_param to per-phy debugfs knob or nl80211 testmode is the next architectural step. - Residual benign dmesg: `bes2600_wlan mmc2:0001:1: PS Mode Error, Reason:1` at T+40 s on fresh boot. Distinct from the pre-4/6 timeout cascade; driver recovers, WiFi stays up. Markus Fritsche (6): bes2600: use request_firmware() for factory.txt read bes2600: default STANDARD_FACTORY_EFUSE_FLAG off for PineTab2 factory.txt format bes2600: thread struct device * through factory request_firmware() call bes2600: gate device LP-mode entry on successful per-VIF firmware handshake bes2600: remove userspace /dev/bes2600 character device interface bes2600: enable CONFIG_BES2600_TESTMODE by default + fix bit-rotted testmode plumbing drivers/staging/bes2600/Makefile | 6 +- drivers/staging/bes2600/bes2600_factory.c | 45 +-- drivers/staging/bes2600/bes2600_factory.h | 3 + drivers/staging/bes2600/bes2600_sdio.c | 4 + drivers/staging/bes2600/bes_chardev.c | 519 -------------------------------- drivers/staging/bes2600/bes_log.h | 23 ++ drivers/staging/bes2600/bes_pwr.c | 20 +- drivers/staging/bes2600/sta.c | 6 +- drivers/staging/bes2600/wsm.h | 2 - 9 files changed, 79 insertions(+), 549 deletions(-) -- 2.53.0