aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/mvm/fw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/fw.c')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/fw.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw.c b/drivers/net/wireless/iwlwifi/mvm/fw.c
index c76299a3a1e0..70e5297646b2 100644
--- a/drivers/net/wireless/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/iwlwifi/mvm/fw.c
@@ -151,13 +151,11 @@ static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm,
151 enum iwl_ucode_type old_type = mvm->cur_ucode; 151 enum iwl_ucode_type old_type = mvm->cur_ucode;
152 static const u8 alive_cmd[] = { MVM_ALIVE }; 152 static const u8 alive_cmd[] = { MVM_ALIVE };
153 153
154 mvm->cur_ucode = ucode_type;
155 fw = iwl_get_ucode_image(mvm, ucode_type); 154 fw = iwl_get_ucode_image(mvm, ucode_type);
156 155 if (WARN_ON(!fw))
157 mvm->ucode_loaded = false;
158
159 if (!fw)
160 return -EINVAL; 156 return -EINVAL;
157 mvm->cur_ucode = ucode_type;
158 mvm->ucode_loaded = false;
161 159
162 iwl_init_notification_wait(&mvm->notif_wait, &alive_wait, 160 iwl_init_notification_wait(&mvm->notif_wait, &alive_wait,
163 alive_cmd, ARRAY_SIZE(alive_cmd), 161 alive_cmd, ARRAY_SIZE(alive_cmd),
@@ -199,7 +197,7 @@ static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm,
199 */ 197 */
200 198
201 for (i = 0; i < IWL_MAX_HW_QUEUES; i++) { 199 for (i = 0; i < IWL_MAX_HW_QUEUES; i++) {
202 if (i < IWL_MVM_FIRST_AGG_QUEUE && i != IWL_MVM_CMD_QUEUE) 200 if (i < mvm->first_agg_queue && i != IWL_MVM_CMD_QUEUE)
203 mvm->queue_to_mac80211[i] = i; 201 mvm->queue_to_mac80211[i] = i;
204 else 202 else
205 mvm->queue_to_mac80211[i] = IWL_INVALID_MAC80211_QUEUE; 203 mvm->queue_to_mac80211[i] = IWL_INVALID_MAC80211_QUEUE;
@@ -243,7 +241,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
243 241
244 lockdep_assert_held(&mvm->mutex); 242 lockdep_assert_held(&mvm->mutex);
245 243
246 if (mvm->init_ucode_run) 244 if (mvm->init_ucode_complete)
247 return 0; 245 return 0;
248 246
249 iwl_init_notification_wait(&mvm->notif_wait, 247 iwl_init_notification_wait(&mvm->notif_wait,
@@ -264,6 +262,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
264 if (ret) 262 if (ret)
265 goto error; 263 goto error;
266 264
265 /* Read the NVM only at driver load time, no need to do this twice */
267 if (read_nvm) { 266 if (read_nvm) {
268 /* Read nvm */ 267 /* Read nvm */
269 ret = iwl_nvm_init(mvm); 268 ret = iwl_nvm_init(mvm);
@@ -273,6 +272,10 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
273 } 272 }
274 } 273 }
275 274
275 /* In case we read the NVM from external file, load it to the NIC */
276 if (iwlwifi_mod_params.nvm_file)
277 iwl_mvm_load_nvm_to_nic(mvm);
278
276 ret = iwl_nvm_check_version(mvm->nvm_data, mvm->trans); 279 ret = iwl_nvm_check_version(mvm->nvm_data, mvm->trans);
277 WARN_ON(ret); 280 WARN_ON(ret);
278 281
@@ -310,7 +313,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
310 ret = iwl_wait_notification(&mvm->notif_wait, &calib_wait, 313 ret = iwl_wait_notification(&mvm->notif_wait, &calib_wait,
311 MVM_UCODE_CALIB_TIMEOUT); 314 MVM_UCODE_CALIB_TIMEOUT);
312 if (!ret) 315 if (!ret)
313 mvm->init_ucode_run = true; 316 mvm->init_ucode_complete = true;
314 goto out; 317 goto out;
315 318
316error: 319error:
@@ -353,8 +356,12 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
353 if (ret) 356 if (ret)
354 return ret; 357 return ret;
355 358
356 /* If we were in RFKILL during module loading, load init ucode now */ 359 /*
357 if (!mvm->init_ucode_run) { 360 * If we haven't completed the run of the init ucode during
361 * module loading, load init ucode now
362 * (for example, if we were in RFKILL)
363 */
364 if (!mvm->init_ucode_complete) {
358 ret = iwl_run_init_mvm_ucode(mvm, false); 365 ret = iwl_run_init_mvm_ucode(mvm, false);
359 if (ret && !iwlmvm_mod_params.init_dbg) { 366 if (ret && !iwlmvm_mod_params.init_dbg) {
360 IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", ret); 367 IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", ret);
@@ -424,6 +431,10 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
424 goto error; 431 goto error;
425 } 432 }
426 433
434 ret = iwl_mvm_power_update_device_mode(mvm);
435 if (ret)
436 goto error;
437
427 IWL_DEBUG_INFO(mvm, "RT uCode started.\n"); 438 IWL_DEBUG_INFO(mvm, "RT uCode started.\n");
428 return 0; 439 return 0;
429 error: 440 error: