Adding OpenWrt support for Xiaomi AX3600 (Part 1)

The Xiaomi AX3600 it's glorious and AX1800 it's almost so good, but smaller (charmy) and with half price.

NEW-Mi-Xiaomi-Router-AX1800-Wifi-6-5-Core-256M-Memory-Mesh-Home-IoT-4-Signal

I hope that IPQ6000 AX1800 it's not so different than IPQ8071 AX3600, so is there any chances to port AX1800 to openwrt in mid future too?

1 Like

Ipq6000 support for the kernel is still ver very VERY bad. I think the gcc (global clock controller) is not even approved upstream

2 Likes

:worried:

Okay, so let's buy the big crab and soon put openwrt on it! Thanks!

Would a build from Qualcomm's Ipq6000 source be possible like there is for the AX3600?

Yeah the best you have in terms of ipq60xx support is in the QCOM staging tree .

https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux.git/tree/arch/arm64/boot/dts/qcom/ipq6018.dtsi?h=for-next

1 Like

No it's not possible. Besides, squashfs is not some read-write fs, so there's no advantage to running it on-device.

Your root password and /etc/config/miwifi is on a separate partition. If that's not re-created or re-initialized on an upgrade, that means the router didn't perform an upgrade properly - likely flag_ota_reboot was not set.

A more accurate check for whether the firmware was modified is to see if files like /usr/sbin/otapredownload is zero-sized.

That's normal. The mod removes phone-home functionality from the router, not block off the manufacturer's servers. Otherwise users having Xiaomi IoT products would suddenly all not work.

1 Like

You may want to look at the QSDK source here:

https://source.codeaurora.org/quic/qsdk/oss/kernel/linux-msm/tree/?h=NHSS.QSDK.12.0.r2

It's for the 4.4 kernel, but it should be doable to make it work on 5.4 once the mechanics of the drivers are understood.

QSDK 12 appears to be the latest AFAIK.

2 Likes

Anybody have any idea?

root@OpenWrt:/sys/kernel/debug/ath11k/ipq8074 hw2.0/mac1/fw_stats# cat pdev_stat
s
[ 2172.830093] got wmi event id UPDATE STATS 0x1d004
[ 2638.929695] got wmi event id 0x1d004

             ath11k PDEV stats
             =================

           Channel noise floor        -96
              Channel TX power         52
                TX frame count          0
                RX frame count 1396908160
                RX clear count    9675200
                   Cycle count 3926238656
               PHY error count          0

          ath11k PDEV TX stats
          ====================

            HTT cookies queued          0
             HTT cookies disp.          0
                   MSDU queued         36
                   MPDU queued         36
                 MSDUs dropped          0
                  Local enqued         36
                   Local freed         36
                     HW queued        144
                  PPDUs reaped        144
                 Num underruns          0
                 PPDUs cleaned          0
                  MPDUs requed          0
             Excessive retries        144
                       HW rate          0
           Sched self triggers        144
     Dropped due to SW retries          3
       Illegal rate phy errors   56086580
        PDEV continuous xretry          0
                    TX timeout          0
                   PDEV resets          0
 Stateless TIDs alloc failures          0
                  PHY underrun          0
  MPDU is more than txop limit          0

          ath11k PDEV RX stats
          ====================

         Mid PPDU route change          0
       Tot. number of statuses          0
        Extra frags on rings 0         36
        Extra frags on rings 1          0
        Extra frags on rings 2         36
        Extra frags on rings 3          0
        MSDUs delivered to HTT          0
        MPDUs delivered to HTT          0
      MSDUs delivered to stack          0
      MPDUs delivered to stack          0
               Oversized AMSUs          0
                    PHY errors        144
              PHY errors drops          0
   MPDU errors (FCS, MIC, ENC)          0
1 Like

The init cmd from qsdk:

Length = 85
CMD ID = 16001 WMI_REQUEST_STATS_CMDID
CMD TIME = [62.870026]
CMD = 4 0 dac3538c e2f9
CMD ID = 16001 WMI_REQUEST_STATS_CMDID
CMD TIME = [61.870022]
CMD = 4 0 dac3538c e2f9
CMD ID = 16001 WMI_REQUEST_STATS_CMDID
CMD TIME = [60.870026]
CMD = 4 0 dac3538c e2f9
CMD ID = 16001 WMI_REQUEST_STATS_CMDID
CMD TIME = [59.870025]
CMD = 4 0 dac3538c e2f9
CMD ID = 16001 WMI_REQUEST_STATS_CMDID
CMD TIME = [58.870026]
CMD = 4 0 dac3538c e2f9
CMD ID = 16001 WMI_REQUEST_STATS_CMDID
CMD TIME = [57.870023]
CMD = 4 0 dac3538c e2f9
CMD ID = 16001 WMI_REQUEST_STATS_CMDID
CMD TIME = [56.870024]
CMD = 4 0 dac3538c e2f9
CMD ID = 16001 WMI_REQUEST_STATS_CMDID
CMD TIME = [55.870027]
CMD = 4 0 dac3538c e2f9
CMD ID = 16001 WMI_REQUEST_STATS_CMDID
CMD TIME = [54.870032]
CMD = 4 0 dac3538c e2f9
CMD ID = 16001 WMI_REQUEST_STATS_CMDID
CMD TIME = [53.870025]
CMD = 4 0 dac3538c e2f9
CMD ID = 16001 WMI_REQUEST_STATS_CMDID
CMD TIME = [52.870024]
CMD = 4 0 dac3538c e2f9
CMD ID = 16001 WMI_REQUEST_STATS_CMDID
CMD TIME = [51.870021]
CMD = 4 0 dac3538c e2f9
CMD ID = 16001 WMI_REQUEST_STATS_CMDID
CMD TIME = [50.870027]
CMD = 4 0 dac3538c e2f9
CMD ID = 16001 WMI_REQUEST_STATS_CMDID
CMD TIME = [49.870019]
CMD = 4 0 dac3538c e2f9
CMD ID = 16001 WMI_REQUEST_STATS_CMDID
CMD TIME = [48.870025]
CMD = 4 0 dac3538c e2f9
CMD ID = 16001 WMI_REQUEST_STATS_CMDID
CMD TIME = [47.870026]
CMD = 4 0 dac3538c e2f9
CMD ID = 16001 WMI_REQUEST_STATS_CMDID
CMD TIME = [46.870060]
CMD = 4 0 dac3538c e2f9
CMD ID = 7003 WMI_BCN_TMPL_CMDID
CMD TIME = [45.887711]
CMD = 0 41 1ba 0
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [45.881643]
CMD = 0 19 10000003 0
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [45.877917]
CMD = 0 19 10000003 0
CMD ID = 2a003 WMI_OBSS_COLOR_COLLISION_DET_CONFIG_CMDID
CMD TIME = [45.874166]
CMD = 0 0 1 39
CMD ID = 5005 WMI_VDEV_UP_CMDID
CMD TIME = [45.874150]
CMD = 0 0 dac3538c e2f9
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [45.874142]
CMD = 0 3 64 0
CMD ID = 700b WMI_BCN_OFFLOAD_CTRL_CMDID
CMD TIME = [45.874131]
CMD = 0 2 0 101
CMD ID = 7003 WMI_BCN_TMPL_CMDID
CMD TIME = [45.874112]
CMD = 0 41 1ba 0
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [45.874068]
CMD = 0 2d 37d 0
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [45.873804]
CMD = 0 7 2 0
CMD ID = 500d WMI_VDEV_SET_WMM_PARAMS_CMDID
CMD TIME = [45.873777]
CMD = 0 c70018 f 3f
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [45.568353]
CMD = 0 21 1 0
CMD ID = 5009 WMI_VDEV_INSTALL_KEY_CMDID
CMD TIME = [45.568188]
CMD = 0 dac3538c e2f9 1
CMD ID = 4003 WMI_PDEV_SET_PARAM_CMDID
CMD TIME = [45.551466]
CMD = 1 24 0 80014
CMD ID = 4003 WMI_PDEV_SET_PARAM_CMDID
CMD TIME = [45.551459]
CMD = 1 bc 80 80014
CMD ID = 40001 WMI_PDEV_OBSS_PD_SPATIAL_REUSE_CMDID
CMD TIME = [45.551449]
CMD = 1 0 0 0
CMD ID = 5003 WMI_VDEV_START_REQUEST_CMDID
CMD TIME = [45.551432]
CMD = 0 0 64 1
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [45.551233]
CMD = 0 2f 1 80014
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [45.551204]
CMD = 0 1a 0 a326361
CMD ID = 4003 WMI_PDEV_SET_PARAM_CMDID
CMD TIME = [45.551191]
CMD = 1 24 0 0
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [45.551087]
CMD = 0 3 64 0
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [45.551057]
CMD = 0 d 1 0
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [45.512346]
CMD = 0 1a 0 0
CMD ID = 3a004 WMI_SET_INIT_COUNTRY_CMDID
CMD TIME = [42.349953]
CMD = 2 1 9c 0
CMD ID = 4003 WMI_PDEV_SET_PARAM_CMDID
CMD TIME = [41.607895]
CMD = 1 4 3c 0
CMD ID = 3001 WMI_START_SCAN_CMDID
CMD TIME = [41.450650]
CMD = a001 a005 0 3
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [41.293516]
CMD = 0 20 1 80014
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [41.084163]
CMD = 0 8002 1b 0
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [41.063648]
CMD = 0 8002 3b 0
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [41.044706]
CMD = 0 2d 37d 38
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [41.044677]
CMD = 0 2d 37d 80014
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [40.707877]
CMD = 0 f 0 0
CMD ID = 6001 WMI_PEER_CREATE_CMDID
CMD TIME = [40.355187]
CMD = 0 dac3538c e2f9 0
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [40.295340]
CMD = 0 87 1 0
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [40.288498]
CMD = 0 8002 7b 0
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [40.268101]
CMD = 0 7e 3 0
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [40.268085]
CMD = 0 1d 3 0
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [40.255117]
CMD = 0 1c 1 0
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [40.255101]
CMD = 0 d 1 12800005
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [40.255076]
CMD = 0 2a 12c 0
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [40.255069]
CMD = 0 29 127 0
CMD ID = 5008 WMI_VDEV_SET_PARAM_CMDID
CMD TIME = [40.255061]
CMD = 0 28 93 0
CMD ID = 1d010 WMI_ECHO_CMDID
CMD TIME = [40.255036]
CMD = 0 0 49c42cff 76c44f3b
CMD ID = 5001 WMI_VDEV_CREATE_CMDID
CMD TIME = [40.254932]
CMD = 0 1 0 dac3538c
CMD ID = 4003 WMI_PDEV_SET_PARAM_CMDID
CMD TIME = [39.664704]
CMD = 1 61 64 0
CMD ID = 4003 WMI_PDEV_SET_PARAM_CMDID
CMD TIME = [39.558548]
CMD = 1 5c 6 0
CMD ID = 4003 WMI_PDEV_SET_PARAM_CMDID
CMD TIME = [39.525680]
CMD = 1 5c 1 80014
CMD ID = 3003 WMI_SCAN_CHAN_LIST_CMDID
CMD TIME = [39.180876]
CMD = d 0 1 12016c
CMD ID = 3003 WMI_SCAN_CHAN_LIST_CMDID
CMD TIME = [39.166365]
CMD = d 0 1 12016c
CMD ID = 3a004 WMI_SET_INIT_COUNTRY_CMDID
CMD TIME = [39.161683]
CMD = 1 1 9c 0
CMD ID = 1d017 WMI_TRANSFER_DATA_TO_FLASH_CMDID
CMD TIME = [35.555486]
CMD = 1 1 64 2
CMD ID = 4003 WMI_PDEV_SET_PARAM_CMDID
CMD TIME = [35.554125]
CMD = 1 bc 80 0
CMD ID = a005 WMI_PDEV_DFS_PHYERR_OFFLOAD_ENABLE_CMDID
CMD TIME = [35.554075]
CMD = 0 ffff 70060 0
CMD ID = 4034 WMI_PDEV_WAL_POWER_DEBUG_CMDID
CMD TIME = [35.553065]
CMD = 1 1 53519000 0
CMD ID = 4034 WMI_PDEV_WAL_POWER_DEBUG_CMDID
CMD TIME = [35.552002]
CMD = 1 0 58702000 0
CMD ID = 3e001 WMI_TWT_ENABLE_CMDID
CMD TIME = [35.551162]
CMD = 1 1388 0 a
CMD ID = 3003 WMI_SCAN_CHAN_LIST_CMDID
CMD TIME = [35.509198]
CMD = 19 0 1 1202bc
CMD ID = 4021 WMI_PDEV_SET_MIMOGAIN_TABLE_CMDID
CMD TIME = [35.501848]
CMD = 1 3e8 1 1ba869c0
CMD ID = 4003 WMI_PDEV_SET_PARAM_CMDID
CMD TIME = [35.463710]
CMD = 1 a 1 0
CMD ID = 4003 WMI_PDEV_SET_PARAM_CMDID
CMD TIME = [35.463555]
CMD = 1 5b 1 2
CMD ID = 4003 WMI_PDEV_SET_PARAM_CMDID
CMD TIME = [35.352363]
CMD = 1 7 1 2
CMD ID = 4003 WMI_PDEV_SET_PARAM_CMDID
CMD TIME = [35.352356]
CMD = 1 60 7d0 0
CMD ID = 4003 WMI_PDEV_SET_PARAM_CMDID
CMD TIME = [35.352347]
CMD = 1 50 3001f40 72656874
CMD ID = 4003 WMI_PDEV_SET_PARAM_CMDID
CMD TIME = [35.352340]
CMD = 1 50 2001f40 72656874
CMD ID = 4003 WMI_PDEV_SET_PARAM_CMDID
CMD TIME = [35.352331]
CMD = 1 50 1001f40 1bb04f70
CMD ID = 4003 WMI_PDEV_SET_PARAM_CMDID
CMD TIME = [35.352306]
CMD = 1 50 1f40 10008
CMD ID = 1d010 WMI_THERMAL_MGMT_CMDID
CMD TIME = [35.222748]
CMD = 0 0 23ca52eb dba380e6
CMD ID = 1 WMI_INIT_CMDID
CMD TIME = [35.012296]
CMD = 1000000 2c2 5f414351 4c4d

The init cmd from ath11k:

root@OpenWrt:/# dmesg |grep wmi|grep cmdid
[    8.143392] wmi cmdid 00000001 length 844
[    8.416316] wmi cmdid 00004034 length 52
[    8.418413] wmi cmdid 00004034 length 52

All i can think of is that we are missing some patches for ath11k.

Also we need to make use of the correct bdwlan.bin from stock (bdwlan.b292)

  1. remove board-2.bin from firmware
  2. add bdwlan.b292 to /lib/firmware/IPQ8074/bdwlan.bin

But i dont think that will fix the issues we are seeing, its probably just ath11k missing something.

I have tested the latest code from https://source.codeaurora.org/quic/qsdk/kvalo/ath/.
Don't know why the firmware recived so many frames but no interrupt.
Don't know what are these errors means

Illegal rate phy errors   56086580

In that case try with the correct bdwlan file from stock

How should I let the ath11k to load bdwlan?
I deleted board-2.bin and add bdwlan, but the ath11k will not load bdwlan.bin

ath11k checks for board-2.bin and if not found it will load bdwlan. See :

The function ath11k_core_fetch_board_data_api_1 should load bdwlan.bin

Edit ...

The file names are defined https://github.com/torvalds/linux/blob/master/drivers/net/wireless/ath/ath11k/hw.h#L77

ath11k_core_fetch_board_data_api_1will load board.bin, not bdwlan.

On master kernel its looks for :

in function

They have just renamed that file, see

https://source.codeaurora.org/quic/qsdk/kvalo/ath/commit/drivers/net/wireless/ath/ath11k/hw.h?h=kernel-ath/ath11k-qca6390-bringup&id=93a5b668806c1d868f7f9f0438321006200c049f

So just copy bdwlan.b292 from stock to /lib/firmware/IPQ8074/board.bin

With bdwlan,
Panic:

wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
wlan0: interface state COUNTRY_UPDATE->HT_SCAN[   23.454596] wmi cmdid 00003001 length 304
[   23.458586] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008
[   23.462562] Mem abort info:

[   23.473971]   ESR = 0x96000004
[   23.474327]   EC = 0x25: DABT (current EL), IL = 32 bits
[   23.477285]   SET = 0, FnV = 0
[   23.482745]   EA = 0, S1PTW = 0
[   23.485608] Data abort info:
[   23.488647]   ISV = 0, ISS = 0x00000004
[   23.491774]   CM = 0, WnR = 0
[   23.495334] user pgtable: 4k pages, 48-bit VAs, pgdp=000000005611c000
[   23.498467] [0000000000000008] pgd=0000000000000000, p4d=0000000000000000
[   23.504896] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[   23.511651] Modules linked in: ath11k
[   23.517032] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W         5.8.0-02483-gc0842fbc1b18-dirty #41
[   23.520865] Hardware name: AX3600 (DT)
[   23.530398] pstate: 40000005 (nZcv daif -PAN -UAO BTYPE=--)
[   23.534056] pc : skb_release_data+0x84/0x1a0
[   23.539514] lr : skb_release_all+0x28/0x38
[   23.544024] sp : ffff800010003cb0
[   23.547928] x29: ffff800010003cb0 x28: ffff0000031f2e30
[   23.551319] x27: ffff0000199e18d0 x26: ffff0000031f0000
[   23.556701] x25: ffff0000031f1a10 x24: 0000000000001a10
[   23.561996] x23: 0000000000000001 x22: ffff000016282740
[   23.567291] x21: ffff000016242f00 x20: ffff000016282770
[   23.572586] x19: 0000000000000000 x18: 000000000000000e
[   23.577881] x17: 0000000000000001 x16: 0000000000000019
[   23.583177] x15: 0000000000000000 x14: 0000000000000000
[   23.588472] x13: 0000000000000002 x12: 0000000000000000
[   23.593766] x11: 0000000000000040 x10: ffff800012501d28
[   23.599062] x9 : ffff800012501d20 x8 : ffff00001d800270
[   23.604358] x7 : ffff00001deb7fc8 x6 : 00000000157da4cb
[   23.609653] x5 : 0000000000000000 x4 : 0000000000000000
[   23.614946] x3 : 0000000000000000 x2 : ffff000016242f00
[   23.620243] x1 : 0000000000000180 x0 : 0000000000000000
[   23.625539] Call trace:
[   23.630828]  skb_release_data+0x84/0x1a0
[   23.633002]  skb_release_all+0x28/0x38
[   23.637168]  consume_skb+0x30/0x90
[   23.640726]  __dev_kfree_skb_any+0x44/0x50
[   23.644154]  ath11k_ce_send_done_cb+0x10c/0x150 [ath11k]
[   23.648227]  ath11k_ce_per_engine_service+0x60/0x388 [ath11k]
[   23.653694]  ath11k_ahb_ce_tasklet+0x20/0x40 [ath11k]
[   23.659313]  tasklet_action_common.isra.0+0x11c/0x170
[   23.664342]  tasklet_action+0x28/0x38
[   23.669374]  efi_header_end+0x120/0x25c
[   23.673019]  irq_exit+0xc0/0xe0
[   23.676664]  __handle_domain_irq+0x68/0xc0
[   23.679793]  gic_handle_irq+0x54/0xa8
[   23.683955]  el1_irq+0xb8/0x180
[   23.687689]  arch_cpu_idle+0x14/0x20
[   23.690642]  do_idle+0x210/0x288
[   23.694458]  cpu_startup_entry+0x28/0x70
[   23.697674]  rest_init+0xd8/0xe8
[   23.701579]  arch_call_rest_init+0x10/0x1c
[   23.704790]  start_kernel+0x4a4/0x4dc
[   23.708701] Code: 91004294 6b13001f 5400028d f9400280 (f9400401)
[   23.712443] ---[ end trace ec03bacfb781446a ]---
[   23.718507] Kernel panic - not syncing: Fatal exception in interrupt
[   23.723201] SMP: stopping secondary CPUs
[   23.729535] Kernel Offset: 0x80000 from 0xffff800010000000
[   23.733438] PHYS_OFFSET: 0x40000000
[   23.738727] CPU features: 0x0240002,20802004
[   23.742114] Memory Limit: none
[   23.746631] Rebooting in 3 seconds..

@gmzhuo that seems like it got further tho, what happens with an STA scan ?

Yes, iw dev wlan0 scan or start hostapd