[LEDE-DEV] [PATCH] ramips: Add support for Sanlinking D240
Kristian Evensen
kristian.evensen at gmail.com
Thu Feb 2 03:54:27 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.
Signed-off-by: Kristian Evensen <kristian.evensen at gmail.com>
---
target/linux/ramips/base-files/etc/board.d/01_leds | 5 +
.../linux/ramips/base-files/etc/board.d/02_network | 1 +
target/linux/ramips/base-files/etc/diag.sh | 3 +
target/linux/ramips/base-files/lib/ramips.sh | 3 +
.../ramips/base-files/lib/upgrade/platform.sh | 1 +
target/linux/ramips/dts/SANLINKING-D240.dts | 124 +++++++++++++++++++++
target/linux/ramips/image/mt7620.mk | 8 ++
7 files changed, 145 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..1238a50 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,11 @@ rt-n14u)
set_wifi_led "$board:blue:air"
set_usb_led "$board:blue:usb"
;;
+sanlinking-d240)
+ ucidef_set_led_default "power" "power" "$board:blue:power" "1"
+ 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..83a9353 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -247,6 +247,9 @@ get_status_led() {
zbt-cpe102)
status_led="$board:green:4g-0"
;;
+ sanlinking-d240)
+ status_led="$board:blue:wifi"
+ ;;
esac
}
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..522b36d
--- /dev/null
+++ b/target/linux/ramips/dts/SANLINKING-D240.dts
@@ -0,0 +1,124 @@
+/dts-v1/;
+
+#include "mt7620a.dtsi"
+
+#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 0>;
+ };
+ usb {
+ label = "sanlinking-d240:blue:usb";
+ gpios = <&gpio1 15 0>;
+ };
+ air {
+ label = "sanlinking-d240:blue:wifi";
+ gpios = <&gpio3 0 1>;
+ };
+ };
+
+ gpio-keys-polled {
+ compatible = "gpio-keys-polled";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ poll-interval = <20>;
+ reset {
+ label = "reset";
+ gpios = <&gpio0 1 1>;
+ linux,code = <KEY_RESTART>;
+ };
+ };
+};
+
+&gpio0 {
+ status = "okay";
+};
+
+&gpio1 {
+ status = "okay";
+};
+
+&gpio3 {
+ status = "okay";
+};
+
+&spi0 {
+ status = "okay";
+
+ en25q128 at 0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "w25q128";
+ reg = <0>;
+ linux,modalias = "m25p80";
+ 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";
+};
+
+ðernet {
+ 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