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_OFST(mem) ((size_t) &((aic_patch_t *)0)->mem)
#define AIC_PATCH_ADDR(mem) ((u32) (aic_patch_str_base + AIC_PATCH_OFST(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) * Issue #58 legacy-loader test.
#define USER_TX_USE_ANA_F_FLAG (0x01U << 2) *
#define USER_APM_PRBRSP_OFFLOAD_DISABLE_FLAG (0x01U << 3) * Keep this table aligned with the SDK V3 D80 firmware imported from Radxa
#define USER_HE_MU_EDCA_UPDATE_DISABLE_FLAG (0x01U << 4) * commit 254d47e6a131dbed5ba32131972f4719f3e1c7fe. Newer loader patches use
#define USER_LOFT_CALIB_DISABLE_FLAG (0x01U << 6) * different RX aggregation settings and a user_ext_flags field that is not
#define USER_CAPA_CALIB_DISABLE_FLAG (0x01U << 7) * part of this firmware generation.
#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)
u32 patch_tbl_d80[][2] = u32 patch_tbl_d80[][2] =
{ {
#ifdef USE_5G #ifdef USE_5G
@@ -76,54 +54,7 @@ u32 patch_tbl_d80[][2] =
#else #else
{0x00b4, 0xf3010000}, {0x00b4, 0xf3010000},
#endif #endif
#ifdef CONFIG_PLATFORM_HI {0x0170, 0x00000002},//rx aggr counter
{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
}; };
//adap test //adap test
@@ -144,16 +75,11 @@ u32 syscfg_tbl_8800d80[][2] = {
extern int adap_test; extern int adap_test;
#define NEW_PATCH_BUFFER_MAP 1
int aicwf_patch_config_8800d80(struct aic_usb_dev *usb_dev) int aicwf_patch_config_8800d80(struct aic_usb_dev *usb_dev)
{ {
u32 rd_patch_addr; u32 rd_patch_addr;
u32 aic_patch_addr; u32 aic_patch_addr;
u32 config_base, aic_patch_str_base; 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; uint32_t start_addr = 0x001D7000;
u32 patch_addr = start_addr; u32 patch_addr = start_addr;
u32 patch_cnt = sizeof(patch_tbl_d80) / 4 / 2; 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); AICWFDBG(LOGERROR, "%x=%x\n", rd_patch_addr_cfm.memaddr, rd_patch_addr_cfm.memdata);
aic_patch_str_base = 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))) { 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); AICWFDBG(LOGERROR, "maigic_num[0x%x] write fail: %d\n", AIC_PATCH_ADDR(magic_num), ret);
return ret; return ret;
@@ -334,7 +234,6 @@ int system_config_8800d80(struct aic_usb_dev *usb_dev){
int syscfg_num; int syscfg_num;
int ret, cnt; int ret, cnt;
const u32 mem_addr = 0x40500000; const u32 mem_addr = 0x40500000;
const u32 cache_mem_addr = 0x40100020;
struct dbg_mem_read_cfm rd_mem_addr_cfm; struct dbg_mem_read_cfm rd_mem_addr_cfm;
ret = rwnx_send_dbg_mem_read_req(usb_dev, mem_addr, &rd_mem_addr_cfm); ret = rwnx_send_dbg_mem_read_req(usb_dev, mem_addr, &rd_mem_addr_cfm);
if (ret) { 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); chip_id = (u8)(rd_mem_addr_cfm.memdata >> 16);
printk("chip_id=%x, chip_mcu_id = %d\n", chip_id, chip_mcu_id); printk("chip_id=%x, chip_mcu_id = %d\n", chip_id, chip_mcu_id);
if (chip_mcu_id) { printk("issue58: using Radxa SDK V3 D80 loader profile\n");
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;
}
}
#if 1 #if 1
syscfg_num = sizeof(syscfg_tbl_8800d80) / sizeof(u32) / 2; syscfg_num = sizeof(syscfg_tbl_8800d80) / sizeof(u32) / 2;
for (cnt = 0; cnt < syscfg_num; cnt++) { 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 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 complete `fw/aic8800D80` firmware set and matches the D80 loader's FMAC patch
specific hypothesis. Firmware for D80N, D80X2, DC, and other variants is not 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. changed.
## Hypothesis ## Hypothesis
@@ -30,6 +32,12 @@ fixed at upstream commit
The normal FMAC file has SHA-256 The normal FMAC file has SHA-256
`1ec680c2b63dcaa0e5d33c5fb6d1857d030f8145c05c385e243760388a61a0da`. `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 ## Install the test branch
From an existing clone: From an existing clone:
@@ -37,6 +45,7 @@ From an existing clone:
```bash ```bash
git fetch origin git fetch origin
git switch test/issue-58-mcu1-legacy-fw git switch test/issue-58-mcu1-legacy-fw
git pull --ff-only
sudo ./install.sh sudo ./install.sh
``` ```
@@ -45,47 +54,63 @@ device does not re-enumerate cleanly.
## Verify ## Verify
First save the complete kernel log and confirm that firmware upload passes the First save the complete kernel log and confirm that the V3 loader profile is
old failure address without a command timeout: active, firmware upload passes the old failure address, and the adapter
re-enumerates after `a69c:8d80`:
```bash ```bash
sudo dmesg -C sudo dmesg -C
# Disconnect and reconnect the device, then wait for initialization. # Disconnect and reconnect the device, then wait for initialization.
sudo dmesg | tee issue58-legacy-fw-dmesg.txt 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: 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. 1. The `chip_id` and `chip_mcu_id` lines, and whether firmware upload completes.
2. Whether nearby SSIDs can be scanned. 2. Whether the adapter re-enumerates and creates an interface owned by
3. Whether Wi-Fi association succeeds. `aic8800_fdrv`.
4. Whether the interface receives an address by DHCP. 3. Whether nearby SSIDs can be scanned through that AIC interface.
5. Whether the gateway and an Internet address can be pinged, and whether real 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. 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`. `btusb` driver. This test does not install or use `aic_btusb`.
Useful commands: Useful commands:
```bash ```bash
iw dev iw dev
nmcli device status
nmcli device wifi list nmcli device wifi list
ip address ip address
ip route ip route
ping -c 4 "$(ip route | awk '/default/ {print $3; exit}')"
ping -c 4 1.1.1.1
lsusb -t lsusb -t
bluetoothctl list bluetoothctl list
``` ```
If NetworkManager is unavailable, identify the interface with `iw dev`, then Identify the new AIC interface with `iw dev`, then replace `wlan0` below with
replace `wlan0` below with that interface name: that interface name. Confirm its driver before treating scan or traffic from
another onboard adapter as a successful result:
```bash ```bash
readlink -f /sys/class/net/wlan0/device/driver
sudo iw dev wlan0 scan | grep SSID 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 ## Return to the current V5 firmware
The installer replaces the firmware under `/lib/firmware`, so merely switching The installer replaces the firmware under `/lib/firmware`, so merely switching