ipq807x: add Dynalink DL-WRX36
authorDirk Buchwalder <buchwalder@posteo.de>
Fri, 5 Aug 2022 09:38:37 +0000 (11:38 +0200)
committerRobert Marko <robimarko@gmail.com>
Mon, 16 Jan 2023 11:42:23 +0000 (12:42 +0100)
Dynalink DL-WRX36 is a AX WIFI router with 4 1G and 1 2.5G ports.

Specifications:

    •     CPU: Qualcomm IPQ8072A Quad core Cortex-A53 2.2GHz
    •     RAM: 1024MB of DDR3
    •     Storage: 256MB Nand
    •     Ethernet: 4x 1G RJ45 ports (QCA8075) + 1 2.5G Port (QCA8081)
    •     WLAN:
          2.4GHz: Qualcomm QCN5024 2x2 802.11b/g/n/ax 1174 Mbps PHY rate
          5GHz: Qualcomm QCN5054 4x4 802.11a/b/g/n/ac/ax 2402 PHY rate
    •     1x USB 3.0

    •     1 gpio-controlled dual color led (blue/red)

            • Buttons: 1x soft reset / 1x WPS
            • Power: 12V DC jack

        A poulated serial header is onboard (J1004)
        the connector size is a 4-pin 2.0 mm JST PH.
        RX/TX is working, u-boot bootwait is active, secure boot is enabled.

        Notes:
- Serial is completely deactivated in the stock firmware image.
- This commit adds only single partition support, that means
  sysupgrade is upgrading the current rootfs partition.
- Installation can be done by serial connection or
  SSH access on OEM firmware

Installation Instructions:

Most part of the installation is performed from an initramfs image
running OpenWrt, and there are two options to boot it.

Boot initramfs option 1: Using serial connection (3.3V)
1. Stop auto boot to get to U-boot shell
2. Transfer initramfs image to device
   (openwrt-ipq807x-generic-dynalink_dl-wrx36-initramfs-uImage.itb)
   Tested using TFTP and a FAT-formatted USB flash drive.
3. Boot the initramfs image
   # bootm

Boot initramfs option 2: From SSH access on OEM firmware
1. Copy the initramfs image to a FAT-formatted flash drive
   (tested on single-partition drive) and connect it to device USB port.
2. Change boot command so it loads the initramfs image on next boot
   Fallback to OEM firmware is provided.
   # fw_setenv bootcmd 'usb start && fatload usb 0:1 0x44000000 openwrt-ipq807x-generic-dynalink_dl-wrx36-initramfs-uImage.itb && bootm 0x44000000; bootipq'
3. Reboot the device to boot the initramfs
   # reboot

Install OpenWrt from initramfs image:
1. Use SCP (or other way) to transfer OpenWrt factory image
2. Connect to device using SSH (on a LAN port)
3. Check MTD partition table.
   rootfs and rootfs_1 should be mtd18 and mtd20
   depending on current OEM slot.
   # cat /proc/mtd
4. Do a ubiformat to both rootfs partitions:
   # ubiformat /dev/mtd18 -y -f /path_to/factory_image
   # ubiformat /dev/mtd20 -y -f /path_to/factory_image
5. Set U-boot env variable: mtdids
   # fw_setenv mtdids 'nand0=nand0'
6. Get offset of mtd18 to determine current OEM slot
   - If current OEM slot is 1, offset is 16777216  (0x1000000)
   - If current OEM slot is 2, offset is 127926272 (0x7a00000)
   # cat /sys/class/mtd/mtd18/offset
7. Set U-boot env variable: mtdparts
   If current OEM slot is 1, run:
   # fw_setenv mtdparts 'mtdparts=nand0:0x6100000@0x1000000(fs),0x6100000@0x7a00000(fs_1)'
   If current OEM slot is 2, run:
   # fw_setenv mtdparts 'mtdparts=nand0:0x6100000@0x7a00000(fs),0x6100000@0x1000000(fs_1)'
8. Set U-boot env variable: bootcmd
   # fw_setenv bootcmd 'setenv bootargs console=ttyMSM0,115200n8 ubi.mtd=rootfs rootfstype=squashfs rootwait; ubi part fs; ubi read 0x44000000 kernel; bootm 0x44000000#config@rt5010w-d350-rev0'
9. Reboot the device
   # reboot

        Note: this PR adds only single partition support, that means sysupgrade is
              upgrading the current rootfs partition

Signed-off-by: Dirk Buchwalder <buchwalder@posteo.de>
package/boot/uboot-envtools/files/ipq807x
package/firmware/ipq-wifi/Makefile
package/firmware/ipq-wifi/board-dynalink_dl-wrx36.ipq8074 [new file with mode: 0644]
target/linux/ipq807x/base-files/etc/board.d/02_network
target/linux/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata
target/linux/ipq807x/base-files/lib/upgrade/platform.sh
target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts [new file with mode: 0644]
target/linux/ipq807x/image/generic.mk

index 71fa7b7b7992a93359e105ade2d213dd0d09e3cd..63fd04ec5b59bd2691e130d364c1b7b070159c2d 100644 (file)
@@ -8,6 +8,11 @@ touch /etc/config/ubootenv
 board=$(board_name)
 
 case "$board" in
+dynalink,dl-wrx36)
+       idx="$(find_mtd_index 0:appsblenv)"
+       [ -n "$idx" ] && \
+               ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2"
+       ;;
 edgecore,eap102)
        idx="$(find_mtd_index 0:appsblenv)"
        [ -n "$idx" ] && \
index e662f7408acbb0007163ed638f56bc2f27d6a668..32988910c0a7fd0bbb4b0bab8f9fa002d039b74b 100644 (file)
@@ -27,6 +27,7 @@ endef
 ALLWIFIBOARDS:= \
        aruba_ap-365 \
        devolo_magic-2-wifi-next \
+       dynalink_dl-wrx36 \
        edgecore_eap102 \
        edgecore_ecw5410 \
        edgecore_oap100 \
@@ -124,6 +125,7 @@ endef
 
 $(eval $(call generate-ipq-wifi-package,aruba_ap-365,Aruba AP-365))
 $(eval $(call generate-ipq-wifi-package,devolo_magic-2-wifi-next,devolo Magic 2 WiFi next))
+$(eval $(call generate-ipq-wifi-package,dynalink_dl-wrx36,Dynalink DL-WRX36))
 $(eval $(call generate-ipq-wifi-package,edgecore_eap102,Edgecore EAP102))
 $(eval $(call generate-ipq-wifi-package,edgecore_ecw5410,Edgecore ECW5410))
 $(eval $(call generate-ipq-wifi-package,edgecore_oap100,Edgecore OAP100))
diff --git a/package/firmware/ipq-wifi/board-dynalink_dl-wrx36.ipq8074 b/package/firmware/ipq-wifi/board-dynalink_dl-wrx36.ipq8074
new file mode 100644 (file)
index 0000000..e529000
Binary files /dev/null and b/package/firmware/ipq-wifi/board-dynalink_dl-wrx36.ipq8074 differ
index 8856daff31416dd5bc392f957f59728dfa3120dc..e2bd46f0959683e5f486c267c2827bea613444f6 100644 (file)
@@ -11,6 +11,9 @@ ipq807x_setup_interfaces()
        local board="$1"
 
        case "$board" in
+       dynalink,dl-wrx36)
+               ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
+               ;;
        edgecore,eap102)
                ucidef_set_interfaces_lan_wan "lan" "wan"
                ;;
index a2290ac124aa08b0278f32f6592039406808778a..974e7607aa39fac840d156b9b1ff3a0681a29f21 100644 (file)
@@ -11,6 +11,7 @@ case "$FIRMWARE" in
        case "$board" in
        edgecore,eap102|\
        edimax,cax1800|\
+       dynalink,dl-wrx36|\
        qnap,301w|\
        redmi,ax6|\
        xiaomi,ax3600|\
index ab3121c44f43ffc9432aa51712f141be114f5edd..63f546444f31ac804a8480106aaef87e39827e84 100644 (file)
@@ -43,6 +43,9 @@ platform_pre_upgrade() {
 
 platform_do_upgrade() {
        case "$(board_name)" in
+       dynalink,dl-wrx36)
+               nand_do_upgrade "$1"
+               ;;
        edgecore,eap102)
                active="$(fw_printenv -n active)"
                if [ "$active" -eq "1" ]; then
diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts
new file mode 100644 (file)
index 0000000..5468e9e
--- /dev/null
@@ -0,0 +1,243 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/* Copyright (c) 2022, Robert Marko <robimarko@gmail.com> */
+
+/dts-v1/;
+
+#include "ipq8074.dtsi"
+#include "ipq8074-hk-cpu.dtsi"
+#include "ipq8074-ess.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+
+/ {
+       model = "Dynalink DL-WRX36";
+       compatible = "dynalink,dl-wrx36", "qcom,ipq8074";
+
+       aliases {
+               led-boot = &led_system_red;
+               led-failsafe = &led_system_red;
+               led-running = &led_system_blue;
+               led-upgrade = &led_system_red;
+               serial0 = &blsp1_uart5;
+               /* Aliases as required by u-boot to patch MAC addresses */
+               ethernet0 = &dp6_syn;
+               ethernet1 = &dp4;
+               ethernet2 = &dp3;
+               ethernet3 = &dp2;
+               ethernet4 = &dp1;
+               label-mac-device = &dp6_syn;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+               bootargs-append = " root=/dev/ubiblock0_1";
+       };
+
+       keys {
+               compatible = "gpio-keys";
+
+               reset {
+                       label = "reset";
+                       gpios = <&tlmm 34 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_RESTART>;
+               };
+
+               wps {
+                       label = "wps";
+                       gpios = <&tlmm 63 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_WPS_BUTTON>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led_system_blue: system-blue {
+                       label = "blue:system";
+                       gpios = <&tlmm 26 GPIO_ACTIVE_HIGH>;
+                       color = <LED_COLOR_ID_BLUE>;
+               };
+
+               led_system_red: system-red {
+                       label = "red:system";
+                       gpios = <&tlmm 25 GPIO_ACTIVE_HIGH>;
+                       color = <LED_COLOR_ID_RED>;
+               };
+       };
+};
+
+&tlmm {
+       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";
+};
+
+&prng {
+       status = "okay";
+};
+
+&cryptobam {
+       status = "okay";
+};
+
+&crypto {
+       status = "okay";
+};
+
+&qpic_bam {
+       status = "okay";
+};
+
+&qpic_nand {
+       status = "okay";
+
+       nand@0 {
+               reg = <0>;
+               nand-ecc-strength = <8>;
+               nand-ecc-step-size = <512>;
+               nand-bus-width = <8>;
+
+               partitions {
+                       compatible = "qcom,smem-part";
+               };
+       };
+};
+
+&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>;
+
+       qca8075_0: ethernet-phy@0 {
+               compatible = "ethernet-phy-ieee802.3-c22";
+               reg = <0>;
+       };
+
+       qca8075_1: ethernet-phy@1 {
+               compatible = "ethernet-phy-ieee802.3-c22";
+               reg = <1>;
+       };
+
+       qca8075_2: ethernet-phy@2 {
+               compatible = "ethernet-phy-ieee802.3-c22";
+               reg = <2>;
+       };
+
+       qca8075_3: ethernet-phy@3 {
+               compatible = "ethernet-phy-ieee802.3-c22";
+               reg = <3>;
+       };
+
+       qca8081: ethernet-phy@28 {
+               compatible = "ethernet-phy-id004d.d101";
+               reg = <28>;
+               reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>;
+       };
+};
+
+&switch {
+       status = "okay";
+
+       switch_cpu_bmp = <0x1>;  /* cpu port bitmap */
+       switch_lan_bmp = <0x3e>; /* lan port bitmap */
+       switch_wan_bmp = <0x40>; /* wan port bitmap */
+       switch_mac_mode = <0xb>; /* mac mode for uniphy instance0*/
+       switch_mac_mode1 = <0xff>; /* mac mode for uniphy instance1*/
+       switch_mac_mode2 = <0xc>; /* mac mode for uniphy instance2*/
+       bm_tick_mode = <0>; /* bm tick mode */
+       tm_tick_mode = <0>; /* tm tick mode */
+
+       qcom,port_phyinfo {
+               port@0 {
+                       port_id = <1>;
+                       phy_address = <0>;
+               };
+               port@1 {
+                       port_id = <2>;
+                       phy_address = <1>;
+               };
+               port@2 {
+                       port_id = <3>;
+                       phy_address = <2>;
+               };
+               port@3 {
+                       port_id = <4>;
+                       phy_address = <3>;
+               };
+               port@5 {
+                       port_id = <6>;
+                       phy_address = <28>;
+                       port_mac_sel = "QGMAC_PORT";
+               };
+       };
+};
+
+&edma {
+       status = "okay";
+};
+
+&dp1 {
+       status = "okay";
+       phy-handle = <&qca8075_0>;
+       label = "lan4";
+};
+
+&dp2 {
+       status = "okay";
+       phy-handle = <&qca8075_1>;
+       label = "lan3";
+};
+
+&dp3 {
+       status = "okay";
+       phy-handle = <&qca8075_2>;
+       label = "lan2";
+};
+
+&dp4 {
+       status = "okay";
+       phy-handle = <&qca8075_3>;
+       label = "lan1";
+};
+
+&dp6_syn {
+       status = "okay";
+       phy-handle = <&qca8081>;
+       label = "wan";
+};
+
+&wifi {
+       status = "okay";
+       qcom,ath11k-calibration-variant = "Dynalink-DL-WRX36";
+};
index 23260ed1e784a6023d7886a0535acf2e6c59173d..811a32e942b3dc0e36530b05d4859831b512cea1 100644 (file)
@@ -17,6 +17,19 @@ define Device/UbiFit
        IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
 endef
 
+define Device/dynalink_dl-wrx36
+       $(call Device/FitImage)
+       $(call Device/UbiFit)
+       DEVICE_VENDOR := Dynalink
+       DEVICE_MODEL := DL-WRX36
+       BLOCKSIZE := 128k
+       PAGESIZE := 2048
+       DEVICE_DTS_CONFIG := config@rt5010w-d350-rev0
+       SOC := ipq8072
+       DEVICE_PACKAGES := ipq-wifi-dynalink_dl-wrx36
+endef
+TARGET_DEVICES += dynalink_dl-wrx36
+
 define Device/edgecore_eap102
        $(call Device/FitImage)
        $(call Device/UbiFit)