aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/intel/iwlwifi
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2017-06-27 05:29:26 -0400
committerLuca Coelho <luciano.coelho@intel.com>2017-06-29 14:02:51 -0400
commit099a628bf6d9bb1d66cc0383f97cea19cfa4aacc (patch)
treefa7892fc9ef80b0898b0fc6faba4d6b79633ec25 /drivers/net/wireless/intel/iwlwifi
parent52b6e168ae579483d71621e4d64d6491e8973e91 (diff)
iwlwifi: pcie: wait longer after device reset
The newest devices need a longer time to reset because of their more complex hardware. Wait 5ms after device reset. Consolidate all the places that reset the device in the PCIe transport to avoid future bugs. While at it, unify the flow to use set_bit instead of full write as requested by the hardware designers. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi')
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/utils.c2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/internal.h7
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c8
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/trans.c23
4 files changed, 15 insertions, 25 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
index bd2596fdafda..fc5a490880d0 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
@@ -526,7 +526,7 @@ static void iwl_mvm_dump_lmac_error_log(struct iwl_mvm *mvm, u32 base)
526 526
527 /* reset the device */ 527 /* reset the device */
528 iwl_set_bit(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); 528 iwl_set_bit(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
529 usleep_range(1000, 2000); 529 usleep_range(5000, 6000);
530 530
531 /* set INIT_DONE flag */ 531 /* set INIT_DONE flag */
532 iwl_set_bit(trans, CSR_GP_CNTRL, 532 iwl_set_bit(trans, CSR_GP_CNTRL,
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
index 7ec2d96ccceb..fa315d84e98e 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
@@ -654,6 +654,13 @@ static inline void iwl_enable_fw_load_int(struct iwl_trans *trans)
654 } 654 }
655} 655}
656 656
657static inline void iwl_pcie_sw_reset(struct iwl_trans *trans)
658{
659 /* Reset entire device - do controller reset (results in SHRD_HW_RST) */
660 iwl_set_bit(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
661 usleep_range(5000, 6000);
662}
663
657static inline void *iwl_pcie_get_tfd(struct iwl_trans_pcie *trans_pcie, 664static inline void *iwl_pcie_get_tfd(struct iwl_trans_pcie *trans_pcie,
658 struct iwl_txq *txq, int idx) 665 struct iwl_txq *txq, int idx)
659{ 666{
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
index e84c5ff389a8..b84b78293e7b 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
@@ -136,9 +136,7 @@ static void iwl_pcie_gen2_apm_stop(struct iwl_trans *trans, bool op_mode_leave)
136 /* Stop device's DMA activity */ 136 /* Stop device's DMA activity */
137 iwl_pcie_apm_stop_master(trans); 137 iwl_pcie_apm_stop_master(trans);
138 138
139 /* Reset the entire device */ 139 iwl_pcie_sw_reset(trans);
140 iwl_set_bit(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
141 usleep_range(1000, 2000);
142 140
143 /* 141 /*
144 * Clear "initialization complete" bit to move adapter from 142 * Clear "initialization complete" bit to move adapter from
@@ -188,9 +186,7 @@ void _iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans, bool low_power)
188 /* Stop the device, and put it in low power state */ 186 /* Stop the device, and put it in low power state */
189 iwl_pcie_gen2_apm_stop(trans, false); 187 iwl_pcie_gen2_apm_stop(trans, false);
190 188
191 /* stop and reset the on-board processor */ 189 iwl_pcie_sw_reset(trans);
192 iwl_write32(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
193 usleep_range(1000, 2000);
194 190
195 /* 191 /*
196 * Upon stop, the IVAR table gets erased, so msi-x won't 192 * Upon stop, the IVAR table gets erased, so msi-x won't
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index cac584cc07b6..92b3a55d0fbc 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -358,9 +358,7 @@ static void iwl_pcie_apm_lp_xtal_enable(struct iwl_trans *trans)
358 __iwl_trans_pcie_set_bit(trans, CSR_GP_CNTRL, 358 __iwl_trans_pcie_set_bit(trans, CSR_GP_CNTRL,
359 CSR_GP_CNTRL_REG_FLAG_XTAL_ON); 359 CSR_GP_CNTRL_REG_FLAG_XTAL_ON);
360 360
361 /* Reset entire device - do controller reset (results in SHRD_HW_RST) */ 361 iwl_pcie_sw_reset(trans);
362 iwl_set_bit(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
363 usleep_range(1000, 2000);
364 362
365 /* 363 /*
366 * Set "initialization complete" bit to move adapter from 364 * Set "initialization complete" bit to move adapter from
@@ -401,12 +399,7 @@ static void iwl_pcie_apm_lp_xtal_enable(struct iwl_trans *trans)
401 apmg_xtal_cfg_reg | 399 apmg_xtal_cfg_reg |
402 SHR_APMG_XTAL_CFG_XTAL_ON_REQ); 400 SHR_APMG_XTAL_CFG_XTAL_ON_REQ);
403 401
404 /* 402 iwl_pcie_sw_reset(trans);
405 * Reset entire device again - do controller reset (results in
406 * SHRD_HW_RST). Turn MAC off before proceeding.
407 */
408 iwl_set_bit(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
409 usleep_range(1000, 2000);
410 403
411 /* Enable LP XTAL by indirect access through CSR */ 404 /* Enable LP XTAL by indirect access through CSR */
412 apmg_gp1_reg = iwl_trans_pcie_read_shr(trans, SHR_APMG_GP1_REG); 405 apmg_gp1_reg = iwl_trans_pcie_read_shr(trans, SHR_APMG_GP1_REG);
@@ -499,9 +492,7 @@ static void iwl_pcie_apm_stop(struct iwl_trans *trans, bool op_mode_leave)
499 return; 492 return;
500 } 493 }
501 494
502 /* Reset the entire device */ 495 iwl_pcie_sw_reset(trans);
503 iwl_set_bit(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
504 usleep_range(1000, 2000);
505 496
506 /* 497 /*
507 * Clear "initialization complete" bit to move adapter from 498 * Clear "initialization complete" bit to move adapter from
@@ -1181,9 +1172,7 @@ static void _iwl_trans_pcie_stop_device(struct iwl_trans *trans, bool low_power)
1181 /* Stop the device, and put it in low power state */ 1172 /* Stop the device, and put it in low power state */
1182 iwl_pcie_apm_stop(trans, false); 1173 iwl_pcie_apm_stop(trans, false);
1183 1174
1184 /* stop and reset the on-board processor */ 1175 iwl_pcie_sw_reset(trans);
1185 iwl_write32(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
1186 usleep_range(1000, 2000);
1187 1176
1188 /* 1177 /*
1189 * Upon stop, the IVAR table gets erased, so msi-x won't 1178 * Upon stop, the IVAR table gets erased, so msi-x won't
@@ -1657,9 +1646,7 @@ static int _iwl_trans_pcie_start_hw(struct iwl_trans *trans, bool low_power)
1657 return err; 1646 return err;
1658 } 1647 }
1659 1648
1660 /* Reset the entire device */ 1649 iwl_pcie_sw_reset(trans);
1661 iwl_write32(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
1662 usleep_range(1000, 2000);
1663 1650
1664 err = iwl_pcie_apm_init(trans); 1651 err = iwl_pcie_apm_init(trans);
1665 if (err) 1652 if (err)