From 7b1bf22f745029260fbd0e32311dd997a6970e5b Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 10 Aug 2021 08:01:24 +0200 Subject: [PATCH] ipq40xx: add tplink ec420 support Signed-off-by: John Crispin --- package/firmware/ipq-wifi/Makefile | 4 +- .../ipq40xx/base-files/etc/board.d/02_network | 3 +- .../etc/hotplug.d/firmware/11-ath10k-caldata | 11 +- .../base-files/lib/upgrade/platform.sh | 3 +- .../dts/qcom-ipq4019-tp-link-ec420-g1.dts | 276 ++++++++++++++++++ target/linux/ipq40xx/image/generic.mk | 15 + .../patches-5.4/998-tp-link-ec420-g1.patch | 12 + 7 files changed, 316 insertions(+), 8 deletions(-) create mode 100755 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-tp-link-ec420-g1.dts create mode 100644 target/linux/ipq40xx/patches-5.4/998-tp-link-ec420-g1.patch diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index b996ee311f..c9d113ae6a 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -50,7 +50,8 @@ ALLWIFIBOARDS:= \ plasmacloud_pa1200 \ plasmacloud_pa2200 \ qxwlan_e2600ac \ - cig_wf610d + cig_wf610d \ + tp-link_ec420-g1 ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ipq-wifi-$(BOARD)) @@ -137,5 +138,6 @@ $(eval $(call generate-ipq-wifi-package,plasmacloud_pa1200,Plasma Cloud PA1200)) $(eval $(call generate-ipq-wifi-package,plasmacloud_pa2200,Plasma Cloud PA2200)) $(eval $(call generate-ipq-wifi-package,qxwlan_e2600ac,Qxwlan E2600AC)) $(eval $(call generate-ipq-wifi-package,cig_wf610d,CIG WF_610D)) +$(eval $(call generate-ipq-wifi-package,tp-link_ec420-g1,tp-link EC420-G1)) $(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE)))) diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index d62a2e5061..16f6040b6e 100755 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -32,8 +32,9 @@ ipq40xx_setup_interfaces() mikrotik,sxtsq-5-ac|\ netgear,ex6100v2|\ netgear,ex6150v2|\ + tp-link,ec420-g1|\ zyxel,wre6606) - ucidef_set_interface_lan "eth0" + ucidef_set_interface_wan "eth0" ;; aruba,ap-303h) ucidef_set_interfaces_lan_wan "eth0" "eth1" diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 3948c08984..c8943d3ba3 100644 --- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -46,6 +46,9 @@ case "$FIRMWARE" in # OEM assigns 4 sequential MACs ath10k_patch_mac $(macaddr_setbit_la $(macaddr_add "$(cat /sys/class/net/eth0/address)" 4)) ;; + tp-link,ec420-g1) + caldata_extract "0:ART" 0x9000 0x2f20 + ;; esac ;; "ath10k/pre-cal-ahb-a000000.wifi.bin") @@ -159,6 +162,9 @@ case "$FIRMWARE" in caldata_extract "ART" 0x1000 0x2f20 ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2) ;; + tp-link,ec420-g1) + caldata_extract "0:ART" 0x1000 0x2f20 + ;; esac ;; "ath10k/pre-cal-ahb-a800000.wifi.bin") @@ -273,11 +279,6 @@ case "$FIRMWARE" in caldata_extract "ART" 0x5000 0x2f20 ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1) ;; - tp-link,ap2220 |\ - tp-link,ec420-g1) - ath10kcal_extract "0:ART" 4096 12064 - ath10kcal_patch_mac_crc $(macaddr_add "$(get_tip mac_address)" 9) #2.4G, wlan1 - ;; esac ;; *) diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh index 54683977cd..cbdd12c750 100644 --- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -72,7 +72,8 @@ platform_do_upgrade() { glinet,gl-ap1300 |\ luma,wrtq-329acn |\ mobipromo,cm520-79f |\ - qxwlan,e2600ac-c2) + qxwlan,e2600ac-c2 |\ + tp-link,ec420-g1) nand_do_upgrade "$1" ;; alfa-network,ap120c-ac) diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-tp-link-ec420-g1.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-tp-link-ec420-g1.dts new file mode 100755 index 0000000000..fc48e605d5 --- /dev/null +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-tp-link-ec420-g1.dts @@ -0,0 +1,276 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq4019.dtsi" +#include +#include +#include + +/ { + model = "tp-link EC420 G1"; + compatible = "tp-link,ec420-g1"; + + aliases { + led-boot = &led_green; + led-failsafe = &led_green; + led-running = &led_green; + led-upgrade = &led_green; + }; + + soc { + mdio@90000 { + status = "okay"; + }; + + ess-psgmii@98000 { + status = "okay"; + }; + + tcsr@1949000 { + compatible = "qcom,tcsr"; + reg = <0x1949000 0x100>; + qcom,wifi_glb_cfg = ; + }; + + ess_tcsr@1953000 { + compatible = "qcom,tcsr"; + reg = <0x1953000 0x1000>; + qcom,ess-interface-select = ; + }; + + tcsr@1957000 { + compatible = "qcom,tcsr"; + reg = <0x1957000 0x100>; + qcom,wifi_noc_memtype_m0_m2 = ; + }; + + crypto@8e3a000 { + status = "okay"; + }; + + watchdog@b017000 { + status = "okay"; + }; + + ess-switch@c000000 { + status = "okay"; + switch_mac_mode = <0x0>; /* mac mode for RGMII RMII */ + switch_initvlas = <0x0007c 0x54>; /* port0 status */ + switch_lan_bmp = <0x10>; + }; + + edma@c080000 { + status = "okay"; + }; + }; + + key { + compatible = "gpio-keys"; + + button@1 { + label = "reset"; + linux,code = ; + gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; + linux,input-type = <1>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_red { + label = "ec420:red:status"; + gpios = <&tlmm 20 GPIO_ACTIVE_HIGH>; + }; + + led_green: power { + label = "ec420:green:status"; + gpios = <&tlmm 21 GPIO_ACTIVE_HIGH>; + }; + + led_blue { + label = "ec420:blue:status"; + gpios = <&tlmm 24 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&tlmm { + serial_0_pins: serial_pinmux { + mux { + pins = "gpio16", "gpio17"; + function = "blsp_uart0"; + bias-disable; + }; + }; + +spi_0_pins: spi_0_pinmux { + pinmux { + function = "blsp_spi0"; + pins = "gpio13", "gpio14", "gpio15"; + drive-strength = <12>; + bias-disable; + }; + + pinmux_cs { + function = "gpio"; + pins = "gpio12"; + drive-strength = <2>; + bias-disable; + output-high; + }; +}; + +nand_pins: nand_pins { + pullups { + pins = "gpio53", "gpio58", "gpio59"; + function = "qpic"; + bias-pull-up; + }; + + pulldowns { + pins = "gpio54", "gpio55", "gpio56", + "gpio57", "gpio60", "gpio61", + "gpio62", "gpio63", "gpio64", + "gpio65", "gpio66", "gpio67", + "gpio68", "gpio69"; + function = "qpic"; + bias-pull-down; + }; + }; +}; + +&cryptobam { + status = "okay"; +}; + +&blsp1_spi1 { + pinctrl-0 = <&spi_0_pins>; + pinctrl-names = "default"; + status = "okay"; + cs-gpios = <&tlmm 12 GPIO_ACTIVE_HIGH>; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "gd25q256"; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition0@0 { + label = "0:SBL1"; + reg = <0x00000000 0x00040000>; + read-only; + }; + partition1@40000 { + label = "0:MIBIB"; + reg = <0x00040000 0x00020000>; + read-only; + }; + partition2@60000 { + label = "0:QSEE"; + reg = <0x00060000 0x00060000>; + read-only; + }; + partition3@c0000 { + label = "0:CDT"; + reg = <0x000c0000 0x00010000>; + read-only; + }; + partition4@d0000 { + label = "0:DDRPARAMS"; + reg = <0x000d0000 0x00010000>; + read-only; + }; + partition5@e0000 { + label = "0:APPSBLENV"; + reg = <0x000e0000 0x00010000>; + read-only; + }; + partition6@f0000 { + label = "0:APPSBL"; + reg = <0x000f0000 0x00080000>; + read-only; + }; + partition7@170000 { + label = "0:ART"; + reg = <0x00170000 0x00010000>; + read-only; + }; + partition8@180000 { + label = "product_info"; + reg = <0x00180000 0x00010000>; + }; + partition9@190000 { + label = "factory_fw"; + reg = <0x00190000 0x01e70000>; + }; + }; + }; +}; + +&nand { + pinctrl-0 = <&nand_pins>; + pinctrl-names = "default"; + status = "okay"; + + nand@0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "ubi"; + reg = <0x00000000 0x10000000>; + }; + }; + }; +}; + +&blsp_dma { + status = "okay"; +}; + +&blsp1_uart1 { + pinctrl-0 = <&serial_0_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&qpic_bam { + status = "okay"; +}; + +&wifi0 { + status = "okay"; +}; + +&wifi1 { + status = "disabled"; +}; + +&pcie0 { + status = "okay"; + perst-gpio = <&tlmm 38 GPIO_ACTIVE_LOW>; + wake-gpio = <&tlmm 40 GPIO_ACTIVE_LOW>; + + bridge@0,0 { + reg = <0x00000000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + wifi2: wifi@1,0 { + compatible = "qcom,ath10k"; + status = "okay"; + reg = <0x00010000 0 0 0 0>; + }; + }; +}; + diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 31f4971c90..d12c48a481 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -816,3 +816,18 @@ define Device/zyxel_wre6606 DEVICE_PACKAGES := -kmod-ath10k-ct kmod-ath10k-ct-smallbuffers endef TARGET_DEVICES += zyxel_wre6606 + +define Device/tp-link_ec420_g1 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_TITLE := tp-link EC420 G1 + BOARD_NAME := ec420_g1 + DEVICE_DTS := qcom-ipq4019-tp-link-ec420-g1 + KERNEL_SIZE := 4096k + IMAGE_SIZE := 26624k + BLOCKSIZE := 128k + PAGESIZE := 2048 + SUPPORTED_DEVICES := tp-link,ec420-g1 + DEVICE_PACKAGES := ath10k-firmware-qca9984-ct ipq-wifi-tp-link_ec420-g1 +endef +TARGET_DEVICES += tp-link_ec420_g1 diff --git a/target/linux/ipq40xx/patches-5.4/998-tp-link-ec420-g1.patch b/target/linux/ipq40xx/patches-5.4/998-tp-link-ec420-g1.patch new file mode 100644 index 0000000000..40c913323f --- /dev/null +++ b/target/linux/ipq40xx/patches-5.4/998-tp-link-ec420-g1.patch @@ -0,0 +1,12 @@ +Index: linux-5.4.111/arch/arm/boot/dts/Makefile +=================================================================== +--- linux-5.4.111.orig/arch/arm/boot/dts/Makefile ++++ linux-5.4.111/arch/arm/boot/dts/Makefile +@@ -883,6 +883,7 @@ dtb-$(CONFIG_ARCH_QCOM) += \ + qcom-ipq4019-u4019-32m.dtb \ + qcom-ipq4019-wpj419.dtb \ + qcom-ipq4019-wtr-m2133hp.dtb \ ++ qcom-ipq4019-tp-link-ec420-g1.dtb \ + qcom-ipq4028-wpj428.dtb \ + qcom-ipq4029-ap-303.dtb \ + qcom-ipq4029-ap-303h.dtb \ -- 2.25.1