ramips: Add support to TP-Link Archer MR200
authorHenryk Heisig <hyniu@o2.pl>
Sat, 24 Sep 2016 19:41:43 +0000 (21:41 +0200)
committerJohn Crispin <john@phrozen.org>
Thu, 22 Dec 2016 14:03:30 +0000 (15:03 +0100)
CPU: MT7620N 580MHz
Flash: 8MB
RAM: 64MB
build-in modem 3G/4G
four ethernet port 10/100Mbps

Signed-off-by: Henryk Heisig <hyniu@o2.pl>
target/linux/ramips/base-files/etc/board.d/01_leds
target/linux/ramips/base-files/etc/board.d/02_network
target/linux/ramips/base-files/etc/diag.sh
target/linux/ramips/base-files/etc/init.d/enablemodem [new file with mode: 0755]
target/linux/ramips/base-files/lib/ramips.sh
target/linux/ramips/base-files/lib/upgrade/platform.sh
target/linux/ramips/dts/ArcherMR200.dts [new file with mode: 0644]
target/linux/ramips/image/mt7620.mk
tools/firmware-utils/src/mktplinkfw2.c

index 4a7b9f69c7d1b40dc38acb84429f07bbd9683235..bcb1df1050bd7f56cad9eecfc8bc519b37c6eb8c 100755 (executable)
@@ -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"
index 63bf123b73ea91d1c434e09ccf386d20372ffec8..94cf0ec7fcf3f258e278ee9da2eb61e01f442825 100755 (executable)
@@ -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@eth0"
+               ucidef_set_interface_wan "usb0"
+               ;;
        mzk-dp150n|\
        vocore)
                ucidef_add_switch "switch0" \
index 0b0b8d9777fb96f0b33b204cd6930237a113d653..c4b753808f9a11ea55d0f6b8a446f9e38d23c73f 100644 (file)
@@ -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 (executable)
index 0000000..a7e6c2e
--- /dev/null
@@ -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
+}
index cc6f00fd558a08e3ba407404f3f27f6da8c25c10..50903c75d6fccd88c8e63ba15c0dde23705f6ac9 100755 (executable)
@@ -295,6 +295,9 @@ ramips_board_detect() {
        *"MR-102N")
                name="mr-102n"
                ;;
+       *"MR200")
+               name="mr200"
+               ;;
        *"MT7620a + MT7530 evaluation"*)
                name="mt7620a_mt7530"
                ;;
index 2151cf945c8bbee8af0c7175d148e388ef70484e..78e87a09f2ea51821f435c41a2c73c91e551324f 100755 (executable)
@@ -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 (file)
index 0000000..93fb048
--- /dev/null
@@ -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@0 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               linux,modalias = "m25p80", "mx25l6405d";
+               spi-max-frequency = <10000000>;
+
+               partition@0 {
+                       label = "u-boot";
+                       reg = <0x0 0x20000>;
+                       read-only;
+               };
+
+               partition@20000 {
+                       label = "firmware";
+                       reg = <0x20000 0x7b0000>;
+               };
+
+               rom: partition@7d0000 {
+                       label = "rom";
+                       reg = <0x7d0000 0x10000>;
+                       read-only;
+               };
+
+               partition@7e0000 {
+                       label = "romfile";
+                       reg = <0x7e0000 0x10000>;
+                       read-only;
+               };
+
+               radio: partition@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";
+               };
+       };
+};
+
+&ethernet {
+               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@0,0 {
+                       reg = <0x0000 0 0 0 0>;
+                       device_type = "pci";
+                       mediatek,mtd-eeprom = <&radio 32768>;
+                       mediatek,2ghz = <0>;
+               };
+       };
+};
index 0bd6c9dcd80441d75517e32e9c04845027f9dbfe..d0e89b68a2b34ec690323a15fd5a92c63de4fc14 100644 (file)
@@ -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
index 213e6729a48877eaecfbaf8de760b44bf03c699e..3ab5c52ec2a3b26f927fe76f63e4a0fc67f35b45 100644 (file)
@@ -155,6 +155,12 @@ static struct flash_layout layouts[] = {
                .kernel_la      = 0x80000000,
                .kernel_ep      = 0x80000000,
                .rootfs_ofs     = 0x140000,
+       }, {
+               .id             = "8MLmtk",
+               .fw_max_len     = 0x7b0000,
+               .kernel_la      = 0x80000000,
+               .kernel_ep      = 0x80000000,
+               .rootfs_ofs     = 0x140000,
        }, {
                /* terminating entry */
        }
@@ -191,6 +197,13 @@ static struct board_info boards[] = {
                .layout_id      = "8Mmtk",
                .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 */
        }