How to add ZBT we2806 to OpenWrt version 19?

I have added the ZBT-we2806 device for OpenWrt v18.06.08 and the firmware is running perfectly on the device. I have added the device in build root with the help of the below files

target/linux/ramips/image/mt76x8.mk
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/ZBT-WE2806.dts

Now I want to add the same device for Openwrt v19.07.6. The device was added and compiled successfully but when I flash the firmware on the device is going in the boot-loop like continuously ON & OFF.

1 Like

Might be as simple as a missing semi-colon somewhere. You should post a git diff against the 19.07 codebase, but you'll be quicker to diagnose if you have serial attached to it.

Even better though would be to build against master (or the crispy fresh 21.01 branch).

2 Likes

How to git checkout for 21.01 branch in build-root?

For now it's still just $ git checkout openwrt-21.02 on master, there's no dedicated git URL yet.

Here are the code files for adding zbt-we2806
target/linux/ramips/image/mt76x8.mk

define Device/zbt-we2806
  DTS := ZBT-WE2806
  IMAGE_SIZE := $(ralink_default_fw_size_8M)
  DEVICE_TITLE := Zbtlink ZBT-WE2806
  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport \
    kmod-i2c-core kmod-i2c-algo-bit kmod-i2c-gpio kmod-i2c-gpio-custom kmod-gpio-pcf857x
endef
TARGET_DEVICES += zbt-we2806

target/linux/ramips/base-files/etc/board.d/01_leds

zbt-we2806)
	set_wifi_led "ra0"
	ucidef_set_led_netdev "4g" "wwan0" "4g" "wwan0" "tx rx"
	ucidef_set_led_netdev "4g2" "wwan1" "4g2" "wwan1" "tx rx"

target/linux/ramips/base-files/etc/board.d/02_network

zbt-we2806)
		ucidef_add_switch "switch0" \
			"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"

target/linux/ramips/base-files/lib/ramips.sh

*"ZBT-WE2806")
		name="zbt-we2806"

target/linux/ramips/base-files/lib/upgrade/platform.sh

zbt-we2806|\

target/linux/ramips/dts/ZBT-WE2806.dts

/dts-v1/;

#include "mt7628an.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
	compatible = "zbtlink,zbt-we2806", "mediatek,mt7628an-soc";
	model = "ZBT-WE2806";

	chosen {
		bootargs = "console=ttyS0,115200";
	};
	
	i2c-gpio {
		#address-cells = <1>;
		#size-cells = <0>;

		compatible = "i2c-gpio";
		gpios = <&gpio0 2 1 &gpio0 3 1>;
		i2c-gpio,delay-us = <10>;

		pcf0: iexp@20 {
			#gpio-cells = <2>;
			compatible = "nxp,pca9671";
			reg = <0x20>;
			gpio-controller;
		};
	};

	gpio-leds {
		compatible = "gpio-leds";

		ra0 {
			label = "ra0";
			gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
		};
		4g {
			label = "4g";
			gpios = <&pcf0 1 GPIO_ACTIVE_LOW>;
		};
		rssi1 {
			label = "rssi1";
			gpios = <&pcf0 2 GPIO_ACTIVE_LOW>;
		};
		rssi2 {
			label = "rssi2";
			gpios = <&pcf0 3 GPIO_ACTIVE_LOW>;
		};
		rssi3 {
			label = "rssi3";
			gpios = <&pcf0 4 GPIO_ACTIVE_LOW>;
		};
		4g2 {
			label = "4g2";
			gpios = <&pcf0 8 GPIO_ACTIVE_LOW>;
		};
		rssi12 {
			label = "rssi12";
			gpios = <&pcf0 7 GPIO_ACTIVE_LOW>;
		};
		rssi22 {
			label = "rssi22";
			gpios = <&pcf0 6 GPIO_ACTIVE_LOW>;
		};
		rssi32 {
			label = "rssi32";
			gpios = <&pcf0 5 GPIO_ACTIVE_LOW>;
		};
	};
	
	gpio_export {
		compatible = "gpio-export";
		#size-cells = <0>;

		4g {
			gpio-export,name = "4g";
			gpio-export,output = <1>;
			gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
		};
		4g2 {
			gpio-export,name = "4g2";
			gpio-export,output = <1>;
			gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
		};
	};

	gpio-keys {
		compatible = "gpio-keys-polled";
		#address-cells = <1>;
		#size-cells = <0>;
		poll-interval = <20>;

		reset {
			label = "reset";
			gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RESTART>;
		};
	};
};

&pinctrl {
	state_default: pinctrl0 {
		gpio {
			ralink,group = "refclk", "wled_an", "gpio", "i2s", "i2c" ;
			ralink,function = "gpio";
		};
	};
};

&wmac {
	status = "okay";
	ralink,mtd-eeprom = <&factory 0x4>;
};

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

&spi0 {
	status = "okay";

	m25p80@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <10000000>;
		m25p,chunked-io = <32>;

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

		partition@50000 {
			label = "firmware";
			reg = <0x50000 0x800000>;
		};
	};
};

&sdhci {
	status = "okay";
};

&ehci {
	status = "okay";
};

&ohci {
	status = "okay";
};

&pcie {
	status = "okay";
};

Is there anything wrong?
Please help @Borromini @juppin @hnyman

1 Like

Can you provide a serial boot log?

i lost stock firmware. could you please send to me your stable firmware ? zbt-we2806. thank you. my email : buinguyenquang@gmail.com

I randomly saw this thread after I found the same issue with another device today:

[    0.000000] Linux version 4.14.241 (builder@buildhost) (gcc version 7.5.0 (OpenWrt GCC 7.5.0 r11364-ef56c85848)) #0 Thu Jul 29 19:50:28 2021
[    0.000000] SoC Type: Ralink RT5350 id:1 rev:3
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001964c (MIPS 24KEc)
[    0.000000] MIPS: machine is Proroute H820
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 16kB, 4-way, VIPT, no aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] random: get_random_bytes called from 0x803d86ec with crng_init=0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: console=ttyS0,57600 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=00079230
[    0.000000] Readback ErrCtl register=00079230
[    0.000000] Memory: 59560K/65536K available (3324K kernel code, 171K rwdata, 432K rodata, 1184K init, 199K bss, 5976K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 256
[    0.000000] CPU Clock: 360MHz
[    0.000000] clocksource: systick: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 583261500 ns
[    0.000000] systick: running - mult: 214748, shift: 32
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 10618113593 ns
[    0.000017] sched_clock: 32 bits at 180MHz, resolution 5ns, wraps every 11930464253ns
[    0.015747] Calibrating delay loop... 239.61 BogoMIPS (lpj=1198080)
[    0.098067] pid_max: default: 32768 minimum: 301
[    0.107666] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.120796] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.144315] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.163872] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.176116] pinctrl core: initialized pinctrl subsystem
[    0.189430] NET: Registered protocol family 16
[    0.254858] rt2880_gpio 10000600.gpio: registering 22 gpios
[    0.266007] rt2880_gpio 10000600.gpio: registering 22 irq handlers
[    0.288664] clocksource: Switched to clocksource MIPS
[    0.300957] NET: Registered protocol family 2
[    0.310046] IP idents hash table entries: 2048 (order: 2, 16384 bytes)
[    0.324661] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.338539] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.351127] TCP: Hash tables configured (established 1024 bind 1024)
[    0.364131] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.375770] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.388858] NET: Registered protocol family 1
[    0.404720] rt-timer 10000100.timer: maximum frequency is 3662Hz
[    0.418488] Crashlog allocated RAM at address 0x3f00000
[    0.433976] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    0.458022] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.469626] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.520175] io scheduler noop registered
[    0.527837] io scheduler deadline registered (default)
[    0.540114] gpio-export gpio_export: 1 gpio(s) exported
[    0.551054] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.570120] console [ttyS0] disabled
[    0.577176] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 20, base_baud = 2500000) is a Palmchip BK-3103
[    0.596998] console [ttyS0] enabled
[    0.596998] console [ttyS0] enabled
[    0.610779] bootconsole [early0] disabled
[    0.610779] bootconsole [early0] disabled
[    0.649141] spi spi0.0: force spi mode3
[    0.658326] m25p80 spi0.0: mx25l6405d (8192 Kbytes)
[    0.668279] 5 fixed-partitions partitions found on MTD device spi0.0
[    0.681015] Creating 5 MTD partitions on "spi0.0":
[    0.690651] 0x000000000000-0x000000030000 : "u-boot"
[    0.702602] 0x000000030000-0x000000050000 : "u-boot-env"
[    0.715174] 0x000000050000-0x000000060000 : "factory"
[    0.727315] 0x000000060000-0x000000200000 : "user_fs"
[    0.739635] 0x000000200000-0x000000800000 : "firmware"
[    0.752991] libphy: Fixed MDIO Bus: probed
[    0.778198] rt3050-esw 10110000.esw: link changed 0x00
[    0.791793] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    0.809538] rt2880_wdt 10000120.watchdog: Initialized
[    0.822290] NET: Registered protocol family 10
[    0.841755] Segment Routing with IPv6
[    0.849423] NET: Registered protocol family 17
[    0.858435] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    0.884371] 8021q: 802.1Q VLAN Support v1.8
[    0.899072] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    0.914117] Please append a correct "root=" boot option; here are the available partitions:
[    0.930840] 1f00             192 mtdblock0
[    0.930851]  (driver?)
[    0.943949] 1f01             128 mtdblock1
[    0.943957]  (driver?)
[    0.957041] 1f02              64 mtdblock2
[    0.957049]  (driver?)
[    0.970174] 1f03            1664 mtdblock3
[    0.970183]  (driver?)
[    0.983272] 1f04            6144 mtdblock4
[    0.983280]  (driver?)
[    0.996374] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    1.014279] Rebooting in 1 seconds..

Fix for your device:

	m25p80@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <10000000>;
		m25p,chunked-io = <32>;

		partitions {
			compatible = "fixed-paritions";

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

			partition@50000 {
				compatible = "denx,uimage";
				label = "firmware";
				reg = <0x50000 0x800000>;
			};
		};
	};

When I tried these changes. I am getting errors with gpio0 and gpio1 as non-existent.

Please help.

@sagar_jain may be able to help you.

Please share your dts file.

#include "mt7628an.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
	compatible = "zbtlink,zbt-we2806", "mediatek,mt7628an-soc";
	model = "ZBT-WE2806";

	chosen {
		bootargs = "console=ttyS0,115200";
	};
	
	i2c-gpio {
		#address-cells = <1>;
		#size-cells = <0>;

		compatible = "i2c-gpio";
		gpios = <&gpio 2 1 &gpio 3 1>;
		i2c-gpio,delay-us = <10>;

		pcf0: iexp@20 {
			#gpio-cells = <2>;
			compatible = "nxp,pca9671";
			reg = <0x20>;
			gpio-controller;
		};
	};

	gpio-leds {
                compatible = "gpio-leds";

                ra0 {
                        label = "ra0";
                        gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
                };
                4g {
                        label = "4g";
                        gpios = <&pcf0 1 GPIO_ACTIVE_LOW>;
                };
                sim1 {
                        label = "sim1";
                        gpios = <&pcf0 2 GPIO_ACTIVE_LOW>;
                };
                sim2 {
                        label = "sim2";
                        gpios = <&pcf0 3 GPIO_ACTIVE_LOW>;
                };
                rssi1 {
                        label = "rssi1";
                        gpios = <&pcf0 8 GPIO_ACTIVE_LOW>;
                };
                rssi2 {
                        label = "rssi2";
                        gpios = <&pcf0 7 GPIO_ACTIVE_LOW>;
                };
                rssi3 {
                        label = "rssi3";
                        gpios = <&pcf0 6 GPIO_ACTIVE_LOW>;
                };	
	};
	
	gpio_export {
		compatible = "gpio-export";
		#size-cells = <0>;

		4g {
			gpio-export,name = "4g";
			gpio-export,output = <1>;
			gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
		};
		4g2 {
			gpio-export,name = "sim";
			gpio-export,output = <0>;
			gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;
		};
	};

	gpio-keys {
		compatible = "gpio-keys-polled";
		#address-cells = <1>;
		#size-cells = <0>;
		poll-interval = <20>;

		reset {
			label = "reset";
			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RESTART>;
		};
	};
};

&pinctrl {
	state_default: pinctrl0 {
		gpio {
			ralink,group = "refclk", "wled_an", "gpio", "i2s", "i2c" ;
			ralink,function = "gpio";
		};
	};
};

&wmac {
	status = "okay";
	ralink,mtd-eeprom = <&factory 0x4>;
};

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

&spi0 {
	status = "okay";

	m25p80@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <10000000>;
		m25p,chunked-io = <32>;

		partitions {
			compatible = "fixed-partitions";

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

			partition@50000 {
				compatible = "denx,uimage";
				label = "firmware";
				reg = <0x50000 0x800000>;
			};
				
		};

	};
};

&sdhci {
	status = "okay";
};

&ehci {
	status = "okay";
};

&ohci {
	status = "okay";
};

&pcie {
	status = "okay";
};

The above dts file is largely based upon the discussion above and original dts compiled with the earlier version of OpenWrt. I am pretty sure the following section is not correct

gpios = <&gpio 2 1 &gpio 3 1>;

Please help me.

Thanks, but I am using 21.02.2. And it gives errors for non-extstent nodes 'gpio0' and 'gpio1'. Any suggestions for the latest release?

This is the DTS file I have. I see some difference.

/dts-v1/;

#include "mt7628an.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
	compatible = "zbtlink,zbt-we2806", "mediatek,mt7628an-soc";
	model = "ZBT-WE2806";

	chosen {
		bootargs = "console=ttyS0,115200";
	};
	
	i2c-gpio {
		#address-cells = <1>;
		#size-cells = <0>;

		compatible = "i2c-gpio";
		gpios = <&gpio0 2 1 &gpio0 3 1>;
		i2c-gpio,delay-us = <10>;

		pcf0: iexp@20 {
			#gpio-cells = <2>;
			compatible = "nxp,pca9671";
			reg = <0x20>;
			gpio-controller;
		};
	};

	gpio-leds {
		compatible = "gpio-leds";

		ra0 {
			label = "ra0";
			gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
		};
		4g {
			label = "4g";
			gpios = <&pcf0 1 GPIO_ACTIVE_LOW>;
		};
		rssi1 {
			label = "rssi1";
			gpios = <&pcf0 2 GPIO_ACTIVE_LOW>;
		};
		rssi2 {
			label = "rssi2";
			gpios = <&pcf0 3 GPIO_ACTIVE_LOW>;
		};
		rssi3 {
			label = "rssi3";
			gpios = <&pcf0 4 GPIO_ACTIVE_LOW>;
		};
		4g2 {
			label = "4g2";
			gpios = <&pcf0 8 GPIO_ACTIVE_LOW>;
		};
		rssi12 {
			label = "rssi12";
			gpios = <&pcf0 7 GPIO_ACTIVE_LOW>;
		};
		rssi22 {
			label = "rssi22";
			gpios = <&pcf0 6 GPIO_ACTIVE_LOW>;
		};
		rssi32 {
			label = "rssi32";
			gpios = <&pcf0 5 GPIO_ACTIVE_LOW>;
		};
	};
	
	gpio_export {
		compatible = "gpio-export";
		#size-cells = <0>;

		4g {
			gpio-export,name = "4g";
			gpio-export,output = <1>;
			gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
		};
		4g2 {
			gpio-export,name = "4g2";
			gpio-export,output = <1>;
			gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
		};
	};

	gpio-keys {
		compatible = "gpio-keys-polled";
		#address-cells = <1>;
		#size-cells = <0>;
		poll-interval = <20>;

		reset {
			label = "reset";
			gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RESTART>;
		};
	};
};

&pinctrl {
	state_default: pinctrl0 {
		gpio {
			ralink,group = "refclk", "wled_an", "gpio", "i2s", "i2c" ;
			ralink,function = "gpio";
		};
	};
};

&wmac {
	status = "okay";
	ralink,mtd-eeprom = <&factory 0x4>;
};

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

&spi0 {
	status = "okay";

	m25p80@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <10000000>;
		m25p,chunked-io = <32>;

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

		partition@50000 {
			label = "firmware";
			reg = <0x50000 0xfb0000>;
		};
	};
};

&sdhci {
	status = "okay";
};

&ehci {
	status = "okay";
};

&ohci {
	status = "okay";
};

&pcie {
	status = "okay";
};

Do any of you have 21.02.2 working with WE2806?

Nope, my build keeps on rebooting even on OpenWRT 19.07.

Can you try this shell script on watchdog timer GPIO

#!/bin/sh

#for example watchdog gpio is 2
wd_gpio="2"

echo $wd_gpio > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio$wd_gpio/direction

while [ 1 ]
do
    echo 1 >/sys/class/gpio/gpio$wd_gpio/value
    sleep 1
    echo 0 >/sys/class/gpio/gpio$wd_gpio/value
    sleep 1
	
	echo 1 >/sys/class/gpio/gpio$wd_gpio/value
    sleep 1
    echo 0 >/sys/class/gpio/gpio$wd_gpio/value
    sleep 1
	
	echo 1 >/sys/class/gpio/gpio$wd_gpio/value
    sleep 1
    echo 0 >/sys/class/gpio/gpio$wd_gpio/value
    sleep 1
done

Hi Sagar ,

I am trying the same on 18.06.8 , I have done the same changes but my device is rebooting continuously . Please help .

Hi! I added inital support ZBT-WE2806-A OpenWrt 21.02.3.
ZBT-WE2806-A some similiar to 2806, but have differencies:

  1. One usb in mPCIe.
  2. Two slots nano sim, switching in router.
  3. 3xLAN, 1xWAN FE.
    Thank so mutch for you work!
1 Like