mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-23 15:32:33 +00:00
af425e4221
This partially reverts commitcfc13c4459
("ipq40xx: utilize nvmem-cells for macs & (pre-)calibration data"). After switching to nvmem RTL30VW, wifi was broken: [ 19.118319] ath10k_ahb a000000.wifi: qca4019 hw1.0 target 0x01000000 chip_id 0x003b00ff sub 0000:0000 [ 19.118377] ath10k_ahb a000000.wifi: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 0 [ 19.130285] ath10k_ahb a000000.wifi: firmware ver 10.4b-ct-4019-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 6b2b5c5b [ 19.159092] ath10k_ahb a000000.wifi: failed to fetch board data for bus=ahb,vendor=0000,device=0000,subsystem-vendor=0000,subsystem-device=0000,variant=cellc,rtl30vw from ath10k/QCA4019/hw1.0/board-2.bin [ 19.238764] ath10k_ahb a000000.wifi: failed to fetch board-2.bin or board.bin from ath10k/QCA4019/hw1.0 [ 19.238847] ath10k_ahb a000000.wifi: failed to fetch board file: -12 [ 19.247362] ath10k_ahb a000000.wifi: could not probe fw (-12) [ 20.190797] ath10k_ahb a800000.wifi: qca4019 hw1.0 target 0x01000000 chip_id 0x003b00ff sub 0000:0000 [ 20.190853] ath10k_ahb a800000.wifi: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 0 [ 20.202893] ath10k_ahb a800000.wifi: firmware ver 10.4b-ct-4019-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 6b2b5c5b [ 20.231357] ath10k_ahb a800000.wifi: failed to fetch board data for bus=ahb,vendor=0000,device=0000,subsystem-vendor=0000,subsystem-device=0000,variant=cellc,rtl30vw from ath10k/QCA4019/hw1.0/board-2.bin [ 20.317318] ath10k_ahb a800000.wifi: failed to fetch board-2.bin or board.bin from ath10k/QCA4019/hw1.0 [ 20.317399] ath10k_ahb a800000.wifi: failed to fetch board file: -12 [ 20.326098] ath10k_ahb a800000.wifi: could not probe fw (-12) Bootloader mangles in NAND partitions and removes precal@X nodes in working system: root@OpenWrt:~# echo $(cat /sys/firmware/devicetree/base/soc/spi@78b5000/flash@0/partitions/partition@170000/label) 0:ART root@OpenWrt:~# ls /sys/firmware/devicetree/base/soc/spi@78b5000/flash@0/partitions/partition@170000/ label name reg Revert to legacy method fixed the problem. Fixes:cfc13c4459
("ipq40xx: utilize nvmem-cells for macs & (pre-)calibration data") Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
222 lines
7.8 KiB
Bash
222 lines
7.8 KiB
Bash
#!/bin/sh
|
|
|
|
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
|
|
|
. /lib/functions/caldata.sh
|
|
|
|
board=$(board_name)
|
|
|
|
case "$FIRMWARE" in
|
|
"ath10k/cal-pci-0000:01:00.0.bin")
|
|
case "$board" in
|
|
meraki,mr33)
|
|
caldata_extract_ubi "ART" 0x9000 0x844
|
|
caldata_valid "4408" || caldata_extract "ART" 0x9000 0x844
|
|
ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) 1)
|
|
;;
|
|
esac
|
|
;;
|
|
"ath10k/pre-cal-pci-0000:01:00.0.bin")
|
|
case "$board" in
|
|
asus,map-ac2200)
|
|
caldata_extract_ubi "Factory" 0x9000 0x2f20
|
|
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
|
|
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
|
|
;;
|
|
asus,rt-ac42u)
|
|
caldata_extract_ubi "Factory" 0x9000 0x2f20
|
|
;;
|
|
avm,fritzrepeater-3000)
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
|
|
;;
|
|
openmesh,a62 |\
|
|
plasmacloud,pa2200)
|
|
caldata_extract "0:ART" 0x9000 0x2f20
|
|
;;
|
|
linksys,ea8300 |\
|
|
linksys,mr8300)
|
|
caldata_extract "ART" 0x9000 0x2f20
|
|
# OEM assigns 4 sequential MACs
|
|
ath10k_patch_mac $(macaddr_setbit_la $(macaddr_add "$(cat /sys/class/net/eth0/address)" 4))
|
|
;;
|
|
netgear,rbr50|\
|
|
netgear,rbs50|\
|
|
netgear,srr60|\
|
|
netgear,srs60)
|
|
caldata_extract_mmc "0:ART" 0x9000 0x2f20
|
|
ath10k_patch_mac $(mmc_get_mac_binary ARTMTD 0x12)
|
|
;;
|
|
esac
|
|
;;
|
|
"ath10k/pre-cal-ahb-a000000.wifi.bin")
|
|
case "$board" in
|
|
qcom,ap-dk01.1-c1)
|
|
caldata_extract "ART" 0x1000 0x2f20
|
|
;;
|
|
asus,map-ac2200|\
|
|
asus,rt-ac42u|\
|
|
asus,rt-ac58u)
|
|
caldata_extract_ubi "Factory" 0x1000 0x2f20
|
|
;;
|
|
avm,fritzbox-4040)
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
|
|
;;
|
|
avm,fritzbox-7530 |\
|
|
avm,fritzrepeater-1200 |\
|
|
avm,fritzrepeater-3000)
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
|
|
;;
|
|
cellc,rtl30vw |\
|
|
openmesh,a42 |\
|
|
openmesh,a62 |\
|
|
plasmacloud,pa1200 |\
|
|
plasmacloud,pa2200)
|
|
caldata_extract "0:ART" 0x1000 0x2f20
|
|
;;
|
|
devolo,magic-2-wifi-next)
|
|
caldata_extract "ART" 0x1000 0x2f20
|
|
ath10k_patch_mac $(mtd_get_mac_ascii APPSBLENV WiFiMacAddress0)
|
|
;;
|
|
dlink,dap-2610)
|
|
caldata_extract "ART" 0x1000 0x2f20
|
|
ath10k_patch_mac $(mtd_get_mac_ascii bdcfg wlanmac)
|
|
;;
|
|
engenius,emd1)
|
|
caldata_extract "0:ART" 0x1000 0x2f20
|
|
ath10k_patch_mac $(mtd_get_mac_ascii 0:APPSBLENV wlanaddr)
|
|
;;
|
|
engenius,emr3500)
|
|
caldata_extract "0:ART" 0x1000 0x2f20
|
|
ath10k_patch_mac $(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
|
|
;;
|
|
engenius,ens620ext)
|
|
caldata_extract "ART" 0x1000 0x2f20
|
|
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) 2)
|
|
;;
|
|
linksys,ea8300 |\
|
|
linksys,mr8300)
|
|
caldata_extract "ART" 0x1000 0x2f20
|
|
ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 2)
|
|
;;
|
|
meraki,mr33)
|
|
caldata_extract_ubi "ART" 0x1000 0x2f20
|
|
caldata_valid "202f" || caldata_extract "ART" 0x1000 0x2f20
|
|
ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) 2)
|
|
;;
|
|
mikrotik,cap-ac |\
|
|
mikrotik,hap-ac2 |\
|
|
mikrotik,hap-ac3)
|
|
wlan_data="/sys/firmware/mikrotik/hard_config/wlan_data"
|
|
( [ -f "$wlan_data" ] && caldata_sysfsload_from_file "$wlan_data" 0x0 0x2f20 ) || \
|
|
( [ -d "$wlan_data" ] && caldata_sysfsload_from_file "$wlan_data/data_0" 0x0 0x2f20 )
|
|
;;
|
|
netgear,rbr50|\
|
|
netgear,rbs50|\
|
|
netgear,srr60|\
|
|
netgear,srs60)
|
|
caldata_extract_mmc "0:ART" 0x1000 0x2f20
|
|
ath10k_patch_mac $(mmc_get_mac_binary ARTMTD 0x0)
|
|
;;
|
|
zyxel,nbg6617 |\
|
|
zyxel,wre6606)
|
|
caldata_extract "ART" 0x1000 0x2f20
|
|
ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
|
|
;;
|
|
esac
|
|
;;
|
|
"ath10k/pre-cal-ahb-a800000.wifi.bin")
|
|
case "$board" in
|
|
qcom,ap-dk01.1-c1)
|
|
caldata_extract "ART" 0x5000 0x2f20
|
|
;;
|
|
asus,map-ac2200|\
|
|
asus,rt-ac58u)
|
|
caldata_extract_ubi "Factory" 0x5000 0x2f20
|
|
;;
|
|
avm,fritzbox-4040)
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
|
|
;;
|
|
avm,fritzbox-7530 |\
|
|
avm,fritzrepeater-1200 |\
|
|
avm,fritzrepeater-3000)
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
|
|
;;
|
|
cellc,rtl30vw |\
|
|
openmesh,a42 |\
|
|
openmesh,a62 |\
|
|
plasmacloud,pa1200 |\
|
|
plasmacloud,pa2200)
|
|
caldata_extract "0:ART" 0x5000 0x2f20
|
|
;;
|
|
devolo,magic-2-wifi-next)
|
|
caldata_extract "ART" 0x5000 0x2f20
|
|
ath10k_patch_mac $(mtd_get_mac_ascii APPSBLENV WiFiMacAddress1)
|
|
;;
|
|
dlink,dap-2610)
|
|
caldata_extract "ART" 0x5000 0x2f20
|
|
ath10k_patch_mac $(mtd_get_mac_ascii bdcfg wlanmac_a)
|
|
;;
|
|
engenius,emd1)
|
|
caldata_extract "0:ART" 0x5000 0x2f20
|
|
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:APPSBLENV wlanaddr) 1)
|
|
;;
|
|
engenius,emr3500)
|
|
caldata_extract "0:ART" 0x5000 0x2f20
|
|
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:APPSBLENV ethaddr) 1)
|
|
;;
|
|
engenius,ens620ext)
|
|
caldata_extract "ART" 0x5000 0x2f20
|
|
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) 3)
|
|
;;
|
|
linksys,ea8300 |\
|
|
linksys,mr8300)
|
|
caldata_extract "ART" 0x5000 0x2f20
|
|
ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 3)
|
|
;;
|
|
meraki,mr33)
|
|
caldata_extract_ubi "ART" 0x5000 0x2f20
|
|
caldata_valid "202f" || caldata_extract "ART" 0x5000 0x2f20
|
|
ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) 3)
|
|
;;
|
|
mikrotik,cap-ac |\
|
|
mikrotik,hap-ac2 |\
|
|
mikrotik,hap-ac3 |\
|
|
mikrotik,sxtsq-5-ac)
|
|
wlan_data="/sys/firmware/mikrotik/hard_config/wlan_data"
|
|
( [ -f "$wlan_data" ] && caldata_sysfsload_from_file "$wlan_data" 0x8000 0x2f20 ) || \
|
|
( [ -d "$wlan_data" ] && caldata_sysfsload_from_file "$wlan_data/data_2" 0x0 0x2f20 )
|
|
;;
|
|
netgear,rbr50|\
|
|
netgear,rbs50|\
|
|
netgear,srr60|\
|
|
netgear,srs60)
|
|
caldata_extract_mmc "0:ART" 0x5000 0x2f20
|
|
ath10k_patch_mac $(mmc_get_mac_binary ARTMTD 0xc)
|
|
;;
|
|
zyxel,nbg6617 |\
|
|
zyxel,wre6606)
|
|
caldata_extract "ART" 0x5000 0x2f20
|
|
ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
|
|
;;
|
|
esac
|
|
;;
|
|
*)
|
|
exit 1
|
|
;;
|
|
esac
|