Skip to content

airoha: add support for Gemtek W1701K - #20430

Open
aiamadeus wants to merge 2 commits into
openwrt:mainfrom
aiamadeus:airoha
Open

aiamadeus wants to merge 2 commits into
openwrt:mainfrom
aiamadeus:airoha

Conversation

@aiamadeus

Copy link
Copy Markdown
Contributor

Hardware specification:

SoC:     Airoha AN7581
RAM:     2GB DDR4 2666MHz
Flash:   512MB W25N04KV
ETH:     2x 2.5G EN8811H
WLAN:    MT7996AV BE19000
WLAN1:   MT7975N 2.4GHz 4x4
WLAN2:   MT7977BN 5GHz 4x5
WLAN3:   MT7977AN 6GHz 4x5
PWM FAN: Nuvoton NCT7511Y
Power:   100-240V AC 1.2A
Button:  Reset

Flash instructions:

  1. Download the initramfs image, rename it to
    initramfs.itb, host it with the tftp server.
  2. Connect to the router through the right Lan port,
    set a static ip of your PC. (ip 192.168.0.205)
  3. Interrupt U-Boot and run these commands:
setenv bootflag 0
setenv one flash read 0x600000 0x1000000 \$loadaddr
setenv two "; bootm"
setenv bootcmd "$one$two"
setenv one
setenv two
saveenv
  1. Reboot and interrupt U-Boot again, then run:
tftpboot 0x89000000 initramfs.itb
bootm
  1. After openwrt boots up, use scp or luci web
    to upload sysupgrade.bin to upgrade.

Note:

  1. Flash partition is based on pr airoha: add support for Gemtek W1700K #17869.
  2. Flash instructions is based on pr airoha: add support for Gemtek W1700K #17869.

@github-actions github-actions Bot added core packages pull request/issue for core (in-tree) packages target/airoha pull request/issue for airoha target labels Oct 17, 2025
@aiamadeus

Copy link
Copy Markdown
Contributor Author

Known issues:
Sometimes eth2 (gdm4) pcs don't work.

[  172.001881] airoha-pcs 1fa09000.pcs: No FBCK Lock from FreqDet module after 50 calibration try. PCS won't work.
[  172.011990] airoha_eth 1fb50000.ethernet eth2: pcs_config failed: -EIO

@danpawlik

Copy link
Copy Markdown
Contributor

Wondering why you enable npu and #17869 in w1700k @andrewjlamarche did not...

@aiamadeus

Copy link
Copy Markdown
Contributor Author

Wondering why you enable npu and #17869 in w1700k did not...

Maybe you misread it? NPU is not enabled now because the firmware failed to load:

[    5.883020] airoha-npu 1e900000.npu: Direct firmware load for airoha/en7581_npu_rv32.bin failed with error -2

status = "disabled";
};

&mdio {

@OpenWRT-fanboy OpenWRT-fanboy Oct 17, 2025 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

compile error... need to change to mdio: mdio { in an7581.dtsi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

fixed by commit 26da4bf

#address-cells = <1>;
#size-cells = <0>;

led@0 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add triggers in the 01_leds file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The LEDs have default modes.
Green in act mode and Amber in link mode.

@@ -0,0 +1,19 @@
--- a/mt7996/eeprom.c

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add missing patch header.

status = "okay";

/* NCT7511Y */
hwmon@2e {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing kmod-hwmon-nct7802 module. Fan control works on this device?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It can only be controlled manually. I will add this later.

@abajk

abajk commented Oct 18, 2025

Copy link
Copy Markdown
Contributor
[    5.883020] airoha-npu 1e900000.npu: Direct firmware load for airoha/en7581_npu_rv32.bin failed with error -2

Maybe the NPU driver is loaded before rootfs is mounted?

@hurrian

hurrian commented Oct 19, 2025

Copy link
Copy Markdown
Contributor
[    5.883020] airoha-npu 1e900000.npu: Direct firmware load for airoha/en7581_npu_rv32.bin failed with error -2

Maybe the NPU driver is loaded before rootfs is mounted?

NPU driver is supposed to call -EPROBE_DEFER if the NPU firmware isn't found, so it's probably something else 🤔

@Ansuel

Ansuel commented Oct 20, 2025

Copy link
Copy Markdown
Member

@aiamadeus the calibration fail looks strange... I wonder if the bootloader is messing with some values... Can you dump some register by chance?

@testuser7

Copy link
Copy Markdown
Contributor

@aiamadeus Can this model be powered directly from 12V somehow?

@aiamadeus

Copy link
Copy Markdown
Contributor Author

Can this model be powered directly from 12V somehow?

@testuser7 Yes, this requires modification. If you remove the case, you will
find a voltage converter board. Remove it and connect 12V to the socket.
In fact @libiunc already does this.

@aiamadeus

Copy link
Copy Markdown
Contributor Author

I wonder if the bootloader is messing with some values...

Makes sense, only eth2 (gdm4) works under stock u-boot.

Can you dump some register by chance?

@Ansuel Under stock firmware or openwrt?

@Ansuel

Ansuel commented Oct 23, 2025

Copy link
Copy Markdown
Member

openwrt.

@aiamadeus

Copy link
Copy Markdown
Contributor Author

Can you dump some register by chance?

Do you have a script to dump which registers?

@bmork

bmork commented Dec 19, 2025

Copy link
Copy Markdown
Contributor

Sorry for hijacking your closed PR @aiamadeus , but I just noticed your attempt to fix mixed FEM detection for MT7996.

Turns out I have the same issue. But to complicate things, I have an almost identical device without mixed iFEM/eFEM too. So I need to solve both cases.

After having stared at the frontend detection code and eeprom logic in the mt7996 part of the mt76 driver for a while, my feeling is that this is a mess. There's testing for an arbitrary subset of frontend combinations in mt7996_variant_fem_init(). Which combinations can exist and are supported is not documented. It's hidden behind very convoluted code and magic numbers from datasheets we don't have access to. But from these devices in the wild it is clear that the subset is incomplete.

The buggy detection code would not have mattered so much if it was only used for selecting a default eeprom file. But the invalid frontend information is used to validate the eeprom data provided to the driver from nvmem. Causing the driver to reject the properly matched eeprom data and use an arbitrary and completely wrong default instead.

This makes absolutely no sense. But it's hard for anyone outside Mediatek to clean it up properly, since we don't have complete insight in the frontend configurations. I think it would be best to remove as much as possible of the eeprom validation code. It's more harmful than useful when the input parameters can't be trusted.

What do you think?

@aiamadeus

Copy link
Copy Markdown
Contributor Author

@bmork That's what I thought too, so initially I simply removed the fem
check from the mt7996_eeprom_variant_valid function. The problem is,
I think the maintainers won't accept this change.

Some devices use internal FEM for 2.4G and external FEM for 5G.
Currently, MT76 does not allow this type of configuration, which
results in the device's eeprom not being able to load:

mt7996e 0000:01:00.0: eeprom load fail, use default bin
mt7996e 0000:01:00.0: Message 0012002d (seq 5) timeout

Fixed the mixed FEM check to load EEPROM correctly.

Signed-off-by: Chukun Pan <[email protected]>
This commit adds support for Quantum Fiber W1701K.

Hardware specification:
  SoC:     Airoha AN7581
  RAM:     2GB DDR4 2666MHz
  Flash:   512MB W25N04KV
  ETH:     2x 2.5G EN8811H
  WLAN:    MT7996AV BE19000
  WLAN1:   MT7975N 2.4GHz 4x4
  WLAN2:   MT7977BN 5GHz 4x5
  WLAN3:   MT7977AN 6GHz 4x5
  PWM FAN: Nuvoton NCT7511Y
  Power:   100-240V AC 1.2A
  Button:  Reset

Flash instructions:
  1. Download the initramfs image, rename it to
     initramfs.itb, host it with the tftp server.

  2. Connect to the router through the right Lan port,
     set a static ip of your PC. (ip 192.168.0.205)

  3. Interrupt U-Boot and run these commands:

      setenv bootflag 0
      setenv one flash read 0x600000 0x1000000 \$loadaddr
      setenv two "; bootm"
      setenv bootcmd "$one$two"
      setenv one
      setenv two
      saveenv

  4. Reboot and interrupt U-Boot again, then run:

      tftpboot 0x89000000 initramfs.itb
      bootm

  5. After openwrt boots up, use scp or luci web
     to upload sysupgrade.bin to upgrade.

Note:
  1. Flash partition is based on pr 17869.
  2. Flash instructions is based on pr 17869.

Signed-off-by: Chukun Pan <[email protected]>
@hurrian

hurrian commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

As this device has the same BMT/BBT issue as the W1700K and XR1710G, please convert this device to UBI.

@libiunc libiunc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's time to merge. It tested successfully on my device, and EIP93 works correctly. #20130

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Commit checks

  • c1ea287 "mt76: fix mixed FEM detection for MT7996" — the message says the mixed FEM check was fixed, but the diff doesn't touch the FEM_MIX detection (adie_id == 0x7977 && adie_comb == 1). It changes the ADIE chip-ID index (adie_idx = 0 → 1) for MT7996 and adds a debug print. Please align the subject/body with what the diff actually does (selecting a different ADIE for chip-ID readout), since "mixed FEM check" describes a different code path. See the inline note on the treewide impact of the adie_idx change.

Generated by Claude Code

adie_comb = u32_get_bits(val, MT_PAD_GPIO_ADIE_COMB_7992);
} else {
- adie_idx = 0;
+ adie_idx = 1;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This else branch is taken for every MT7996 device (everything that is not MT7992), so forcing adie_idx = 1 here changes ADIE chip-ID detection for all MT7996 boards, not just the W1701K. The original code reads the chip ID from ADIE index 0; on a board where only ADIE 0 is populated, mt7996_mcu_rf_regval(dev, MT_ADIE_CHIP_ID(1), ...) would read the wrong (or absent) ADIE and could mis-detect the FEM type or fail. Can you confirm this doesn't regress single-ADIE MT7996 devices? If the right ADIE index is board-specific, a conditional keyed on the variant would be safer than flipping the default for the whole driver.


Generated by Claude Code

@@ -0,0 +1,24 @@
--- a/mt7996/init.c

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: this patch has no header. OpenWrt patches should carry a descriptive header (subject + explanation, ideally a Signed-off-by) above the ---/+++ lines. This was already requested earlier in the thread; the rename from -remove-eeprom-valid to -fix-eeprom-valid kept the headerless form.


Generated by Claude Code

};

&mdio {
phy14: ethernet-phy@14 {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

phy14 (and phy15 below) omit the compatible property. The EN8811H is a Clause-45 PHY; other in-tree EN8811H nodes declare it explicitly, e.g. an7581-nokia_xg-040g-md-common.dtsi:170-171,`` and the sibling W1700K's phy5/phy8 do too. Without it the MDIO bus may scan these PHYs as C22 and fail to read the C45 PHY ID, so the kmod-phy-airoha-en8811h driver may not bind. Add the compatible to both nodes:

Suggested change
phy14: ethernet-phy@14 {
phy14: ethernet-phy@14 {
compatible = "ethernet-phy-ieee802.3-c45";
reg = <14>;

Generated by Claude Code

endef
TARGET_DEVICES += gemtek_w1700k-ubi

define Device/gemtek_w1701k

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: this PR adds a new device (new .dts + new define Device/...), so per the project's new-device commit-message convention the introducing commit should include a MAC address layout section in addition to the Hardware specification and Flash instructions it already has. Please document where each interface's MAC comes from (e.g. LAN/WAN from lan_mac/wan_mac in the dsd partition via the ascii-eq-delim-env layout, WiFi from lan_mac 1), one line per interface, using xx:xx:xx for the unit-specific bytes.


Generated by Claude Code

@qwertzou

Copy link
Copy Markdown

As this device has the same BMT/BBT issue as the W1700K and XR1710G, please convert this device to UBI.

W1701K followed the tutorial to write openwrt-airoha-an7581-gemtek_xr1710g-ubi-chainload-uboot successfully and started ubi-chainload-uboot. With your TFTP server, ensure you are serving the installer as openwrt-airoha-an7581-gemtek_w1700k-ubi-initramfs-installer.itb
Press UP/DOWN to move, ENTER to select, ESC to quit
Using ethernet@1fb50000 device
TFTP from server 192.168.1.10; our IP address is 192.168.1.1
Filename 'openwrt-airoha-an7581-gemtek_xr1710g-ubi-initramfs-installer.itb'.
Load address: 0x89000000
Loading: *
ARP Retry count exceeded; starting again
Unknown command 'askenv' - try 'help'
Use ping:
U-Boot> ping 192.168.1.1
Using ethernet@1fb50000 device

ARP Retry count exceeded; starting again
ping failed; host 192.168.1.1 is not alive
U-Boot> ping 192.168.1.1
Using ethernet@1fb50000 device

ARP Retry count exceeded; starting again
ping failed; host 192.168.1.1 is not alive

U-Boot> version
U-Boot 2026.01-OpenWrt-r34154-35e3ed74fe (Apr 25 2026 - 02:23:42 +0000)

aarch64-openwrt-linux-musl-gcc (OpenWrt GCC 14.3.0 r34154-35e3ed74fe) 14.3.0
GNU ld (GNU Binutils) 2.44

I have verified that the TFTP server is normal

@libiunc

libiunc commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

As this device has the same BMT/BBT issue as the W1700K and XR1710G, please convert this device to UBI.

W1701K followed the tutorial to write openwrt-airoha-an7581-gemtek_xr1710g-ubi-chainload-uboot successfully and started ubi-chainload-uboot. With your TFTP server, ensure you are serving the installer as openwrt-airoha-an7581-gemtek_w1700k-ubi-initramfs-installer.itb Press UP/DOWN to move, ENTER to select, ESC to quit Using ethernet@1fb50000 device TFTP from server 192.168.1.10; our IP address is 192.168.1.1 Filename 'openwrt-airoha-an7581-gemtek_xr1710g-ubi-initramfs-installer.itb'. Load address: 0x89000000 Loading: * ARP Retry count exceeded; starting again Unknown command 'askenv' - try 'help' Use ping: U-Boot> ping 192.168.1.1 Using ethernet@1fb50000 device

ARP Retry count exceeded; starting again ping failed; host 192.168.1.1 is not alive U-Boot> ping 192.168.1.1 Using ethernet@1fb50000 device

ARP Retry count exceeded; starting again ping failed; host 192.168.1.1 is not alive

U-Boot> version U-Boot 2026.01-OpenWrt-r34154-35e3ed74fe (Apr 25 2026 - 02:23:42 +0000)

aarch64-openwrt-linux-musl-gcc (OpenWrt GCC 14.3.0 r34154-35e3ed74fe) 14.3.0 GNU ld (GNU Binutils) 2.44

I have verified that the TFTP server is normal

TFTP will only succeed after the initial startup and proper network configuration. Any subsequent TFTP operations will fail.

@qwertzou

qwertzou commented Jul 12, 2026 •

Copy link
Copy Markdown

As this device has the same BMT/BBT issue as the W1700K and XR1710G, please convert this device to UBI.

W1701K followed the tutorial to write openwrt-airoha-an7581-gemtek_xr1710g-ubi-chainload-uboot successfully and started ubi-chainload-uboot. With your TFTP server, ensure you are serving the installer as openwrt-airoha-an7581-gemtek_w1700k-ubi-initramfs-installer.itb Press UP/DOWN to move, ENTER to select, ESC to quit Using ethernet@1fb50000 device TFTP from server 192.168.1.10; our IP address is 192.168.1.1 Filename 'openwrt-airoha-an7581-gemtek_xr1710g-ubi-initramfs-installer.itb'. Load address: 0x89000000 Loading: * ARP Retry count exceeded; starting again Unknown command 'askenv' - try 'help' Use ping: U-Boot> ping 192.168.1.1 Using ethernet@1fb50000 device

ARP Retry count exceeded; starting again ping failed; host 192.168.1.1 is not alive U-Boot> ping 192.168.1.1 Using ethernet@1fb50000 device

ARP Retry count exceeded; starting again ping failed; host 192.168.1.1 is not alive

U-Boot> version U-Boot 2026.01-OpenWrt-r34154-35e3ed74fe (Apr 25 2026 - 02:23:42 +0000)

aarch64-openwrt-linux-musl-gcc (OpenWrt GCC 14.3.0 r34154-35e3ed74fe) 14.3.0 GNU ld (GNU Binutils) 2.44

I have verified that the TFTP server is normal,vendor U-boot tftpboot is effective

image

@qwertzou

Copy link
Copy Markdown

As this device has the same BMT/BBT issue as the W1700K and XR1710G, please convert this device to UBI.

W1701K followed the tutorial to write openwrt-airoha-an7581-gemtek_xr1710g-ubi-chainload-uboot successfully and started ubi-chainload-uboot. With your TFTP server, ensure you are serving the installer as openwrt-airoha-an7581-gemtek_w1700k-ubi-initramfs-installer.itb Press UP/DOWN to move, ENTER to select, ESC to quit Using ethernet@1fb50000 device TFTP from server 192.168.1.10; our IP address is 192.168.1.1 Filename 'openwrt-airoha-an7581-gemtek_xr1710g-ubi-initramfs-installer.itb'. Load address: 0x89000000 Loading: * ARP Retry count exceeded; starting again Unknown command 'askenv' - try 'help' Use ping: U-Boot> ping 192.168.1.1 Using ethernet@1fb50000 device
ARP Retry count exceeded; starting again ping failed; host 192.168.1.1 is not alive U-Boot> ping 192.168.1.1 Using ethernet@1fb50000 device
ARP Retry count exceeded; starting again ping failed; host 192.168.1.1 is not alive
U-Boot> version U-Boot 2026.01-OpenWrt-r34154-35e3ed74fe (Apr 25 2026 - 02:23:42 +0000)
aarch64-openwrt-linux-musl-gcc (OpenWrt GCC 14.3.0 r34154-35e3ed74fe) 14.3.0 GNU ld (GNU Binutils) 2.44
I have verified that the TFTP server is normal

TFTP will only succeed after the initial startup and proper network configuration. Any subsequent TFTP operations will fail.

ubi-installer How to upload OpenWrt firmware?

@hurrian

hurrian commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

The only physical ethernet ports on this device are the 2.5G ports and the chainloader doesn't (yet) support MDIO.

@OpenWRT-fanboy

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core packages pull request/issue for core (in-tree) packages target/airoha pull request/issue for airoha target

Projects

None yet

Development

Successfully merging this pull request may close these issues.