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 <truong@codeaurora.org>
This commit is contained in:
Tony Truong 2020-02-13 15:41:05 -08:00 • committed by Gerrit - the friendly Code Review server
commit dafef170fb

View file

@ -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)