]> git.ipfire.org Git - thirdparty/openwrt.git/commit
airoha: fix EN7581 PCIe initialization and add x2 link support 22336/head
authorRyan Chen <rchen14b@gmail.com>
Wed, 11 Feb 2026 04:25:01 +0000 (22:25 -0600)
committerRobert Marko <robimarko@gmail.com>
Tue, 10 Mar 2026 10:22:45 +0000 (11:22 +0100)
commit150d05f8c69b7c9825e83f5600d76402cc7effc6
tree1e82708233add921e3cb1a4d6070ee51c19a3125
parent56648149d50e09961d0111182c6641e47d0b2e81
airoha: fix EN7581 PCIe initialization and add x2 link support

Fix two hardware initialization issues in the EN7581 PCIe controller
and add support for x2 (2-lane) link mode.

Fixes:

The upstream EN7581 PCIe initialization writes EQ presets and PIPE
configuration registers before clk_bulk_prepare_enable(). Since the
MAC clocks are not yet running at that point, these register writes
are silently dropped, leaving the hardware with default values. This
can cause link training failures or suboptimal equalization.

Additionally, after link training the MAC may only advertise Gen1-Gen2
capability in the Link Capabilities 2 register despite the PHY being
configured for Gen3. A serdes reset toggle forces the MAC to re-read
PHY capability, recovering Gen3 8GT/s link speed.

Both issues are addressed by separating PERST from the clock callbacks
(patch 911), allowing the PCIe controller driver to properly sequence
PERST, clock enable, and register writes (patch 912).

New feature:

PCIe x2 mode support for EN7581 using the NP_SCU system controller
for serdes mux routing, PERST management, and lane configuration.
Both bonded MACs are configured for x2 operation with proper EQ
presets before link training begins.

Signed-off-by: Ryan Chen <rchen14b@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21978
Link: https://github.com/openwrt/openwrt/pull/22336
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/airoha/dts/an7581.dtsi
target/linux/airoha/patches-6.12/911-clk-en7581-Separate-PERST-from-refclk-in-PCIe-clock.patch [new file with mode: 0644]
target/linux/airoha/patches-6.12/912-pcie-mediatek-gen3-Add-x2-link-support-for-Airoha-EN7581.patch [new file with mode: 0644]