1 --- a/drivers/net/wireless/ath/ath9k/rc.c
2 +++ b/drivers/net/wireless/ath/ath9k/rc.c
3 @@ -378,17 +378,6 @@ static const struct ath_rate_table ar541
4 0, /* Phy rates allowed initially */
7 -static const struct ath_rate_table *hw_rate_table[ATH9K_MODE_MAX] = {
8 - [ATH9K_MODE_11A] = &ar5416_11a_ratetable,
9 - [ATH9K_MODE_11G] = &ar5416_11g_ratetable,
10 - [ATH9K_MODE_11NA_HT20] = &ar5416_11na_ratetable,
11 - [ATH9K_MODE_11NG_HT20] = &ar5416_11ng_ratetable,
12 - [ATH9K_MODE_11NA_HT40PLUS] = &ar5416_11na_ratetable,
13 - [ATH9K_MODE_11NA_HT40MINUS] = &ar5416_11na_ratetable,
14 - [ATH9K_MODE_11NG_HT40PLUS] = &ar5416_11ng_ratetable,
15 - [ATH9K_MODE_11NG_HT40MINUS] = &ar5416_11ng_ratetable,
18 static int ath_rc_get_rateindex(const struct ath_rate_table *rate_table,
19 struct ieee80211_tx_rate *rate);
21 @@ -1200,38 +1189,23 @@ static void ath_rc_tx_status(struct ath_
23 struct ath_rate_table *ath_choose_rate_table(struct ath_softc *sc,
24 enum ieee80211_band band,
30 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
33 case IEEE80211_BAND_2GHZ:
34 - mode = ATH9K_MODE_11G;
36 - mode = ATH9K_MODE_11NG_HT20;
38 - mode = ATH9K_MODE_11NG_HT40PLUS;
40 + return &ar5416_11ng_ratetable;
41 + return &ar5416_11g_ratetable;
42 case IEEE80211_BAND_5GHZ:
43 - mode = ATH9K_MODE_11A;
45 - mode = ATH9K_MODE_11NA_HT20;
47 - mode = ATH9K_MODE_11NA_HT40PLUS;
49 + return &ar5416_11na_ratetable;
50 + return &ar5416_11a_ratetable;
52 ath_print(common, ATH_DBG_CONFIG, "Invalid band\n");
56 - BUG_ON(mode >= ATH9K_MODE_MAX);
58 - ath_print(common, ATH_DBG_CONFIG,
59 - "Choosing rate table for mode: %d\n", mode);
61 - return hw_rate_table[mode];
64 static void ath_rc_init(struct ath_softc *sc,
65 @@ -1480,7 +1454,7 @@ static void ath_rate_init(void *priv, st
66 /* Choose rate table first */
68 rate_table = ath_choose_rate_table(sc, sband->band,
69 - sta->ht_cap.ht_supported, is_cw40);
70 + sta->ht_cap.ht_supported);
72 ath_rc_priv->ht_cap = ath_rc_build_ht_caps(sc, sta, is_cw40, is_sgi);
73 ath_rc_init(sc, priv_sta, sband, sta, rate_table);
74 @@ -1520,8 +1494,7 @@ static void ath_rate_update(void *priv,
76 if ((local_cw40 != oper_cw40) || (local_sgi != oper_sgi)) {
77 rate_table = ath_choose_rate_table(sc, sband->band,
78 - sta->ht_cap.ht_supported,
80 + sta->ht_cap.ht_supported);
81 ath_rc_priv->ht_cap = ath_rc_build_ht_caps(sc, sta,
83 ath_rc_init(sc, priv_sta, sband, sta, rate_table);
84 --- a/drivers/net/wireless/ath/ath9k/hw.c
85 +++ b/drivers/net/wireless/ath/ath9k/hw.c
86 @@ -1812,37 +1812,11 @@ int ath9k_hw_fill_cap_info(struct ath_hw
90 - bitmap_zero(pCap->wireless_modes, ATH9K_MODE_MAX);
91 + if (eeval & AR5416_OPFLAGS_11A)
92 + pCap->hw_caps |= ATH9K_HW_CAP_5GHZ;
94 - if (eeval & AR5416_OPFLAGS_11A) {
95 - set_bit(ATH9K_MODE_11A, pCap->wireless_modes);
96 - if (ah->config.ht_enable) {
97 - if (!(eeval & AR5416_OPFLAGS_N_5G_HT20))
98 - set_bit(ATH9K_MODE_11NA_HT20,
99 - pCap->wireless_modes);
100 - if (!(eeval & AR5416_OPFLAGS_N_5G_HT40)) {
101 - set_bit(ATH9K_MODE_11NA_HT40PLUS,
102 - pCap->wireless_modes);
103 - set_bit(ATH9K_MODE_11NA_HT40MINUS,
104 - pCap->wireless_modes);
109 - if (eeval & AR5416_OPFLAGS_11G) {
110 - set_bit(ATH9K_MODE_11G, pCap->wireless_modes);
111 - if (ah->config.ht_enable) {
112 - if (!(eeval & AR5416_OPFLAGS_N_2G_HT20))
113 - set_bit(ATH9K_MODE_11NG_HT20,
114 - pCap->wireless_modes);
115 - if (!(eeval & AR5416_OPFLAGS_N_2G_HT40)) {
116 - set_bit(ATH9K_MODE_11NG_HT40PLUS,
117 - pCap->wireless_modes);
118 - set_bit(ATH9K_MODE_11NG_HT40MINUS,
119 - pCap->wireless_modes);
123 + if (eeval & AR5416_OPFLAGS_11G)
124 + pCap->hw_caps |= ATH9K_HW_CAP_2GHZ;
126 pCap->tx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_TX_MASK);
128 --- a/drivers/net/wireless/ath/ath9k/hw.h
129 +++ b/drivers/net/wireless/ath/ath9k/hw.h
130 @@ -164,18 +164,6 @@ enum ath_ini_subsys {
134 -enum wireless_mode {
135 - ATH9K_MODE_11A = 0,
137 - ATH9K_MODE_11NA_HT20,
138 - ATH9K_MODE_11NG_HT20,
139 - ATH9K_MODE_11NA_HT40PLUS,
140 - ATH9K_MODE_11NA_HT40MINUS,
141 - ATH9K_MODE_11NG_HT40PLUS,
142 - ATH9K_MODE_11NG_HT40MINUS,
147 ATH9K_HW_CAP_HT = BIT(0),
148 ATH9K_HW_CAP_RFSILENT = BIT(1),
149 @@ -190,11 +178,12 @@ enum ath9k_hw_caps {
150 ATH9K_HW_CAP_SGI_20 = BIT(10),
151 ATH9K_HW_CAP_PAPRD = BIT(11),
152 ATH9K_HW_CAP_ANT_DIV_COMB = BIT(12),
153 + ATH9K_HW_CAP_2GHZ = BIT(13),
154 + ATH9K_HW_CAP_5GHZ = BIT(14),
157 struct ath9k_hw_capabilities {
158 u32 hw_caps; /* ATH9K_HW_CAP_* from ath9k_hw_caps */
159 - DECLARE_BITMAP(wireless_modes, ATH9K_MODE_MAX); /* ATH9K_MODE_* */
162 u16 low_5ghz_chan, high_5ghz_chan;
163 --- a/drivers/net/wireless/ath/ath9k/init.c
164 +++ b/drivers/net/wireless/ath/ath9k/init.c
165 @@ -486,7 +486,7 @@ static int ath9k_init_channels_rates(str
166 ARRAY_SIZE(ath9k_5ghz_chantable) !=
169 - if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes)) {
170 + if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) {
171 channels = kmemdup(ath9k_2ghz_chantable,
172 sizeof(ath9k_2ghz_chantable), GFP_KERNEL);
174 @@ -501,7 +501,7 @@ static int ath9k_init_channels_rates(str
175 ARRAY_SIZE(ath9k_legacy_rates);
178 - if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes)) {
179 + if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) {
180 channels = kmemdup(ath9k_5ghz_chantable,
181 sizeof(ath9k_5ghz_chantable), GFP_KERNEL);
183 @@ -690,17 +690,17 @@ void ath9k_set_hw_capab(struct ath_softc
184 hw->rate_control_algorithm = "ath9k_rate_control";
187 - if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes))
188 + if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
189 hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
190 &sc->sbands[IEEE80211_BAND_2GHZ];
191 - if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes))
192 + if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
193 hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
194 &sc->sbands[IEEE80211_BAND_5GHZ];
196 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
197 - if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes))
198 + if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
199 setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap);
200 - if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes))
201 + if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
202 setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap);
205 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
206 +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
207 @@ -566,7 +566,7 @@ static void ath9k_init_crypto(struct ath
209 static void ath9k_init_channels_rates(struct ath9k_htc_priv *priv)
211 - if (test_bit(ATH9K_MODE_11G, priv->ah->caps.wireless_modes)) {
212 + if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) {
213 priv->sbands[IEEE80211_BAND_2GHZ].channels =
215 priv->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ;
216 @@ -577,7 +577,7 @@ static void ath9k_init_channels_rates(st
217 ARRAY_SIZE(ath9k_legacy_rates);
220 - if (test_bit(ATH9K_MODE_11A, priv->ah->caps.wireless_modes)) {
221 + if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) {
222 priv->sbands[IEEE80211_BAND_5GHZ].channels = ath9k_5ghz_channels;
223 priv->sbands[IEEE80211_BAND_5GHZ].band = IEEE80211_BAND_5GHZ;
224 priv->sbands[IEEE80211_BAND_5GHZ].n_channels =
225 @@ -740,18 +740,18 @@ static void ath9k_set_hw_capab(struct at
226 hw->extra_tx_headroom = sizeof(struct tx_frame_hdr) +
227 sizeof(struct htc_frame_hdr) + 4;
229 - if (test_bit(ATH9K_MODE_11G, priv->ah->caps.wireless_modes))
230 + if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
231 hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
232 &priv->sbands[IEEE80211_BAND_2GHZ];
233 - if (test_bit(ATH9K_MODE_11A, priv->ah->caps.wireless_modes))
234 + if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
235 hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
236 &priv->sbands[IEEE80211_BAND_5GHZ];
238 if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
239 - if (test_bit(ATH9K_MODE_11G, priv->ah->caps.wireless_modes))
240 + if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
242 &priv->sbands[IEEE80211_BAND_2GHZ].ht_cap);
243 - if (test_bit(ATH9K_MODE_11A, priv->ah->caps.wireless_modes))
244 + if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
246 &priv->sbands[IEEE80211_BAND_5GHZ].ht_cap);