aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2010-07-13 20:13:15 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2010-07-23 11:41:46 -0400
commit6a822d060c439bb700f2369767105f49135b94f8 (patch)
treec2b23a92c351bdeba9f9c58e382cc0c04137871f /drivers/net/wireless
parentffb7d896b3bc21e09d77fed45b52b2ff4ce213e5 (diff)
iwlwifi: add TLV to specify the size of phy calibration table
Different devices have different size of phy calibration table; add new TLV to specify the size. If the TLV is not part of uCode header, the default table size will be used to make sure the backward compatibilities. Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c24
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h9
4 files changed, 37 insertions, 4 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
index f06d1feedf81..a7216dda9786 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
@@ -164,7 +164,7 @@ static void iwlagn_gain_computation(struct iwl_priv *priv,
164 164
165 memset(&cmd, 0, sizeof(cmd)); 165 memset(&cmd, 0, sizeof(cmd));
166 166
167 cmd.hdr.op_code = IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD; 167 cmd.hdr.op_code = priv->_agn.phy_calib_chain_noise_gain_cmd;
168 cmd.hdr.first_group = 0; 168 cmd.hdr.first_group = 0;
169 cmd.hdr.groups_num = 1; 169 cmd.hdr.groups_num = 1;
170 cmd.hdr.data_valid = 1; 170 cmd.hdr.data_valid = 1;
@@ -197,7 +197,7 @@ static void iwlagn_chain_noise_reset(struct iwl_priv *priv)
197 data->beacon_count = 0; 197 data->beacon_count = 0;
198 198
199 memset(&cmd, 0, sizeof(cmd)); 199 memset(&cmd, 0, sizeof(cmd));
200 cmd.hdr.op_code = IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD; 200 cmd.hdr.op_code = priv->_agn.phy_calib_chain_noise_reset_cmd;
201 cmd.hdr.first_group = 0; 201 cmd.hdr.first_group = 0;
202 cmd.hdr.groups_num = 1; 202 cmd.hdr.groups_num = 1;
203 cmd.hdr.data_valid = 1; 203 cmd.hdr.data_valid = 1;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 33a8f13ffe0a..db86f70d1a3f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1692,6 +1692,7 @@ static void iwl_nic_start(struct iwl_priv *priv)
1692 1692
1693struct iwlagn_ucode_capabilities { 1693struct iwlagn_ucode_capabilities {
1694 u32 max_probe_length; 1694 u32 max_probe_length;
1695 u32 standard_phy_calibration_size;
1695}; 1696};
1696 1697
1697static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context); 1698static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context);
@@ -1967,6 +1968,13 @@ static int iwlagn_load_firmware(struct iwl_priv *priv,
1967 else 1968 else
1968 priv->enhance_sensitivity_table = true; 1969 priv->enhance_sensitivity_table = true;
1969 break; 1970 break;
1971 case IWL_UCODE_TLV_PHY_CALIBRATION_SIZE:
1972 if (tlv_len != fixed_tlv_size)
1973 ret = -EINVAL;
1974 else
1975 capa->standard_phy_calibration_size =
1976 le32_to_cpup((__le32 *)tlv_data);
1977 break;
1970 default: 1978 default:
1971 IWL_WARN(priv, "unknown TLV: %d\n", tlv_type); 1979 IWL_WARN(priv, "unknown TLV: %d\n", tlv_type);
1972 break; 1980 break;
@@ -2005,6 +2013,8 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
2005 u32 build; 2013 u32 build;
2006 struct iwlagn_ucode_capabilities ucode_capa = { 2014 struct iwlagn_ucode_capabilities ucode_capa = {
2007 .max_probe_length = 200, 2015 .max_probe_length = 200,
2016 .standard_phy_calibration_size =
2017 IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE,
2008 }; 2018 };
2009 2019
2010 memset(&pieces, 0, sizeof(pieces)); 2020 memset(&pieces, 0, sizeof(pieces));
@@ -2226,6 +2236,20 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
2226 pieces.boot_size); 2236 pieces.boot_size);
2227 memcpy(priv->ucode_boot.v_addr, pieces.boot, pieces.boot_size); 2237 memcpy(priv->ucode_boot.v_addr, pieces.boot, pieces.boot_size);
2228 2238
2239 /*
2240 * figure out the offset of chain noise reset and gain commands
2241 * base on the size of standard phy calibration commands table size
2242 */
2243 if (ucode_capa.standard_phy_calibration_size >
2244 IWL_MAX_PHY_CALIBRATE_TBL_SIZE)
2245 ucode_capa.standard_phy_calibration_size =
2246 IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE;
2247
2248 priv->_agn.phy_calib_chain_noise_reset_cmd =
2249 ucode_capa.standard_phy_calibration_size;
2250 priv->_agn.phy_calib_chain_noise_gain_cmd =
2251 ucode_capa.standard_phy_calibration_size + 1;
2252
2229 /************************************************** 2253 /**************************************************
2230 * This is still part of probe() in a sense... 2254 * This is still part of probe() in a sense...
2231 * 2255 *
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index 04b2e2987f1e..67892f9ef2a5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -3660,10 +3660,10 @@ enum {
3660 IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD = 15, 3660 IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD = 15,
3661 IWL_PHY_CALIBRATE_BASE_BAND_CMD = 16, 3661 IWL_PHY_CALIBRATE_BASE_BAND_CMD = 16,
3662 IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD = 17, 3662 IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD = 17,
3663 IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD = 18, 3663 IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE = 18,
3664 IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD = 19,
3665}; 3664};
3666 3665
3666#define IWL_MAX_PHY_CALIBRATE_TBL_SIZE (253)
3667 3667
3668#define IWL_CALIB_INIT_CFG_ALL cpu_to_le32(0xffffffff) 3668#define IWL_CALIB_INIT_CFG_ALL cpu_to_le32(0xffffffff)
3669 3669
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 297f8d1f5cb5..4fa8cdd8f96c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -571,6 +571,7 @@ enum iwl_ucode_tlv_type {
571 IWL_UCODE_TLV_INIT_EVTLOG_SIZE = 12, 571 IWL_UCODE_TLV_INIT_EVTLOG_SIZE = 12,
572 IWL_UCODE_TLV_INIT_ERRLOG_PTR = 13, 572 IWL_UCODE_TLV_INIT_ERRLOG_PTR = 13,
573 IWL_UCODE_TLV_ENHANCE_SENS_TBL = 14, 573 IWL_UCODE_TLV_ENHANCE_SENS_TBL = 14,
574 IWL_UCODE_TLV_PHY_CALIBRATION_SIZE = 15,
574}; 575};
575 576
576struct iwl_ucode_tlv { 577struct iwl_ucode_tlv {
@@ -1321,6 +1322,14 @@ struct iwl_priv {
1321 u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr; 1322 u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr;
1322 u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr; 1323 u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr;
1323 1324
1325 /*
1326 * chain noise reset and gain commands are the
1327 * two extra calibration commands follows the standard
1328 * phy calibration commands
1329 */
1330 u8 phy_calib_chain_noise_reset_cmd;
1331 u8 phy_calib_chain_noise_gain_cmd;
1332
1324 struct iwl_notif_statistics statistics; 1333 struct iwl_notif_statistics statistics;
1325 struct iwl_bt_notif_statistics statistics_bt; 1334 struct iwl_bt_notif_statistics statistics_bt;
1326#ifdef CONFIG_IWLWIFI_DEBUGFS 1335#ifdef CONFIG_IWLWIFI_DEBUGFS