[source] ramips: Add device DLINK DWR-512-B

LEDE Commits lede-commits at lists.infradead.org
Wed Nov 23 01:19:10 PST 2016


mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/ec1de9b1a6cd957bb2cb68f7eda294ab73bf9102

commit ec1de9b1a6cd957bb2cb68f7eda294ab73bf9102
Author: Giuseppe Lippolis <giu.lippolis at gmail.com>
AuthorDate: Sun Nov 13 23:36:00 2016 +0100

    ramips: Add device DLINK DWR-512-B
    
    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 at gmail.com>
---
 target/linux/ramips/base-files/etc/diag.sh         |   1 +
 target/linux/ramips/base-files/lib/ramips.sh       |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh      |   1 +
 target/linux/ramips/dts/DWR-512-B.dts              | 128 +++++++++++++++++++++
 target/linux/ramips/image/rt305x.mk                |   9 ++
 5 files changed, 142 insertions(+)

diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index 1aa1a2e..a7b8ae0 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -67,6 +67,7 @@ get_status_led() {
 	dir-615-h1|\
 	dir-620-a1|\
 	dir-620-d1|\
+	dwr-512-b|\
 	hpm|\
 	hw550-3g|\
 	mac1200rv2|\
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index 5c82188..3793e58 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -166,6 +166,9 @@ ramips_board_detect() {
 	*"DuZun DM06")
 		name="duzun-dm06"
 		;;
+	*"DWR-512 B")
+		name="dwr-512-b"
+		;;
 	*"E1700")
 		name="e1700"
 		;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 7c63c1c..3c1fb41 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -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
index 0000000..ab3c02a
--- /dev/null
+++ b/target/linux/ramips/dts/DWR-512-B.dts
@@ -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 at 0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <30000000>;
+		m25p,fast-read;
+
+		partition at 0 {
+			label = "u-boot";
+			reg = <0x0 0x30000>;
+			read-only;
+		};
+
+		partition at 30000 {
+			label = "u-boot-env";
+			reg = <0x30000 0x20000>;
+			read-only;
+		};
+
+		partition at 50000 {
+			label = "firmware";
+			reg = <0x50000 0x7a0000>;
+		};
+
+		config: partition at 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>;
+};
diff --git a/target/linux/ramips/image/rt305x.mk b/target/linux/ramips/image/rt305x.mk
index 8f2157c..fed600d 100644
--- a/target/linux/ramips/image/rt305x.mk
+++ b/target/linux/ramips/image/rt305x.mk
@@ -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



More information about the lede-commits mailing list