openwrt/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
Ansuel Smith f44e933458 ipq806x: provide WiFI mac-addresses from dts
Use nvmem framework for supported mac-address stored
in nvmem cells and drop mac patch function for hotplug
script for supported devices.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
[rebase, move to correct node for d7800, include xr500]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-10-30 22:11:13 +02:00

138 lines
3.2 KiB
Bash

#!/bin/sh
[ -e /lib/firmware/$FIRMWARE ] && exit 0
. /lib/functions/caldata.sh
board=$(board_name)
case "$FIRMWARE" in
"ath10k/pre-cal-pci-0000:01:00.0.bin")
case $board in
askey,rt4230w-rev6)
caldata_extract "0:ART" 0x1000 0x2f20
;;
asrock,g10)
if [ -b "$(find_mtd_part 0:art)" ]; then
caldata_extract "0:art" 0x1000 0x2f20
else
# XXX: drop upper case after kernel v5.4 is gone (qcom-smem)
caldata_extract "0:ART" 0x1000 0x2f20
fi
;;
buffalo,wxr-2533dhp)
caldata_extract "ART" 0x1000 0x2f20
;;
edgecore,ecw5410)
if [ -b "$(find_mtd_part 0:art)" ]; then
caldata_extract "0:art" 0x1000 0x2f20
else
# XXX: drop upper case after kernel v5.4 is gone (qcom-smem)
caldata_extract "0:ART" 0x1000 0x2f20
fi
;;
linksys,ea7500-v1 |\
linksys,ea8500)
caldata_extract "art" 0x1000 0x2f20
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) 1)
;;
nec,wg2600hp |\
nec,wg2600hp3)
caldata_extract "ART" 0x1000 0x2f20
;;
netgear,d7800 |\
netgear,r7500v2 |\
netgear,r7800)
caldata_extract "art" 0x1000 0x2f20
;;
netgear,xr500)
caldata_extract "art" 0x1000 0x2f20
;;
tplink,ad7200 |\
tplink,c2600)
caldata_extract "radio" 0x1000 0x2f20
;;
tplink,vr2600v)
caldata_extract "ART" 0x1000 0x2f20
;;
zyxel,nbg6817)
if [ -b "$(find_mtd_part 0:art)" ]; then
caldata_extract "0:art" 0x1000 0x2f20
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:appsblenv ethaddr) 1)
else
# XXX: drop upper case after kernel v5.4 is gone (qcom-smem)
caldata_extract "0:ART" 0x1000 0x2f20
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:APPSBLENV ethaddr) 1)
fi
;;
esac
;;
"ath10k/pre-cal-pci-0001:01:00.0.bin")
case $board in
askey,rt4230w-rev6)
caldata_extract "0:ART" 0x5000 0x2f20
;;
asrock,g10)
if [ -b "$(find_mtd_part 0:art)" ]; then
caldata_extract "0:art" 0x5000 0x2f20
else
# XXX: drop upper case after kernel v5.4 is gone (qcom-smem)
caldata_extract "0:ART" 0x5000 0x2f20
fi
;;
buffalo,wxr-2533dhp)
caldata_extract "ART" 0x5000 0x2f20
;;
linksys,ea7500-v1 |\
linksys,ea8500)
caldata_extract "art" 0x5000 0x2f20
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) 2)
;;
nec,wg2600hp |\
nec,wg2600hp3)
caldata_extract "ART" 0x5000 0x2f20
;;
netgear,d7800 |\
netgear,r7500v2 |\
netgear,r7800)
caldata_extract "art" 0x5000 0x2f20
;;
netgear,xr500)
caldata_extract "art" 0x5000 0x2f20
;;
tplink,ad7200 |\
tplink,c2600)
caldata_extract "radio" 0x5000 0x2f20
;;
tplink,vr2600v)
caldata_extract "ART" 0x5000 0x2f20
;;
zyxel,nbg6817)
if [ -b "$(find_mtd_part 0:art)" ]; then
caldata_extract "0:art" 0x5000 0x2f20
ath10k_patch_mac $(mtd_get_mac_ascii 0:appsblenv ethaddr)
else
# XXX: drop upper case after kernel v5.4 is gone (qcom-smem)
caldata_extract "0:ART" 0x5000 0x2f20
ath10k_patch_mac $(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
fi
;;
esac
;;
"ath10k/pre-cal-pci-0002:01:00.0.bin")
case $board in
edgecore,ecw5410)
if [ -b "$(find_mtd_part 0:art)" ]; then
caldata_extract "0:art" 0x5000 0x2f20
else
# XXX: drop upper case after kernel v5.4 is gone (qcom-smem)
caldata_extract "0:ART" 0x5000 0x2f20
fi
;;
esac
;;
*)
exit 1
;;
esac