diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-core.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.c | 71 |
1 files changed, 26 insertions, 45 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 45ec5cfe3fc..885167f8168 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -67,30 +67,6 @@ u32 iwl_debug_level; | |||
67 | 67 | ||
68 | const u8 iwl_bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; | 68 | const u8 iwl_bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; |
69 | 69 | ||
70 | |||
71 | /* This function both allocates and initializes hw and priv. */ | ||
72 | struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg) | ||
73 | { | ||
74 | struct iwl_priv *priv; | ||
75 | /* mac80211 allocates memory for this device instance, including | ||
76 | * space for this driver's private structure */ | ||
77 | struct ieee80211_hw *hw; | ||
78 | |||
79 | hw = ieee80211_alloc_hw(sizeof(struct iwl_priv), | ||
80 | cfg->ops->ieee80211_ops); | ||
81 | if (hw == NULL) { | ||
82 | pr_err("%s: Can not allocate network device\n", | ||
83 | cfg->name); | ||
84 | goto out; | ||
85 | } | ||
86 | |||
87 | priv = hw->priv; | ||
88 | priv->hw = hw; | ||
89 | |||
90 | out: | ||
91 | return hw; | ||
92 | } | ||
93 | |||
94 | #define MAX_BIT_RATE_40_MHZ 150 /* Mbps */ | 70 | #define MAX_BIT_RATE_40_MHZ 150 /* Mbps */ |
95 | #define MAX_BIT_RATE_20_MHZ 72 /* Mbps */ | 71 | #define MAX_BIT_RATE_20_MHZ 72 /* Mbps */ |
96 | static void iwlcore_init_ht_hw_capab(const struct iwl_priv *priv, | 72 | static void iwlcore_init_ht_hw_capab(const struct iwl_priv *priv, |
@@ -965,12 +941,10 @@ void iwl_irq_handle_error(struct iwl_priv *priv) | |||
965 | IWL_ERR(priv, "Loaded firmware version: %s\n", | 941 | IWL_ERR(priv, "Loaded firmware version: %s\n", |
966 | priv->hw->wiphy->fw_version); | 942 | priv->hw->wiphy->fw_version); |
967 | 943 | ||
968 | priv->cfg->ops->lib->dump_nic_error_log(priv); | 944 | iwl_dump_nic_error_log(priv); |
969 | if (priv->cfg->ops->lib->dump_csr) | 945 | iwl_dump_csr(priv); |
970 | priv->cfg->ops->lib->dump_csr(priv); | 946 | iwl_dump_fh(priv, NULL, false); |
971 | if (priv->cfg->ops->lib->dump_fh) | 947 | iwl_dump_nic_event_log(priv, false, NULL, false); |
972 | priv->cfg->ops->lib->dump_fh(priv, NULL, false); | ||
973 | priv->cfg->ops->lib->dump_nic_event_log(priv, false, NULL, false); | ||
974 | #ifdef CONFIG_IWLWIFI_DEBUG | 948 | #ifdef CONFIG_IWLWIFI_DEBUG |
975 | if (iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) | 949 | if (iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) |
976 | iwl_print_rx_config_cmd(priv, | 950 | iwl_print_rx_config_cmd(priv, |
@@ -1051,7 +1025,6 @@ int iwl_apm_init(struct iwl_priv *priv) | |||
1051 | /* | 1025 | /* |
1052 | * Enable HAP INTA (interrupt from management bus) to | 1026 | * Enable HAP INTA (interrupt from management bus) to |
1053 | * wake device's PCI Express link L1a -> L0s | 1027 | * wake device's PCI Express link L1a -> L0s |
1054 | * NOTE: This is no-op for 3945 (non-existent bit) | ||
1055 | */ | 1028 | */ |
1056 | iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, | 1029 | iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, |
1057 | CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A); | 1030 | CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A); |
@@ -1064,20 +1037,18 @@ int iwl_apm_init(struct iwl_priv *priv) | |||
1064 | * If not (unlikely), enable L0S, so there is at least some | 1037 | * If not (unlikely), enable L0S, so there is at least some |
1065 | * power savings, even without L1. | 1038 | * power savings, even without L1. |
1066 | */ | 1039 | */ |
1067 | if (priv->cfg->base_params->set_l0s) { | 1040 | lctl = iwl_pcie_link_ctl(priv); |
1068 | lctl = iwl_pcie_link_ctl(priv); | 1041 | if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) == |
1069 | if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) == | 1042 | PCI_CFG_LINK_CTRL_VAL_L1_EN) { |
1070 | PCI_CFG_LINK_CTRL_VAL_L1_EN) { | 1043 | /* L1-ASPM enabled; disable(!) L0S */ |
1071 | /* L1-ASPM enabled; disable(!) L0S */ | 1044 | iwl_set_bit(priv, CSR_GIO_REG, |
1072 | iwl_set_bit(priv, CSR_GIO_REG, | 1045 | CSR_GIO_REG_VAL_L0S_ENABLED); |
1073 | CSR_GIO_REG_VAL_L0S_ENABLED); | 1046 | IWL_DEBUG_POWER(priv, "L1 Enabled; Disabling L0S\n"); |
1074 | IWL_DEBUG_POWER(priv, "L1 Enabled; Disabling L0S\n"); | 1047 | } else { |
1075 | } else { | 1048 | /* L1-ASPM disabled; enable(!) L0S */ |
1076 | /* L1-ASPM disabled; enable(!) L0S */ | 1049 | iwl_clear_bit(priv, CSR_GIO_REG, |
1077 | iwl_clear_bit(priv, CSR_GIO_REG, | 1050 | CSR_GIO_REG_VAL_L0S_ENABLED); |
1078 | CSR_GIO_REG_VAL_L0S_ENABLED); | 1051 | IWL_DEBUG_POWER(priv, "L1 Disabled; Enabling L0S\n"); |
1079 | IWL_DEBUG_POWER(priv, "L1 Disabled; Enabling L0S\n"); | ||
1080 | } | ||
1081 | } | 1052 | } |
1082 | 1053 | ||
1083 | /* Configure analog phase-lock-loop before activating to D0A */ | 1054 | /* Configure analog phase-lock-loop before activating to D0A */ |
@@ -1777,6 +1748,15 @@ int iwl_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
1777 | 1748 | ||
1778 | mutex_lock(&priv->mutex); | 1749 | mutex_lock(&priv->mutex); |
1779 | 1750 | ||
1751 | if (!ctx->vif || !iwl_is_ready_rf(priv)) { | ||
1752 | /* | ||
1753 | * Huh? But wait ... this can maybe happen when | ||
1754 | * we're in the middle of a firmware restart! | ||
1755 | */ | ||
1756 | err = -EBUSY; | ||
1757 | goto out; | ||
1758 | } | ||
1759 | |||
1780 | interface_modes = ctx->interface_modes | ctx->exclusive_interface_modes; | 1760 | interface_modes = ctx->interface_modes | ctx->exclusive_interface_modes; |
1781 | 1761 | ||
1782 | if (!(interface_modes & BIT(newtype))) { | 1762 | if (!(interface_modes & BIT(newtype))) { |
@@ -1804,6 +1784,7 @@ int iwl_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
1804 | /* success */ | 1784 | /* success */ |
1805 | iwl_teardown_interface(priv, vif, true); | 1785 | iwl_teardown_interface(priv, vif, true); |
1806 | vif->type = newtype; | 1786 | vif->type = newtype; |
1787 | vif->p2p = newp2p; | ||
1807 | err = iwl_setup_interface(priv, ctx); | 1788 | err = iwl_setup_interface(priv, ctx); |
1808 | WARN_ON(err); | 1789 | WARN_ON(err); |
1809 | /* | 1790 | /* |