diff options
author | Eran Harary <eran.harary@intel.com> | 2014-04-23 03:46:09 -0400 |
---|---|---|
committer | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2014-05-06 13:40:02 -0400 |
commit | 14b485f041e35f60212317017c2127b8a9b6be31 (patch) | |
tree | 3b070e751da261f80b1c4ec8c5b992d7336d4f18 /drivers/net/wireless/iwlwifi | |
parent | 300855443ee722e49ebd0d9ca086d68886cf4a83 (diff) |
iwlwifi: mvm: prevent nic to powered up at driver load
A few devices aren't allowed to be powered up at driver
load time. Add "power_up_nic_in_init" flag to iwl_cfg
structure to customize the load flow according to the
device.
Signed-off-by: Eran Harary <eran.harary@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-config.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/fw.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/mvm.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/nvm.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/ops.c | 16 |
5 files changed, 18 insertions, 9 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-config.h b/drivers/net/wireless/iwlwifi/iwl-config.h index b73eac9428a7..97f23d6e480b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-config.h +++ b/drivers/net/wireless/iwlwifi/iwl-config.h | |||
@@ -274,6 +274,7 @@ struct iwl_cfg { | |||
274 | u8 nvm_hw_section_num; | 274 | u8 nvm_hw_section_num; |
275 | bool lp_xtal_workaround; | 275 | bool lp_xtal_workaround; |
276 | const struct iwl_pwr_tx_backoff *pwr_tx_backoffs; | 276 | const struct iwl_pwr_tx_backoff *pwr_tx_backoffs; |
277 | bool no_power_up_nic_in_init; | ||
277 | }; | 278 | }; |
278 | 279 | ||
279 | /* | 280 | /* |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw.c b/drivers/net/wireless/iwlwifi/mvm/fw.c index 3d99cf564ba6..34ae3f32b300 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/iwlwifi/mvm/fw.c | |||
@@ -295,7 +295,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm) | |||
295 | /* Read the NVM only at driver load time, no need to do this twice */ | 295 | /* Read the NVM only at driver load time, no need to do this twice */ |
296 | if (read_nvm) { | 296 | if (read_nvm) { |
297 | /* Read nvm */ | 297 | /* Read nvm */ |
298 | ret = iwl_nvm_init(mvm); | 298 | ret = iwl_nvm_init(mvm, true); |
299 | if (ret) { | 299 | if (ret) { |
300 | IWL_ERR(mvm, "Failed to read NVM: %d\n", ret); | 300 | IWL_ERR(mvm, "Failed to read NVM: %d\n", ret); |
301 | goto error; | 301 | goto error; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index 17c42da5f9f2..b52d1c97e289 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h | |||
@@ -757,7 +757,7 @@ int iwl_mvm_rx_statistics(struct iwl_mvm *mvm, | |||
757 | struct iwl_device_cmd *cmd); | 757 | struct iwl_device_cmd *cmd); |
758 | 758 | ||
759 | /* NVM */ | 759 | /* NVM */ |
760 | int iwl_nvm_init(struct iwl_mvm *mvm); | 760 | int iwl_nvm_init(struct iwl_mvm *mvm, bool read_nvm_from_nic); |
761 | int iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm); | 761 | int iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm); |
762 | 762 | ||
763 | int iwl_mvm_up(struct iwl_mvm *mvm); | 763 | int iwl_mvm_up(struct iwl_mvm *mvm); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/nvm.c b/drivers/net/wireless/iwlwifi/mvm/nvm.c index 4092422cb849..fe4c91e7c27c 100644 --- a/drivers/net/wireless/iwlwifi/mvm/nvm.c +++ b/drivers/net/wireless/iwlwifi/mvm/nvm.c | |||
@@ -427,7 +427,7 @@ int iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm) | |||
427 | return ret; | 427 | return ret; |
428 | } | 428 | } |
429 | 429 | ||
430 | int iwl_nvm_init(struct iwl_mvm *mvm) | 430 | int iwl_nvm_init(struct iwl_mvm *mvm, bool read_nvm_from_nic) |
431 | { | 431 | { |
432 | int ret, i, section; | 432 | int ret, i, section; |
433 | u8 *nvm_buffer, *temp; | 433 | u8 *nvm_buffer, *temp; |
@@ -443,7 +443,9 @@ int iwl_nvm_init(struct iwl_mvm *mvm) | |||
443 | ret = iwl_mvm_read_external_nvm(mvm); | 443 | ret = iwl_mvm_read_external_nvm(mvm); |
444 | if (ret) | 444 | if (ret) |
445 | return ret; | 445 | return ret; |
446 | } else { | 446 | } |
447 | |||
448 | if (read_nvm_from_nic) { | ||
447 | /* list of NVM sections we are allowed/need to read */ | 449 | /* list of NVM sections we are allowed/need to read */ |
448 | if (mvm->trans->cfg->device_family != IWL_DEVICE_FAMILY_8000) { | 450 | if (mvm->trans->cfg->device_family != IWL_DEVICE_FAMILY_8000) { |
449 | nvm_to_read[0] = mvm->cfg->nvm_hw_section_num; | 451 | nvm_to_read[0] = mvm->cfg->nvm_hw_section_num; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c index 7a5a8bac5fd0..3c14ea1ffae3 100644 --- a/drivers/net/wireless/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/iwlwifi/mvm/ops.c | |||
@@ -467,12 +467,18 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | |||
467 | min_backoff = calc_min_backoff(trans, cfg); | 467 | min_backoff = calc_min_backoff(trans, cfg); |
468 | iwl_mvm_tt_initialize(mvm, min_backoff); | 468 | iwl_mvm_tt_initialize(mvm, min_backoff); |
469 | 469 | ||
470 | if (WARN(cfg->no_power_up_nic_in_init && !iwlwifi_mod_params.nvm_file, | ||
471 | "not allowing power-up and not having nvm_file\n")) | ||
472 | goto out_free; | ||
473 | |||
470 | /* | 474 | /* |
471 | * If the NVM exists in an external file, | 475 | * Even if nvm exists in the nvm_file driver should read agin the nvm |
472 | * there is no need to unnecessarily power up the NIC at driver load | 476 | * from the nic because there might be entries that exist in the OTP |
477 | * and not in the file. | ||
478 | * for nics with no_power_up_nic_in_init: rely completley on nvm_file | ||
473 | */ | 479 | */ |
474 | if (iwlwifi_mod_params.nvm_file) { | 480 | if (cfg->no_power_up_nic_in_init && iwlwifi_mod_params.nvm_file) { |
475 | err = iwl_nvm_init(mvm); | 481 | err = iwl_nvm_init(mvm, false); |
476 | if (err) | 482 | if (err) |
477 | goto out_free; | 483 | goto out_free; |
478 | } else { | 484 | } else { |
@@ -519,7 +525,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | |||
519 | out_free: | 525 | out_free: |
520 | iwl_phy_db_free(mvm->phy_db); | 526 | iwl_phy_db_free(mvm->phy_db); |
521 | kfree(mvm->scan_cmd); | 527 | kfree(mvm->scan_cmd); |
522 | if (!iwlwifi_mod_params.nvm_file) | 528 | if (!cfg->no_power_up_nic_in_init || !iwlwifi_mod_params.nvm_file) |
523 | iwl_trans_op_mode_leave(trans); | 529 | iwl_trans_op_mode_leave(trans); |
524 | ieee80211_free_hw(mvm->hw); | 530 | ieee80211_free_hw(mvm->hw); |
525 | return NULL; | 531 | return NULL; |