Re: [PATCH RFC v5 8/8] PCI: dw-rockchip: port some suspend code from vendor kernel
From: Shawn Lin
Date: Mon Mar 16 2026 - 20:52:47 EST
Hi Sebastian,
在 2026/03/17 星期二 3:10, Sebastian Reichel 写道:
Rockchip's vendor kernel does these calls before starting the actual
process of going into L2 state. I'm not sure about the rationale,
hopefully Shawn can help out with that.
Cc: Shawn Lin <shawn.lin@xxxxxxxxxxxxxx>
Signed-off-by: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxx>
---
drivers/pci/controller/dwc/pcie-dw-rockchip.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
index 3be83feccecb..fbdde82c95b6 100644
--- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c
+++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
@@ -74,6 +74,9 @@
#define PCIE_CLKREQ_NOT_READY FIELD_PREP_WM16(BIT(0), 0)
#define PCIE_CLKREQ_PULL_DOWN FIELD_PREP_WM16(GENMASK(13, 12), 1)
+/* General Debug Register */
+#define PCIE_CLIENT_GENERAL_DEBUG 0x104
+
/* RASDES TBA information */
#define PCIE_CLIENT_CDM_RASDES_TBA_INFO_CMN 0x154
#define PCIE_CLIENT_CDM_RASDES_TBA_L1_1 BIT(4)
@@ -776,6 +779,11 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
return ret;
}
+static inline void rockchip_pcie_link_status_clear(struct rockchip_pcie *rockchip)
+{
+ rockchip_pcie_writel_apb(rockchip, PCIE_CLIENT_GENERAL_DEBUG, 0x0);
+}
+
Thanks for the patches.
It is intended to clear the debug buffer before entering the L2 state.
This ensures that when the link re-establishes after resume, the debug
registers contain cleaner information, making it easier to diagnose any
link training issues that may occur during the reconnection process.
That said, this operation is not strictly necessary from a functional
standpoint. The PCIe controller will work correctly without it. This was
primarily a request from downstream folks to have cleaner debug
information during bring-up and troubleshooting phases.
static int rockchip_pcie_suspend(struct device *dev)
{
struct rockchip_pcie *rockchip = dev_get_drvdata(dev);
@@ -789,6 +797,11 @@ static int rockchip_pcie_suspend(struct device *dev)
rockchip->intx = rockchip_pcie_readl_apb(rockchip, PCIE_CLIENT_INTR_MASK_LEGACY);
+ /* All sub-devices are in D3hot by PCIe stack */
+ dw_pcie_dbi_ro_wr_dis(pci);
+
+ rockchip_pcie_link_status_clear(rockchip);
+
ret = dw_pcie_suspend_noirq(pci);
if (ret)
return ret;