1 --- a/drivers/net/wireless/ath/ath9k/hw.c
2 +++ b/drivers/net/wireless/ath/ath9k/hw.c
3 @@ -951,25 +951,60 @@ static bool ath9k_hw_set_global_txtimeou
5 void ath9k_hw_init_global_settings(struct ath_hw *ah)
7 - struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
8 + struct ath_common *common = ath9k_hw_common(ah);
9 + struct ieee80211_conf *conf = &common->hw->conf;
10 + const struct ath9k_channel *chan = ah->curchan;
14 + int rx_lat = 0, tx_lat = 0, eifs = 0;
17 ath_dbg(ath9k_hw_common(ah), ATH_DBG_RESET, "ah->misc_mode 0x%x\n",
23 if (ah->misc_mode != 0)
24 REG_SET_BIT(ah, AR_PCU_MISC, ah->misc_mode);
26 - if (conf->channel && conf->channel->band == IEEE80211_BAND_5GHZ)
33 + if (IS_CHAN_HALF_RATE(chan)) {
37 + if (IS_CHAN_A_FAST_CLOCK(ah, chan))
42 + } else if (IS_CHAN_QUARTER_RATE(chan)) {
46 + if (IS_CHAN_A_FAST_CLOCK(ah, chan))
52 + eifs = REG_READ(ah, AR_D_GBL_IFS_EIFS);
53 + reg = REG_READ(ah, AR_USEC);
54 + rx_lat = MS(reg, AR_USEC_RX_LAT);
55 + tx_lat = MS(reg, AR_USEC_TX_LAT);
57 + slottime = ah->slottime;
58 + if (IS_CHAN_5GHZ(chan))
64 /* As defined by IEEE 802.11-2007 17.3.8.6 */
65 - slottime = ah->slottime + 3 * ah->coverage_class;
66 - acktimeout = slottime + sifstime;
67 + acktimeout = slottime + sifstime + 3 * ah->coverage_class;
70 * Workaround for early ACK timeouts, add an offset to match the
71 @@ -981,11 +1016,19 @@ void ath9k_hw_init_global_settings(struc
72 if (conf->channel && conf->channel->band == IEEE80211_BAND_2GHZ)
73 acktimeout += 64 - sifstime - ah->slottime;
75 - ath9k_hw_setslottime(ah, ah->slottime);
76 + ath9k_hw_setslottime(ah, slottime);
77 ath9k_hw_set_ack_timeout(ah, acktimeout);
78 ath9k_hw_set_cts_timeout(ah, acktimeout);
79 if (ah->globaltxtimeout != (u32) -1)
80 ath9k_hw_set_global_txtimeout(ah, ah->globaltxtimeout);
82 + REG_WRITE(ah, AR_D_GBL_IFS_EIFS, ath9k_hw_mac_to_clks(ah, eifs));
83 + REG_RMW(ah, AR_USEC,
84 + (common->clockrate - 1) |
85 + SM(rx_lat, AR_USEC_RX_LAT) |
86 + SM(tx_lat, AR_USEC_TX_LAT),
87 + AR_USEC_TX_LAT | AR_USEC_RX_LAT | AR_USEC_USEC);
90 EXPORT_SYMBOL(ath9k_hw_init_global_settings);