difos/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata
jonathan brophy 8da24b1109 Qualcommax: IPQ807x: Add support for TP-Link Deco X80-5G
The TP-link Deco X80-5G is a AX WIFI router with a single 1G (LAN) and 1 2.5G (WAN) port with a built in Quectel 5G modem.

Specifications:

Architecture	ARMv8-A (aarch64 Cortex A53, 4 cores)
Vendor	Qualcomm
Bootloader	U-Boot (2016)
System-On-Chip	Qualcomm IPQ8074A (Networking Pro 1210 platform)
CPU/Speed	2.2GHZ
Flash-Chip	ESMT F59D1G81MB-45TI 1G-bit NAND
Flash MB	128MB (1Gbit)
RAM-chip	2* ESMT M15T4G16256A-DEBG2G 2Gb DDR3L (32bit)
RAM MB	512MB (4Gbit)
WLan System-On-Chip (5g)	Qualcomm QCN5054
WLan Front end modules (5g)	8* Qorvo QPF4588
WLAN (5G)	A/N/AC/AX
WLAN Antenna (int)	8* (4 shared with 2.5G)
WLan System-On-Chip (2.4G)	Qualcomm QCN5024
WLan Front end modules (2.4G)	4* Skyworks SKY85340-11
WLAN (2.4G)	B/G/N/AX
WLAN Antenna (int)	4* (shared with 5g)
Eithernet-phy (1Gbit)	Qualcomm (Atheros) AR8033-AL1A
Ethernet (1Gbit)	1*
Eithernet-phy (2.5Gbit)	Qualcomm QCA8081
Ethernet (2.5Gbit)	1*
Switch	Embedded in the SOC?
Serial	1.8v 8n1 (testpoints)
Modem System-On-Chip	Qualcomm 5G RG50xQ (Snapdragon X55 platform)
5G modem capability	5000Mbps down 900Mbps up
5G modem bands	N1/N3/N5/N7/N8/N20/N28/N38/N40/N41/N77/N78/N79
4G modem capability	4.5G LTE-Advanced Pro (Cat20 down 2Gbps) (Cat18 up 200Mbps)
4G modem FDD bands	B1/B3/B5/B7/B8/B18/B19/B20/B26/B28
4G modem TDD bands	B34/B38/B39/B40/B41/B42/B43
Modem antenna (int)	8* (5G/4G use)
Modem antenna (ext)	2* SMA connectors (5G/4G use)
SIM type	1* Nano SIM
Telephony	1* POTS RJ11
(see wiki for more info:)
https://openwrt.org/inbox/toh/tp-link/x80-5g_v1

        Notes:
Installation Instructions:

Between antennas 7 and 8 on the PCB with the RGB harness there are three test pads labelled TP1 TP2 and TP3 connections are as follows:
  |TP2|-- RX
  |TP1|-- TX
  |TP3|-- GND

RX requires an external pullup to operate somewhere around 5 K ohm but your luck may vary the Uart is 1.8v

Set a static IP and set up a tftpserver and terminal.
power the router and quickly type the magic string “tpl” and press enter to break into u-boot
in the shell set the environment variables to enable tftp booting
setenv ipaddr (routerIP)
setenv serverip (server IP)
load you initramfs:
tftpboot 0x44000000 (serverIP):openwrt-qualcommax-ipq807x-tplink_x80-5g-initramfs-uImage.itb
boot your initramfs
bootm
upload your factory image to /tmp
format and install the factory image:
ubiformat /dev/mtd12 -y -f /tmp/openwrt-qualcommax-ipq807x-tplink_x80-5g-squashfs-factory.ubi

Note as this device swaps root partitions upon update your boot partition may be set as mtd13

Update script to mount factory tplink partition's for MAC recovery and device data.
Capture Labelmac from Factory_data partition.
Patch LAN from Labelmac.
Patch ART from Labelmac.
Set GPIO to make modem operational from boot.

GPIO fan tables work like the  stock device with three fan maps high active idle with a top fan speed of 6800 RPM.

High temp 70 deg speeds 6-8
Active temp 50 deg speeds 2-5
low temp 25 degree speed 0-1

Signed-off-by: jonathan brophy <professor_jonny@hotmail.com>
Link: https://github.com/openwrt/openwrt/pull/16329
Signed-off-by: Robert Marko <robimarko@gmail.com>
2025-04-22 13:25:40 +02:00

149 lines
4 KiB
Bash

#!/bin/sh
[ -e /lib/firmware/$FIRMWARE ] && exit 0
. /lib/functions/caldata.sh
board=$(board_name)
case "$FIRMWARE" in
"ath11k/IPQ8074/hw2.0/cal-ahb-c000000.wifi.bin")
case "$board" in
aliyun,ap8220)
caldata_extract "0:art" 0x1000 0x20000
addr=$(mtd_get_mac_text product_info 0x4b)
ath11k_patch_mac $addr 0
ath11k_patch_mac $(macaddr_add $addr 8) 1
ath11k_set_macflag
;;
asus,rt-ax89x)
CI_UBIPART="UBI_DEV"
caldata_extract_ubi "Factory" 0x1000 0x20000
;;
arcadyan,aw1000|\
buffalo,wxr-5950ax12|\
cmcc,rm2-6|\
compex,wpq873|\
dynalink,dl-wrx36|\
edgecore,eap102|\
edimax,cax1800|\
linksys,mx5300|\
netgear,wax218|\
qnap,301w|\
redmi,ax6|\
xiaomi,ax3600|\
xiaomi,ax9000|\
yuncore,ax880|\
zte,mf269)
caldata_extract "0:art" 0x1000 0x20000
;;
linksys,homewrk|\
linksys,mx4200v1|\
linksys,mx8500)
caldata_extract "0:art" 0x1000 0x20000
ath11k_remove_regdomain
;;
linksys,mx4200v2)
caldata_extract "0:art" 0x1000 0x20000
label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
ath11k_patch_mac $(macaddr_add $label_mac 2) 0
ath11k_patch_mac $(macaddr_add $label_mac 1) 1
ath11k_patch_mac $(macaddr_add $label_mac 3) 2
ath11k_remove_regdomain
ath11k_set_macflag
;;
linksys,mx4300)
caldata_extract "0:art" 0x1000 0x20000
label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
ath11k_patch_mac $(macaddr_add $label_mac 2) 0
ath11k_patch_mac $(macaddr_add $label_mac 1) 1
ath11k_patch_mac $(macaddr_add $label_mac 3) 2
ath11k_remove_regdomain
;;
netgear,rax120v2)
caldata_extract "0:art" 0x1000 0x20000
ath11k_patch_mac $(mtd_get_mac_binary boarddata1 0xc) 0
ath11k_patch_mac $(mtd_get_mac_binary boarddata1 0x0) 1
ath11k_patch_mac $(mtd_get_mac_binary boarddata1 0x6) 2
ath11k_set_macflag
;;
netgear,sxr80|\
netgear,sxs80)
caldata_extract "0:art" 0x1000 0x20000
label_mac=$(get_mac_label)
ath11k_patch_mac $(mtd_get_mac_binary boarddata1 0x0c) 0
#boarddata1 doesn't have a MAC for the 2G interface
ath11k_patch_mac $(macaddr_setbit_la $label_mac) 1
ath11k_patch_mac $(mtd_get_mac_binary boarddata1 0x12) 2
ath11k_set_macflag
;;
netgear,wax620)
caldata_extract "0:art" 0x1000 0x20000
label_mac=$(get_mac_label)
ath11k_patch_mac $(macaddr_add $label_mac -31) 1
ath11k_patch_mac $(macaddr_add $label_mac 1) 0
ath11k_set_macflag
;;
netgear,wax630)
caldata_extract "0:art" 0x1000 0x20000
label_mac=$(get_mac_label)
ath11k_patch_mac $(macaddr_add $label_mac -31) 1
ath11k_patch_mac $(macaddr_add $label_mac 1) 0
ath11k_patch_mac $(macaddr_add $label_mac 33) 2
ath11k_set_macflag
;;
prpl,haze|\
spectrum,sax1v1k)
caldata_extract_mmc "0:ART" 0x1000 0x20000
;;
tplink,deco-x80-5g)
caldata_extract "0:art" 0x1000 0x20000
label_mac=$(get_mac_binary /tmp/factory_data/default-mac 0)
ath11k_patch_mac $(macaddr_add $label_mac -1) 0
ath11k_patch_mac $(macaddr_add $label_mac -2) 1
ath11k_set_macflag
;;
tplink,eap620hd-v1|\
tplink,eap660hd-v1)
caldata_from_file "/tmp/factory_data/radio" 0 0x20000
label_mac=$(get_mac_binary /tmp/factory_data/default-mac 0)
ath11k_patch_mac $label_mac 1
ath11k_patch_mac $(macaddr_add $label_mac 1) 0
ath11k_set_macflag
;;
zbtlink,zbt-z800ax)
caldata_extract "0:art" 0x1000 0x20000
label_mac=$(get_mac_label)
ath11k_patch_mac $(macaddr_add $label_mac -1) 0
ath11k_patch_mac $(macaddr_add $label_mac -2) 1
ath11k_set_macflag
;;
zyxel,nbg7815)
caldata_extract "0:art" 0x1000 0x20000
label_mac=$(get_mac_label)
ath11k_patch_mac $(macaddr_add $label_mac 3) 0
ath11k_patch_mac $(macaddr_add $label_mac 2) 1
ath11k_patch_mac $(macaddr_add $label_mac 4) 2
ath11k_set_macflag
;;
esac
;;
"ath11k/QCN9074/hw1.0/cal-pci-0000:01:00.0.bin"|\
"ath11k/QCN9074/hw1.0/cal-pci-0001:01:00.0.bin")
case "$board" in
linksys,mx8500)
caldata_extract "0:art" 0x26800 0x20000
ath11k_remove_regdomain
;;
prpl,haze)
caldata_extract_mmc "0:ART" 0x26800 0x20000
;;
xiaomi,ax9000)
caldata_extract "0:art" 0x26800 0x20000
;;
esac
;;
*)
exit 1
;;
esac