ath5k: MRR support and 2GHz radio override belong in ah_capabilities
MRR support and 2GHz radio override belong in ah_capabilities and we should use them (e.g. so far we used to set mrr descriptor without checking if MRR support is enabled + we checked for MRR support 2 times, one by trying to set up an MRR descriptor and another one based on MAC version). Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
84e1e7373b
commit
86f62d9b70
5 changed files with 46 additions and 47 deletions
|
@ -166,7 +166,9 @@ static int ath_ahb_probe(struct platform_device *pdev)
|
||||||
if (to_platform_device(ah->dev)->id == 0 &&
|
if (to_platform_device(ah->dev)->id == 0 &&
|
||||||
(bcfg->config->flags & (BD_WLAN0 | BD_WLAN1)) ==
|
(bcfg->config->flags & (BD_WLAN0 | BD_WLAN1)) ==
|
||||||
(BD_WLAN1 | BD_WLAN0))
|
(BD_WLAN1 | BD_WLAN0))
|
||||||
__set_bit(ATH_STAT_2G_DISABLED, ah->status);
|
ah->ah_capabilities.cap_needs_2GHz_ovr = true;
|
||||||
|
else
|
||||||
|
ah->ah_capabilities.cap_needs_2GHz_ovr = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ath5k_init_ah(ah, &ath_ahb_bus_ops);
|
ret = ath5k_init_ah(ah, &ath_ahb_bus_ops);
|
||||||
|
|
|
@ -1159,6 +1159,8 @@ struct ath5k_capabilities {
|
||||||
} cap_queues;
|
} cap_queues;
|
||||||
|
|
||||||
bool cap_has_phyerr_counters;
|
bool cap_has_phyerr_counters;
|
||||||
|
bool cap_has_mrr_support;
|
||||||
|
bool cap_needs_2GHz_ovr;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* size of noise floor history (keep it a power of two) */
|
/* size of noise floor history (keep it a power of two) */
|
||||||
|
@ -1274,13 +1276,11 @@ struct ath5k_hw {
|
||||||
dma_addr_t desc_daddr; /* DMA (physical) address */
|
dma_addr_t desc_daddr; /* DMA (physical) address */
|
||||||
size_t desc_len; /* size of TX/RX descriptors */
|
size_t desc_len; /* size of TX/RX descriptors */
|
||||||
|
|
||||||
DECLARE_BITMAP(status, 6);
|
DECLARE_BITMAP(status, 4);
|
||||||
#define ATH_STAT_INVALID 0 /* disable hardware accesses */
|
#define ATH_STAT_INVALID 0 /* disable hardware accesses */
|
||||||
#define ATH_STAT_MRRETRY 1 /* multi-rate retry support */
|
#define ATH_STAT_PROMISC 1
|
||||||
#define ATH_STAT_PROMISC 2
|
#define ATH_STAT_LEDSOFT 2 /* enable LED gpio status */
|
||||||
#define ATH_STAT_LEDSOFT 3 /* enable LED gpio status */
|
#define ATH_STAT_STARTED 3 /* opened & irqs enabled */
|
||||||
#define ATH_STAT_STARTED 4 /* opened & irqs enabled */
|
|
||||||
#define ATH_STAT_2G_DISABLED 5 /* multiband radio without 2G */
|
|
||||||
|
|
||||||
unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */
|
unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */
|
||||||
struct ieee80211_channel *curchan; /* current h/w channel */
|
struct ieee80211_channel *curchan; /* current h/w channel */
|
||||||
|
|
|
@ -306,11 +306,6 @@ int ath5k_hw_init(struct ath5k_hw *ah)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test_bit(ATH_STAT_2G_DISABLED, ah->status)) {
|
|
||||||
__clear_bit(AR5K_MODE_11B, ah->ah_capabilities.cap_mode);
|
|
||||||
__clear_bit(AR5K_MODE_11G, ah->ah_capabilities.cap_mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Crypto settings */
|
/* Crypto settings */
|
||||||
common->keymax = (ah->ah_version == AR5K_AR5210 ?
|
common->keymax = (ah->ah_version == AR5K_AR5210 ?
|
||||||
AR5K_KEYTABLE_SIZE_5210 : AR5K_KEYTABLE_SIZE_5211);
|
AR5K_KEYTABLE_SIZE_5210 : AR5K_KEYTABLE_SIZE_5211);
|
||||||
|
|
|
@ -725,22 +725,25 @@ ath5k_txbuf_setup(struct ath5k_hw *ah, struct ath5k_buf *bf,
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_unmap;
|
goto err_unmap;
|
||||||
|
|
||||||
memset(mrr_rate, 0, sizeof(mrr_rate));
|
/* Set up MRR descriptor */
|
||||||
memset(mrr_tries, 0, sizeof(mrr_tries));
|
if (ah->ah_capabilities.cap_has_mrr_support) {
|
||||||
for (i = 0; i < 3; i++) {
|
memset(mrr_rate, 0, sizeof(mrr_rate));
|
||||||
rate = ieee80211_get_alt_retry_rate(ah->hw, info, i);
|
memset(mrr_tries, 0, sizeof(mrr_tries));
|
||||||
if (!rate)
|
for (i = 0; i < 3; i++) {
|
||||||
break;
|
rate = ieee80211_get_alt_retry_rate(ah->hw, info, i);
|
||||||
|
if (!rate)
|
||||||
|
break;
|
||||||
|
|
||||||
mrr_rate[i] = rate->hw_value;
|
mrr_rate[i] = rate->hw_value;
|
||||||
mrr_tries[i] = info->control.rates[i + 1].count;
|
mrr_tries[i] = info->control.rates[i + 1].count;
|
||||||
|
}
|
||||||
|
|
||||||
|
ath5k_hw_setup_mrr_tx_desc(ah, ds,
|
||||||
|
mrr_rate[0], mrr_tries[0],
|
||||||
|
mrr_rate[1], mrr_tries[1],
|
||||||
|
mrr_rate[2], mrr_tries[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ath5k_hw_setup_mrr_tx_desc(ah, ds,
|
|
||||||
mrr_rate[0], mrr_tries[0],
|
|
||||||
mrr_rate[1], mrr_tries[1],
|
|
||||||
mrr_rate[2], mrr_tries[2]);
|
|
||||||
|
|
||||||
ds->ds_link = 0;
|
ds->ds_link = 0;
|
||||||
ds->ds_data = bf->skbaddr;
|
ds->ds_data = bf->skbaddr;
|
||||||
|
|
||||||
|
@ -2489,8 +2492,8 @@ ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops)
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_irq;
|
goto err_irq;
|
||||||
|
|
||||||
/* set up multi-rate retry capabilities */
|
/* Set up multi-rate retry capabilities */
|
||||||
if (ah->ah_version == AR5K_AR5212) {
|
if (ah->ah_capabilities.cap_has_mrr_support) {
|
||||||
hw->max_rates = 4;
|
hw->max_rates = 4;
|
||||||
hw->max_rate_tries = max(AR5K_INIT_RETRY_SHORT,
|
hw->max_rate_tries = max(AR5K_INIT_RETRY_SHORT,
|
||||||
AR5K_INIT_RETRY_LONG);
|
AR5K_INIT_RETRY_LONG);
|
||||||
|
@ -2848,20 +2851,6 @@ ath5k_init(struct ieee80211_hw *hw)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check if the MAC has multi-rate retry support.
|
|
||||||
* We do this by trying to setup a fake extended
|
|
||||||
* descriptor. MACs that don't have support will
|
|
||||||
* return false w/o doing anything. MACs that do
|
|
||||||
* support it will return true w/o doing anything.
|
|
||||||
*/
|
|
||||||
ret = ath5k_hw_setup_mrr_tx_desc(ah, NULL, 0, 0, 0, 0, 0, 0);
|
|
||||||
|
|
||||||
if (ret < 0)
|
|
||||||
goto err;
|
|
||||||
if (ret > 0)
|
|
||||||
__set_bit(ATH_STAT_MRRETRY, ah->status);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Collect the channel list. The 802.11 layer
|
* Collect the channel list. The 802.11 layer
|
||||||
* is responsible for filtering this list based
|
* is responsible for filtering this list based
|
||||||
|
|
|
@ -85,12 +85,19 @@ int ath5k_hw_set_capabilities(struct ath5k_hw *ah)
|
||||||
caps->cap_range.range_2ghz_min = 2412;
|
caps->cap_range.range_2ghz_min = 2412;
|
||||||
caps->cap_range.range_2ghz_max = 2732;
|
caps->cap_range.range_2ghz_max = 2732;
|
||||||
|
|
||||||
if (AR5K_EEPROM_HDR_11B(ee_header))
|
/* Override 2GHz modes on SoCs that need it
|
||||||
__set_bit(AR5K_MODE_11B, caps->cap_mode);
|
* NOTE: cap_needs_2GHz_ovr gets set from
|
||||||
|
* ath_ahb_probe */
|
||||||
|
if (!caps->cap_needs_2GHz_ovr) {
|
||||||
|
if (AR5K_EEPROM_HDR_11B(ee_header))
|
||||||
|
__set_bit(AR5K_MODE_11B,
|
||||||
|
caps->cap_mode);
|
||||||
|
|
||||||
if (AR5K_EEPROM_HDR_11G(ee_header) &&
|
if (AR5K_EEPROM_HDR_11G(ee_header) &&
|
||||||
ah->ah_version != AR5K_AR5211)
|
ah->ah_version != AR5K_AR5211)
|
||||||
__set_bit(AR5K_MODE_11G, caps->cap_mode);
|
__set_bit(AR5K_MODE_11G,
|
||||||
|
caps->cap_mode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,12 +110,18 @@ int ath5k_hw_set_capabilities(struct ath5k_hw *ah)
|
||||||
else
|
else
|
||||||
caps->cap_queues.q_tx_num = AR5K_NUM_TX_QUEUES;
|
caps->cap_queues.q_tx_num = AR5K_NUM_TX_QUEUES;
|
||||||
|
|
||||||
/* newer hardware has PHY error counters */
|
/* Newer hardware has PHY error counters */
|
||||||
if (ah->ah_mac_srev >= AR5K_SREV_AR5213A)
|
if (ah->ah_mac_srev >= AR5K_SREV_AR5213A)
|
||||||
caps->cap_has_phyerr_counters = true;
|
caps->cap_has_phyerr_counters = true;
|
||||||
else
|
else
|
||||||
caps->cap_has_phyerr_counters = false;
|
caps->cap_has_phyerr_counters = false;
|
||||||
|
|
||||||
|
/* MACs since AR5212 have MRR support */
|
||||||
|
if (ah->ah_version == AR5K_AR5212)
|
||||||
|
caps->cap_has_mrr_support = true;
|
||||||
|
else
|
||||||
|
caps->cap_has_mrr_support = false;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue