diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-4965.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 144 |
1 files changed, 90 insertions, 54 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 2e54dae95751..8b2d04ed43d6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -105,6 +105,90 @@ static const u16 default_tid_to_tx_fifo[] = { | |||
105 | 105 | ||
106 | #endif /*CONFIG_IWL4965_HT */ | 106 | #endif /*CONFIG_IWL4965_HT */ |
107 | 107 | ||
108 | static int iwl4965_init_drv(struct iwl_priv *priv) | ||
109 | { | ||
110 | int ret; | ||
111 | int i; | ||
112 | |||
113 | priv->antenna = (enum iwl4965_antenna)iwl4965_mod_params.antenna; | ||
114 | priv->retry_rate = 1; | ||
115 | priv->ibss_beacon = NULL; | ||
116 | |||
117 | spin_lock_init(&priv->lock); | ||
118 | spin_lock_init(&priv->power_data.lock); | ||
119 | spin_lock_init(&priv->sta_lock); | ||
120 | spin_lock_init(&priv->hcmd_lock); | ||
121 | spin_lock_init(&priv->lq_mngr.lock); | ||
122 | |||
123 | for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) | ||
124 | INIT_LIST_HEAD(&priv->ibss_mac_hash[i]); | ||
125 | |||
126 | INIT_LIST_HEAD(&priv->free_frames); | ||
127 | |||
128 | mutex_init(&priv->mutex); | ||
129 | |||
130 | /* Clear the driver's (not device's) station table */ | ||
131 | iwlcore_clear_stations_table(priv); | ||
132 | |||
133 | priv->data_retry_limit = -1; | ||
134 | priv->ieee_channels = NULL; | ||
135 | priv->ieee_rates = NULL; | ||
136 | priv->band = IEEE80211_BAND_2GHZ; | ||
137 | |||
138 | priv->iw_mode = IEEE80211_IF_TYPE_STA; | ||
139 | |||
140 | priv->use_ant_b_for_management_frame = 1; /* start with ant B */ | ||
141 | priv->valid_antenna = 0x7; /* assume all 3 connected */ | ||
142 | priv->ps_mode = IWL_MIMO_PS_NONE; | ||
143 | |||
144 | /* Choose which receivers/antennas to use */ | ||
145 | iwl4965_set_rxon_chain(priv); | ||
146 | |||
147 | iwlcore_reset_qos(priv); | ||
148 | |||
149 | priv->qos_data.qos_active = 0; | ||
150 | priv->qos_data.qos_cap.val = 0; | ||
151 | |||
152 | iwlcore_set_rxon_channel(priv, IEEE80211_BAND_2GHZ, 6); | ||
153 | |||
154 | priv->rates_mask = IWL_RATES_MASK; | ||
155 | /* If power management is turned on, default to AC mode */ | ||
156 | priv->power_mode = IWL_POWER_AC; | ||
157 | priv->user_txpower_limit = IWL_DEFAULT_TX_POWER; | ||
158 | |||
159 | ret = iwl_init_channel_map(priv); | ||
160 | if (ret) { | ||
161 | IWL_ERROR("initializing regulatory failed: %d\n", ret); | ||
162 | goto err; | ||
163 | } | ||
164 | |||
165 | ret = iwl4965_init_geos(priv); | ||
166 | if (ret) { | ||
167 | IWL_ERROR("initializing geos failed: %d\n", ret); | ||
168 | goto err_free_channel_map; | ||
169 | } | ||
170 | |||
171 | iwl4965_rate_control_register(priv->hw); | ||
172 | ret = ieee80211_register_hw(priv->hw); | ||
173 | if (ret) { | ||
174 | IWL_ERROR("Failed to register network device (error %d)\n", | ||
175 | ret); | ||
176 | goto err_free_geos; | ||
177 | } | ||
178 | |||
179 | priv->hw->conf.beacon_int = 100; | ||
180 | priv->mac80211_registered = 1; | ||
181 | |||
182 | return 0; | ||
183 | |||
184 | err_free_geos: | ||
185 | iwl4965_free_geos(priv); | ||
186 | err_free_channel_map: | ||
187 | iwl_free_channel_map(priv); | ||
188 | err: | ||
189 | return ret; | ||
190 | } | ||
191 | |||
108 | static int is_fat_channel(__le32 rxon_flags) | 192 | static int is_fat_channel(__le32 rxon_flags) |
109 | { | 193 | { |
110 | return (rxon_flags & RXON_FLG_CHANNEL_MODE_PURE_40_MSK) || | 194 | return (rxon_flags & RXON_FLG_CHANNEL_MODE_PURE_40_MSK) || |
@@ -391,55 +475,6 @@ static int iwl4965_kw_alloc(struct iwl_priv *priv) | |||
391 | return 0; | 475 | return 0; |
392 | } | 476 | } |
393 | 477 | ||
394 | #define CHECK_AND_PRINT(x) ((eeprom_ch->flags & EEPROM_CHANNEL_##x) \ | ||
395 | ? # x " " : "") | ||
396 | |||
397 | /** | ||
398 | * iwl4965_set_fat_chan_info - Copy fat channel info into driver's priv. | ||
399 | * | ||
400 | * Does not set up a command, or touch hardware. | ||
401 | */ | ||
402 | int iwl4965_set_fat_chan_info(struct iwl_priv *priv, | ||
403 | enum ieee80211_band band, u16 channel, | ||
404 | const struct iwl4965_eeprom_channel *eeprom_ch, | ||
405 | u8 fat_extension_channel) | ||
406 | { | ||
407 | struct iwl4965_channel_info *ch_info; | ||
408 | |||
409 | ch_info = (struct iwl4965_channel_info *) | ||
410 | iwl4965_get_channel_info(priv, band, channel); | ||
411 | |||
412 | if (!is_channel_valid(ch_info)) | ||
413 | return -1; | ||
414 | |||
415 | IWL_DEBUG_INFO("FAT Ch. %d [%sGHz] %s%s%s%s%s%s(0x%02x" | ||
416 | " %ddBm): Ad-Hoc %ssupported\n", | ||
417 | ch_info->channel, | ||
418 | is_channel_a_band(ch_info) ? | ||
419 | "5.2" : "2.4", | ||
420 | CHECK_AND_PRINT(IBSS), | ||
421 | CHECK_AND_PRINT(ACTIVE), | ||
422 | CHECK_AND_PRINT(RADAR), | ||
423 | CHECK_AND_PRINT(WIDE), | ||
424 | CHECK_AND_PRINT(NARROW), | ||
425 | CHECK_AND_PRINT(DFS), | ||
426 | eeprom_ch->flags, | ||
427 | eeprom_ch->max_power_avg, | ||
428 | ((eeprom_ch->flags & EEPROM_CHANNEL_IBSS) | ||
429 | && !(eeprom_ch->flags & EEPROM_CHANNEL_RADAR)) ? | ||
430 | "" : "not "); | ||
431 | |||
432 | ch_info->fat_eeprom = *eeprom_ch; | ||
433 | ch_info->fat_max_power_avg = eeprom_ch->max_power_avg; | ||
434 | ch_info->fat_curr_txpow = eeprom_ch->max_power_avg; | ||
435 | ch_info->fat_min_power = 0; | ||
436 | ch_info->fat_scan_power = eeprom_ch->max_power_avg; | ||
437 | ch_info->fat_flags = eeprom_ch->flags; | ||
438 | ch_info->fat_extension_channel = fat_extension_channel; | ||
439 | |||
440 | return 0; | ||
441 | } | ||
442 | |||
443 | /** | 478 | /** |
444 | * iwl4965_kw_free - Free the "keep warm" buffer | 479 | * iwl4965_kw_free - Free the "keep warm" buffer |
445 | */ | 480 | */ |
@@ -2015,11 +2050,11 @@ static s32 iwl4965_get_voltage_compensation(s32 eeprom_voltage, | |||
2015 | return comp; | 2050 | return comp; |
2016 | } | 2051 | } |
2017 | 2052 | ||
2018 | static const struct iwl4965_channel_info * | 2053 | static const struct iwl_channel_info * |
2019 | iwl4965_get_channel_txpower_info(struct iwl_priv *priv, | 2054 | iwl4965_get_channel_txpower_info(struct iwl_priv *priv, |
2020 | enum ieee80211_band band, u16 channel) | 2055 | enum ieee80211_band band, u16 channel) |
2021 | { | 2056 | { |
2022 | const struct iwl4965_channel_info *ch_info; | 2057 | const struct iwl_channel_info *ch_info; |
2023 | 2058 | ||
2024 | ch_info = iwl4965_get_channel_info(priv, band, channel); | 2059 | ch_info = iwl4965_get_channel_info(priv, band, channel); |
2025 | 2060 | ||
@@ -2438,7 +2473,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, | |||
2438 | s32 txatten_grp = CALIB_CH_GROUP_MAX; | 2473 | s32 txatten_grp = CALIB_CH_GROUP_MAX; |
2439 | int i; | 2474 | int i; |
2440 | int c; | 2475 | int c; |
2441 | const struct iwl4965_channel_info *ch_info = NULL; | 2476 | const struct iwl_channel_info *ch_info = NULL; |
2442 | struct iwl4965_eeprom_calib_ch_info ch_eeprom_info; | 2477 | struct iwl4965_eeprom_calib_ch_info ch_eeprom_info; |
2443 | const struct iwl4965_eeprom_calib_measure *measurement; | 2478 | const struct iwl4965_eeprom_calib_measure *measurement; |
2444 | s16 voltage; | 2479 | s16 voltage; |
@@ -2725,7 +2760,7 @@ int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel) | |||
2725 | u8 is_fat = 0; | 2760 | u8 is_fat = 0; |
2726 | u8 ctrl_chan_high = 0; | 2761 | u8 ctrl_chan_high = 0; |
2727 | struct iwl4965_channel_switch_cmd cmd = { 0 }; | 2762 | struct iwl4965_channel_switch_cmd cmd = { 0 }; |
2728 | const struct iwl4965_channel_info *ch_info; | 2763 | const struct iwl_channel_info *ch_info; |
2729 | 2764 | ||
2730 | band = priv->band == IEEE80211_BAND_2GHZ; | 2765 | band = priv->band == IEEE80211_BAND_2GHZ; |
2731 | 2766 | ||
@@ -4471,7 +4506,7 @@ static u8 iwl4965_is_channel_extension(struct iwl_priv *priv, | |||
4471 | enum ieee80211_band band, | 4506 | enum ieee80211_band band, |
4472 | u16 channel, u8 extension_chan_offset) | 4507 | u16 channel, u8 extension_chan_offset) |
4473 | { | 4508 | { |
4474 | const struct iwl4965_channel_info *ch_info; | 4509 | const struct iwl_channel_info *ch_info; |
4475 | 4510 | ||
4476 | ch_info = iwl4965_get_channel_info(priv, band, channel); | 4511 | ch_info = iwl4965_get_channel_info(priv, band, channel); |
4477 | if (!is_channel_valid(ch_info)) | 4512 | if (!is_channel_valid(ch_info)) |
@@ -4848,6 +4883,7 @@ void iwl4965_hw_cancel_deferred_work(struct iwl_priv *priv) | |||
4848 | } | 4883 | } |
4849 | 4884 | ||
4850 | static struct iwl_lib_ops iwl4965_lib = { | 4885 | static struct iwl_lib_ops iwl4965_lib = { |
4886 | .init_drv = iwl4965_init_drv, | ||
4851 | .eeprom_ops = { | 4887 | .eeprom_ops = { |
4852 | .verify_signature = iwlcore_eeprom_verify_signature, | 4888 | .verify_signature = iwlcore_eeprom_verify_signature, |
4853 | .acquire_semaphore = iwlcore_eeprom_acquire_semaphore, | 4889 | .acquire_semaphore = iwlcore_eeprom_acquire_semaphore, |