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

Piotr Dymacz pepe2k at gmail.com
Sun Nov 5 13:24:49 PST 2017


Hello Kristian,

On 04.11.2017 21:53, Kristian Evensen wrote:
> 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:

I got the same board last week and had some initial support ready 
locally. I pushed it now to my staging tree, please have a look:

https://git.lede-project.org/?p=lede/pepe2k/staging.git;a=shortlog;h=refs/heads/ramips_unielec-u7621-06

Maybe we can combine our patches and work out a common version.
Please, find also my comments below.

-- 
Cheers,
Piotr

[snip]

> Notes:
> * According to the specifications on the Unielec website, two LEDs
> should be controllable via GPIO. I was not able to find the pins.

GPIOs 10, 11 and 12 control LEDs 3, 4 and 5 in top row. At least on my 
board, some of these LEDs were rotated (wrong polarization).

> * 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.

AFAIK, board with 256/16 MB is the default one (mass production?). Any 
change means MOQ and customized version. The default one can be easily 
purchased from Ali..., directly from the vendor.

> * I have assumed that the placement of wifi cards will be as on the image on
> the Unielec website linked to above.

I have problem with this and I don't know how we should proceed here 
(Mathias, what do you think?).

Actually, the board by default comes without any Wi-Fi card installed 
and they need to be ordered separately (if someone needs them at all).

Personally, I don't think we should force any type of card and/or order 
in slots. The board comes with two miniPCIe slots which can be used for 
almost anything. I've been testing it with ath9k and mt7603 based cards, 
a different configuration than yours :)

> * 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.

AFAIK, the firmware vendor provides board with doesn't come from them. 
They installed some version dedicated for PandoraBox PBR-M1.

There is also some dedicated Padavan version but I have no idea where it 
can be downloaded from.

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

sysupgrade -F ...

> 
> 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.

At least on my board, button just stops autobooting process. Web server 
seems to be enabled in the bootloader all the time - with a static IP on 
my PC I can access it even during autobooting countdown.

> 
> 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|\

The board name is U7621-06 (not U7621-6).

As the 256/16 MB configuration is (seems to be) the default one, I don't 
see any reason for a different board name.

[snip]

> +/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)";

According to the vendor website and datasheet, it should be "UniElec 
U7621-06".

> +	gpio_export {
> +		compatible = "gpio-export";
> +		#size-cells = <0>;
> +
> +		modem_power {
> +		    gpio-export,name = "modem_power";

This is not a "power" control line. Actually, GPIO16 is connected with 
PERST# signal in miniPCIe slot (the one for LTE/mSATA). Most of miniPCIe 
cards (including modems) use this pin for reset (active low).

> +		    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";

This board doesn't use U-Boot.

> +			reg = <0x0 0x30000>;
> +			read-only;
> +		};
> +
> +		partition at 30000 {
> +			label = "u-boot-env";

This partition, at least on my piece, contains some configuration data 
which looks like from MediaTek SDK based firmware (leftovers?). It's 
definitely not an U-Boot environment.

> +			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>;
> +		};
> +	};

Does your board contains correct eeprom data in factory partition, 
including MAC addresses? Can you share your factory partition dumps?

> +};
> +
> +&ethernet {
> +	mtd-mac-address = <&factory 0xe000>;

My board has a a MAC address at 0xe006.

> +	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
> 




More information about the Lede-dev mailing list