cnss2: Enable self-recovery only when host driver detects linkdown

Enable self recovery only when the host driver detects link down.

Change-Id: I415dd838ef9288922ceeb0ab46b7b6ea95d00ebb
Signed-off-by: Mohammed Siddiq <msiddiq@codeaurora.org>
This commit is contained in:
Mohammed Siddiq 2020-09-24 23:00:23 +05:30
commit 02e42bd387
2 changed files with 17 additions and 4 deletions

View file

@ -1117,6 +1117,11 @@ static int cnss_do_recovery(struct cnss_plat_data *plat_priv,
self_recovery:
cnss_pr_dbg("Going for self recovery\n");
cnss_bus_dev_shutdown(plat_priv);
if (test_bit(LINK_DOWN_SELF_RECOVERY, &plat_priv->ctrl_params.quirks))
clear_bit(LINK_DOWN_SELF_RECOVERY,
&plat_priv->ctrl_params.quirks);
cnss_bus_dev_powerup(plat_priv);
return 0;
@ -2623,10 +2628,6 @@ static void cnss_init_control_params(struct cnss_plat_data *plat_priv)
of_property_read_bool(plat_priv->plat_dev->dev.of_node,
"qcom,wlan-cbc-enabled");
if (of_property_read_bool(plat_priv->plat_dev->dev.of_node,
"cnss-enable-self-recovery"))
plat_priv->ctrl_params.quirks |= BIT(LINK_DOWN_SELF_RECOVERY);
plat_priv->ctrl_params.mhi_timeout = CNSS_MHI_TIMEOUT_DEFAULT;
plat_priv->ctrl_params.mhi_m2_timeout = CNSS_MHI_M2_TIMEOUT_DEFAULT;
plat_priv->ctrl_params.qmi_timeout = CNSS_QMI_TIMEOUT_DEFAULT;

View file

@ -968,6 +968,7 @@ int cnss_pci_link_down(struct device *dev)
{
struct pci_dev *pci_dev = to_pci_dev(dev);
struct cnss_pci_data *pci_priv = cnss_get_pci_priv(pci_dev);
struct cnss_plat_data *plat_priv = NULL;
int ret;
if (!pci_priv) {
@ -975,6 +976,17 @@ int cnss_pci_link_down(struct device *dev)
return -EINVAL;
}
plat_priv = pci_priv->plat_priv;
if (!plat_priv) {
cnss_pr_err("plat_priv is NULL\n");
return -ENODEV;
}
if (pci_priv->drv_connected_last &&
of_property_read_bool(plat_priv->plat_dev->dev.of_node,
"cnss-enable-self-recovery"))
plat_priv->ctrl_params.quirks |= BIT(LINK_DOWN_SELF_RECOVERY);
cnss_pr_err("PCI link down is detected by drivers\n");
ret = msm_pcie_pm_control(MSM_PCIE_HANDLE_LINKDOWN,