PCI: rockchip: make link down in .remove

It's safe to disable the link state after EP driver removed

Change-Id: I36f811ad353b7384a792adf7da904442afbe45d6
Signed-off-by: Simon Xue <xxm@rock-chips.com>
This commit is contained in:
Simon Xue
2019-10-25 08:24:01 +08:00
committed by Tao Huang
parent a82a0c27da
commit 770dc69cdc

View File

@@ -1291,6 +1291,7 @@ static int rockchip_pcie_remove(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct rockchip_pcie *rockchip = dev_get_drvdata(dev);
u32 status1, status2;
u32 status;
status1 = rockchip_pcie_read(rockchip, PCIE_CLIENT_BASIC_STATUS1);
status2 = rockchip_pcie_read(rockchip, PCIE_CLIENT_DEBUG_OUT_0);
@@ -1306,6 +1307,17 @@ static int rockchip_pcie_remove(struct platform_device *pdev)
pci_unmap_iospace(rockchip->io);
irq_domain_remove(rockchip->irq_domain);
/* disable link state */
status = rockchip_pcie_read(rockchip, PCIE_RC_CONFIG_LCS);
status |= BIT(4);
rockchip_pcie_write(rockchip, status, PCIE_RC_CONFIG_LCS);
mdelay(1);
status = rockchip_pcie_read(rockchip, PCIE_RC_CONFIG_LCS);
status &= ~BIT(4);
rockchip_pcie_write(rockchip, status, PCIE_RC_CONFIG_LCS);
rockchip_pcie_deinit_phys(rockchip);
rockchip_pcie_disable_clocks(rockchip);