Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
[cascardo/linux.git] / drivers / net / wireless / iwlwifi / iwl-5000.c
index 7cb4d69..cf2fb47 100644 (file)
 #include "iwl-dev.h"
 #include "iwl-core.h"
 #include "iwl-io.h"
-#include "iwl-sta.h"
-#include "iwl-helpers.h"
 #include "iwl-agn.h"
 #include "iwl-agn-hw.h"
-#include "iwl-5000-hw.h"
 #include "iwl-trans.h"
 #include "iwl-shared.h"
-#include "iwl-pci.h"
+#include "iwl-cfg.h"
 
 /* Highest firmware API version supported */
 #define IWL5000_UCODE_API_MAX 5
@@ -135,6 +132,21 @@ static struct iwl_sensitivity_ranges iwl5150_sensitivity = {
        .nrg_th_cca = 62,
 };
 
+#define IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF  (-5)
+
+static s32 iwl_temp_calib_to_offset(struct iwl_priv *priv)
+{
+       u16 temperature, voltage;
+       __le16 *temp_calib = (__le16 *)iwl_eeprom_query_addr(priv,
+                               EEPROM_KELVIN_TEMPERATURE);
+
+       temperature = le16_to_cpu(temp_calib[0]);
+       voltage = le16_to_cpu(temp_calib[1]);
+
+       /* offset = temp - volt / coeff */
+       return (s32)(temperature - voltage / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF);
+}
+
 static void iwl5150_set_ct_threshold(struct iwl_priv *priv)
 {
        const s32 volt2temp_coef = IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF;
@@ -158,7 +170,6 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
                        iwlagn_mod_params.num_of_queues;
 
        hw_params(priv).max_txq_num = priv->cfg->base_params->num_of_queues;
-       hw_params(priv).max_stations = IWLAGN_STATION_COUNT;
        priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
 
        hw_params(priv).max_data_size = IWLAGN_RTC_DATA_SIZE;
@@ -175,16 +186,7 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
        iwl5000_set_ct_threshold(priv);
 
        /* Set initial sensitivity parameters */
-       /* Set initial calibration set */
        hw_params(priv).sens = &iwl5000_sensitivity;
-       hw_params(priv).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);
-
-       hw_params(priv).beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
 
        return 0;
 }
@@ -197,7 +199,6 @@ static int iwl5150_hw_set_hw_params(struct iwl_priv *priv)
                        iwlagn_mod_params.num_of_queues;
 
        hw_params(priv).max_txq_num = priv->cfg->base_params->num_of_queues;
-       hw_params(priv).max_stations = IWLAGN_STATION_COUNT;
        priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
 
        hw_params(priv).max_data_size = IWLAGN_RTC_DATA_SIZE;
@@ -214,16 +215,7 @@ static int iwl5150_hw_set_hw_params(struct iwl_priv *priv)
        iwl5150_set_ct_threshold(priv);
 
        /* Set initial sensitivity parameters */
-       /* Set initial calibration set */
        hw_params(priv).sens = &iwl5150_sensitivity;
-       hw_params(priv).calib_init_cfg =
-               BIT(IWL_CALIB_LO)               |
-               BIT(IWL_CALIB_TX_IQ)            |
-               BIT(IWL_CALIB_BASE_BAND);
-       if (priv->cfg->need_dc_calib)
-               hw_params(priv).calib_init_cfg |= BIT(IWL_CALIB_DC);
-
-       hw_params(priv).beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
 
        return 0;
 }
@@ -245,7 +237,7 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
 {
        /*
         * MULTI-FIXME
-        * See iwl_mac_channel_switch.
+        * See iwlagn_mac_channel_switch.
         */
        struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
        struct iwl5000_channel_switch_cmd cmd;
@@ -353,12 +345,12 @@ static struct iwl_base_params iwl5000_base_params = {
        .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
        .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
        .led_compensation = 51,
-       .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
        .chain_noise_scale = 1000,
        .wd_timeout = IWL_LONG_WD_TIMEOUT,
        .max_event_log_size = 512,
        .no_idle_support = true,
+       .wd_disable = true,
 };
 static struct iwl_ht_params iwl5000_ht_params = {
        .ht_greenfield_support = true,
@@ -428,7 +420,7 @@ struct iwl_cfg iwl5350_agn_cfg = {
        .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,       \
        .lib = &iwl5150_lib,                                    \
        .base_params = &iwl5000_base_params,                    \
-       .need_dc_calib = true,                                  \
+       .no_xtal_calib = true,                                  \
        .led_mode = IWL_LED_BLINK,                              \
        .internal_wimax_coex = true