Adding Mofi 4500-V3 support

Hi guys. I recently successfully built a target for the Mofi 5500, and now I'm going to build one for the 4500 as well. It's good practice, and could be useful to those who want to build their own OpenWRT image for the Mofi 4500.

So here goes. First the list of chips on the board:

  • GL850G - USB 2.0 hub controller
  • HXB18T2G160AF-25E - 256 Megabyte (2Gigabit) DDR2 RAM chip
  • 25Q256JVEQ - 32MB SPI FLASH
  • MT7620A - Processor

PCI-E:

  • Quectel EC25-AF - LTE cell module

UPDATE:
That went really fast. I finished making the DTS, adding it to the makefile, and updating a couple other things. I don't have my RS-232 adapter here, but I ordered another one and it'll arrive in a couple days. I'll try flashing it at that point to make sure everything goes well.

For now, here's my DTS in case someone wants it.

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT

#include "mt7620a.dtsi"

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

/ {
	compatible = "mofi4500-v3";
	model = "MoFi Network MOFI4500-4GXeLTE-V3";

	aliases {
		led-boot = &led_power;
		led-failsafe = &led_power;
		led-running = &led_power;
		led-upgrade = &led_power;
	};

	chosen {
		bootargs = "console=ttyS0,115200";
	};

	leds {
		compatible = "gpio-leds";

		led_power: power {
			label = "green:power";
			gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
			default-state = "on";
		};

		internet {
			label = "green:internet";
			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
		};

		wifi {
			label = "green:wifi";
			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
		};
	};

	gpio-keys {
		compatible = "gpio-keys-polled";

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

		wps {
			label = "wps";
			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_WPS_BUTTON>;
		};
	};
};

&sdhci {
	status = "okay";
};

&ehci {
	status = "okay";
};

&ohci {
	status = "okay";
};

&pcie {
	status = "okay";
};

&gpio@638 {
	status = "okay";
};

&gpio@688 {
	status = "okay";
};

&spi0 {
	status = "okay";

	en25q128@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <10000000>;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			partition@0 {
				label = "Bootloader";
				reg = <0x00 0x30000>;
				read-only;
			};

			partition@30000 {
				label = "Config";
				reg = <0x30000 0x10000>;
				read-only;
			};

			partition@40000 {
				label = "factory";
				reg = <0x40000 0x10000>;
				read-only;
			};

			partition@50000 {
				label = "Recovery";
				reg = <0x50000 0x550000>;
				read-only;
			};

			partition@550000 {
				compatible = "denx,uimage";
				label = "firmware";
				reg = <0x550000 0x1fb0000>;
			};
		};
	};
};

To make it easier this is a ZBT WE826-T with slightly modified firmware.

The WE826-T has been supported for a long time and the OpenWrt firmware works without issue.

Interesting. I never knew that. There's a bunch of brands with that same device apparently when I Googled it.

I just took a look and it seems that the DTS has quite the mismatch with what I'm seeing the the decompiled Mofi DTB file, though. I'm going to keep to what I know, but if something doesn't work, I'll certainly try using that as a fallback for whatever didn't work.

I'm abandoning this project. There's not enough interest from what I've seen, and if I try to push through a PR, it's all bureaucracy. It's not worth the hassle. I got what I want, and that's a working Mofi 5500 target. It compiled just fine, and I've been running that ever since.

For those of you interested in making a 4500 release, I recommend looking into what Dairyman suggested.

Here's the DTS as it currently stands and it compiled in case someone wants to test it.

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT

#include "mt7620a_zbtlink_zbt-we826.dtsi"

/ {
	compatible = "mofinetwork,mofi4500-4gxelte-v3", "ralink,mt7620a-soc";
	model = "MOFI4500-V3";
};

&flash0 {
	broken-flash-reset;
};

&firmware {
	reg = <0x50000 0x1fb0000>;
};

Here's the addition to the /target/linux/ramips/image/mt7620.mk file:

# Do not remove SUPPORTED_DEVICES! The customized Mofi version of OpenWRT (stock firmware) expects
# to see this device name. The stock firmware does not allow for forcing an installation.
# Without this line, users cannot upload the new firmware through the stock Mofi firmware.
define Device/mofinetwork_mofi4500-4gxelte-v3
  $(Device/uimage-lzma-loader)
  SOC := mt7620a
  IMAGE_SIZE := 27656k
  DEVICE_VENDOR := MoFi Network
  DEVICE_MODEL := MOFI4500-4GXeLTE-V3
  DEVICE_PACKAGES := kmod-sdhci kmod-usb-core kmod-usb2
  SUPPORTED_DEVICES += mofi4500-v3
endef
TARGET_DEVICES += mofinetwork_mofi4500-4gxelte-v3

Please note that because the serial port doesn't seem to talk to my FTDI adapter, nor my PL2302 adapter, then I'm not sure that it's enabled. So, I didn't figure out how to send it the initramfs, and therefore could not test it.