fix(legacy-mcu1): support AIC8800D80 product 0x8820 and unstick cfg80211 connect

Two independent fixes found on a UGREEN a69c:5723 adapter
(chip_id=7, chip_mcu_id=1, product_id=0x8820, issue #118):

1) The firmware boots and answers every configuration request, but never
   confirms MM_START_REQ, so the MAC never starts and wlan0 stays unusable
   (the symptom reported in #79). The Windows loader (aicloadfw.sys) handles
   product 0x8820 differently: it writes 0x40500010 = 0x2, masked-writes
   0x40506024 (mask 0xff) = 0xdf, and uploads only the FMAC firmware without
   the adid/patch/patch-table/patch-config layer. Mirror that behaviour,
   gated on product_id == 0x8820 so that other D80 revisions (for example the
   a69c:572f from #58) keep uploading the patch layer and stay unaffected.
   The existing MCU1 cache fix (0x40100020 |= 0x1) is kept for both.

2) rwnx_cfg80211_connect() returned 0 when the state machine was already
   CONNECTING/DISCONNECTING, without ever reporting a result. cfg80211 then
   keeps wdev->conn allocated and rejects every later NL80211_CMD_CONNECT
   with -EALREADY, so the driver's connect op is never called again and
   NetworkManager loops on the password prompt ("associating -> disconnected"
   every 5 s) with no driver activity at all. Report the failure instead:
   reset the state and return -EBUSY.

Tested on Ubuntu 26.04 / 7.0.0-14-generic: 5 GHz association, DHCP, IPv6
SLAAC and internet traffic all work, and it survives reboot and USB re-plug.
Full logs and analysis: #118
This commit is contained in:
kaijia323 committed 2026-10-28 01:14:37 +08:00
1 parent a9683a4560
commit 73e0a57128
3 files changed
+41 -3

No files matched your search

+9 -1
View File
@@ -3206,7 +3206,15 @@ static int rwnx_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
if((int)atomic_read(&rwnx_vif->drv_conn_state) == (int)RWNX_DRV_STATUS_DISCONNECTING||
(int)atomic_read(&rwnx_vif->drv_conn_state) == (int)RWNX_DRV_STATUS_CONNECTING) {
AICWFDBG(LOGERROR, "%s driver is disconnecting or connecting ,return it \r\n", __func__);
return 0;
/*
* local fix: returning 0 here leaves cfg80211 waiting for a connect
* result that never comes, so every later connect fails with -EALREADY
* (NetworkManager then loops asking for the password forever).
* Report the failure instead so cfg80211 drops its pending request.
*/
rwnx_set_conn_state(rwnx_vif, &rwnx_vif->drv_conn_state,
(int)RWNX_DRV_STATUS_DISCONNECTED);
return -EBUSY;
}
#endif