aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath9k/main.c')
-rw-r--r--drivers/net/wireless/ath9k/main.c79
1 files changed, 8 insertions, 71 deletions
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 4cf0d26d1392..2888778040e4 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -507,7 +507,13 @@ static int ath9k_config(struct ieee80211_hw *hw,
507 } 507 }
508 508
509 sc->sc_ah->ah_channels[pos].chanmode = 509 sc->sc_ah->ah_channels[pos].chanmode =
510 (curchan->band == IEEE80211_BAND_2GHZ) ? CHANNEL_G : CHANNEL_A; 510 (curchan->band == IEEE80211_BAND_2GHZ) ?
511 CHANNEL_G : CHANNEL_A;
512
513 if (sc->sc_curaid && hw->conf.ht_conf.ht_supported)
514 sc->sc_ah->ah_channels[pos].chanmode =
515 ath_get_extchanmode(sc, curchan);
516
511 sc->sc_config.txpowlimit = 2 * conf->power_level; 517 sc->sc_config.txpowlimit = 2 * conf->power_level;
512 518
513 /* set h/w channel */ 519 /* set h/w channel */
@@ -1145,75 +1151,6 @@ enum ath9k_ht_macmode ath_cwm_macmode(struct ath_softc *sc)
1145 return sc->sc_ht_info.tx_chan_width; 1151 return sc->sc_ht_info.tx_chan_width;
1146} 1152}
1147 1153
1148void ath_setup_rate(struct ath_softc *sc,
1149 enum wireless_mode wMode,
1150 enum RATE_TYPE type,
1151 const struct ath9k_rate_table *rt)
1152{
1153 int i, maxrates, a = 0, b = 0;
1154 struct ieee80211_supported_band *band_2ghz;
1155 struct ieee80211_supported_band *band_5ghz;
1156 struct ieee80211_rate *rates_2ghz;
1157 struct ieee80211_rate *rates_5ghz;
1158
1159 if ((wMode >= WIRELESS_MODE_MAX) || (type != NORMAL_RATE))
1160 return;
1161
1162 band_2ghz = &sc->sbands[IEEE80211_BAND_2GHZ];
1163 band_5ghz = &sc->sbands[IEEE80211_BAND_5GHZ];
1164 rates_2ghz = sc->rates[IEEE80211_BAND_2GHZ];
1165 rates_5ghz = sc->rates[IEEE80211_BAND_5GHZ];
1166
1167 if (rt->rateCount > ATH_RATE_MAX)
1168 maxrates = ATH_RATE_MAX;
1169 else
1170 maxrates = rt->rateCount;
1171
1172 if ((band_2ghz->n_bitrates != 0) && (band_5ghz->n_bitrates != 0)) {
1173 DPRINTF(sc, ATH_DBG_CONFIG,
1174 "%s: Rates already setup\n", __func__);
1175 return;
1176 }
1177
1178 for (i = 0; i < maxrates; i++) {
1179 switch (wMode) {
1180 case WIRELESS_MODE_11b:
1181 case WIRELESS_MODE_11g:
1182 rates_2ghz[a].bitrate = rt->info[i].rateKbps / 100;
1183 rates_2ghz[a].hw_value = rt->info[i].rateCode;
1184 a++;
1185 band_2ghz->n_bitrates = a;
1186 break;
1187 case WIRELESS_MODE_11a:
1188 rates_5ghz[b].bitrate = rt->info[i].rateKbps / 100;
1189 rates_5ghz[b].hw_value = rt->info[i].rateCode;
1190 b++;
1191 band_5ghz->n_bitrates = b;
1192 break;
1193 default:
1194 break;
1195 }
1196 }
1197
1198 if (band_2ghz->n_bitrates) {
1199 for (i = 0; i < band_2ghz->n_bitrates; i++) {
1200 DPRINTF(sc, ATH_DBG_CONFIG,
1201 "%s: 2GHz Rate: %2dMbps, ratecode: %2d\n",
1202 __func__,
1203 rates_2ghz[i].bitrate / 10,
1204 rates_2ghz[i].hw_value);
1205 }
1206 } else if (band_5ghz->n_bitrates) {
1207 for (i = 0; i < band_5ghz->n_bitrates; i++) {
1208 DPRINTF(sc, ATH_DBG_CONFIG,
1209 "%s: 5Ghz Rate: %2dMbps, ratecode: %2d\n",
1210 __func__,
1211 rates_5ghz[i].bitrate / 10,
1212 rates_5ghz[i].hw_value);
1213 }
1214 }
1215}
1216
1217static int ath_detach(struct ath_softc *sc) 1154static int ath_detach(struct ath_softc *sc)
1218{ 1155{
1219 struct ieee80211_hw *hw = sc->hw; 1156 struct ieee80211_hw *hw = sc->hw;
@@ -1275,7 +1212,7 @@ static int ath_attach(u16 devid,
1275 hw->wiphy->bands[IEEE80211_BAND_2GHZ] = 1212 hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
1276 &sc->sbands[IEEE80211_BAND_2GHZ]; 1213 &sc->sbands[IEEE80211_BAND_2GHZ];
1277 1214
1278 if (sc->sc_ah->ah_caps.wireless_modes & ATH9K_MODE_SEL_11A) { 1215 if (test_bit(ATH9K_MODE_11A, sc->sc_ah->ah_caps.wireless_modes)) {
1279 sc->sbands[IEEE80211_BAND_5GHZ].channels = 1216 sc->sbands[IEEE80211_BAND_5GHZ].channels =
1280 sc->channels[IEEE80211_BAND_5GHZ]; 1217 sc->channels[IEEE80211_BAND_5GHZ];
1281 sc->sbands[IEEE80211_BAND_5GHZ].bitrates = 1218 sc->sbands[IEEE80211_BAND_5GHZ].bitrates =