From: Henryk Heisig Date: Sat, 24 Sep 2016 19:41:43 +0000 (+0200) Subject: ramips: Add support to TP-Link Archer MR200 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=c8043137bbd323b1490ae8613eab915ba9c138ee;p=openwrt%2Fstaging%2Fluka.git 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 --- 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 4a7b9f69c7..bcb1df1050 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 63bf123b73..94cf0ec7fc 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@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 0b0b8d9777..c4b753808f 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 0000000000..a7e6c2ef23 --- /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 cc6f00fd55..50903c75d6 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 2151cf945c..78e87a09f2 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 0000000000..93fb048d49 --- /dev/null +++ b/target/linux/ramips/dts/ArcherMR200.dts @@ -0,0 +1,195 @@ +/dts-v1/; + +#include "mt7620a.dtsi" +#include +#include + +/ { + 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 = ; + }; + + rfkill { + label = "rfkill"; + gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + }; + + 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"; + }; + }; +}; + +ð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@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 0bd6c9dcd8..d0e89b68a2 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 213e6729a4..3ab5c52ec2 100644 --- a/tools/firmware-utils/src/mktplinkfw2.c +++ b/tools/firmware-utils/src/mktplinkfw2.c @@ -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 */ }