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 a747dd90a8..77749e3f0c 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -46,6 +46,9 @@ ipq40xx_setup_interfaces() netgear,rbr20|\ netgear,wac510|\ sony,ncp-hg100-cellular|\ + tplink,deco-m5-v1|\ + tplink,deco-m5-v2|\ + tplink,deco-m5-v3|\ wallys,dr40x9|\ zte,mf18a|\ zte,mf289f) diff --git a/target/linux/ipq40xx/dts/qcom-ipq4019-deco-m5-v1.dts b/target/linux/ipq40xx/dts/qcom-ipq4019-deco-m5-v1.dts new file mode 100644 index 0000000000..c78e0dfa1a --- /dev/null +++ b/target/linux/ipq40xx/dts/qcom-ipq4019-deco-m5-v1.dts @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq4019-deco-m5.dtsi" + +/ { + model = "TP-Link Deco M5 v1"; + compatible = "tplink,deco-m5-v1", "qcom,ipq4019"; + + aliases { + led-boot = &led_driver_blue; + led-failsafe = &led_driver_red; + led-running = &led_driver_green; + led-upgrade = &led_driver_red; + }; +}; + +&led_driver { + status = "okay"; +}; + +&wifi0 { + qcom,ath10k-calibration-variant = "TP-Link-Deco-M5-v1"; +}; + +&wifi1 { + qcom,ath10k-calibration-variant = "TP-Link-Deco-M5-v1"; +}; diff --git a/target/linux/ipq40xx/dts/qcom-ipq4019-deco-m5-v2.dts b/target/linux/ipq40xx/dts/qcom-ipq4019-deco-m5-v2.dts new file mode 100644 index 0000000000..dd3256d29f --- /dev/null +++ b/target/linux/ipq40xx/dts/qcom-ipq4019-deco-m5-v2.dts @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq4019-deco-m5.dtsi" + +/ { + model = "TP-Link Deco M5 v2"; + compatible = "tplink,deco-m5-v2", "qcom,ipq4019"; + + aliases { + led-boot = &led_driver_blue; + led-failsafe = &led_driver_red; + led-running = &led_driver_green; + led-upgrade = &led_driver_red; + }; +}; + +&led_driver { + status = "okay"; +}; + +&wifi0 { + qcom,ath10k-calibration-variant = "TP-Link-Deco-M5-v1"; +}; + +&wifi1 { + qcom,ath10k-calibration-variant = "TP-Link-Deco-M5-v1"; +}; diff --git a/target/linux/ipq40xx/dts/qcom-ipq4019-deco-m5-v3.dts b/target/linux/ipq40xx/dts/qcom-ipq4019-deco-m5-v3.dts new file mode 100644 index 0000000000..38613afb94 --- /dev/null +++ b/target/linux/ipq40xx/dts/qcom-ipq4019-deco-m5-v3.dts @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq4019-deco-m5.dtsi" + +/ { + model = "TP-Link Deco M5 v3"; + compatible = "tplink,deco-m5-v3", "qcom,ipq4019"; + + aliases { + led-boot = &led_gpios_blue; + led-failsafe = &led_gpios_red; + led-running = &led_gpios_green; + led-upgrade = &led_gpios_red; + }; + + led_gpios { + status = "okay"; + compatible = "gpio-leds"; + + led_gpios_red: led@0 { + gpios = <&tlmm 28 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_FAULT; + }; + led_gpios_green: led@1 { + gpios = <&tlmm 32 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_POWER; + }; + led_gpios_blue: led@2 { + gpios = <&tlmm 35 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_BOOT; + }; + }; +}; + +&wifi0 { + qcom,ath10k-calibration-variant = "TP-Link-Deco-M5-v3"; +}; + +&wifi1 { + qcom,ath10k-calibration-variant = "TP-Link-Deco-M5-v3"; +}; diff --git a/target/linux/ipq40xx/dts/qcom-ipq4019-deco-m5.dtsi b/target/linux/ipq40xx/dts/qcom-ipq4019-deco-m5.dtsi new file mode 100644 index 0000000000..450eeeee29 --- /dev/null +++ b/target/linux/ipq40xx/dts/qcom-ipq4019-deco-m5.dtsi @@ -0,0 +1,378 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq4019.dtsi" +#include +#include +#include +#include + +/ { + chosen { + bootargs-append = " root=/dev/mtdblock16"; + }; + + aliases { + label-mac-device = &swport4; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + soc { + tcsr@194b000 { + compatible = "qcom,tcsr"; + reg = <0x194b000 0x100>; + qcom,usb-hsphy-mode-select = ; + status = "okay"; + }; + + tcsr@1949000 { + compatible = "qcom,tcsr"; + reg = <0x1949000 0x100>; + qcom,wifi_glb_cfg = ; + }; + + tcsr@1957000 { + compatible = "qcom,tcsr"; + reg = <0x1957000 0x100>; + qcom,wifi_noc_memtype_m0_m2 = ; + }; + + ess_tcsr@1953000 { + compatible = "qcom,tcsr"; + reg = <0x1953000 0x1000>; + qcom,ess-interface-select = ; + }; + }; +}; + +&tlmm { + serial_0_pins: serial_0_pinmux { + pinmux { + pins = "gpio16", "gpio17"; + function = "blsp_uart0"; + bias-disable; + }; + }; + + serial_1_pins: serial_1_pinmux { + pinmux { + pins = "gpio8", "gpio9", "gpio10", "gpio11"; + function = "blsp_uart1"; + bias-disable; + }; + }; + + spi_0_pins: spi_0_pinmux { + pinmux { + pins = "gpio13", "gpio14", "gpio15"; + function = "blsp_spi0"; + drive-strength = <12>; + bias-disable; + }; + pinmux_cs { + pins = "gpio12"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + output-high; + }; + }; + + i2c_0_pins: i2c_0_pinmux { + pinmux { + pins = "gpio20", "gpio21"; + function = "blsp_i2c0"; + drive-strength = <16>; + bias-disable; + }; + }; + + wifi_pins: wifi_pinmux { + pinmux_1 { + pins = "gpio37"; + function = "gpio"; + drive-strength = <6>; + bias-pull-up; + output-high; + }; + + pinmux_2 { + pins = "gpio42"; + function = "gpio"; + drive-strength = <6>; + bias-pull-up; + output-high; + }; + + pinmux_3 { + pins = "gpio43"; + function = "gpio"; + drive-strength = <6>; + bias-pull-up; + }; + }; +}; + +&blsp_dma { + status = "okay"; +}; + +&blsp1_i2c3 { + pinctrl-0 = <&i2c_0_pins>; + pinctrl-names = "default"; + status = "okay"; + + led_driver: lp5521@32 { + compatible = "national,lp5521"; + reg = <0x32>; + clock-mode = /bits/ 8 <2>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + + led_driver_red: led@0 { + reg = <0>; + chan-name = "fault:red"; + led-cur = /bits/ 8 <0x2f>; + max-cur = /bits/ 8 <0x5f>; + color = ; + function = LED_FUNCTION_FAULT; + }; + led_driver_green: led@1 { + reg = <1>; + chan-name = "power:green"; + led-cur = /bits/ 8 <0x2f>; + max-cur = /bits/ 8 <0x5f>; + color = ; + function = LED_FUNCTION_POWER; + }; + led_driver_blue: led@2 { + reg = <2>; + chan-name = "boot:blue"; + led-cur = /bits/ 8 <0x2f>; + max-cur = /bits/ 8 <0x5f>; + color = ; + }; + }; +}; + +&blsp1_uart1 { + pinctrl-0 = <&serial_0_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&blsp1_uart2 { + pinctrl-0 = <&serial_1_pins>; + pinctrl-names = "default"; + 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>; + reg = <0>; + compatible = "jedec,spi-nor"; + spi-max-frequency = <24000000>; + + partitions { + #address-cells = <1>; + #size-cells = <1>; + compatible = "fixed-partitions"; + + partition@0 { + label = "0:SBL1"; + reg = <0x00000000 0x00030000>; + read-only; + }; + partition@30000 { + label = "0:BOOTCONFIG"; + reg = <0x00030000 0x00010000>; + read-only; + }; + partition@40000 { + label = "0:MIBIB"; + reg = <0x00040000 0x00010000>; + read-only; + }; + partition@50000 { + label = "0:BOOTCONFIG1"; + reg = <0x00050000 0x00010000>; + read-only; + }; + partition@60000 { + label = "0:QSEE"; + reg = <0x00060000 0x00060000>; + read-only; + }; + partition@c0000 { + label = "0:CDT"; + reg = <0x000c0000 0x00010000>; + read-only; + }; + partition@d0000 { + label = "0:DDRPARAMS"; + reg = <0x000d0000 0x00010000>; + read-only; + }; + partition@e0000 { + label = "0:APPSBLENV"; + reg = <0x000e0000 0x00010000>; + read-only; + }; + partition@f0000 { + label = "0:APPSBL"; + reg = <0x000f0000 0x00080000>; + read-only; + }; + partition@170000 { + label = "0:ART"; + reg = <0x00170000 0x00010000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + precal_art_1000: precal@1000 { + reg = <0x1000 0x2f20>; + }; + + precal_art_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; + }; + }; + partition@180000 { + label = "OPAQUE"; + reg = <0x00180000 0x000c0000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_gmac0: macaddr@0 { + compatible = "mac-base"; + reg = <0x8 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + partition@240000 { + label = "0:HLOS"; + reg = <0x00240000 0x00300000>; + read-only; + }; + partition@540000 { + label = "0:rootfs"; + reg = <0x00540000 0x007d0000>; + read-only; + }; + partition@d10000 { + label = "0:APPSBL_1"; + reg = <0x00d10000 0x00080000>; + read-only; + }; + partition@d90000 { + label = "firmware"; + compatible = "denx,fit"; + reg = <0x00d90000 0x01270000>; + }; + }; + }; +}; + +&crypto { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&prng { + status = "okay"; +}; + +&usb2 { + status = "disabled"; +}; + +&usb2_hs_phy { + status = "disabled"; +}; + +&usb3 { + status = "disabled"; +}; + +&usb3_hs_phy { + status = "disabled"; +}; + +&usb3_ss_phy { + status = "disabled"; +}; + +&mdio { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&gmac { + status = "okay"; +}; + +&switch { + status = "okay"; +}; + +&swport4 { + status = "okay"; + label = "lan"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_gmac0 0>; +}; + +&swport5 { + status = "okay"; + label = "wan"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_gmac0 1>; +}; + +&wifi0 { + pinctrl-0 = <&wifi_pins>; + pinctrl-names = "default"; + status = "okay"; + nvmem-cell-names = "pre-calibration", "mac-address"; + nvmem-cells = <&precal_art_1000>, <&macaddr_gmac0 2>; +}; + +&wifi1 { + status = "okay"; + nvmem-cell-names = "pre-calibration", "mac-address"; + nvmem-cells = <&precal_art_5000>, <&macaddr_gmac0 3>; +}; diff --git a/target/linux/ipq40xx/image/Makefile b/target/linux/ipq40xx/image/Makefile index 31aa960298..f68b72987b 100644 --- a/target/linux/ipq40xx/image/Makefile +++ b/target/linux/ipq40xx/image/Makefile @@ -17,4 +17,8 @@ endef include $(SUBTARGET).mk +ifeq ($(SUBTARGET),generic) +include generic-tp-link.mk +endif + $(eval $(call BuildImage)) diff --git a/target/linux/ipq40xx/image/generic-tp-link.mk b/target/linux/ipq40xx/image/generic-tp-link.mk new file mode 100644 index 0000000000..5d91c3c743 --- /dev/null +++ b/target/linux/ipq40xx/image/generic-tp-link.mk @@ -0,0 +1,40 @@ +DEVICE_VARS += TPLINK_BOARD_ID + +define Device/tplink-deco-m5-common + $(call Device/FitzImage) + DEVICE_VENDOR := TP-Link + SOC := qcom-ipq4019 + IMAGES += factory.bin + IMAGE/factory.bin := append-rootfs | tplink-safeloader factory + IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | append-metadata +endef + +define Device/tplink_deco-m5-v1 + $(call Device/tplink-deco-m5-common) + DEVICE_MODEL := Deco-M5 + DEVICE_VARIANT := v1 + TPLINK_BOARD_ID := DECO-M5 + KERNEL_SIZE := 4096k + IMAGE_SIZE := 16640k +endef +TARGET_DEVICES += tplink_deco-m5-v1 + +define Device/tplink_deco-m5-v2 + $(call Device/tplink-deco-m5-common) + DEVICE_MODEL := Deco-M5 + DEVICE_VARIANT := v2 + TPLINK_BOARD_ID := DECO-M5 + KERNEL_SIZE := 4096k + IMAGE_SIZE := 16640k +endef +TARGET_DEVICES += tplink_deco-m5-v2 + +define Device/tplink_deco-m5-v3 + $(call Device/tplink-deco-m5-common) + DEVICE_MODEL := Deco-M5 + DEVICE_VARIANT := v3 + TPLINK_BOARD_ID := DECO-M5 + KERNEL_SIZE := 4096k + IMAGE_SIZE := 16640k +endef +TARGET_DEVICES += tplink_deco-m5-v3