aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@winlab.rutgers.edu>2008-02-03 21:51:49 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-02-29 15:19:37 -0500
commit400ec45a02b2a9ef75c26c490ba80801d19b7e7b (patch)
tree46e284462d150443c173519be9b7e680792f18e7
parentd8ee398d183df36083e41e9162b0cf014f38f482 (diff)
ath5k: Cleanup after API changes
Cleanup after API changes patch (checkpatch.pl stuff) and on ath5k_hw_channel() make use of the existing ath5k_channel_ok() instead of re-implementing the checks again. This was necessary to make the code cleaner and fit the 80-chars wide limit so sending it within the same patch. Finally make a note that we *may* eventually move cap_range stuff to struct wiphy (band frequency range capabilities). This information can later be exported to userspace, for example, and giving it access to mac80211 and drivers in general can come in handy. Changes to initvals.c, phy.c Changes-licensed-under: ISC Changes to ath5k.h, base.c Changes-licensed-under: 3-Clause-BSD Signed-off-by: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath5k/ath5k.h8
-rw-r--r--drivers/net/wireless/ath5k/base.c127
-rw-r--r--drivers/net/wireless/ath5k/initvals.c6
-rw-r--r--drivers/net/wireless/ath5k/phy.c35
4 files changed, 102 insertions, 74 deletions
diff --git a/drivers/net/wireless/ath5k/ath5k.h b/drivers/net/wireless/ath5k/ath5k.h
index 9ea8c549b781..18223d9833f1 100644
--- a/drivers/net/wireless/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath5k/ath5k.h
@@ -263,8 +263,10 @@ enum ath5k_driver_mode {
263/* adding this flag to rate_code enables short preamble, see ar5212_reg.h */ 263/* adding this flag to rate_code enables short preamble, see ar5212_reg.h */
264#define AR5K_SET_SHORT_PREAMBLE 0x04 264#define AR5K_SET_SHORT_PREAMBLE 0x04
265 265
266#define HAS_SHPREAMBLE(_ix) (rt->rates[_ix].modulation == IEEE80211_RATE_SHORT_PREAMBLE) 266#define HAS_SHPREAMBLE(_ix) \
267#define SHPREAMBLE_FLAG(_ix) (HAS_SHPREAMBLE(_ix) ? AR5K_SET_SHORT_PREAMBLE : 0) 267 (rt->rates[_ix].modulation == IEEE80211_RATE_SHORT_PREAMBLE)
268#define SHPREAMBLE_FLAG(_ix) \
269 (HAS_SHPREAMBLE(_ix) ? AR5K_SET_SHORT_PREAMBLE : 0)
268 270
269/****************\ 271/****************\
270 TX DEFINITIONS 272 TX DEFINITIONS
@@ -892,6 +894,8 @@ enum ath5k_capability_type {
892 AR5K_CAP_RFSILENT = 20, /* Supports RFsilent */ 894 AR5K_CAP_RFSILENT = 20, /* Supports RFsilent */
893}; 895};
894 896
897
898/* XXX: we *may* move cap_range stuff to struct wiphy */
895struct ath5k_capabilities { 899struct ath5k_capabilities {
896 /* 900 /*
897 * Supported PHY modes 901 * Supported PHY modes
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 52e55f67b735..e3efd869922f 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -80,7 +80,7 @@ MODULE_AUTHOR("Nick Kossifidis");
80MODULE_DESCRIPTION("Support for 5xxx series of Atheros 802.11 wireless LAN cards."); 80MODULE_DESCRIPTION("Support for 5xxx series of Atheros 802.11 wireless LAN cards.");
81MODULE_SUPPORTED_DEVICE("Atheros 5xxx WLAN cards"); 81MODULE_SUPPORTED_DEVICE("Atheros 5xxx WLAN cards");
82MODULE_LICENSE("Dual BSD/GPL"); 82MODULE_LICENSE("Dual BSD/GPL");
83MODULE_VERSION("0.1.1 (EXPERIMENTAL)"); 83MODULE_VERSION("0.5.0 (EXPERIMENTAL)");
84 84
85 85
86/* Known PCI ids */ 86/* Known PCI ids */
@@ -513,35 +513,46 @@ ath5k_pci_probe(struct pci_dev *pdev,
513 sc->ah->ah_mac_srev, 513 sc->ah->ah_mac_srev,
514 sc->ah->ah_phy_revision); 514 sc->ah->ah_phy_revision);
515 515
516 if(!sc->ah->ah_single_chip){ 516 if (!sc->ah->ah_single_chip) {
517 /* Single chip radio (!RF5111) */ 517 /* Single chip radio (!RF5111) */
518 if(sc->ah->ah_radio_5ghz_revision && !sc->ah->ah_radio_2ghz_revision) { 518 if (sc->ah->ah_radio_5ghz_revision &&
519 !sc->ah->ah_radio_2ghz_revision) {
519 /* No 5GHz support -> report 2GHz radio */ 520 /* No 5GHz support -> report 2GHz radio */
520 if(!test_bit(AR5K_MODE_11A, sc->ah->ah_capabilities.cap_mode)){ 521 if (!test_bit(AR5K_MODE_11A,
522 sc->ah->ah_capabilities.cap_mode)) {
521 ATH5K_INFO(sc, "RF%s 2GHz radio found (0x%x)\n", 523 ATH5K_INFO(sc, "RF%s 2GHz radio found (0x%x)\n",
522 ath5k_chip_name(AR5K_VERSION_RAD,sc->ah->ah_radio_5ghz_revision), 524 ath5k_chip_name(AR5K_VERSION_RAD,
523 sc->ah->ah_radio_5ghz_revision); 525 sc->ah->ah_radio_5ghz_revision),
524 /* No 2GHz support (5110 and some 5Ghz only cards) -> report 5Ghz radio */ 526 sc->ah->ah_radio_5ghz_revision);
525 } else if(!test_bit(AR5K_MODE_11B, sc->ah->ah_capabilities.cap_mode)){ 527 /* No 2GHz support (5110 and some
528 * 5Ghz only cards) -> report 5Ghz radio */
529 } else if (!test_bit(AR5K_MODE_11B,
530 sc->ah->ah_capabilities.cap_mode)) {
526 ATH5K_INFO(sc, "RF%s 5GHz radio found (0x%x)\n", 531 ATH5K_INFO(sc, "RF%s 5GHz radio found (0x%x)\n",
527 ath5k_chip_name(AR5K_VERSION_RAD,sc->ah->ah_radio_5ghz_revision), 532 ath5k_chip_name(AR5K_VERSION_RAD,
528 sc->ah->ah_radio_5ghz_revision); 533 sc->ah->ah_radio_5ghz_revision),
534 sc->ah->ah_radio_5ghz_revision);
529 /* Multiband radio */ 535 /* Multiband radio */
530 } else { 536 } else {
531 ATH5K_INFO(sc, "RF%s multiband radio found" 537 ATH5K_INFO(sc, "RF%s multiband radio found"
532 " (0x%x)\n", 538 " (0x%x)\n",
533 ath5k_chip_name(AR5K_VERSION_RAD,sc->ah->ah_radio_5ghz_revision), 539 ath5k_chip_name(AR5K_VERSION_RAD,
534 sc->ah->ah_radio_5ghz_revision); 540 sc->ah->ah_radio_5ghz_revision),
541 sc->ah->ah_radio_5ghz_revision);
535 } 542 }
536 } 543 }
537 /* Multi chip radio (RF5111 - RF2111) -> report both 2GHz/5GHz radios */ 544 /* Multi chip radio (RF5111 - RF2111) ->
538 else if(sc->ah->ah_radio_5ghz_revision && sc->ah->ah_radio_2ghz_revision){ 545 * report both 2GHz/5GHz radios */
546 else if (sc->ah->ah_radio_5ghz_revision &&
547 sc->ah->ah_radio_2ghz_revision){
539 ATH5K_INFO(sc, "RF%s 5GHz radio found (0x%x)\n", 548 ATH5K_INFO(sc, "RF%s 5GHz radio found (0x%x)\n",
540 ath5k_chip_name(AR5K_VERSION_RAD,sc->ah->ah_radio_5ghz_revision), 549 ath5k_chip_name(AR5K_VERSION_RAD,
541 sc->ah->ah_radio_5ghz_revision); 550 sc->ah->ah_radio_5ghz_revision),
551 sc->ah->ah_radio_5ghz_revision);
542 ATH5K_INFO(sc, "RF%s 2GHz radio found (0x%x)\n", 552 ATH5K_INFO(sc, "RF%s 2GHz radio found (0x%x)\n",
543 ath5k_chip_name(AR5K_VERSION_RAD,sc->ah->ah_radio_2ghz_revision), 553 ath5k_chip_name(AR5K_VERSION_RAD,
544 sc->ah->ah_radio_2ghz_revision); 554 sc->ah->ah_radio_2ghz_revision),
555 sc->ah->ah_radio_2ghz_revision);
545 } 556 }
546 } 557 }
547 558
@@ -891,14 +902,17 @@ ath5k_copy_channels(struct ath5k_hw *ah,
891 902
892 /* Write channel info and increment counter */ 903 /* Write channel info and increment counter */
893 channels[count].center_freq = freq; 904 channels[count].center_freq = freq;
894 905 switch (mode) {
895 if((mode == AR5K_MODE_11A) || 906 case AR5K_MODE_11A:
896 (mode == AR5K_MODE_11G)){ 907 case AR5K_MODE_11G:
897 channels[count].hw_value = chfreq|CHANNEL_OFDM; 908 channels[count].hw_value = chfreq | CHANNEL_OFDM;
898 } else if((mode == AR5K_MODE_11A_TURBO) || 909 break;
899 (mode == AR5K_MODE_11G_TURBO)){ 910 case AR5K_MODE_11A_TURBO:
900 channels[count].hw_value = chfreq|CHANNEL_OFDM|CHANNEL_TURBO; 911 case AR5K_MODE_11G_TURBO:
901 }if(mode == AR5K_MODE_11B) { 912 channels[count].hw_value = chfreq |
913 CHANNEL_OFDM | CHANNEL_TURBO;
914 break;
915 case AR5K_MODE_11B:
902 channels[count].hw_value = CHANNEL_B; 916 channels[count].hw_value = CHANNEL_B;
903 } 917 }
904 918
@@ -926,15 +940,16 @@ ath5k_getchannels(struct ieee80211_hw *hw)
926 count_r = count_c = 0; 940 count_r = count_c = 0;
927 941
928 /* 2GHz band */ 942 /* 2GHz band */
929 if(!test_bit(AR5K_MODE_11G, sc->ah->ah_capabilities.cap_mode)){ 943 if (!test_bit(AR5K_MODE_11G, sc->ah->ah_capabilities.cap_mode)) {
930 mode2g = AR5K_MODE_11B; 944 mode2g = AR5K_MODE_11B;
931 if(!test_bit(AR5K_MODE_11B, sc->ah->ah_capabilities.cap_mode)){ 945 if (!test_bit(AR5K_MODE_11B,
946 sc->ah->ah_capabilities.cap_mode))
932 mode2g = -1; 947 mode2g = -1;
933 }
934 } 948 }
935 949
936 if(mode2g > 0){ 950 if (mode2g > 0) {
937 struct ieee80211_supported_band *sband = &sbands[IEEE80211_BAND_2GHZ]; 951 struct ieee80211_supported_band *sband =
952 &sbands[IEEE80211_BAND_2GHZ];
938 953
939 sband->bitrates = sc->rates; 954 sband->bitrates = sc->rates;
940 sband->channels = sc->channels; 955 sband->channels = sc->channels;
@@ -945,7 +960,7 @@ ath5k_getchannels(struct ieee80211_hw *hw)
945 960
946 hw_rates = ath5k_hw_get_rate_table(ah, mode2g); 961 hw_rates = ath5k_hw_get_rate_table(ah, mode2g);
947 sband->n_bitrates = ath5k_copy_rates(sband->bitrates, 962 sband->n_bitrates = ath5k_copy_rates(sband->bitrates,
948 hw_rates,max_r); 963 hw_rates, max_r);
949 964
950 count_c = sband->n_channels; 965 count_c = sband->n_channels;
951 count_r = sband->n_bitrates; 966 count_r = sband->n_bitrates;
@@ -959,8 +974,9 @@ ath5k_getchannels(struct ieee80211_hw *hw)
959 974
960 /* 5GHz band */ 975 /* 5GHz band */
961 976
962 if(test_bit(AR5K_MODE_11A, sc->ah->ah_capabilities.cap_mode)){ 977 if (test_bit(AR5K_MODE_11A, sc->ah->ah_capabilities.cap_mode)) {
963 struct ieee80211_supported_band *sband = &sbands[IEEE80211_BAND_5GHZ]; 978 struct ieee80211_supported_band *sband =
979 &sbands[IEEE80211_BAND_5GHZ];
964 980
965 sband->bitrates = &sc->rates[count_r]; 981 sband->bitrates = &sc->rates[count_r];
966 sband->channels = &sc->channels[count_c]; 982 sband->channels = &sc->channels[count_c];
@@ -971,7 +987,7 @@ ath5k_getchannels(struct ieee80211_hw *hw)
971 987
972 hw_rates = ath5k_hw_get_rate_table(ah, AR5K_MODE_11A); 988 hw_rates = ath5k_hw_get_rate_table(ah, AR5K_MODE_11A);
973 sband->n_bitrates = ath5k_copy_rates(sband->bitrates, 989 sband->n_bitrates = ath5k_copy_rates(sband->bitrates,
974 hw_rates,max_r); 990 hw_rates, max_r);
975 991
976 hw->wiphy->bands[IEEE80211_BAND_5GHZ] = sband; 992 hw->wiphy->bands[IEEE80211_BAND_5GHZ] = sband;
977 } 993 }
@@ -1109,7 +1125,7 @@ ath5k_setcurmode(struct ath5k_softc *sc, unsigned int mode)
1109 1125
1110 sc->curmode = mode; 1126 sc->curmode = mode;
1111 1127
1112 if(mode == AR5K_MODE_11A){ 1128 if (mode == AR5K_MODE_11A) {
1113 sc->curband = &sc->sbands[IEEE80211_BAND_5GHZ]; 1129 sc->curband = &sc->sbands[IEEE80211_BAND_5GHZ];
1114 } else { 1130 } else {
1115 sc->curband = &sc->sbands[IEEE80211_BAND_2GHZ]; 1131 sc->curband = &sc->sbands[IEEE80211_BAND_2GHZ];
@@ -1161,43 +1177,43 @@ ath5k_mode_setup(struct ath5k_softc *sc)
1161 * When hw returns eg. 27 it points to the last 802.11g rate (54Mbits) etc 1177 * When hw returns eg. 27 it points to the last 802.11g rate (54Mbits) etc
1162 */ 1178 */
1163static void 1179static void
1164ath5k_set_total_hw_rates(struct ath5k_softc *sc){ 1180ath5k_set_total_hw_rates(struct ath5k_softc *sc) {
1165 1181
1166 struct ath5k_hw *ah = sc->ah; 1182 struct ath5k_hw *ah = sc->ah;
1167 1183
1168 if(test_bit(AR5K_MODE_11A, ah->ah_modes)) 1184 if (test_bit(AR5K_MODE_11A, ah->ah_modes))
1169 sc->a_rates = 8; 1185 sc->a_rates = 8;
1170 1186
1171 if(test_bit(AR5K_MODE_11B, ah->ah_modes)) 1187 if (test_bit(AR5K_MODE_11B, ah->ah_modes))
1172 sc->b_rates = 4; 1188 sc->b_rates = 4;
1173 1189
1174 if(test_bit(AR5K_MODE_11G, ah->ah_modes)) 1190 if (test_bit(AR5K_MODE_11G, ah->ah_modes))
1175 sc->g_rates = 12; 1191 sc->g_rates = 12;
1176 1192
1177 /* XXX: Need to see what what happens when 1193 /* XXX: Need to see what what happens when
1178 xr disable bits in eeprom are set */ 1194 xr disable bits in eeprom are set */
1179 if(ah->ah_version >= AR5K_AR5212) 1195 if (ah->ah_version >= AR5K_AR5212)
1180 sc->xr_rates = 4; 1196 sc->xr_rates = 4;
1181 1197
1182} 1198}
1183 1199
1184static inline int 1200static inline int
1185ath5k_hw_to_driver_rix(struct ath5k_softc *sc, int hw_rix){ 1201ath5k_hw_to_driver_rix(struct ath5k_softc *sc, int hw_rix) {
1186 1202
1187 int mac80211_rix; 1203 int mac80211_rix;
1188 1204
1189 if(sc->curband->band == IEEE80211_BAND_2GHZ){ 1205 if(sc->curband->band == IEEE80211_BAND_2GHZ) {
1190 /* We setup a g ratetable for both b/g modes */ 1206 /* We setup a g ratetable for both b/g modes */
1191 mac80211_rix = hw_rix - sc->b_rates - sc->a_rates - sc->xr_rates; 1207 mac80211_rix =
1208 hw_rix - sc->b_rates - sc->a_rates - sc->xr_rates;
1192 } else { 1209 } else {
1193 mac80211_rix = hw_rix - sc->xr_rates; 1210 mac80211_rix = hw_rix - sc->xr_rates;
1194 } 1211 }
1195 1212
1196 /* Something went wrong, fallback to basic rate for this band */ 1213 /* Something went wrong, fallback to basic rate for this band */
1197 if((mac80211_rix >= sc->curband->n_bitrates) || 1214 if ((mac80211_rix >= sc->curband->n_bitrates) ||
1198 (mac80211_rix <= 0 )){ 1215 (mac80211_rix <= 0 ))
1199 mac80211_rix = 1; 1216 mac80211_rix = 1;
1200 }
1201 1217
1202 return mac80211_rix; 1218 return mac80211_rix;
1203} 1219}
@@ -1306,7 +1322,8 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
1306 1322
1307 ret = ah->ah_setup_tx_desc(ah, ds, pktlen, 1323 ret = ah->ah_setup_tx_desc(ah, ds, pktlen,
1308 ieee80211_get_hdrlen_from_skb(skb), AR5K_PKT_TYPE_NORMAL, 1324 ieee80211_get_hdrlen_from_skb(skb), AR5K_PKT_TYPE_NORMAL,
1309 (sc->power_level * 2), ctl->tx_rate->hw_value, ctl->retry_limit, keyidx, 0, flags, 0, 0); 1325 (sc->power_level * 2), ctl->tx_rate->hw_value,
1326 ctl->retry_limit, keyidx, 0, flags, 0, 0);
1310 if (ret) 1327 if (ret)
1311 goto err_unmap; 1328 goto err_unmap;
1312 1329
@@ -1848,7 +1865,8 @@ accept:
1848 rxs.signal = ds->ds_rxstat.rs_rssi * 100 / 64; 1865 rxs.signal = ds->ds_rxstat.rs_rssi * 100 / 64;
1849 1866
1850 rxs.antenna = ds->ds_rxstat.rs_antenna; 1867 rxs.antenna = ds->ds_rxstat.rs_antenna;
1851 rxs.rate_idx = ath5k_hw_to_driver_rix(sc,ds->ds_rxstat.rs_rate); 1868 rxs.rate_idx = ath5k_hw_to_driver_rix(sc,
1869 ds->ds_rxstat.rs_rate);
1852 rxs.flag |= ath5k_rx_decrypted(sc, ds, skb); 1870 rxs.flag |= ath5k_rx_decrypted(sc, ds, skb);
1853 1871
1854 ath5k_debug_dump_skb(sc, skb, "RX ", 0); 1872 ath5k_debug_dump_skb(sc, skb, "RX ", 0);
@@ -1995,8 +2013,9 @@ ath5k_beacon_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
1995 ds->ds_data = bf->skbaddr; 2013 ds->ds_data = bf->skbaddr;
1996 ret = ah->ah_setup_tx_desc(ah, ds, skb->len, 2014 ret = ah->ah_setup_tx_desc(ah, ds, skb->len,
1997 ieee80211_get_hdrlen_from_skb(skb), 2015 ieee80211_get_hdrlen_from_skb(skb),
1998 AR5K_PKT_TYPE_BEACON, (sc->power_level * 2), ctl->tx_rate->hw_value, 1, 2016 AR5K_PKT_TYPE_BEACON, (sc->power_level * 2),
1999 AR5K_TXKEYIX_INVALID, antenna, flags, 0, 0); 2017 ctl->tx_rate->hw_value, 1, AR5K_TXKEYIX_INVALID,
2018 antenna, flags, 0, 0);
2000 if (ret) 2019 if (ret)
2001 goto err_unmap; 2020 goto err_unmap;
2002 2021
@@ -2486,7 +2505,8 @@ ath5k_calibrate(unsigned long data)
2486 struct ath5k_hw *ah = sc->ah; 2505 struct ath5k_hw *ah = sc->ah;
2487 2506
2488 ATH5K_DBG(sc, ATH5K_DEBUG_CALIBRATE, "channel %u/%x\n", 2507 ATH5K_DBG(sc, ATH5K_DEBUG_CALIBRATE, "channel %u/%x\n",
2489 ieee80211_frequency_to_channel(sc->curchan->center_freq), sc->curchan->hw_value); 2508 ieee80211_frequency_to_channel(sc->curchan->center_freq),
2509 sc->curchan->hw_value);
2490 2510
2491 if (ath5k_hw_get_rf_gain(ah) == AR5K_RFGAIN_NEED_CHANGE) { 2511 if (ath5k_hw_get_rf_gain(ah) == AR5K_RFGAIN_NEED_CHANGE) {
2492 /* 2512 /*
@@ -2498,7 +2518,8 @@ ath5k_calibrate(unsigned long data)
2498 } 2518 }
2499 if (ath5k_hw_phy_calibrate(ah, sc->curchan)) 2519 if (ath5k_hw_phy_calibrate(ah, sc->curchan))
2500 ATH5K_ERR(sc, "calibration of channel %u failed\n", 2520 ATH5K_ERR(sc, "calibration of channel %u failed\n",
2501 ieee80211_frequency_to_channel(sc->curchan->center_freq)); 2521 ieee80211_frequency_to_channel(
2522 sc->curchan->center_freq));
2502 2523
2503 mod_timer(&sc->calib_tim, round_jiffies(jiffies + 2524 mod_timer(&sc->calib_tim, round_jiffies(jiffies +
2504 msecs_to_jiffies(ath5k_calinterval * 1000))); 2525 msecs_to_jiffies(ath5k_calinterval * 1000)));
diff --git a/drivers/net/wireless/ath5k/initvals.c b/drivers/net/wireless/ath5k/initvals.c
index a255d8bfa949..cfcb1fe7bd34 100644
--- a/drivers/net/wireless/ath5k/initvals.c
+++ b/drivers/net/wireless/ath5k/initvals.c
@@ -1317,8 +1317,10 @@ int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel)
1317 /* For AR5211 */ 1317 /* For AR5211 */
1318 } else if (ah->ah_version == AR5K_AR5211) { 1318 } else if (ah->ah_version == AR5K_AR5211) {
1319 1319
1320 if(mode > 2){ /* AR5K_MODE_11B */ 1320 /* AR5K_MODE_11B */
1321 ATH5K_ERR(ah->ah_sc,"unsupported channel mode: %d\n", mode); 1321 if (mode > 2) {
1322 ATH5K_ERR(ah->ah_sc,
1323 "unsupported channel mode: %d\n", mode);
1322 return -EINVAL; 1324 return -EINVAL;
1323 } 1325 }
1324 1326
diff --git a/drivers/net/wireless/ath5k/phy.c b/drivers/net/wireless/ath5k/phy.c
index 8b576b314cf5..248c0f545f24 100644
--- a/drivers/net/wireless/ath5k/phy.c
+++ b/drivers/net/wireless/ath5k/phy.c
@@ -1124,7 +1124,7 @@ static int ath5k_hw_rf5112_rfregs(struct ath5k_hw *ah,
1124 rf = ah->ah_rf_banks; 1124 rf = ah->ah_rf_banks;
1125 1125
1126 if (ah->ah_radio_5ghz_revision >= AR5K_SREV_RAD_2112A 1126 if (ah->ah_radio_5ghz_revision >= AR5K_SREV_RAD_2112A
1127 && !test_bit(AR5K_MODE_11A, ah->ah_capabilities.cap_mode)){ 1127 && !test_bit(AR5K_MODE_11A, ah->ah_capabilities.cap_mode)) {
1128 rf_ini = rfregs_2112a; 1128 rf_ini = rfregs_2112a;
1129 rf_size = ARRAY_SIZE(rfregs_5112a); 1129 rf_size = ARRAY_SIZE(rfregs_5112a);
1130 if (mode < 2) { 1130 if (mode < 2) {
@@ -1445,9 +1445,10 @@ static u32 ath5k_hw_rf5110_chan2athchan(struct ieee80211_channel *channel)
1445 * newer chipsets like the AR5212A who have a completely 1445 * newer chipsets like the AR5212A who have a completely
1446 * different RF/PHY part. 1446 * different RF/PHY part.
1447 */ 1447 */
1448 athchan = (ath5k_hw_bitswap((ieee80211_frequency_to_channel(channel->center_freq) - 24) / 2, 5) << 1) | 1448 athchan = (ath5k_hw_bitswap(
1449 (1 << 6) | 0x1; 1449 (ieee80211_frequency_to_channel(
1450 1450 channel->center_freq) - 24) / 2, 5)
1451 << 1) | (1 << 6) | 0x1;
1451 return athchan; 1452 return athchan;
1452} 1453}
1453 1454
@@ -1506,7 +1507,8 @@ static int ath5k_hw_rf5111_channel(struct ath5k_hw *ah,
1506 struct ieee80211_channel *channel) 1507 struct ieee80211_channel *channel)
1507{ 1508{
1508 struct ath5k_athchan_2ghz ath5k_channel_2ghz; 1509 struct ath5k_athchan_2ghz ath5k_channel_2ghz;
1509 unsigned int ath5k_channel = ieee80211_frequency_to_channel(channel->center_freq); 1510 unsigned int ath5k_channel =
1511 ieee80211_frequency_to_channel(channel->center_freq);
1510 u32 data0, data1, clock; 1512 u32 data0, data1, clock;
1511 int ret; 1513 int ret;
1512 1514
@@ -1517,8 +1519,9 @@ static int ath5k_hw_rf5111_channel(struct ath5k_hw *ah,
1517 1519
1518 if (channel->hw_value & CHANNEL_2GHZ) { 1520 if (channel->hw_value & CHANNEL_2GHZ) {
1519 /* Map 2GHz channel to 5GHz Atheros channel ID */ 1521 /* Map 2GHz channel to 5GHz Atheros channel ID */
1520 ret = ath5k_hw_rf5111_chan2athchan(ieee80211_frequency_to_channel(channel->center_freq), 1522 ret = ath5k_hw_rf5111_chan2athchan(
1521 &ath5k_channel_2ghz); 1523 ieee80211_frequency_to_channel(channel->center_freq),
1524 &ath5k_channel_2ghz);
1522 if (ret) 1525 if (ret)
1523 return ret; 1526 return ret;
1524 1527
@@ -1599,19 +1602,17 @@ static int ath5k_hw_rf5112_channel(struct ath5k_hw *ah,
1599int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel) 1602int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel)
1600{ 1603{
1601 int ret; 1604 int ret;
1602
1603 /* 1605 /*
1604 * Check bounds supported by the PHY 1606 * Check bounds supported by the PHY (we don't care about regultory
1605 * (don't care about regulation restrictions at this point) 1607 * restrictions at this point). Note: hw_value already has the band
1606 */ 1608 * (CHANNEL_2GHZ, or CHANNEL_5GHZ) so we inform ath5k_channel_ok()
1607 if ((channel->center_freq < ah->ah_capabilities.cap_range.range_2ghz_min || 1609 * of the band by that */
1608 channel->center_freq > ah->ah_capabilities.cap_range.range_2ghz_max) && 1610 if (!ath5k_channel_ok(ah, channel->center_freq, channel->hw_value)) {
1609 (channel->center_freq < ah->ah_capabilities.cap_range.range_5ghz_min ||
1610 channel->center_freq > ah->ah_capabilities.cap_range.range_5ghz_max)) {
1611 ATH5K_ERR(ah->ah_sc, 1611 ATH5K_ERR(ah->ah_sc,
1612 "channel out of supported range (%u MHz)\n", 1612 "channel frequency (%u MHz) out of supported "
1613 "band range\n",
1613 channel->center_freq); 1614 channel->center_freq);
1614 return -EINVAL; 1615 return -EINVAL;
1615 } 1616 }
1616 1617
1617 /* 1618 /*