]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
ipq40xx: add support for TP-Link Deco-M5
authorBee Cadorna <r3usrlnd@gmail.com>
Wed, 8 Jan 2025 22:30:05 +0000 (16:30 -0600)
committerRobert Marko <robimarko@gmail.com>
Wed, 25 Mar 2026 09:31:58 +0000 (10:31 +0100)
Specifications
--------------
- SoC          : Qualcomm IPQ4019
- RAM          : 256 MiB DDR3-1600 (NT5CC128M16IP)
- Flash        : 32 MiB SPI NOR
  - V1, V2     : GigaDevice GD25Q256C
  - V3         : Winbond W25Q256FV, Micron N25Q128A11
  - V320       : EON EN25QH256, XMC XM25QH256BK (with patch included)
- WLAN         : IPQ4019 On-chip
  - 2.4 GHz    : 2x2 MIMO 802.11b/g/n
  - 5 GHz      : 2x2 MIMO 802.11n/ac
- Ethernet     : QCA8072 10/100/1000BASE-T 1x WAN; 1x LAN
- UART         : 3v3 115200n, use pins under heatsink
- Buttons      : 1x Reset
- LEDs         : 1x Combined RGB LED
  - V1         : Driven by LP5521 channels (Channel 0, 1, 2?)
  - V3, V320   : Driven by GPIO Pins (Pin 28, 32, 35 Active Low)
- Bluetooth    :
  - V1, V2, V3 : CSR8811
  - V320       : AC6368A/B
- Power        : DC 12V @ 1.2A
- FCC ID       :
  - V1         : TE7M5
  - V3         : TE7M5V3
  - V320       : TE7M5V32, 2AXJ4M5V3, 2BCGWM5V3
- TFTP ID      :
  - Client     : 192.168.0.66
  - Router     : 192.168.0.11

MAC Addresses
-------------
Label   : OPAQUE partition @ 0x0008
LAN     : Label
WAN     : Label + 1
WLAN 2G : Label + 2
WLAN 5G : Label + 3

Installation
------------
1. Install TFTP server software
2. Rename the factory image to 'M5v1_tp_recovery.bin' and copy it into
   the TFTP folder
3. Connect an interface configured to 192.168.0.66/24 to the LAN port
   - Note: The LAN port is the ethernet port that is furthest away from
     the power plug
4. Press the 'reset' button down before powering up the device, holding
   for at least 10 seconds
5. Router should download the factory image, install it, and then reboot
6. Router will start up with address 192.168.1.1

Known Issues
------------
- Some devices (including some V1 and V2 devices) may have flash chips
  that are not detected, supported by, or have broken SFDP support

Signed-off-by: Bee Cadorna <r3usrlnd@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/17537
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/ipq40xx/base-files/etc/board.d/02_network
target/linux/ipq40xx/dts/qcom-ipq4019-deco-m5-v1.dts [new file with mode: 0644]
target/linux/ipq40xx/dts/qcom-ipq4019-deco-m5-v2.dts [new file with mode: 0644]
target/linux/ipq40xx/dts/qcom-ipq4019-deco-m5-v3.dts [new file with mode: 0644]
target/linux/ipq40xx/dts/qcom-ipq4019-deco-m5.dtsi [new file with mode: 0644]
target/linux/ipq40xx/image/Makefile
target/linux/ipq40xx/image/generic-tp-link.mk [new file with mode: 0644]

index a747dd90a8cbbd3f5717f5811743dae14c980b16..77749e3f0cb49afb50dffd8e01e679ba45d4691b 100644 (file)
@@ -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 (file)
index 0000000..c78e0df
--- /dev/null
@@ -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 (file)
index 0000000..dd3256d
--- /dev/null
@@ -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 (file)
index 0000000..38613af
--- /dev/null
@@ -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 = <LED_COLOR_ID_RED>;
+                       function = LED_FUNCTION_FAULT;
+               };
+               led_gpios_green: led@1 {
+                       gpios = <&tlmm 32 GPIO_ACTIVE_LOW>;
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_POWER;
+               };
+               led_gpios_blue: led@2 {
+                       gpios = <&tlmm 35 GPIO_ACTIVE_LOW>;
+                       color = <LED_COLOR_ID_BLUE>;
+                       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 (file)
index 0000000..450eeee
--- /dev/null
@@ -0,0 +1,378 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "qcom-ipq4019.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/soc/qcom,tcsr.h>
+#include <dt-bindings/leds/common.h>
+
+/ {
+       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 = <KEY_RESTART>;
+               };
+       };
+
+       soc {
+               tcsr@194b000 {
+                       compatible = "qcom,tcsr";
+                       reg = <0x194b000 0x100>;
+                       qcom,usb-hsphy-mode-select = <TCSR_USB_HSPHY_HOST_MODE>;
+                       status = "okay";
+               };
+
+               tcsr@1949000 {
+                       compatible = "qcom,tcsr";
+                       reg = <0x1949000 0x100>;
+                       qcom,wifi_glb_cfg = <TCSR_WIFI_GLB_CFG>;
+               };
+
+               tcsr@1957000 {
+                       compatible = "qcom,tcsr";
+                       reg = <0x1957000 0x100>;
+                       qcom,wifi_noc_memtype_m0_m2 = <TCSR_WIFI_NOC_MEMTYPE_M0_M2>;
+               };
+
+               ess_tcsr@1953000 {
+                       compatible = "qcom,tcsr";
+                       reg = <0x1953000 0x1000>;
+                       qcom,ess-interface-select = <TCSR_ESS_PSGMII>;
+               };
+       };
+};
+
+&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 = <LED_COLOR_ID_RED>;
+                       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 = <LED_COLOR_ID_GREEN>;
+                       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 = <LED_COLOR_ID_BLUE>;
+               };
+       };
+};
+
+&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>;
+};
index 31aa9602983e39c2eb79123263dc1e36c44b591e..f68b72987b5791d6e997de1ae349960aec41b5ef 100644 (file)
@@ -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 (file)
index 0000000..5d91c3c
--- /dev/null
@@ -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