diff options
author | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2010-04-19 21:49:40 -0400 |
---|---|---|
committer | Reinette Chatre <reinette.chatre@intel.com> | 2010-04-30 18:34:32 -0400 |
commit | e517736ab85fcaa4ceebbb572f3e86838097ad0a (patch) | |
tree | 399971d6ea5e1707bfd64ee17559b8a00f795065 | |
parent | e3a3cd8789e1daf1b5af70d3252cab50cd3824c9 (diff) |
iwlwifi: set hw parameters based on device type
Separate the hw_set_hw_params() function to per device based; different
devices can have different hardware parameters set, when separate the
function based on device type can avoid mistakes, give more flexibilities and
easier to read.
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-5000.c | 73 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-6000.c | 70 |
2 files changed, 103 insertions, 40 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index e43493685271..115d3ea1142f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -200,26 +200,57 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv) | |||
200 | 200 | ||
201 | /* Set initial sensitivity parameters */ | 201 | /* Set initial sensitivity parameters */ |
202 | /* Set initial calibration set */ | 202 | /* Set initial calibration set */ |
203 | switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) { | 203 | priv->hw_params.sens = &iwl5000_sensitivity; |
204 | case CSR_HW_REV_TYPE_5150: | 204 | priv->hw_params.calib_init_cfg = |
205 | priv->hw_params.sens = &iwl5150_sensitivity; | 205 | BIT(IWL_CALIB_XTAL) | |
206 | priv->hw_params.calib_init_cfg = | 206 | BIT(IWL_CALIB_LO) | |
207 | BIT(IWL_CALIB_DC) | | 207 | BIT(IWL_CALIB_TX_IQ) | |
208 | BIT(IWL_CALIB_LO) | | 208 | BIT(IWL_CALIB_TX_IQ_PERD) | |
209 | BIT(IWL_CALIB_TX_IQ) | | 209 | BIT(IWL_CALIB_BASE_BAND); |
210 | BIT(IWL_CALIB_BASE_BAND); | 210 | |
211 | 211 | return 0; | |
212 | break; | 212 | } |
213 | default: | 213 | |
214 | priv->hw_params.sens = &iwl5000_sensitivity; | 214 | static int iwl5150_hw_set_hw_params(struct iwl_priv *priv) |
215 | priv->hw_params.calib_init_cfg = | 215 | { |
216 | BIT(IWL_CALIB_XTAL) | | 216 | if (priv->cfg->mod_params->num_of_queues >= IWL_MIN_NUM_QUEUES && |
217 | BIT(IWL_CALIB_LO) | | 217 | priv->cfg->mod_params->num_of_queues <= IWLAGN_NUM_QUEUES) |
218 | BIT(IWL_CALIB_TX_IQ) | | 218 | priv->cfg->num_of_queues = |
219 | BIT(IWL_CALIB_TX_IQ_PERD) | | 219 | priv->cfg->mod_params->num_of_queues; |
220 | BIT(IWL_CALIB_BASE_BAND); | 220 | |
221 | break; | 221 | priv->hw_params.max_txq_num = priv->cfg->num_of_queues; |
222 | } | 222 | priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM; |
223 | priv->hw_params.scd_bc_tbls_size = | ||
224 | priv->cfg->num_of_queues * | ||
225 | sizeof(struct iwlagn_scd_bc_tbl); | ||
226 | priv->hw_params.tfd_size = sizeof(struct iwl_tfd); | ||
227 | priv->hw_params.max_stations = IWL5000_STATION_COUNT; | ||
228 | priv->hw_params.bcast_sta_id = IWL5000_BROADCAST_ID; | ||
229 | |||
230 | priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE; | ||
231 | priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE; | ||
232 | |||
233 | priv->hw_params.max_bsm_size = 0; | ||
234 | priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) | | ||
235 | BIT(IEEE80211_BAND_5GHZ); | ||
236 | priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR; | ||
237 | |||
238 | priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant); | ||
239 | priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant); | ||
240 | priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant; | ||
241 | priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant; | ||
242 | |||
243 | if (priv->cfg->ops->lib->temp_ops.set_ct_kill) | ||
244 | priv->cfg->ops->lib->temp_ops.set_ct_kill(priv); | ||
245 | |||
246 | /* Set initial sensitivity parameters */ | ||
247 | /* Set initial calibration set */ | ||
248 | priv->hw_params.sens = &iwl5150_sensitivity; | ||
249 | priv->hw_params.calib_init_cfg = | ||
250 | BIT(IWL_CALIB_DC) | | ||
251 | BIT(IWL_CALIB_LO) | | ||
252 | BIT(IWL_CALIB_TX_IQ) | | ||
253 | BIT(IWL_CALIB_BASE_BAND); | ||
223 | 254 | ||
224 | return 0; | 255 | return 0; |
225 | } | 256 | } |
@@ -332,7 +363,7 @@ static struct iwl_lib_ops iwl5000_lib = { | |||
332 | }; | 363 | }; |
333 | 364 | ||
334 | static struct iwl_lib_ops iwl5150_lib = { | 365 | static struct iwl_lib_ops iwl5150_lib = { |
335 | .set_hw_params = iwl5000_hw_set_hw_params, | 366 | .set_hw_params = iwl5150_hw_set_hw_params, |
336 | .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl, | 367 | .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl, |
337 | .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl, | 368 | .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl, |
338 | .txq_set_sched = iwlagn_txq_set_sched, | 369 | .txq_set_sched = iwlagn_txq_set_sched, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index 7da23d3ff7b6..c4926506a084 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
@@ -176,24 +176,56 @@ static int iwl6000_hw_set_hw_params(struct iwl_priv *priv) | |||
176 | /* Set initial sensitivity parameters */ | 176 | /* Set initial sensitivity parameters */ |
177 | /* Set initial calibration set */ | 177 | /* Set initial calibration set */ |
178 | priv->hw_params.sens = &iwl6000_sensitivity; | 178 | priv->hw_params.sens = &iwl6000_sensitivity; |
179 | switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) { | 179 | priv->hw_params.calib_init_cfg = |
180 | case CSR_HW_REV_TYPE_6x50: | 180 | BIT(IWL_CALIB_XTAL) | |
181 | priv->hw_params.calib_init_cfg = | 181 | BIT(IWL_CALIB_LO) | |
182 | BIT(IWL_CALIB_XTAL) | | 182 | BIT(IWL_CALIB_TX_IQ) | |
183 | BIT(IWL_CALIB_DC) | | 183 | BIT(IWL_CALIB_BASE_BAND); |
184 | BIT(IWL_CALIB_LO) | | 184 | |
185 | BIT(IWL_CALIB_TX_IQ) | | 185 | return 0; |
186 | BIT(IWL_CALIB_BASE_BAND); | 186 | } |
187 | 187 | ||
188 | break; | 188 | static int iwl6050_hw_set_hw_params(struct iwl_priv *priv) |
189 | default: | 189 | { |
190 | priv->hw_params.calib_init_cfg = | 190 | if (priv->cfg->mod_params->num_of_queues >= IWL_MIN_NUM_QUEUES && |
191 | BIT(IWL_CALIB_XTAL) | | 191 | priv->cfg->mod_params->num_of_queues <= IWLAGN_NUM_QUEUES) |
192 | BIT(IWL_CALIB_LO) | | 192 | priv->cfg->num_of_queues = |
193 | BIT(IWL_CALIB_TX_IQ) | | 193 | priv->cfg->mod_params->num_of_queues; |
194 | BIT(IWL_CALIB_BASE_BAND); | 194 | |
195 | break; | 195 | priv->hw_params.max_txq_num = priv->cfg->num_of_queues; |
196 | } | 196 | priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM; |
197 | priv->hw_params.scd_bc_tbls_size = | ||
198 | priv->cfg->num_of_queues * | ||
199 | sizeof(struct iwlagn_scd_bc_tbl); | ||
200 | priv->hw_params.tfd_size = sizeof(struct iwl_tfd); | ||
201 | priv->hw_params.max_stations = IWL5000_STATION_COUNT; | ||
202 | priv->hw_params.bcast_sta_id = IWL5000_BROADCAST_ID; | ||
203 | |||
204 | priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE; | ||
205 | priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE; | ||
206 | |||
207 | priv->hw_params.max_bsm_size = 0; | ||
208 | priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) | | ||
209 | BIT(IEEE80211_BAND_5GHZ); | ||
210 | priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR; | ||
211 | |||
212 | priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant); | ||
213 | priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant); | ||
214 | priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant; | ||
215 | priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant; | ||
216 | |||
217 | if (priv->cfg->ops->lib->temp_ops.set_ct_kill) | ||
218 | priv->cfg->ops->lib->temp_ops.set_ct_kill(priv); | ||
219 | |||
220 | /* Set initial sensitivity parameters */ | ||
221 | /* Set initial calibration set */ | ||
222 | priv->hw_params.sens = &iwl6000_sensitivity; | ||
223 | priv->hw_params.calib_init_cfg = | ||
224 | BIT(IWL_CALIB_XTAL) | | ||
225 | BIT(IWL_CALIB_DC) | | ||
226 | BIT(IWL_CALIB_LO) | | ||
227 | BIT(IWL_CALIB_TX_IQ) | | ||
228 | BIT(IWL_CALIB_BASE_BAND); | ||
197 | 229 | ||
198 | return 0; | 230 | return 0; |
199 | } | 231 | } |
@@ -304,7 +336,7 @@ static const struct iwl_ops iwl6000_ops = { | |||
304 | }; | 336 | }; |
305 | 337 | ||
306 | static struct iwl_lib_ops iwl6050_lib = { | 338 | static struct iwl_lib_ops iwl6050_lib = { |
307 | .set_hw_params = iwl6000_hw_set_hw_params, | 339 | .set_hw_params = iwl6050_hw_set_hw_params, |
308 | .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl, | 340 | .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl, |
309 | .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl, | 341 | .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl, |
310 | .txq_set_sched = iwlagn_txq_set_sched, | 342 | .txq_set_sched = iwlagn_txq_set_sched, |