<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:±¼¸²
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><div><div dir="ltr"><pre style="white-space:pre-wrap;">netis WF-2881 is an MT7621AT based router with MT7602EN, MT7612EN.
</pre><pre style="white-space:pre-wrap;"><span style="font-family:±¼¸², sans-serif;font-size:12pt;">It has 128MB DDR3, 128MB SLC NAND FLASH, 5-port Gbps switch and 1x USB 3.0.</span></pre><pre style="white-space:pre-wrap;">The following patch adds support for this device.

Tested and working:
* ethernet
* both WiFi radios
* USB 3.0
* buttons (reset button)
* ethernet switch and USB diag LEDs
* UART
* GPIOs


Signed-off-by: YounJae Rho <<a href="https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel" target="_blank">l</a>uxflow@live.com></pre><pre style="white-space:pre-wrap;">---</pre><pre><span style="white-space:pre-wrap;"> target/linux/ramips/base-files/etc/board.d/01_leds |   3 +
 .../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/WF-2881.dts                | 129 +++++++++++++++++++++
 target/linux/ramips/image/Makefile                 |   6 +-
 target/linux/ramips/mt7621/config-3.18             |   7 +-
 target/linux/ramips/mt7621/profiles/wf-2881.mk     |  18 +++
 9 files changed, 168 insertions(+), 3 deletions(-)
 create mode 100644 target/linux/ramips/dts/WF-2881.dts
 create mode 100644 target/linux/ramips/mt7621/profiles/wf-2881.mk

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 c75a993..7d2b284 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -264,6 +264,9 @@ zbt-wr8305rt)
 zte-q7)
        set_wifi_led "$board:blue:status"
        ;;
+wf-2881)
+       set_usb_led "netis:green:usb"
+       ;;
 esac
 
 board_config_flush
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 0732796..543512a 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -83,6 +83,7 @@ ramips_setup_interfaces()
        wsr-1166|\
        wsr-600|\
        wt1520|\
+       wf-2881|\
        y1)
                ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
                ucidef_add_switch "switch0" "1" "1"
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index 5376759..bf4fec0 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -174,6 +174,9 @@ get_status_led() {
        wsr-600)
                status_led="$board:orange:diag"
                ;;
+       wf-2881)
+               status_led="netis:green:wps"
+               ;;
        esac
 }
 
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index 340bc4c..0273527 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -277,6 +277,9 @@ ramips_board_detect() {
        *"NCS601W")
                name="ncs601w"
                ;;
+       *"NETIS WF-2881")
+               name="wf-2881"
+               ;;
        *"NW718")
                name="nw718"
                ;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index d3d9df3..687642f 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -107,6 +107,7 @@ platform_check_image() {
        w150m|\
        w306r-v20|\
        w502u|\
+       wf-2881|\
        whr-1166d|\
        whr-300hp2|\
        whr-600d|\
diff --git a/target/linux/ramips/dts/WF-2881.dts b/target/linux/ramips/dts/WF-2881.dts
new file mode 100644
index 0000000..b31aeee
--- /dev/null
+++ b/target/linux/ramips/dts/WF-2881.dts
@@ -0,0 +1,129 @@
+/dts-v1/;
+
+/include/ "mt7621.dtsi"
+
+/ {
+       compatible = "mediatek,mt7621-eval-board", "mediatek,mt7621-soc";
+       model = "NETIS WF-2881";
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x8000000>;
+       };
+
+       palmbus@1E000000 {
+               spi@b00 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&state_default>;
+               };
+       };
+
+       chosen {
+               bootargs = "console=ttyS0,57600";
+       };
+
+
+       nand@1e003000 {
+               compatible = "mtk,mt7621-nand";
+               bank-width = <2>;
+               reg = <0x1e003000 0x800
+                               0x1e003800 0x800>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+
+                       partition@0 {
+                               label = "u-boot";
+                               reg = <0x0 0x30000>;
+                               read-only;
+                       };
+
+                       partition@30000 {
+                               label = "u-boot-env";
+                               reg = <0x30000 0x1000>;
+                               read-only;
+                       };
+
+                       partition@80000 {
+                               label = "config";
+                               reg = <0x80000 0x20000>;
+                               read-only;
+                       };
+
+                       factory: partition@100000 {
+                               label = "factory";
+                               reg = <0x100000 0x40000>;
+                               read-only;
+                       };
+
+                       partition@140000 {
+                               label = "firmware";
+                               reg = <0x140000 0x6EC0000>;
+                       };
+
+       };
+
+
+       pcie@1e140000 {
+               status = "okay";
+
+               pcie0 {
+                       mt76@0,0 {
+                               reg = <0x0000 0 0 0 0>;
+                               device_type = "pci";
+                               mediatek,mtd-eeprom = <&factory 0x8000>;
+                               mediatek,2ghz = <0>;
+                       };
+               };
+
+               pcie1 {
+                       mt76@1,0 {
+                               reg = <0x0000 0 0 0 0>;
+                               device_type = "pci";
+                               mediatek,mtd-eeprom = <&factory 0x0000>;
+                               mediatek,5ghz = <0>;
+                       };
+               };
+       };
+
+       ethernet@1e100000 {
+               mtd-mac-address = <&factory 0xe006>;
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+
+               usb {
+                       label = "netis:green:usb";
+                       gpios = <&gpio0 6 1>;
+               };
+               wps {
+                       label = "netis:green:wps";
+                       gpios = <&gpio0 0 1>;
+               };
+       };
+
+       gpio-keys-polled {
+               compatible = "gpio-keys-polled";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               poll-interval = <20>;
+
+               reset {
+                       label = "reset";
+                       gpios = <&gpio0 12 1>;
+                       linux,code = <0x198>;
+               };
+
+
+       };
+
+       pinctrl {
+               state_default: pinctrl0 {
+                       gpio {
+                               ralink,group = "uart3", "jtag";
+                               ralink,function = "gpio";
+                       };
+               };
+       };
+};
diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile
index c66409d..060a2a4 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -950,7 +950,7 @@ endif
 #
 
 ifeq ($(SUBTARGET),mt7621)
-  TARGET_DEVICES += mt7621 wsr-600 wsr-1166 dir-860l-b1 firewrt pbr-m1 re6500 sap-g3200u3
+  TARGET_DEVICES += mt7621 wsr-600 wsr-1166 dir-860l-b1 firewrt pbr-m1 re6500 sap-g3200u3 wf-2881
 endif
 
 define Device/mt7621
@@ -1000,6 +1000,10 @@ define Device/sap-g3200u3
   DTS := SAP-G3200U3
 endef
 
+define Device/wf-2881
+  DTS := WF-2881
+endef
+
 #
 # MT7628 Profiles
 #
diff --git a/target/linux/ramips/mt7621/config-3.18 b/target/linux/ramips/mt7621/config-3.18
index fb05d1e..8bc2d80 100644
--- a/target/linux/ramips/mt7621/config-3.18
+++ b/target/linux/ramips/mt7621/config-3.18
@@ -36,6 +36,8 @@ CONFIG_CPU_RMAP=y
 CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
 CONFIG_CPU_SUPPORTS_HIGHMEM=y
 CONFIG_CPU_SUPPORTS_MSA=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_WORKQUEUE=y
 CONFIG_CSRC_R4K=y
 CONFIG_DEBUG_PINCTRL=y
 CONFIG_DMA_NONCOHERENT=y
@@ -117,18 +119,19 @@ CONFIG_MIPS_MT_FPAFF=y
 CONFIG_MIPS_MT_SMP=y
 CONFIG_MIPS_PERF_SHARED_TC_COUNTERS=y
 # CONFIG_MIPS_VPE_LOADER is not set
-# CONFIG_MTK_MTD_NAND is not set
 CONFIG_MODULES_USE_ELF_REL=y
 CONFIG_MT7621_WDT=y
 # CONFIG_MTD_CFI_INTELEXT is not set
 CONFIG_MTD_CMDLINE_PARTS=y
-CONFIG_MTD_M25P80=y
+CONFIG_MTD_NAND=y
+CONFIG_MTD_NAND_ECC=y
 CONFIG_MTD_PHYSMAP=y
 CONFIG_MTD_SPI_NOR=y
 CONFIG_MTD_SPLIT_FIRMWARE=y
 CONFIG_MTD_SPLIT_SEAMA_FW=y
 CONFIG_MTD_SPLIT_TRX_FW=y
 CONFIG_MTD_SPLIT_UIMAGE_FW=y
+CONFIG_MTK_MTD_NAND=y
 CONFIG_NEED_DMA_MAP_STATE=y
 CONFIG_NET_FLOW_LIMIT=y
 CONFIG_NET_RALINK=y
diff --git a/target/linux/ramips/mt7621/profiles/wf-2881.mk b/target/linux/ramips/mt7621/profiles/wf-2881.mk
new file mode 100644
index 0000000..6de40af
--- /dev/null
+++ b/target/linux/ramips/mt7621/profiles/wf-2881.mk
@@ -0,0 +1,18 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/WF-2881
+       NAME:=NETIS WF-2881
+       PACKAGES:=\
+               kmod-usb-core kmod-usb3 kmod-usb-hid \
+               kmod-ledtrig-usbdev
+endef
+
+define Profile/WF-2881/Description
+       Package set compatible with the NETIS WF-2881 board.
+endef
+$(eval $(call Profile,WF-2881))
</span></pre><div><br></div>                                        </div></div><style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:±¼¸²;
}

--></style>                                      </div></body>
</html>