[LEDE-DEV] [PATCH] ramips: Add support for the Unielec U7621-6

Kristian Evensen kristian.evensen at gmail.com
Sat Nov 4 13:53:15 PDT 2017


The Unielec U7621-6
(http://www.unielecinc.com/q/news/cn/p/product/detail.html?qd_guid=pyrEjfTmYf)
is an MT7621-based router with the following specifications:

* CPU: MT7621 (880Mhz)
* 5x 10/100/1000Mbps ports.
* 8/16/32/64 MB Flash.
* 256/512 MB RAM.
* 1x USB 3.0 port.
* 1x mini-PCIe slot intended for either a modem or an mSata disk.
* 2x normal mini-PCIe slots.
* 1x SIM slots.
* 1x button.
* 1x mico SD-card reader.

Works:
* Wifi.
* Switch.
* The normal mini-PCIe slots.
* The modem/mSata mini-PCIe slot (only tested with a modem).
* SIM slot.
* Sysupgrade.
* Button (reset).
* micro SD-card reader.

Not working:
-

Notes:
* According to the specifications on the Unielec website, two LEDs
should be controllable via GPIO. I was not able to find the pins.
* The device can be delivered with different amounts of RAM and
storage. I have only added support for devices with 256MB RAM and 16MB
storage, as that is the configuration of my device. However, I have
added all the required infrastructure for making adding support for the
other configurations easy.
* I have assumed that the placement of wifi cards will be as on the image on
the Unielec website linked to above.
* The factory firmware reads the MAC address from offset e000 on the
factory partition. On my device, this offset contains 0xffs, but I have
chosen to keep the offset in the dts to ensure we are consistent with
the factory firmware.

Installation:

See Recovery below. The router comes pre-installed with OpenWRT (Pandora
Box), but sysupgrade fails due to board name mismatch.

Recovery:
The U7621-6 supports web recovery. If you keep the reset-button pressed
for ~5 seconds during boot, a webserver is started. Your machine will be
assigned an IP through DHCP, and the router has address 192.168.1.1. The
recovery website is in Chinese, but is easy to use. Click on the second
item in the list to access the recovery page, then the second item on
the next page is where you select the firmware. In order to start the
recovery, you click the button at the bottom.

Signed-off-by: Kristian Evensen <kristian.evensen at gmail.com>
---
 .../linux/ramips/base-files/etc/board.d/02_network |   1 +
 target/linux/ramips/base-files/lib/ramips.sh       |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh      |   1 +
 target/linux/ramips/dts/U7621-6-256M-16M.dts       |  54 ++++++++
 target/linux/ramips/dts/U7621-6.dtsi               | 147 +++++++++++++++++++++
 target/linux/ramips/image/mt7621.mk                |   9 ++
 6 files changed, 215 insertions(+)
 create mode 100644 target/linux/ramips/dts/U7621-6-256M-16M.dts
 create mode 100644 target/linux/ramips/dts/U7621-6.dtsi

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 1c8505e8c7..8530ca5170 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -102,6 +102,7 @@ ramips_setup_interfaces()
 	r6220|\
 	sap-g3200u3|\
 	sk-wb8|\
+	u7621-6-256M-16M|\
 	vr500|\
 	wf-2881|\
 	witi|\
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index 07e776cb0c..e937fa5701 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -508,6 +508,9 @@ ramips_board_detect() {
 	*"U25AWF-H1")
 		name="u25awf-h1"
 		;;
+	*"Unielec U7621-6 (256M RAM/16M flash)")
+		name="u7621-6-256M-16M"
+		;;
 	*"UBNT-ERX")
 		name="ubnt-erx"
 		;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 99ebe35b44..0eb808c3ce 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -145,6 +145,7 @@ platform_check_image() {
 	timecloud|\
 	tiny-ac|\
 	u25awf-h1|\
+	u7621-6-256M-16M|\
 	ur-326n4g|\
 	ur-336un|\
 	v22rw-2x2|\
diff --git a/target/linux/ramips/dts/U7621-6-256M-16M.dts b/target/linux/ramips/dts/U7621-6-256M-16M.dts
new file mode 100644
index 0000000000..fff6206e44
--- /dev/null
+++ b/target/linux/ramips/dts/U7621-6-256M-16M.dts
@@ -0,0 +1,54 @@
+/*
+ *  BSD LICENSE
+ *
+ *  Copyright(c) 2017 Kristian Evensen <kristian.evensen at 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 "U7621-6.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+	compatible = "unielec,u7621-6-256m-16m", "unielec,u7621-6", "mediatek,mt7621-soc";
+	model = "Unielec U7621-6 (256M RAM/16M flash)";
+
+	memory at 0 {
+		device_type = "memory";
+		reg = <0x0 0x10000000>;
+	};
+};
+
+&firmware {
+	reg = <0x50000 0xfb0000>;
+};
+
diff --git a/target/linux/ramips/dts/U7621-6.dtsi b/target/linux/ramips/dts/U7621-6.dtsi
new file mode 100644
index 0000000000..e5718caab5
--- /dev/null
+++ b/target/linux/ramips/dts/U7621-6.dtsi
@@ -0,0 +1,147 @@
+/*
+ *  BSD LICENSE
+ *
+ *  Copyright(c) 2017 Kristian Evensen <kristian.evensen at 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 "mt7621.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+	compatible = "unielec,u7621-6", "mediatek,mt7621-soc";
+
+	chosen {
+		bootargs = "console=ttyS0,115200";
+	};
+
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		poll-interval = <20>;
+
+		reset {
+			label = "reset";
+			gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+	};
+
+	gpio_export {
+		compatible = "gpio-export";
+		#size-cells = <0>;
+
+		modem_power {
+		    gpio-export,name = "modem_power";
+		    gpio-export,output = <1>;
+		    gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
+
+&sdhci {
+	status = "okay";
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&sdhci_pins>;
+};
+
+&spi0 {
+	status = "okay";
+
+	m25p80 at 0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <10000000>;
+		m25p,chunked-io = <32>;
+
+		partition at 0 {
+			label = "u-boot";
+			reg = <0x0 0x30000>;
+			read-only;
+		};
+
+		partition at 30000 {
+			label = "u-boot-env";
+			reg = <0x30000 0x10000>;
+			read-only;
+		};
+
+		factory: partition at 40000 {
+			label = "factory";
+			reg = <0x40000 0x10000>;
+			read-only;
+		};
+
+		firmware: partition at 50000 {
+			label = "firmware";
+		};
+	};
+};
+
+&pcie {
+	status = "okay";
+
+	pcie1 {
+		wifi at 14c3,7612 {
+			compatible = "pci14c3,7612";
+			reg = <0x0000 0 0 0 0>;
+			mediatek,mtd-eeprom = <&factory 0x8000>;
+			ieee80211-freq-limit = <5000000 6000000>;
+		};
+	};
+
+	pcie2 {
+		wifi at 14c3,7602 {
+			compatible = "pci14c3,7602";
+			reg = <0x0000 0 0 0 0>;
+			mediatek,mtd-eeprom = <&factory 0x0000>;
+			ieee80211-freq-limit = <2400000 2500000>;
+		};
+	};
+};
+
+&ethernet {
+	mtd-mac-address = <&factory 0xe000>;
+	mediatek,portmap = "llllw";
+};
+
+&pinctrl {
+	state_default: pinctrl0 {
+		gpio {
+			ralink,group = "wdt", "jtag";
+			ralink,function = "gpio";
+		};
+	};
+};
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index 8bd7e0318f..1bdd0024e4 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -225,6 +225,15 @@ define Device/timecloud
 endef
 TARGET_DEVICES += timecloud
 
+define Device/u7621-6-256M-16M
+  DTS := U7621-6-256M-16M
+  IMAGE_SIZE := 16777216
+  DEVICE_TITLE := Unielec U7621-6 (256M RAM/16M flash)
+  DEVICE_PACKAGES := kmod-ata-core kmod-ata-ahci kmod-sdhci-mt7620 kmod-mt76x2 kmod-usb3 \
+	kmod-usb-ledtrig-usbport wpad-mini
+endef
+TARGET_DEVICES += u7621-6-256M-16M
+
 define Device/ubnt-erx
   DTS := UBNT-ERX
   FILESYSTEMS := squashfs
-- 
2.11.0




More information about the Lede-dev mailing list