iwlwifi: avoid duplicate sw reset executions in the code
Most of the sw resets in the code are done by one function, which writes to the relevant CSR. Use the common function to perform the only reset which was done separately, redundant to the common code. Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
This commit is contained in:
parent
fd527eb5d2
commit
870c2a1123
|
@ -579,6 +579,7 @@ struct iwl_trans_ops {
|
|||
void (*configure)(struct iwl_trans *trans,
|
||||
const struct iwl_trans_config *trans_cfg);
|
||||
void (*set_pmi)(struct iwl_trans *trans, bool state);
|
||||
void (*sw_reset)(struct iwl_trans *trans);
|
||||
bool (*grab_nic_access)(struct iwl_trans *trans, unsigned long *flags);
|
||||
void (*release_nic_access)(struct iwl_trans *trans,
|
||||
unsigned long *flags);
|
||||
|
@ -1124,6 +1125,12 @@ static inline void iwl_trans_set_pmi(struct iwl_trans *trans, bool state)
|
|||
trans->ops->set_pmi(trans, state);
|
||||
}
|
||||
|
||||
static inline void iwl_trans_sw_reset(struct iwl_trans *trans)
|
||||
{
|
||||
if (trans->ops->sw_reset)
|
||||
trans->ops->sw_reset(trans);
|
||||
}
|
||||
|
||||
static inline void
|
||||
iwl_trans_set_bits_mask(struct iwl_trans *trans, u32 reg, u32 mask, u32 value)
|
||||
{
|
||||
|
|
|
@ -516,8 +516,7 @@ static void iwl_mvm_dump_lmac_error_log(struct iwl_mvm *mvm, u32 base)
|
|||
IWL_ERR(trans, "HW error, resetting before reading\n");
|
||||
|
||||
/* reset the device */
|
||||
iwl_set_bit(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
|
||||
usleep_range(5000, 6000);
|
||||
iwl_trans_sw_reset(trans);
|
||||
|
||||
/* set INIT_DONE flag */
|
||||
iwl_set_bit(trans, CSR_GP_CNTRL,
|
||||
|
|
|
@ -658,13 +658,6 @@ static inline void iwl_enable_fw_load_int(struct iwl_trans *trans)
|
|||
}
|
||||
}
|
||||
|
||||
static inline void iwl_pcie_sw_reset(struct iwl_trans *trans)
|
||||
{
|
||||
/* Reset entire device - do controller reset (results in SHRD_HW_RST) */
|
||||
iwl_set_bit(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
|
||||
usleep_range(5000, 6000);
|
||||
}
|
||||
|
||||
static inline u8 iwl_pcie_get_cmd_index(struct iwl_txq *q, u32 index)
|
||||
{
|
||||
return index & (q->n_window - 1);
|
||||
|
|
|
@ -137,7 +137,7 @@ static void iwl_pcie_gen2_apm_stop(struct iwl_trans *trans, bool op_mode_leave)
|
|||
/* Stop device's DMA activity */
|
||||
iwl_pcie_apm_stop_master(trans);
|
||||
|
||||
iwl_pcie_sw_reset(trans);
|
||||
iwl_trans_sw_reset(trans);
|
||||
|
||||
/*
|
||||
* Clear "initialization complete" bit to move adapter from
|
||||
|
@ -192,7 +192,7 @@ void _iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans, bool low_power)
|
|||
/* Stop the device, and put it in low power state */
|
||||
iwl_pcie_gen2_apm_stop(trans, false);
|
||||
|
||||
iwl_pcie_sw_reset(trans);
|
||||
iwl_trans_sw_reset(trans);
|
||||
|
||||
/*
|
||||
* Upon stop, the IVAR table gets erased, so msi-x won't
|
||||
|
|
|
@ -176,6 +176,13 @@ out:
|
|||
kfree(buf);
|
||||
}
|
||||
|
||||
static void iwl_trans_pcie_sw_reset(struct iwl_trans *trans)
|
||||
{
|
||||
/* Reset entire device - do controller reset (results in SHRD_HW_RST) */
|
||||
iwl_set_bit(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
|
||||
usleep_range(5000, 6000);
|
||||
}
|
||||
|
||||
static void iwl_pcie_free_fw_monitor(struct iwl_trans *trans)
|
||||
{
|
||||
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
|
||||
|
@ -446,7 +453,7 @@ static void iwl_pcie_apm_lp_xtal_enable(struct iwl_trans *trans)
|
|||
__iwl_trans_pcie_set_bit(trans, CSR_GP_CNTRL,
|
||||
CSR_GP_CNTRL_REG_FLAG_XTAL_ON);
|
||||
|
||||
iwl_pcie_sw_reset(trans);
|
||||
iwl_trans_pcie_sw_reset(trans);
|
||||
|
||||
/*
|
||||
* Set "initialization complete" bit to move adapter from
|
||||
|
@ -487,7 +494,7 @@ static void iwl_pcie_apm_lp_xtal_enable(struct iwl_trans *trans)
|
|||
apmg_xtal_cfg_reg |
|
||||
SHR_APMG_XTAL_CFG_XTAL_ON_REQ);
|
||||
|
||||
iwl_pcie_sw_reset(trans);
|
||||
iwl_trans_pcie_sw_reset(trans);
|
||||
|
||||
/* Enable LP XTAL by indirect access through CSR */
|
||||
apmg_gp1_reg = iwl_trans_pcie_read_shr(trans, SHR_APMG_GP1_REG);
|
||||
|
@ -580,7 +587,7 @@ static void iwl_pcie_apm_stop(struct iwl_trans *trans, bool op_mode_leave)
|
|||
return;
|
||||
}
|
||||
|
||||
iwl_pcie_sw_reset(trans);
|
||||
iwl_trans_pcie_sw_reset(trans);
|
||||
|
||||
/*
|
||||
* Clear "initialization complete" bit to move adapter from
|
||||
|
@ -1265,7 +1272,7 @@ static void _iwl_trans_pcie_stop_device(struct iwl_trans *trans, bool low_power)
|
|||
/* Stop the device, and put it in low power state */
|
||||
iwl_pcie_apm_stop(trans, false);
|
||||
|
||||
iwl_pcie_sw_reset(trans);
|
||||
iwl_trans_pcie_sw_reset(trans);
|
||||
|
||||
/*
|
||||
* Upon stop, the IVAR table gets erased, so msi-x won't
|
||||
|
@ -1739,7 +1746,7 @@ static int _iwl_trans_pcie_start_hw(struct iwl_trans *trans, bool low_power)
|
|||
return err;
|
||||
}
|
||||
|
||||
iwl_pcie_sw_reset(trans);
|
||||
iwl_trans_pcie_sw_reset(trans);
|
||||
|
||||
err = iwl_pcie_apm_init(trans);
|
||||
if (err)
|
||||
|
@ -3044,6 +3051,7 @@ static void iwl_trans_pcie_resume(struct iwl_trans *trans)
|
|||
.write_mem = iwl_trans_pcie_write_mem, \
|
||||
.configure = iwl_trans_pcie_configure, \
|
||||
.set_pmi = iwl_trans_pcie_set_pmi, \
|
||||
.sw_reset = iwl_trans_pcie_sw_reset, \
|
||||
.grab_nic_access = iwl_trans_pcie_grab_nic_access, \
|
||||
.release_nic_access = iwl_trans_pcie_release_nic_access, \
|
||||
.set_bits_mask = iwl_trans_pcie_set_bits_mask, \
|
||||
|
|
Loading…
Reference in New Issue