Skip to content

Commit edd54eb

Browse files
committed
arm64: rockchip: rk3576: extended PCI Wi-Fi reset timing and bus mastering
1 parent 1040451 commit edd54eb

File tree

2 files changed

+102
-64
lines changed

2 files changed

+102
-64
lines changed
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: HackingGate <[email protected]>
3+
Date: Sun, 26 Oct 2025 23:30:11 +0900
4+
Subject: [PATCH] arm64: rockchip: fix PCI WiFi on RK3576 with extended reset
5+
timing and bus mastering
6+
7+
RK3576 PCIe WiFi cards (QCA wcn6855) fail to initialize due to two issues:
8+
9+
1. Bus mastering is disabled on Rockchip PCIe bridges and endpoints,
10+
preventing DMA operations required for MHI firmware loading.
11+
12+
2. Insufficient PERST# timing prevents the WiFi card's PCIe interface
13+
from properly initializing before link training begins.
14+
15+
This patch adds:
16+
- PCI quirk to enable bus mastering on Rockchip root ports and endpoints
17+
- Extended PERST# hold time (100ms) and post-reset delay (200ms)
18+
19+
This ensures the WiFi card has sufficient time for PCIe interface
20+
initialization and Data Link Layer activation.
21+
22+
Tested-by: HackingGate <[email protected]>
23+
Signed-off-by: HackingGate <[email protected]>
24+
---
25+
drivers/pci/controller/dwc/pcie-dw-rockchip.c | 7 ++++
26+
drivers/pci/quirks.c | 35 +++++++++++++++++++
27+
2 files changed, 42 insertions(+)
28+
29+
diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
30+
index 3e2752c7dd09..f475be5dfea5 100644
31+
--- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c
32+
+++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
33+
@@ -221,6 +221,7 @@ static int rockchip_pcie_start_link(struct dw_pcie *pci)
34+
35+
/* Reset device */
36+
gpiod_set_value_cansleep(rockchip->rst_gpio, 0);
37+
+ msleep(100); /* Hold reset asserted for 100ms */
38+
39+
rockchip_pcie_enable_ltssm(rockchip);
40+
41+
@@ -236,6 +237,12 @@ static int rockchip_pcie_start_link(struct dw_pcie *pci)
42+
msleep(PCIE_T_PVPERL_MS);
43+
gpiod_set_value_cansleep(rockchip->rst_gpio, 1);
44+
45+
+ /*
46+
+ * Extended delay for WiFi cards (wcn6855) that need extra time
47+
+ * for PCIe interface initialization and Data Link Layer activation.
48+
+ */
49+
+ msleep(200);
50+
+
51+
return 0;
52+
}
53+
54+
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
55+
index 214ed060ca1b..86b08c1d6973 100644
56+
--- a/drivers/pci/quirks.c
57+
+++ b/drivers/pci/quirks.c
58+
@@ -5654,6 +5654,41 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x145a, quirk_intel_e2000_no_ats);
59+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x145c, quirk_intel_e2000_no_ats);
60+
#endif /* CONFIG_PCI_ATS */
61+
62+
+/*
63+
+ * Rockchip DesignWare PCIe controller doesn't enable bus master for endpoints.
64+
+ * Ensure bus mastering is enabled for root ports and attached endpoints.
65+
+ */
66+
+static void quirk_rockchip_pcie_enable_bus_master(struct pci_dev *dev)
67+
+{
68+
+ struct pci_dev *bridge;
69+
+ u16 vendor;
70+
+
71+
+ /* Rockchip root ports also need BME asserted to forward DMA */
72+
+ if (dev->vendor == PCI_VENDOR_ID_ROCKCHIP) {
73+
+ if (pci_is_bridge(dev)) {
74+
+ pci_info(dev, "Rockchip bridge: enabling bus mastering\n");
75+
+ pci_set_master(dev);
76+
+ }
77+
+ return;
78+
+ }
79+
+
80+
+ if (pci_is_bridge(dev))
81+
+ return;
82+
+
83+
+ bridge = pci_upstream_bridge(dev);
84+
+ if (!bridge)
85+
+ return;
86+
+
87+
+ /* Check if attached to Rockchip PCIe controller */
88+
+ pci_read_config_word(bridge, PCI_VENDOR_ID, &vendor);
89+
+ if (vendor == PCI_VENDOR_ID_ROCKCHIP) {
90+
+ pci_info(dev, "Endpoint behind Rockchip bridge: enabling bus mastering\n");
91+
+ pci_set_master(dev);
92+
+ }
93+
+}
94+
+DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, quirk_rockchip_pcie_enable_bus_master);
95+
+DECLARE_PCI_FIXUP_ENABLE(PCI_ANY_ID, PCI_ANY_ID, quirk_rockchip_pcie_enable_bus_master);
96+
+
97+
/* Freescale PCIe doesn't support MSI in RC mode */
98+
static void quirk_fsl_no_msi(struct pci_dev *pdev)
99+
{
100+
--
101+
2.47.3
102+

patch/kernel/archive/rockchip64-6.18/rk3576-0012-pcie-rockchip-enable-bus-master-for-devices.patch

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)