aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-6000.c
diff options
context:
space:
mode:
authorShanyu Zhao <shanyu.zhao@intel.com>2010-09-14 19:23:32 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2010-09-28 19:55:25 -0400
commit6b5ce501428942d9dec864a41ee223307f421574 (patch)
treef580aedb17b6df2710523da1778a5dd2a33f08b3 /drivers/net/wireless/iwlwifi/iwl-6000.c
parent1de19eccb3fe634e939cb40f30fdfda93a67fe93 (diff)
iwlwifi: add iwl_nic_ops structure to iwl_ops
iwlwifi driver supports multiple devices. Since some device needs special configuration we create a new iwl_nic_ops structure which is configurable per device. Currently there is only one function pointer inside this structure: additional_nic_config(). The iwl_nic_ops structure is added to the top level in struct iwl_ops, making it easier to change per device. Duplication of the iwl_lib_ops structure is no longer needed. With this new ops the previous function pointer set_calib_version is no longer needed since it is just a per device nic configuration. As part of the code restructuring, a bug is addressed. Indication of calib version to uCode is only needed for 6050 devices, however, current implementation set calib version for all 6000 devices for which DC calib is needed. To fix this, create iwl6050_ops for 6050 devices and only populate iwl_nic_ops in this structure. Signed-off-by: Shanyu Zhao <shanyu.zhao@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-6000.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 9f43f2770c96..8256034285a6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -83,11 +83,10 @@ static void iwl6000_set_ct_threshold(struct iwl_priv *priv)
83 priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD; 83 priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
84} 84}
85 85
86/* Indicate calibration version to uCode. */ 86static void iwl6050_additional_nic_config(struct iwl_priv *priv)
87static void iwl6000_set_calib_version(struct iwl_priv *priv)
88{ 87{
89 if (priv->cfg->need_dc_calib && 88 /* Indicate calibration version to uCode. */
90 (priv->cfg->ops->lib->eeprom_ops.calib_version(priv) >= 6)) 89 if (priv->cfg->ops->lib->eeprom_ops.calib_version(priv) >= 6)
91 iwl_set_bit(priv, CSR_GP_DRIVER_REG, 90 iwl_set_bit(priv, CSR_GP_DRIVER_REG,
92 CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); 91 CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
93} 92}
@@ -117,9 +116,11 @@ static void iwl6000_nic_config(struct iwl_priv *priv)
117 iwl_write32(priv, CSR_GP_DRIVER_REG, 116 iwl_write32(priv, CSR_GP_DRIVER_REG,
118 CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_IPA); 117 CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_IPA);
119 } 118 }
120 /* else do nothing, uCode configured */ 119 /* do additional nic configuration if needed */
121 if (priv->cfg->ops->lib->temp_ops.set_calib_version) 120 if (priv->cfg->ops->nic &&
122 priv->cfg->ops->lib->temp_ops.set_calib_version(priv); 121 priv->cfg->ops->nic->additional_nic_config) {
122 priv->cfg->ops->nic->additional_nic_config(priv);
123 }
123} 124}
124 125
125static struct iwl_sensitivity_ranges iwl6000_sensitivity = { 126static struct iwl_sensitivity_ranges iwl6000_sensitivity = {
@@ -320,7 +321,6 @@ static struct iwl_lib_ops iwl6000_lib = {
320 .temp_ops = { 321 .temp_ops = {
321 .temperature = iwlagn_temperature, 322 .temperature = iwlagn_temperature,
322 .set_ct_kill = iwl6000_set_ct_threshold, 323 .set_ct_kill = iwl6000_set_ct_threshold,
323 .set_calib_version = iwl6000_set_calib_version,
324 }, 324 },
325 .manage_ibss_station = iwlagn_manage_ibss_station, 325 .manage_ibss_station = iwlagn_manage_ibss_station,
326 .update_bcast_stations = iwl_update_bcast_stations, 326 .update_bcast_stations = iwl_update_bcast_stations,
@@ -396,7 +396,6 @@ static struct iwl_lib_ops iwl6000g2b_lib = {
396 .temp_ops = { 396 .temp_ops = {
397 .temperature = iwlagn_temperature, 397 .temperature = iwlagn_temperature,
398 .set_ct_kill = iwl6000_set_ct_threshold, 398 .set_ct_kill = iwl6000_set_ct_threshold,
399 .set_calib_version = iwl6000_set_calib_version,
400 }, 399 },
401 .manage_ibss_station = iwlagn_manage_ibss_station, 400 .manage_ibss_station = iwlagn_manage_ibss_station,
402 .update_bcast_stations = iwl_update_bcast_stations, 401 .update_bcast_stations = iwl_update_bcast_stations,
@@ -419,6 +418,10 @@ static struct iwl_lib_ops iwl6000g2b_lib = {
419 } 418 }
420}; 419};
421 420
421static struct iwl_nic_ops iwl6050_nic_ops = {
422 .additional_nic_config = &iwl6050_additional_nic_config,
423};
424
422static const struct iwl_ops iwl6000_ops = { 425static const struct iwl_ops iwl6000_ops = {
423 .lib = &iwl6000_lib, 426 .lib = &iwl6000_lib,
424 .hcmd = &iwlagn_hcmd, 427 .hcmd = &iwlagn_hcmd,
@@ -426,6 +429,14 @@ static const struct iwl_ops iwl6000_ops = {
426 .led = &iwlagn_led_ops, 429 .led = &iwlagn_led_ops,
427}; 430};
428 431
432static const struct iwl_ops iwl6050_ops = {
433 .lib = &iwl6000_lib,
434 .hcmd = &iwlagn_hcmd,
435 .utils = &iwlagn_hcmd_utils,
436 .led = &iwlagn_led_ops,
437 .nic = &iwl6050_nic_ops,
438};
439
429static const struct iwl_ops iwl6000g2b_ops = { 440static const struct iwl_ops iwl6000g2b_ops = {
430 .lib = &iwl6000g2b_lib, 441 .lib = &iwl6000g2b_lib,
431 .hcmd = &iwlagn_bt_hcmd, 442 .hcmd = &iwlagn_bt_hcmd,
@@ -909,7 +920,7 @@ struct iwl_cfg iwl6050_2agn_cfg = {
909 .ucode_api_max = IWL6050_UCODE_API_MAX, 920 .ucode_api_max = IWL6050_UCODE_API_MAX,
910 .ucode_api_min = IWL6050_UCODE_API_MIN, 921 .ucode_api_min = IWL6050_UCODE_API_MIN,
911 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, 922 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
912 .ops = &iwl6000_ops, 923 .ops = &iwl6050_ops,
913 .eeprom_size = OTP_LOW_IMAGE_SIZE, 924 .eeprom_size = OTP_LOW_IMAGE_SIZE,
914 .eeprom_ver = EEPROM_6050_EEPROM_VERSION, 925 .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
915 .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION, 926 .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION,
@@ -947,7 +958,7 @@ struct iwl_cfg iwl6050g2_bgn_cfg = {
947 .ucode_api_max = IWL6050_UCODE_API_MAX, 958 .ucode_api_max = IWL6050_UCODE_API_MAX,
948 .ucode_api_min = IWL6050_UCODE_API_MIN, 959 .ucode_api_min = IWL6050_UCODE_API_MIN,
949 .sku = IWL_SKU_G|IWL_SKU_N, 960 .sku = IWL_SKU_G|IWL_SKU_N,
950 .ops = &iwl6000_ops, 961 .ops = &iwl6050_ops,
951 .eeprom_size = OTP_LOW_IMAGE_SIZE, 962 .eeprom_size = OTP_LOW_IMAGE_SIZE,
952 .eeprom_ver = EEPROM_6050G2_EEPROM_VERSION, 963 .eeprom_ver = EEPROM_6050G2_EEPROM_VERSION,
953 .eeprom_calib_ver = EEPROM_6050G2_TX_POWER_VERSION, 964 .eeprom_calib_ver = EEPROM_6050G2_TX_POWER_VERSION,
@@ -985,7 +996,7 @@ struct iwl_cfg iwl6050_2abg_cfg = {
985 .ucode_api_max = IWL6050_UCODE_API_MAX, 996 .ucode_api_max = IWL6050_UCODE_API_MAX,
986 .ucode_api_min = IWL6050_UCODE_API_MIN, 997 .ucode_api_min = IWL6050_UCODE_API_MIN,
987 .sku = IWL_SKU_A|IWL_SKU_G, 998 .sku = IWL_SKU_A|IWL_SKU_G,
988 .ops = &iwl6000_ops, 999 .ops = &iwl6050_ops,
989 .eeprom_size = OTP_LOW_IMAGE_SIZE, 1000 .eeprom_size = OTP_LOW_IMAGE_SIZE,
990 .eeprom_ver = EEPROM_6050_EEPROM_VERSION, 1001 .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
991 .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION, 1002 .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION,