From: Kristian Evensen Date: Sun, 10 Sep 2017 12:44:47 +0000 (+0200) Subject: ramips: Add support for ZBT WE1026-5G X-Git-Tag: v18.06.0-rc1~2269 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=79440ea7563d626d3823cbd3dadbe2f73214ce32;p=openwrt%2Fopenwrt.git ramips: Add support for ZBT WE1026-5G 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 --- 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 83e1a94000..f6a7bac81a 100755 --- a/target/linux/ramips/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/base-files/etc/board.d/01_leds @@ -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) 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 9284b1812f..6f05259467 100755 --- a/target/linux/ramips/base-files/etc/board.d/02_network +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -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" ;; diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh index 174e29e434..d0055d422b 100755 --- a/target/linux/ramips/base-files/lib/ramips.sh +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -553,6 +553,9 @@ ramips_board_detect() { *"WCR-150GN") name="wcr-150gn" ;; + *"WE1026-5G (16M)") + name="we1026-5g-16m" + ;; *"WF-2881") name="wf-2881" ;; diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index 5cfca52ab1..09a7dae394 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh @@ -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 index 0000000000..e01e86423c --- /dev/null +++ b/target/linux/ramips/dts/WE1026-5G-16M.dts @@ -0,0 +1,76 @@ +/* + * BSD LICENSE + * + * Copyright(c) 2017 Kristian Evensen . + * 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 index 0000000000..c357e1eee7 --- /dev/null +++ b/target/linux/ramips/dts/WE1026-5G.dtsi @@ -0,0 +1,124 @@ +/* + * BSD LICENSE + * + * Copyright(c) 2017 Kristian Evensen . + * 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 +#include + +/ { + 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 = ; + }; + }; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&sdhci { + status = "okay"; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + 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>; + }; + }; +}; diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index f201c9d404..6d2533d349 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -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