test: match D80 loader to legacy firmware

This commit is contained in:
Shen Mintao
2026-07-22 16:55:44 +08:00
parent bff42860ff
commit 7b2541e5c0
2 changed files with 49 additions and 137 deletions
+10 -123
View File
@@ -39,36 +39,14 @@ typedef struct {
#define AIC_PATCH_OFST(mem) ((size_t) &((aic_patch_t *)0)->mem)
#define AIC_PATCH_ADDR(mem) ((u32) (aic_patch_str_base + AIC_PATCH_OFST(mem)))
#define USER_PWROFST_COVER_CALIB_FLAG (0x01U << 0)
#define USER_CHAN_MAX_TXPWR_EN_FLAG (0x01U << 1)
#define USER_TX_USE_ANA_F_FLAG (0x01U << 2)
#define USER_APM_PRBRSP_OFFLOAD_DISABLE_FLAG (0x01U << 3)
#define USER_HE_MU_EDCA_UPDATE_DISABLE_FLAG (0x01U << 4)
#define USER_LOFT_CALIB_DISABLE_FLAG (0x01U << 6)
#define USER_CAPA_CALIB_DISABLE_FLAG (0x01U << 7)
#define USER_PWR_CALIB_DISABLE_FLAG (0x01U << 8)
#define USER_IPA_CALIB_DISABLE_FLAG (0x01U << 13)
#define USER_EXT_FLAGS_DEFAULT_D80 (USER_PWROFST_COVER_CALIB_FLAG)
#define CFG_USER_PWROFST_COVER_CALIB_EN (1)
#if (defined(CONFIG_POWER_LIMIT))
#define CFG_USER_CHAN_MAX_TXPWR_EN (1)
#else
#define CFG_USER_CHAN_MAX_TXPWR_EN (0)
#endif
#define CFG_USER_TX_USE_ANA_F_EN (0)
#if (defined(CONFIG_PRBREQ_REPORT))
#define CFG_USER_APM_PRBRSP_OFFLOAD_DISABLE (1)
#else
#define CFG_USER_APM_PRBRSP_OFFLOAD_DISABLE (0)
#endif
#define CFG_USER_HE_MU_EDCA_UPDATE_DISABLE (0)
#define CFG_USER_LOFT_CALIB_DISABLE_DISABLE (0)
#define CFG_USER_CAPA_CALIB_DISABLE_DISABLE (0)
#define CFG_USER_PWR_CALIB_DISABLE_DISABLE (0)
#define CFG_USER_IPA_CALIB_DISABLE_DISABLE (0)
/*
* Issue #58 legacy-loader test.
*
* Keep this table aligned with the SDK V3 D80 firmware imported from Radxa
* commit 254d47e6a131dbed5ba32131972f4719f3e1c7fe. Newer loader patches use
* different RX aggregation settings and a user_ext_flags field that is not
* part of this firmware generation.
*/
u32 patch_tbl_d80[][2] =
{
#ifdef USE_5G
@@ -76,54 +54,7 @@ u32 patch_tbl_d80[][2] =
#else
{0x00b4, 0xf3010000},
#endif
#ifdef CONFIG_PLATFORM_HI
{0x0170, 0x00010001},//rx aggr counter
#else
{0x0170, 0x0001000A},//rx aggr counter
#endif
{0x0188,
(USER_EXT_FLAGS_DEFAULT_D80 |
#if CFG_USER_CHAN_MAX_TXPWR_EN
USER_CHAN_MAX_TXPWR_EN_FLAG |
#endif
#if CFG_USER_TX_USE_ANA_F_EN
USER_TX_USE_ANA_F_FLAG |
#endif
#if CFG_USER_APM_PRBRSP_OFFLOAD_DISABLE
USER_APM_PRBRSP_OFFLOAD_DISABLE_FLAG |
#endif
#if CFG_USER_HE_MU_EDCA_UPDATE_DISABLE
USER_HE_MU_EDCA_UPDATE_DISABLE_FLAG |
#endif
#if CFG_USER_LOFT_CALIB_DISABLE_DISABLE
USER_LOFT_CALIB_DISABLE_FLAG |
#endif
#if CFG_USER_CAPA_CALIB_DISABLE_DISABLE
USER_CAPA_CALIB_DISABLE_FLAG |
#endif
#if CFG_USER_PWR_CALIB_DISABLE_DISABLE
USER_PWR_CALIB_DISABLE_FLAG |
#endif
#if CFG_USER_IPA_CALIB_DISABLE_DISABLE
USER_IPA_CALIB_DISABLE_FLAG |
#endif
0) & ~(
#if !CFG_USER_PWROFST_COVER_CALIB_EN
USER_PWROFST_COVER_CALIB_FLAG |
#endif
0)
}, // user_ext_flags
#ifdef CONFIG_RADAR_OR_IR_DETECT
{0x0019c,0x00000900},
#endif
#ifdef CONFIG_WOWLAN
{0x019c,0x01000000},
#ifdef ANDROID_PLATFORM
{0x01A0, 0x01000001},
#endif
#endif
{0x0170, 0x00000002},//rx aggr counter
};
//adap test
@@ -144,16 +75,11 @@ u32 syscfg_tbl_8800d80[][2] = {
extern int adap_test;
#define NEW_PATCH_BUFFER_MAP 1
int aicwf_patch_config_8800d80(struct aic_usb_dev *usb_dev)
{
u32 rd_patch_addr;
u32 aic_patch_addr;
u32 config_base, aic_patch_str_base;
#if (NEW_PATCH_BUFFER_MAP)
u32 patch_buff_addr, patch_buff_base, rd_version_addr, rd_version_val;
#endif
uint32_t start_addr = 0x001D7000;
u32 patch_addr = start_addr;
u32 patch_cnt = sizeof(patch_tbl_d80) / 4 / 2;
@@ -190,32 +116,6 @@ int aicwf_patch_config_8800d80(struct aic_usb_dev *usb_dev)
AICWFDBG(LOGERROR, "%x=%x\n", rd_patch_addr_cfm.memaddr, rd_patch_addr_cfm.memdata);
aic_patch_str_base = rd_patch_addr_cfm.memdata;
#if (NEW_PATCH_BUFFER_MAP)
if (chip_id == CHIP_REV_U01) {
rd_version_addr = RAM_FMAC_FW_ADDR_8800D80 + 0x01C;
} else {
rd_version_addr = RAM_FMAC_FW_ADDR_8800D80_U02 + 0x01C;
}
if ((ret = rwnx_send_dbg_mem_read_req(usb_dev, rd_version_addr, &rd_patch_addr_cfm))) {
AICWFDBG(LOGERROR, "version val[0x%x] rd fail: %d\n", rd_version_addr, ret);
return ret;
}
rd_version_val = rd_patch_addr_cfm.memdata;
AICWFDBG(LOGINFO, "rd_version_val=%08X\n", rd_version_val);
usb_dev->fw_version_uint = rd_version_val;
if (rd_version_val > 0x06090100) {
patch_buff_addr = rd_patch_addr + 12;
ret = rwnx_send_dbg_mem_read_req(usb_dev, patch_buff_addr, &rd_patch_addr_cfm);
if (ret) {
AICWFDBG(LOGERROR, "patch buf rd fail\n");
return ret;
}
AICWFDBG(LOGINFO, "%x=%x\n", rd_patch_addr_cfm.memaddr, rd_patch_addr_cfm.memdata);
patch_buff_base = rd_patch_addr_cfm.memdata;
patch_addr = start_addr = patch_buff_base;
}
#endif
if ((ret = rwnx_send_dbg_mem_write_req(usb_dev, AIC_PATCH_ADDR(magic_num), AIC_PATCH_MAGIG_NUM))) {
AICWFDBG(LOGERROR, "maigic_num[0x%x] write fail: %d\n", AIC_PATCH_ADDR(magic_num), ret);
return ret;
@@ -334,7 +234,6 @@ int system_config_8800d80(struct aic_usb_dev *usb_dev){
int syscfg_num;
int ret, cnt;
const u32 mem_addr = 0x40500000;
const u32 cache_mem_addr = 0x40100020;
struct dbg_mem_read_cfm rd_mem_addr_cfm;
ret = rwnx_send_dbg_mem_read_req(usb_dev, mem_addr, &rd_mem_addr_cfm);
if (ret) {
@@ -346,19 +245,7 @@ int system_config_8800d80(struct aic_usb_dev *usb_dev){
}
chip_id = (u8)(rd_mem_addr_cfm.memdata >> 16);
printk("chip_id=%x, chip_mcu_id = %d\n", chip_id, chip_mcu_id);
if (chip_mcu_id) {
ret = rwnx_send_dbg_mem_read_req(usb_dev, cache_mem_addr, &rd_mem_addr_cfm);
if (ret) {
printk("%x rd fail: %d\n", mem_addr, ret);
return ret;
}
rd_mem_addr_cfm.memdata |= 0x01;
ret = rwnx_send_dbg_mem_write_req(usb_dev, cache_mem_addr, rd_mem_addr_cfm.memdata);
if (ret) {
printk("%x write fail: %d\n", cache_mem_addr, ret);
return ret;
}
}
printk("issue58: using Radxa SDK V3 D80 loader profile\n");
#if 1
syscfg_num = sizeof(syscfg_tbl_8800d80) / sizeof(u32) / 2;
for (cnt = 0; cnt < syscfg_num; cnt++) {
+39 -14
View File
@@ -9,8 +9,10 @@ chip_id=7, chip_mcu_id=1
```
Do not merge this branch as a general firmware downgrade. It replaces the
complete `fw/aic8800D80` firmware set so that an affected device can test one
specific hypothesis. Firmware for D80N, D80X2, DC, and other variants is not
complete `fw/aic8800D80` firmware set and matches the D80 loader's FMAC patch
table, patch-buffer layout, and MCU cache setup to that firmware generation.
The USB transport and modern-kernel compatibility code remain current.
Firmware and loader paths for D80N, D80X2, DC, and other variants are not
changed.
## Hypothesis
@@ -30,6 +32,12 @@ fixed at upstream commit
The normal FMAC file has SHA-256
`1ec680c2b63dcaa0e5d33c5fb6d1857d030f8145c05c385e243760388a61a0da`.
The first hardware test proved that this image uploads completely without the
`0x170400` timeout, but the device then failed to re-enumerate while the newer
loader was still applying SDK V5-era FMAC patches and MCU cache setup. This
follow-up matches those loader operations to V3 so that their effect can be
tested separately, while retaining unrelated fixes in the current driver.
## Install the test branch
From an existing clone:
@@ -37,6 +45,7 @@ From an existing clone:
```bash
git fetch origin
git switch test/issue-58-mcu1-legacy-fw
git pull --ff-only
sudo ./install.sh
```
@@ -45,47 +54,63 @@ device does not re-enumerate cleanly.
## Verify
First save the complete kernel log and confirm that firmware upload passes the
old failure address without a command timeout:
First save the complete kernel log and confirm that the V3 loader profile is
active, firmware upload passes the old failure address, and the adapter
re-enumerates after `a69c:8d80`:
```bash
sudo dmesg -C
# Disconnect and reconnect the device, then wait for initialization.
sudo dmesg | tee issue58-legacy-fw-dmesg.txt
sudo dmesg | grep -iE 'aic|chip_id|chip_mcu_id|fmacfw|bin upload|cmd timed-out'
sudo dmesg | grep -iE 'aic|issue58|chip_id|chip_mcu_id|fmacfw|bin upload|cmd timed-out|error -110'
lsusb
lsusb -t
```
The log must contain:
```text
issue58: using Radxa SDK V3 D80 loader profile
```
Please report all of the following, even if an earlier item fails:
1. The `chip_id` and `chip_mcu_id` lines, and whether firmware upload completes.
2. Whether nearby SSIDs can be scanned.
3. Whether Wi-Fi association succeeds.
4. Whether the interface receives an address by DHCP.
5. Whether the gateway and an Internet address can be pinged, and whether real
2. Whether the adapter re-enumerates and creates an interface owned by
`aic8800_fdrv`.
3. Whether nearby SSIDs can be scanned through that AIC interface.
4. Whether Wi-Fi association succeeds through that interface.
5. Whether the interface receives an address by DHCP.
6. Whether the gateway and an Internet address can be pinged, and whether real
traffic works.
6. Whether Bluetooth still enumerates and works through the kernel's standard
7. Whether Bluetooth still enumerates and works through the kernel's standard
`btusb` driver. This test does not install or use `aic_btusb`.
Useful commands:
```bash
iw dev
nmcli device status
nmcli device wifi list
ip address
ip route
ping -c 4 "$(ip route | awk '/default/ {print $3; exit}')"
ping -c 4 1.1.1.1
lsusb -t
bluetoothctl list
```
If NetworkManager is unavailable, identify the interface with `iw dev`, then
replace `wlan0` below with that interface name:
Identify the new AIC interface with `iw dev`, then replace `wlan0` below with
that interface name. Confirm its driver before treating scan or traffic from
another onboard adapter as a successful result:
```bash
readlink -f /sys/class/net/wlan0/device/driver
sudo iw dev wlan0 scan | grep SSID
ip route show dev wlan0
ping -I wlan0 -c 4 1.1.1.1
```
The driver path should end in `/aic8800_fdrv`.
## Return to the current V5 firmware
The installer replaces the firmware under `/lib/firmware`, so merely switching