Devicetree
 help / color / mirror / Atom feed
* [PATCH] mediatek: mt7988: give each PCIe host its PEXTP clock (BPi-R4 Pro 8X, BE14 WiFi module)
       [not found] <20261129123118.187289-1-lukasz.busko@guns4hire.cc>
@ 2026-11-29 13:07 ` Łukasz Buśko
  2026-11-29 13:20   ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Łukasz Buśko @ 2026-11-29 13:07 UTC (permalink / raw)
  To: ryder.lee@mediatek.com, bhelgaas@google.com,
	lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org,
	robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
	matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com,
	jianjun.wang@mediatek.com, linux-pci@vger.kernel.org,
	linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, frank.wunderlich@linux.dev

[-- Attachment #1: Type: text/plain, Size: 9612 bytes --]

Hi,
Its my first time to commit patch. Email body+attachment.

Each MT7988 PCIe port feeds its SerDes through a per-port transceiver PHY
driven by the topckgen pextp_p<n>_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 <lukasz.busko@guns4hire.cc>
---
 ...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 <lukasz.busko@guns4hire.cc>
+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<n>_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 <lukasz.busko@guns4hire.cc>
+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<n>_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

--
Pozdrawiam / Best regards
Łukasz Buśko

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-mediatek-mt7988-give-each-PCIe-host-its-PEXTP-clock-.patch --]
[-- Type: text/x-patch; name=0001-mediatek-mt7988-give-each-PCIe-host-its-PEXTP-clock-.patch, Size: 9641 bytes --]

From a5f28705125708ebf2cace9de3113ba3f7d00d01 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Bu=C5=9Bko?= <lukasz.busko@guns4hire.cc>
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<n>_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 <lukasz.busko@guns4hire.cc>
---
 ...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 <lukasz.busko@guns4hire.cc>
+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<n>_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 <lukasz.busko@guns4hire.cc>
+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<n>_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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mediatek: mt7988: give each PCIe host its PEXTP clock (BPi-R4 Pro 8X, BE14 WiFi module)
  2026-11-29 13:07 ` [PATCH] mediatek: mt7988: give each PCIe host its PEXTP clock (BPi-R4 Pro 8X, BE14 WiFi module) Łukasz Buśko
@ 2026-11-29 13:20   ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-29 13:20 UTC (permalink / raw)
  To: Łukasz Buśko, linux-pci@vger.kernel.org,
	devicetree@vger.kernel.org
  Cc: robh, conor+dt

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] arm64: dts: mediatek: commit adds OpenWrt patch files instead
  of patching tree
- [Medium] dt-bindings: PCI: mediatek: mt7988 PEXTP mux added to MAC
  instead of clk tree
- [Low] mediatek: mt7988: commit changelog contains email greeting and
  quilt patch list
--

commit 8239227460147312c96d3389ca6f78c52b062fbe
Author: Łukasz Buśko <lukasz.busko@guns4hire.cc>

> mediatek: mt7988: give each PCIe host its PEXTP clock (BPi-R4 Pro 8X, BE14 WiFi module)
> 
> Hi,
> Its my first time to commit patch. Email body+attachment.
> 
> Each MT7988 PCIe port feeds its SerDes through a per-port transceiver PHY
> driven by the topckgen pextp_p<n>_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 <lukasz.busko@guns4hire.cc>

[Severity: Low]
The commit message includes a conversational email greeting ("Hi, Its my
first time to commit patch...") and lists OpenWrt quilt patch numbers
("991", "992").  Personal notes for reviewers belong below the "---"
tearline so they are not recorded in the permanent git history, and each
patch should have its own self-contained commit changelog.

> 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 0000000000000..a7b1ba09159f2
> --- /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 <lukasz.busko@guns4hire.cc>
> +Date: Sat, 17 Oct 2026 09:10:00 +0200
> +Subject: [PATCH] dt-bindings: PCI: mediatek: add MT7988 with its PEXTP
> + reference clock

[Severity: High]
Does this commit add two OpenWrt quilt patch files under
target/linux/mediatek/patches-6.18/ instead of modifying the kernel
source files directly?

The Linux kernel build system does not process target/linux/, so
Documentation/devicetree/bindings/pci/mediatek-pcie-gen3.yaml and
arch/arm64/boot/dts/mediatek/mt7988a.dtsi remain unmodified in the tree
and compiled DTBs still lack the PEXTP clocks.  Also, the embedded diffs
were generated against an older 6.18 tree and do not apply cleanly to the
current files (for example, mediatek-pcie-gen3.yaml also has
mediatek,mt7981-pcie and mediatek,mt8189-pcie in the compatible enum, and
pcie2 in mt7988a.dtsi has phys and phy-names properties).  Please apply
the binding and DTS changes directly to the kernel tree as two separate
commits.

[ ... ]

> +--- 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

[Severity: Medium]
Should CLK_TOP_PEXTP_P0_SEL..P3_SEL be parented in the MT7988 clock
driver (or assigned to the PHY nodes) rather than added as a required
fifth clock on the PCIe MAC binding?

In drivers/clk/mediatek/clk-mt7988-infracfg.c, the analogous USB PIPE
gates are parented to their topckgen muxes, whereas the PCIe PIPE gates
(which each PCIe node already claims as "pl_250m") are parented directly
to "top_xtal":

drivers/clk/mediatek/clk-mt7988-infracfg.c:
	GATE_INFRA3(CLK_INFRA_USB_PIPE, "infra_usb_pipe", "sspxtp_sel", 10),
	GATE_INFRA3(CLK_INFRA_USB_PIPE_CK_P1, "infra_usb_pipe_ck_p1", "usb_phy_sel", 11),
	...
	GATE_INFRA3(CLK_INFRA_PCIE_PIPE_P0, "infra_pcie_pipe_ck_p0", "top_xtal", 24),
	GATE_INFRA3(CLK_INFRA_PCIE_PIPE_P1, "infra_pcie_pipe_ck_p1", "top_xtal", 25),
	GATE_INFRA3(CLK_INFRA_PCIE_PIPE_P2, "infra_pcie_pipe_ck_p2", "top_xtal", 26),
	GATE_INFRA3(CLK_INFRA_PCIE_PIPE_P3, "infra_pcie_pipe_ck_p3", "top_xtal", 27),

Requiring a new mediatek,mt7988-pcie compatible with 5 clocks on the MAC
node breaks compatibility with existing 4-clock mt7988a.dtsi device
trees, whereas parenting CLK_INFRA_PCIE_PIPE_P0..P3 to
"pextp_p0_sel".."pextp_p3_sel" in clk-mt7988-infracfg.c (or describing
the reference clock on the PHY) would enable the mux when the port powers
up without changing the PCIe MAC binding.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/WPbvQ5bN1rWZUCz7EPql9EZIfTCossuyvgobtVAYvP1JM0m-RohvumoDmBdEAz2H593XEGyTh9T8zn_BYb7OlKc7LePH1RQbjjCel2mu86s=@guns4hire.cc?part=1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-29 13:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261129123118.187289-1-lukasz.busko@guns4hire.cc>
2026-11-29 13:07 ` [PATCH] mediatek: mt7988: give each PCIe host its PEXTP clock (BPi-R4 Pro 8X, BE14 WiFi module) Łukasz Buśko
2026-11-29 13:20   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox