From 47fd8822fab0315cef2463dd69823a4c8d00c525 Mon Sep 17 00:00:00 2001 From: Shawn Lin Date: Tue, 5 Nov 2024 09:19:47 +0800 Subject: [PATCH] PCI: dw: rockchip: Add shutdown support There is nothing worth to do when rebooting in normal system as the whole thing is going to be reset in a clean way. However if the reboot process doesn't reset the anything, then reset PCIe controller in probe would throw a glitch which could generate a spurious irq. Work around this by disabling misc irq before rebooting. Signed-off-by: Shawn Lin Change-Id: I7b6e53ecbce385581a6beb0333a2df320a32cc9e --- drivers/pci/controller/dwc/pcie-dw-rockchip.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c index cdc9c5dc6d77..c6421475bdb2 100644 --- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c +++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c @@ -1777,6 +1777,16 @@ static int rk_pcie_remove(struct platform_device *pdev) return 0; } +static void rk_pcie_shutdown(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct rk_pcie *rk_pcie = dev_get_drvdata(dev); + + dev_dbg(rk_pcie->pci->dev, "shutdown...\n"); + rk_pcie_disable_ltssm(rk_pcie); + rk_pcie_writel_apb(rk_pcie, PCIE_CLIENT_INTR_MASK, 0xffffffff); +} + #ifdef CONFIG_PCIEASPM static void rk_pcie_downstream_dev_to_d0(struct rk_pcie *rk_pcie, bool enable) { @@ -2082,6 +2092,7 @@ static struct platform_driver rk_plat_pcie_driver = { }, .probe = rk_pcie_probe, .remove = rk_pcie_remove, + .shutdown = rk_pcie_shutdown, }; module_platform_driver(rk_plat_pcie_driver);