aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-6000.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-6000.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c219
1 files changed, 2 insertions, 217 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index f124ec697168..00da2520a4b7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -24,26 +24,11 @@
24 * 24 *
25 *****************************************************************************/ 25 *****************************************************************************/
26 26
27#include <linux/kernel.h>
28#include <linux/module.h> 27#include <linux/module.h>
29#include <linux/init.h>
30#include <linux/delay.h>
31#include <linux/skbuff.h>
32#include <linux/netdevice.h>
33#include <net/mac80211.h>
34#include <linux/etherdevice.h>
35#include <asm/unaligned.h>
36#include <linux/stringify.h> 28#include <linux/stringify.h>
37 29#include "iwl-config.h"
38#include "iwl-eeprom.h"
39#include "iwl-dev.h"
40#include "iwl-core.h"
41#include "iwl-io.h"
42#include "iwl-agn.h"
43#include "iwl-agn-hw.h"
44#include "iwl-trans.h"
45#include "iwl-shared.h"
46#include "iwl-cfg.h" 30#include "iwl-cfg.h"
31#include "iwl-dev.h" /* still needed */
47 32
48/* Highest firmware API version supported */ 33/* Highest firmware API version supported */
49#define IWL6000_UCODE_API_MAX 6 34#define IWL6000_UCODE_API_MAX 6
@@ -71,200 +56,6 @@
71#define IWL6030_FW_PRE "iwlwifi-6000g2b-" 56#define IWL6030_FW_PRE "iwlwifi-6000g2b-"
72#define IWL6030_MODULE_FIRMWARE(api) IWL6030_FW_PRE __stringify(api) ".ucode" 57#define IWL6030_MODULE_FIRMWARE(api) IWL6030_FW_PRE __stringify(api) ".ucode"
73 58
74static void iwl6000_set_ct_threshold(struct iwl_priv *priv)
75{
76 /* want Celsius */
77 priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD;
78 priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
79}
80
81/* NIC configuration for 6000 series */
82static void iwl6000_nic_config(struct iwl_priv *priv)
83{
84 iwl_rf_config(priv);
85
86 switch (cfg(priv)->device_family) {
87 case IWL_DEVICE_FAMILY_6005:
88 case IWL_DEVICE_FAMILY_6030:
89 case IWL_DEVICE_FAMILY_6000:
90 break;
91 case IWL_DEVICE_FAMILY_6000i:
92 /* 2x2 IPA phy type */
93 iwl_write32(trans(priv), CSR_GP_DRIVER_REG,
94 CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_IPA);
95 break;
96 case IWL_DEVICE_FAMILY_6050:
97 /* Indicate calibration version to uCode. */
98 if (iwl_eeprom_calib_version(priv) >= 6)
99 iwl_set_bit(trans(priv), CSR_GP_DRIVER_REG,
100 CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
101 break;
102 case IWL_DEVICE_FAMILY_6150:
103 /* Indicate calibration version to uCode. */
104 if (iwl_eeprom_calib_version(priv) >= 6)
105 iwl_set_bit(trans(priv), CSR_GP_DRIVER_REG,
106 CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
107 iwl_set_bit(trans(priv), CSR_GP_DRIVER_REG,
108 CSR_GP_DRIVER_REG_BIT_6050_1x2);
109 break;
110 default:
111 WARN_ON(1);
112 }
113}
114
115static const struct iwl_sensitivity_ranges iwl6000_sensitivity = {
116 .min_nrg_cck = 110,
117 .auto_corr_min_ofdm = 80,
118 .auto_corr_min_ofdm_mrc = 128,
119 .auto_corr_min_ofdm_x1 = 105,
120 .auto_corr_min_ofdm_mrc_x1 = 192,
121
122 .auto_corr_max_ofdm = 145,
123 .auto_corr_max_ofdm_mrc = 232,
124 .auto_corr_max_ofdm_x1 = 110,
125 .auto_corr_max_ofdm_mrc_x1 = 232,
126
127 .auto_corr_min_cck = 125,
128 .auto_corr_max_cck = 175,
129 .auto_corr_min_cck_mrc = 160,
130 .auto_corr_max_cck_mrc = 310,
131 .nrg_th_cck = 110,
132 .nrg_th_ofdm = 110,
133
134 .barker_corr_th_min = 190,
135 .barker_corr_th_min_mrc = 336,
136 .nrg_th_cca = 62,
137};
138
139static void iwl6000_hw_set_hw_params(struct iwl_priv *priv)
140{
141 priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) |
142 BIT(IEEE80211_BAND_5GHZ);
143
144 priv->hw_params.tx_chains_num =
145 num_of_ant(priv->hw_params.valid_tx_ant);
146 if (cfg(priv)->rx_with_siso_diversity)
147 priv->hw_params.rx_chains_num = 1;
148 else
149 priv->hw_params.rx_chains_num =
150 num_of_ant(priv->hw_params.valid_rx_ant);
151
152 iwl6000_set_ct_threshold(priv);
153
154 /* Set initial sensitivity parameters */
155 priv->hw_params.sens = &iwl6000_sensitivity;
156
157}
158
159static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
160 struct ieee80211_channel_switch *ch_switch)
161{
162 /*
163 * MULTI-FIXME
164 * See iwlagn_mac_channel_switch.
165 */
166 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
167 struct iwl6000_channel_switch_cmd cmd;
168 const struct iwl_channel_info *ch_info;
169 u32 switch_time_in_usec, ucode_switch_time;
170 u16 ch;
171 u32 tsf_low;
172 u8 switch_count;
173 u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval);
174 struct ieee80211_vif *vif = ctx->vif;
175 struct iwl_host_cmd hcmd = {
176 .id = REPLY_CHANNEL_SWITCH,
177 .len = { sizeof(cmd), },
178 .flags = CMD_SYNC,
179 .data = { &cmd, },
180 };
181
182 cmd.band = priv->band == IEEE80211_BAND_2GHZ;
183 ch = ch_switch->channel->hw_value;
184 IWL_DEBUG_11H(priv, "channel switch from %u to %u\n",
185 ctx->active.channel, ch);
186 cmd.channel = cpu_to_le16(ch);
187 cmd.rxon_flags = ctx->staging.flags;
188 cmd.rxon_filter_flags = ctx->staging.filter_flags;
189 switch_count = ch_switch->count;
190 tsf_low = ch_switch->timestamp & 0x0ffffffff;
191 /*
192 * calculate the ucode channel switch time
193 * adding TSF as one of the factor for when to switch
194 */
195 if ((priv->ucode_beacon_time > tsf_low) && beacon_interval) {
196 if (switch_count > ((priv->ucode_beacon_time - tsf_low) /
197 beacon_interval)) {
198 switch_count -= (priv->ucode_beacon_time -
199 tsf_low) / beacon_interval;
200 } else
201 switch_count = 0;
202 }
203 if (switch_count <= 1)
204 cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time);
205 else {
206 switch_time_in_usec =
207 vif->bss_conf.beacon_int * switch_count * TIME_UNIT;
208 ucode_switch_time = iwl_usecs_to_beacons(priv,
209 switch_time_in_usec,
210 beacon_interval);
211 cmd.switch_time = iwl_add_beacon_time(priv,
212 priv->ucode_beacon_time,
213 ucode_switch_time,
214 beacon_interval);
215 }
216 IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n",
217 cmd.switch_time);
218 ch_info = iwl_get_channel_info(priv, priv->band, ch);
219 if (ch_info)
220 cmd.expect_beacon = is_channel_radar(ch_info);
221 else {
222 IWL_ERR(priv, "invalid channel switch from %u to %u\n",
223 ctx->active.channel, ch);
224 return -EFAULT;
225 }
226
227 return iwl_dvm_send_cmd(priv, &hcmd);
228}
229
230static struct iwl_lib_ops iwl6000_lib = {
231 .set_hw_params = iwl6000_hw_set_hw_params,
232 .set_channel_switch = iwl6000_hw_channel_switch,
233 .nic_config = iwl6000_nic_config,
234 .eeprom_ops = {
235 .regulatory_bands = {
236 EEPROM_REG_BAND_1_CHANNELS,
237 EEPROM_REG_BAND_2_CHANNELS,
238 EEPROM_REG_BAND_3_CHANNELS,
239 EEPROM_REG_BAND_4_CHANNELS,
240 EEPROM_REG_BAND_5_CHANNELS,
241 EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
242 EEPROM_REG_BAND_52_HT40_CHANNELS
243 },
244 .enhanced_txpower = true,
245 },
246 .temperature = iwlagn_temperature,
247};
248
249static struct iwl_lib_ops iwl6030_lib = {
250 .set_hw_params = iwl6000_hw_set_hw_params,
251 .set_channel_switch = iwl6000_hw_channel_switch,
252 .nic_config = iwl6000_nic_config,
253 .eeprom_ops = {
254 .regulatory_bands = {
255 EEPROM_REG_BAND_1_CHANNELS,
256 EEPROM_REG_BAND_2_CHANNELS,
257 EEPROM_REG_BAND_3_CHANNELS,
258 EEPROM_REG_BAND_4_CHANNELS,
259 EEPROM_REG_BAND_5_CHANNELS,
260 EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
261 EEPROM_REG_BAND_52_HT40_CHANNELS
262 },
263 .enhanced_txpower = true,
264 },
265 .temperature = iwlagn_temperature,
266};
267
268static const struct iwl_base_params iwl6000_base_params = { 59static const struct iwl_base_params iwl6000_base_params = {
269 .eeprom_size = OTP_LOW_IMAGE_SIZE, 60 .eeprom_size = OTP_LOW_IMAGE_SIZE,
270 .num_of_queues = IWLAGN_NUM_QUEUES, 61 .num_of_queues = IWLAGN_NUM_QUEUES,
@@ -337,7 +128,6 @@ static const struct iwl_bt_params iwl6000_bt_params = {
337 .max_data_size = IWL60_RTC_DATA_SIZE, \ 128 .max_data_size = IWL60_RTC_DATA_SIZE, \
338 .eeprom_ver = EEPROM_6005_EEPROM_VERSION, \ 129 .eeprom_ver = EEPROM_6005_EEPROM_VERSION, \
339 .eeprom_calib_ver = EEPROM_6005_TX_POWER_VERSION, \ 130 .eeprom_calib_ver = EEPROM_6005_TX_POWER_VERSION, \
340 .lib = &iwl6000_lib, \
341 .base_params = &iwl6000_g2_base_params, \ 131 .base_params = &iwl6000_g2_base_params, \
342 .need_temp_offset_calib = true, \ 132 .need_temp_offset_calib = true, \
343 .led_mode = IWL_LED_RF_STATE 133 .led_mode = IWL_LED_RF_STATE
@@ -392,7 +182,6 @@ const struct iwl_cfg iwl6005_2agn_mow2_cfg = {
392 .max_data_size = IWL60_RTC_DATA_SIZE, \ 182 .max_data_size = IWL60_RTC_DATA_SIZE, \
393 .eeprom_ver = EEPROM_6030_EEPROM_VERSION, \ 183 .eeprom_ver = EEPROM_6030_EEPROM_VERSION, \
394 .eeprom_calib_ver = EEPROM_6030_TX_POWER_VERSION, \ 184 .eeprom_calib_ver = EEPROM_6030_TX_POWER_VERSION, \
395 .lib = &iwl6030_lib, \
396 .base_params = &iwl6000_g2_base_params, \ 185 .base_params = &iwl6000_g2_base_params, \
397 .bt_params = &iwl6000_bt_params, \ 186 .bt_params = &iwl6000_bt_params, \
398 .need_temp_offset_calib = true, \ 187 .need_temp_offset_calib = true, \
@@ -466,7 +255,6 @@ const struct iwl_cfg iwl130_bg_cfg = {
466 .valid_rx_ant = ANT_BC, /* .cfg overwrite */ \ 255 .valid_rx_ant = ANT_BC, /* .cfg overwrite */ \
467 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, \ 256 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, \
468 .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION, \ 257 .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION, \
469 .lib = &iwl6000_lib, \
470 .base_params = &iwl6000_base_params, \ 258 .base_params = &iwl6000_base_params, \
471 .led_mode = IWL_LED_BLINK 259 .led_mode = IWL_LED_BLINK
472 260
@@ -495,7 +283,6 @@ const struct iwl_cfg iwl6000i_2bg_cfg = {
495 .max_data_size = IWL60_RTC_DATA_SIZE, \ 283 .max_data_size = IWL60_RTC_DATA_SIZE, \
496 .valid_tx_ant = ANT_AB, /* .cfg overwrite */ \ 284 .valid_tx_ant = ANT_AB, /* .cfg overwrite */ \
497 .valid_rx_ant = ANT_AB, /* .cfg overwrite */ \ 285 .valid_rx_ant = ANT_AB, /* .cfg overwrite */ \
498 .lib = &iwl6000_lib, \
499 .eeprom_ver = EEPROM_6050_EEPROM_VERSION, \ 286 .eeprom_ver = EEPROM_6050_EEPROM_VERSION, \
500 .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION, \ 287 .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION, \
501 .base_params = &iwl6050_base_params, \ 288 .base_params = &iwl6050_base_params, \
@@ -520,7 +307,6 @@ const struct iwl_cfg iwl6050_2abg_cfg = {
520 .device_family = IWL_DEVICE_FAMILY_6150, \ 307 .device_family = IWL_DEVICE_FAMILY_6150, \
521 .max_inst_size = IWL60_RTC_INST_SIZE, \ 308 .max_inst_size = IWL60_RTC_INST_SIZE, \
522 .max_data_size = IWL60_RTC_DATA_SIZE, \ 309 .max_data_size = IWL60_RTC_DATA_SIZE, \
523 .lib = &iwl6000_lib, \
524 .eeprom_ver = EEPROM_6150_EEPROM_VERSION, \ 310 .eeprom_ver = EEPROM_6150_EEPROM_VERSION, \
525 .eeprom_calib_ver = EEPROM_6150_TX_POWER_VERSION, \ 311 .eeprom_calib_ver = EEPROM_6150_TX_POWER_VERSION, \
526 .base_params = &iwl6050_base_params, \ 312 .base_params = &iwl6050_base_params, \
@@ -549,7 +335,6 @@ const struct iwl_cfg iwl6000_3agn_cfg = {
549 .max_data_size = IWL60_RTC_DATA_SIZE, 335 .max_data_size = IWL60_RTC_DATA_SIZE,
550 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 336 .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
551 .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION, 337 .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
552 .lib = &iwl6000_lib,
553 .base_params = &iwl6000_base_params, 338 .base_params = &iwl6000_base_params,
554 .ht_params = &iwl6000_ht_params, 339 .ht_params = &iwl6000_ht_params,
555 .led_mode = IWL_LED_BLINK, 340 .led_mode = IWL_LED_BLINK,