forked from marfrit/kernel-agent
b04c8cd501
PR #33's per-series mirrors were generated against the bes2600-dkms cleanups branch (rooted at fe73571) without rebasing onto the v7.0-danctnix1 kernel baseline. Result: per-commit diffs carried stale baseline context (e.g. from_timer rather than the new timer_container_of API), so the cumulative no longer applied cleanly to ohm's actual base. pkgrel=6 build #1 failed with 'Hunk #3 FAILED' in Patch D's sta.c. Fix: in marfrit/bes2600-dkms, create danctnix-sync branch (fe73571 + drop-in replace bes2600/ with v7.0-danctnix1's drivers/staging/bes2600/), rebase cleanups onto it as cleanups-rebased-on-danctnix, manually resolve the resulting conflicts keeping each commit's intent + the new baseline context, rebase Patch H accordingly. Format-patch and re-route to the same series-dir names as PR #33. Conflict resolution notes: - 'remove userspace /dev/bes2600 character device interface' commit: the chardev wrapper was removed but two utility funcs that danctnix's bes2600_btuart.c depends on (bes2600_chrdev_is_bus_error, bes2600_chrdev_switch_subsys_glb) were re-added with EXPORT_SYMBOL_GPL. bes2600_switch_bt re-added as static (file-local, called only from bes2600_chrdev_switch_subsys_glb). - Patch D (atomicize ba_lock): re-resolved bes2600_ba_timer's timer_container_of() vs from_timer() to keep the new API. - SCS Makefile @@ hunk counts corrected from -9,6 +9,10 to -9,6 +9,11 (the original was actually wrong; build-via-fuzz was masking it). Cumulative b2sum: ka-promote ohm now emits eb179c03f35a4dbaec2e40036f0033ef04985bb6b14ab22419d68e5caaa5874f... (279 554 bytes, 32 patches resolved). pkgrel=6 built from this manifest + installed on ohm 2026-05-19 ~23:39. Functional verification: bes2600 + bes2600_btuart both load, Pattern A 0 over fresh boot, wlan0 associates to newton. srcversion 1A919EED0E6DC2478559B17 differs from pkgrel=5's BEB625FA... — the reconstruction is functionally equivalent (5 GHz working, no firmware/driver race conditions) but NOT byte-equivalent (the chardev utility re-add chose different formatting than the original danctnix code). Byte-equivalence is not a goal; per-series traceability and working hardware are. Closes (proper this time): #29. Refs: #28, #30, #33 (the half-working attempt), #31, #32.
84 lines
3.2 KiB
Diff
84 lines
3.2 KiB
Diff
From 3942404ae16b134a55e48cb796d625b8b90e504f Mon Sep 17 00:00:00 2001
|
|
From: Markus Fritsche <fritsche.markus@gmail.com>
|
|
Date: Tue, 28 Apr 2026 21:37:37 +0200
|
|
Subject: [PATCH 19/29] bes2600: handle multi-function SDIO cards in
|
|
mmc_hw_reset bus_reset
|
|
|
|
c5.2 (recover-wedged-firmware-via-mmc-hw-reset) wraps mmc_hw_reset()
|
|
and treats any non-zero return as a recovery failure. On
|
|
single-function SDIO cards mmc_hw_reset returns 0 after doing the
|
|
remove + rescan inline. On multi-function cards (BES2600 has WLAN
|
|
func 1 + BT companion func 2) the kernel's mmc_sdio_hw_reset() does
|
|
NOT do the rescan: it tears the card down and returns 1 to signal
|
|
"caller must trigger rescan".
|
|
|
|
Field observation on PineTab2 (linux-pinetab2 6.19.10-danctnix1):
|
|
when a real LMAC wedge fired bes2600_chrdev_wifi_force_close ->
|
|
bes2600_chrdev_do_bus_reset, mmc_hw_reset returned 1, c5.2's wrapper
|
|
treated that as "bus_reset failed: 1", logged the error, and gave
|
|
up. The card was already removed (mmc2: card 0001 removed) but
|
|
nothing scheduled a rescan; wifi (and the BT companion which shares
|
|
the same SDIO host) stayed silent until the user rebooted four
|
|
minutes later.
|
|
|
|
Fix:
|
|
|
|
- Capture the mmc_host pointer before calling mmc_hw_reset (the
|
|
card pointer is invalid after the remove).
|
|
- On positive return (multi-function path), log informationally
|
|
and call mmc_detect_change(host, 0) to schedule a rescan.
|
|
Return 0 so callers see the recovery as successful.
|
|
- Negative return is still treated as failure as before.
|
|
|
|
The mmc_detect_change side effect is asynchronous; the chrdev's
|
|
wait_event_timeout(probe_done_wq, !sbus_priv) still observes the
|
|
remove half synchronously, and the rescan + re-probe runs out of
|
|
the host detect work afterwards.
|
|
|
|
Signed-off-by: Markus Fritsche <fritsche.markus@gmail.com>
|
|
---
|
|
bes2600/bes2600_sdio.c | 24 +++++++++++++++++++++++-
|
|
1 file changed, 23 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/drivers/staging/bes2600/bes2600_sdio.c b/drivers/staging/bes2600/bes2600_sdio.c
|
|
index 5a0694a..c81c244 100644
|
|
--- a/drivers/staging/bes2600/bes2600_sdio.c
|
|
+++ b/drivers/staging/bes2600/bes2600_sdio.c
|
|
@@ -1810,10 +1810,32 @@ static void bes2600_sdio_halt_device(struct sbus_priv *self)
|
|
*/
|
|
static int bes2600_sdio_bus_reset(struct sbus_priv *self)
|
|
{
|
|
+ struct mmc_host *host;
|
|
+ int ret;
|
|
+
|
|
if (!self || !self->func || !self->func->card)
|
|
return -EINVAL;
|
|
|
|
- return mmc_hw_reset(self->func->card);
|
|
+ host = self->func->card->host;
|
|
+ ret = mmc_hw_reset(self->func->card);
|
|
+
|
|
+ /*
|
|
+ * On multi-function SDIO cards (BES2600 has WLAN func 1 + BT
|
|
+ * companion func 2), mmc_sdio_hw_reset() removes the card and
|
|
+ * returns 1 to signal "remove happened, caller must trigger
|
|
+ * rescan". The kernel does NOT auto-rescan in this case;
|
|
+ * single-function cards take the rescan path inline and return 0.
|
|
+ * Treat any non-negative return as success and force a rescan if
|
|
+ * mmc_hw_reset signalled the multi-function path - otherwise the
|
|
+ * card stays removed indefinitely after a wedge recovery,
|
|
+ * leaving wifi (and the BT companion) silent until reboot.
|
|
+ */
|
|
+ if (ret > 0) {
|
|
+ bes_info("multi-func mmc_hw_reset removed card; scheduling rescan\n");
|
|
+ mmc_detect_change(host, 0);
|
|
+ ret = 0;
|
|
+ }
|
|
+ return ret;
|
|
}
|
|
|
|
static bool bes2600_sdio_wakeup_source(struct sbus_priv *self)
|
|
--
|
|
2.54.0
|
|
|