aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2011-06-14 18:23:39 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2011-06-18 11:23:56 -0400
commit86cb3b4e08a106594ee79c94dec9c7ca289cf999 (patch)
tree6c83c6367f30bbc65a9ee734cf553c69907d68d4 /drivers/net/wireless/iwlwifi
parent916b337310969dd5eef35be0988a6bf768c138f9 (diff)
iwlagn: merge duplicate code into single function
Same operation needed by multiple devices, move to single function. Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-2000.c16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c17
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.c25
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.h1
5 files changed, 30 insertions, 45 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c
index 56a22de847da..1c1330035ca9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-2000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-2000.c
@@ -74,21 +74,7 @@ static void iwl2000_set_ct_threshold(struct iwl_priv *priv)
74/* NIC configuration for 2000 series */ 74/* NIC configuration for 2000 series */
75static void iwl2000_nic_config(struct iwl_priv *priv) 75static void iwl2000_nic_config(struct iwl_priv *priv)
76{ 76{
77 u16 radio_cfg; 77 iwl_rf_config(priv);
78
79 radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
80
81 /* write radio config values to register */
82 if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX)
83 iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
84 EEPROM_RF_CFG_TYPE_MSK(radio_cfg) |
85 EEPROM_RF_CFG_STEP_MSK(radio_cfg) |
86 EEPROM_RF_CFG_DASH_MSK(radio_cfg));
87
88 /* set CSR_HW_CONFIG_REG for uCode use */
89 iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
90 CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
91 CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
92 78
93 if (priv->cfg->iq_invert) 79 if (priv->cfg->iq_invert)
94 iwl_set_bit(priv, CSR_GP_DRIVER_REG, 80 iwl_set_bit(priv, CSR_GP_DRIVER_REG,
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 06fe9aded1ea..937a8f12afa7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -64,23 +64,10 @@
64static void iwl5000_nic_config(struct iwl_priv *priv) 64static void iwl5000_nic_config(struct iwl_priv *priv)
65{ 65{
66 unsigned long flags; 66 unsigned long flags;
67 u16 radio_cfg;
68 67
69 spin_lock_irqsave(&priv->lock, flags); 68 iwl_rf_config(priv);
70
71 radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
72 69
73 /* write radio config values to register */ 70 spin_lock_irqsave(&priv->lock, flags);
74 if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) < EEPROM_RF_CONFIG_TYPE_MAX)
75 iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
76 EEPROM_RF_CFG_TYPE_MSK(radio_cfg) |
77 EEPROM_RF_CFG_STEP_MSK(radio_cfg) |
78 EEPROM_RF_CFG_DASH_MSK(radio_cfg));
79
80 /* set CSR_HW_CONFIG_REG for uCode use */
81 iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
82 CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
83 CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
84 71
85 /* W/A : NIC is stuck in a reset state after Early PCIe power off 72 /* W/A : NIC is stuck in a reset state after Early PCIe power off
86 * (PCIe power is lost before PERST# is asserted), 73 * (PCIe power is lost before PERST# is asserted),
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index c66bbc6c004d..3fcc0925d542 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -95,21 +95,7 @@ static void iwl6150_additional_nic_config(struct iwl_priv *priv)
95/* NIC configuration for 6000 series */ 95/* NIC configuration for 6000 series */
96static void iwl6000_nic_config(struct iwl_priv *priv) 96static void iwl6000_nic_config(struct iwl_priv *priv)
97{ 97{
98 u16 radio_cfg; 98 iwl_rf_config(priv);
99
100 radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
101
102 /* write radio config values to register */
103 if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX)
104 iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
105 EEPROM_RF_CFG_TYPE_MSK(radio_cfg) |
106 EEPROM_RF_CFG_STEP_MSK(radio_cfg) |
107 EEPROM_RF_CFG_DASH_MSK(radio_cfg));
108
109 /* set CSR_HW_CONFIG_REG for uCode use */
110 iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
111 CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
112 CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
113 99
114 /* no locking required for register write */ 100 /* no locking required for register write */
115 if (priv->cfg->pa_type == IWL_PA_INTERNAL) { 101 if (priv->cfg->pa_type == IWL_PA_INTERNAL) {
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
index 47a56bc1cd12..768d0ee276f7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
@@ -834,3 +834,28 @@ const struct iwl_channel_info *iwl_get_channel_info(const struct iwl_priv *priv,
834 834
835 return NULL; 835 return NULL;
836} 836}
837
838void iwl_rf_config(struct iwl_priv *priv)
839{
840 u16 radio_cfg;
841
842 radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
843
844 /* write radio config values to register */
845 if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX) {
846 iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
847 EEPROM_RF_CFG_TYPE_MSK(radio_cfg) |
848 EEPROM_RF_CFG_STEP_MSK(radio_cfg) |
849 EEPROM_RF_CFG_DASH_MSK(radio_cfg));
850 IWL_INFO(priv, "Radio type=0x%x-0x%x-0x%x\n",
851 EEPROM_RF_CFG_TYPE_MSK(radio_cfg),
852 EEPROM_RF_CFG_STEP_MSK(radio_cfg),
853 EEPROM_RF_CFG_DASH_MSK(radio_cfg));
854 } else
855 WARN_ON(1);
856
857 /* set CSR_HW_CONFIG_REG for uCode use */
858 iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
859 CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
860 CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
861}
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
index c1a17f9eaf33..c6f370f21ee0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
@@ -310,5 +310,6 @@ void iwl_free_channel_map(struct iwl_priv *priv);
310const struct iwl_channel_info *iwl_get_channel_info( 310const struct iwl_channel_info *iwl_get_channel_info(
311 const struct iwl_priv *priv, 311 const struct iwl_priv *priv,
312 enum ieee80211_band band, u16 channel); 312 enum ieee80211_band band, u16 channel);
313void iwl_rf_config(struct iwl_priv *priv);
313 314
314#endif /* __iwl_eeprom_h__ */ 315#endif /* __iwl_eeprom_h__ */