cnss2: Skip link down recovery if link has been recovered by retry

There is no need to proceed link down recovery if link has been recovered
by retries during power on sequence.

Change-Id: I876f2e239b519d4230b5c115cdc05ff7650f5cd1
Signed-off-by: Yue Ma <yuem@codeaurora.org>
This commit is contained in:
Yue Ma 2020-03-31 16:28:46 -07:00
commit cd68afdcc7
5 changed files with 22 additions and 1 deletions

View file

@ -418,6 +418,21 @@ int cnss_bus_is_device_down(struct cnss_plat_data *plat_priv)
}
}
int cnss_bus_check_link_status(struct cnss_plat_data *plat_priv)
{
if (!plat_priv)
return -ENODEV;
switch (plat_priv->bus_type) {
case CNSS_BUS_PCI:
return cnss_pci_check_link_status(plat_priv->bus_priv);
default:
cnss_pr_dbg("Unsupported bus type: %d\n",
plat_priv->bus_type);
return 0;
}
}
int cnss_bus_debug_reg_read(struct cnss_plat_data *plat_priv, u32 offset,
u32 *val)
{

View file

@ -48,6 +48,7 @@ int cnss_bus_call_driver_modem_status(struct cnss_plat_data *plat_priv,
int cnss_bus_update_status(struct cnss_plat_data *plat_priv,
enum cnss_driver_status status);
int cnss_bus_is_device_down(struct cnss_plat_data *plat_priv);
int cnss_bus_check_link_status(struct cnss_plat_data *plat_priv);
int cnss_bus_debug_reg_read(struct cnss_plat_data *plat_priv, u32 offset,
u32 *val);
int cnss_bus_debug_reg_write(struct cnss_plat_data *plat_priv, u32 offset,

View file

@ -996,6 +996,10 @@ static int cnss_do_recovery(struct cnss_plat_data *plat_priv,
switch (reason) {
case CNSS_REASON_LINK_DOWN:
if (!cnss_bus_check_link_status(plat_priv)) {
cnss_pr_dbg("Skip link down recovery as link is already up\n");
return 0;
}
if (test_bit(LINK_DOWN_SELF_RECOVERY,
&plat_priv->ctrl_params.quirks))
goto self_recovery;

View file

@ -374,7 +374,7 @@ static struct cnss_bus_bw_cfg cnss_bus_bw_table[] = {
#define PCIE_REG_SIZE ARRAY_SIZE(pcie_reg_access_seq)
#define WLAON_REG_SIZE ARRAY_SIZE(wlaon_reg_access_seq)
static int cnss_pci_check_link_status(struct cnss_pci_data *pci_priv)
int cnss_pci_check_link_status(struct cnss_pci_data *pci_priv)
{
u16 device_id;

View file

@ -161,6 +161,7 @@ static inline int cnss_pci_get_drv_connected(void *bus_priv)
return atomic_read(&pci_priv->drv_connected);
}
int cnss_pci_check_link_status(struct cnss_pci_data *pci_priv);
int cnss_suspend_pci_link(struct cnss_pci_data *pci_priv);
int cnss_resume_pci_link(struct cnss_pci_data *pci_priv);
int cnss_pci_init(struct cnss_plat_data *plat_priv);