From a5f28705125708ebf2cace9de3113ba3f7d00d01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bu=C5=9Bko?= Date: Mon, 23 Nov 2026 21:41:32 +0100 Subject: [PATCH] mediatek: mt7988: give each PCIe host its PEXTP clock (BPi-R4 Pro 8X, BE14 WiFi module) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each MT7988 PCIe port feeds its SerDes through a per-port transceiver PHY driven by the topckgen pextp_p_sel mux. The hosts are described with the mediatek,mt7986-pcie fallback, whose schema pins a host to exactly four clocks, so nothing ever claims that mux and clk.c keeps it off as an unused clock for the whole uptime: pextp_p0_sel 0 0 0 26000000 ... N deviceless mtk_pcie_parse_port() collects the clocks of a host node with devm_clk_bulk_get_all() and mtk_pcie_power_up() enables them before the LTSSM is started, so the host runs its state machine against a PHY with no reference clock. That is never reported as a missing clock, only as a link failure: mtk-pcie-gen3 11300000.pcie: PCIe link down, current LTSSM state: detect.quiet (0x1) - 991 dt-bindings: PCI: mediatek-gen3 add mediatek,mt7988-pcie, paired with the mediatek,mt8192-pcie fallback, and pin its clocks to the four infracfg clocks plus pextp_clk. - 992 DTS: describe <&topckgen CLK_TOP_PEXTP_Pn_SEL> "pextp_clk" on each of the four hosts and move them onto the new compatible. The driver needs no change: the hosts already bind through the mediatek,mt8192-pcie entry of mtk_pcie_of_match[], so this only describes the clock the driver has been collecting all along. On a BPi-R4 Pro 8X with the BE14/MT7996 module both PCIe links come back on every boot - 11300000 enumerates 14c3:7990 (mt7996e) and 11310000 14c3:7991 (mt7996e_hif) - with the 2.4 GHz, 5 GHz/160 MHz and 6 GHz/320 MHz BSS up, and pextp_p0_sel/p1_sel read `2 2 ... Y pcie@11300000` / `pcie@11310000` while the two unused ports stay off. Signed-off-by: Łukasz Buśko --- ...mediatek-add-MT7988-with-its-PEXTP-r.patch | 67 ++++++++++ ...-mt7988a-give-each-PCIe-host-its-PEX.patch | 120 ++++++++++++++++++ 2 files changed, 187 insertions(+) create mode 100644 target/linux/mediatek/patches-6.18/991-dt-bindings-PCI-mediatek-add-MT7988-with-its-PEXTP-r.patch create mode 100644 target/linux/mediatek/patches-6.18/992-arm64-dts-mediatek-mt7988a-give-each-PCIe-host-its-PEX.patch diff --git a/target/linux/mediatek/patches-6.18/991-dt-bindings-PCI-mediatek-add-MT7988-with-its-PEXTP-r.patch b/target/linux/mediatek/patches-6.18/991-dt-bindings-PCI-mediatek-add-MT7988-with-its-PEXTP-r.patch new file mode 100644 index 00000000..a7b1ba09 --- /dev/null +++ b/target/linux/mediatek/patches-6.18/991-dt-bindings-PCI-mediatek-add-MT7988-with-its-PEXTP-r.patch @@ -0,0 +1,67 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Łukasz Buśko +Date: Sat, 17 Oct 2026 09:10:00 +0200 +Subject: [PATCH] dt-bindings: PCI: mediatek: add MT7988 with its PEXTP + reference clock + +The MT7988 PCIe hosts are described with the mediatek,mt7986-pcie +fallback, whose schema pins the host to exactly four clocks. Each MT7988 +port drives its SerDes through a per-port transceiver PHY fed by the +topckgen pextp_p_sel mux, so the MT7988 hosts need a fifth clock and +a compatible of their own to describe it. + +Add mediatek,mt7988-pcie, paired with the mediatek,mt8192-pcie fallback +the driver already matches, and pin its clocks to the four infracfg +clocks plus pextp_clk. + +--- + .../devicetree/bindings/pci/mediatek-pcie-gen3.yaml | 31 +++++++++++++++++++ + 1 file changed, 31 insertions(+) + +--- a/Documentation/devicetree/bindings/pci/mediatek-pcie-gen3.yaml ++++ b/Documentation/devicetree/bindings/pci/mediatek-pcie-gen3.yaml +@@ -49,6 +49,7 @@ properties: + - items: + - enum: + - mediatek,mt7986-pcie ++ - mediatek,mt7988-pcie + - mediatek,mt8188-pcie + - mediatek,mt8195-pcie + - const: mediatek,mt8192-pcie +@@ -268,6 +269,36 @@ allOf: + + resets: + minItems: 1 ++ maxItems: 2 ++ ++ reset-names: ++ minItems: 1 ++ maxItems: 2 ++ ++ mediatek,pbus-csr: false ++ ++ - if: ++ properties: ++ compatible: ++ contains: ++ enum: ++ - mediatek,mt7988-pcie ++ then: ++ properties: ++ clocks: ++ minItems: 5 ++ maxItems: 5 ++ ++ clock-names: ++ items: ++ - const: pl_250m ++ - const: tl_26m ++ - const: peri_26m ++ - const: top_133m ++ - const: pextp_clk ++ ++ resets: ++ minItems: 1 + maxItems: 2 + + reset-names: diff --git a/target/linux/mediatek/patches-6.18/992-arm64-dts-mediatek-mt7988a-give-each-PCIe-host-its-PEX.patch b/target/linux/mediatek/patches-6.18/992-arm64-dts-mediatek-mt7988a-give-each-PCIe-host-its-PEX.patch new file mode 100644 index 00000000..038cd39d --- /dev/null +++ b/target/linux/mediatek/patches-6.18/992-arm64-dts-mediatek-mt7988a-give-each-PCIe-host-its-PEX.patch @@ -0,0 +1,120 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Łukasz Buśko +Date: Sat, 17 Oct 2026 09:20:00 +0200 +Subject: [PATCH] arm64: dts: mediatek: mt7988a: give each PCIe host its PEXTP + reference clock + +mtk_pcie_parse_port() takes every clock listed on the host with +devm_clk_bulk_get_all() and mtk_pcie_power_up() enables them before the +LTSSM is started. The MT7988 device tree lists four infracfg clocks per +host and stops there, so the per-port transceiver PHY reference clock +(topckgen pextp_p_sel) is never among them and is left disabled as an +unused clock: + + pextp_p0_sel 0 0 0 26000000 ... N deviceless + +The host then polls a link that cannot come up because its PHY has no +reference clock: + + mtk-pcie-gen3 11300000.pcie: PCIe link down, current LTSSM state: detect.quiet (0x1) + +Describe that clock on all four hosts and move them onto the +mediatek,mt7988-pcie compatible, which the binding now pins to the five +clocks. The driver keeps matching through the mediatek,mt8192-pcie +fallback, so this is a description-only change. + +Based on the BPi-R4 Pro 8X device tree from the Bananapi vendor tree. +--- + arch/arm64/boot/dts/mediatek/mt7988a.dtsi | 28 ++++++++++++++------------ + 1 file changed, 16 insertions(+), 12 deletions(-) + +--- a/arch/arm64/boot/dts/mediatek/mt7988a.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt7988a.dtsi +@@ -632,7 +632,7 @@ + }; + + pcie2: pcie@11280000 { +- compatible = "mediatek,mt7986-pcie", ++ compatible = "mediatek,mt7988-pcie", + "mediatek,mt8192-pcie"; + device_type = "pci"; + #address-cells = <3>; +@@ -649,9 +649,10 @@ + clocks = <&infracfg CLK_INFRA_PCIE_PIPE_P2>, + <&infracfg CLK_INFRA_PCIE_GFMUX_TL_P2>, + <&infracfg CLK_INFRA_PCIE_PERI_26M_CK_P2>, +- <&infracfg CLK_INFRA_133M_PCIE_CK_P2>; ++ <&infracfg CLK_INFRA_133M_PCIE_CK_P2>, ++ <&topckgen CLK_TOP_PEXTP_P2_SEL>; + clock-names = "pl_250m", "tl_26m", "peri_26m", +- "top_133m"; ++ "top_133m", "pextp_clk"; + pinctrl-names = "default"; + pinctrl-0 = <&pcie2_pins>; + status = "disabled"; +@@ -673,7 +674,7 @@ + }; + + pcie3: pcie@11290000 { +- compatible = "mediatek,mt7986-pcie", ++ compatible = "mediatek,mt7988-pcie", + "mediatek,mt8192-pcie"; + device_type = "pci"; + #address-cells = <3>; +@@ -690,9 +691,10 @@ + clocks = <&infracfg CLK_INFRA_PCIE_PIPE_P3>, + <&infracfg CLK_INFRA_PCIE_GFMUX_TL_P3>, + <&infracfg CLK_INFRA_PCIE_PERI_26M_CK_P3>, +- <&infracfg CLK_INFRA_133M_PCIE_CK_P3>; ++ <&infracfg CLK_INFRA_133M_PCIE_CK_P3>, ++ <&topckgen CLK_TOP_PEXTP_P3_SEL>; + clock-names = "pl_250m", "tl_26m", "peri_26m", +- "top_133m"; ++ "top_133m", "pextp_clk"; + pinctrl-names = "default"; + pinctrl-0 = <&pcie3_pins>; + status = "disabled"; +@@ -711,7 +713,7 @@ + }; + + pcie0: pcie@11300000 { +- compatible = "mediatek,mt7986-pcie", ++ compatible = "mediatek,mt7988-pcie", + "mediatek,mt8192-pcie"; + device_type = "pci"; + #address-cells = <3>; +@@ -728,9 +730,10 @@ + clocks = <&infracfg CLK_INFRA_PCIE_PIPE_P0>, + <&infracfg CLK_INFRA_PCIE_GFMUX_TL_P0>, + <&infracfg CLK_INFRA_PCIE_PERI_26M_CK_P0>, +- <&infracfg CLK_INFRA_133M_PCIE_CK_P0>; ++ <&infracfg CLK_INFRA_133M_PCIE_CK_P0>, ++ <&topckgen CLK_TOP_PEXTP_P0_SEL>; + clock-names = "pl_250m", "tl_26m", "peri_26m", +- "top_133m"; ++ "top_133m", "pextp_clk"; + pinctrl-names = "default"; + pinctrl-0 = <&pcie0_pins>; + status = "disabled"; +@@ -749,7 +752,7 @@ + }; + + pcie1: pcie@11310000 { +- compatible = "mediatek,mt7986-pcie", ++ compatible = "mediatek,mt7988-pcie", + "mediatek,mt8192-pcie"; + device_type = "pci"; + #address-cells = <3>; +@@ -766,9 +769,10 @@ + clocks = <&infracfg CLK_INFRA_PCIE_PIPE_P1>, + <&infracfg CLK_INFRA_PCIE_GFMUX_TL_P1>, + <&infracfg CLK_INFRA_PCIE_PERI_26M_CK_P1>, +- <&infracfg CLK_INFRA_133M_PCIE_CK_P1>; ++ <&infracfg CLK_INFRA_133M_PCIE_CK_P1>, ++ <&topckgen CLK_TOP_PEXTP_P1_SEL>; + clock-names = "pl_250m", "tl_26m", "peri_26m", +- "top_133m"; ++ "top_133m", "pextp_clk"; + pinctrl-names = "default"; + pinctrl-0 = <&pcie1_pins>; + status = "disabled"; -- 2.56.1