From: Giuseppe Lippolis Date: Sun, 13 Nov 2016 22:36:00 +0000 (+0100) Subject: ramips: Add device DLINK DWR-512-B X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=ec1de9b1a6cd957bb2cb68f7eda294ab73bf9102;p=openwrt%2Fstaging%2Fansuel.git 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 --- diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh index 1aa1a2e9fb..a7b8ae0b06 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 5c82188406..3793e5824f 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 7c63c1cf3b..3c1fb4168c 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 0000000000..ab3c02aeb3 --- /dev/null +++ b/target/linux/ramips/dts/DWR-512-B.dts @@ -0,0 +1,128 @@ +/dts-v1/; + +#include "rt5350.dtsi" + +#include +#include + +/ { + 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 = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + 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>; +}; + +ðernet { + 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 8f2157cca2..fed600d1e1 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