iwlwifi: simplify parameter setting to allow support for 6000 series
authorJay Sternberg <jay.e.sternberg@linux.intel.com>
Tue, 3 Feb 2009 00:21:14 +0000 (16:21 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 9 Feb 2009 20:03:42 +0000 (15:03 -0500)
by parametrizing the set hw function, in addition to allowing for
supporting the 6000 family significantly simplify the addition of new
hardware.

Signed-off-by: Jay Sternberg <jay.e.sternberg@linux.intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-100.c
drivers/net/wireless/iwlwifi/iwl-5000.c
drivers/net/wireless/iwlwifi/iwl-6000.c
drivers/net/wireless/iwlwifi/iwl-core.h

index dbadaf44f5700293af330b74d2d3e1b125eaa073..4c4d16537e3d2c7f641174b108b1e74cf79729cb 100644 (file)
@@ -66,5 +66,7 @@ struct iwl_cfg iwl100_bgn_cfg = {
        .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
        .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_A,
+       .valid_rx_ant = ANT_AB,
 };
 
index c5e9a66e2f88830cb9294aeb633f563dafc29b81..539fc0e234f790d397bfa45af621ff267c72796b 100644 (file)
@@ -43,6 +43,7 @@
 #include "iwl-sta.h"
 #include "iwl-helpers.h"
 #include "iwl-5000-hw.h"
+#include "iwl-6000-hw.h"
 
 /* Highest firmware API version supported */
 #define IWL5000_UCODE_API_MAX 1
@@ -840,8 +841,18 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
        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 = IWL50_RTC_DATA_SIZE;
-       priv->hw_params.max_inst_size = IWL50_RTC_INST_SIZE;
+
+       switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
+       case CSR_HW_REV_TYPE_6x00:
+       case CSR_HW_REV_TYPE_6x50:
+               priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE;
+               priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE;
+               break;
+       default:
+               priv->hw_params.max_data_size = IWL50_RTC_DATA_SIZE;
+               priv->hw_params.max_inst_size = IWL50_RTC_INST_SIZE;
+       }
+
        priv->hw_params.max_bsm_size = 0;
        priv->hw_params.fat_channel =  BIT(IEEE80211_BAND_2GHZ) |
                                        BIT(IEEE80211_BAND_5GHZ);
@@ -849,61 +860,40 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
 
        priv->hw_params.sens = &iwl5000_sensitivity;
 
-       switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
-       case CSR_HW_REV_TYPE_5100:
-               priv->hw_params.tx_chains_num = 1;
-               priv->hw_params.rx_chains_num = 2;
-               priv->hw_params.valid_tx_ant = ANT_B;
-               priv->hw_params.valid_rx_ant = ANT_AB;
-               break;
-       case CSR_HW_REV_TYPE_5150:
-               priv->hw_params.tx_chains_num = 1;
-               priv->hw_params.rx_chains_num = 2;
-               priv->hw_params.valid_tx_ant = ANT_A;
-               priv->hw_params.valid_rx_ant = ANT_AB;
-               break;
-       case CSR_HW_REV_TYPE_5300:
-       case CSR_HW_REV_TYPE_5350:
-               priv->hw_params.tx_chains_num = 3;
-               priv->hw_params.rx_chains_num = 3;
-               priv->hw_params.valid_tx_ant = ANT_ABC;
-               priv->hw_params.valid_rx_ant = ANT_ABC;
-               break;
-       }
+       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;
 
        switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
-       case CSR_HW_REV_TYPE_5100:
-       case CSR_HW_REV_TYPE_5300:
-       case CSR_HW_REV_TYPE_5350:
-               /* 5X00 and 5350 wants in Celsius */
-               priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD;
-               break;
        case CSR_HW_REV_TYPE_5150:
                /* 5150 wants in Kelvin */
                priv->hw_params.ct_kill_threshold =
                                iwl5150_get_ct_threshold(priv);
                break;
+       default:
+               /* all others want Celsius */
+               priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD;
+               break;
        }
 
        /* Set initial calibration set */
        switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
-       case CSR_HW_REV_TYPE_5100:
-       case CSR_HW_REV_TYPE_5300:
-       case CSR_HW_REV_TYPE_5350:
+       case CSR_HW_REV_TYPE_5150:
                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_TX_IQ_PERD)       |
                        BIT(IWL_CALIB_BASE_BAND);
+
                break;
-       case CSR_HW_REV_TYPE_5150:
+       default:
                priv->hw_params.calib_init_cfg =
-                       BIT(IWL_CALIB_DC)               |
+                       BIT(IWL_CALIB_XTAL)             |
                        BIT(IWL_CALIB_LO)               |
                        BIT(IWL_CALIB_TX_IQ)            |
+                       BIT(IWL_CALIB_TX_IQ_PERD)       |
                        BIT(IWL_CALIB_BASE_BAND);
-
                break;
        }
 
@@ -1556,6 +1546,8 @@ struct iwl_cfg iwl5300_agn_cfg = {
        .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
        .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_ABC,
+       .valid_rx_ant = ANT_ABC,
 };
 
 struct iwl_cfg iwl5100_bg_cfg = {
@@ -1569,6 +1561,8 @@ struct iwl_cfg iwl5100_bg_cfg = {
        .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
        .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_B,
+       .valid_rx_ant = ANT_AB,
 };
 
 struct iwl_cfg iwl5100_abg_cfg = {
@@ -1582,6 +1576,8 @@ struct iwl_cfg iwl5100_abg_cfg = {
        .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
        .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_B,
+       .valid_rx_ant = ANT_AB,
 };
 
 struct iwl_cfg iwl5100_agn_cfg = {
@@ -1595,6 +1591,8 @@ struct iwl_cfg iwl5100_agn_cfg = {
        .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
        .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_B,
+       .valid_rx_ant = ANT_AB,
 };
 
 struct iwl_cfg iwl5350_agn_cfg = {
@@ -1608,6 +1606,8 @@ struct iwl_cfg iwl5350_agn_cfg = {
        .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
        .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_ABC,
+       .valid_rx_ant = ANT_ABC,
 };
 
 struct iwl_cfg iwl5150_agn_cfg = {
@@ -1621,6 +1621,8 @@ struct iwl_cfg iwl5150_agn_cfg = {
        .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
        .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_A,
+       .valid_rx_ant = ANT_AB,
 };
 
 MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));
index 4515a6053dd0fa246b97f947c234cf28b05aee2d..b78d67633c279b29c4b83699f4601d05793b940b 100644 (file)
@@ -72,6 +72,8 @@ struct iwl_cfg iwl6000_2ag_cfg = {
        .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
        .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_BC,
+       .valid_rx_ant = ANT_BC,
 };
 
 struct iwl_cfg iwl6000_2agn_cfg = {
@@ -85,6 +87,8 @@ struct iwl_cfg iwl6000_2agn_cfg = {
        .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
        .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_BC,
+       .valid_rx_ant = ANT_BC,
 };
 
 struct iwl_cfg iwl6050_2agn_cfg = {
@@ -98,6 +102,8 @@ struct iwl_cfg iwl6050_2agn_cfg = {
        .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
        .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_BC,
+       .valid_rx_ant = ANT_BC,
 };
 
 struct iwl_cfg iwl6000_3agn_cfg = {
@@ -111,6 +117,8 @@ struct iwl_cfg iwl6000_3agn_cfg = {
        .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
        .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_ABC,
+       .valid_rx_ant = ANT_ABC,
 };
 
 struct iwl_cfg iwl6050_3agn_cfg = {
@@ -124,6 +132,8 @@ struct iwl_cfg iwl6050_3agn_cfg = {
        .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
        .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_ABC,
+       .valid_rx_ant = ANT_ABC,
 };
 
 MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
index 0a719aeb7349d7063fc01f112ca50b94434c5167..02e92be75568fed3447c24ffbfcabaab4eb48535 100644 (file)
@@ -211,6 +211,8 @@ struct iwl_cfg {
        u16  eeprom_calib_ver;
        const struct iwl_ops *ops;
        const struct iwl_mod_params *mod_params;
+       u8   valid_tx_ant;
+       u8   valid_rx_ant;
 };
 
 /***************************