diff --git a/package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq807x b/package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq807x index 21ec0ae5b13..723b0981c44 100644 --- a/package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq807x +++ b/package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq807x @@ -39,6 +39,7 @@ netgear,sxs80|\ netgear,wax218|\ netgear,wax620|\ netgear,wax630|\ +tplink,deco-x80-5g|\ tplink,eap620hd-v1|\ tplink,eap660hd-v1) ubootenv_add_mtd "0:appsblenv" "0x0" "0x40000" "0x20000" diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 5e233656e89..d21ee73fc26 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -67,6 +67,7 @@ ALLWIFIBOARDS:= \ redmi_ax6 \ skspruce_wia3300-20 \ spectrum_sax1v1k \ + tplink_deco-x80-5g \ tplink_eap610-outdoor \ tplink_eap620hd-v1 \ tplink_eap623od-hd-v1 \ @@ -217,6 +218,7 @@ $(eval $(call generate-ipq-wifi-package,prpl_haze,prpl Haze)) $(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6)) $(eval $(call generate-ipq-wifi-package,skspruce_wia3300-20,SKSpruce WIA3300-20)) $(eval $(call generate-ipq-wifi-package,spectrum_sax1v1k,Spectrum SAX1V1K)) +$(eval $(call generate-ipq-wifi-package,tplink_deco-x80-5g,TP-Link Deco X80-5G)) $(eval $(call generate-ipq-wifi-package,tplink_eap610-outdoor,TPLink EAP610-Outdoor)) $(eval $(call generate-ipq-wifi-package,tplink_eap620hd-v1,TP-Link EAP620 HD v1)) $(eval $(call generate-ipq-wifi-package,tplink_eap623od-hd-v1,TP-Link EAP623-Outdoor HD v1)) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-deco-x80-5g.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-deco-x80-5g.dts new file mode 100644 index 00000000000..09f8be6e15a --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-deco-x80-5g.dts @@ -0,0 +1,458 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/* Copyright (c) 2022, Robert Marko +altered by Jonathan Brophy +to suit the TP-Link Deco X80-5G target */ + +/dts-v1/; + +#include "ipq8074.dtsi" +#include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-ess.dtsi" +#include +#include +#include + +/ { + model = "TP-Link Deco X80-5G"; + compatible = "tplink,deco-x80-5g", "qcom,ipq8074"; + + aliases { + serial0 = &blsp1_uart5; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-append = " root=/dev/ubiblock0_1"; + }; + + modem { + compatible = "gpio-export"; + pinctrl-names = "default"; + pinctrl-0 = <&modem_pins>; + pinctrl-1 = <&antenna_pins>; + + w_disable { + gpio-export,name = "w_disable"; + gpio-export,output = <1>; + gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>; /* wwan disable output */ + }; + + modem-reset { + gpio-export,name = "modem_reset"; + gpio-export,output = <0>; + gpios = <&tlmm 29 GPIO_ACTIVE_HIGH>; /* reset modem output */ + }; + + ext_antenna_en { + gpio-export,name = "ext_antenna_en"; + gpio-export,output = <0>; + gpios = <&tlmm 56 GPIO_ACTIVE_HIGH>; /* select external sma antennas for wwan output */ + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + pinctrl-0 = <&button_pins>; + pinctrl-names = "default"; + + reset_button { + label = "reset"; + gpios = <&tlmm 27 GPIO_ACTIVE_LOW>; /*reset button output*/ + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-0 = <&led_pins>; + pinctrl-names = "default"; + /*note the LED's defined here are not individual they are a single combined RGB element used for status functions. + To mimic the OEM default behaviour green and red are switched on from boot to indicate yellow (power on).*/ + + led_system_green: green { + gpios = <&tlmm 50 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_STATUS; + default-state = "on"; + }; + + led_system_red: red { + gpios = <&tlmm 51 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_STATUS; + default-state = "on"; + }; + + led_system_blue: blue { + gpios = <&tlmm 52 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_STATUS; + }; + }; + + gpio_fan: gpio-fan { + compatible = "gpio-fan"; + pinctrl-0 = <&fan_pins>; + pinctrl-names = "default"; + gpios = <&tlmm 42 GPIO_ACTIVE_LOW>, /* fan gpio MSB */ + <&tlmm 41 GPIO_ACTIVE_LOW>, + <&tlmm 40 GPIO_ACTIVE_LOW>; /* fan gpio LSB */ + + /* stock fan is a Sunnon EF40201BX-Q18C-F99 + 6800 rpm + gpio68 seemed to be the feedback rpm of the fan. + no support for fan speed in kernel saved for future use.*/ + + /*rpm-gpios = <&tlmm 68 GPIO_ACTIVE_HIGH>; */ + gpio-fan,speed-map = <0 0>, /* speed 0 binary drive bits 0,0,0 (idle state) */ + <971 1>, /* speed 1 binary drive bits 0,0,1 ▼ */ + <1942 2>, /* speed 3 binary drive bits 0,1,0 (active state) */ + <2913 3>, /* speed 4 binary drive bits 0,1,1 ▼ */ + <3884 4>, /* speed 5 binary drive bits 1,0,0 ▼ */ + <4855 5>, /* speed 6 binary drive bits 1,0,1 (high state) */ + <5826 6>, /* speed 7 binary drive bits 1,1,0 ▼ */ + <6800 7>; /* speed 8 binary drive bits 1,1,1 ▼ */ + #cooling-cells = <2>; /* min followed by max */ + }; +}; + +&cpu0_thermal { + trips { + cpu0_high: cpu-high { + temperature = <70000>; + hysteresis = <2000>; + type = "active"; + }; + cpu0_active: cpu-active { + temperature = <50000>; + hysteresis = <2000>; + type = "active"; + }; + cpu0_idle: cpu-idle { + temperature = <25000>; + hysteresis = <2000>; + type = "active"; + }; + }; + + cooling-maps { + map2 { + trip = <&cpu0_high>; + cooling-device = <&gpio_fan 5 THERMAL_NO_LIMIT>; + }; + map3 { + trip = <&cpu0_active>; + cooling-device = <&gpio_fan 2 4>; + }; + map4 { + trip = <&cpu0_idle>; + cooling-device = <&gpio_fan THERMAL_NO_LIMIT 1>; + }; + }; +}; + +&cpu1_thermal { + trips { + cpu1_high: cpu-high { + temperature = <70000>; + hysteresis = <2000>; + type = "active"; + }; + cpu1_active: cpu-active { + temperature = <50000>; + hysteresis = <2000>; + type = "active"; + }; + cpu1_idle: cpu-idle { + temperature = <25000>; + hysteresis = <2000>; + type = "active"; + }; + }; + + cooling-maps { + map2 { + trip = <&cpu1_high>; + cooling-device = <&gpio_fan 5 THERMAL_NO_LIMIT>; + }; + map3 { + trip = <&cpu1_active>; + cooling-device = <&gpio_fan 2 4>; + }; + map4 { + trip = <&cpu1_idle>; + cooling-device = <&gpio_fan THERMAL_NO_LIMIT 1>; + }; + }; +}; + +&cpu2_thermal { + trips { + cpu2_high: cpu-high { + temperature = <70000>; + hysteresis = <2000>; + type = "active"; + }; + cpu2_active: cpu-active { + temperature = <50000>; + hysteresis = <2000>; + type = "active"; + }; + cpu2_idle: cpu-idle { + temperature = <25000>; + hysteresis = <2000>; + type = "active"; + }; + }; + + cooling-maps { + map2 { + trip = <&cpu2_high>; + cooling-device = <&gpio_fan 5 THERMAL_NO_LIMIT>; + }; + map3 { + trip = <&cpu2_active>; + cooling-device = <&gpio_fan 2 4>; + }; + map4 { + trip = <&cpu2_idle>; + cooling-device = <&gpio_fan THERMAL_NO_LIMIT 1>; + }; + }; +}; + +&cpu3_thermal { + trips { + cpu3_high: cpu-high { + temperature = <70000>; + hysteresis = <2000>; + type = "active"; + }; + cpu3_active: cpu-active { + temperature = <50000>; + hysteresis = <2000>; + type = "active"; + }; + cpu3_idle: cpu-idle { + temperature = <25000>; + hysteresis = <2000>; + type = "active"; + }; + }; + + cooling-maps { + map2 { + trip = <&cpu3_high>; + cooling-device = <&gpio_fan 5 THERMAL_NO_LIMIT>; + }; + map3 { + trip = <&cpu3_active>; + cooling-device = <&gpio_fan 2 4>; + }; + map4 { + trip = <&cpu3_idle>; + cooling-device = <&gpio_fan THERMAL_NO_LIMIT 1>; + }; + }; +}; + + +&cluster_thermal { + trips { + cluster_high: cluster-high { + temperature = <70000>; + hysteresis = <2000>; + type = "active"; + }; + cluster_active: cluster-active { + temperature = <50000>; + hysteresis = <2000>; + type = "active"; + }; + cluster_idle: cluster-idle { + temperature = <25000>; + hysteresis = <2000>; + type = "active"; + }; + }; + + cooling-maps { + map2 { + trip = <&cluster_high>; + cooling-device = <&gpio_fan 5 THERMAL_NO_LIMIT>; + }; + map3 { + trip = <&cluster_active>; + cooling-device = <&gpio_fan 2 4>; + }; + map4 { + trip = <&cluster_idle>; + cooling-device = <&gpio_fan THERMAL_NO_LIMIT 1>; + }; + }; +}; + + +&tlmm { + button_pins: button-state { + pins = "gpio27"; + function = "gpio"; + drive-strength = <2>; + bias-pull-up; + }; + + fan_pins: fan-state { + pins = "gpio40", "gpio41", "gpio42"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + + antenna_pins: antenna-state { + pins = "gpio56"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + + modem_pins: modem-state { + pins = "gpio29", "gpio55"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + + led_pins: led-state { + pins = "gpio50", "gpio51", "gpio52"; + function = "gpio"; + drive-strength = <8>; + bias-disable; + }; + + mdio_pins: mdio-pins { + mdc { + pins = "gpio68"; + function = "mdc"; + drive-strength = <8>; + bias-pull-up; + }; + + mdio { + pins = "gpio69"; + function = "mdio"; + drive-strength = <8>; + bias-pull-up; + }; + }; +}; + +&blsp1_uart5 { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&crypto { + status = "okay"; +}; + +&prng { + status = "okay"; +}; + +&qpic_bam { + status = "okay"; +}; + +&qpic_nand { + status = "okay"; + + nand@0 { + reg = <0>; + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + nand-bus-width = <8>; + + partitions { + compatible = "qcom,smem-part"; /* define SMEM partition table */ + + }; + }; +}; + +&qusb_phy_0 { + status = "okay"; +}; + +&ssphy_0 { + status = "okay"; +}; + +&usb_0 { + status = "okay"; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; + + qca8033: ethernet-phy@4 { + compatible = "ethernet-phy-ieee802.3-c22"; /* lan phy */ + reg = <4>; + }; + + qca8081: ethernet-phy@28 { + compatible = "ethernet-phy-id004d.d101"; /* wan phy */ + reg = <28>; + reset-deassert-us = <10000>; + reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>; + }; +}; + + +&switch { + status = "okay"; + + switch_wan_bmp = ; /* wan port bitmap */ + switch_lan_bmp = ; /* lan port bitmap */ + switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ + switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ + + qcom,port_phyinfo { + port@5 { + port_id = <5>; + phy_address = <28>; + port_mac_sel = "QGMAC_PORT"; + }; + port@6 { + port_id = <6>; + phy_address = <4>; + }; + }; +}; + +&edma { + status = "okay"; +}; + +&dp5 { + status = "okay"; + phy-handle = <&qca8081>; + label = "wan"; +}; + +&dp6_syn { + status = "okay"; + phy-handle = <&qca8033>; + label = "lan"; +}; + +&wifi { + status = "okay"; + qcom,ath11k-calibration-variant = "tplink_deco-x80-5g"; +}; diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk index 9a615eb0b49..bd1529807e9 100644 --- a/target/linux/qualcommax/image/ipq807x.mk +++ b/target/linux/qualcommax/image/ipq807x.mk @@ -392,6 +392,21 @@ define Device/spectrum_sax1v1k endef TARGET_DEVICES += spectrum_sax1v1k + +define Device/tplink_deco-x80-5g + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := TP-Link + DEVICE_MODEL := Deco X80-5G + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_DTS_CONFIG := config@hk01.c5 + SOC := ipq8074 + DEVICE_PACKAGES := kmod-hwmon-gpiofan ipq-wifi-tplink_deco-x80-5g \ + kmod-usb-serial-option kmod-usb-net-qmi-wwan +endef +TARGET_DEVICES += tplink_deco-x80-5g + define Device/tplink_eap620hd-v1 $(call Device/FitImage) $(call Device/UbiFit) diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network index 7d55f6ab69e..437b3936b3e 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network @@ -13,6 +13,7 @@ ipq807x_setup_interfaces() case "$board" in aliyun,ap8220|\ edgecore,eap102|\ + tplink,deco-x80-5g|\ yuncore,ax880|\ zte,mf269) ucidef_set_interfaces_lan_wan "lan" "wan" @@ -100,6 +101,11 @@ ipq807x_setup_macs() lan_mac=$(macaddr_add $label_mac 1) wan_mac=$label_mac ;; + tplink,deco-x80-5g) + label_mac=$(get_mac_binary /tmp/factory_data/default-mac 0) + lan_mac=$(macaddr_add $label_mac 1) + wan_mac=$label_mac + ;; tplink,eap620hd-v1|\ tplink,eap660hd-v1) label_mac=$(get_mac_binary /tmp/factory_data/default-mac 0) diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata index 508ecec314a..d46e84bf8b9 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata +++ b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata @@ -96,6 +96,13 @@ case "$FIRMWARE" in 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 diff --git a/target/linux/qualcommax/ipq807x/base-files/lib/preinit/09_mount_factory_data b/target/linux/qualcommax/ipq807x/base-files/lib/preinit/09_mount_factory_data index f29362dbcef..4e7071155a7 100644 --- a/target/linux/qualcommax/ipq807x/base-files/lib/preinit/09_mount_factory_data +++ b/target/linux/qualcommax/ipq807x/base-files/lib/preinit/09_mount_factory_data @@ -18,6 +18,10 @@ preinit_mount_factory_data() { preinit_mount_factory_partitions() { case $(board_name) in + tplink,deco-x80-5g) + preinit_mount_factory_data "factory_data" + preinit_mount_factory_data "runtime_data" + ;; tplink,eap620hd-v1|\ tplink,eap660hd-v1) preinit_mount_factory_data "tp_data" diff --git a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh index ec8d0f58b06..0a38cfa8d8c 100644 --- a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh @@ -262,6 +262,7 @@ platform_do_upgrade() { CI_DATAPART="rootfs_data" emmc_do_upgrade "$1" ;; + tplink,deco-x80-5g|\ tplink,eap620hd-v1|\ tplink,eap660hd-v1) tplink_do_upgrade "$1"