From 3ebe41df9a4a117f81e2f86f21930a362e4d4888 Mon Sep 17 00:00:00 2001 From: Mohammed Siddiq Date: Fri, 16 Jul 2021 16:56:11 +0530 Subject: [PATCH] cnss2: Add code to do PCIe L2 suspend during shutdown During mhi resume if mhi detects link down then it posts link recover event where cnss platform driver goes for self recovery, as part of recovery the shutdown & powerup sequence is done. During shutdown the PCIe link is suspended, the link suspend should be L2 suspend. But in current scenario, it goes for DRV suspend as the drv_connected_last flag is still set because resume is initiated by host driver to get qmi stats via cnss_pci_resume_bus. So on power up the link does not come up as it tries for DRV resume instead of L2 resume. To fix this, during shutdown the link suspend should be L2 suspend, so add code to always do PCIe L2 suspend during shutdown. Change-Id: I748d2e243bf4491ec31bc42027514a73c3d945b4 Signed-off-by: Mohammed Siddiq --- drivers/net/wireless/cnss2/pci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/cnss2/pci.c b/drivers/net/wireless/cnss2/pci.c index 08635be66660..bfd199c16b87 100644 --- a/drivers/net/wireless/cnss2/pci.c +++ b/drivers/net/wireless/cnss2/pci.c @@ -1107,6 +1107,9 @@ int cnss_suspend_pci_link(struct cnss_pci_data *pci_priv) cnss_pr_err("Failed to set D3Hot, err = %d\n", ret); } + /* Always do PCIe L2 suspend during power off/PCIe link recovery */ + pci_priv->drv_connected_last = 0; + ret = cnss_set_pci_link(pci_priv, PCI_LINK_DOWN); if (ret) goto out; @@ -1184,8 +1187,6 @@ int cnss_pci_recover_link_down(struct cnss_pci_data *pci_priv) */ msleep(WAKE_EVENT_TIMEOUT); - /* Always do PCIe L2 suspend/resume during link down recovery */ - pci_priv->drv_connected_last = 0; ret = cnss_suspend_pci_link(pci_priv); if (ret) cnss_pr_err("Failed to suspend PCI link, err = %d\n", ret);