iwlwifi: add missing rcu_read_lock
[safe/jmp/linux-2.6] / drivers / net / wireless / iwlwifi / iwl-1000.c
index 1fc3814..6be2992 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2008-2009 Intel Corporation. All rights reserved.
+ * Copyright(c) 2008 - 2010 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
 #include "iwl-core.h"
 #include "iwl-io.h"
 #include "iwl-sta.h"
+#include "iwl-agn.h"
 #include "iwl-helpers.h"
-#include "iwl-5000-hw.h"
+#include "iwl-agn-hw.h"
 #include "iwl-agn-led.h"
+#include "iwl-agn-debugfs.h"
 
 /* Highest firmware API version supported */
 #define IWL1000_UCODE_API_MAX 3
@@ -89,67 +91,147 @@ static void iwl1000_nic_config(struct iwl_priv *priv)
                                ~APMG_SVR_VOLTAGE_CONFIG_BIT_MSK);
 }
 
+static struct iwl_sensitivity_ranges iwl1000_sensitivity = {
+       .min_nrg_cck = 95,
+       .max_nrg_cck = 0, /* not used, set to 0 */
+       .auto_corr_min_ofdm = 90,
+       .auto_corr_min_ofdm_mrc = 170,
+       .auto_corr_min_ofdm_x1 = 120,
+       .auto_corr_min_ofdm_mrc_x1 = 240,
+
+       .auto_corr_max_ofdm = 120,
+       .auto_corr_max_ofdm_mrc = 210,
+       .auto_corr_max_ofdm_x1 = 155,
+       .auto_corr_max_ofdm_mrc_x1 = 290,
+
+       .auto_corr_min_cck = 125,
+       .auto_corr_max_cck = 200,
+       .auto_corr_min_cck_mrc = 170,
+       .auto_corr_max_cck_mrc = 400,
+       .nrg_th_cck = 95,
+       .nrg_th_ofdm = 95,
+
+       .barker_corr_th_min = 190,
+       .barker_corr_th_min_mrc = 390,
+       .nrg_th_cca = 62,
+};
+
+static int iwl1000_hw_set_hw_params(struct iwl_priv *priv)
+{
+       if (priv->cfg->mod_params->num_of_queues >= IWL_MIN_NUM_QUEUES &&
+           priv->cfg->mod_params->num_of_queues <= IWLAGN_NUM_QUEUES)
+               priv->cfg->num_of_queues =
+                       priv->cfg->mod_params->num_of_queues;
+
+       priv->hw_params.max_txq_num = priv->cfg->num_of_queues;
+       priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM;
+       priv->hw_params.scd_bc_tbls_size =
+                       priv->cfg->num_of_queues *
+                       sizeof(struct iwlagn_scd_bc_tbl);
+       priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
+       priv->hw_params.max_stations = IWL5000_STATION_COUNT;
+       priv->hw_params.bcast_sta_id = IWL5000_BROADCAST_ID;
+
+       priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE;
+       priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE;
+
+       priv->hw_params.max_bsm_size = 0;
+       priv->hw_params.ht40_channel =  BIT(IEEE80211_BAND_2GHZ) |
+                                       BIT(IEEE80211_BAND_5GHZ);
+       priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
+
+       priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
+       priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
+       priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant;
+       priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant;
+
+       if (priv->cfg->ops->lib->temp_ops.set_ct_kill)
+               priv->cfg->ops->lib->temp_ops.set_ct_kill(priv);
+
+       /* Set initial sensitivity parameters */
+       /* Set initial calibration set */
+       priv->hw_params.sens = &iwl1000_sensitivity;
+       priv->hw_params.calib_init_cfg =
+                       BIT(IWL_CALIB_XTAL)             |
+                       BIT(IWL_CALIB_LO)               |
+                       BIT(IWL_CALIB_TX_IQ)            |
+                       BIT(IWL_CALIB_TX_IQ_PERD)       |
+                       BIT(IWL_CALIB_BASE_BAND);
+
+       return 0;
+}
+
 static struct iwl_lib_ops iwl1000_lib = {
-       .set_hw_params = iwl5000_hw_set_hw_params,
-       .txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl,
-       .txq_inval_byte_cnt_tbl = iwl5000_txq_inval_byte_cnt_tbl,
-       .txq_set_sched = iwl5000_txq_set_sched,
-       .txq_agg_enable = iwl5000_txq_agg_enable,
-       .txq_agg_disable = iwl5000_txq_agg_disable,
+       .set_hw_params = iwl1000_hw_set_hw_params,
+       .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
+       .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
+       .txq_set_sched = iwlagn_txq_set_sched,
+       .txq_agg_enable = iwlagn_txq_agg_enable,
+       .txq_agg_disable = iwlagn_txq_agg_disable,
        .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
        .txq_free_tfd = iwl_hw_txq_free_tfd,
        .txq_init = iwl_hw_tx_queue_init,
-       .rx_handler_setup = iwl5000_rx_handler_setup,
-       .setup_deferred_work = iwl5000_setup_deferred_work,
-       .is_valid_rtc_data_addr = iwl5000_hw_valid_rtc_data_addr,
-       .load_ucode = iwl5000_load_ucode,
+       .rx_handler_setup = iwlagn_rx_handler_setup,
+       .setup_deferred_work = iwlagn_setup_deferred_work,
+       .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
+       .load_ucode = iwlagn_load_ucode,
        .dump_nic_event_log = iwl_dump_nic_event_log,
        .dump_nic_error_log = iwl_dump_nic_error_log,
-       .init_alive_start = iwl5000_init_alive_start,
-       .alive_notify = iwl5000_alive_notify,
-       .send_tx_power = iwl5000_send_tx_power,
+       .dump_csr = iwl_dump_csr,
+       .dump_fh = iwl_dump_fh,
+       .init_alive_start = iwlagn_init_alive_start,
+       .alive_notify = iwlagn_alive_notify,
+       .send_tx_power = iwlagn_send_tx_power,
        .update_chain_flags = iwl_update_chain_flags,
        .apm_ops = {
-               .init = iwl5000_apm_init,
+               .init = iwl_apm_init,
                .stop = iwl_apm_stop,
                .config = iwl1000_nic_config,
                .set_pwr_src = iwl_set_pwr_src,
        },
        .eeprom_ops = {
                .regulatory_bands = {
-                       EEPROM_5000_REG_BAND_1_CHANNELS,
-                       EEPROM_5000_REG_BAND_2_CHANNELS,
-                       EEPROM_5000_REG_BAND_3_CHANNELS,
-                       EEPROM_5000_REG_BAND_4_CHANNELS,
-                       EEPROM_5000_REG_BAND_5_CHANNELS,
-                       EEPROM_5000_REG_BAND_24_HT40_CHANNELS,
-                       EEPROM_5000_REG_BAND_52_HT40_CHANNELS
+                       EEPROM_REG_BAND_1_CHANNELS,
+                       EEPROM_REG_BAND_2_CHANNELS,
+                       EEPROM_REG_BAND_3_CHANNELS,
+                       EEPROM_REG_BAND_4_CHANNELS,
+                       EEPROM_REG_BAND_5_CHANNELS,
+                       EEPROM_REG_BAND_24_HT40_CHANNELS,
+                       EEPROM_REG_BAND_52_HT40_CHANNELS
                },
                .verify_signature  = iwlcore_eeprom_verify_signature,
                .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
                .release_semaphore = iwlcore_eeprom_release_semaphore,
-               .calib_version  = iwl5000_eeprom_calib_version,
-               .query_addr = iwl5000_eeprom_query_addr,
+               .calib_version  = iwlagn_eeprom_calib_version,
+               .query_addr = iwlagn_eeprom_query_addr,
        },
        .post_associate = iwl_post_associate,
        .isr = iwl_isr_ict,
        .config_ap = iwl_config_ap,
        .temp_ops = {
-               .temperature = iwl5000_temperature,
+               .temperature = iwlagn_temperature,
                .set_ct_kill = iwl1000_set_ct_threshold,
         },
+       .manage_ibss_station = iwlagn_manage_ibss_station,
+       .debugfs_ops = {
+               .rx_stats_read = iwl_ucode_rx_stats_read,
+               .tx_stats_read = iwl_ucode_tx_stats_read,
+               .general_stats_read = iwl_ucode_general_stats_read,
+       },
+       .recover_from_tx_stall = iwl_bg_monitor_recover,
+       .check_plcp_health = iwl_good_plcp_health,
+       .check_ack_health = iwl_good_ack_health,
 };
 
-static struct iwl_ops iwl1000_ops = {
-       .ucode = &iwl5000_ucode,
+static const struct iwl_ops iwl1000_ops = {
        .lib = &iwl1000_lib,
-       .hcmd = &iwl5000_hcmd,
-       .utils = &iwl5000_hcmd_utils,
+       .hcmd = &iwlagn_hcmd,
+       .utils = &iwlagn_hcmd_utils,
        .led = &iwlagn_led_ops,
 };
 
 struct iwl_cfg iwl1000_bgn_cfg = {
-       .name = "1000 Series BGN",
+       .name = "Intel(R) Centrino(R) Wireless-N 1000 BGN",
        .fw_name_pre = IWL1000_FW_PRE,
        .ucode_api_max = IWL1000_UCODE_API_MAX,
        .ucode_api_min = IWL1000_UCODE_API_MIN,
@@ -157,20 +239,33 @@ struct iwl_cfg iwl1000_bgn_cfg = {
        .ops = &iwl1000_ops,
        .eeprom_size = OTP_LOW_IMAGE_SIZE,
        .eeprom_ver = EEPROM_1000_EEPROM_VERSION,
-       .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
-       .mod_params = &iwl50_mod_params,
+       .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION,
+       .num_of_queues = IWLAGN_NUM_QUEUES,
+       .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
+       .mod_params = &iwlagn_mod_params,
        .valid_tx_ant = ANT_A,
        .valid_rx_ant = ANT_AB,
-       .need_pll_cfg = true,
+       .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
+       .set_l0s = true,
+       .use_bsm = false,
        .max_ll_items = OTP_MAX_LL_ITEMS_1000,
        .shadow_ram_support = false,
        .ht_greenfield_support = true,
        .led_compensation = 51,
+       .use_rts_for_ht = true, /* use rts/cts protection */
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
+       .support_ct_kill_exit = true,
+       .plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF,
+       .chain_noise_scale = 1000,
+       .monitor_recover_period = IWL_MONITORING_PERIOD,
+       .max_event_log_size = 128,
+       .ucode_tracing = true,
+       .sensitivity_calib_by_driver = true,
+       .chain_noise_calib_by_driver = true,
 };
 
 struct iwl_cfg iwl1000_bg_cfg = {
-       .name = "1000 Series BG",
+       .name = "Intel(R) Centrino(R) Wireless-N 1000 BG",
        .fw_name_pre = IWL1000_FW_PRE,
        .ucode_api_max = IWL1000_UCODE_API_MAX,
        .ucode_api_min = IWL1000_UCODE_API_MIN,
@@ -178,16 +273,27 @@ struct iwl_cfg iwl1000_bg_cfg = {
        .ops = &iwl1000_ops,
        .eeprom_size = OTP_LOW_IMAGE_SIZE,
        .eeprom_ver = EEPROM_1000_EEPROM_VERSION,
-       .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
-       .mod_params = &iwl50_mod_params,
+       .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION,
+       .num_of_queues = IWLAGN_NUM_QUEUES,
+       .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
+       .mod_params = &iwlagn_mod_params,
        .valid_tx_ant = ANT_A,
        .valid_rx_ant = ANT_AB,
-       .need_pll_cfg = true,
+       .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
+       .set_l0s = true,
+       .use_bsm = false,
        .max_ll_items = OTP_MAX_LL_ITEMS_1000,
        .shadow_ram_support = false,
-       .ht_greenfield_support = true,
        .led_compensation = 51,
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
+       .support_ct_kill_exit = true,
+       .plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF,
+       .chain_noise_scale = 1000,
+       .monitor_recover_period = IWL_MONITORING_PERIOD,
+       .max_event_log_size = 128,
+       .ucode_tracing = true,
+       .sensitivity_calib_by_driver = true,
+       .chain_noise_calib_by_driver = true,
 };
 
 MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX));