Commit 501fd989 authored by Emmanuel Grumbach's avatar Emmanuel Grumbach

iwlwifi: pcie: try to get ownership several times

Some races with the hardware can happen when we take
ownership of the device. Don't give up after the first try.

Cc: <stable@vger.kernel.org>
Reviewed-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
parent e02a9d60
...@@ -454,6 +454,7 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) ...@@ -454,6 +454,7 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans)
{ {
int ret; int ret;
int t = 0; int t = 0;
int iter;
IWL_DEBUG_INFO(trans, "iwl_trans_prepare_card_hw enter\n"); IWL_DEBUG_INFO(trans, "iwl_trans_prepare_card_hw enter\n");
...@@ -462,6 +463,7 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) ...@@ -462,6 +463,7 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans)
if (ret >= 0) if (ret >= 0)
return 0; return 0;
for (iter = 0; iter < 10; iter++) {
/* If HW is not ready, prepare the conditions to check again */ /* If HW is not ready, prepare the conditions to check again */
iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_PREPARE); CSR_HW_IF_CONFIG_REG_PREPARE);
...@@ -474,6 +476,10 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) ...@@ -474,6 +476,10 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans)
usleep_range(200, 1000); usleep_range(200, 1000);
t += 200; t += 200;
} while (t < 150000); } while (t < 150000);
msleep(25);
}
IWL_DEBUG_INFO(trans, "got NIC after %d iterations\n", iter);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment