aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath5k/pcu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/pcu.c')
-rw-r--r--drivers/net/wireless/ath/ath5k/pcu.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/net/wireless/ath/ath5k/pcu.c b/drivers/net/wireless/ath/ath5k/pcu.c
index 618ee54d5fe..06731384506 100644
--- a/drivers/net/wireless/ath/ath5k/pcu.c
+++ b/drivers/net/wireless/ath/ath5k/pcu.c
@@ -77,14 +77,13 @@ static const unsigned int ack_rates_high[] =
77int ath5k_hw_get_frame_duration(struct ath5k_hw *ah, 77int ath5k_hw_get_frame_duration(struct ath5k_hw *ah,
78 int len, struct ieee80211_rate *rate, bool shortpre) 78 int len, struct ieee80211_rate *rate, bool shortpre)
79{ 79{
80 struct ath5k_softc *sc = ah->ah_sc;
81 int sifs, preamble, plcp_bits, sym_time; 80 int sifs, preamble, plcp_bits, sym_time;
82 int bitrate, bits, symbols, symbol_bits; 81 int bitrate, bits, symbols, symbol_bits;
83 int dur; 82 int dur;
84 83
85 /* Fallback */ 84 /* Fallback */
86 if (!ah->ah_bwmode) { 85 if (!ah->ah_bwmode) {
87 __le16 raw_dur = ieee80211_generic_frame_duration(sc->hw, 86 __le16 raw_dur = ieee80211_generic_frame_duration(ah->hw,
88 NULL, len, rate); 87 NULL, len, rate);
89 88
90 /* subtract difference between long and short preamble */ 89 /* subtract difference between long and short preamble */
@@ -205,7 +204,7 @@ unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah)
205 */ 204 */
206void ath5k_hw_update_mib_counters(struct ath5k_hw *ah) 205void ath5k_hw_update_mib_counters(struct ath5k_hw *ah)
207{ 206{
208 struct ath5k_statistics *stats = &ah->ah_sc->stats; 207 struct ath5k_statistics *stats = &ah->stats;
209 208
210 /* Read-And-Clear */ 209 /* Read-And-Clear */
211 stats->ack_fail += ath5k_hw_reg_read(ah, AR5K_ACK_FAIL); 210 stats->ack_fail += ath5k_hw_reg_read(ah, AR5K_ACK_FAIL);
@@ -240,25 +239,24 @@ void ath5k_hw_update_mib_counters(struct ath5k_hw *ah)
240 */ 239 */
241static inline void ath5k_hw_write_rate_duration(struct ath5k_hw *ah) 240static inline void ath5k_hw_write_rate_duration(struct ath5k_hw *ah)
242{ 241{
243 struct ath5k_softc *sc = ah->ah_sc;
244 struct ieee80211_rate *rate; 242 struct ieee80211_rate *rate;
245 unsigned int i; 243 unsigned int i;
246 /* 802.11g covers both OFDM and CCK */ 244 /* 802.11g covers both OFDM and CCK */
247 u8 band = IEEE80211_BAND_2GHZ; 245 u8 band = IEEE80211_BAND_2GHZ;
248 246
249 /* Write rate duration table */ 247 /* Write rate duration table */
250 for (i = 0; i < sc->sbands[band].n_bitrates; i++) { 248 for (i = 0; i < ah->sbands[band].n_bitrates; i++) {
251 u32 reg; 249 u32 reg;
252 u16 tx_time; 250 u16 tx_time;
253 251
254 if (ah->ah_ack_bitrate_high) 252 if (ah->ah_ack_bitrate_high)
255 rate = &sc->sbands[band].bitrates[ack_rates_high[i]]; 253 rate = &ah->sbands[band].bitrates[ack_rates_high[i]];
256 /* CCK -> 1Mb */ 254 /* CCK -> 1Mb */
257 else if (i < 4) 255 else if (i < 4)
258 rate = &sc->sbands[band].bitrates[0]; 256 rate = &ah->sbands[band].bitrates[0];
259 /* OFDM -> 6Mb */ 257 /* OFDM -> 6Mb */
260 else 258 else
261 rate = &sc->sbands[band].bitrates[4]; 259 rate = &ah->sbands[band].bitrates[4];
262 260
263 /* Set ACK timeout */ 261 /* Set ACK timeout */
264 reg = AR5K_RATE_DUR(rate->hw_value); 262 reg = AR5K_RATE_DUR(rate->hw_value);
@@ -586,7 +584,7 @@ void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval)
586 /* 584 /*
587 * Set the additional timers by mode 585 * Set the additional timers by mode
588 */ 586 */
589 switch (ah->ah_sc->opmode) { 587 switch (ah->opmode) {
590 case NL80211_IFTYPE_MONITOR: 588 case NL80211_IFTYPE_MONITOR:
591 case NL80211_IFTYPE_STATION: 589 case NL80211_IFTYPE_STATION:
592 /* In STA mode timer1 is used as next wakeup 590 /* In STA mode timer1 is used as next wakeup
@@ -623,8 +621,8 @@ void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval)
623 * Set the beacon register and enable all timers. 621 * Set the beacon register and enable all timers.
624 */ 622 */
625 /* When in AP or Mesh Point mode zero timer0 to start TSF */ 623 /* When in AP or Mesh Point mode zero timer0 to start TSF */
626 if (ah->ah_sc->opmode == NL80211_IFTYPE_AP || 624 if (ah->opmode == NL80211_IFTYPE_AP ||
627 ah->ah_sc->opmode == NL80211_IFTYPE_MESH_POINT) 625 ah->opmode == NL80211_IFTYPE_MESH_POINT)
628 ath5k_hw_reg_write(ah, 0, AR5K_TIMER0); 626 ath5k_hw_reg_write(ah, 0, AR5K_TIMER0);
629 627
630 ath5k_hw_reg_write(ah, next_beacon, AR5K_TIMER0); 628 ath5k_hw_reg_write(ah, next_beacon, AR5K_TIMER0);
@@ -814,7 +812,7 @@ int ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype op_mode)
814 struct ath_common *common = ath5k_hw_common(ah); 812 struct ath_common *common = ath5k_hw_common(ah);
815 u32 pcu_reg, beacon_reg, low_id, high_id; 813 u32 pcu_reg, beacon_reg, low_id, high_id;
816 814
817 ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_MODE, "mode %d\n", op_mode); 815 ATH5K_DBG(ah, ATH5K_DEBUG_MODE, "mode %d\n", op_mode);
818 816
819 /* Preserve rest settings */ 817 /* Preserve rest settings */
820 pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000; 818 pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000;
@@ -890,7 +888,7 @@ void ath5k_hw_pcu_init(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
890 * XXX: rethink this after new mode changes to 888 * XXX: rethink this after new mode changes to
891 * mac80211 are integrated */ 889 * mac80211 are integrated */
892 if (ah->ah_version == AR5K_AR5212 && 890 if (ah->ah_version == AR5K_AR5212 &&
893 ah->ah_sc->nvifs) 891 ah->nvifs)
894 ath5k_hw_write_rate_duration(ah); 892 ath5k_hw_write_rate_duration(ah);
895 893
896 /* Set RSSI/BRSSI thresholds 894 /* Set RSSI/BRSSI thresholds