ramips: Add device DLINK DWR-512-B
authorGiuseppe Lippolis <giu.lippolis@gmail.com>
Sun, 13 Nov 2016 22:36:00 +0000 (23:36 +0100)
committerMathias Kresin <dev@kresin.me>
Wed, 23 Nov 2016 07:36:11 +0000 (08:36 +0100)
The Dlink DWR-512-B modem is a ralink 5350 processor based embedding
a 3G mini-pcie router.

The oem JBOOT bootloader has to be replaced by a RT5350 SDK
U-Boot such as https://github.com/stevenylai/ralink_sdk - U-Boot
configured for the RT5350 256MiB SDR.

Main reason to change the bootloader is the encrypted header used to
store the kernel image. In this way an image can only be generated
using the propietary binboy tool (included in the GPL distribution
from Dlink). The binboy tool doesn't allow to modify the kernel/rootfs
partition scheme. This is considered a big constraint (limited kernel
size and inefficient usage of flash space).

For interested people I pubblished the details of my investigation
about the encrypted firmware header here:
http://lists.infradead.org/pipermail/lede-dev/2016-October/003435.html

Signed-off-by: Giuseppe Lippolis <giu.lippolis@gmail.com>
target/linux/ramips/base-files/etc/diag.sh
target/linux/ramips/base-files/lib/ramips.sh
target/linux/ramips/base-files/lib/upgrade/platform.sh
target/linux/ramips/dts/DWR-512-B.dts [new file with mode: 0644]
target/linux/ramips/image/rt305x.mk

index 1aa1a2e9fb057c27b3825e35d65544eecca73f43..a7b8ae0b06480d5320a6c276ef6bc9f75a4325a9 100644 (file)
@@ -67,6 +67,7 @@ get_status_led() {
        dir-615-h1|\
        dir-620-a1|\
        dir-620-d1|\
+       dwr-512-b|\
        hpm|\
        hw550-3g|\
        mac1200rv2|\
index 5c821884065d1949c61f2ad526de6742c0734a3d..3793e5824ffd32a9113d3c0e101f6915ae144492 100755 (executable)
@@ -166,6 +166,9 @@ ramips_board_detect() {
        *"DuZun DM06")
                name="duzun-dm06"
                ;;
+       *"DWR-512 B")
+               name="dwr-512-b"
+               ;;
        *"E1700")
                name="e1700"
                ;;
index 7c63c1cf3b10379b0215e6331dc974ff5f33a5fb..3c1fb4168cd23fb21bdf7d4b288c3427a53d6a38 100755 (executable)
@@ -50,6 +50,7 @@ platform_check_image() {
        dir-620-d1|\
        dir-810l|\
        duzun-dm06|\
+       dwr-512-b|\
        e1700|\
        esr-9753|\
        ex2700|\
diff --git a/target/linux/ramips/dts/DWR-512-B.dts b/target/linux/ramips/dts/DWR-512-B.dts
new file mode 100644 (file)
index 0000000..ab3c02a
--- /dev/null
@@ -0,0 +1,128 @@
+/dts-v1/;
+
+#include "rt5350.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+       compatible = "ralink,rt5350-soc";
+       model = "D-Link DWR-512 B";
+
+       gpio-keys-polled {
+               compatible = "gpio-keys-polled";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               poll-interval = <20>;
+
+               wps {
+                       label = "wps";
+                       gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_WPS_BUTTON>;
+               };
+
+               reset {
+                       label = "reset";
+                       gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_RESTART>;
+               };
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+
+               sms {
+                       label = "dwr-512-b:green:sms";
+                       gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
+               };
+               status {
+                       label = "dwr-512-b:green:status";
+                       gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
+               };
+               2g {
+                       label = "dwr-512-b:green:2g";
+                       gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;
+               };
+               3g {
+                       label = "dwr-512-b:green:3g";
+                       gpios = <&gpio0 19 GPIO_ACTIVE_LOW>;
+               };
+               sstrengthr {
+                       label = "dwr-512-b:red:sigstrength";
+                       gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
+               };
+               sstrengthg {
+                       label = "dwr-512-b:green:sigstrength";
+                       gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio-export {
+               compatible = "gpio-export";
+               #size-cells = <0>;
+
+               modem3g_enable {
+                       gpio-export,name = "modem3g_enable";
+                       gpio-export,output = <1>;
+                       gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
+               };
+       };
+};
+
+&spi0 {
+       status = "okay";
+
+       mx25l6405d@0 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <30000000>;
+               m25p,fast-read;
+
+               partition@0 {
+                       label = "u-boot";
+                       reg = <0x0 0x30000>;
+                       read-only;
+               };
+
+               partition@30000 {
+                       label = "u-boot-env";
+                       reg = <0x30000 0x20000>;
+                       read-only;
+               };
+
+               partition@50000 {
+                       label = "firmware";
+                       reg = <0x50000 0x7a0000>;
+               };
+
+               config: partition@7f0000 {
+                       label = "config";
+                       reg = <0x7f0000 0x10000>;
+               };
+       };
+};
+
+&pinctrl {
+       state_default: pinctrl0 {
+               gpio {
+                       ralink,group = "i2c", "jtag", "uartf";
+                       ralink,function = "gpio";
+               };
+       };
+};
+
+&esw {
+       mediatek,portmap = <0x2f>;
+};
+
+&ethernet {
+       mtd-mac-address = <&config 0xe07e>;
+};
+
+&wmac {
+       ralink,mtd-eeprom = <&config 0xe08a>;
+       ralink,led-polarity = <1>;
+       mtd-mac-address = <&config 0xe07e>;
+};
index 8f2157cca2f616aeeef22095ef13798727629da3..fed600d1e164305686ad133a26fcb33683e53c42 100644 (file)
@@ -174,6 +174,15 @@ endef
 TARGET_DEVICES += dir-620-d1
 
 
+define Device/dwr-512-b
+  DTS := DWR-512-B
+  DEVICE_TITLE := D-Link DWR-512 B
+  DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-i2c-core kmod-i2c-ralink kmod-spi-dev \
+                       kmod-usb-serial kmod-usb-serial-option kmod-usb-serial-wwan comgt
+endef
+TARGET_DEVICES += dwr-512-b
+
+
 define Device/esr-9753
   DTS := ESR-9753
   BLOCKSIZE := 64k