ramips: add support for D-Link DWR-960
authorPawel Dembicki <paweldembicki@gmail.com>
Thu, 19 Apr 2018 07:20:58 +0000 (09:20 +0200)
committerDaniel Golle <daniel@makrotopia.org>
Wed, 8 Apr 2020 13:05:51 +0000 (14:05 +0100)
The DWR-960 Wireless Router is based on the MT7620A SoC.

Specification:

- MediaTek MT7620A (580 Mhz)
- 128 MB of RAM
- 16 MB of FLASH
- 1x 802.11bgn radio
- 1x 802.11ac radio (MT7610 mpcie card)
- 4x 10/100 Mbps Ethernet (1 WAN and 3 LAN)
- 1x 10/100/1000 Mbps Ethernet (1 LAN) (AR8035)
- 2x internal, non-detachable antennas (Wifi 2.4G)
- 3x external, detachable antennas (2x LTE, 1x Wifi 5G)
- 1x LTE modem
- UART (J4) header on PCB (57600 8n1)
- 9x LED, 2x button
- JBOOT bootloader

Known issues:
- Flash is extremely slow.

Installation:
Apply factory image via http web-gui or JBOOT recovery page

How to revert to OEM firmware:
- push the reset button and turn on the power. Wait until LED start
  blinking (~10sec.)
- upload original factory image via JBOOT http (IP: 192.168.123.254)

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
target/linux/ramips/dts/mt7620a_dlink_dwr-960.dts [new file with mode: 0644]
target/linux/ramips/image/mt7620.mk
target/linux/ramips/mt7620/base-files/etc/board.d/01_leds
target/linux/ramips/mt7620/base-files/etc/board.d/02_network
target/linux/ramips/mt7620/base-files/etc/board.d/03_gpio_switches
target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom

diff --git a/target/linux/ramips/dts/mt7620a_dlink_dwr-960.dts b/target/linux/ramips/dts/mt7620a_dlink_dwr-960.dts
new file mode 100644 (file)
index 0000000..063d65a
--- /dev/null
@@ -0,0 +1,190 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "mt7620a.dtsi"
+
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+       compatible = "dlink,dwr-960", "ralink,mt7620a-soc";
+       model = "D-Link DWR-960";
+
+       aliases {
+               led-boot = &led_status;
+               led-failsafe = &led_status;
+               led-running = &led_status;
+               led-upgrade = &led_status;
+       };
+
+       keys {
+               compatible = "gpio-keys";
+
+               reset {
+                       label = "reset";
+                       gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_RESTART>;
+               };
+
+               wps {
+                       label = "wps";
+                       gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_WPS_BUTTON>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led_status: status {
+                       label = "dwr-960:green:status";
+                       gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
+               };
+
+               wan {
+                       label = "dwr-960:green:wan";
+                       gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
+               };
+
+               lan {
+                       label = "dwr-960:green:lan";
+                       gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
+               };
+
+               sms {
+                       label = "dwr-960:green:sms";
+                       gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
+               };
+
+               signal_green {
+                       label = "dwr-960:green:signal";
+                       gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>;
+               };
+
+               signal_red {
+                       label = "dwr-960:red:signal";
+                       gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>;
+               };
+
+               4g {
+                       label = "dwr-960:green:4g";
+                       gpios = <&gpio2 2 GPIO_ACTIVE_LOW>;
+               };
+
+               3g {
+                       label = "dwr-960:green:3g";
+                       gpios = <&gpio2 3 GPIO_ACTIVE_LOW>;
+               };
+
+               wlan5g {
+                       label = "dwr-960:green:wlan5g";
+                       gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "phy0tpt";
+               };
+
+               wlan2g {
+                       label = "dwr-960:green:wlan2g";
+                       gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "phy1tpt";
+               };
+       };
+};
+
+&ethernet {
+       status = "okay";
+
+       pinctrl-names = "default";
+       pinctrl-0 = <&rgmii2_pins &mdio_pins>;
+       mediatek,portmap = "wllll";
+
+       port@5 {
+               status = "okay";
+               phy-mode = "rgmii-txid";
+               phy-handle = <&phy7>;
+       };
+
+       mdio-bus {
+               status = "okay";
+
+               phy7: ethernet-phy@7 {
+                       reg = <7>;
+                       phy-mode = "rgmii-id";
+               };
+       };
+};
+
+&gpio1 {
+       status = "okay";
+};
+
+&gpio2 {
+       status = "okay";
+};
+
+&gpio3 {
+       status = "okay";
+};
+
+&spi0 {
+       status = "okay";
+
+       flash@0 {
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <50000000>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "jboot";
+                               reg = <0x0 0x10000>;
+                               read-only;
+                       };
+
+                       partition@10000 {
+                               compatible = "amit,jimage";
+                               label = "firmware";
+                               reg = <0x10000 0xfe0000>;
+                       };
+
+                       config: partition@ff0000 {
+                               label = "config";
+                               reg = <0xff0000 0x10000>;
+                               read-only;
+                       };
+               };
+       };
+};
+
+&ehci {
+       status = "okay";
+};
+
+&ohci {
+       status = "okay";
+};
+
+&pcie {
+       status = "okay";
+};
+
+&pcie0 {
+       wifi@0,0 {
+               compatible = "mediatek,mt76";
+               reg = <0x0000 0 0 0 0>;
+               ieee80211-freq-limit = <5000000 6000000>;
+               mediatek,mtd-eeprom = <&config 0xe08e>;
+               mtd-mac-address = <&config 0xe50e>;
+               mtd-mac-address-increment = <2>;
+       };
+};
+
+&state_default {
+       default {
+               ralink,group = "i2c", "wled", "spi refclk", "uartf", "ephy";
+               ralink,function = "gpio";
+       };
+};
index 552879e02fcb8e0458d370ed1a89b56c5f90d9a7..d5365ac70eec7e40c8b78f886de76b78a526231b 100644 (file)
@@ -279,6 +279,20 @@ define Device/dlink_dwr-922-e2
 endef
 TARGET_DEVICES += dlink_dwr-922-e2
 
+define Device/dlink_dwr-960
+  $(Device/amit_jboot)
+  SOC := mt7620a
+  IMAGE_SIZE := 16256k
+  DEVICE_VENDOR := D-Link
+  DEVICE_MODEL := DWR-960
+  DLINK_ROM_ID := DLK6E2429001
+  DLINK_FAMILY_MEMBER := 0x6E24
+  DLINK_FIRMWARE_SIZE := 0xFE0000
+  DEVICE_PACKAGES += kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi \
+       kmod-mt76x0e
+endef
+TARGET_DEVICES += dlink_dwr-960
+
 define Device/dovado_tiny-ac
   SOC := mt7620a
   IMAGE_SIZE := 7872k
index fe6dfac50e4dd7dcd9f3119f17061f0dc4b83670..e4fd87501962b951556811fee5108452238c2909 100755 (executable)
@@ -87,6 +87,9 @@ dlink,dwr-922-e2)
        ucidef_set_led_netdev "signalstrength" "signalstrength" "$boardname:green:sigstrength" "wwan0" "link"
        ucidef_set_led_netdev "4g" "4g" "$boardname:green:4g" "wwan0" "tx rx"
        ;;
+dlink,dwr-960)
+       ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x2e"
+       ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01"
 dovado,tiny-ac)
        set_wifi_led "$boardname:orange:wifi"
        ;;
index 76e1d56bd3b254ea4d28edc8d4b47db4fa739203..d870b5c11c41434ef6c7ebc12bf479adaf460fac 100755 (executable)
@@ -100,6 +100,10 @@ ramips_setup_interfaces()
                ucidef_add_switch "switch0" \
                        "1:lan:2" "2:lan:1" "3:lan:3" "4:lan" "0:wan" "6@eth0"
                ;;
+       dlink,dwr-960)
+               ucidef_add_switch "switch0" \
+                       "1:lan" "2:lan" "3:lan" "5:lan" "0:wan" "6@eth0"
+               ;;
        edimax,br-6478ac-v2|\
        tplink,archer-c2-v1)
                ucidef_add_switch "switch1" \
@@ -273,6 +277,7 @@ ramips_setup_macs()
        dlink,dwr-118-a2|\
        dlink,dwr-921-c1|\
        dlink,dwr-922-e2|\
+       dlink,dwr-960|\
        lava,lr-25g001)
                wan_mac=$(jboot_config_read -m -i $(find_mtd_part "config") -o 0xE000)
                lan_mac=$(macaddr_add "$wan_mac" 1)
index 85380d84a8eccf7e45b1baef9950e011716c4423..f2355fdb978ca15f45698a82fb44c6f4a85282e5 100755 (executable)
@@ -11,6 +11,9 @@ dlink,dir-510l)
        ucidef_add_gpio_switch "usb_enable1" "USB 1A enable" "12" "0"
        ucidef_add_gpio_switch "usb_enable05" "USB 0.5A enable" "13" "1"
        ;;
+dlink,dwr-960)
+       ucidef_add_gpio_switch "power_mpcie" "mPCIe power" "0" "1"
+       ;;
 head-weblink,hdrm200)
        ucidef_add_gpio_switch "sim_switch" "SIM slot switch" "0"
        ucidef_add_gpio_switch "io1" "I/O 1" "1"
index f33ed82f625cce9f8aae6471ccc8a0c7b549149d..291f89f41df27809cce9aafd4e2604f8893b4403 100644 (file)
@@ -28,6 +28,7 @@ case "$FIRMWARE" in
        dlink,dwr-118-a2|\
        dlink,dwr-921-c1|\
        dlink,dwr-922-e2|\
+       dlink,dwr-960|\
        lava,lr-25g001)
                wan_mac=$(jboot_config_read -m -i $(find_mtd_part "config") -o 0xE000)
                wifi_mac=$(macaddr_add "$wan_mac" 1)