iwlwifi: use .cfg to enable/disable continuous ucode trace
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / iwl-6000.c
index 92b407f89d3295d9895ed80118f17f2d18def15a..7cd45fe9b775ad21003c278cdffb16dfb47a57c2 100644 (file)
 #include "iwl-agn-hw.h"
 #include "iwl-6000-hw.h"
 #include "iwl-agn-led.h"
+#include "iwl-agn-debugfs.h"
 
 /* Highest firmware API version supported */
 #define IWL6000_UCODE_API_MAX 4
 #define IWL6050_UCODE_API_MAX 4
+#define IWL6000G2_UCODE_API_MAX 4
 
 /* Lowest firmware API version supported */
 #define IWL6000_UCODE_API_MIN 4
 #define IWL6050_UCODE_API_MIN 4
+#define IWL6000G2_UCODE_API_MIN 4
 
 #define IWL6000_FW_PRE "iwlwifi-6000-"
 #define _IWL6000_MODULE_FIRMWARE(api) IWL6000_FW_PRE #api ".ucode"
 #define _IWL6050_MODULE_FIRMWARE(api) IWL6050_FW_PRE #api ".ucode"
 #define IWL6050_MODULE_FIRMWARE(api) _IWL6050_MODULE_FIRMWARE(api)
 
+#define IWL6000G2A_FW_PRE "iwlwifi-6000g2a-"
+#define _IWL6000G2A_MODULE_FIRMWARE(api) IWL6000G2A_FW_PRE #api ".ucode"
+#define IWL6000G2A_MODULE_FIRMWARE(api) _IWL6000G2A_MODULE_FIRMWARE(api)
+
+
 static void iwl6000_set_ct_threshold(struct iwl_priv *priv)
 {
        /* want Celsius */
@@ -169,24 +177,56 @@ static int iwl6000_hw_set_hw_params(struct iwl_priv *priv)
        /* Set initial sensitivity parameters */
        /* Set initial calibration set */
        priv->hw_params.sens = &iwl6000_sensitivity;
-       switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
-       case CSR_HW_REV_TYPE_6x50:
-               priv->hw_params.calib_init_cfg =
-                       BIT(IWL_CALIB_XTAL)             |
-                       BIT(IWL_CALIB_DC)               |
-                       BIT(IWL_CALIB_LO)               |
-                       BIT(IWL_CALIB_TX_IQ)            |
-                       BIT(IWL_CALIB_BASE_BAND);
-
-               break;
-       default:
-               priv->hw_params.calib_init_cfg =
-                       BIT(IWL_CALIB_XTAL)             |
-                       BIT(IWL_CALIB_LO)               |
-                       BIT(IWL_CALIB_TX_IQ)            |
-                       BIT(IWL_CALIB_BASE_BAND);
-               break;
-       }
+       priv->hw_params.calib_init_cfg =
+               BIT(IWL_CALIB_XTAL)             |
+               BIT(IWL_CALIB_LO)               |
+               BIT(IWL_CALIB_TX_IQ)            |
+               BIT(IWL_CALIB_BASE_BAND);
+
+       return 0;
+}
+
+static int iwl6050_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 = IWL60_RTC_DATA_SIZE;
+       priv->hw_params.max_inst_size = IWL60_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 = &iwl6000_sensitivity;
+       priv->hw_params.calib_init_cfg =
+               BIT(IWL_CALIB_XTAL)             |
+               BIT(IWL_CALIB_DC)               |
+               BIT(IWL_CALIB_LO)               |
+               BIT(IWL_CALIB_TX_IQ)            |
+               BIT(IWL_CALIB_BASE_BAND);
 
        return 0;
 }
@@ -260,7 +300,7 @@ static struct iwl_lib_ops iwl6000_lib = {
                        EEPROM_REG_BAND_3_CHANNELS,
                        EEPROM_REG_BAND_4_CHANNELS,
                        EEPROM_REG_BAND_5_CHANNELS,
-                       EEPROM_REG_BAND_24_HT40_CHANNELS,
+                       EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
                        EEPROM_REG_BAND_52_HT40_CHANNELS
                },
                .verify_signature  = iwlcore_eeprom_verify_signature,
@@ -278,6 +318,11 @@ static struct iwl_lib_ops iwl6000_lib = {
                .set_ct_kill = iwl6000_set_ct_threshold,
         },
        .add_bcast_station = iwl_add_bcast_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,
@@ -292,7 +337,7 @@ static const struct iwl_ops iwl6000_ops = {
 };
 
 static struct iwl_lib_ops iwl6050_lib = {
-       .set_hw_params = iwl6000_hw_set_hw_params,
+       .set_hw_params = iwl6050_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,
@@ -327,7 +372,7 @@ static struct iwl_lib_ops iwl6050_lib = {
                        EEPROM_REG_BAND_3_CHANNELS,
                        EEPROM_REG_BAND_4_CHANNELS,
                        EEPROM_REG_BAND_5_CHANNELS,
-                       EEPROM_REG_BAND_24_HT40_CHANNELS,
+                       EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
                        EEPROM_REG_BAND_52_HT40_CHANNELS
                },
                .verify_signature  = iwlcore_eeprom_verify_signature,
@@ -346,6 +391,11 @@ static struct iwl_lib_ops iwl6050_lib = {
                .set_calib_version = iwl6050_set_calib_version,
         },
        .add_bcast_station = iwl_add_bcast_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,
@@ -359,6 +409,42 @@ static const struct iwl_ops iwl6050_ops = {
        .led = &iwlagn_led_ops,
 };
 
+
+struct iwl_cfg iwl6000g2a_2agn_cfg = {
+       .name = "6000 Series 2x2 AGN Gen2a",
+       .fw_name_pre = IWL6000G2A_FW_PRE,
+       .ucode_api_max = IWL6000G2_UCODE_API_MAX,
+       .ucode_api_min = IWL6000G2_UCODE_API_MIN,
+       .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
+       .ops = &iwl6000_ops,
+       .eeprom_size = OTP_LOW_IMAGE_SIZE,
+       .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
+       .eeprom_calib_ver = EEPROM_6000G2_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_AB,
+       .valid_rx_ant = ANT_AB,
+       .pll_cfg_val = 0,
+       .set_l0s = true,
+       .use_bsm = false,
+       .pa_type = IWL_PA_SYSTEM,
+       .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
+       .shadow_ram_support = true,
+       .ht_greenfield_support = true,
+       .led_compensation = 51,
+       .use_rts_for_ht = true, /* use rts/cts protection */
+       .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
+       .supports_idle = true,
+       .adv_thermal_throttle = true,
+       .support_ct_kill_exit = true,
+       .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
+       .chain_noise_scale = 1000,
+       .monitor_recover_period = IWL_MONITORING_PERIOD,
+       .max_event_log_size = 512,
+       .ucode_tracing = true,
+};
+
 /*
  * "i": Internal configuration, use internal Power Amplifier
  */
@@ -371,10 +457,10 @@ struct iwl_cfg iwl6000i_2agn_cfg = {
        .ops = &iwl6000_ops,
        .eeprom_size = OTP_LOW_IMAGE_SIZE,
        .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
-       .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
+       .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
        .num_of_queues = IWLAGN_NUM_QUEUES,
        .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
-       .mod_params = &iwl50_mod_params,
+       .mod_params = &iwlagn_mod_params,
        .valid_tx_ant = ANT_BC,
        .valid_rx_ant = ANT_BC,
        .pll_cfg_val = 0,
@@ -393,6 +479,8 @@ struct iwl_cfg iwl6000i_2agn_cfg = {
        .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
        .chain_noise_scale = 1000,
        .monitor_recover_period = IWL_MONITORING_PERIOD,
+       .max_event_log_size = 1024,
+       .ucode_tracing = true,
 };
 
 struct iwl_cfg iwl6000i_2abg_cfg = {
@@ -404,10 +492,10 @@ struct iwl_cfg iwl6000i_2abg_cfg = {
        .ops = &iwl6000_ops,
        .eeprom_size = OTP_LOW_IMAGE_SIZE,
        .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
-       .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
+       .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
        .num_of_queues = IWLAGN_NUM_QUEUES,
        .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
-       .mod_params = &iwl50_mod_params,
+       .mod_params = &iwlagn_mod_params,
        .valid_tx_ant = ANT_BC,
        .valid_rx_ant = ANT_BC,
        .pll_cfg_val = 0,
@@ -416,7 +504,6 @@ struct iwl_cfg iwl6000i_2abg_cfg = {
        .pa_type = IWL_PA_INTERNAL,
        .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
        .shadow_ram_support = true,
-       .ht_greenfield_support = true,
        .led_compensation = 51,
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .supports_idle = true,
@@ -425,6 +512,8 @@ struct iwl_cfg iwl6000i_2abg_cfg = {
        .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
        .chain_noise_scale = 1000,
        .monitor_recover_period = IWL_MONITORING_PERIOD,
+       .max_event_log_size = 1024,
+       .ucode_tracing = true,
 };
 
 struct iwl_cfg iwl6000i_2bg_cfg = {
@@ -436,10 +525,10 @@ struct iwl_cfg iwl6000i_2bg_cfg = {
        .ops = &iwl6000_ops,
        .eeprom_size = OTP_LOW_IMAGE_SIZE,
        .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
-       .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
+       .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
        .num_of_queues = IWLAGN_NUM_QUEUES,
        .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
-       .mod_params = &iwl50_mod_params,
+       .mod_params = &iwlagn_mod_params,
        .valid_tx_ant = ANT_BC,
        .valid_rx_ant = ANT_BC,
        .pll_cfg_val = 0,
@@ -448,7 +537,6 @@ struct iwl_cfg iwl6000i_2bg_cfg = {
        .pa_type = IWL_PA_INTERNAL,
        .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
        .shadow_ram_support = true,
-       .ht_greenfield_support = true,
        .led_compensation = 51,
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .supports_idle = true,
@@ -457,6 +545,8 @@ struct iwl_cfg iwl6000i_2bg_cfg = {
        .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
        .chain_noise_scale = 1000,
        .monitor_recover_period = IWL_MONITORING_PERIOD,
+       .max_event_log_size = 1024,
+       .ucode_tracing = true,
 };
 
 struct iwl_cfg iwl6050_2agn_cfg = {
@@ -468,10 +558,10 @@ struct iwl_cfg iwl6050_2agn_cfg = {
        .ops = &iwl6050_ops,
        .eeprom_size = OTP_LOW_IMAGE_SIZE,
        .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
-       .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
+       .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION,
        .num_of_queues = IWLAGN_NUM_QUEUES,
        .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
-       .mod_params = &iwl50_mod_params,
+       .mod_params = &iwlagn_mod_params,
        .valid_tx_ant = ANT_AB,
        .valid_rx_ant = ANT_AB,
        .pll_cfg_val = 0,
@@ -490,6 +580,8 @@ struct iwl_cfg iwl6050_2agn_cfg = {
        .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
        .chain_noise_scale = 1500,
        .monitor_recover_period = IWL_MONITORING_PERIOD,
+       .max_event_log_size = 1024,
+       .ucode_tracing = true,
 };
 
 struct iwl_cfg iwl6050_2abg_cfg = {
@@ -501,10 +593,10 @@ struct iwl_cfg iwl6050_2abg_cfg = {
        .ops = &iwl6050_ops,
        .eeprom_size = OTP_LOW_IMAGE_SIZE,
        .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
-       .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
+       .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION,
        .num_of_queues = IWLAGN_NUM_QUEUES,
        .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
-       .mod_params = &iwl50_mod_params,
+       .mod_params = &iwlagn_mod_params,
        .valid_tx_ant = ANT_AB,
        .valid_rx_ant = ANT_AB,
        .pll_cfg_val = 0,
@@ -513,7 +605,6 @@ struct iwl_cfg iwl6050_2abg_cfg = {
        .pa_type = IWL_PA_SYSTEM,
        .max_ll_items = OTP_MAX_LL_ITEMS_6x50,
        .shadow_ram_support = true,
-       .ht_greenfield_support = true,
        .led_compensation = 51,
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .supports_idle = true,
@@ -522,6 +613,8 @@ struct iwl_cfg iwl6050_2abg_cfg = {
        .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
        .chain_noise_scale = 1500,
        .monitor_recover_period = IWL_MONITORING_PERIOD,
+       .max_event_log_size = 1024,
+       .ucode_tracing = true,
 };
 
 struct iwl_cfg iwl6000_3agn_cfg = {
@@ -533,10 +626,10 @@ struct iwl_cfg iwl6000_3agn_cfg = {
        .ops = &iwl6000_ops,
        .eeprom_size = OTP_LOW_IMAGE_SIZE,
        .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
-       .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
+       .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
        .num_of_queues = IWLAGN_NUM_QUEUES,
        .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
-       .mod_params = &iwl50_mod_params,
+       .mod_params = &iwlagn_mod_params,
        .valid_tx_ant = ANT_ABC,
        .valid_rx_ant = ANT_ABC,
        .pll_cfg_val = 0,
@@ -555,7 +648,10 @@ struct iwl_cfg iwl6000_3agn_cfg = {
        .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
        .chain_noise_scale = 1000,
        .monitor_recover_period = IWL_MONITORING_PERIOD,
+       .max_event_log_size = 1024,
+       .ucode_tracing = true,
 };
 
 MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
 MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX));
+MODULE_FIRMWARE(IWL6000G2A_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX));
This page took 0.035383 seconds and 5 git commands to generate.