ramips: add support for DLINK DWR-922-E2
authorSimon Quigley <squigley@squigley.net>
Thu, 20 Dec 2018 16:47:52 +0000 (11:47 -0500)
committerMathias Kresin <dev@kresin.me>
Sat, 29 Dec 2018 15:03:30 +0000 (16:03 +0100)
Very similar to the DWR-921-C1, except has a telephony/RJ11 port (not
sure if supported, I didn't try), wireless router with QMI LTE embedded
modem is based on the MT7620N SoC.

Specification:

  * MediaTek MT7620N (580 Mhz)
  * 64 MB of RAM
  * 16 MB of FLASH
  * 802.11bgn radio
  * 5x 10/100 Mbps Ethernet (1 WAN and 4 LAN)
  * 2x external, detachable (LTE) antennas
  * UART header on PCB (57600 8n1)
  * 6x LED (GPIO-controlled)
  * 1x bi-color Signal Strength LED (GPIO-controlled)
  * 2x button
  * JBOOT bootloader

The status led has been assigned to the dwr-922-e2:green:signalstrength
(lte signal strength) led. At the end of the boot it is switched off and
is available for lte operation. Works correctly also during sysupgrade
operation.

Installation:
Apply factory image via d-link http web-gui, or via recovery interface:

How to recover/revert to OEM firmware:
1.) Push and hold the reset button and turn on the power. Wait until all
    LEDs start rapidly blinking (~10sec.)
2.) DHCP should give you an IP in the 192.168.123.0/24 subnet, or set
    one manually
3.) Upload original factory image via JBOOT http interface at IP
    192.168.123.254
4.) If http doesn't work, it can be done with curl command:
      curl -F FN=@XXXXX.bin http://192.168.123.254/upg
    where XXXXX.bin is name of firmware file.
5.) You can optionally telnet to 192.168.123.254 before or during the
    upload and it will report the flashing status, memory address etc.
6.) Once web UI and/or telnet says "Success", power cycle the router, or
    type "reboot" into the telnet session.

Signed-off-by: Simon Quigley <squigley@squigley.net>
[squashed commits, word wrap commit message, rename signal strenght led
name to match what is used for the DWR-921-C1 since they share the led
configuration, add label referenced in the aliases node]
Signed-off-by: Mathias Kresin <dev@kresin.me>
target/linux/ramips/base-files/etc/board.d/01_leds
target/linux/ramips/base-files/etc/board.d/02_network
target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
target/linux/ramips/dts/DWR-922-E2.dts [new file with mode: 0644]
target/linux/ramips/image/mt7620.mk

index 2e62073d3f4b1be1c8ffcf62b84be967d4db5055..35a28174cc547f2c1ba80214d83a5180fe9d6a5b 100755 (executable)
@@ -124,9 +124,12 @@ dlink,dwr-118-a2)
        ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01"
        set_wifi_led "$boardname:green:wlan2g" "wlan1"
        ;;
-dlink,dwr-921-c1)
+dlink,dwr-921-c1|\
+dlink,dwr-922-e2)
        set_wifi_led "$boardname:green:wifi"
        ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x0f"
+       ucidef_set_led_netdev "signalstrength" "signalstrength" "$boardname:green:sigstrength" "wwan0" "link"
+       ucidef_set_led_netdev "4g" "4g" "$boardname:green:4g" "wwan0" "tx rx"
        ;;
 dir-860l-b1)
        ucidef_set_led_netdev "wan" "wan" "$boardname:green:net" "eth0.2"
index 797490aed4b3d824dcc9b48f2a0e942c63216e61..f958ac2bd081f0193b7c05153f6098fc770347b4 100755 (executable)
@@ -90,6 +90,7 @@ ramips_setup_interfaces()
        dir-810l|\
        dlink,dwr-116-a1|\
        dlink,dwr-921-c1|\
+       dlink,dwr-922-e2|\
        ew1200|\
        firewrt|\
        hc5661a|\
@@ -488,6 +489,7 @@ ramips_setup_macs()
        dlink,dwr-118-a1|\
        dlink,dwr-118-a2|\
        dlink,dwr-921-c1|\
+       dlink,dwr-922-e2|\
        lava,lr-25g001)
                wan_mac=$(jboot_config_read -m -i $(find_mtd_part "config") -o 0xE000)
                lan_mac=$(macaddr_add "$wan_mac" 1)
index 1d9de2d503724ffdd35cde9438e3a33167bb70e2..13a4687251e1eb39c56fc8985ead145614176b46 100644 (file)
@@ -58,6 +58,7 @@ case "$FIRMWARE" in
        dlink,dwr-118-a1|\
        dlink,dwr-118-a2|\
        dlink,dwr-921-c1|\
+       dlink,dwr-922-e2|\
        lava,lr-25g001)
                wan_mac=$(jboot_config_read -m -i $(find_mtd_part "config") -o 0xE000)
                wifi_mac=$(macaddr_add "$wan_mac" 1)
diff --git a/target/linux/ramips/dts/DWR-922-E2.dts b/target/linux/ramips/dts/DWR-922-E2.dts
new file mode 100644 (file)
index 0000000..c2dd26a
--- /dev/null
@@ -0,0 +1,154 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "mt7620n.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+       compatible = "dlink,dwr-922-e2", "ralink,mt7620n-soc";
+       model = "D-Link DWR-922 E2";
+
+       aliases {
+               led-boot = &sstrengthg;
+               led-failsafe = &sstrengthg;
+       };
+
+       keys {
+               compatible = "gpio-keys-polled";
+               poll-interval = <20>;
+
+               wps {
+                       label = "wps";
+                       gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_WPS_BUTTON>;
+               };
+
+               reset {
+                       label = "reset";
+                       gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_RESTART>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               led-boot = &sstrengthg;
+
+               sms {
+                       label = "dwr-922-e2:green:sms";
+                       gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
+               };
+
+               lan {
+                       label = "dwr-922-e2:green:lan";
+                       gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
+               };
+
+               sstrengthg: sstrengthg {
+                       label = "dwr-922-e2:green:sigstrength";
+                       gpios = <&gpio2 0 GPIO_ACTIVE_LOW>;
+               };
+
+               sstrengthr {
+                       label = "dwr-922-e2:red:sigstrength";
+                       gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
+               };
+
+               4g {
+                       label = "dwr-922-e2:green:4g";
+                       gpios = <&gpio2 2 GPIO_ACTIVE_LOW>;
+               };
+
+               3g {
+                       label = "dwr-922-e2:green:3g";
+                       gpios = <&gpio2 3 GPIO_ACTIVE_LOW>;
+               };
+
+               wifi {
+                       label = "dwr-922-e2:green:wifi";
+                       gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio_export {
+               compatible = "gpio-export";
+               #size-cells = <0>;
+
+               lte_modem_enable {
+                       gpio-export,name = "lte_modem_enable";
+                       gpio-export,output = <1>;
+                       gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
+               };
+       };
+};
+
+&gpio1 {
+       status = "okay";
+};
+
+&gpio2 {
+       status = "okay";
+};
+
+&gpio3 {
+       status = "okay";
+};
+
+&spi0 {
+       status = "okay";
+
+       flash@0 {
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <10000000>;
+
+               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";
+};
+
+&ethernet {
+       port@4 {
+               status = "okay";
+       };
+};
+
+&pinctrl {
+       state_default: pinctrl0 {
+               default {
+                       ralink,group = "spi refclk", "i2c", "ephy", "wled";
+                       ralink,function = "gpio";
+               };
+       };
+};
index 2f733b2ed91d9bd42cc8774028f36fbb3dc62830..6b65856281e18530689837b3d3a5527dff201fce 100644 (file)
@@ -228,6 +228,22 @@ define Device/dlink_dwr-921-c3
 endef
 TARGET_DEVICES += dlink_dwr-921-c3
 
+define Device/dlink_dwr-922-e2
+  DTS := DWR-922-E2
+  IMAGE_SIZE := $(ralink_default_fw_size_16M)
+  DEVICE_TITLE := D-Link DWR-922 E2
+  DLINK_ROM_ID := DLK6E2414005
+  DLINK_FAMILY_MEMBER := 0x6E24
+  DLINK_FIRMWARE_SIZE := 0xFE0000
+  KERNEL := $(KERNEL_DTB)
+  IMAGES += factory.bin
+  IMAGE/sysupgrade.bin := mkdlinkfw | pad-rootfs | append-metadata
+  IMAGE/factory.bin := mkdlinkfw | pad-rootfs | mkdlinkfw-factory
+  DEVICE_PACKAGES := jboot-tools \
+       kmod-usb2 kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi
+endef
+TARGET_DEVICES += dlink_dwr-922-e2
+
 define Device/e1700
   DTS := E1700
   IMAGES += factory.bin