aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2011-11-17 11:51:53 -0500
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2011-11-25 13:49:04 -0500
commit93b64105e5642728cfc441e20a42164323fe4ad0 (patch)
treea9d0ddd217744d94e3405f93c210c5d50a8a7f6e /drivers/net/wireless/iwlwifi
parent72bcacc2bd237423eea8c00c2794e67dc7eebca6 (diff)
iwlagn: remove calibration knowledge
The init microcode knows very well which calibrations are required and sends us results for those that are. Consequently, we can just send all of those to the RT uCode again. The problem with having the driver know about this is that it is a uCode feature, not a hardware feature so the config is completely unsuitable. The only thing we need to check is whether the device needs crystal calibration or not, add a new parameter to the configuration for that. This makes new uCode work on 6000 series devices. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-1000.c9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-2000.c14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c15
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-calib.c28
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-ucode.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-shared.h2
8 files changed, 22 insertions, 75 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index e12b48c2cff6..bc9bbbb2b494 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -147,16 +147,7 @@ static int iwl1000_hw_set_hw_params(struct iwl_priv *priv)
147 iwl1000_set_ct_threshold(priv); 147 iwl1000_set_ct_threshold(priv);
148 148
149 /* Set initial sensitivity parameters */ 149 /* Set initial sensitivity parameters */
150 /* Set initial calibration set */
151 hw_params(priv).sens = &iwl1000_sensitivity; 150 hw_params(priv).sens = &iwl1000_sensitivity;
152 hw_params(priv).calib_init_cfg =
153 BIT(IWL_CALIB_XTAL) |
154 BIT(IWL_CALIB_LO) |
155 BIT(IWL_CALIB_TX_IQ) |
156 BIT(IWL_CALIB_TX_IQ_PERD) |
157 BIT(IWL_CALIB_BASE_BAND);
158 if (priv->cfg->need_dc_calib)
159 hw_params(priv).calib_init_cfg |= BIT(IWL_CALIB_DC);
160 151
161 return 0; 152 return 0;
162} 153}
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c
index b3193571ed07..0c4688d95b65 100644
--- a/drivers/net/wireless/iwlwifi/iwl-2000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-2000.c
@@ -143,17 +143,7 @@ static int iwl2000_hw_set_hw_params(struct iwl_priv *priv)
143 iwl2000_set_ct_threshold(priv); 143 iwl2000_set_ct_threshold(priv);
144 144
145 /* Set initial sensitivity parameters */ 145 /* Set initial sensitivity parameters */
146 /* Set initial calibration set */
147 hw_params(priv).sens = &iwl2000_sensitivity; 146 hw_params(priv).sens = &iwl2000_sensitivity;
148 hw_params(priv).calib_init_cfg =
149 BIT(IWL_CALIB_XTAL) |
150 BIT(IWL_CALIB_LO) |
151 BIT(IWL_CALIB_TX_IQ) |
152 BIT(IWL_CALIB_BASE_BAND);
153 if (priv->cfg->need_dc_calib)
154 hw_params(priv).calib_rt_cfg |= IWL_CALIB_CFG_DC_IDX;
155 if (priv->cfg->need_temp_offset_calib)
156 hw_params(priv).calib_init_cfg |= BIT(IWL_CALIB_TEMP_OFFSET);
157 147
158 return 0; 148 return 0;
159} 149}
@@ -258,7 +248,6 @@ static struct iwl_bt_params iwl2030_bt_params = {
258 .eeprom_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ 248 .eeprom_calib_ver = EEPROM_2000_TX_POWER_VERSION, \
259 .lib = &iwl2000_lib, \ 249 .lib = &iwl2000_lib, \
260 .base_params = &iwl2000_base_params, \ 250 .base_params = &iwl2000_base_params, \
261 .need_dc_calib = true, \
262 .need_temp_offset_calib = true, \ 251 .need_temp_offset_calib = true, \
263 .temp_offset_v2 = true, \ 252 .temp_offset_v2 = true, \
264 .led_mode = IWL_LED_RF_STATE, \ 253 .led_mode = IWL_LED_RF_STATE, \
@@ -286,7 +275,6 @@ struct iwl_cfg iwl2000_2bgn_d_cfg = {
286 .lib = &iwl2030_lib, \ 275 .lib = &iwl2030_lib, \
287 .base_params = &iwl2030_base_params, \ 276 .base_params = &iwl2030_base_params, \
288 .bt_params = &iwl2030_bt_params, \ 277 .bt_params = &iwl2030_bt_params, \
289 .need_dc_calib = true, \
290 .need_temp_offset_calib = true, \ 278 .need_temp_offset_calib = true, \
291 .temp_offset_v2 = true, \ 279 .temp_offset_v2 = true, \
292 .led_mode = IWL_LED_RF_STATE, \ 280 .led_mode = IWL_LED_RF_STATE, \
@@ -308,7 +296,6 @@ struct iwl_cfg iwl2030_2bgn_cfg = {
308 .eeprom_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ 296 .eeprom_calib_ver = EEPROM_2000_TX_POWER_VERSION, \
309 .lib = &iwl2000_lib, \ 297 .lib = &iwl2000_lib, \
310 .base_params = &iwl2000_base_params, \ 298 .base_params = &iwl2000_base_params, \
311 .need_dc_calib = true, \
312 .need_temp_offset_calib = true, \ 299 .need_temp_offset_calib = true, \
313 .temp_offset_v2 = true, \ 300 .temp_offset_v2 = true, \
314 .led_mode = IWL_LED_RF_STATE, \ 301 .led_mode = IWL_LED_RF_STATE, \
@@ -338,7 +325,6 @@ struct iwl_cfg iwl105_bgn_d_cfg = {
338 .lib = &iwl2030_lib, \ 325 .lib = &iwl2030_lib, \
339 .base_params = &iwl2030_base_params, \ 326 .base_params = &iwl2030_base_params, \
340 .bt_params = &iwl2030_bt_params, \ 327 .bt_params = &iwl2030_bt_params, \
341 .need_dc_calib = true, \
342 .need_temp_offset_calib = true, \ 328 .need_temp_offset_calib = true, \
343 .temp_offset_v2 = true, \ 329 .temp_offset_v2 = true, \
344 .led_mode = IWL_LED_RF_STATE, \ 330 .led_mode = IWL_LED_RF_STATE, \
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index c511c98a89a8..3a3f83032382 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -186,14 +186,7 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
186 iwl5000_set_ct_threshold(priv); 186 iwl5000_set_ct_threshold(priv);
187 187
188 /* Set initial sensitivity parameters */ 188 /* Set initial sensitivity parameters */
189 /* Set initial calibration set */
190 hw_params(priv).sens = &iwl5000_sensitivity; 189 hw_params(priv).sens = &iwl5000_sensitivity;
191 hw_params(priv).calib_init_cfg =
192 BIT(IWL_CALIB_XTAL) |
193 BIT(IWL_CALIB_LO) |
194 BIT(IWL_CALIB_TX_IQ) |
195 BIT(IWL_CALIB_TX_IQ_PERD) |
196 BIT(IWL_CALIB_BASE_BAND);
197 190
198 return 0; 191 return 0;
199} 192}
@@ -222,14 +215,7 @@ static int iwl5150_hw_set_hw_params(struct iwl_priv *priv)
222 iwl5150_set_ct_threshold(priv); 215 iwl5150_set_ct_threshold(priv);
223 216
224 /* Set initial sensitivity parameters */ 217 /* Set initial sensitivity parameters */
225 /* Set initial calibration set */
226 hw_params(priv).sens = &iwl5150_sensitivity; 218 hw_params(priv).sens = &iwl5150_sensitivity;
227 hw_params(priv).calib_init_cfg =
228 BIT(IWL_CALIB_LO) |
229 BIT(IWL_CALIB_TX_IQ) |
230 BIT(IWL_CALIB_BASE_BAND);
231 if (priv->cfg->need_dc_calib)
232 hw_params(priv).calib_init_cfg |= BIT(IWL_CALIB_DC);
233 219
234 return 0; 220 return 0;
235} 221}
@@ -433,7 +419,7 @@ struct iwl_cfg iwl5350_agn_cfg = {
433 .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION, \ 419 .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION, \
434 .lib = &iwl5150_lib, \ 420 .lib = &iwl5150_lib, \
435 .base_params = &iwl5000_base_params, \ 421 .base_params = &iwl5000_base_params, \
436 .need_dc_calib = true, \ 422 .no_xtal_calib = true, \
437 .led_mode = IWL_LED_BLINK, \ 423 .led_mode = IWL_LED_BLINK, \
438 .internal_wimax_coex = true 424 .internal_wimax_coex = true
439 425
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index ee3363fdf309..09f037824f81 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -164,17 +164,7 @@ static int iwl6000_hw_set_hw_params(struct iwl_priv *priv)
164 iwl6000_set_ct_threshold(priv); 164 iwl6000_set_ct_threshold(priv);
165 165
166 /* Set initial sensitivity parameters */ 166 /* Set initial sensitivity parameters */
167 /* Set initial calibration set */
168 hw_params(priv).sens = &iwl6000_sensitivity; 167 hw_params(priv).sens = &iwl6000_sensitivity;
169 hw_params(priv).calib_init_cfg =
170 BIT(IWL_CALIB_XTAL) |
171 BIT(IWL_CALIB_LO) |
172 BIT(IWL_CALIB_TX_IQ) |
173 BIT(IWL_CALIB_BASE_BAND);
174 if (priv->cfg->need_dc_calib)
175 hw_params(priv).calib_rt_cfg |= IWL_CALIB_CFG_DC_IDX;
176 if (priv->cfg->need_temp_offset_calib)
177 hw_params(priv).calib_init_cfg |= BIT(IWL_CALIB_TEMP_OFFSET);
178 168
179 return 0; 169 return 0;
180} 170}
@@ -364,7 +354,6 @@ static struct iwl_bt_params iwl6000_bt_params = {
364 .eeprom_calib_ver = EEPROM_6005_TX_POWER_VERSION, \ 354 .eeprom_calib_ver = EEPROM_6005_TX_POWER_VERSION, \
365 .lib = &iwl6000_lib, \ 355 .lib = &iwl6000_lib, \
366 .base_params = &iwl6000_g2_base_params, \ 356 .base_params = &iwl6000_g2_base_params, \
367 .need_dc_calib = true, \
368 .need_temp_offset_calib = true, \ 357 .need_temp_offset_calib = true, \
369 .led_mode = IWL_LED_RF_STATE 358 .led_mode = IWL_LED_RF_STATE
370 359
@@ -406,7 +395,6 @@ struct iwl_cfg iwl6005_2agn_d_cfg = {
406 .lib = &iwl6030_lib, \ 395 .lib = &iwl6030_lib, \
407 .base_params = &iwl6000_g2_base_params, \ 396 .base_params = &iwl6000_g2_base_params, \
408 .bt_params = &iwl6000_bt_params, \ 397 .bt_params = &iwl6000_bt_params, \
409 .need_dc_calib = true, \
410 .need_temp_offset_calib = true, \ 398 .need_temp_offset_calib = true, \
411 .led_mode = IWL_LED_RF_STATE, \ 399 .led_mode = IWL_LED_RF_STATE, \
412 .adv_pm = true \ 400 .adv_pm = true \
@@ -506,7 +494,6 @@ struct iwl_cfg iwl6000i_2bg_cfg = {
506 .eeprom_ver = EEPROM_6050_EEPROM_VERSION, \ 494 .eeprom_ver = EEPROM_6050_EEPROM_VERSION, \
507 .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION, \ 495 .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION, \
508 .base_params = &iwl6050_base_params, \ 496 .base_params = &iwl6050_base_params, \
509 .need_dc_calib = true, \
510 .led_mode = IWL_LED_BLINK, \ 497 .led_mode = IWL_LED_BLINK, \
511 .internal_wimax_coex = true 498 .internal_wimax_coex = true
512 499
@@ -530,7 +517,6 @@ struct iwl_cfg iwl6050_2abg_cfg = {
530 .eeprom_ver = EEPROM_6150_EEPROM_VERSION, \ 517 .eeprom_ver = EEPROM_6150_EEPROM_VERSION, \
531 .eeprom_calib_ver = EEPROM_6150_TX_POWER_VERSION, \ 518 .eeprom_calib_ver = EEPROM_6150_TX_POWER_VERSION, \
532 .base_params = &iwl6050_base_params, \ 519 .base_params = &iwl6050_base_params, \
533 .need_dc_calib = true, \
534 .led_mode = IWL_LED_BLINK, \ 520 .led_mode = IWL_LED_BLINK, \
535 .internal_wimax_coex = true 521 .internal_wimax_coex = true
536 522
@@ -555,7 +541,6 @@ struct iwl_cfg iwl6000_3agn_cfg = {
555 .lib = &iwl6000_lib, 541 .lib = &iwl6000_lib,
556 .base_params = &iwl6000_base_params, 542 .base_params = &iwl6000_base_params,
557 .ht_params = &iwl6000_ht_params, 543 .ht_params = &iwl6000_ht_params,
558 .need_dc_calib = true,
559 .led_mode = IWL_LED_BLINK, 544 .led_mode = IWL_LED_BLINK,
560}; 545};
561 546
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-calib.c b/drivers/net/wireless/iwlwifi/iwl-agn-calib.c
index 03bac48558b2..c7bcafabb3b3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-calib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-calib.c
@@ -84,30 +84,28 @@ struct statistics_general_data {
84 84
85int iwl_send_calib_results(struct iwl_priv *priv) 85int iwl_send_calib_results(struct iwl_priv *priv)
86{ 86{
87 int ret = 0;
88 int i = 0;
89
90 struct iwl_host_cmd hcmd = { 87 struct iwl_host_cmd hcmd = {
91 .id = REPLY_PHY_CALIBRATION_CMD, 88 .id = REPLY_PHY_CALIBRATION_CMD,
92 .flags = CMD_SYNC, 89 .flags = CMD_SYNC,
93 }; 90 };
91 int i = 0;
94 92
95 for (i = 0; i < IWL_CALIB_MAX; i++) { 93 for (i = 0; i < IWL_CALIB_MAX; i++) {
96 if ((BIT(i) & hw_params(priv).calib_init_cfg) && 94 int ret;
97 priv->calib_results[i].buf) { 95
98 hcmd.len[0] = priv->calib_results[i].buf_len; 96 if (!priv->calib_results[i].buf)
99 hcmd.data[0] = priv->calib_results[i].buf; 97 continue;
100 hcmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY; 98 hcmd.len[0] = priv->calib_results[i].buf_len;
101 ret = iwl_trans_send_cmd(trans(priv), &hcmd); 99 hcmd.data[0] = priv->calib_results[i].buf;
102 if (ret) { 100 hcmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY;
103 IWL_ERR(priv, "Error %d iteration %d\n", 101 ret = iwl_trans_send_cmd(trans(priv), &hcmd);
104 ret, i); 102 if (ret) {
105 break; 103 IWL_ERR(priv, "Error %d iteration %d\n", ret, i);
106 } 104 return ret;
107 } 105 }
108 } 106 }
109 107
110 return ret; 108 return 0;
111} 109}
112 110
113int iwl_calib_set(struct iwl_calib_result *res, const u8 *buf, int len) 111int iwl_calib_set(struct iwl_calib_result *res, const u8 *buf, int len)
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
index 9ec315b31d45..7043fdb13986 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
@@ -477,9 +477,11 @@ static int iwlagn_alive_notify(struct iwl_priv *priv)
477 if (ret) 477 if (ret)
478 return ret; 478 return ret;
479 479
480 ret = iwlagn_set_Xtal_calib(priv); 480 if (!priv->cfg->no_xtal_calib) {
481 if (ret) 481 ret = iwlagn_set_Xtal_calib(priv);
482 return ret; 482 if (ret)
483 return ret;
484 }
483 485
484 return iwl_send_calib_results(priv); 486 return iwl_send_calib_results(priv);
485} 487}
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index fa47f75185df..f1d9d0c13e4c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -184,8 +184,9 @@ struct iwl_ht_params {
184 * @ht_params: point to ht patameters 184 * @ht_params: point to ht patameters
185 * @bt_params: pointer to bt parameters 185 * @bt_params: pointer to bt parameters
186 * @pa_type: used by 6000 series only to identify the type of Power Amplifier 186 * @pa_type: used by 6000 series only to identify the type of Power Amplifier
187 * @need_dc_calib: need to perform init dc calibration
188 * @need_temp_offset_calib: need to perform temperature offset calibration 187 * @need_temp_offset_calib: need to perform temperature offset calibration
188 * @no_xtal_calib: some devices do not need crystal calibration data,
189 * don't send it to those
189 * @scan_antennas: available antenna for scan operation 190 * @scan_antennas: available antenna for scan operation
190 * @led_mode: 0=blinking, 1=On(RF On)/Off(RF Off) 191 * @led_mode: 0=blinking, 1=On(RF On)/Off(RF Off)
191 * @adv_pm: advance power management 192 * @adv_pm: advance power management
@@ -222,8 +223,8 @@ struct iwl_cfg {
222 struct iwl_ht_params *ht_params; 223 struct iwl_ht_params *ht_params;
223 struct iwl_bt_params *bt_params; 224 struct iwl_bt_params *bt_params;
224 enum iwl_pa_type pa_type; /* if used set to IWL_PA_SYSTEM */ 225 enum iwl_pa_type pa_type; /* if used set to IWL_PA_SYSTEM */
225 const bool need_dc_calib; /* if used set to true */
226 const bool need_temp_offset_calib; /* if used set to true */ 226 const bool need_temp_offset_calib; /* if used set to true */
227 const bool no_xtal_calib;
227 u8 scan_rx_antennas[IEEE80211_NUM_BANDS]; 228 u8 scan_rx_antennas[IEEE80211_NUM_BANDS];
228 enum iwl_led_mode led_mode; 229 enum iwl_led_mode led_mode;
229 const bool adv_pm; 230 const bool adv_pm;
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h
index 1f7a93c67c45..47be77a8a0a7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-shared.h
+++ b/drivers/net/wireless/iwlwifi/iwl-shared.h
@@ -174,7 +174,6 @@ struct iwl_mod_params {
174 * @ct_kill_exit_threshold: when to reeable the device - in hw dependent unit 174 * @ct_kill_exit_threshold: when to reeable the device - in hw dependent unit
175 * relevant for 1000, 6000 and up 175 * relevant for 1000, 6000 and up
176 * @wd_timeout: TX queues watchdog timeout 176 * @wd_timeout: TX queues watchdog timeout
177 * @calib_init_cfg: setup initial calibrations for the hw
178 * @calib_rt_cfg: setup runtime calibrations for the hw 177 * @calib_rt_cfg: setup runtime calibrations for the hw
179 * @struct iwl_sensitivity_ranges: range of sensitivity values 178 * @struct iwl_sensitivity_ranges: range of sensitivity values
180 */ 179 */
@@ -195,7 +194,6 @@ struct iwl_hw_params {
195 u32 ct_kill_exit_threshold; 194 u32 ct_kill_exit_threshold;
196 unsigned int wd_timeout; 195 unsigned int wd_timeout;
197 196
198 u32 calib_init_cfg;
199 u32 calib_rt_cfg; 197 u32 calib_rt_cfg;
200 const struct iwl_sensitivity_ranges *sens; 198 const struct iwl_sensitivity_ranges *sens;
201}; 199};