ramips: Add support for ZBT WE1026-5G
authorKristian Evensen <kristian.evensen@gmail.com>
Sun, 10 Sep 2017 12:44:47 +0000 (14:44 +0200)
committerJohn Crispin <john@phrozen.org>
Mon, 11 Sep 2017 15:17:05 +0000 (17:17 +0200)
The ZBT WE1026-5G
(http://www.zbtlink.com/products/router/WE1026-5G.html) is the follow-up
to the ZBT WE1026 and is based on MT7620. For the previous WE1026, the
ZBT WE826 image could be used. However, as the name implies, the -5G
comes equipped with a 5GHz wifi radio. As the WE826 only has a 2.4GHz
radio, the addition of 5GHz means that a separate image is needed for
the WE1026-5G. I suspect that this image will also work on the previous
WE1026, but I don't have a device to test with.

The WE1026-5G has following specifications:
* CPU: MT7620A
* 1x 10/100Mbps Ethernet.
* 16 MB Flash.
* 64 MB RAM.
* 1x USB 2.0 port.
* 1x mini-PCIe slots.
* 1x SIM slots.
* 1x 2.4Ghz WIFI.
* 1x 5GHz wifi (MT7612)
* 1x button.
* 3x controllable LEDs.

Works:
* Wifi.
* Switch.
* mini-PCIe slot. Only tested with a USB device (a modem).
* SIM slot.
* Sysupgrade.
* Button (reset).

Not working:
* The 5GHz WIFI LED is completely dead. I suspect the issue is the same
as on other devices with Mediatek 5Ghz wifi-cards/chips. The LED is
controlled by the driver, and mt76 (currently) does not support this.

Not tested:
* SD card reader.

Notes:
* The modem (labeled 3G/4G) and power LEDs are controlled by the
hardware.
* There is a 32MB version of this device available, but I do not have
access to it. I have therefor only added support for the 16MB version,
but added all the required infrastructure to make adding support for the
32MB version easy.

Installation:
The router comes pre-installed with OpenWRT, including a variant of
Luci. The initial firmware install can be done through this UI,
following normal procedure. I.e., access the UI and update the firmware
using the sysupgrade-image. Remember to select that you do not want to
keep existing settings.

Recovery:
If you brick the device, the WE1026-5G supports recovery using HTTP. Keep the
reset button pressed for ~5sec when booting to start the web server. Set the
address of the network interface on your machine to 192.168.1.2/24, and
point your browser to 192.168.1.1 to access the recovery UI. From the
recovery UI you can upload a firmware image.

Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
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/lib/ramips.sh
target/linux/ramips/base-files/lib/upgrade/platform.sh
target/linux/ramips/dts/WE1026-5G-16M.dts [new file with mode: 0644]
target/linux/ramips/dts/WE1026-5G.dtsi [new file with mode: 0644]
target/linux/ramips/image/mt7620.mk

index 83e1a940002ff9ac93043c7130ecbfb8d549ce7b..f6a7bac81ad45dea0580829bad988932325e4088 100755 (executable)
@@ -379,6 +379,11 @@ w502u)
 wcr-150gn)
        set_usb_led "$board:amber:user"
        ;;
+we1026-5g-16m)
+       ucidef_set_led_netdev "lan" "LAN" "we1026-5g:green:lan" "eth0"
+       set_wifi_led "we1026-5g:green:wifi"
+       set_usb_led "we1026-5g:green:usb" "1-1.1"
+       ;;
 whr-1166d|\
 whr-300hp2|\
 whr-600d)
index 9284b1812fb5b2251875ff8df54db98743cd8ba6..6f05259467eb295c73f6658e2dd2a6f1e994dd08 100755 (executable)
@@ -323,7 +323,8 @@ ramips_setup_interfaces()
                ucidef_add_switch "switch0" \
                        "3:lan" "4:wan" "6@eth0"
                ;;
-       wcr-150gn)
+       wcr-150gn|\
+       we1026-5g-16m)
                ucidef_add_switch "switch0" \
                        "0:lan" "6t@eth0"
                ;;
index 174e29e4346ed4ff91e596feb27ab94c69f55860..d0055d422b73b88903207c858a07934f6d6870b0 100755 (executable)
@@ -553,6 +553,9 @@ ramips_board_detect() {
        *"WCR-150GN")
                name="wcr-150gn"
                ;;
+       *"WE1026-5G (16M)")
+               name="we1026-5g-16m"
+               ;;
        *"WF-2881")
                name="wf-2881"
                ;;
index 5cfca52ab1f31ab5efaa5cfbad247be1c0db3d5e..09a7dae394600927ee72290d1088d1b703bbfc08 100755 (executable)
@@ -193,6 +193,7 @@ platform_check_image() {
        x8|\
        y1|\
        y1s|\
+       we1026-5g-16m|\
        zbt-ape522ii|\
        zbt-cpe102|\
        zbt-wa05|\
diff --git a/target/linux/ramips/dts/WE1026-5G-16M.dts b/target/linux/ramips/dts/WE1026-5G-16M.dts
new file mode 100644 (file)
index 0000000..e01e864
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ *  BSD LICENSE
+ *
+ *  Copyright(c) 2017 Kristian Evensen <kristian.evensen@gmail.com>.
+ *  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    * Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    * Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in
+ *      the documentation and/or other materials provided with the
+ *      distribution.
+ *    * Neither the name of Broadcom Corporation nor the names of its
+ *      contributors may be used to endorse or promote products derived
+ *      from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/dts-v1/;
+
+#include "WE1026-5G.dtsi"
+
+/ {
+       compatible = "zbtlink,we1026-5g-16m", "ralink,mt7620a-soc";
+       model = "ZBT WE1026-5G (16M)";
+};
+
+&spi0 {
+       status = "okay";
+
+       en25q128@0 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <10000000>;
+
+               partition@0 {
+                       label = "u-boot";
+                       reg = <0x0 0x30000>;
+                       read-only;
+               };
+
+               partition@30000 {
+                       label = "u-boot-env";
+                       reg = <0x30000 0x10000>;
+                       read-only;
+               };
+
+               factory: partition@40000 {
+                       label = "factory";
+                       reg = <0x40000 0x10000>;
+                       read-only;
+               };
+
+               firmware: partition@50000 {
+                       label = "firmware";
+                       reg = <0x50000 0xfb0000>;
+               };
+       };
+};
diff --git a/target/linux/ramips/dts/WE1026-5G.dtsi b/target/linux/ramips/dts/WE1026-5G.dtsi
new file mode 100644 (file)
index 0000000..c357e1e
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ *  BSD LICENSE
+ *
+ *  Copyright(c) 2017 Kristian Evensen <kristian.evensen@gmail.com>.
+ *  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    * Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    * Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in
+ *      the documentation and/or other materials provided with the
+ *      distribution.
+ *    * Neither the name of Broadcom Corporation nor the names of its
+ *      contributors may be used to endorse or promote products derived
+ *      from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "mt7620a.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+       compatible = "zbtlink,we1026-5g", "ralink,mt7620a-soc";
+
+       chosen {
+               bootargs = "console=ttyS0,115200";
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+               lan {
+                       label = "we1026-5g:green:lan";
+                       gpios = <&gpio2 0 GPIO_ACTIVE_LOW>;
+               };
+
+               usb {
+                       label = "we1026-5g:green:usb";
+                       gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
+               };
+
+               wifi {
+                       label = "we1026-5g:green:wifi";
+                       gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio-keys-polled {
+               compatible = "gpio-keys-polled";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               poll-interval = <20>;
+               reset {
+                       label = "reset";
+                       gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_RESTART>;
+               };
+       };
+};
+
+&gpio2 {
+       status = "okay";
+};
+
+&gpio3 {
+       status = "okay";
+};
+
+&sdhci {
+       status = "okay";
+};
+
+&ehci {
+       status = "okay";
+};
+
+&ohci {
+       status = "okay";
+};
+
+&ethernet {
+       mtd-mac-address = <&factory 0x28>;
+};
+
+&wmac {
+       ralink,mtd-eeprom = <&factory 0>;
+};
+
+&pinctrl {
+       state_default: pinctrl0 {
+               default {
+                       ralink,group = "i2c", "uartf", "spi refclk", "ephy", "wled";
+                       ralink,function = "gpio";
+               };
+       };
+};
+
+&pcie {
+       status = "okay";
+       pcie-bridge {
+               wifi@14c3,7662 {
+                       compatible = "pci14c3,7662";
+                       reg = <0x0000 0 0 0 0>;
+                       mediatek,mtd-eeprom = <&factory 0x8000>;
+                       ieee80211-freq-limit = <5000000 6000000>;
+               };
+       };
+};
index f201c9d404a9c3625c4be1f75395af9b34a1a441..6d2533d349bab48a4c1e9b81bd513f5e799ff534 100644 (file)
@@ -480,6 +480,15 @@ define Device/youku-yk1
 endef
 TARGET_DEVICES += youku-yk1
 
+define Device/we1026-5g-16m
+  DTS := WE1026-5G-16M
+  IMAGE_SIZE := 16777216
+  SUPPORTED_DEVICES += we1026-5g-16m
+  DEVICE_TITLE := Zbtlink ZBT-WE1026-5G (16M)
+  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-mt76 kmod-sdhci-mt7620
+endef
+TARGET_DEVICES += we1026-5g-16m
+
 define Device/zbt-ape522ii
   DTS := ZBT-APE522II
   DEVICE_TITLE := Zbtlink ZBT-APE522II