IPQ4019: Adding Support For Tp Link Deco M9 Plus

Yea i checked and that is empty

I used copilot to write the partition table and a quick check seemed that is good.
Then it might be the nand_pins section that you asked me to add.

What bdf's are you using ?

is bdf board definition files ? (guessing)

here is the patch that I have used:

The board bdfs. You need to add them to ipq-wifi.

Check out my adventure adding the b3000, you'll find much of the info you need within the discussions

I also ecommend you checkout the b3000 dts. Its a very simple device, so the nand stuff is pretty clear and non convoluted. It should help you put the pieces together

My bet is on the NAND DMA, that is the only thing that can be not enabled

Do you have the stock boot log ?

https://github.com/meshing-m/m9plus-openwrt/raw/refs/heads/main/uart_log.txt

Upon review of the stock boot log, the b3000.dts is not the best reference in regaurds to the nand. However, since its booting already, i would focus on generating the proper bdf ... if you look at the deco referenced above you get the idea

you'll find the bdf here


package/firmware/ipq-wifi/board-tplink_deco-m5.qca4019

Its a binary so it does not show ... but note the name of the file, yours will need to follow the same format when generating it. You may also want to download the actual file and run strings on it, to get the variant string, if the variant string is in fact a requirement for 4019 ? This may only be a 5018 flavour requirement but its worth the mention.

Once you get the proper bdf in place, the wifi should come up.

I believe what this means for the dts is that because the nand entry in qcom-ipq4019.dtsi references qpic_bam for dma's, we need to enable qpic_bam

so add:

&qpic_bam {
        status = "okay";
};

to fix nand flash problem

@naf @robimarko bingo!

root@OpenWrt:~# cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 00100000 00020000 "0:SBL1"
mtd1: 00100000 00020000 "0:MIBIB"
mtd2: 00100000 00020000 "0:BOOTCONFIG"
mtd3: 00100000 00020000 "0:QSEE"
mtd4: 00080000 00020000 "0:CDT"
mtd5: 00080000 00020000 "0:BOOTCONFIG1"
mtd6: 00180000 00020000 "0:APPSBLENV"
mtd7: 00200000 00020000 "0:APPSBL"
mtd8: 00080000 00020000 "0:ART"
mtd9: 02d00000 00020000 "rootfs"
mtd10: 02d00000 00020000 "rootfs_1"
mtd11: 00900000 00020000 "factory_data"
mtd12: 01100000 00020000 "runtime_data"
root@OpenWrt:~# 
1 Like

I will try to digest this.. one attempt at this failed(same errors for wifi).

regarding wifi, a couple of (uneducated and untested) suggestions:
you added m9+ to the ipq-wifi Makefile, but you didn't build or include that package.
i think you need too add this to your Makefile:

DEVICE_PACKAGES := ipq-wifi-tplink_deco-m9plus

you should also bring back all the nvmem references in the dts that you added initially but removed in a later commit, especially the ones regarding wifi cal and firmware variant name. i assume that when nand was broken this was necessary to get the network stuff to come up at all, but now that nand is fixed they need to come back.

i couldn't immediately find your mac address location in flash, but thats a secondary issue.

this is correct. You can select the package manually, but being that its an essential package, it should be set by default as suggested above by naf

guess we should read the instructions also:

i assume the "needed board files" are extracted from the stock fw?

$ grep --binary-files=text "Selecting board data file" ~/tplink-m9plus/dump/m9plus-openwrt/uart_log.txt
[   31.033924]  wifi0: Selecting board data file name boardData_1_0_IPQ4019_DK04_2G_US.bin
[   33.916989]  wifi1: Selecting board data file name boardData_1_0_IPQ4019_DK04_5G_US.bin
[   36.874529]  wifi2: Selecting board data file name boardData_2_0_QCA9888_5G_Y9690_SBS_HB_US.bin

$ pwd
/home/naf/tplink-m9plus/stock/_M9Plus_2.0_1.6.4.bin.extracted/ubifs-root/1814.ubi/squashfs-root

$ md5sum lib/firmware/IPQ4019/hw.1/boardData_1_0_IPQ4019_DK04_2G_US.bin lib/firmware/IPQ4019/hw.1/boardData_1_0_IPQ4019_DK04_5G_US.bin lib/firmware/QCA9888/hw.2/boardData_2_0_QCA9888_5G_Y9690_SBS_HB_US.bin
2002da87269fd7063d6320e88160192a  lib/firmware/IPQ4019/hw.1/boardData_1_0_IPQ4019_DK04_2G_US.bin
a4b067ed4e8adaaa3340e8b500c93591  lib/firmware/IPQ4019/hw.1/boardData_1_0_IPQ4019_DK04_5G_US.bin
66ace6ea333b38ec65cd0deadac9c418  lib/firmware/QCA9888/hw.2/boardData_2_0_QCA9888_5G_Y9690_SBS_HB_US.bin

one of these?

or do you mean literally just rename the m5 version from here: https://github.com/dutchmillbytes/openwrt/raw/82156967e00b38aa4cc80909bc008e529519e666/package/firmware/ipq-wifi/board-tplink_deco-m5.qca4019 and put it somewhere?

EDIT TO ADD: it appears we should follow the instructions here: https://forum.openwrt.org/t/howto-create-ipq40xx-bdf-files

yes, the documentation is non existent from what i could gather. And no one will give a solid explanation, apparently it has to do with a NDA ??

With that said, I will outline what i did to create the bdf's , hopefully I will save you much of the agony

  1. indentify the bdf's being used in the stock firmware ... which it appears you have done already. (I say bdf's because the glinet b3000 uses 2 bdfs one for the ipq5018 and a second for the qcn6122. I believe you board only uses 1 ... based soley off of what I see in the m5 port, bare with me here, this will make more sense later.

  2. retrieve the stock bdfs discovered from the logs. Again, it seems you've already got them
    base on your last post

  3. download the bdf for the m5 and also the qca-swiss-army-knife from the links below

m5 bdf

qca-swiss-army-knife

  1. extract qca-swiss-army-knife to a folder named "qca-sak"

  2. place the m5 bdf and the stock bdfs, you retreived prior, in this folder aswell, then run the following command from a terminal in the qca-sak directory

 hostle@hostle-Satellite-C670:~/qca-sak$ ./qca-swiss-army-knife/tools/scripts/ath10k/ath10k-bdencoder -e ./board-tplink_deco-m5.qca4019 -o board.json

ouitput

bus=ahb,bmi-chip-id=0,bmi-board-id=20,variant=TP-Link_Deco_M5_EU_v3.0.bin created size: 12064
bus=ahb,bmi-chip-id=0,bmi-board-id=21,variant=TP-Link_Deco_M5_EU_v3.0.bin created size: 12064
board-2.json created
  1. now open the newly created board-2.json file

board-2.json

[
    {
        "names": [
            "bus=ahb,bmi-chip-id=0,bmi-board-id=20,variant=TP-Link_Deco_M5_EU_v3.0"
        ],
        "data": "bus=ahb,bmi-chip-id=0,bmi-board-id=20,variant=TP-Link_Deco_M5_EU_v3.0.bin"
    },
    {
        "names": [
            "bus=ahb,bmi-chip-id=0,bmi-board-id=21,variant=TP-Link_Deco_M5_EU_v3.0"
        ],
        "data": "bus=ahb,bmi-chip-id=0,bmi-board-id=21,variant=TP-Link_Deco_M5_EU_v3.0.bin"
    }
]

you need to edit the variant string and possibly the bmi-board-id too (in ipq5018, the generic id 255 is used for all boards, this does not seem to be the case in 4019)

assuming your ids are the same the edited file so look something like (not exactly like)

[
    {
        "names": [
            "bus=ahb,bmi-chip-id=0,bmi-board-id=20,variant=TP-Link_Deco_M9_plus_EU_v3.0"
        ],
        "data": "bus=ahb,bmi-chip-id=0,bmi-board-id=20,variant=TP-Link_Deco_M9_plus_EU_v3.0.bin"
    },
    {
        "names": [
            "bus=ahb,bmi-chip-id=0,bmi-board-id=21,variant=TP-Link_Deco_M9_plus_EU_v3.0"
        ],
        "data": "bus=ahb,bmi-chip-id=0,bmi-board-id=21,variant=TP-Link_Deco_M5_EU_v3.0.bin"
    }
]

the stock bin you use must be renamed to match the variant string used

ie

boardData_1_0_IPQ4019_DK04_2G_US.bin
becomes 
bus=ahb,bmi-chip-id=0,bmi-board-id=20,variant=TP-Link_Deco_M9_plus_EU_v3.0.bin

and 

boardData_1_0_IPQ4019_DK04_5G_US.bin
becomes 
bus=ahb,bmi-chip-id=0,bmi-board-id=21,variant=TP-Link_Deco_M9_plus_EU_v3.0.bin

  1. save the baord-2.json file and run the following command from the qca-sak directory
hostle@hostle-Satellite-C670:~/qca-sak$ ./qca-swiss-army-knife/tools/scripts/ath10k/ath10k-bdencoder -c board-2.json -o board-tplink_deco-m9-plus.qca4019

output

board binary file 'board-tplink_deco-m9-plus.qca4019' is created
hostle@hostle-Satellite-C670:~/qca-sak$ 
  1. place the newly created bdf in a folder named "src" inside of the ipq-wifi directory

build and, load the new firmware and hopefully watch wifi boot ..

again this is moreless an overview, you'll need to workout the details but the methods are all there. At least enough to keep you progressing. I'll answer what I can but i would be nice if someone that has done bdfs for the 4019 would come forward and help out

good luck

perhaps one of @RolandoMagico @DragonBluep @Lanchon can help out @meshing? [just the 3 most recent 4019 committers to https://github.com/openwrt/firmware_qca-wireless]

wifi0/wifi1 are working now. wifi2 which is qca9888 is not:

[   13.319296] ath10k_pci 0000:01:00.0: qca9888 hw2.0 target 0x01000000 chip_id 0x00000000 sub 0000:0000
[   13.319373] ath10k_pci 0000:01:00.0: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 0
[   13.332397] ath10k_pci 0000:01:00.0: firmware ver 10.4-3.9.0.2-00157 api 5 features no-p2p,mfp,peer-flow-ctrl,allows-mesh-bcast,no-ps,iram-recovery crc32 812c4602
[   13.619737] ath10k_pci 0000:01:00.0: failed to fetch board data for bus=pci,vendor=168c,device=0056,subsystem-vendor=0000,subsystem-device=0000 from ath10k/QCA9888/hw2.0/board-2.bin
[   13.814191] ath10k_pci 0000:01:00.0: failed to fetch board-2.bin or board.bin from ath10k/QCA9888/hw2.0
[   13.814279] ath10k_pci 0000:01:00.0: failed to fetch board file: -12
[   13.822818] ath10k_pci 0000:01:00.0: could not probe fw (-12)

latest commit.

In attempt to fixing the wifi2 errors I have tried installed ath10k-firmware-qca9888-ct and non ct versions but I get the same error...I am guessing some patching needs to be done in package/firmware/ath10k-ct-formware to generate the correct package and not the standard openwrt packages ?

https://lists.infradead.org/pipermail/ath10k/2024-March/015395.html

This sounds very similar.. maybe it's broken on main

:partying_face:

root@OpenWrt:~# iw list | grep phy
Wiphy phy2
        wiphy index: 2
Wiphy phy1
        wiphy index: 1
Wiphy phy0
        wiphy index: 0
root@OpenWrt:~# 

Now the only question I have is should I try updating the device with factor.bin style openwrt image ?
should I use tplink webui ?

1 Like