Support for D-Link DIR-842 (Rev C2)

in 11-ath10k-caldata i added

....

ath10kcal_extract "art" 20480 2116
		ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary art 0) -1)
		;;
	dlink,dir-859-a1|\
	dlink,dir-842-c2)
		ath10kcal_extract "art" 20480 2116
		ath10kcal_patch_mac $(mtd_get_mac_ascii devdata "wlan5mac")
		;;
	elecom,wrc-1750ghbk2-i)
		ath10kcal_extract "art" 20480 2116

...

I added dlink,dir-842-c2) after dlink,dir-859-a1|
Thanks for your help!

I am not sure it is correct and why ath9k is there as well?

The switch chip is a QCA8337N, so the driver is ath9k

You need to check where caldata is really located, where mac addresses are located and set it up respectively. Not just copy lines from another device.

Oops, silly me, I forgot to include the firmware in make menuconfig

no wonder it cannot load....

I am sure the firmware is in /lib/firmware , but for some reason it cant load

[   48.918029] firmware ath10k!fwcfg-pci-0000:00:00.0.txt: firmware_loading_store: map pages failed
[   49.108017] firmware ath10k!pre-cal-pci-0000:00:00.0.bin: firmware_loading_store: map pages failed
[   49.601961] firmware ath10k!QCA9888!hw2.0!ct-firmware-5.bin: firmware_loading_store: map pages failed
[   49.786043] firmware ath10k!QCA9888!hw2.0!ct-firmware-2.bin: firmware_loading_store: map pages failed
[   49.970148] firmware ath10k!QCA9888!hw2.0!firmware-6.bin: firmware_loading_store: map pages failed
[   50.789565] ath10k_pci 0000:00:00.0: qca9888 hw2.0 target 0x01000000 chip_id 0x00000000 sub 0000:0000
[   50.799136] ath10k_pci 0000:00:00.0: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 0
[   50.819169] ath10k_pci 0000:00:00.0: firmware ver 10.4b-ct-9888-fW-012-e8020273 api 5 features mfp,peer-flow-ctrl,txstatus-noack,wmi-10.x-CT,ratemask-CT,regdump-CT,txrate-CT,flush-all-CT,pingpong-CT,ch-regs-CT,nop-CT,set-special-CT,tx-rc-CT,cust-stats-CT,txrate2-CT,beacon-cb-CT,wmi-block-ack-CT,wmi-bcn-rc-CT crc32 d41e2174
[   51.136959] ath10k_pci 0000:00: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
[   51.246320] firmware ath10k!QCA9888!hw2.0!board.bin: firmware_loading_store: map pages failed
[   51.255340] ath10k_pci 0000:00:00.0: failed to fetch board-2.bin or board.bin from ath10k/QCA9888/hw2.0
[   51.265073] ath10k_pci 0000:00:00.0: failed to fetch board file: -11
[   51.271860] ath10k_pci 0000:00:00.0: could not probe fw (-11)

Thanks

Is board-2.bin there?

Yes, and I compare with board-2.bin downloaded from github, they are the same.
Thanks in advance

I see that firmware is loading, but I am not quite competent in that board-2.bin file. Probably the device should be added there too.

Thanks anyway, I will look more into that.

I have identified the wifi0.caldata is located in art partition with an offset of 1000(h) and size of 2F20 and wifi1.caldata is located in 5000(h) size of 2F20, so i should add

ath10kcal_extract "art" 5000 12064

in 11-ath10k-caldata
am i right?

I don't remember 100%, but you need to convert it to decimal, if it is hex 5000.
The script uses dd.

Thanks, I will take a look in the original script to figure it out.

20480 12064
It was last year when I added a device the last time. So I forgot most of these things.

1 Like

And most likely 20480 2116 is correct. The same wireless device should have the same caldata length

Thanks, when i take a look at cal-pci-0000:00:00.0.bin , I only see part of wifi1.caldata (only first 840(h) = 2116(decimal) bytes is there), so the bytes that got left out are not needed?

You need to find out which file you need "ath10k/cal-pci-0000:00:00.0.bin" or "ath10k/pre-cal-pci-0000:00:00.0.bin" the latter has 12064 length

I think I need ath10k/pre-cal-pci-0000:00:00.0.bin, because the kernel tries to load it but failed?

Yes, then add the board to the

"ath10k/pre-cal-pci-0000:00:00.0.bin")

part instead of

"ath10k/cal-pci-0000:00:00.0.bin")

But you also need to figure out the mac address location, but that's not omportant at this stage.

I already know the mac address location, it is in devconf with ascii format

wlan5mac=xx:xx:...

, so i think mtd_get_mac_ascii
i used is correct?

It depends on how it is located as ascii. It can be 00:11:22:33:44:55 or 001122334455, etc.
You need to check if it is correctly extracted. But that's not important. First get firmware loaded. It will set a random mac, that can be fixed later.