Commit 5d664a41 authored by Tomas Winkler's avatar Tomas Winkler Committed by John W. Linville

iwlwifi: take a valid antenna upon rate scale init

This patch selects a valid antennae upon rate scale init. This solves a
SYSASSERT complaining that the driver is setting a non valid antenna in
the LQ CMD.
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarZhu Yi <yi.zhu@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent be5d56ed
...@@ -811,10 +811,14 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv) ...@@ -811,10 +811,14 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) { switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
case CSR_HW_REV_TYPE_5100: case CSR_HW_REV_TYPE_5100:
priv->hw_params.tx_chains_num = 1;
priv->hw_params.rx_chains_num = 2;
priv->hw_params.valid_tx_ant = ANT_B;
priv->hw_params.valid_rx_ant = ANT_AB;
break;
case CSR_HW_REV_TYPE_5150: case CSR_HW_REV_TYPE_5150:
priv->hw_params.tx_chains_num = 1; priv->hw_params.tx_chains_num = 1;
priv->hw_params.rx_chains_num = 2; priv->hw_params.rx_chains_num = 2;
/* FIXME: move to ANT_A, ANT_B, ANT_C enum */
priv->hw_params.valid_tx_ant = ANT_A; priv->hw_params.valid_tx_ant = ANT_A;
priv->hw_params.valid_rx_ant = ANT_AB; priv->hw_params.valid_rx_ant = ANT_AB;
break; break;
......
...@@ -284,6 +284,16 @@ static inline u8 num_of_ant(u8 mask) ...@@ -284,6 +284,16 @@ static inline u8 num_of_ant(u8 mask)
!!((mask) & ANT_C); !!((mask) & ANT_C);
} }
static inline u8 first_antenna(u8 mask)
{
if (mask & ANT_A)
return ANT_A;
if (mask & ANT_B)
return ANT_B;
return ANT_C;
}
static inline u8 iwl4965_get_prev_ieee_rate(u8 rate_index) static inline u8 iwl4965_get_prev_ieee_rate(u8 rate_index)
{ {
u8 rate = iwl_rates[rate_index].prev_ieee; u8 rate = iwl_rates[rate_index].prev_ieee;
......
...@@ -845,7 +845,7 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, int is_ap) ...@@ -845,7 +845,7 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, int is_ap)
struct iwl_link_quality_cmd link_cmd = { struct iwl_link_quality_cmd link_cmd = {
.reserved1 = 0, .reserved1 = 0,
}; };
u16 rate_flags; u32 rate_flags;
/* Set up the rate scaling to start at selected rate, fall back /* Set up the rate scaling to start at selected rate, fall back
* all the way down to 1M in IEEE order, and then spin on 1M */ * all the way down to 1M in IEEE order, and then spin on 1M */
...@@ -861,15 +861,16 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, int is_ap) ...@@ -861,15 +861,16 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, int is_ap)
if (r >= IWL_FIRST_CCK_RATE && r <= IWL_LAST_CCK_RATE) if (r >= IWL_FIRST_CCK_RATE && r <= IWL_LAST_CCK_RATE)
rate_flags |= RATE_MCS_CCK_MSK; rate_flags |= RATE_MCS_CCK_MSK;
/* Use Tx antenna B only */ rate_flags |= first_antenna(priv->hw_params.valid_tx_ant) <<
rate_flags |= RATE_MCS_ANT_B_MSK; /*FIXME:RS*/ RATE_MCS_ANT_POS;
link_cmd.rs_table[i].rate_n_flags = link_cmd.rs_table[i].rate_n_flags =
iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags); iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags);
r = iwl4965_get_prev_ieee_rate(r); r = iwl4965_get_prev_ieee_rate(r);
} }
link_cmd.general_params.single_stream_ant_msk = 2; link_cmd.general_params.single_stream_ant_msk =
first_antenna(priv->hw_params.valid_tx_ant);
link_cmd.general_params.dual_stream_ant_msk = 3; link_cmd.general_params.dual_stream_ant_msk = 3;
link_cmd.agg_params.agg_dis_start_th = 3; link_cmd.agg_params.agg_dis_start_th = 3;
link_cmd.agg_params.agg_time_limit = cpu_to_le16(4000); link_cmd.agg_params.agg_time_limit = cpu_to_le16(4000);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment