|
@@ -62,111 +62,6 @@ module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
|
|
|
MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
|
|
|
|
|
|
bool is_ath9k_unloaded;
|
|
|
-/* We use the hw_value as an index into our private channel structure */
|
|
|
-
|
|
|
-#define CHAN2G(_freq, _idx) { \
|
|
|
- .band = IEEE80211_BAND_2GHZ, \
|
|
|
- .center_freq = (_freq), \
|
|
|
- .hw_value = (_idx), \
|
|
|
- .max_power = 20, \
|
|
|
-}
|
|
|
-
|
|
|
-#define CHAN5G(_freq, _idx) { \
|
|
|
- .band = IEEE80211_BAND_5GHZ, \
|
|
|
- .center_freq = (_freq), \
|
|
|
- .hw_value = (_idx), \
|
|
|
- .max_power = 20, \
|
|
|
-}
|
|
|
-
|
|
|
-/* Some 2 GHz radios are actually tunable on 2312-2732
|
|
|
- * on 5 MHz steps, we support the channels which we know
|
|
|
- * we have calibration data for all cards though to make
|
|
|
- * this static */
|
|
|
-static const struct ieee80211_channel ath9k_2ghz_chantable[] = {
|
|
|
- CHAN2G(2412, 0), /* Channel 1 */
|
|
|
- CHAN2G(2417, 1), /* Channel 2 */
|
|
|
- CHAN2G(2422, 2), /* Channel 3 */
|
|
|
- CHAN2G(2427, 3), /* Channel 4 */
|
|
|
- CHAN2G(2432, 4), /* Channel 5 */
|
|
|
- CHAN2G(2437, 5), /* Channel 6 */
|
|
|
- CHAN2G(2442, 6), /* Channel 7 */
|
|
|
- CHAN2G(2447, 7), /* Channel 8 */
|
|
|
- CHAN2G(2452, 8), /* Channel 9 */
|
|
|
- CHAN2G(2457, 9), /* Channel 10 */
|
|
|
- CHAN2G(2462, 10), /* Channel 11 */
|
|
|
- CHAN2G(2467, 11), /* Channel 12 */
|
|
|
- CHAN2G(2472, 12), /* Channel 13 */
|
|
|
- CHAN2G(2484, 13), /* Channel 14 */
|
|
|
-};
|
|
|
-
|
|
|
-/* Some 5 GHz radios are actually tunable on XXXX-YYYY
|
|
|
- * on 5 MHz steps, we support the channels which we know
|
|
|
- * we have calibration data for all cards though to make
|
|
|
- * this static */
|
|
|
-static const struct ieee80211_channel ath9k_5ghz_chantable[] = {
|
|
|
- /* _We_ call this UNII 1 */
|
|
|
- CHAN5G(5180, 14), /* Channel 36 */
|
|
|
- CHAN5G(5200, 15), /* Channel 40 */
|
|
|
- CHAN5G(5220, 16), /* Channel 44 */
|
|
|
- CHAN5G(5240, 17), /* Channel 48 */
|
|
|
- /* _We_ call this UNII 2 */
|
|
|
- CHAN5G(5260, 18), /* Channel 52 */
|
|
|
- CHAN5G(5280, 19), /* Channel 56 */
|
|
|
- CHAN5G(5300, 20), /* Channel 60 */
|
|
|
- CHAN5G(5320, 21), /* Channel 64 */
|
|
|
- /* _We_ call this "Middle band" */
|
|
|
- CHAN5G(5500, 22), /* Channel 100 */
|
|
|
- CHAN5G(5520, 23), /* Channel 104 */
|
|
|
- CHAN5G(5540, 24), /* Channel 108 */
|
|
|
- CHAN5G(5560, 25), /* Channel 112 */
|
|
|
- CHAN5G(5580, 26), /* Channel 116 */
|
|
|
- CHAN5G(5600, 27), /* Channel 120 */
|
|
|
- CHAN5G(5620, 28), /* Channel 124 */
|
|
|
- CHAN5G(5640, 29), /* Channel 128 */
|
|
|
- CHAN5G(5660, 30), /* Channel 132 */
|
|
|
- CHAN5G(5680, 31), /* Channel 136 */
|
|
|
- CHAN5G(5700, 32), /* Channel 140 */
|
|
|
- /* _We_ call this UNII 3 */
|
|
|
- CHAN5G(5745, 33), /* Channel 149 */
|
|
|
- CHAN5G(5765, 34), /* Channel 153 */
|
|
|
- CHAN5G(5785, 35), /* Channel 157 */
|
|
|
- CHAN5G(5805, 36), /* Channel 161 */
|
|
|
- CHAN5G(5825, 37), /* Channel 165 */
|
|
|
-};
|
|
|
-
|
|
|
-/* Atheros hardware rate code addition for short premble */
|
|
|
-#define SHPCHECK(__hw_rate, __flags) \
|
|
|
- ((__flags & IEEE80211_RATE_SHORT_PREAMBLE) ? (__hw_rate | 0x04 ) : 0)
|
|
|
-
|
|
|
-#define RATE(_bitrate, _hw_rate, _flags) { \
|
|
|
- .bitrate = (_bitrate), \
|
|
|
- .flags = (_flags), \
|
|
|
- .hw_value = (_hw_rate), \
|
|
|
- .hw_value_short = (SHPCHECK(_hw_rate, _flags)) \
|
|
|
-}
|
|
|
-
|
|
|
-static struct ieee80211_rate ath9k_legacy_rates[] = {
|
|
|
- RATE(10, 0x1b, 0),
|
|
|
- RATE(20, 0x1a, IEEE80211_RATE_SHORT_PREAMBLE),
|
|
|
- RATE(55, 0x19, IEEE80211_RATE_SHORT_PREAMBLE),
|
|
|
- RATE(110, 0x18, IEEE80211_RATE_SHORT_PREAMBLE),
|
|
|
- RATE(60, 0x0b, (IEEE80211_RATE_SUPPORTS_5MHZ |
|
|
|
- IEEE80211_RATE_SUPPORTS_10MHZ)),
|
|
|
- RATE(90, 0x0f, (IEEE80211_RATE_SUPPORTS_5MHZ |
|
|
|
- IEEE80211_RATE_SUPPORTS_10MHZ)),
|
|
|
- RATE(120, 0x0a, (IEEE80211_RATE_SUPPORTS_5MHZ |
|
|
|
- IEEE80211_RATE_SUPPORTS_10MHZ)),
|
|
|
- RATE(180, 0x0e, (IEEE80211_RATE_SUPPORTS_5MHZ |
|
|
|
- IEEE80211_RATE_SUPPORTS_10MHZ)),
|
|
|
- RATE(240, 0x09, (IEEE80211_RATE_SUPPORTS_5MHZ |
|
|
|
- IEEE80211_RATE_SUPPORTS_10MHZ)),
|
|
|
- RATE(360, 0x0d, (IEEE80211_RATE_SUPPORTS_5MHZ |
|
|
|
- IEEE80211_RATE_SUPPORTS_10MHZ)),
|
|
|
- RATE(480, 0x08, (IEEE80211_RATE_SUPPORTS_5MHZ |
|
|
|
- IEEE80211_RATE_SUPPORTS_10MHZ)),
|
|
|
- RATE(540, 0x0c, (IEEE80211_RATE_SUPPORTS_5MHZ |
|
|
|
- IEEE80211_RATE_SUPPORTS_10MHZ)),
|
|
|
-};
|
|
|
|
|
|
#ifdef CONFIG_MAC80211_LEDS
|
|
|
static const struct ieee80211_tpt_blink ath9k_tpt_blink[] = {
|
|
@@ -486,51 +381,6 @@ static int ath9k_init_queues(struct ath_softc *sc)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-static int ath9k_init_channels_rates(struct ath_softc *sc)
|
|
|
-{
|
|
|
- void *channels;
|
|
|
-
|
|
|
- BUILD_BUG_ON(ARRAY_SIZE(ath9k_2ghz_chantable) +
|
|
|
- ARRAY_SIZE(ath9k_5ghz_chantable) !=
|
|
|
- ATH9K_NUM_CHANNELS);
|
|
|
-
|
|
|
- if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) {
|
|
|
- channels = devm_kzalloc(sc->dev,
|
|
|
- sizeof(ath9k_2ghz_chantable), GFP_KERNEL);
|
|
|
- if (!channels)
|
|
|
- return -ENOMEM;
|
|
|
-
|
|
|
- memcpy(channels, ath9k_2ghz_chantable,
|
|
|
- sizeof(ath9k_2ghz_chantable));
|
|
|
- sc->sbands[IEEE80211_BAND_2GHZ].channels = channels;
|
|
|
- sc->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ;
|
|
|
- sc->sbands[IEEE80211_BAND_2GHZ].n_channels =
|
|
|
- ARRAY_SIZE(ath9k_2ghz_chantable);
|
|
|
- sc->sbands[IEEE80211_BAND_2GHZ].bitrates = ath9k_legacy_rates;
|
|
|
- sc->sbands[IEEE80211_BAND_2GHZ].n_bitrates =
|
|
|
- ARRAY_SIZE(ath9k_legacy_rates);
|
|
|
- }
|
|
|
-
|
|
|
- if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) {
|
|
|
- channels = devm_kzalloc(sc->dev,
|
|
|
- sizeof(ath9k_5ghz_chantable), GFP_KERNEL);
|
|
|
- if (!channels)
|
|
|
- return -ENOMEM;
|
|
|
-
|
|
|
- memcpy(channels, ath9k_5ghz_chantable,
|
|
|
- sizeof(ath9k_5ghz_chantable));
|
|
|
- sc->sbands[IEEE80211_BAND_5GHZ].channels = channels;
|
|
|
- sc->sbands[IEEE80211_BAND_5GHZ].band = IEEE80211_BAND_5GHZ;
|
|
|
- sc->sbands[IEEE80211_BAND_5GHZ].n_channels =
|
|
|
- ARRAY_SIZE(ath9k_5ghz_chantable);
|
|
|
- sc->sbands[IEEE80211_BAND_5GHZ].bitrates =
|
|
|
- ath9k_legacy_rates + 4;
|
|
|
- sc->sbands[IEEE80211_BAND_5GHZ].n_bitrates =
|
|
|
- ARRAY_SIZE(ath9k_legacy_rates) - 4;
|
|
|
- }
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
static void ath9k_init_misc(struct ath_softc *sc)
|
|
|
{
|
|
|
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
|
|
@@ -793,7 +643,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
|
|
|
if (ret)
|
|
|
goto err_btcoex;
|
|
|
|
|
|
- ret = ath9k_init_channels_rates(sc);
|
|
|
+ ret = ath9k_cmn_init_channels_rates(common);
|
|
|
if (ret)
|
|
|
goto err_btcoex;
|
|
|
|
|
@@ -823,10 +673,11 @@ static void ath9k_init_band_txpower(struct ath_softc *sc, int band)
|
|
|
struct ieee80211_supported_band *sband;
|
|
|
struct ieee80211_channel *chan;
|
|
|
struct ath_hw *ah = sc->sc_ah;
|
|
|
+ struct ath_common *common = ath9k_hw_common(ah);
|
|
|
struct cfg80211_chan_def chandef;
|
|
|
int i;
|
|
|
|
|
|
- sband = &sc->sbands[band];
|
|
|
+ sband = &common->sbands[band];
|
|
|
for (i = 0; i < sband->n_channels; i++) {
|
|
|
chan = &sband->channels[i];
|
|
|
ah->curchan = &ah->channels[chan->hw_value];
|
|
@@ -851,13 +702,16 @@ static void ath9k_init_txpower_limits(struct ath_softc *sc)
|
|
|
|
|
|
void ath9k_reload_chainmask_settings(struct ath_softc *sc)
|
|
|
{
|
|
|
- if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT))
|
|
|
+ struct ath_hw *ah = sc->sc_ah;
|
|
|
+ struct ath_common *common = ath9k_hw_common(ah);
|
|
|
+
|
|
|
+ if (!(ah->caps.hw_caps & ATH9K_HW_CAP_HT))
|
|
|
return;
|
|
|
|
|
|
- if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
|
|
|
- setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap);
|
|
|
- if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
|
|
|
- setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap);
|
|
|
+ if (ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
|
|
|
+ setup_ht_cap(sc, &common->sbands[IEEE80211_BAND_2GHZ].ht_cap);
|
|
|
+ if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
|
|
|
+ setup_ht_cap(sc, &common->sbands[IEEE80211_BAND_5GHZ].ht_cap);
|
|
|
}
|
|
|
|
|
|
static const struct ieee80211_iface_limit if_limits[] = {
|
|
@@ -970,10 +824,10 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
|
|
|
|
|
|
if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
|
|
|
hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
|
|
|
- &sc->sbands[IEEE80211_BAND_2GHZ];
|
|
|
+ &common->sbands[IEEE80211_BAND_2GHZ];
|
|
|
if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
|
|
|
hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
|
|
|
- &sc->sbands[IEEE80211_BAND_5GHZ];
|
|
|
+ &common->sbands[IEEE80211_BAND_5GHZ];
|
|
|
|
|
|
ath9k_init_wow(hw);
|
|
|
ath9k_reload_chainmask_settings(sc);
|