Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ramips: add Wavlink WL-WN572HG3 router #15179

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ianchi
Copy link
Contributor

@ianchi ianchi commented Apr 17, 2024

Adds support for Wavlink AC 1200 (WL-WN572HG3) router.

Thanks to varu for a lot of work.
See furum thread.

Specifications:

  • Soc: MT7620A
  • RAM: 64MiB
  • Flash: NOR 8MiB GD25Q64B
  • Wi-Fi:
    • MT7612E: 5GHz
    • MT7620A: 2.4GHz
  • Ethernet: 1x 10/100Mb LAN + 1x 1Gb-WAN
  • USB: 1x 2.0 - only used internally
  • UART: 57600, 8N1
  • LEDs:
    • 7 blue at the front
      • 1 Power (fixed)
      • 2 LAN / WAN
      • 2 WIFI 2.4 / 5 (annotated wifi/low)
      • 2 Status: running / boot,failsafe (annotated mid/high)
  • Buttons: 1 reset button
  • POE: Passive 24 VDC, 0.5 A

Installation:

  • Set host computer's ip to 192.168.10.100
  • save sysupgrade image file as 'firmware.bin'
  • setup tftp server on computer, serving the file from root
  • connect your computer to the LAN port of the WAVLINK router via an Ethernet cable
  • press and hold the reset button while powering on the router
  • keep it pressed for ten seconds
  • wait for firmware to be uploaded

@github-actions github-actions bot added the target/ramips pull request/issue for ramips target label Apr 17, 2024
@namiltd
Copy link
Contributor

namiltd commented Apr 17, 2024

No specifications, installation method, etc. in the commit description.

In the definition of LEDs the label is deprecated, use color/function instead.

@ianchi ianchi force-pushed the WL-WN572HG3 branch 2 times, most recently from e835e8f to 3e556d3 Compare April 20, 2024 23:14
@ianchi ianchi force-pushed the WL-WN572HG3 branch 2 times, most recently from 01d9444 to 93a56c2 Compare April 20, 2024 23:21
@namiltd
Copy link
Contributor

namiltd commented Apr 21, 2024

The MT7620A (MT7530WU) chip is only 100Mb/s so it should be:
- Ethernet: 1x 10/100Mb LAN + 1x 10/100Mb-WAN

@ianchi
Copy link
Contributor Author

ianchi commented Apr 21, 2024

@namiltd, I too initally thought it should be 10/100Mbps. But I've run an iperf3 test and I get higher than 100Mbps.
And when I connect the wavlink to another router with Owrt in both a get an eth link of 1000.

That is why I believe WAN should be 1G.

I googled it and found some references in this same direction:

wavlinkstore
WN572HG3 support Router/ AP/ Repeater mode; 1x 10/100Mbps LAN; 1x 10/100/1000Mbps WAN

iperf3

[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   456 MBytes   382 Mbits/sec    0             sender
[  5]   0.00-10.01  sec   456 MBytes   382 Mbits/sec                  receiver

I think it tops by cpu

wavlink side

Port 4:
        mib: Port 4 MIB counters
TxGPC      : 62202
TxBOC      : 0
TxGOC      : 510012026
TxEPC      : 0
RxGPC      : 11612
RxBOC      : 0
RxGOC      : 167233383
RxEPC1     : 0
RxEPC2     : 49

        enable_mirror_rx: 0
        enable_mirror_tx: 0
        pvid: 1
        link: port:4 link:up speed:1000baseT full-duplex

router upstream from WAN

Port 4:
        mib: MIB counters
RxGoodByte  : 510245338 (486.6 MiB)
TxByte      : 174175541 (166.1 MiB)

        enable_eee: 0
        igmp_snooping: 0
        vlan_prio: 0
        pvid: 1
        link: port:4 link:up speed:1000baseT full-duplex txflow rxflow auto

@namiltd
Copy link
Contributor

namiltd commented Apr 21, 2024

It's ok, the router has an additional Realtek chip (RTL8211F) connected via rgmii on port4.

What is the effect after enabling pa_gpio?

The name of the router is WL-WN572HG3, not WL-572HG3.
According to OEM boot logo from the website https://openwrt.org/inbox/toh/wavlink/wavlink_ac1200

LAN 80:3f:5d:b7:58:8f
WAN 80:3f:5d:b7:58:90
WLAN2 80:3f:5d:b7:58:91
WLAN5 80:3f:5d:b7:58:92

for compatibility this means:

&ethernet {
	pinctrl-names = "default";
	pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>;

	nvmem-cells = <&macaddr_factory_28 (-2)>;
	nvmem-cell-names = "mac-address";
...
...
&pcie0 {
	mt76@0,0 {
		compatible = "mediatek,mt76";
		reg = <0x0000 0 0 0 0>;
		ieee80211-freq-limit = <5000000 6000000>;

		nvmem-cells = <&eeprom_radio_8000>, <&macaddr_rom_f100 1>;
		nvmem-cell-names = "eeprom", "mac-address";

	};
};

&wmac {
	pinctrl-names = "default", "pa_gpio";
	pinctrl-0 = <&pa_pins>;
	pinctrl-1 = <&pa_gpio_pins>;

	nvmem-cells = <&eeprom_radio_0>, <&macaddr_rom_f100 0>;
	nvmem-cell-names = "eeprom", "mac-address";
};

Log also confirms eLNA: [ 14.688000] [7620]:20-E2P[0x36]:(c004),EXT LNA|PA on!

@ianchi
Copy link
Contributor Author

ianchi commented Apr 21, 2024

Hi @namiltd, with the current config I already get mac address with the same increasing sequence, and the same mac addresses I used to have.

Current DTS maps firmware address 0x28 for eth
in 02_network we map 0x2e for wan (which has a mac of +1 from eth mac)
For wireless the eeprom already has the correct mac address (offset 4 of the eeprom), which are at +2 and +3 from eth

I don't think we need to offset -2 eth and remap wlan mac-address

MTD Firmware

# WAN
root@OpenWrt:~# dd if=/dev/mtdblock2 bs=1 count=6 skip=46 | hexdump -C
00000000  80 3f 5d XX YY 54                                 

# ETH LAN
root@OpenWrt:~# dd if=/dev/mtdblock2 bs=1 count=6 skip=40 | hexdump -C
00000000  80 3f 5d XX YY 53                                 

# EEPROM 5G
root@OpenWrt:~# dd if=/dev/mtdblock2 bs=1 count=6 skip=32772 | hexdump -C
00000000  80 3f 5d XX YY 56                                 

# EEPROM 2.4G
root@OpenWrt:~# dd if=/dev/mtdblock2 bs=1 count=6 skip=4 | hexdump -C
00000000  80 3f 5d XX YY 55                                

Original

LAN 80:3f:5d:XX:YY:53
WAN 80:3f:5d:XX:YY:54

Current Openwrt build

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP qlen 1000
    link/ether 80:3f:5d:XX:YY:53 brd ff:ff:ff:ff:ff:ff
4: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether 80:3f:5d:XX:YY:53 brd ff:ff:ff:ff:ff:ff
5: eth0.1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP qlen 1000
    link/ether 80:3f:5d:XX:YY:53 brd ff:ff:ff:ff:ff:ff
6: eth0.2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether 80:3f:5d:XX:YY:54 brd ff:ff:ff:ff:ff:ff
7: phy1-ap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP qlen 1000
    link/ether 80:3f:5d:XX:YY:55 brd ff:ff:ff:ff:ff:ff
8: phy0-ap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP qlen 1000
    link/ether 80:3f:5d:XX:YY:56 brd ff:ff:ff:ff:ff:ff

@namiltd
Copy link
Contributor

namiltd commented Apr 21, 2024

In my opinion, the code is almost ready for commit. It only requires changing the router name in the commit title and description (to WL-WN572HG3).

@ianchi
Copy link
Contributor Author

ianchi commented Apr 21, 2024

Updated model.

@ianchi ianchi changed the title ramips: add Wavlink WL-572HG3 router ramips: add Wavlink WL-WN572HG3 router Apr 22, 2024
@ianchi
Copy link
Contributor Author

ianchi commented Apr 23, 2024

Hi @namiltd, I was reviewing the bootlog, and there are some warnings in the MTD partitions that I need some help with.

Some regarding bad cell count on dts-tree partitions. The other regarding erase block boundaries.

[    1.208090] spi spi0.0: force spi mode3
[    1.216717] spi-nor spi0.0: gd25q64 (8192 Kbytes)
[    1.226348] 6 fixed-partitions partitions found on MTD device spi0.0
[    1.239083] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[    1.253695] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[    1.268598] Creating 6 MTD partitions on "spi0.0":
[    1.278197] 0x000000000000-0x000000030000 : "u-boot"
[    1.291710] 0x000000030000-0x000000040000 : "config"
[    1.303133] 0x000000040000-0x000000050000 : "factory"
[    1.317150] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[    1.332164] 0x000000050000-0x0000007e0000 : "firmware"
[    1.345596] 2 uimage-fw partitions found on MTD device firmware
[    1.357496] Creating 2 MTD partitions on "firmware":
[    1.367403] 0x000000000000-0x00000024e6a9 : "kernel"
[    1.377317] mtd: partition "kernel" doesn't end on an erase/write block -- force read-only
[    1.395229] 0x00000024e6a9-0x000000790000 : "rootfs"
[    1.405226] mtd: partition "rootfs" doesn't start on an erase/write block boundary -- force read-only
[    1.427098] mtd: setting mtd5 (rootfs) as root device
[    1.437375] 1 squashfs-split partitions found on MTD device rootfs
[    1.449717] 0x0000005e0000-0x000000790000 : "rootfs_data"
[    1.461914] 0x0000007e0000-0x0000007f0000 : "board_data"
[    1.476175] 0x0000007f0000-0x000000800000 : "nvram"
```

@namiltd
Copy link
Contributor

namiltd commented Apr 23, 2024

This is just a warning which you can ignore completely or change the code by adding two lines so it doesn't appear:

&spi0 {
	status = "okay";

	flash@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <24000000>;
		#address-cells = <1>;
		#size-cells = <1>;

@ianchi
Copy link
Contributor Author

ianchi commented Apr 24, 2024

Understood.
I would like to remove the warning, but I see every other device with this soc has the same definition without de cells.
So I'll leave it to be consistent with the rest

@ianchi
Copy link
Contributor Author

ianchi commented Apr 28, 2024

Hi,anything else to merge this PR?

Adds support for Wavlink AC 1200 (WL-WN572HG3) router.

Specifications:
* Soc: MT7620A
* RAM: 64MiB
* Flash: NOR 8MiB GD25Q64B
* Wi-Fi:
  * MT7612E: 5GHz
  * MT7620A: 2.4GHz
* Ethernet: 1x 10/100Mb LAN + 1x 1Gb-WAN
* USB: 1x 2.0 - only used internally
* UART: 57600, 8N1
* LEDs:
  * 7 blue at the front
    * 1 Power (fixed)
    * 2 LAN / WAN
    * 2 WIFI 2.4 / 5 (annotated wifi/low)
    * 2 Status: running / boot,failsafe (annotated mid/high)
* Buttons: 1 reset button
* POE: Passive 24 VDC, 0.5 A

Installation:
* Set host computer's ip to 192.168.10.100
* save sysupgrade image file as 'firmware.bin'
* setup tftp server on computer, serving the file from root
* connect your computer to the LAN port of the WAVLINK router via an Ethernet cable
* press and hold the reset button while powering on the router
* keep it pressed for ten seconds
* wait for firmware to be uploaded

Signed-off-by: Adrian Panella <ianchi74@outlook.com>
@ianchi
Copy link
Contributor Author

ianchi commented May 1, 2024

Updated leds and tested.
Working fine.

@ianchi ianchi requested a review from hauke May 4, 2024 01:50
@ianchi
Copy link
Contributor Author

ianchi commented May 12, 2024

Hi @hauke/@namiltd
anything else left to merge this?

Copy link
Contributor

@DragonBluep DragonBluep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing label_mac?

read-only;
};

factory: partition@40000 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
factory: partition@40000 {
partition@40000 {

mediatek,fixed-link = <1000 1 1 1>;
};


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove duplicated new line.

reg = <4>;
phy-mode = "rgmii";
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove new line.


&ethernet {
pinctrl-names = "default";
pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>;
pinctrl-0 = <&rgmii2_pins>, <&mdio_pins>;

};

&pcie0 {
mt76@0,0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
mt76@0,0 {
wifi@0,0 {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
target/ramips pull request/issue for ramips target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants