aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-6000.c
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2010-06-15 19:14:53 -0400
committerReinette Chatre <reinette.chatre@intel.com>2010-06-25 17:52:18 -0400
commit178d1596073e81927a24221dba6c55ae0048a207 (patch)
treec8783d2f8bb153f14359da99eb35f4e310c4bd8d /drivers/net/wireless/iwlwifi/iwl-6000.c
parent4e3243f549540235d180e446715a14c1b5827902 (diff)
iwlwifi: enable DC calibration based on config parameter
Different devices have different calibration requirement, some need DC calibration and some don't; make it a cfg parameter for easy management. Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-6000.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c143
1 files changed, 19 insertions, 124 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index afdeec56b13f..c909a9c5e5e1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -84,9 +84,10 @@ static void iwl6000_set_ct_threshold(struct iwl_priv *priv)
84} 84}
85 85
86/* Indicate calibration version to uCode. */ 86/* Indicate calibration version to uCode. */
87static void iwl6050_set_calib_version(struct iwl_priv *priv) 87static void iwl6000_set_calib_version(struct iwl_priv *priv)
88{ 88{
89 if (priv->cfg->ops->lib->eeprom_ops.calib_version(priv) >= 6) 89 if (priv->cfg->need_dc_calib &&
90 (priv->cfg->ops->lib->eeprom_ops.calib_version(priv) >= 6))
90 iwl_set_bit(priv, CSR_GP_DRIVER_REG, 91 iwl_set_bit(priv, CSR_GP_DRIVER_REG,
91 CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); 92 CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
92} 93}
@@ -186,53 +187,8 @@ static int iwl6000_hw_set_hw_params(struct iwl_priv *priv)
186 BIT(IWL_CALIB_LO) | 187 BIT(IWL_CALIB_LO) |
187 BIT(IWL_CALIB_TX_IQ) | 188 BIT(IWL_CALIB_TX_IQ) |
188 BIT(IWL_CALIB_BASE_BAND); 189 BIT(IWL_CALIB_BASE_BAND);
189 190 if (priv->cfg->need_dc_calib)
190 priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS; 191 priv->hw_params.calib_init_cfg |= BIT(IWL_CALIB_DC);
191
192 return 0;
193}
194
195static int iwl6050_hw_set_hw_params(struct iwl_priv *priv)
196{
197 if (priv->cfg->mod_params->num_of_queues >= IWL_MIN_NUM_QUEUES &&
198 priv->cfg->mod_params->num_of_queues <= IWLAGN_NUM_QUEUES)
199 priv->cfg->num_of_queues =
200 priv->cfg->mod_params->num_of_queues;
201
202 priv->hw_params.max_txq_num = priv->cfg->num_of_queues;
203 priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM;
204 priv->hw_params.scd_bc_tbls_size =
205 priv->cfg->num_of_queues *
206 sizeof(struct iwlagn_scd_bc_tbl);
207 priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
208 priv->hw_params.max_stations = IWL5000_STATION_COUNT;
209 priv->hw_params.bcast_sta_id = IWL5000_BROADCAST_ID;
210
211 priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE;
212 priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE;
213
214 priv->hw_params.max_bsm_size = 0;
215 priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) |
216 BIT(IEEE80211_BAND_5GHZ);
217 priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
218
219 priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
220 priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
221 priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant;
222 priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant;
223
224 if (priv->cfg->ops->lib->temp_ops.set_ct_kill)
225 priv->cfg->ops->lib->temp_ops.set_ct_kill(priv);
226
227 /* Set initial sensitivity parameters */
228 /* Set initial calibration set */
229 priv->hw_params.sens = &iwl6000_sensitivity;
230 priv->hw_params.calib_init_cfg =
231 BIT(IWL_CALIB_XTAL) |
232 BIT(IWL_CALIB_DC) |
233 BIT(IWL_CALIB_LO) |
234 BIT(IWL_CALIB_TX_IQ) |
235 BIT(IWL_CALIB_BASE_BAND);
236 192
237 priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS; 193 priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
238 194
@@ -359,6 +315,7 @@ static struct iwl_lib_ops iwl6000_lib = {
359 .temp_ops = { 315 .temp_ops = {
360 .temperature = iwlagn_temperature, 316 .temperature = iwlagn_temperature,
361 .set_ct_kill = iwl6000_set_ct_threshold, 317 .set_ct_kill = iwl6000_set_ct_threshold,
318 .set_calib_version = iwl6000_set_calib_version,
362 }, 319 },
363 .manage_ibss_station = iwlagn_manage_ibss_station, 320 .manage_ibss_station = iwlagn_manage_ibss_station,
364 .debugfs_ops = { 321 .debugfs_ops = {
@@ -397,79 +354,6 @@ static const struct iwl_ops iwl6000g2b_ops = {
397 .led = &iwlagn_led_ops, 354 .led = &iwlagn_led_ops,
398}; 355};
399 356
400static struct iwl_lib_ops iwl6050_lib = {
401 .set_hw_params = iwl6050_hw_set_hw_params,
402 .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
403 .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
404 .txq_set_sched = iwlagn_txq_set_sched,
405 .txq_agg_enable = iwlagn_txq_agg_enable,
406 .txq_agg_disable = iwlagn_txq_agg_disable,
407 .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
408 .txq_free_tfd = iwl_hw_txq_free_tfd,
409 .txq_init = iwl_hw_tx_queue_init,
410 .rx_handler_setup = iwlagn_rx_handler_setup,
411 .setup_deferred_work = iwlagn_setup_deferred_work,
412 .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
413 .load_ucode = iwlagn_load_ucode,
414 .dump_nic_event_log = iwl_dump_nic_event_log,
415 .dump_nic_error_log = iwl_dump_nic_error_log,
416 .dump_csr = iwl_dump_csr,
417 .dump_fh = iwl_dump_fh,
418 .init_alive_start = iwlagn_init_alive_start,
419 .alive_notify = iwlagn_alive_notify,
420 .send_tx_power = iwlagn_send_tx_power,
421 .update_chain_flags = iwl_update_chain_flags,
422 .set_channel_switch = iwl6000_hw_channel_switch,
423 .apm_ops = {
424 .init = iwl_apm_init,
425 .stop = iwl_apm_stop,
426 .config = iwl6000_nic_config,
427 .set_pwr_src = iwl_set_pwr_src,
428 },
429 .eeprom_ops = {
430 .regulatory_bands = {
431 EEPROM_REG_BAND_1_CHANNELS,
432 EEPROM_REG_BAND_2_CHANNELS,
433 EEPROM_REG_BAND_3_CHANNELS,
434 EEPROM_REG_BAND_4_CHANNELS,
435 EEPROM_REG_BAND_5_CHANNELS,
436 EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
437 EEPROM_REG_BAND_52_HT40_CHANNELS
438 },
439 .verify_signature = iwlcore_eeprom_verify_signature,
440 .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
441 .release_semaphore = iwlcore_eeprom_release_semaphore,
442 .calib_version = iwlagn_eeprom_calib_version,
443 .query_addr = iwlagn_eeprom_query_addr,
444 .update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower,
445 },
446 .post_associate = iwl_post_associate,
447 .isr = iwl_isr_ict,
448 .config_ap = iwl_config_ap,
449 .temp_ops = {
450 .temperature = iwlagn_temperature,
451 .set_ct_kill = iwl6000_set_ct_threshold,
452 .set_calib_version = iwl6050_set_calib_version,
453 },
454 .manage_ibss_station = iwlagn_manage_ibss_station,
455 .debugfs_ops = {
456 .rx_stats_read = iwl_ucode_rx_stats_read,
457 .tx_stats_read = iwl_ucode_tx_stats_read,
458 .general_stats_read = iwl_ucode_general_stats_read,
459 },
460 .recover_from_tx_stall = iwl_bg_monitor_recover,
461 .check_plcp_health = iwl_good_plcp_health,
462 .check_ack_health = iwl_good_ack_health,
463};
464
465static const struct iwl_ops iwl6050_ops = {
466 .lib = &iwl6050_lib,
467 .hcmd = &iwlagn_hcmd,
468 .utils = &iwlagn_hcmd_utils,
469 .led = &iwlagn_led_ops,
470};
471
472
473struct iwl_cfg iwl6000g2a_2agn_cfg = { 357struct iwl_cfg iwl6000g2a_2agn_cfg = {
474 .name = "6000 Series 2x2 AGN Gen2a", 358 .name = "6000 Series 2x2 AGN Gen2a",
475 .fw_name_pre = IWL6000G2A_FW_PRE, 359 .fw_name_pre = IWL6000G2A_FW_PRE,
@@ -505,6 +389,7 @@ struct iwl_cfg iwl6000g2a_2agn_cfg = {
505 .ucode_tracing = true, 389 .ucode_tracing = true,
506 .sensitivity_calib_by_driver = true, 390 .sensitivity_calib_by_driver = true,
507 .chain_noise_calib_by_driver = true, 391 .chain_noise_calib_by_driver = true,
392 .need_dc_calib = true,
508}; 393};
509 394
510struct iwl_cfg iwl6000g2a_2abg_cfg = { 395struct iwl_cfg iwl6000g2a_2abg_cfg = {
@@ -537,6 +422,7 @@ struct iwl_cfg iwl6000g2a_2abg_cfg = {
537 .chain_noise_scale = 1000, 422 .chain_noise_scale = 1000,
538 .monitor_recover_period = IWL_MONITORING_PERIOD, 423 .monitor_recover_period = IWL_MONITORING_PERIOD,
539 .max_event_log_size = 512, 424 .max_event_log_size = 512,
425 .need_dc_calib = true,
540}; 426};
541 427
542struct iwl_cfg iwl6000g2a_2bg_cfg = { 428struct iwl_cfg iwl6000g2a_2bg_cfg = {
@@ -569,6 +455,7 @@ struct iwl_cfg iwl6000g2a_2bg_cfg = {
569 .chain_noise_scale = 1000, 455 .chain_noise_scale = 1000,
570 .monitor_recover_period = IWL_MONITORING_PERIOD, 456 .monitor_recover_period = IWL_MONITORING_PERIOD,
571 .max_event_log_size = 512, 457 .max_event_log_size = 512,
458 .need_dc_calib = true,
572}; 459};
573 460
574struct iwl_cfg iwl6000g2b_2agn_cfg = { 461struct iwl_cfg iwl6000g2b_2agn_cfg = {
@@ -603,6 +490,7 @@ struct iwl_cfg iwl6000g2b_2agn_cfg = {
603 .chain_noise_scale = 1000, 490 .chain_noise_scale = 1000,
604 .monitor_recover_period = IWL_MONITORING_PERIOD, 491 .monitor_recover_period = IWL_MONITORING_PERIOD,
605 .max_event_log_size = 512, 492 .max_event_log_size = 512,
493 .need_dc_calib = true,
606}; 494};
607 495
608struct iwl_cfg iwl6000g2b_2abg_cfg = { 496struct iwl_cfg iwl6000g2b_2abg_cfg = {
@@ -635,6 +523,7 @@ struct iwl_cfg iwl6000g2b_2abg_cfg = {
635 .chain_noise_scale = 1000, 523 .chain_noise_scale = 1000,
636 .monitor_recover_period = IWL_MONITORING_PERIOD, 524 .monitor_recover_period = IWL_MONITORING_PERIOD,
637 .max_event_log_size = 512, 525 .max_event_log_size = 512,
526 .need_dc_calib = true,
638}; 527};
639 528
640struct iwl_cfg iwl6000g2b_2bgn_cfg = { 529struct iwl_cfg iwl6000g2b_2bgn_cfg = {
@@ -669,6 +558,7 @@ struct iwl_cfg iwl6000g2b_2bgn_cfg = {
669 .chain_noise_scale = 1000, 558 .chain_noise_scale = 1000,
670 .monitor_recover_period = IWL_MONITORING_PERIOD, 559 .monitor_recover_period = IWL_MONITORING_PERIOD,
671 .max_event_log_size = 512, 560 .max_event_log_size = 512,
561 .need_dc_calib = true,
672}; 562};
673 563
674struct iwl_cfg iwl6000g2b_2bg_cfg = { 564struct iwl_cfg iwl6000g2b_2bg_cfg = {
@@ -701,6 +591,7 @@ struct iwl_cfg iwl6000g2b_2bg_cfg = {
701 .chain_noise_scale = 1000, 591 .chain_noise_scale = 1000,
702 .monitor_recover_period = IWL_MONITORING_PERIOD, 592 .monitor_recover_period = IWL_MONITORING_PERIOD,
703 .max_event_log_size = 512, 593 .max_event_log_size = 512,
594 .need_dc_calib = true,
704}; 595};
705 596
706struct iwl_cfg iwl6000g2b_bgn_cfg = { 597struct iwl_cfg iwl6000g2b_bgn_cfg = {
@@ -735,6 +626,7 @@ struct iwl_cfg iwl6000g2b_bgn_cfg = {
735 .chain_noise_scale = 1000, 626 .chain_noise_scale = 1000,
736 .monitor_recover_period = IWL_MONITORING_PERIOD, 627 .monitor_recover_period = IWL_MONITORING_PERIOD,
737 .max_event_log_size = 512, 628 .max_event_log_size = 512,
629 .need_dc_calib = true,
738}; 630};
739 631
740struct iwl_cfg iwl6000g2b_bg_cfg = { 632struct iwl_cfg iwl6000g2b_bg_cfg = {
@@ -767,6 +659,7 @@ struct iwl_cfg iwl6000g2b_bg_cfg = {
767 .chain_noise_scale = 1000, 659 .chain_noise_scale = 1000,
768 .monitor_recover_period = IWL_MONITORING_PERIOD, 660 .monitor_recover_period = IWL_MONITORING_PERIOD,
769 .max_event_log_size = 512, 661 .max_event_log_size = 512,
662 .need_dc_calib = true,
770}; 663};
771 664
772/* 665/*
@@ -885,7 +778,7 @@ struct iwl_cfg iwl6050_2agn_cfg = {
885 .ucode_api_max = IWL6050_UCODE_API_MAX, 778 .ucode_api_max = IWL6050_UCODE_API_MAX,
886 .ucode_api_min = IWL6050_UCODE_API_MIN, 779 .ucode_api_min = IWL6050_UCODE_API_MIN,
887 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, 780 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
888 .ops = &iwl6050_ops, 781 .ops = &iwl6000_ops,
889 .eeprom_size = OTP_LOW_IMAGE_SIZE, 782 .eeprom_size = OTP_LOW_IMAGE_SIZE,
890 .eeprom_ver = EEPROM_6050_EEPROM_VERSION, 783 .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
891 .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION, 784 .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION,
@@ -914,6 +807,7 @@ struct iwl_cfg iwl6050_2agn_cfg = {
914 .ucode_tracing = true, 807 .ucode_tracing = true,
915 .sensitivity_calib_by_driver = true, 808 .sensitivity_calib_by_driver = true,
916 .chain_noise_calib_by_driver = true, 809 .chain_noise_calib_by_driver = true,
810 .need_dc_calib = true,
917}; 811};
918 812
919struct iwl_cfg iwl6050_2abg_cfg = { 813struct iwl_cfg iwl6050_2abg_cfg = {
@@ -922,7 +816,7 @@ struct iwl_cfg iwl6050_2abg_cfg = {
922 .ucode_api_max = IWL6050_UCODE_API_MAX, 816 .ucode_api_max = IWL6050_UCODE_API_MAX,
923 .ucode_api_min = IWL6050_UCODE_API_MIN, 817 .ucode_api_min = IWL6050_UCODE_API_MIN,
924 .sku = IWL_SKU_A|IWL_SKU_G, 818 .sku = IWL_SKU_A|IWL_SKU_G,
925 .ops = &iwl6050_ops, 819 .ops = &iwl6000_ops,
926 .eeprom_size = OTP_LOW_IMAGE_SIZE, 820 .eeprom_size = OTP_LOW_IMAGE_SIZE,
927 .eeprom_ver = EEPROM_6050_EEPROM_VERSION, 821 .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
928 .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION, 822 .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION,
@@ -949,6 +843,7 @@ struct iwl_cfg iwl6050_2abg_cfg = {
949 .ucode_tracing = true, 843 .ucode_tracing = true,
950 .sensitivity_calib_by_driver = true, 844 .sensitivity_calib_by_driver = true,
951 .chain_noise_calib_by_driver = true, 845 .chain_noise_calib_by_driver = true,
846 .need_dc_calib = true,
952}; 847};
953 848
954struct iwl_cfg iwl6000_3agn_cfg = { 849struct iwl_cfg iwl6000_3agn_cfg = {