aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-1000.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-1000.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-1000.c174
1 files changed, 70 insertions, 104 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index 0b779a41a142..2a88e73bb39c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2008 - 2010 Intel Corporation. All rights reserved. 3 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -36,6 +36,7 @@
36#include <net/mac80211.h> 36#include <net/mac80211.h>
37#include <linux/etherdevice.h> 37#include <linux/etherdevice.h>
38#include <asm/unaligned.h> 38#include <asm/unaligned.h>
39#include <linux/stringify.h>
39 40
40#include "iwl-eeprom.h" 41#include "iwl-eeprom.h"
41#include "iwl-dev.h" 42#include "iwl-dev.h"
@@ -45,18 +46,20 @@
45#include "iwl-agn.h" 46#include "iwl-agn.h"
46#include "iwl-helpers.h" 47#include "iwl-helpers.h"
47#include "iwl-agn-hw.h" 48#include "iwl-agn-hw.h"
48#include "iwl-agn-led.h"
49#include "iwl-agn-debugfs.h"
50 49
51/* Highest firmware API version supported */ 50/* Highest firmware API version supported */
52#define IWL1000_UCODE_API_MAX 3 51#define IWL1000_UCODE_API_MAX 5
52#define IWL100_UCODE_API_MAX 5
53 53
54/* Lowest firmware API version supported */ 54/* Lowest firmware API version supported */
55#define IWL1000_UCODE_API_MIN 1 55#define IWL1000_UCODE_API_MIN 1
56#define IWL100_UCODE_API_MIN 5
56 57
57#define IWL1000_FW_PRE "iwlwifi-1000-" 58#define IWL1000_FW_PRE "iwlwifi-1000-"
58#define _IWL1000_MODULE_FIRMWARE(api) IWL1000_FW_PRE #api ".ucode" 59#define IWL1000_MODULE_FIRMWARE(api) IWL1000_FW_PRE __stringify(api) ".ucode"
59#define IWL1000_MODULE_FIRMWARE(api) _IWL1000_MODULE_FIRMWARE(api) 60
61#define IWL100_FW_PRE "iwlwifi-100-"
62#define IWL100_MODULE_FIRMWARE(api) IWL100_FW_PRE __stringify(api) ".ucode"
60 63
61 64
62/* 65/*
@@ -118,35 +121,37 @@ static struct iwl_sensitivity_ranges iwl1000_sensitivity = {
118 121
119static int iwl1000_hw_set_hw_params(struct iwl_priv *priv) 122static int iwl1000_hw_set_hw_params(struct iwl_priv *priv)
120{ 123{
121 if (priv->cfg->mod_params->num_of_queues >= IWL_MIN_NUM_QUEUES && 124 if (iwlagn_mod_params.num_of_queues >= IWL_MIN_NUM_QUEUES &&
122 priv->cfg->mod_params->num_of_queues <= IWLAGN_NUM_QUEUES) 125 iwlagn_mod_params.num_of_queues <= IWLAGN_NUM_QUEUES)
123 priv->cfg->num_of_queues = 126 priv->cfg->base_params->num_of_queues =
124 priv->cfg->mod_params->num_of_queues; 127 iwlagn_mod_params.num_of_queues;
125 128
126 priv->hw_params.max_txq_num = priv->cfg->num_of_queues; 129 priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues;
127 priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM; 130 priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM;
128 priv->hw_params.scd_bc_tbls_size = 131 priv->hw_params.scd_bc_tbls_size =
129 priv->cfg->num_of_queues * 132 priv->cfg->base_params->num_of_queues *
130 sizeof(struct iwlagn_scd_bc_tbl); 133 sizeof(struct iwlagn_scd_bc_tbl);
131 priv->hw_params.tfd_size = sizeof(struct iwl_tfd); 134 priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
132 priv->hw_params.max_stations = IWLAGN_STATION_COUNT; 135 priv->hw_params.max_stations = IWLAGN_STATION_COUNT;
133 priv->hw_params.bcast_sta_id = IWLAGN_BROADCAST_ID; 136 priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
134 137
135 priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE; 138 priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE;
136 priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE; 139 priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE;
137 140
138 priv->hw_params.max_bsm_size = 0;
139 priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) | 141 priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) |
140 BIT(IEEE80211_BAND_5GHZ); 142 BIT(IEEE80211_BAND_5GHZ);
141 priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR; 143 priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
142 144
143 priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant); 145 priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
144 priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant); 146 if (priv->cfg->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->cfg->valid_rx_ant);
145 priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant; 151 priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant;
146 priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant; 152 priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant;
147 153
148 if (priv->cfg->ops->lib->temp_ops.set_ct_kill) 154 iwl1000_set_ct_threshold(priv);
149 priv->cfg->ops->lib->temp_ops.set_ct_kill(priv);
150 155
151 /* Set initial sensitivity parameters */ 156 /* Set initial sensitivity parameters */
152 /* Set initial calibration set */ 157 /* Set initial calibration set */
@@ -167,31 +172,14 @@ static int iwl1000_hw_set_hw_params(struct iwl_priv *priv)
167 172
168static struct iwl_lib_ops iwl1000_lib = { 173static struct iwl_lib_ops iwl1000_lib = {
169 .set_hw_params = iwl1000_hw_set_hw_params, 174 .set_hw_params = iwl1000_hw_set_hw_params,
170 .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
171 .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
172 .txq_set_sched = iwlagn_txq_set_sched,
173 .txq_agg_enable = iwlagn_txq_agg_enable,
174 .txq_agg_disable = iwlagn_txq_agg_disable,
175 .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
176 .txq_free_tfd = iwl_hw_txq_free_tfd,
177 .txq_init = iwl_hw_tx_queue_init,
178 .rx_handler_setup = iwlagn_rx_handler_setup, 175 .rx_handler_setup = iwlagn_rx_handler_setup,
179 .setup_deferred_work = iwlagn_setup_deferred_work, 176 .setup_deferred_work = iwlagn_setup_deferred_work,
180 .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr, 177 .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
181 .load_ucode = iwlagn_load_ucode,
182 .dump_nic_event_log = iwl_dump_nic_event_log,
183 .dump_nic_error_log = iwl_dump_nic_error_log,
184 .dump_csr = iwl_dump_csr,
185 .dump_fh = iwl_dump_fh,
186 .init_alive_start = iwlagn_init_alive_start,
187 .alive_notify = iwlagn_alive_notify,
188 .send_tx_power = iwlagn_send_tx_power, 178 .send_tx_power = iwlagn_send_tx_power,
189 .update_chain_flags = iwl_update_chain_flags, 179 .update_chain_flags = iwl_update_chain_flags,
190 .apm_ops = { 180 .apm_ops = {
191 .init = iwl_apm_init, 181 .init = iwl_apm_init,
192 .stop = iwl_apm_stop,
193 .config = iwl1000_nic_config, 182 .config = iwl1000_nic_config,
194 .set_pwr_src = iwl_set_pwr_src,
195 }, 183 },
196 .eeprom_ops = { 184 .eeprom_ops = {
197 .regulatory_bands = { 185 .regulatory_bands = {
@@ -201,32 +189,13 @@ static struct iwl_lib_ops iwl1000_lib = {
201 EEPROM_REG_BAND_4_CHANNELS, 189 EEPROM_REG_BAND_4_CHANNELS,
202 EEPROM_REG_BAND_5_CHANNELS, 190 EEPROM_REG_BAND_5_CHANNELS,
203 EEPROM_REG_BAND_24_HT40_CHANNELS, 191 EEPROM_REG_BAND_24_HT40_CHANNELS,
204 EEPROM_REG_BAND_52_HT40_CHANNELS 192 EEPROM_REGULATORY_BAND_NO_HT40,
205 }, 193 },
206 .verify_signature = iwlcore_eeprom_verify_signature,
207 .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
208 .release_semaphore = iwlcore_eeprom_release_semaphore,
209 .calib_version = iwlagn_eeprom_calib_version,
210 .query_addr = iwlagn_eeprom_query_addr, 194 .query_addr = iwlagn_eeprom_query_addr,
211 }, 195 },
212 .post_associate = iwl_post_associate,
213 .isr = iwl_isr_ict,
214 .config_ap = iwl_config_ap,
215 .temp_ops = { 196 .temp_ops = {
216 .temperature = iwlagn_temperature, 197 .temperature = iwlagn_temperature,
217 .set_ct_kill = iwl1000_set_ct_threshold,
218 }, 198 },
219 .manage_ibss_station = iwlagn_manage_ibss_station,
220 .update_bcast_station = iwl_update_bcast_station,
221 .debugfs_ops = {
222 .rx_stats_read = iwl_ucode_rx_stats_read,
223 .tx_stats_read = iwl_ucode_tx_stats_read,
224 .general_stats_read = iwl_ucode_general_stats_read,
225 .bt_stats_read = iwl_ucode_bt_stats_read,
226 },
227 .recover_from_tx_stall = iwl_bg_monitor_recover,
228 .check_plcp_health = iwl_good_plcp_health,
229 .check_ack_health = iwl_good_ack_health,
230 .txfifo_flush = iwlagn_txfifo_flush, 199 .txfifo_flush = iwlagn_txfifo_flush,
231 .dev_txfifo_flush = iwlagn_dev_txfifo_flush, 200 .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
232}; 201};
@@ -235,73 +204,70 @@ static const struct iwl_ops iwl1000_ops = {
235 .lib = &iwl1000_lib, 204 .lib = &iwl1000_lib,
236 .hcmd = &iwlagn_hcmd, 205 .hcmd = &iwlagn_hcmd,
237 .utils = &iwlagn_hcmd_utils, 206 .utils = &iwlagn_hcmd_utils,
238 .led = &iwlagn_led_ops,
239}; 207};
240 208
241struct iwl_cfg iwl1000_bgn_cfg = { 209static struct iwl_base_params iwl1000_base_params = {
242 .name = "Intel(R) Centrino(R) Wireless-N 1000 BGN",
243 .fw_name_pre = IWL1000_FW_PRE,
244 .ucode_api_max = IWL1000_UCODE_API_MAX,
245 .ucode_api_min = IWL1000_UCODE_API_MIN,
246 .sku = IWL_SKU_G|IWL_SKU_N,
247 .ops = &iwl1000_ops,
248 .eeprom_size = OTP_LOW_IMAGE_SIZE,
249 .eeprom_ver = EEPROM_1000_EEPROM_VERSION,
250 .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION,
251 .num_of_queues = IWLAGN_NUM_QUEUES, 210 .num_of_queues = IWLAGN_NUM_QUEUES,
252 .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES, 211 .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
253 .mod_params = &iwlagn_mod_params, 212 .eeprom_size = OTP_LOW_IMAGE_SIZE,
254 .valid_tx_ant = ANT_A,
255 .valid_rx_ant = ANT_AB,
256 .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL, 213 .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
257 .set_l0s = true,
258 .use_bsm = false,
259 .max_ll_items = OTP_MAX_LL_ITEMS_1000, 214 .max_ll_items = OTP_MAX_LL_ITEMS_1000,
260 .shadow_ram_support = false, 215 .shadow_ram_support = false,
261 .ht_greenfield_support = true,
262 .led_compensation = 51, 216 .led_compensation = 51,
263 .use_rts_for_aggregation = true, /* use rts/cts protection */
264 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 217 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
265 .support_ct_kill_exit = true, 218 .support_ct_kill_exit = true,
266 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF, 219 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF,
267 .chain_noise_scale = 1000, 220 .chain_noise_scale = 1000,
268 .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 221 .wd_timeout = IWL_DEF_WD_TIMEOUT,
269 .max_event_log_size = 128, 222 .max_event_log_size = 128,
270 .ucode_tracing = true, 223};
271 .sensitivity_calib_by_driver = true, 224static struct iwl_ht_params iwl1000_ht_params = {
272 .chain_noise_calib_by_driver = true, 225 .ht_greenfield_support = true,
226 .use_rts_for_aggregation = true, /* use rts/cts protection */
227};
228
229#define IWL_DEVICE_1000 \
230 .fw_name_pre = IWL1000_FW_PRE, \
231 .ucode_api_max = IWL1000_UCODE_API_MAX, \
232 .ucode_api_min = IWL1000_UCODE_API_MIN, \
233 .eeprom_ver = EEPROM_1000_EEPROM_VERSION, \
234 .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION, \
235 .ops = &iwl1000_ops, \
236 .base_params = &iwl1000_base_params, \
237 .led_mode = IWL_LED_BLINK
238
239struct iwl_cfg iwl1000_bgn_cfg = {
240 .name = "Intel(R) Centrino(R) Wireless-N 1000 BGN",
241 IWL_DEVICE_1000,
242 .ht_params = &iwl1000_ht_params,
273}; 243};
274 244
275struct iwl_cfg iwl1000_bg_cfg = { 245struct iwl_cfg iwl1000_bg_cfg = {
276 .name = "Intel(R) Centrino(R) Wireless-N 1000 BG", 246 .name = "Intel(R) Centrino(R) Wireless-N 1000 BG",
277 .fw_name_pre = IWL1000_FW_PRE, 247 IWL_DEVICE_1000,
278 .ucode_api_max = IWL1000_UCODE_API_MAX, 248};
279 .ucode_api_min = IWL1000_UCODE_API_MIN, 249
280 .sku = IWL_SKU_G, 250#define IWL_DEVICE_100 \
281 .ops = &iwl1000_ops, 251 .fw_name_pre = IWL100_FW_PRE, \
282 .eeprom_size = OTP_LOW_IMAGE_SIZE, 252 .ucode_api_max = IWL100_UCODE_API_MAX, \
283 .eeprom_ver = EEPROM_1000_EEPROM_VERSION, 253 .ucode_api_min = IWL100_UCODE_API_MIN, \
284 .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION, 254 .eeprom_ver = EEPROM_1000_EEPROM_VERSION, \
285 .num_of_queues = IWLAGN_NUM_QUEUES, 255 .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION, \
286 .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES, 256 .ops = &iwl1000_ops, \
287 .mod_params = &iwlagn_mod_params, 257 .base_params = &iwl1000_base_params, \
288 .valid_tx_ant = ANT_A, 258 .led_mode = IWL_LED_RF_STATE, \
289 .valid_rx_ant = ANT_AB, 259 .rx_with_siso_diversity = true
290 .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL, 260
291 .set_l0s = true, 261struct iwl_cfg iwl100_bgn_cfg = {
292 .use_bsm = false, 262 .name = "Intel(R) Centrino(R) Wireless-N 100 BGN",
293 .max_ll_items = OTP_MAX_LL_ITEMS_1000, 263 IWL_DEVICE_100,
294 .shadow_ram_support = false, 264 .ht_params = &iwl1000_ht_params,
295 .led_compensation = 51, 265};
296 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 266
297 .support_ct_kill_exit = true, 267struct iwl_cfg iwl100_bg_cfg = {
298 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF, 268 .name = "Intel(R) Centrino(R) Wireless-N 100 BG",
299 .chain_noise_scale = 1000, 269 IWL_DEVICE_100,
300 .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
301 .max_event_log_size = 128,
302 .ucode_tracing = true,
303 .sensitivity_calib_by_driver = true,
304 .chain_noise_calib_by_driver = true,
305}; 270};
306 271
307MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX)); 272MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX));
273MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_MAX));