f8107ee6cc
UPSTREAM.md captures the submission-ready state:
- patch-by-patch intent and testing status
- CW1200 lineage narrative
- branch-to-patch mapping on marfrit/bes2600-dkms
- submission routes (near-term Mobian MR, longer-term linux-wireless
RFC for drivers/staging/)
- known limitations left for follow-up
- recommended CC list for a future linux-wireless RFC
patches/staging-prep-series/ contains the linear 6-patch series with
cover letter, generated from the bes2600/staging-prep-series branch on
marfrit/bes2600-dkms (cherry-picked off mobian in dependency order).
All patches checkpatch.pl --no-tree --strict clean.
Branch mapping:
1/6 bes2600/factory-request-firmware (c1)
2/6 bes2600/factory-no-efuse-flag (c5, stacked on c1)
3/6 bes2600/factory-thread-dev (c1.1, stacked on c1+c5)
4/6 bes2600/pm-gate-on-handshake (c2, standalone)
5/6 bes2600/remove-chardev-user-interface (c3, standalone)
6/6 bes2600/enable-testmode (c4, standalone)
Total: 79 insertions, 549 deletions. Net -470 lines.
Signed-off-by: Markus Fritsche <fritsche.markus@gmail.com>
158 lines
7.3 KiB
Diff
158 lines
7.3 KiB
Diff
From 6f13e008d21d453db486f707f47340a0a17e650b Mon Sep 17 00:00:00 2001
|
|
From: Markus Fritsche <fritsche.markus@gmail.com>
|
|
Date: Wed, 22 Apr 2026 14:15:56 +0200
|
|
Subject: [PATCH 0/6] bes2600: staging-prep cleanup for PineTab2 (BES2600WM)
|
|
|
|
This series is a staging-prep cleanup for the out-of-tree Bestechnic
|
|
BES2600WM Wi-Fi/BT combo-chip driver as shipped by Mobian's bes2600-dkms
|
|
package (and in-tree at drivers/staging/bes2600/ in the danctnix
|
|
linux-pinetab2 fork). Target hardware is the Pine64 PineTab2 (RK3566
|
|
+ BES2600WM, SDIO vendor 0xBE57 / device 0x2002).
|
|
|
|
The driver descends from the ST-Ericsson CW1200 (drivers/net/wireless/
|
|
st/cw1200/) — same author, Dmitry Tarnyagin, shared WSM host↔firmware
|
|
protocol, shared SDIO bus backend. Kconfig ancestry markers survive in
|
|
this tree today: CONFIG_BES2600_USE_STE_EXTENSIONS (STE = ST-Ericsson),
|
|
CONFIG_BES2600_WSM_DEBUG (WSM). ST-Ericsson 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 linux-pinetab2
|
|
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, matching the
|
|
/lib/firmware/ layout). Kills a kernel-mainline anti-pattern and the
|
|
'(NULL device *): read and check /lib/firmware/bes2600_factory.txt
|
|
error' boot spam on PineTab2.
|
|
|
|
* 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 — gcc -Werror=missing-prototypes broke the build with the
|
|
new default until this is fixed.
|
|
|
|
* 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 (firmware never posted the
|
|
PM-change indication). On PineTab2 this recurred every 5-10 s
|
|
whenever the interface was associated and idle, flooded dmesg, and
|
|
cascaded into sdio_tx_work WARN splats / [RX] Receive failure
|
|
messages. 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, alloc_chrdev_region /
|
|
cdev_init / cdev_add / class_create / device_create in the init
|
|
path, and the matching teardown in bes2600_chrdev_free — 519 lines
|
|
deleted. The in-kernel accessor functions (is_signal_mode,
|
|
get_fw_type, etc., 13 call sites) and the fw_type module parameter
|
|
are preserved; the userspace interface becomes rfkill + module_param
|
|
+ (with 6/6) nl80211 testmode.
|
|
|
|
* 6/6 — Flip CONFIG_BES2600_TESTMODE default from n to y. The driver
|
|
already implements a mac80211 testmode_cmd dispatcher (routing to
|
|
the firmware's patch_wifi_testMode path), already gated on the flag;
|
|
CONFIG_NL80211_TESTMODE=y is common on target kernels. Enabling the
|
|
flag also exposes accumulated bit-rot — ~41 calls to undefined
|
|
bes2600_info/err/warn/dbg/err_with_cond macros, and 3 TSM/roam-delay
|
|
helpers with external linkage but no prototype. Add shim macros to
|
|
bes_log.h rewiring the legacy calls onto the existing bes_info /
|
|
bes_err / bes_warn / bes_devel family, define BES2600_DBG_* subsystem
|
|
ids as 0 constants, and mark the 3 helpers static.
|
|
|
|
## Testing
|
|
|
|
Reference hardware: Pine64 PineTab2 (BES2600WM + Rockchip RK3566,
|
|
8a:2e:77:1f:ec:05, LAN AP newton @ 2.4 GHz ch11, tested also on
|
|
TelekomHotspot@ERGO @ 5 GHz ch36).
|
|
|
|
Host kernel: linux-pinetab2 6.19.10-danctnix1-1-pinetab2 with
|
|
CONFIG_NL80211_TESTMODE=y. Driver installed via
|
|
/lib/modules/<ver>/extra/ and verified loaded via modinfo srcversion.
|
|
|
|
Per-patch outcomes in post-reboot dmesg (full-stack applied):
|
|
- 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: 'bes2600_pwr_enter_lp_mode, wait pm ind timeout' (pre-patch 20-30
|
|
msgs / 5 min window) — 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; module
|
|
builds cleanly
|
|
|
|
Full stack: wifi associates and passes traffic across 3+ reboots.
|
|
|
|
## Known limitations / out of scope
|
|
|
|
- factory_section_write_file() in bes2600_factory.c still uses
|
|
kernel_write() + filp_open(O_CREAT) to persist per-channel
|
|
calibration updates back to /lib/firmware/bes2600_factory.txt.
|
|
Converting the write-back path to debugfs or nl80211 testmode is a
|
|
follow-up.
|
|
|
|
- bes_chardev.c still carries DPD file-read/write paths gated by
|
|
BES2600_WRITE_DPD_TO_FILE (off by default, so dead code in the
|
|
default build). Same treatment needed.
|
|
|
|
- bes_fw.c:587 unconditionally creates
|
|
/lib/firmware/bes2002_fw_write.bin via filp_open() for debug
|
|
observation. Needs to go before drivers/staging/ accepts the driver.
|
|
|
|
- bes_cdev global singleton still holds sig_mode and fw_type. Moving
|
|
those to per-hw_priv state is blocked by fw_type being a module
|
|
parameter (inherently singleton). Migrating fw_type to a per-phy
|
|
debugfs knob or nl80211 testmode command is the next step; overlaps
|
|
with 6/6's testmode plumbing.
|
|
|
|
- One residual benign notice after the full stack: 'bes2600_wlan
|
|
mmc2:0001:1: PS Mode Error, Reason:1' at T+40s on fresh boot.
|
|
Distinct from the pre-4/6 timeout cascade; driver recovers, WiFi
|
|
stays up. Root cause not investigated.
|
|
|
|
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
|
|
|
|
bes2600/Makefile | 6 +-
|
|
bes2600/bes2600_factory.c | 45 ++--
|
|
bes2600/bes2600_factory.h | 3 +
|
|
bes2600/bes2600_sdio.c | 4 +
|
|
bes2600/bes_chardev.c | 519 --------------------------------------
|
|
bes2600/bes_log.h | 23 ++
|
|
bes2600/bes_pwr.c | 20 +-
|
|
bes2600/sta.c | 6 +-
|
|
bes2600/wsm.h | 2 -
|
|
9 files changed, 79 insertions(+), 549 deletions(-)
|
|
|
|
--
|
|
2.53.0
|
|
|