[LEDE-DEV] [PATCH v2] ramips: Add support for Sanlinking D240

Kristian Evensen kristian.evensen at gmail.com
Fri Feb 3 00:54:04 PST 2017


The Sanlinking Technologies D240
(http://www.sanlinking.com/en/29-dual-4g-wifi-router.html) is basically the same
device as the ZBT WE826, so adding support for it in LEDE is straight forward.
The differences is that the D240 has two mini-PCIe slots (instead of one), blue
LEDs and supports PoE.

Wifi, USB, switch and both mini-PCIe slots are working. I have not been able to
test the SD card reader on the device.

v1->v2:

* Misc. code cleanup (thanks Mathias Kresin)

Signed-off-by: Kristian Evensen <kristian.evensen at gmail.com>

Cleanup
---
 target/linux/ramips/base-files/etc/board.d/01_leds |   4 +
 .../linux/ramips/base-files/etc/board.d/02_network |   1 +
 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/SANLINKING-D240.dts        | 120 +++++++++++++++++++++
 target/linux/ramips/image/mt7620.mk                |   8 ++
 7 files changed, 138 insertions(+)
 create mode 100644 target/linux/ramips/dts/SANLINKING-D240.dts

diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds
index 545d6a4..409854f 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -300,6 +300,10 @@ rt-n14u)
 	set_wifi_led "$board:blue:air"
 	set_usb_led "$board:blue:usb"
 	;;
+sanlinking-d240)
+	set_wifi_led "$board:blue:wifi"
+	set_usb_led "$board:blue:usb"
+	;;
 tew-714tru)
 	set_usb_led "$board:red:usb"
 	set_wifi_led "$board:green:wifi"
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index c001dfe..bf2edf0 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -92,6 +92,7 @@ ramips_setup_interfaces()
 	pbr-m1|\
 	psg1208|\
 	psg1218|\
+	sanlinking-d240|\
 	sap-g3200u3|\
 	sk-wb8|\
 	vr500|\
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index 5fb2213..b92d871 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -115,6 +115,7 @@ get_status_led() {
 	rt-n14u|\
 	rt-n15|\
 	rt-n56u|\
+	sanlinking-d240|\
 	wl-330n|\
 	wl-330n3g|\
 	wli-tx4-ag300n|\
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index d9918cc..dc86a82 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -442,6 +442,9 @@ ramips_board_detect() {
 	*"SamKnows Whitebox 8")
 		name="sk-wb8"
 		;;
+	*"SANLINKING-D240")
+		name="sanlinking-d240"
+		;;
 	*"SAP-G3200U3")
 		name="sap-g3200u3"
 		;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index d83e5c1..afc6014 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -123,6 +123,7 @@ platform_check_image() {
 	rt-n15|\
 	rt-n56u|\
 	rut5xx|\
+	sanlinking-d240|\
 	sap-g3200u3|\
 	sk-wb8|\
 	sl-r7205|\
diff --git a/target/linux/ramips/dts/SANLINKING-D240.dts b/target/linux/ramips/dts/SANLINKING-D240.dts
new file mode 100644
index 0000000..888f5aa
--- /dev/null
+++ b/target/linux/ramips/dts/SANLINKING-D240.dts
@@ -0,0 +1,120 @@
+/dts-v1/;
+
+#include "mt7620a.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+	compatible = "sanlinking,sanlinking-d240", "ralink,mt7620a-soc";
+	model = "SANLINKING-D240";
+
+	chosen {
+		bootargs = "console=ttyS0,115200";
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+		power {
+			label = "sanlinking-d240:blue:power";
+			gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
+		};
+		usb {
+			label = "sanlinking-d240:blue:usb";
+			gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
+		};
+		air {
+			label = "sanlinking-d240:blue:wifi";
+			gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		poll-interval = <20>;
+		reset {
+			label = "reset";
+			gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+	};
+};
+
+&gpio1 {
+	status = "okay";
+};
+
+&gpio3 {
+	status = "okay";
+};
+
+&spi0 {
+	status = "okay";
+
+	en25q128 at 0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <10000000>;
+
+		partition at 0 {
+			label = "u-boot";
+			reg = <0x0 0x30000>;
+			read-only;
+		};
+
+		partition at 30000 {
+			label = "u-boot-env";
+			reg = <0x30000 0x10000>;
+			read-only;
+		};
+
+		factory: partition at 40000 {
+			label = "factory";
+			reg = <0x40000 0x10000>;
+			read-only;
+		};
+
+		partition at 50000 {
+			label = "firmware";
+			reg = <0x50000 0xfb0000>;
+		};
+	};
+};
+
+&sdhci {
+	status = "okay";
+};
+
+&ehci {
+	status = "okay";
+};
+
+&ohci {
+	status = "okay";
+};
+
+&ethernet {
+	mtd-mac-address = <&factory 0x4>;
+	ralink,port-map = "wllll";
+};
+
+&wmac {
+	ralink,mtd-eeprom = <&factory 0>;
+};
+
+&pinctrl {
+	state_default: pinctrl0 {
+		default {
+			ralink,group = "i2c", "uartf", "wled", "spi refclk", "pa";
+			ralink,function = "gpio";
+		};
+	};
+};
+
+&pcie {
+	status = "okay";
+};
diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index 50eae2f..416c09e 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -465,3 +465,11 @@ define Device/kng_rc
 	zyimage -d 8997 -v "ZyXEL Keenetic Viva"
 endef
 TARGET_DEVICES += kng_rc
+
+define Device/sanlinking-d240
+  DTS := SANLINKING-D240
+  IMAGE_SIZE := $(ralink_default_fw_size_16M)
+  DEVICE_TITLE := Sanlinking Technologies D240
+  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-mt76 kmod-sdhci-mt7620
+endef
+TARGET_DEVICES += sanlinking-d240
-- 
2.9.3




More information about the Lede-dev mailing list