aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-4965.c
diff options
context:
space:
mode:
authorGuy Cohen <guy.cohen@intel.com>2008-04-21 18:42:01 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-07 15:02:16 -0400
commitfde0db310fd4979e0d8e6ba009975d23cc7e65ac (patch)
tree79bc5dab39cce0cbc2b4d40433b53c048efbd38a /drivers/net/wireless/iwlwifi/iwl-4965.c
parentd1141dfb3ab5545491e3aa15b7f0d7330a186281 (diff)
iwlwifi: HT antenna/chains overhaul
1. This patch restructures rate scale algorithm to support SISO, MIMO2, MIMO3 2. It adds support for detailed valid TX and RX antennas settings 3. It removes few unesfull antenna definitions Signed-off-by: Guy Cohen <guy.cohen@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-4965.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c57
1 files changed, 32 insertions, 25 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 91cc03f76e1a..2c5bfa4f048d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -58,7 +58,8 @@ static void iwl4965_hw_card_show_info(struct iwl_priv *priv);
58#define IWL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \ 58#define IWL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \
59 [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \ 59 [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \
60 IWL_RATE_SISO_##s##M_PLCP, \ 60 IWL_RATE_SISO_##s##M_PLCP, \
61 IWL_RATE_MIMO_##s##M_PLCP, \ 61 IWL_RATE_MIMO2_##s##M_PLCP,\
62 IWL_RATE_MIMO3_##s##M_PLCP,\
62 IWL_RATE_##r##M_IEEE, \ 63 IWL_RATE_##r##M_IEEE, \
63 IWL_RATE_##ip##M_INDEX, \ 64 IWL_RATE_##ip##M_INDEX, \
64 IWL_RATE_##in##M_INDEX, \ 65 IWL_RATE_##in##M_INDEX, \
@@ -89,6 +90,7 @@ const struct iwl4965_rate_info iwl4965_rates[IWL_RATE_COUNT] = {
89 IWL_DECLARE_RATE_INFO(48, 48, 36, 54, 36, 54, 36, 54), /* 48mbps */ 90 IWL_DECLARE_RATE_INFO(48, 48, 36, 54, 36, 54, 36, 54), /* 48mbps */
90 IWL_DECLARE_RATE_INFO(54, 54, 48, INV, 48, INV, 48, INV),/* 54mbps */ 91 IWL_DECLARE_RATE_INFO(54, 54, 48, INV, 48, INV, 48, INV),/* 54mbps */
91 IWL_DECLARE_RATE_INFO(60, 60, 48, INV, 48, INV, 48, INV),/* 60mbps */ 92 IWL_DECLARE_RATE_INFO(60, 60, 48, INV, 48, INV, 48, INV),/* 60mbps */
93 /* FIXME:RS: ^^ should be INV (legacy) */
92}; 94};
93 95
94#ifdef CONFIG_IWL4965_HT 96#ifdef CONFIG_IWL4965_HT
@@ -265,7 +267,6 @@ static int iwl4965_init_drv(struct iwl_priv *priv)
265 int ret; 267 int ret;
266 int i; 268 int i;
267 269
268 priv->antenna = (enum iwl4965_antenna)priv->cfg->mod_params->antenna;
269 priv->retry_rate = 1; 270 priv->retry_rate = 1;
270 priv->ibss_beacon = NULL; 271 priv->ibss_beacon = NULL;
271 272
@@ -305,7 +306,6 @@ static int iwl4965_init_drv(struct iwl_priv *priv)
305 priv->iw_mode = IEEE80211_IF_TYPE_STA; 306 priv->iw_mode = IEEE80211_IF_TYPE_STA;
306 307
307 priv->use_ant_b_for_management_frame = 1; /* start with ant B */ 308 priv->use_ant_b_for_management_frame = 1; /* start with ant B */
308 priv->valid_antenna = 0x7; /* assume all 3 connected */
309 priv->ps_mode = IWL_MIMO_PS_NONE; 309 priv->ps_mode = IWL_MIMO_PS_NONE;
310 310
311 /* Choose which receivers/antennas to use */ 311 /* Choose which receivers/antennas to use */
@@ -361,18 +361,20 @@ static int is_fat_channel(__le32 rxon_flags)
361 (rxon_flags & RXON_FLG_CHANNEL_MODE_MIXED_MSK); 361 (rxon_flags & RXON_FLG_CHANNEL_MODE_MIXED_MSK);
362} 362}
363 363
364static u8 is_single_stream(struct iwl_priv *priv)
365{
366#ifdef CONFIG_IWL4965_HT 364#ifdef CONFIG_IWL4965_HT
367 if (!priv->current_ht_config.is_ht || 365static u8 is_single_rx_stream(struct iwl_priv *priv)
368 (priv->current_ht_config.supp_mcs_set[1] == 0) || 366{
369 (priv->ps_mode == IWL_MIMO_PS_STATIC)) 367 return !priv->current_ht_config.is_ht ||
370 return 1; 368 ((priv->current_ht_config.supp_mcs_set[1] == 0) &&
369 (priv->current_ht_config.supp_mcs_set[2] == 0)) ||
370 priv->ps_mode == IWL_MIMO_PS_STATIC;
371}
371#else 372#else
373static inline u8 is_single_rx_stream(struct iwl_priv *priv)
374{
372 return 1; 375 return 1;
373#endif /*CONFIG_IWL4965_HT */
374 return 0;
375} 376}
377#endif /*CONFIG_IWL4965_HT */
376 378
377int iwl4965_hwrate_to_plcp_idx(u32 rate_n_flags) 379int iwl4965_hwrate_to_plcp_idx(u32 rate_n_flags)
378{ 380{
@@ -382,8 +384,8 @@ int iwl4965_hwrate_to_plcp_idx(u32 rate_n_flags)
382 if (rate_n_flags & RATE_MCS_HT_MSK) { 384 if (rate_n_flags & RATE_MCS_HT_MSK) {
383 idx = (rate_n_flags & 0xff); 385 idx = (rate_n_flags & 0xff);
384 386
385 if (idx >= IWL_RATE_MIMO_6M_PLCP) 387 if (idx >= IWL_RATE_MIMO2_6M_PLCP)
386 idx = idx - IWL_RATE_MIMO_6M_PLCP; 388 idx = idx - IWL_RATE_MIMO2_6M_PLCP;
387 389
388 idx += IWL_FIRST_OFDM_RATE; 390 idx += IWL_FIRST_OFDM_RATE;
389 /* skip 9M not supported in ht*/ 391 /* skip 9M not supported in ht*/
@@ -411,7 +413,7 @@ void iwl4965_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags,
411 int rate_index; 413 int rate_index;
412 414
413 control->antenna_sel_tx = 415 control->antenna_sel_tx =
414 ((rate_n_flags & RATE_MCS_ANT_AB_MSK) >> RATE_MCS_ANT_POS); 416 ((rate_n_flags & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS);
415 if (rate_n_flags & RATE_MCS_HT_MSK) 417 if (rate_n_flags & RATE_MCS_HT_MSK)
416 control->flags |= IEEE80211_TXCTL_OFDM_HT; 418 control->flags |= IEEE80211_TXCTL_OFDM_HT;
417 if (rate_n_flags & RATE_MCS_GF_MSK) 419 if (rate_n_flags & RATE_MCS_GF_MSK)
@@ -441,7 +443,7 @@ void iwl4965_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags,
441static int iwl4965_get_rx_chain_counter(struct iwl_priv *priv, 443static int iwl4965_get_rx_chain_counter(struct iwl_priv *priv,
442 u8 *idle_state, u8 *rx_state) 444 u8 *idle_state, u8 *rx_state)
443{ 445{
444 u8 is_single = is_single_stream(priv); 446 u8 is_single = is_single_rx_stream(priv);
445 u8 is_cam = test_bit(STATUS_POWER_PMI, &priv->status) ? 0 : 1; 447 u8 is_cam = test_bit(STATUS_POWER_PMI, &priv->status) ? 0 : 1;
446 448
447 /* # of Rx chains to use when expecting MIMO. */ 449 /* # of Rx chains to use when expecting MIMO. */
@@ -1344,8 +1346,8 @@ int iwl4965_hw_set_hw_params(struct iwl_priv *priv)
1344 1346
1345 priv->hw_params.tx_chains_num = 2; 1347 priv->hw_params.tx_chains_num = 2;
1346 priv->hw_params.rx_chains_num = 2; 1348 priv->hw_params.rx_chains_num = 2;
1347 priv->hw_params.valid_tx_ant = (IWL_ANTENNA_MAIN | IWL_ANTENNA_AUX); 1349 priv->hw_params.valid_tx_ant = ANT_A | ANT_B;
1348 priv->hw_params.valid_rx_ant = (IWL_ANTENNA_MAIN | IWL_ANTENNA_AUX); 1350 priv->hw_params.valid_rx_ant = ANT_A | ANT_B;
1349 priv->hw_params.ct_kill_threshold = CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD); 1351 priv->hw_params.ct_kill_threshold = CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD);
1350 1352
1351#ifdef CONFIG_IWL4965_RUN_TIME_CALIB 1353#ifdef CONFIG_IWL4965_RUN_TIME_CALIB
@@ -2512,7 +2514,7 @@ static void iwl4965_txq_update_byte_cnt_tbl(struct iwl_priv *priv,
2512 */ 2514 */
2513void iwl4965_set_rxon_chain(struct iwl_priv *priv) 2515void iwl4965_set_rxon_chain(struct iwl_priv *priv)
2514{ 2516{
2515 u8 is_single = is_single_stream(priv); 2517 u8 is_single = is_single_rx_stream(priv);
2516 u8 idle_state, rx_state; 2518 u8 idle_state, rx_state;
2517 2519
2518 priv->staging_rxon.rx_chain = 0; 2520 priv->staging_rxon.rx_chain = 0;
@@ -2523,7 +2525,8 @@ void iwl4965_set_rxon_chain(struct iwl_priv *priv)
2523 * Just after first association, iwl_chain_noise_calibration() 2525 * Just after first association, iwl_chain_noise_calibration()
2524 * checks which antennas actually *are* connected. */ 2526 * checks which antennas actually *are* connected. */
2525 priv->staging_rxon.rx_chain |= 2527 priv->staging_rxon.rx_chain |=
2526 cpu_to_le16(priv->valid_antenna << RXON_RX_CHAIN_VALID_POS); 2528 cpu_to_le16(priv->hw_params.valid_rx_ant <<
2529 RXON_RX_CHAIN_VALID_POS);
2527 2530
2528 /* How many receivers should we use? */ 2531 /* How many receivers should we use? */
2529 iwl4965_get_rx_chain_counter(priv, &idle_state, &rx_state); 2532 iwl4965_get_rx_chain_counter(priv, &idle_state, &rx_state);
@@ -3106,7 +3109,7 @@ static int iwl4965_calc_rssi(struct iwl4965_rx_phy_res *rx_resp)
3106 3109
3107#ifdef CONFIG_IWL4965_HT 3110#ifdef CONFIG_IWL4965_HT
3108 3111
3109void iwl4965_init_ht_hw_capab(struct iwl_priv *priv, 3112void iwl4965_init_ht_hw_capab(const struct iwl_priv *priv,
3110 struct ieee80211_ht_info *ht_info, 3113 struct ieee80211_ht_info *ht_info,
3111 enum ieee80211_band band) 3114 enum ieee80211_band band)
3112{ 3115{
@@ -3132,7 +3135,10 @@ void iwl4965_init_ht_hw_capab(struct iwl_priv *priv,
3132 ht_info->ampdu_density = CFG_HT_MPDU_DENSITY_DEF; 3135 ht_info->ampdu_density = CFG_HT_MPDU_DENSITY_DEF;
3133 3136
3134 ht_info->supp_mcs_set[0] = 0xFF; 3137 ht_info->supp_mcs_set[0] = 0xFF;
3135 ht_info->supp_mcs_set[1] = 0xFF; 3138 if (priv->hw_params.tx_chains_num >= 2)
3139 ht_info->supp_mcs_set[1] = 0xFF;
3140 if (priv->hw_params.tx_chains_num >= 3)
3141 ht_info->supp_mcs_set[2] = 0xFF;
3136} 3142}
3137#endif /* CONFIG_IWL4965_HT */ 3143#endif /* CONFIG_IWL4965_HT */
3138 3144
@@ -3910,8 +3916,7 @@ void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap)
3910 rate_flags |= RATE_MCS_CCK_MSK; 3916 rate_flags |= RATE_MCS_CCK_MSK;
3911 3917
3912 /* Use Tx antenna B only */ 3918 /* Use Tx antenna B only */
3913 rate_flags |= RATE_MCS_ANT_B_MSK; 3919 rate_flags |= RATE_MCS_ANT_B_MSK; /*FIXME:RS*/
3914 rate_flags &= ~RATE_MCS_ANT_A_MSK;
3915 3920
3916 link_cmd.rs_table[i].rate_n_flags = 3921 link_cmd.rs_table[i].rate_n_flags =
3917 iwl4965_hw_set_rate_n_flags(iwl4965_rates[r].plcp, rate_flags); 3922 iwl4965_hw_set_rate_n_flags(iwl4965_rates[r].plcp, rate_flags);
@@ -4016,11 +4021,13 @@ void iwl4965_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info)
4016 4021
4017 iwl4965_set_rxon_chain(priv); 4022 iwl4965_set_rxon_chain(priv);
4018 4023
4019 IWL_DEBUG_ASSOC("supported HT rate 0x%X %X " 4024 IWL_DEBUG_ASSOC("supported HT rate 0x%X 0x%X 0x%X "
4020 "rxon flags 0x%X operation mode :0x%X " 4025 "rxon flags 0x%X operation mode :0x%X "
4021 "extension channel offset 0x%x " 4026 "extension channel offset 0x%x "
4022 "control chan %d\n", 4027 "control chan %d\n",
4023 ht_info->supp_mcs_set[0], ht_info->supp_mcs_set[1], 4028 ht_info->supp_mcs_set[0],
4029 ht_info->supp_mcs_set[1],
4030 ht_info->supp_mcs_set[2],
4024 le32_to_cpu(rxon->flags), ht_info->ht_protection, 4031 le32_to_cpu(rxon->flags), ht_info->ht_protection,
4025 ht_info->extension_chan_offset, 4032 ht_info->extension_chan_offset,
4026 ht_info->control_channel); 4033 ht_info->control_channel);