[PATCH v2 3/6] ath79: D-Link DAP-2680 A1: convert ath10k caldata to nvmem

Christian Lamparter chunkeey at gmail.com
Fri Jun 17 17:24:04 PDT 2022


Hi,

On 18/06/2022 01:26, Sebastian Schaper wrote:
> unfortunately, testing these changes on DAP-2680 resulted in board-2.bin
> not being loaded, the driver is only looking for board.bin instead.
> 
> [   12.476846] ath10k 5.15 driver, optimized for CT firmware, probing pci device: 0x46.
> [   12.486197] ath10k_pci 0000:00:00.0: enabling device (0000 -> 0002)
> [   12.492883] ath10k_pci 0000:00:00.0: pci irq legacy oper_irq_mode 1 irq_mode 0 reset_mode 0
> [   15.751865] ath10k_pci 0000:00:00.0: qca9984/qca9994 hw1.0 target 0x01000000 chip_id 0x00000000 sub 168c:cafe
> [   15.761962] ath10k_pci 0000:00:00.0: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 0
> [   15.781211] ath10k_pci 0000:00:00.0: firmware ver 10.4b-ct-9984-fW-13-5ae337bb1 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 7ea63dc5
> [   18.114113] ath10k_pci 0000:00:00.0: Loading BDF type 0
> [   18.123845] ath10k_pci 0000:00:00.0: failed to fetch board data for bus=pci,vendor=168c,device=0046,subsystem-vendor=168c,subsystem-device=cafe from ath10k/QCA9984/hw1.0/board-2.bin
> [   18.737015] ath10k_pci 0000:00:00.0: failed to fetch board-2.bin or board.bin from ath10k/QCA9984/hw1.0
> [   18.746595] ath10k_pci 0000:00:00.0: failed to fetch board file: -12
> [   18.767513] ath10k_pci 0000:00:00.0: could not probe fw (-12)

Technically, the Wave-2 chips like the 9984 need the "pre-calibration"
as the nvmem-cell-names string over "calibration". If you change it,
it will  pick up the matching entry in board-2.bin...

> Creating a symlink named board.bin does make it work, it turns out the
> 11-ath10k-caldata script is never called for $FIRMWARE `board-2.bin`.
> 
> This is probably the reason a symlink was used with many ath10k devices,
> but unfortunately I am not familiar with the details of board files loading, or
> how this should be handled when caldata is extracted via the nvmem driver.

the symlink from the pre-cal to the board.bin is an established OpenWrt
workaround. Because the entry in the board-2.bin might not be the one
you want. It could be that your device's ODM changed the RF layout over
the reference boardfiles and you get anything from slightly worse to
almost no range/performance. Using the pre-cal for the boardfile too
was found to be the easy fix and provied an improvement.

Qualcomm's official way to address this is to add a variant property to the
ath10k node and upstream the boardfile from the vendor through their process:
<https://wireless.wiki.kernel.org/en/users/drivers/ath10k/boardfiles>

Regards,
Christian

> Am 13.06.22 um 22:15 schrieb Sander Vanheule:
>> Add the PCIe node for the ath10k radio to the devicetree, and refer to
>> the art partition for the calibration data using nvmem-cells.
>>
>> MAC address assignment is moved to '10_fix_wifi_mac', so the device can
>> then be removed from the caldata extraction script '11-ath10k-caldata'.
>>
>> Cc: Sebastian Schaper <openwrt at sebastianschaper.net>
>> Signed-off-by: Sander Vanheule <sander at svanheule.net>
>> ---
>>   .../linux/ath79/dts/qca9558_dlink_dap-2680-a1.dts  | 14 ++++++++++++++
>>   .../etc/hotplug.d/firmware/11-ath10k-caldata       |  6 ------
>>   .../etc/hotplug.d/ieee80211/10_fix_wifi_mac        |  7 ++++++-
>>   3 files changed, 20 insertions(+), 7 deletions(-)
>>
>> diff --git a/target/linux/ath79/dts/qca9558_dlink_dap-2680-a1.dts b/target/linux/ath79/dts/qca9558_dlink_dap-2680-a1.dts
>> index 0593fd29f418..09503da52b60 100644
>> --- a/target/linux/ath79/dts/qca9558_dlink_dap-2680-a1.dts
>> +++ b/target/linux/ath79/dts/qca9558_dlink_dap-2680-a1.dts
>> @@ -79,4 +79,18 @@
>>   &pcie0 {
>>       status = "okay";
>> +
>> +    wifi at 0,0 {
>> +        compatible = "qcom,ath10k";
>> +        reg = <0 0 0 0 0>;
>> +
>> +        nvmem-cells = <&cal_ath10k>;
>> +        nvmem-cell-names = "calibration";
>> +    };
>> +};
>> +
>> +&art {
>> +    cal_ath10k: calibration at 5000 {
>> +        reg = <0x5000 0x2f20>;
>> +    };
>>   };
>> diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
>> index 668fd76af3a4..74a625ca840c 100644
>> --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
>> +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
>> @@ -199,12 +199,6 @@ case "$FIRMWARE" in
>>               /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
>>           rm /lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin
>>           ;;
>> -    dlink,dap-2680-a1)
>> -        caldata_extract "art" 0x5000 0x2f20
>> -        ath10k_patch_mac $(mtd_get_mac_ascii bdcfg wlanmac_a)
>> -        ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
>> -            /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
>> -        ;;
>>       dlink,dir-842-c1|\
>>       dlink,dir-842-c2|\
>>       dlink,dir-842-c3)
>> diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
>> index a4f82c54e271..d5a2471a99a9 100644
>> --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
>> +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
>> @@ -27,12 +27,17 @@ case "$board" in
>>           mtd_get_mac_ascii bdcfg "wlanmac" > /sys${DEVPATH}/macaddress
>>           ;;
>>       dlink,dap-2660-a1|\
>> -    dlink,dap-2680-a1|\
>>       dlink,dap-2695-a1|\
>>       dlink,dap-3662-a1)
>>           [ "$PHYNBR" -eq 1 ] && \
>>               mtd_get_mac_ascii bdcfg "wlanmac" > /sys${DEVPATH}/macaddress
>>           ;;
>> +    dlink,dap-2680-a1)
>> +        [ "$PHYNBR" -eq 0 ] && \
>> +            mtd_get_mac_ascii bdcfg "wlanmac_a" > /sys${DEVPATH}/macaddress
>> +        [ "$PHYNBR" -eq 1 ] && \
>> +            mtd_get_mac_ascii bdcfg "wlanmac" > /sys${DEVPATH}/macaddress
>> +        ;;
>>       iodata,wn-ac1600dgr)
>>           # There is no eeprom data for 5 GHz wlan in "art" partition
>>           # which would allow to patch the macaddress




More information about the openwrt-devel mailing list