aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath5k/base.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath5k/base.c')
-rw-r--r--drivers/net/wireless/ath5k/base.c127
1 files changed, 74 insertions, 53 deletions
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)));