Skip to content

ramips: mt7620: add RGMII1 DSA and D-Link DAP-1620 A2 support - #25022

Open
Boilerplate4u wants to merge 2 commits into
openwrt:mainfrom
Boilerplate4u:dap1620-dsa-pr-v1
Open

Boilerplate4u wants to merge 2 commits into
openwrt:mainfrom
Boilerplate4u:dap1620-dsa-pr-v1

Conversation

@Boilerplate4u

@Boilerplate4u Boilerplate4u commented Sep 4, 2026 •

Copy link
Copy Markdown

Summary

Add DSA support for the external RGMII1 interface on MT7620 switch port 5 and use it to add support for the D-Link DAP-1620 A2.

This PR contains two commits: the generic MT7620 DSA/RGMII1 change and DAP-1620 A2 device support, including the device-specific LED service.

MT7620 RGMII1 support

MT7620 switch port 5 is the external MAC exposed through RGMII1. The DSA driver supports internal user ports 0-4 and CPU port 6, but does not support external port 5.

Add phylink capabilities and MAC configuration for port 5 and add mt7620_gsw_config_rgmii1() to configure the interface from the DSA MAC configuration callback while keeping the legacy mt7620_port_init() path unchanged.

The DAP-1620 A2 uses rgmii-id. For the RGMII *ID modes, the PHY supplies the requested internal delays while the MT7620 MAC-side delays remain disabled. Leave RX_SKEW unchanged.

The helper also contains MII and RMII interface handling, but these modes are outside the tested DAP-1620 A2 device path and are not changed further as part of this work.

Derive the CPU forwarding matrix from the actual DSA user ports, allowing traffic between external port 5 and CPU port 6.

Include port 5 in fast MIB polling while linked at 1 Gbps. The hardware packet counters are only 16 bits, requiring frequent sampling to extend them in software without missing wraps.

Track negotiated Gigabit state separately from administratively enabled ports through mib_gige_ports. Request a 20 ms polling interval for CPU port 6 and Gigabit port 5, with all ports sampled every tenth tick. These are requested scheduling intervals, not guaranteed deadlines. Slower or down external links use the normal full-port polling cadence.

Keep the explicit interval resets when polling is stopped and restarted. The fast-polling selection is limited to CPU port 6 and external port 5 and must be revisited if support for additional Gigabit user ports is added.

Use a single DSA-local definition, MT7620_DSA_EXTERNAL_PORT, for external port 5.

The legacy swconfig path remains unchanged. PPE hardware flow offload is outside this PR's scope.

D-Link DAP-1620 A2

The D-Link DAP-1620 A2 is a dual-band Wi-Fi range extender with one Gigabit Ethernet port.

Hardware:

  • MediaTek MT7620A, 580 MHz
  • 64 MiB RAM
  • 8 MiB SPI NOR flash
  • Integrated MT7620 2.4 GHz Wi-Fi
  • MediaTek MT7612E 5 GHz 802.11ac radio over PCIe
  • Realtek RTL8211E Gigabit Ethernet PHY
  • Reset and WPS buttons
  • Red/green status LED and three signal-strength indicators

Connect the RTL8211E at MDIO address 1 to DSA user port 5 through RGMII1. Use rgmii-id so the PHY supplies both internal clock delays while the MT7620 MAC-side delays remain disabled. Describe port 6 as the fixed 1 Gbps full-duplex CPU connection.

Select kmod-mt76x2, kmod-phy-realtek, kmod-dsa-mt7620 and the device-specific dap1620-leds service. Drop swconfig and rssileds, and configure the DSA lan interface as the default LAN.

Flash layout, with exclusive end addresses:

  • U-Boot: 0x000000-0x030000
  • NVRAM: 0x030000-0x040000
  • Factory: 0x040000-0x050000
  • Firmware: 0x050000-0x800000

Calibration and MAC addresses:

  • 2.4 GHz calibration: factory + 0x0000
  • 5 GHz calibration: factory + 0x8000
  • Ethernet MAC: factory + 0xffe8
  • 2.4 GHz MAC: Ethernet MAC incremented by 1
  • 5 GHz MAC: factory + 0xffd4

Preserve U-Boot, NVRAM and factory data as read-only partitions. The MAC increment changes the address value, not the flash offset.

Flash constraints

U-Boot, NVRAM and factory data occupy the first 320 KiB of the 8 MiB flash. The firmware partition is limited to 7872 KiB, or 8,060,928 bytes.

The separately built AP test profile excludes these PPP and PPPoE packages:

  • ppp
  • kmod-ppp
  • ppp-mod-pppoe
  • kmod-pppoe
  • kmod-pppox
  • kmod-slhc
  • luci-proto-ppp

It includes luci-light, dap1620-leds and kmod-dsa-mt7620. rssileds and WPS functionality are not included.

The verified AP build artifacts were built from commit 60a9fbe8dc19a666bfa8a1c0ae846e8579d2af1c:

  • Sysupgrade: dap1620-20260909-aa0bbbb2-ap-no-ppp-sysupgrade.bin
    • Size: 7,078,166 bytes
    • SHA256: e3b9a5861a8b458ce6ff540f052b089cb4d274be84d0d4f430dd9f7d84997be1
    • Margin below the firmware limit: 982,762 bytes, approximately 0.94 MiB
  • Initramfs: dap1620-20260909-aa0bbbb2-ap-no-ppp-initramfs.bin
    • Size: 6,901,132 bytes
    • SHA256: 71c9eb3dbac933db7ea3731de2b516301791455069fe49629fbfa0866985935e

The aa0bbbb2 identifier in the artifact names is a build label. The recorded source commit for these builds is 60a9fbe8dc19a666bfa8a1c0ae846e8579d2af1c.

These figures apply only to these build artifacts. The final upstream device image must remain within the 8,060,928-byte firmware limit.

LED behaviour

Add the dap1620-leds service in place of rssileds.

The status LED is red by default during startup using the normal OpenWrt boot LED handling. Once dap1620-leds starts, it shows solid green when the selected uplink is connected and blinking amber when it is unavailable.

In Ethernet mode, use physical carrier on lan as the uplink condition and keep the signal indicators off. In repeater mode, require an associated and authorized Wi-Fi station and follow that station's signal strength. No DHCP, DNS or Internet-reachability checks are performed.

Use these configurable signal thresholds:

  • Below -75 dBm: first indicator amber
  • -75 to below -65 dBm: one green indicator
  • -65 to below -55 dBm: two green indicators
  • -55 dBm or stronger: three green indicators

These thresholds are policy defaults, not recovered stock firmware values. Keep the signal indicators off when disconnected or when RSSI is unavailable. Require explicit station selection when multiple STA configurations exist.

Installation

Use the U-Boot serial console at 57600 baud, 8N1, without flow control. Connect Ethernet to a TFTP server at 192.168.0.100.

Start from a cold power-on. Press 4 at the bootloader menu to enter the command line.

For RAM-only testing:

setenv ipaddr 192.168.0.1
setenv serverip 192.168.0.100
tftpboot 0x81000000 openwrt-ramips-mt7620-dlink_dap-1620-a2-initramfs-kernel.bin
bootm 0x81000000

This loads and runs OpenWrt without writing the firmware to flash.

For persistent installation, cold-start the device and select U-Boot menu option 2, Load system code then write to Flash via TFTP. Confirm with Y and provide the device and server addresses above and this filename:

openwrt-ramips-mt7620-dlink_dap-1620-a2-squashfs-sysupgrade.bin

After flashing has completed, disconnect power, allow the device to power down fully, and reconnect it. Verify that OpenWrt boots from flash before considering the installation complete.

Subsequent upgrades can use the normal OpenWrt sysupgrade procedure.

Testing

Hardware testing across the tested DAP-1620 A2 development revisions confirmed:

  • DSA initialization and RTL8211E detection through MDIO
  • Port 5 operating with rgmii-id
  • 1 Gbps full-duplex Ethernet negotiation
  • LAN traffic and link recovery
  • Detection of both Wi-Fi radios
  • Initramfs boot through U-Boot and TFTP
  • Flashing and booting a squashfs sysupgrade image
  • Cold power cycle after the initial flash
  • Ethernet LED behaviour with carrier disconnected and connected
  • Wi-Fi station association and authorized-state detection
  • Three green signal indicators at an observed RSSI of -54 dBm

A 60-minute bidirectional TCP soak completed successfully at approximately 250 Mbit/s DAP TX and 217 Mbit/s DAP RX. All iperf3 phases exited successfully. The sampled link status remained at 1 Gbps full duplex, with no observed link drops or increases in the switch MIB bad-packet or error counters.

Additional 30-second TCP tests:

  • DAP TX: 578 Mbit/s, 27 retransmissions
  • DAP RX: 377 Mbit/s, 37 retransmissions
  • Bidirectional: 254 + 221 Mbit/s, 0 + 231 retransmissions

CPU usage was close to saturation during the tests. The higher retransmission count in the server-to-DAP direction during bidirectional traffic could be related to CPU or softirq pressure, but the cause has not been established. The generic rx_dropped counter increased by 124 during the 60-minute soak.

These tests terminate TCP on the device itself and are not a forwarding or hardware flow-offload benchmark. Hardware offload such as PR #24515 may help forwarding workloads, but is outside the scope of this device support. With only one external Ethernet port, a conventional wired LAN-to-WAN forwarding test is not available.

The results support basic Ethernet and DSA stability under sustained load. Negotiation at 100 Mbit/s, repeated link-cycle testing and weaker-RSSI LED threshold testing remain separate tests.

The AP artifacts listed under flash constraints were separately verified for successful build, package contents, file size and checksum. The build record does not identify them as the revision used for every hardware result above.

This support builds on Senthil Durairaj's original DAP-1620 A2 work in PR #17027 and the MT7620 DSA driver introduced in PR #24493.

Link: #17027
Link: #24493
Link: https://forum.openwrt.org/t/253264

Signed-off-by: Senthil Durairaj [email protected]
Signed-off-by: Boyler Fourcade [email protected]

@openwrt openwrt Bot added kernel pull request/issue with Linux kernel related changes not following guidelines Pull request does not follow formatting guidelines target/ramips pull request/issue for ramips target labels Sep 4, 2026
@openwrt openwrt Bot removed the not following guidelines Pull request does not follow formatting guidelines label Sep 4, 2026

@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

  • 46afe069 "ramips: mt7620: add DSA support for rgmii1" — the message says the interface setup was moved into a shared mt7620_gsw_config_rgmii1() helper, but soc_mt7620.c's mt7620_port_init() is unchanged and still holds its own copy; nothing was moved and the helper has a single caller. Either reword to "add", or actually convert the legacy path.
  • af927a6a "ramips: mt7620: add support for D-Link DAP-1620 A2" — new-device commit is missing the MAC address layout section (the DTS derives MACs from macaddr_factory_ffd4/macaddr_factory_ffe8), and the flash instructions are a single sentence with no image name, TFTP/server addresses or U-Boot commands.

Generated by Claude Code

Comment thread target/linux/ramips/image/mt7620.mk Resolved
Comment thread target/linux/ramips/image/mt7620.mk Resolved
@namiltd

namiltd commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

In the PR, leave only the first commit. Implementing the D-Link DAP-1620 A2 is a separate topic, which you should link to if necessary. Or change the topic name to include both.

You have both swconfig (#17027) and DSA (this one) versions at the same time. You should choose one, or ideally switch both to draft until testing is complete.

@namiltd

namiltd commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

If #17027 (comment) works, this PR can remain with the information on what it was tested on. It will likely be useful for other devices in the future.

MT7620 switch port 5 is the external MAC exposed through RGMII1.
The DSA driver currently handles the internal user ports 0-4 and CPU
port 6, but leaves port 5 unsupported.

Add phylink capabilities and MAC configuration for external port 5,
including RGMII, MII and RMII interface modes. Add the
mt7620_gsw_config_rgmii1() helper for the DSA interface setup.
Keep the external port definition in the DSA driver as
MT7620_DSA_EXTERNAL_PORT.

For all RGMII modes, disable the MT7620 MAC-side TX and RX clock
delays. This also normalizes plain RGMII instead of preserving its
previous register state. For the *ID modes, the PHY supplies the
requested internal delays. Leave RX_SKEW unchanged.

Include port 5 in the fast MIB polling path when it is linked at
1 Gbps. Track negotiated Gigabit state separately so slower or down
links use the normal full-port polling cadence. Poll the CPU port
and the active Gigabit external port at a requested 20 ms interval,
and sample all ports every tenth tick. Keep both interval resets
when polling is stopped and restarted.

Derive the CPU forwarding matrix from the actual DSA user ports
instead of assuming only internal ports 0-4.

Leave the legacy mt7620_port_init() path unchanged.

Signed-off-by: Boyler Fourcade <[email protected]>
@openwrt openwrt Bot added add package Introduces a new package Makefile build script core packages pull request/issue for core (in-tree) packages not following guidelines Pull request does not follow formatting guidelines labels Sep 8, 2026
@Boilerplate4u Boilerplate4u changed the title ramips: mt7620: add DSA support for RGMII1 ramips: mt7620: add RGMII1 DSA and D-Link DAP-1620 A2 support Sep 8, 2026
@Boilerplate4u

Copy link
Copy Markdown
Author

Updated the PR with the latest DSA/RGMII1 review changes and DAP-1620 A2 support.

The main changes since the previous revision are:

  • Refined the RGMII delay configuration and cleaned up the external port 5 handling.
  • Added the dap1620-leds service for Ethernet status and Wi-Fi signal indicators.
  • Updated the device configuration and PR description to reflect the current implementation.
  • Built and tested a new sysupgrade image, including the LED service, within the 8 MiB flash constraints.

I'll post the latest Ethernet/DSA soak and CPU test results in a separate comment below.

@Boilerplate4u

Copy link
Copy Markdown
Author

A quick update on the DAP-1620 A2 testing.

The 60-minute bidirectional TCP soak completed successfully at around 250 Mbit/s TX + 217 Mbit/s RX, with no observed link drops or increases in the switch MIB error counters.

The soak recorded 1,559 TX and 27,933 RX-direction TCP retransmissions. The generic rx_dropped counter increased by 124. All three iperf3 phases exited with status 0, and all 65 recorded link samples showed 1 Gbps full duplex with carrier up. These were sampled observations, not continuous link monitoring.

I also ran separate 30-second tests:

  • TX: 578 Mbit/s, 27 retransmissions
  • RX: 377 Mbit/s, 37 retransmissions
  • Bidirectional: 254 + 221 Mbit/s, 0 + 231 retransmissions

CPU usage was close to 100% during the tests, so the CPU appears to be the main throughput bottleneck. The higher retransmission count in the server → DAP direction during bidirectional traffic could be related to CPU/softirq pressure, but I haven't established the cause.

Hardware offload, such as #24515, might help with forwarding workloads, but these tests terminate TCP on the DUT itself. With only one external Ethernet port, I can't perform a conventional wired LAN→WAN forwarding test.

For now, the results look good for the basic Ethernet/DSA stability test. I'll keep the retransmissions as an observation rather than treating them as a confirmed DSA issue.

@namiltd

namiltd commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Please test the version without swconfig and DSA: 17027.patch

@openwrt openwrt Bot removed the not following guidelines Pull request does not follow formatting guidelines label Sep 8, 2026
@Boilerplate4u

Copy link
Copy Markdown
Author

Please test the version without swconfig and DSA: 17027.patch

@namiltd Sure, I can test it. But as far as I can tell, this is basically a modified version of #17027 that removes swconfig, adds mediatek,no-swconfig, and uses eth0 directly without DSA.

Just curious though, what exactly are you hoping to find out with this test? Is the idea to see if this simpler approach is enough for a single-port device, or is there something specific in the current DSA implementation that you're concerned about?

@namiltd

namiltd commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

I wonder if it's possible to disable DSA for a router with only a single port, it doesn't offer much benefit but consumes quite a bit of flash memory.

@Boilerplate4u

Boilerplate4u commented Sep 8, 2026 •

Copy link
Copy Markdown
Author

There’s still a fair amount of space left even with DSA, so I don’t see it as much of a problem. The development build I tested also included some debug tools, like ip-full.

But sure, I can test it both with and without DSA and strip out all the extras so we have a fair comparison.

I’m also planning to test the PPE work in #24515, which might depend on DSA. 

@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

  • 07b39f7e "ramips: mt7620: add support for D-Link DAP-1620 A2" — subject scope is ramips: mt7620:, but the commit also patches the generic package/base-files/files/etc/diag.sh and adds a whole new core package under package/utils/dap1620-leds/. Split those out into their own commits with base-files: and dap1620-leds: subjects.

Generated by Claude Code

Comment thread package/base-files/files/etc/diag.sh Resolved
Comment thread package/utils/dap1620-leds/Makefile Resolved
Comment thread package/utils/dap1620-leds/Makefile Resolved
Comment thread package/utils/dap1620-leds/files/daemon Resolved
@Boilerplate4u

Copy link
Copy Markdown
Author

@namiltd, I just need to fix a few things from the commit review, and once that’s done, I’ll test your patch.

@Boilerplate4u

Copy link
Copy Markdown
Author

@namiltd I tested your no-DSA/no-swconfig patch on the DAP-1620 A2. There are two separate issues worth documenting before deciding what to do with this approach.

1. The initial boot failure was an unrelated OpenWrt 6.18 regression

My first test build was based on your patch adapted on top of the current DAP-1620 A2 test baseline, with both DSA and swconfig disabled.

Both the initramfs and sysupgrade images initially appeared to hang during boot immediately after:

gsw: ephy base address: 12
gsw: setting port4 to ephy mode

There was no panic or Oops, so I instrumented the MT7620 Ethernet/MDIO path and then the generic PHY registration path.

The PHY itself was detected correctly as RTL8211E (0x001cc915), and the exact deadlock was eventually isolated to:

register_netdev()
  -> register_netdevice()          [RTNL already held]
    -> ndo_init = fe_init()
      -> fe_mdio_init()
        -> of_mdiobus_register()
          -> phy_device_register()
            -> rtnl_lock()         [self-deadlock]

So the boot failure was not caused by the DAP-1620 A2 DTS changes or by the basic no-DSA/no-swconfig approach.

The regression comes from OpenWrt commit:

96ecf8dd248cbdd4bcabcc198f9170abda1ab0ea
generic: pse-pd: add patches for module-based PSE drivers

introduced through #23222.

In particular, the current OpenWrt patch:

target/linux/generic/pending-6.18/
896-03-net-phy-own-phydev-psec-via-PSE-notifier-and-remove-.patch

takes RTNL around the PSE attach path.

This is already independently reproduced on Lantiq in #24650. There, the problem was bisected to the same OpenWrt commit, dropping 896-03 fixed the boot problem, and the same basic call chain was identified:

register_netdev
  -> ndo_init
    -> MDIO registration
      -> phy_device_register
        -> rtnl_lock

The current upstream net-next v6 PSE patch series addresses this problem. It was posted on September 6 and is still an upstream patch series under review, not something already merged into Linus' mainline tree that OpenWrt can simply cherry-pick as released commits.

The current v6 series keeps patches 1-3 functionally unchanged and adds:

  • v6 4/5: replace RTNL in the PSE/PHY attach path with a dedicated PSE mutex, specifically fixing MDIO buses registered from ndo_init;
  • v6 5/5: fix the related phydev->psec lifetime issue.

v6 also fixes the build/link problem that existed in v5 when PHYLIB was modular.

I compared OpenWrt's current 896-01..03 against upstream v6 1/5..3/5. The functional changes already match, so for this test I left them unchanged and backported v6 4/5 and 5/5 as 896-04 and 896-05.

With that change, the same no-DSA/no-swconfig image boots normally.

The complete review branch is here:

https://github.com/Boilerplate4u/openwrt/tree/review/namiltd/dap1620-p17027-pse-v6

Boilerplate4u/openwrt
review/namiltd/dap1620-p17027-pse-v6
HEAD: 23408eceb223e8ed26685596c7e55bc34992e820

The two relevant commits on top of the common AP test baseline are:

30db92e5ca  ramips: mt7620: test DAP-1620 A2 without DSA
23408eceb2  kernel: backport PSE PHY locking fixes

This is a test/review branch, not an upstream-ready patch series. It intentionally retains my AP-only test/profile changes such as the PPP package exclusions and the existing dap1620-leds setup.

After applying the PSE fix I verified the no-DSA path on the actual DAP-1620 A2.

Test results:

  • complete boot;
  • eth0 negotiates 1000 Mbps/full duplex;
  • 250 ICMP packets with 1400-byte payloads, 0% packet loss;
  • RX/TX errors remained at zero;
  • existing RX/TX drop counters did not increase during the test;
  • physical link down/up recovers normally;
  • the port returns to forwarding state;
  • the device's LED indication correctly follows Ethernet link state.

2. There is still an RGMII delay question in the no-DSA version

The current no-DSA setup uses:

phy-mode = "rgmii";

There is an important detail here.

In the legacy MT7620 path, plain RGMII deliberately leaves the MT7620 TX/RX delay bits untouched for backward compatibility.

At the same time, kmod-phy-realtek is modular. MT7620 attempts to attach the PHY before that module is loaded, so the RTL8211E is currently attached as:

driver=Generic PHY

The Realtek module loads later, but the already attached PHY remains bound to Generic PHY.

This means the currently working configuration does not actually exercise rtl8211e_config_init().

In practice both sides inherit their existing hardware state instead of establishing an explicit RGMII delay configuration:

MT7620 delays:   left unchanged by the legacy RGMII path
RTL8211E delays: left unchanged because Generic PHY is used

There is useful history in #17027 here.

PR #22496 attempted to solve the early PHY attachment problem by building the Realtek PHY driver directly into the MT7620 kernel.

When that was tested on a DAP-1620 A2, the PHY correctly changed from:

driver=Generic PHY

to:

driver=RTL8211E Gigabit Ethernet

but Ethernet traffic stopped working even though Gigabit carrier was still reported.

That result is interesting because the RTL8211E driver handles plain rgmii by explicitly disabling both internal RTL8211E RGMII delays in rtl8211e_config_init().

The old #22496 test did not measure the delay register before and after driver binding, so it does not prove that the delay change caused the traffic failure. However, the observation is consistent with an RGMII timing problem and fits the later hardware testing on this device.

During the DSA/RGMII1 work for #25022 I tested the delay configuration directly on the same DAP-1620 A2.

An initial working configuration split the delays between the PHY and MAC:

RTL8211E: RX delay
MT7620:   TX delay

That worked.

The final DSA configuration instead uses an explicit rgmii-id setup:

phy-mode = "rgmii-id"

RTL8211E: TX + RX delay enabled
MT7620:   TX + RX delay disabled

That configuration was verified after cold boot by directly checking the delay registers, and it passed normal traffic and link-recovery testing.

The detailed DAP-1620 A2 RGMII/DSA test history is here:

https://forum.openwrt.org/t/253264

So I think the no-DSA approach itself is now testable, but the RGMII delay semantics still need to be decided explicitly rather than relying on the current Generic PHY / inherited register state.

I'll leave that implementation choice to you since this is your original patch.

DSA is not affected by this PSE deadlock

The PSE regression also explains an otherwise slightly confusing difference between the no-DSA and DSA implementations.

The legacy/non-DSA path reaches fe_mdio_init() from fe_init(), which is the netdev ndo_init callback.

register_netdevice() therefore already holds RTNL when MDIO/PHY registration happens, causing the recursive lock in the old PSE patch.

The current MT7620 DSA path has different ordering.

It first completes:

devm_register_netdev()

and only afterwards calls:

fe_mdio_init()

for the DSA switch.

RTNL from netdev registration has therefore already been released before PHY registration reaches the PSE attach code.

That is why the DSA DAP-1620 A2 build did not encounter this particular regression.

I therefore don't think the PSE fix belongs in #25022. It is a generic OpenWrt kernel regression and should remain separate from the DAP-1620 A2/MT7620 DSA work.

What would probably help OpenWrt most

Since the regression is already independently documented in #24650, opening another generic report for the same issue probably would not add much value.

A useful next step would be to add the DAP-1620 A2/MT7620 result to #24650 as a second independent reproducer, including:

  • the exact MT7620 call chain;
  • confirmation that the PHY itself is detected correctly;
  • confirmation that the freeze occurs at the recursive RTNL acquisition;
  • confirmation that the current upstream net-next v6 PSE locking fix resolves the boot regression.

After that, a separate OpenWrt PR updating the existing pending-6.18/896-* PSE patch series to the corrected upstream v6 series would probably be the cleanest project-level fix.

That should remain completely separate from #25022 and from any DAP-1620 A2-specific change.

Since MT7620 now provides a second independent platform reproducing the same deadlock and validating the upstream fix, it may also be useful to send a Tested-by for the relevant upstream v6 patch/series once the final OpenWrt-side testing is complete.

For your no-DSA patch, the remaining question from my side is therefore mainly how you want to handle:

  • RTL8211E RGMII delay configuration;
  • the early PHY attachment / Realtek driver binding;
  • and whether you want to carry or otherwise depend on the corrected generic PSE patch series while this is being developed.

The PSE boot failure itself is understood, is not specific to the DAP-1620 A2, and has a generic upstream fix in the current net-next v6 series.

@openwrt openwrt Bot added the not following guidelines Pull request does not follow formatting guidelines label Sep 10, 2026
@Boilerplate4u

Copy link
Copy Markdown
Author

Follow-up on the September 4 commit checks:

  • The generic commit message was corrected from “move” to “add”; the legacy mt7620_port_init() path remains unchanged.
  • The DAP-1620 A2 device commit documents the MAC/calibration layout and includes the complete U-Boot/TFTP installation procedure, including image names and device/server addresses.

@Boilerplate4u

Copy link
Copy Markdown
Author

The base-files hunk has been dropped. The LED service is part of the DAP-1620 A2 device support and is only used by that device, so it stays in the same device-support commit. Splitting it into a third commit would not improve the code or the resulting firmware.

@Boilerplate4u

Copy link
Copy Markdown
Author

Updated PR #25022 with the remaining review follow-ups.

Changes since the previous published revision:

  • dropped the DAP-1620 A2-specific logic from the generic diag.sh; normal OpenWrt boot LED handling is used instead
  • made the dap1620-leds package title A2-specific
  • dropped the duplicate src/COPYING / PKG_LICENSE_FILES
  • load the LED configuration once at daemon startup instead of every 2 seconds
  • explicitly restart dap1620-leds on the existing config reload triggers so settings are read again
  • kept the PR as two commits, with the device-specific LED service in the DAP-1620 A2 support commit
  • updated the device/PR documentation to match the final LED behaviour and existing installation/test data

The legacy swconfig path, the MII/RMII behaviour and the cosmetic DEVICE_MODEL / DEVICE_VARIANT ordering were intentionally left unchanged for the reasons noted in the individual review replies.

The existing AP/no-PPP test images remain the hardware-tested firmware reference for this update:

  • dap1620-20260909-aa0bbbb2-ap-no-ppp-sysupgrade.bin
    • 7,078,166 bytes
    • SHA256 e3b9a5861a8b458ce6ff540f052b089cb4d274be84d0d4f430dd9f7d84997be1
  • dap1620-20260909-aa0bbbb2-ap-no-ppp-initramfs.bin
    • 6,901,132 bytes
    • SHA256 71c9eb3dbac933db7ea3731de2b516301791455069fe49629fbfa0866985935e

The AP/no-PPP package exclusions are a separate test profile and are not part of the upstream device defaults.

Final PR head: 5c2913f0a2a3420d2acefe5ea5b6df9d0b62aafa.

@Boilerplate4u
Boilerplate4u force-pushed the dap1620-dsa-pr-v1 branch 2 times, most recently from e9ba6e8 to 7760250 Compare September 10, 2026 15:01
@openwrt openwrt Bot removed the not following guidelines Pull request does not follow formatting guidelines label Sep 10, 2026
@namiltd

namiltd commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

I’m in favor of using the no-DSA/no-swconfig version (once the issues are resolved) and leaving the PR implementing RGMII1 DSA for use with other routers. However, only you can compare the performance of each solution, since you have the router.

@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

  • 77602505 "ramips: mt7620: add support for D-Link DAP-1620 A2" — the message describes deltas against earlier PR revisions ("Load the LED configuration once ... rather than re-reading UCI on every two-second sample", "Do not ship a duplicate GPLv2 COPYING file ..."); the tree never did either, so describe what the commit does, not what it stopped doing.
  • 77602505 — the AP test-image block (filenames, sizes, SHA256, "source commit 60a9fbe8dc19a666bfa8a1c0ae846e8579d2af1c") points at a build that is not reachable from this repository; that provenance belongs in the PR description, not in git history.

Generated by Claude Code

Comment thread package/utils/dap1620-leds/files/daemon Resolved
@Boilerplate4u

Copy link
Copy Markdown
Author

Sure, I can compare the performance of the two solutions since I have the hardware, but I think that comparison makes most sense once the no-DSA version has its remaining issues resolved.

Just to clarify my position though: I don't really want to take over development or maintenance of the no-DSA/no-swconfig variant. My work in #25022 has been focused on the DSA implementation, which is working correctly on the DAP-1620 A2 and follows the normal upstream Linux/OpenWrt DSA model.

To me, DSA also looks like the more sensible long-term direction here. It uses the upstream Linux switch framework that OpenWrt has been moving towards, rather than introducing another alternative networking path for this device.

There is also the PPE work in #24515, which I intend to test on the DAP-1620 A2. That implementation is closely tied to the MT7620 DSA stack: it is based on the DSA work from #24493 and its PPE backend is currently built together with kmod-dsa-mt7620. External RGMII1/port 5 still needs follow-up support there, but that gives me another reason to keep the DAP-1620 A2 on the DSA path rather than move away from it.

The DAP-1620 A2 is basically a dedicated wireless repeater/AP with a single Gigabit Ethernet port. For that use case I don't see a strong need for a separate minimal networking implementation just to avoid DSA, especially while there is still enough flash space for the usual OpenWrt functionality for a dedicated AP/repeater.

Flash size also doesn't look like a strong reason by itself: the tested DSA sysupgrade image still had roughly 960 KiB of headroom within the device's firmware limit.

One thing I'm also wondering about is why we would develop a third networking variant for the DAP-1620 A2 at all.

If the preferred direction is ultimately non-DSA, why not continue with or revive #17027?

I already hardware-tested that version successfully on OpenWrt 25.12.5 / Linux 6.12.94, including initramfs boot, sysupgrade, Ethernet, 2.4 GHz and 5 GHz Wi-Fi. That version uses the existing non-DSA/swconfig path and was working on the actual hardware.

The reason I started working on the DSA version in the first place was your suggestion after #24493 was merged, partly because of the possible PPE path in #24515.

So from my point of view we currently have:

#17027:
non-DSA + swconfig
hardware-tested and working on 6.12

#25022:
DSA + RGMII1
hardware-tested and working on current 6.18

new alternative:
no DSA + no swconfig
boots and passes basic traffic after fixing the unrelated PSE regression,
but still has open RTL8211E binding/RGMII delay questions

So I guess my main question is: what specific technical advantage are we trying to gain with the no-DSA/no-swconfig variant compared with either the already working #17027 approach or the DSA implementation?

Developing the third option seems harder for me to justify unless there is some clear technical advantage over both of the already working approaches.

The no-DSA/no-swconfig version still has implementation-specific questions around the early RTL8211E binding and RGMII delay handling, and on current OpenWrt 6.18 it also runs into the generic PSE regression unless the upstream fix is backported.

I think those parts should really be resolved as part of that approach rather than folded into the DSA work.

So I'm happy to help with the part where I can be most useful right now: hardware testing and performance comparison on the actual DAP-1620 A2.

If you want to continue developing the no-DSA/no-swconfig version, I'm happy to test patches/builds and compare its performance against the DSA version once you consider it ready for that.

But I'd prefer to keep #25022 focused on the working RGMII1 DSA implementation rather than replace the DAP-1620 A2 support with an alternative path that I don't intend to maintain.

The D-Link DAP-1620 A2 is a dual-band Wi-Fi range extender with one
Gigabit Ethernet port.

Hardware:
- MediaTek MT7620A, 580 MHz
- 64 MiB RAM
- 8 MiB SPI NOR flash
- Integrated MT7620 2.4 GHz Wi-Fi
- MediaTek MT7612E 5 GHz 802.11ac radio over PCIe
- Realtek RTL8211E Gigabit Ethernet PHY
- Reset and WPS buttons
- Red/green status LED and three signal-strength indicators

Connect the RTL8211E on MDIO address 1 to DSA user port 5 through
RGMII1. Use rgmii-id so the PHY supplies both internal clock delays
while the MT7620 MAC-side delays remain disabled. Describe port 6
as the fixed 1 Gbps full-duplex CPU connection.

Select kmod-mt76x2, kmod-phy-realtek, kmod-dsa-mt7620 and
dap1620-leds. Drop swconfig and rssileds, and configure the DSA lan
interface as the default LAN.

Flash layout, with exclusive end addresses:
- U-Boot:   0x000000-0x030000
- NVRAM:    0x030000-0x040000
- Factory:  0x040000-0x050000
- Firmware: 0x050000-0x800000

Calibration and MAC addresses:
- 2.4 GHz calibration: factory + 0x0000
- 5 GHz calibration:   factory + 0x8000
- Ethernet MAC:        factory + 0xffe8
- 2.4 GHz MAC:         Ethernet MAC incremented by 1
- 5 GHz MAC:           factory + 0xffd4

Preserve U-Boot, NVRAM and factory data as read-only partitions.
The MAC increment changes the address value, not the flash offset.

Flash constraints:

U-Boot, NVRAM and factory data occupy the first 320 KiB of the
8 MiB flash, leaving 7872 KiB for firmware. The image must fit
within this limit.

LED behaviour:

Use the normal OpenWrt boot LED handling. The status LED is red by
default during startup through the DTS default state. Once
dap1620-leds starts, show solid green when the selected uplink is
connected and blinking amber when it is unavailable.

In Ethernet mode, use physical carrier on lan as the uplink
condition and keep the signal indicators off. In repeater mode,
require an associated and authorized Wi-Fi station and follow
that station's signal strength. No DHCP, DNS or Internet
reachability checks are performed.

Load the LED policy configuration when the daemon starts. In auto
and repeater modes, load the wireless configuration to select the
station; explicit Ethernet mode does not depend on it. Restart the
service on the existing dap1620-leds and wireless reload triggers
so changed settings are read again.

Use these configurable signal thresholds:
- Below -75 dBm: first indicator amber
- -75 to below -65 dBm: one green indicator
- -65 to below -55 dBm: two green indicators
- -55 dBm or stronger: three green indicators

These thresholds are policy defaults, not stock firmware values.
Keep the signal indicators off when disconnected or when RSSI
is unavailable. Require explicit station selection when multiple
STA configurations exist.

Use GPL-2.0-only package metadata and SPDX headers for the LED
shell-script package.

Installation:

Use the U-Boot serial console at 57600 baud, 8N1, without flow
control. Connect Ethernet to a TFTP server at 192.168.0.100.

Start from a cold power-on. Press 4 at the bootloader menu to enter
the command line. For RAM-only testing:

  setenv ipaddr 192.168.0.1
  setenv serverip 192.168.0.100
  tftpboot 0x81000000 openwrt-ramips-mt7620-dlink_dap-1620-a2-initramfs-kernel.bin
  bootm 0x81000000

For persistent installation, cold-start the device and select
U-Boot menu option 2, "Load system code then write to Flash via
TFTP". Confirm with Y and use:

  openwrt-ramips-mt7620-dlink_dap-1620-a2-squashfs-sysupgrade.bin

After flashing completes, disconnect power, allow the device to
power down fully, and reconnect it. Subsequent upgrades can use
the normal OpenWrt sysupgrade procedure.

Development testing on DAP-1620 A2 confirmed:
- DSA initialization and RTL8211E detection through MDIO
- Port 5 operating with rgmii-id
- 1 Gbps full-duplex Ethernet negotiation
- LAN traffic and link recovery
- Detection of both Wi-Fi radios
- Initramfs boot through U-Boot/TFTP
- Flashing and booting a squashfs sysupgrade image
- Cold power cycle after the initial flash
- Ethernet LED behaviour with carrier disconnected and connected
- Wi-Fi station association and authorized-state detection
- Three green signal indicators at an observed RSSI of -54 dBm

A 60-minute bidirectional TCP soak completed successfully at
approximately 250 Mbit/s DAP TX + 217 Mbit/s DAP RX. The sampled
link status remained at 1 Gbps full duplex with no observed link
drops or increases in the observed switch MIB bad-packet/error
counters.

The DUT itself terminated the TCP traffic, so these tests are not
a forwarding or hardware flow-offload benchmark. PPE work such as
openwrt#24515 is outside the scope of this support.

This support builds on Senthil Durairaj's original DAP-1620 A2
work in PR openwrt#17027 and the MT7620 DSA driver introduced in openwrt#24493.

Link: openwrt#17027
Link: openwrt#24493
Link: https://forum.openwrt.org/t/253264

Signed-off-by: Senthil Durairaj <[email protected]>
Signed-off-by: Boyler Fourcade <[email protected]>
@namiltd

namiltd commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

This is not a separate path; we disable the switch (set it to transparent mode) because we only have one output port, so it is not needed. We apply a similar procedure for the external switch connected to rgmii1.
I proposed both DSA and non-DSA solutions for you to test and choose the one you consider best.
The PPE will not achieve hardware offloading with only a single output via the rgmii1.

@Boilerplate4u

Copy link
Copy Markdown
Author

Follow-up on the commit-message wording point:

Commit-message wording updated. The LED section now describes the resulting implementation directly rather than comparing it with earlier PR revisions: configuration is loaded at daemon startup, wireless configuration is used for auto/repeater mode, and the existing reload triggers restart the service when configuration changes.

The licensing paragraph now simply describes the package as using GPL-2.0-only metadata and SPDX headers, without referring to the removed intermediate COPYING implementation.

@Boilerplate4u

Copy link
Copy Markdown
Author

Follow-up on the AP test-image provenance point:

Agreed. The AP test-image filenames, hashes and the separate 60a9fbe8... build provenance have been removed from the commit message. That information remains in the PR description, where the relationship between the separate AP test profile and the upstream changes can be documented without making unrelated build provenance part of the permanent commit history.

@Boilerplate4u

Copy link
Copy Markdown
Author

Follow-up after the latest review:

  • explicit mode=ethernet no longer depends on /etc/config/wireless; auto and repeater still load the wireless configuration as required
  • the device commit message now describes the resulting implementation directly and no longer carries the separate AP test-image provenance
  • the exact final revision fa97b1e47dcb52649cded03c60d4c93a98b0d2ee built successfully with the existing OpenWrt GCC 14.4.0 / mipsel_24kc / musl toolchain and the AP/no-PPP test profile

Verified artifacts from that exact revision:

  • sysupgrade: dap1620-20260910-fa97b1e4-ap-no-ppp-sysupgrade.bin
    • 7,012,630 bytes
    • SHA256 475f963666cabb72da9baaeeb477479ca6c772962c3dc3eaebc0f32498c16e2b
  • initramfs: dap1620-20260910-fa97b1e4-ap-no-ppp-initramfs.bin
    • 6,806,438 bytes
    • SHA256 5df1f0e06b85a446cc7f446acd5d7e0e9a53efa482be9cdc2bb7c3575d59a54d

The sysupgrade image remains 1,048,298 bytes below the 7,872 KiB firmware partition limit. dap1620-leds is present in the manifest; PPP/PPPoE packages remain excluded only by the separate AP test profile.

@namiltd

namiltd commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

For the non-DSA path, phy-mode = "rgmii-id" should be used - but note it has inverted semantics here compared to the DSA driver.

phy-mode = "rgmii-id"

MT7620 delays:   TX + RX delay enabled
RTL8211E delays: left unchanged because Generic PHY is used

@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.

Reviewed 1 new commit; no new issues found.


Generated by Claude Code

@Boilerplate4u

Boilerplate4u commented Sep 11, 2026 •

Copy link
Copy Markdown
Author

I’ll finish the current DSA track first and test the PPE work on the DAP-1620. After that, I’ll take a proper look at the no-DSA/no-swconfig suggestion (including the remaining issues I mentioned in my longer post above, especially the RTL8211E binding/RGMII delay handling and the current OpenWrt 6.18 PSE regression).

PPE is very interesting since the pretty slow 580 MHz MT7620A gets CPU-bound quite fast when everything stays in software. The #24515 results show that PPE can cut CPU usage pretty dramatically, which means the MT7620A CPU has a lot less networking work to do and can spend more time on Wi-Fi, interrupts/softirq and everything else going on in the box.

Port 5/RGMII1 isn’t supported by the current PPE code yet, but since RGMII1 on the DAP-1620’s MT7620A connects directly to the RTL8211E Ethernet PHY and not to an external switch, adding port 5 support might be possible (we’ll see).

Once that’s done, I'm able to do a more proper comparison between DSA and the no-DSA/no-swconfig config (i.e throughput performance, RGMII delay handling, flash usage etc.).

@abajk

abajk commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

The deadlock found on the Lantiq target has already been fixed in the OpenWRT master branch.

@namiltd

namiltd commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Any progress?

@Boilerplate4u

Copy link
Copy Markdown
Author

I’ve been swamped with work lately, but I’ll try to get back at it soon

};

&gsw {
mediatek,ephy-base = /bits/ 8 <12>;

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.

Question, not a change request — you have the A2 hardware, I don't: no internal ePHY port is used on this board at all (port@5 is external, and the ephy pins are muxed to GPIO for the RSSI LEDs), yet ephy-base = <12> still makes mt7620_ephy_init() calibrate five internal ePHYs (MDIO 12–16) that can never link. Was mediatek,ephy-disable considered? Keeping <12> is perfectly fine if that is what you verified on hardware.

@namiltd

namiltd commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

It’s a shame this topic died; it could have contributed to the gradual phasing out of swconfig wherever possible.

Comment on lines +13 to +18
aliases {
led-boot = &led_status_red;
led-failsafe = &led_status_green;
led-running = &led_status_red;
led-upgrade = &led_status_red;
};

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.

does the label of the device show a mac address? if so, please add a label-mac-device alias to the aliases node, pointing to the interface that uses this mac, e.g. label-mac-device = &ethernet;.

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

Labels

add package Introduces a new package Makefile build script core packages pull request/issue for core (in-tree) packages kernel pull request/issue with Linux kernel related changes target/ramips pull request/issue for ramips target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants