Banana pi BPI-R3 has a wrong pcie clock. PCie not work

I install one expansion card ,it only converts interface (NVME M2 TO PCIE),no extra functions or chips included,so no drivers required for it. It will be ok and run very well on computer motherboards if a quectel 5G module installed on this card( Linux & windows). However, it would get into trouble if it works on Banana PI R3.Here is the dmesg info:

root@OpenWrt:~# dmesg |grep pci
[    0.112089] mt7986a-pinctrl 1001f000.pinctrl: found group selector 6 for pcie_clk
[    0.112101] mt7986a-pinctrl 1001f000.pinctrl: found group selector 30 for pcie_pereset
[    0.112111] mt7986a-pinctrl 1001f000.pinctrl: request pin 9 (GPIO_4) for 11280000.pcie
[    0.112120] mt7986a-pinctrl 1001f000.pinctrl: enable function pcie group pcie_clk
[    0.112136] mt7986a-pinctrl 1001f000.pinctrl: request pin 41 (PCIE_PERESET_N) for 11280000.pcie
[    0.112144] mt7986a-pinctrl 1001f000.pinctrl: enable function pcie group pcie_pereset
[    0.112186] mtk-pcie-gen3 11280000.pcie: host bridge /soc/pcie@11280000 ranges:
[    0.112209] mtk-pcie-gen3 11280000.pcie: Parsing ranges property...
[    0.112231] mtk-pcie-gen3 11280000.pcie:      MEM 0x0020000000..0x002fffffff -> 0x0020000000
[    0.112353] phy phy-soc:[email protected]: pcie auto load valid efuse: ENABLE with value: 1
[    0.112469] /soc/pcie@11280000: Failed to get clk index: 0 ret: -517
[    0.112481] mtk-pcie-gen3 11280000.pcie: failed to get clocks
[    2.827293] mt7986a-pinctrl 1001f000.pinctrl: found group selector 6 for pcie_clk
[    2.842214] mt7986a-pinctrl 1001f000.pinctrl: found group selector 30 for pcie_pereset
[    2.852710] mt7986a-pinctrl 1001f000.pinctrl: request pin 9 (GPIO_4) for 11280000.pcie
[    2.867104] mt7986a-pinctrl 1001f000.pinctrl: enable function pcie group pcie_clk
[    2.867117] mt7986a-pinctrl 1001f000.pinctrl: request pin 41 (PCIE_PERESET_N) for 11280000.pcie
[    2.881423] mt7986a-pinctrl 1001f000.pinctrl: enable function pcie group pcie_pereset
[    2.896467] mtk-pcie-gen3 11280000.pcie: host bridge /soc/pcie@11280000 ranges:
[    2.912578] mtk-pcie-gen3 11280000.pcie: Parsing ranges property...
[    2.927502] mtk-pcie-gen3 11280000.pcie:      MEM 0x0020000000..0x002fffffff -> 0x0020000000
[    2.954429] phy phy-soc:[email protected]: pcie auto load valid efuse: ENABLE with value: 1
[    3.212005] mtk-pcie-gen3 11280000.pcie: PCIe link down, ltssm reg val: 0x1000001
[    3.221774] mtk-pcie-gen3: probe of 11280000.pcie failed with error -110
[   10.070522] ehci-pci: EHCI PCI platform driver
[   10.097632] ohci-pci: OHCI PCI platform driver

It seems the board has a incorrect clock. And How to fix? By the way, the driver for Quectel 5G module is fine and has passed on other platforms( such as OpenWRT 23.05 x64 devices)

Seems similar to pwm in openwrt 5.15 kernel

@@ -370,11 +411,11 @@
 			bus-range = <0x00 0xff>;
 			ranges = <0x82000000 0x00 0x20000000 0x00
 				  0x20000000 0x00 0x10000000>;
-			clocks = <&infracfg CLK_INFRA_PCIE_SEL>,
+			clocks = <&infracfg CLK_INFRA_IPCIE_PIPE_CK>,
 				 <&infracfg CLK_INFRA_IPCIE_CK>,
-				 <&infracfg CLK_INFRA_IPCIE_PIPE_CK>,
 				 <&infracfg CLK_INFRA_IPCIER_CK>,
 				 <&infracfg CLK_INFRA_IPCIEB_CK>;
+			clock-names = "pl_250m", "tl_26m", "peri_26m", "top_133m";
 			status = "disabled";
 
 			phys = <&pcie_port PHY_TYPE_PCIE>;

Based on diff i found in pwm thread

Look which values you have in mt7986a.dtsi and try changing it to the other values…seems again clock drivers in openwrt 5.15 and 6.1/mainline are different.

I have no idea. I just re-clone it and check out ae500e62e2938e112ae1fc6aa7389e8c7b784b13 and then re-build.

Try to change the dtsi and then rebuild