Adding OpenWrt support for Linksys EA7500 v2

My dts is very similar to yours

// SPDX-License-Identifier: GPL-2.0
/dts-v1/;

#include "mt7621.dtsi"

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

/ {
	compatible = "linksys,ea7500-v2", "mediatek,mt7621-soc";
	model = "Linksys EA7500 V2";

	chosen {
		bootargs = "console=ttyS0,115200";
	};
	
	aliases {
		led-boot = &status;
		led-failsafe = &status;
		led-running = &status;
		led-upgrade = &status;
	};
	
	leds {
		compatible = "gpio-leds";
		
		status: status {
			label = "ea7500-v2:white:status";
			gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>;
		};

		wan {
			label = "ea7500-v2:green:wan";
			gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
		};

		lan4 {
			label = "ea7500-v2:green:lan4";
			gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
		};

		lan3 {
			label = "ea7500-v2:green:lan3";
			gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
		};

		lan2 {
			label = "ea7500-v2:green:lan2";
			gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
		};

		lan1 {
			label = "ea7500-v2:green:lan1";
			gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
		};

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

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


};

&nand {
	status = "okay";

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

		partition@0 {
			label = "boot";
			reg = <0x0 0x080000>;
			read-only;
		};

		partition@80000 {
			label = "u_env";
			reg = <0x080000 0x040000>;
			read-only;
		};

		factory: partition@c0000 {
			label = "Factory";
			reg = <0x0c0000 0x040000>;
			read-only;
		};

		partition@100000 {
			label = "s_env";
			reg = <0x100000 0x040000>;
			read-only;
		};

		partition@140000 {
			label = "devinfo";
			reg = <0x140000 0x040000>;
			read-only;
		};

		partition@180000 {
			label = "kernel";
			reg = <0x180000 0x400000>; //4MB kernel
		};

		partition@580000 {
			label = "ubi";
			reg = <0x580000 0x2400000>;
		};
		
		partition@2980000 {
			label = "alt_kernel";
			reg = <0x2980000 0x400000>;
			read-only;
		};
		
		partition@2d80000 {
			label = "alt_rootfs";
			reg = <0x2d80000 0x2400000>;
			read-only;
		};
		
		partition@5180000 {
			label = "sysdiag";
			reg = <0x5180000 0x100000>;
			read-only;
		};
	
		partition@5280000 {
			label = "syscfg";
			reg = <0x5280000 0x2d00000>;
			read-only;
		};
	};
};

&pcie {
	status = "okay";
};

&pcie0 {
	mt76@0,0 {
		reg = <0x0000 0 0 0 0>;
		mediatek,mtd-eeprom = <&factory 0x0000>;
	};
};

&pcie1 {
	mt76@0,0 {
		reg = <0x0000 0 0 0 0>;
		mediatek,mtd-eeprom = <&factory 0x8000>;
		ieee80211-freq-limit = <5000000 6000000>;
	};
};

&pinctrl {
	state_default: pinctrl0 {
		gpio {
			ralink,group = "jtag", "uart2", "uart3", "wdt";
			ralink,function = "gpio";
		};
	};
};

BTW, how the driver perform on other 7615 devices? Maybe the driver is not mature enough?

Thanks for the dts info. I'm not able to get the closed source driver to work in my EA7500-AH v2. The driver kept crashing the router. Need to figure out what's missing tho. Will share with all when I get it to work.

Not sure why you are able to get good WiFi range while mine is bad. Will try out your dts and see if it helps.

There is a lot of wifi interference here, so maybe the range I got is not accurate.
Although I get a OK range, the speed (about 50~150 mbps) is too slow to use daily anyway.

I am now trying to get closed source driver on it, you need kernel version 4.14.123 to make it work, otherwise it will cause kernel panic.

I have problem getting the eeprom data to load on the closed source driver (the mac address is all 00).
Now 2.4G work with wrong MAC
I can bring up the 5G interface but I cant see the network on my phone.

Progress update!

I am able to get the 5G wifi working using the closed source driver by changing E2pAccessMode=2 in all of the .dat files locatedin /etc/wireless/mt7615/

and dd the factory partition into /lib/firmware/mt7615.eeprom.bin

Now it seems to be able to read the MAC address from the eeprom and I can connect to 5G wifi

2G wifi works fine however 5G wifi is not stable at all, after some wifi traffic it just drops out completely

[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  36.1 MBytes   303 Mbits/sec                  
[  5]   1.00-2.00   sec  47.0 MBytes   395 Mbits/sec                  
[  5]   2.00-3.00   sec  30.5 MBytes   256 Mbits/sec                  
[  5]   3.00-4.00   sec  0.00 Bytes  0.00 bits/sec                  
[  5]   4.00-5.00   sec  0.00 Bytes  0.00 bits/sec                  
[  5]   5.00-6.00   sec  0.00 Bytes  0.00 bits/sec                  
[  5]   6.00-7.00   sec  0.00 Bytes  0.00 bits/sec                  
[  5]   7.00-8.00   sec  0.00 Bytes  0.00 bits/sec                  
[  5]   8.00-9.00   sec  0.00 Bytes  0.00 bits/sec                  
[  5]   9.00-10.00  sec  0.00 Bytes  0.00 bits/sec                  
[  5]  10.00-11.00  sec  0.00 Bytes  0.00 bits/sec                  
[  5]  11.00-12.00  sec  0.00 Bytes  0.00 bits/sec                  
[  5]  12.00-13.00  sec  0.00 Bytes  0.00 bits/sec                  
[  5]  13.00-14.00  sec  0.00 Bytes  0.00 bits/sec                  
[  5]  13.00-14.00  sec  0.00 Bytes  0.00 bits/sec  
1 Like

Which closed source driver are you using?

This one, now the 5G wifi seems quite Ok, need to test for a little longer for sure

@quarky @farawayso

if you guys are willing to test, I have a pre-compiled firmware using driver from mtk-openwrt-feed.

I tested initramfs and factory.bin using tftp they boot without problem, wifi signal and speed is fine for me, use at your own risk though.

UPDATE: the new version use a script to dd the factory partition to the respective eeprom.bin files, and patched the mac address during the first boot.

Now the Mac address for 5G wifi is correct, but mac address for 2G wifi is still not correct, I will try to fix that

I tested the 5G wifi for ~1 hours, so far so good

UPDATE2: Fixed lan and wan mac

Ea7500v2 is my only Router. And I do not want try it now until the openwrt is supposed. I can only flash by breed boot or another boot.

1 Like

I tried your image. It loads, with 4 new WiFi interfaces created. I'll try to build my own. So it looks like must use 4.14.123. I was trying with whatever that had been configured in the master branch.

Thanks for sharing your image.

1 Like

Thanks for testing!

You need to create a script to dd the factory partition to create two eeprom files and patch the Mac address during the first boot. (see my script at /etc/init.d/wifieeprom)

Unfortunately I don't have this router anymore. So I can't make any further progress, but the state of my build is quite usable according to my limited testing.

Btw, for the open source driver, I don't think we made a mistake configuring it, I think it is because the driver is not mature enough, because other mt7615 devices are facing the same problem.

Would you mind sharing your source codes? I just can’t get my build to run with the closed source driver. Kept crashing my router.

Here you are: https://drive.google.com/file/d/1rPOK7eFFm_ZJm62wg7Ezssg7fhG7eG6p/view?usp=sharing

Sorry for not using github....

update:sorry for the wrong link

Oops.... Sorry for the wrong link.....
Link updated

Also on github: https://github.com/jackcolentern/openwrt-linksys-ea7500v2

Great! Thanks for sharing!

1 Like

Also can you help me confirm that the wired connection (including Mac address for lan and wan) works on my build? I dont longer have the router so I cant test it. Thanks!

Wired connection for LAN and WAN appears fine. I'm able to connect to the router via LAN and router can access internet via WAN. WiFi devices also can access Internet.

I'm now trying to make my own build runs properly. Seems harder than I anticipated.

Edit:
MAC addresses properly need more work. WAN (eth0.1) interface and the br-lan bridge interface have correct MAC addresses. The eth0 interface on the other hand appears to use a randomly generated MAC address. WiFi interfaces MAC address appears correct.

1 Like

Thanks for the report!

What problem are you facing when you try to build?

Kernel kept panicking when I try to bring up the wireless interface.

Are you using the src from mtk-openwrt-feeds?

Yes, using the mtk-openwrt-feeds. Still trying to figure out what's the different between yours and mine. I started off using the latest master version, which is based on 4.14.132. Now trying 4.14.123.