iwlagn: hw_params moves to iwl_shared
[pandora-kernel.git] / drivers / net / wireless / iwlwifi / iwl-2000.c
index 32ac865..1a36edf 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/delay.h>
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
-#include <linux/wireless.h>
 #include <net/mac80211.h>
 #include <linux/etherdevice.h>
 #include <asm/unaligned.h>
 #include "iwl-helpers.h"
 #include "iwl-agn-hw.h"
 #include "iwl-6000-hw.h"
+#include "iwl-shared.h"
 
 /* Highest firmware API version supported */
-#define IWL2030_UCODE_API_MAX 5
-#define IWL2000_UCODE_API_MAX 5
-#define IWL105_UCODE_API_MAX 5
-#define IWL135_UCODE_API_MAX 5
+#define IWL2030_UCODE_API_MAX 6
+#define IWL2000_UCODE_API_MAX 6
+#define IWL105_UCODE_API_MAX 6
+#define IWL135_UCODE_API_MAX 6
+
+/* Oldest version we won't warn about */
+#define IWL2030_UCODE_API_OK 5
+#define IWL2000_UCODE_API_OK 5
+#define IWL105_UCODE_API_OK 5
+#define IWL135_UCODE_API_OK 5
 
 /* Lowest firmware API version supported */
 #define IWL2030_UCODE_API_MIN 5
@@ -73,8 +79,8 @@
 static void iwl2000_set_ct_threshold(struct iwl_priv *priv)
 {
        /* want Celsius */
-       priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD;
-       priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
+       hw_params(priv).ct_kill_threshold = CT_KILL_THRESHOLD;
+       hw_params(priv).ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
 }
 
 /* NIC configuration for 2000 series */
@@ -85,9 +91,6 @@ static void iwl2000_nic_config(struct iwl_priv *priv)
        if (priv->cfg->iq_invert)
                iwl_set_bit(priv, CSR_GP_DRIVER_REG,
                            CSR_GP_DRIVER_REG_BIT_RADIO_IQ_INVER);
-
-       if (priv->cfg->disable_otp_refresh)
-               iwl_write_prph(priv, APMG_ANALOG_SVR_REG, 0x80000010);
 }
 
 static struct iwl_sensitivity_ranges iwl2000_sensitivity = {
@@ -122,54 +125,50 @@ static int iwl2000_hw_set_hw_params(struct iwl_priv *priv)
                priv->cfg->base_params->num_of_queues =
                        iwlagn_mod_params.num_of_queues;
 
-       priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues;
-       priv->hw_params.scd_bc_tbls_size =
+       hw_params(priv).max_txq_num = priv->cfg->base_params->num_of_queues;
+       hw_params(priv).scd_bc_tbls_size =
                priv->cfg->base_params->num_of_queues *
                sizeof(struct iwlagn_scd_bc_tbl);
-       priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
-       priv->hw_params.max_stations = IWLAGN_STATION_COUNT;
+       hw_params(priv).tfd_size = sizeof(struct iwl_tfd);
+       hw_params(priv).max_stations = IWLAGN_STATION_COUNT;
        priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
 
-       priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE;
-       priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE;
+       hw_params(priv).max_data_size = IWL60_RTC_DATA_SIZE;
+       hw_params(priv).max_inst_size = IWL60_RTC_INST_SIZE;
 
-       priv->hw_params.ht40_channel =  BIT(IEEE80211_BAND_2GHZ) |
-                                       BIT(IEEE80211_BAND_5GHZ);
+       hw_params(priv).ht40_channel =  BIT(IEEE80211_BAND_2GHZ);
 
-       priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
+       hw_params(priv).tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
        if (priv->cfg->rx_with_siso_diversity)
-               priv->hw_params.rx_chains_num = 1;
+               hw_params(priv).rx_chains_num = 1;
        else
-               priv->hw_params.rx_chains_num =
+               hw_params(priv).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;
+       hw_params(priv).valid_tx_ant = priv->cfg->valid_tx_ant;
+       hw_params(priv).valid_rx_ant = priv->cfg->valid_rx_ant;
 
        iwl2000_set_ct_threshold(priv);
 
        /* Set initial sensitivity parameters */
        /* Set initial calibration set */
-       priv->hw_params.sens = &iwl2000_sensitivity;
-       priv->hw_params.calib_init_cfg =
+       hw_params(priv).sens = &iwl2000_sensitivity;
+       hw_params(priv).calib_init_cfg =
                BIT(IWL_CALIB_XTAL)             |
                BIT(IWL_CALIB_LO)               |
                BIT(IWL_CALIB_TX_IQ)            |
                BIT(IWL_CALIB_BASE_BAND);
        if (priv->cfg->need_dc_calib)
-               priv->hw_params.calib_rt_cfg |= BIT(IWL_CALIB_CFG_DC_IDX);
+               hw_params(priv).calib_rt_cfg |= IWL_CALIB_CFG_DC_IDX;
        if (priv->cfg->need_temp_offset_calib)
-               priv->hw_params.calib_init_cfg |= BIT(IWL_CALIB_TEMP_OFFSET);
+               hw_params(priv).calib_init_cfg |= BIT(IWL_CALIB_TEMP_OFFSET);
 
-       priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
+       hw_params(priv).beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
 
        return 0;
 }
 
 static struct iwl_lib_ops iwl2000_lib = {
        .set_hw_params = iwl2000_hw_set_hw_params,
-       .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,
        .nic_config = iwl2000_nic_config,
        .eeprom_ops = {
                .regulatory_bands = {
@@ -181,17 +180,16 @@ static struct iwl_lib_ops iwl2000_lib = {
                        EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
                        EEPROM_REGULATORY_BAND_NO_HT40,
                },
-               .update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower,
+               .update_enhanced_txpower = iwl_eeprom_enhanced_txpower,
        },
        .temperature = iwlagn_temperature,
 };
 
 static struct iwl_lib_ops iwl2030_lib = {
        .set_hw_params = iwl2000_hw_set_hw_params,
-       .rx_handler_setup = iwlagn_bt_rx_handler_setup,
-       .setup_deferred_work = iwlagn_bt_setup_deferred_work,
+       .bt_rx_handler_setup = iwlagn_bt_rx_handler_setup,
+       .bt_setup_deferred_work = iwlagn_bt_setup_deferred_work,
        .cancel_deferred_work = iwlagn_bt_cancel_deferred_work,
-       .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
        .nic_config = iwl2000_nic_config,
        .eeprom_ops = {
                .regulatory_bands = {
@@ -203,27 +201,11 @@ static struct iwl_lib_ops iwl2030_lib = {
                        EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
                        EEPROM_REGULATORY_BAND_NO_HT40,
                },
-               .update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower,
+               .update_enhanced_txpower = iwl_eeprom_enhanced_txpower,
        },
        .temperature = iwlagn_temperature,
 };
 
-static const struct iwl_ops iwl2000_ops = {
-       .lib = &iwl2000_lib,
-};
-
-static const struct iwl_ops iwl2030_ops = {
-       .lib = &iwl2030_lib,
-};
-
-static const struct iwl_ops iwl105_ops = {
-       .lib = &iwl2000_lib,
-};
-
-static const struct iwl_ops iwl135_ops = {
-       .lib = &iwl2030_lib,
-};
-
 static struct iwl_base_params iwl2000_base_params = {
        .eeprom_size = OTP_LOW_IMAGE_SIZE,
        .num_of_queues = IWLAGN_NUM_QUEUES,
@@ -240,6 +222,7 @@ static struct iwl_base_params iwl2000_base_params = {
        .wd_timeout = IWL_DEF_WD_TIMEOUT,
        .max_event_log_size = 512,
        .shadow_reg_enable = true,
+       .hd_v2 = true,
 };
 
 
@@ -259,6 +242,7 @@ static struct iwl_base_params iwl2030_base_params = {
        .wd_timeout = IWL_LONG_WD_TIMEOUT,
        .max_event_log_size = 512,
        .shadow_reg_enable = true,
+       .hd_v2 = true,
 };
 
 static struct iwl_ht_params iwl2000_ht_params = {
@@ -279,16 +263,16 @@ static struct iwl_bt_params iwl2030_bt_params = {
 #define IWL_DEVICE_2000                                                \
        .fw_name_pre = IWL2000_FW_PRE,                          \
        .ucode_api_max = IWL2000_UCODE_API_MAX,                 \
+       .ucode_api_ok = IWL2000_UCODE_API_OK,                   \
        .ucode_api_min = IWL2000_UCODE_API_MIN,                 \
        .eeprom_ver = EEPROM_2000_EEPROM_VERSION,               \
        .eeprom_calib_ver = EEPROM_2000_TX_POWER_VERSION,       \
-       .ops = &iwl2000_ops,                                    \
+       .lib = &iwl2000_lib,                                    \
        .base_params = &iwl2000_base_params,                    \
        .need_dc_calib = true,                                  \
        .need_temp_offset_calib = true,                         \
        .led_mode = IWL_LED_RF_STATE,                           \
-       .iq_invert = true,                                      \
-       .disable_otp_refresh = true                             \
+       .iq_invert = true                                       \
 
 struct iwl_cfg iwl2000_2bgn_cfg = {
        .name = "2000 Series 2x2 BGN",
@@ -304,10 +288,11 @@ struct iwl_cfg iwl2000_2bg_cfg = {
 #define IWL_DEVICE_2030                                                \
        .fw_name_pre = IWL2030_FW_PRE,                          \
        .ucode_api_max = IWL2030_UCODE_API_MAX,                 \
+       .ucode_api_ok = IWL2030_UCODE_API_OK,                   \
        .ucode_api_min = IWL2030_UCODE_API_MIN,                 \
        .eeprom_ver = EEPROM_2000_EEPROM_VERSION,               \
        .eeprom_calib_ver = EEPROM_2000_TX_POWER_VERSION,       \
-       .ops = &iwl2030_ops,                                    \
+       .lib = &iwl2030_lib,                                    \
        .base_params = &iwl2030_base_params,                    \
        .bt_params = &iwl2030_bt_params,                        \
        .need_dc_calib = true,                                  \
@@ -330,16 +315,18 @@ struct iwl_cfg iwl2030_2bg_cfg = {
 #define IWL_DEVICE_105                                         \
        .fw_name_pre = IWL105_FW_PRE,                           \
        .ucode_api_max = IWL105_UCODE_API_MAX,                  \
+       .ucode_api_ok = IWL105_UCODE_API_OK,                    \
        .ucode_api_min = IWL105_UCODE_API_MIN,                  \
        .eeprom_ver = EEPROM_2000_EEPROM_VERSION,               \
        .eeprom_calib_ver = EEPROM_2000_TX_POWER_VERSION,       \
-       .ops = &iwl105_ops,                                     \
+       .lib = &iwl2000_lib,                                    \
        .base_params = &iwl2000_base_params,                    \
        .need_dc_calib = true,                                  \
        .need_temp_offset_calib = true,                         \
        .led_mode = IWL_LED_RF_STATE,                           \
        .adv_pm = true,                                         \
-       .rx_with_siso_diversity = true                          \
+       .rx_with_siso_diversity = true,                         \
+       .iq_invert = true                                       \
 
 struct iwl_cfg iwl105_bg_cfg = {
        .name = "105 Series 1x1 BG",
@@ -355,17 +342,19 @@ struct iwl_cfg iwl105_bgn_cfg = {
 #define IWL_DEVICE_135                                         \
        .fw_name_pre = IWL135_FW_PRE,                           \
        .ucode_api_max = IWL135_UCODE_API_MAX,                  \
+       .ucode_api_ok = IWL135_UCODE_API_OK,                    \
        .ucode_api_min = IWL135_UCODE_API_MIN,                  \
        .eeprom_ver = EEPROM_2000_EEPROM_VERSION,               \
        .eeprom_calib_ver = EEPROM_2000_TX_POWER_VERSION,       \
-       .ops = &iwl135_ops,                                     \
+       .lib = &iwl2030_lib,                                    \
        .base_params = &iwl2030_base_params,                    \
        .bt_params = &iwl2030_bt_params,                        \
        .need_dc_calib = true,                                  \
        .need_temp_offset_calib = true,                         \
        .led_mode = IWL_LED_RF_STATE,                           \
        .adv_pm = true,                                         \
-       .rx_with_siso_diversity = true                          \
+       .rx_with_siso_diversity = true,                         \
+       .iq_invert = true                                       \
 
 struct iwl_cfg iwl135_bg_cfg = {
        .name = "135 Series 1x1 BG/BT",