]> git.ipfire.org Git - thirdparty/openwrt.git/commit
airoha: fix EN7581 PCIe initialization and add x2 link support 21978/head
authorRyan Chen <rchen14b@gmail.com>
Wed, 11 Feb 2026 04:25:01 +0000 (22:25 -0600)
committerRobert Marko <robimarko@gmail.com>
Fri, 13 Feb 2026 11:08:56 +0000 (12:08 +0100)
commit8b9bd686e7c705dca28849882f53cf416559e1df
tree0c4fdcb9ddd26bdff707497cd2cd96ffef48d63c
parentcd39bc2c5bd726ddf8a3018551e05280740b4547
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
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]