[source] ramips: Add support to TP-Link Archer MR200
LEDE Commits
lede-commits at lists.infradead.org
Thu Dec 22 07:06:02 PST 2016
blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/c8043137bbd323b1490ae8613eab915ba9c138ee
commit c8043137bbd323b1490ae8613eab915ba9c138ee
Author: Henryk Heisig <hyniu at o2.pl>
AuthorDate: Sat Sep 24 21:41:43 2016 +0200
ramips: Add support to TP-Link Archer MR200
CPU: MT7620N 580MHz
Flash: 8MB
RAM: 64MB
build-in modem 3G/4G
four ethernet port 10/100Mbps
Signed-off-by: Henryk Heisig <hyniu at o2.pl>
---
target/linux/ramips/base-files/etc/board.d/01_leds | 6 +
.../linux/ramips/base-files/etc/board.d/02_network | 5 +
target/linux/ramips/base-files/etc/diag.sh | 3 +
.../linux/ramips/base-files/etc/init.d/enablemodem | 16 ++
target/linux/ramips/base-files/lib/ramips.sh | 3 +
.../ramips/base-files/lib/upgrade/platform.sh | 3 +-
target/linux/ramips/dts/ArcherMR200.dts | 195 +++++++++++++++++++++
target/linux/ramips/image/mt7620.mk | 10 ++
tools/firmware-utils/src/mktplinkfw2.c | 13 ++
9 files changed, 253 insertions(+), 1 deletion(-)
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 4a7b9f6..bcb1df1 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -242,6 +242,12 @@ mr-102n)
set_wifi_led "$board:green:wlan"
set_usb_led "$board:green:usb"
;;
+mr200)
+ ucidef_set_led_default "power" "power" "$board:white:power" "1"
+ ucidef_set_led_netdev "lan" "lan" "$board:white:lan" "eth0.1"
+ ucidef_set_led_netdev "wan" "wan" "$board:white:wan" "usb0"
+ set_wifi_led "$board:white:wlan"
+ ;;
mzk-ex750np)
ucidef_set_led_default "power" "power" "$board:red:power" "1"
set_wifi_led "$board:red: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 63bf123..94cf0ec 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -217,6 +217,11 @@ ramips_setup_interfaces()
wl-330n)
ucidef_set_interface_lan "eth0.1"
;;
+ mr200)
+ ucidef_add_switch "switch0" \
+ "0:lan" "1:lan" "2:lan" "3:lan" "6t at eth0"
+ ucidef_set_interface_wan "usb0"
+ ;;
mzk-dp150n|\
vocore)
ucidef_add_switch "switch0" \
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index 0b0b8d9..c4b7538 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -164,6 +164,9 @@ get_status_led() {
mr-102n)
status_led="$board:amber:status"
;;
+ mr200)
+ status_led="$board:white:power"
+ ;;
nw718)
status_led="$board:amber:cpu"
;;
diff --git a/target/linux/ramips/base-files/etc/init.d/enablemodem b/target/linux/ramips/base-files/etc/init.d/enablemodem
new file mode 100755
index 0000000..a7e6c2e
--- /dev/null
+++ b/target/linux/ramips/base-files/etc/init.d/enablemodem
@@ -0,0 +1,16 @@
+#!/bin/sh /etc/rc.common
+. /lib/ramips.sh
+
+START=99
+
+start() {
+ local board=$(ramips_board_name)
+ if [ $board = "mr200" ]; then
+ adb wait-for-device
+ adb shell chmod +x /WEBSERVER/www/cgi-bin/*
+ adb shell httpd -h /WEBSERVER/www/ &
+ echo "2357 000d" > /sys/bus/usb-serial/drivers/option1/new_id
+ sleep 2
+ adb kill-server
+ fi
+}
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index cc6f00f..50903c7 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -295,6 +295,9 @@ ramips_board_detect() {
*"MR-102N")
name="mr-102n"
;;
+ *"MR200")
+ name="mr200"
+ ;;
*"MT7620a + MT7530 evaluation"*)
name="mt7620a_mt7530"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 2151cf9..78e87a0 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -204,7 +204,8 @@ platform_check_image() {
return 0
;;
c20i|\
- c50)
+ c50|\
+ mr200)
[ "$magic" != "03000000" ] && {
echo "Invalid image type."
return 1
diff --git a/target/linux/ramips/dts/ArcherMR200.dts b/target/linux/ramips/dts/ArcherMR200.dts
new file mode 100644
index 0000000..93fb048
--- /dev/null
+++ b/target/linux/ramips/dts/ArcherMR200.dts
@@ -0,0 +1,195 @@
+/dts-v1/;
+
+#include "mt7620a.dtsi"
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+ compatible = "ralink,mt7620a-soc";
+ model = "TP-Link Archer MR200";
+
+ chosen {
+ bootargs = "console=ttyS0,115200";
+ };
+
+ gpio-leds {
+ compatible = "gpio-leds";
+
+ lan {
+ label = "mr200:white:lan";
+ gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
+ };
+
+ wan {
+ label = "mr200:white:wan";
+ gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
+ };
+
+ power {
+ label = "mr200:white:power";
+ gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
+ };
+
+ 4g {
+ label = "mr200:white:4g";
+ gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
+ };
+
+ wps {
+ label = "mr200:white:wps";
+ gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
+ };
+
+ signal1 {
+ label = "mr200:white:signal1";
+ gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
+ };
+
+ signal2 {
+ label = "mr200:white:signal2";
+ gpios = <&gpio2 2 GPIO_ACTIVE_LOW>;
+ };
+
+ signal3 {
+ label = "mr200:white:signal3";
+ gpios = <&gpio2 3 GPIO_ACTIVE_LOW>;
+ };
+
+ signal4 {
+ label = "mr200:white:signal4";
+ gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
+ };
+
+ wlan {
+ label = "mr200:white:wlan";
+ gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ gpio-keys {
+ compatible = "gpio-keys";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ reset {
+ label = "reset";
+ gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
+ linux,code = <KEY_RESTART>;
+ };
+
+ rfkill {
+ label = "rfkill";
+ gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>;
+ linux,code = <KEY_RFKILL>;
+ };
+ };
+
+ gpio_export {
+ compatible = "gpio-export";
+ #size-cells = <0>;
+
+ power_usb {
+ gpio-export,name = "power_usb1";
+ gpio-export,output = <1>;
+ gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+};
+
+&gpio1 {
+ status = "okay";
+};
+
+&gpio2 {
+ status = "okay";
+};
+
+&gpio3 {
+ status = "okay";
+};
+
+&spi0 {
+ status = "okay";
+
+ m25p80 at 0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ linux,modalias = "m25p80", "mx25l6405d";
+ spi-max-frequency = <10000000>;
+
+ partition at 0 {
+ label = "u-boot";
+ reg = <0x0 0x20000>;
+ read-only;
+ };
+
+ partition at 20000 {
+ label = "firmware";
+ reg = <0x20000 0x7b0000>;
+ };
+
+ rom: partition at 7d0000 {
+ label = "rom";
+ reg = <0x7d0000 0x10000>;
+ read-only;
+ };
+
+ partition at 7e0000 {
+ label = "romfile";
+ reg = <0x7e0000 0x10000>;
+ read-only;
+ };
+
+ radio: partition at 7f0000 {
+ label = "radio";
+ reg = <0x7f0000 0x10000>;
+ read-only;
+ };
+ };
+};
+
+&pinctrl {
+ state_default: pinctrl0 {
+ gpio {
+ ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "wled", "nd_sd", "ephy", "spi refclk";
+ ralink,function = "gpio";
+ };
+ };
+};
+
+ðernet {
+ mtd-mac-address = <&rom 0xf100>;
+ mediatek,portmap = "llll";
+ };
+
+&ehci {
+ status = "okay";
+};
+
+&ohci {
+ status = "okay";
+};
+
+&gsw {
+ mediatek,port4 = "ephy";
+};
+
+&wmac {
+ ralink,mtd-eeprom = <&radio 0>;
+};
+
+&pcie {
+ status = "okay";
+
+ pcie-bridge {
+ mt76 at 0,0 {
+ reg = <0x0000 0 0 0 0>;
+ device_type = "pci";
+ mediatek,mtd-eeprom = <&radio 32768>;
+ mediatek,2ghz = <0>;
+ };
+ };
+};
diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index 0bd6c9d..d0e89b6 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -59,6 +59,16 @@ define Device/ArcherC50
endef
TARGET_DEVICES += ArcherC50
+define Device/ArcherMR200
+ DTS := ArcherMR200
+ KERNEL := $(KERNEL_DTB)
+ KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-header ArcherMR200 -c
+ IMAGE/sysupgrade.bin := append-kernel | tplink-header ArcherMR200 -j -r $(KDIR)/root.squashfs
+ DEVICE_PACKAGES := kmod-usb2 kmod-usb-net kmod-usb-net-rndis kmod-usb-serial kmod-usb-serial-option adb
+ DEVICE_TITLE := TP-Link ArcherMR200
+endef
+TARGET_DEVICES += ArcherMR200
+
define Device/ex2700
DTS := EX2700
BLOCKSIZE := 4k
diff --git a/tools/firmware-utils/src/mktplinkfw2.c b/tools/firmware-utils/src/mktplinkfw2.c
index 213e672..3ab5c52 100644
--- a/tools/firmware-utils/src/mktplinkfw2.c
+++ b/tools/firmware-utils/src/mktplinkfw2.c
@@ -156,6 +156,12 @@ static struct flash_layout layouts[] = {
.kernel_ep = 0x80000000,
.rootfs_ofs = 0x140000,
}, {
+ .id = "8MLmtk",
+ .fw_max_len = 0x7b0000,
+ .kernel_la = 0x80000000,
+ .kernel_ep = 0x80000000,
+ .rootfs_ofs = 0x140000,
+ }, {
/* terminating entry */
}
};
@@ -192,6 +198,13 @@ static struct board_info boards[] = {
.hdr_ver = 3,
.endian_swap = true,
}, {
+ .id = "ArcherMR200",
+ .hw_id = 0xd7500001,
+ .hw_rev = 0x4a,
+ .layout_id = "8MLmtk",
+ .hdr_ver = 3,
+ .endian_swap = true,
+ }, {
/* terminating entry */
}
};
More information about the lede-commits
mailing list