From dafef170fb99d4453311886d771e646dd775820f Mon Sep 17 00:00:00 2001 From: Tony Truong Date: Thu, 13 Feb 2020 15:41:05 -0800 Subject: [PATCH] msm: pcie: add proper PCIe link state for linkdown When PCIe root complex receives a linkdown, move PCIe S/W state to MSM_PCIE_LINK_DOWN instead. When using MSM_PCIE_LINK_DISABLED, there is a chance PCIe resume will execute even though PCIe core and PHY is still up. Change-Id: Ifee3c60d5eedf1fd73751fa13905e9f32d17bbae Signed-off-by: Tony Truong --- drivers/pci/controller/pci-msm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pci-msm.c b/drivers/pci/controller/pci-msm.c index 958f6660397a..a45f544126c2 100644 --- a/drivers/pci/controller/pci-msm.c +++ b/drivers/pci/controller/pci-msm.c @@ -321,6 +321,7 @@ enum msm_pcie_link_status { MSM_PCIE_LINK_ENABLED, MSM_PCIE_LINK_DISABLED, MSM_PCIE_LINK_DRV, + MSM_PCIE_LINK_DOWN, }; enum msm_pcie_boot_option { @@ -4840,7 +4841,7 @@ static irqreturn_t handle_aer_irq(int irq, void *data) msm_pcie_write_mask(dev->dm_core + PCIE20_CAP_DEVCTRLSTATUS, 0, BIT(18)|BIT(17)|BIT(16)); - if (dev->link_status == MSM_PCIE_LINK_DISABLED) { + if (dev->link_status != MSM_PCIE_LINK_ENABLED) { PCIE_DBG2(dev, "RC%d link is down\n", dev->rc_idx); goto out; } @@ -4991,7 +4992,7 @@ static irqreturn_t handle_linkdown_irq(int irq, void *data) "PCIe:the link of RC%d is suspending.\n", dev->rc_idx); } else { - dev->link_status = MSM_PCIE_LINK_DISABLED; + dev->link_status = MSM_PCIE_LINK_DOWN; dev->shadow_en = false; if (dev->linkdown_panic)