aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath
diff options
context:
space:
mode:
authorKalle Valo <kvalo@qca.qualcomm.com>2012-03-26 09:26:56 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2012-03-26 09:26:56 -0400
commit0564161ea902c6c3e7e45ffd2df37bcb0d235acb (patch)
tree073cefc403e1ec5a8a267fc98130ac6d9191dc5c /drivers/net/wireless/ath
parent40abc2defbca6a6d7fde49082586430350d0a535 (diff)
parent377526578f2c343ea281a918b18ece1fca65005c (diff)
Merge remote branch 'wireless-next/master' into ath6kl-next
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r--drivers/net/wireless/ath/ath.h26
-rw-r--r--drivers/net/wireless/ath/ath5k/ath5k.h1
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c20
-rw-r--r--drivers/net/wireless/ath/ath5k/mac80211-ops.c4
-rw-r--r--drivers/net/wireless/ath/ath5k/phy.c34
-rw-r--r--drivers/net/wireless/ath/ath6kl/wmi.c6
-rw-r--r--drivers/net/wireless/ath/ath9k/Kconfig8
-rw-r--r--drivers/net/wireless/ath/ath9k/ar5008_phy.c21
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_hw.c50
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_initvals.h6
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_mac.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_phy.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h302
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_hw.c25
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_mac.c26
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_phy.c19
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h24
-rw-r--r--drivers/net/wireless/ath/ath9k/beacon.c14
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.c45
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.h27
-rw-r--r--drivers/net/wireless/ath/ath9k/gpio.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_main.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c150
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h16
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c20
-rw-r--r--drivers/net/wireless/ath/ath9k/mac.c42
-rw-r--r--drivers/net/wireless/ath/ath9k/mac.h4
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c56
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c14
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c70
-rw-r--r--drivers/net/wireless/ath/ath9k/reg.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c40
-rw-r--r--drivers/net/wireless/ath/main.c9
34 files changed, 345 insertions, 748 deletions
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
index efc01110dc34..c54b7d37bff1 100644
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -174,28 +174,24 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry);
174void ath_hw_cycle_counters_update(struct ath_common *common); 174void ath_hw_cycle_counters_update(struct ath_common *common);
175int32_t ath_hw_get_listen_time(struct ath_common *common); 175int32_t ath_hw_get_listen_time(struct ath_common *common);
176 176
177extern __printf(2, 3) void ath_printk(const char *level, const char *fmt, ...); 177__printf(3, 4)
178 178void ath_printk(const char *level, const struct ath_common *common,
179#define _ath_printk(level, common, fmt, ...) \ 179 const char *fmt, ...);
180do { \
181 __always_unused struct ath_common *unused = common; \
182 ath_printk(level, fmt, ##__VA_ARGS__); \
183} while (0)
184 180
185#define ath_emerg(common, fmt, ...) \ 181#define ath_emerg(common, fmt, ...) \
186 _ath_printk(KERN_EMERG, common, fmt, ##__VA_ARGS__) 182 ath_printk(KERN_EMERG, common, fmt, ##__VA_ARGS__)
187#define ath_alert(common, fmt, ...) \ 183#define ath_alert(common, fmt, ...) \
188 _ath_printk(KERN_ALERT, common, fmt, ##__VA_ARGS__) 184 ath_printk(KERN_ALERT, common, fmt, ##__VA_ARGS__)
189#define ath_crit(common, fmt, ...) \ 185#define ath_crit(common, fmt, ...) \
190 _ath_printk(KERN_CRIT, common, fmt, ##__VA_ARGS__) 186 ath_printk(KERN_CRIT, common, fmt, ##__VA_ARGS__)
191#define ath_err(common, fmt, ...) \ 187#define ath_err(common, fmt, ...) \
192 _ath_printk(KERN_ERR, common, fmt, ##__VA_ARGS__) 188 ath_printk(KERN_ERR, common, fmt, ##__VA_ARGS__)
193#define ath_warn(common, fmt, ...) \ 189#define ath_warn(common, fmt, ...) \
194 _ath_printk(KERN_WARNING, common, fmt, ##__VA_ARGS__) 190 ath_printk(KERN_WARNING, common, fmt, ##__VA_ARGS__)
195#define ath_notice(common, fmt, ...) \ 191#define ath_notice(common, fmt, ...) \
196 _ath_printk(KERN_NOTICE, common, fmt, ##__VA_ARGS__) 192 ath_printk(KERN_NOTICE, common, fmt, ##__VA_ARGS__)
197#define ath_info(common, fmt, ...) \ 193#define ath_info(common, fmt, ...) \
198 _ath_printk(KERN_INFO, common, fmt, ##__VA_ARGS__) 194 ath_printk(KERN_INFO, common, fmt, ##__VA_ARGS__)
199 195
200/** 196/**
201 * enum ath_debug_level - atheros wireless debug level 197 * enum ath_debug_level - atheros wireless debug level
@@ -256,7 +252,7 @@ enum ATH_DEBUG {
256#define ath_dbg(common, dbg_mask, fmt, ...) \ 252#define ath_dbg(common, dbg_mask, fmt, ...) \
257do { \ 253do { \
258 if ((common)->debug_mask & ATH_DBG_##dbg_mask) \ 254 if ((common)->debug_mask & ATH_DBG_##dbg_mask) \
259 _ath_printk(KERN_DEBUG, common, fmt, ##__VA_ARGS__); \ 255 ath_printk(KERN_DEBUG, common, fmt, ##__VA_ARGS__); \
260} while (0) 256} while (0)
261 257
262#define ATH_DBG_WARN(foo, arg...) WARN(foo, arg) 258#define ATH_DBG_WARN(foo, arg...) WARN(foo, arg)
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index 6640326f7005..8d434b8f5855 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -1320,6 +1320,7 @@ struct ath5k_hw {
1320 struct ieee80211_vif *bslot[ATH_BCBUF]; 1320 struct ieee80211_vif *bslot[ATH_BCBUF];
1321 u16 num_ap_vifs; 1321 u16 num_ap_vifs;
1322 u16 num_adhoc_vifs; 1322 u16 num_adhoc_vifs;
1323 u16 num_mesh_vifs;
1323 unsigned int bhalq, /* SW q for outgoing beacons */ 1324 unsigned int bhalq, /* SW q for outgoing beacons */
1324 bmisscount, /* missed beacon transmits */ 1325 bmisscount, /* missed beacon transmits */
1325 bintval, /* beacon interval in TU */ 1326 bintval, /* beacon interval in TU */
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index a339693fbe26..0e643b016b32 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -1867,7 +1867,8 @@ ath5k_beacon_send(struct ath5k_hw *ah)
1867 ah->bmisscount = 0; 1867 ah->bmisscount = 0;
1868 } 1868 }
1869 1869
1870 if ((ah->opmode == NL80211_IFTYPE_AP && ah->num_ap_vifs > 1) || 1870 if ((ah->opmode == NL80211_IFTYPE_AP && ah->num_ap_vifs +
1871 ah->num_mesh_vifs > 1) ||
1871 ah->opmode == NL80211_IFTYPE_MESH_POINT) { 1872 ah->opmode == NL80211_IFTYPE_MESH_POINT) {
1872 u64 tsf = ath5k_hw_get_tsf64(ah); 1873 u64 tsf = ath5k_hw_get_tsf64(ah);
1873 u32 tsftu = TSF_TO_TU(tsf); 1874 u32 tsftu = TSF_TO_TU(tsf);
@@ -1952,7 +1953,8 @@ ath5k_beacon_update_timers(struct ath5k_hw *ah, u64 bc_tsf)
1952 u64 hw_tsf; 1953 u64 hw_tsf;
1953 1954
1954 intval = ah->bintval & AR5K_BEACON_PERIOD; 1955 intval = ah->bintval & AR5K_BEACON_PERIOD;
1955 if (ah->opmode == NL80211_IFTYPE_AP && ah->num_ap_vifs > 1) { 1956 if (ah->opmode == NL80211_IFTYPE_AP && ah->num_ap_vifs
1957 + ah->num_mesh_vifs > 1) {
1956 intval /= ATH_BCBUF; /* staggered multi-bss beacons */ 1958 intval /= ATH_BCBUF; /* staggered multi-bss beacons */
1957 if (intval < 15) 1959 if (intval < 15)
1958 ATH5K_WARN(ah, "intval %u is too low, min 15\n", 1960 ATH5K_WARN(ah, "intval %u is too low, min 15\n",
@@ -2330,15 +2332,6 @@ ath5k_calibrate_work(struct work_struct *work)
2330 "got new rfgain, resetting\n"); 2332 "got new rfgain, resetting\n");
2331 ieee80211_queue_work(ah->hw, &ah->reset_work); 2333 ieee80211_queue_work(ah->hw, &ah->reset_work);
2332 } 2334 }
2333
2334 /* TODO: On full calibration we should stop TX here,
2335 * so that it doesn't interfere (mostly due to gain_f
2336 * calibration that messes with tx packets -see phy.c).
2337 *
2338 * NOTE: Stopping the queues from above is not enough
2339 * to stop TX but saves us from disconecting (at least
2340 * we don't lose packets). */
2341 ieee80211_stop_queues(ah->hw);
2342 } else 2335 } else
2343 ah->ah_cal_mask |= AR5K_CALIBRATION_SHORT; 2336 ah->ah_cal_mask |= AR5K_CALIBRATION_SHORT;
2344 2337
@@ -2353,10 +2346,9 @@ ath5k_calibrate_work(struct work_struct *work)
2353 ah->curchan->center_freq)); 2346 ah->curchan->center_freq));
2354 2347
2355 /* Clear calibration flags */ 2348 /* Clear calibration flags */
2356 if (ah->ah_cal_mask & AR5K_CALIBRATION_FULL) { 2349 if (ah->ah_cal_mask & AR5K_CALIBRATION_FULL)
2357 ieee80211_wake_queues(ah->hw);
2358 ah->ah_cal_mask &= ~AR5K_CALIBRATION_FULL; 2350 ah->ah_cal_mask &= ~AR5K_CALIBRATION_FULL;
2359 } else if (ah->ah_cal_mask & AR5K_CALIBRATION_SHORT) 2351 else if (ah->ah_cal_mask & AR5K_CALIBRATION_SHORT)
2360 ah->ah_cal_mask &= ~AR5K_CALIBRATION_SHORT; 2352 ah->ah_cal_mask &= ~AR5K_CALIBRATION_SHORT;
2361} 2353}
2362 2354
diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
index af4c7ecb4b30..5c5329955414 100644
--- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c
+++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
@@ -134,6 +134,8 @@ ath5k_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
134 ah->num_ap_vifs++; 134 ah->num_ap_vifs++;
135 else if (avf->opmode == NL80211_IFTYPE_ADHOC) 135 else if (avf->opmode == NL80211_IFTYPE_ADHOC)
136 ah->num_adhoc_vifs++; 136 ah->num_adhoc_vifs++;
137 else if (avf->opmode == NL80211_IFTYPE_MESH_POINT)
138 ah->num_mesh_vifs++;
137 } 139 }
138 140
139 /* Any MAC address is fine, all others are included through the 141 /* Any MAC address is fine, all others are included through the
@@ -175,6 +177,8 @@ ath5k_remove_interface(struct ieee80211_hw *hw,
175 ah->num_ap_vifs--; 177 ah->num_ap_vifs--;
176 else if (avf->opmode == NL80211_IFTYPE_ADHOC) 178 else if (avf->opmode == NL80211_IFTYPE_ADHOC)
177 ah->num_adhoc_vifs--; 179 ah->num_adhoc_vifs--;
180 else if (avf->opmode == NL80211_IFTYPE_MESH_POINT)
181 ah->num_mesh_vifs--;
178 182
179 ath5k_update_bssid_mask_and_opmode(ah, NULL); 183 ath5k_update_bssid_mask_and_opmode(ah, NULL);
180 mutex_unlock(&ah->lock); 184 mutex_unlock(&ah->lock);
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index e1f8613426a9..3a2845489a1b 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -1871,31 +1871,15 @@ ath5k_hw_phy_calibrate(struct ath5k_hw *ah,
1871 ret = 0; 1871 ret = 0;
1872 } 1872 }
1873 1873
1874 /* On full calibration do an AGC calibration and 1874 /* On full calibration request a PAPD probe for
1875 * request a PAPD probe for gainf calibration if 1875 * gainf calibration if needed */
1876 * needed */ 1876 if ((ah->ah_cal_mask & AR5K_CALIBRATION_FULL) &&
1877 if (ah->ah_cal_mask & AR5K_CALIBRATION_FULL) { 1877 (ah->ah_radio == AR5K_RF5111 ||
1878 1878 ah->ah_radio == AR5K_RF5112) &&
1879 AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL, 1879 channel->hw_value != AR5K_MODE_11B)
1880 AR5K_PHY_AGCCTL_CAL); 1880 ath5k_hw_request_rfgain_probe(ah);
1881 1881
1882 ret = ath5k_hw_register_timeout(ah, AR5K_PHY_AGCCTL, 1882 /* Update noise floor */
1883 AR5K_PHY_AGCCTL_CAL | AR5K_PHY_AGCCTL_NF,
1884 0, false);
1885 if (ret) {
1886 ATH5K_ERR(ah,
1887 "gain calibration timeout (%uMHz)\n",
1888 channel->center_freq);
1889 }
1890
1891 if ((ah->ah_radio == AR5K_RF5111 ||
1892 ah->ah_radio == AR5K_RF5112)
1893 && (channel->hw_value != AR5K_MODE_11B))
1894 ath5k_hw_request_rfgain_probe(ah);
1895 }
1896
1897 /* Update noise floor
1898 * XXX: Only do this after AGC calibration */
1899 if (!(ah->ah_cal_mask & AR5K_CALIBRATION_NF)) 1883 if (!(ah->ah_cal_mask & AR5K_CALIBRATION_NF))
1900 ath5k_hw_update_noise_floor(ah); 1884 ath5k_hw_update_noise_floor(ah);
1901 1885
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c
index 16e4e5a647a1..7654e8e286d3 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.c
+++ b/drivers/net/wireless/ath/ath6kl/wmi.c
@@ -557,7 +557,8 @@ static int ath6kl_wmi_rx_probe_req_event_rx(struct wmi *wmi, u8 *datap, int len,
557 dlen, freq, vif->probe_req_report); 557 dlen, freq, vif->probe_req_report);
558 558
559 if (vif->probe_req_report || vif->nw_type == AP_NETWORK) 559 if (vif->probe_req_report || vif->nw_type == AP_NETWORK)
560 cfg80211_rx_mgmt(vif->ndev, freq, ev->data, dlen, GFP_ATOMIC); 560 cfg80211_rx_mgmt(vif->ndev, freq, 0,
561 ev->data, dlen, GFP_ATOMIC);
561 562
562 return 0; 563 return 0;
563} 564}
@@ -596,7 +597,8 @@ static int ath6kl_wmi_rx_action_event_rx(struct wmi *wmi, u8 *datap, int len,
596 return -EINVAL; 597 return -EINVAL;
597 } 598 }
598 ath6kl_dbg(ATH6KL_DBG_WMI, "rx_action: len=%u freq=%u\n", dlen, freq); 599 ath6kl_dbg(ATH6KL_DBG_WMI, "rx_action: len=%u freq=%u\n", dlen, freq);
599 cfg80211_rx_mgmt(vif->ndev, freq, ev->data, dlen, GFP_ATOMIC); 600 cfg80211_rx_mgmt(vif->ndev, freq, 0,
601 ev->data, dlen, GFP_ATOMIC);
600 602
601 return 0; 603 return 0;
602} 604}
diff --git a/drivers/net/wireless/ath/ath9k/Kconfig b/drivers/net/wireless/ath/ath9k/Kconfig
index 595a272aa96e..e507e78398f3 100644
--- a/drivers/net/wireless/ath/ath9k/Kconfig
+++ b/drivers/net/wireless/ath/ath9k/Kconfig
@@ -81,6 +81,14 @@ config ATH9K_DFS_CERTIFIED
81 developed. At this point enabling this option won't do anything 81 developed. At this point enabling this option won't do anything
82 except increase code size. 82 except increase code size.
83 83
84config ATH9K_MAC_DEBUG
85 bool "Atheros MAC statistics"
86 depends on ATH9K_DEBUGFS
87 default y
88 ---help---
89 This option enables collection of statistics for Rx/Tx status
90 data and some other MAC related statistics
91
84config ATH9K_RATE_CONTROL 92config ATH9K_RATE_CONTROL
85 bool "Atheros ath9k rate control" 93 bool "Atheros ath9k rate control"
86 depends on ATH9K 94 depends on ATH9K
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
index 86a891f93fc9..d7d8e9199140 100644
--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
@@ -834,9 +834,10 @@ static int ar5008_hw_process_ini(struct ath_hw *ah,
834 AR_SREV_9287_11_OR_LATER(ah)) 834 AR_SREV_9287_11_OR_LATER(ah))
835 REG_WRITE_ARRAY(&ah->iniModesTxGain, modesIndex, regWrites); 835 REG_WRITE_ARRAY(&ah->iniModesTxGain, modesIndex, regWrites);
836 836
837 if (AR_SREV_9271_10(ah)) 837 if (AR_SREV_9271_10(ah)) {
838 REG_WRITE_ARRAY(&ah->iniModes_9271_1_0_only, 838 REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, AR_PHY_SPECTRAL_SCAN_ENA);
839 modesIndex, regWrites); 839 REG_RMW_FIELD(ah, AR_PHY_RF_CTL3, AR_PHY_TX_END_TO_ADC_ON, 0xa);
840 }
840 841
841 ENABLE_REGWRITE_BUFFER(ah); 842 ENABLE_REGWRITE_BUFFER(ah);
842 843
@@ -858,21 +859,11 @@ static int ar5008_hw_process_ini(struct ath_hw *ah,
858 859
859 REGWRITE_BUFFER_FLUSH(ah); 860 REGWRITE_BUFFER_FLUSH(ah);
860 861
861 if (AR_SREV_9271(ah)) {
862 if (ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE) == 1)
863 REG_WRITE_ARRAY(&ah->iniModes_high_power_tx_gain_9271,
864 modesIndex, regWrites);
865 else
866 REG_WRITE_ARRAY(&ah->iniModes_normal_power_tx_gain_9271,
867 modesIndex, regWrites);
868 }
869
870 REG_WRITE_ARRAY(&ah->iniBB_RfGain, freqIndex, regWrites); 862 REG_WRITE_ARRAY(&ah->iniBB_RfGain, freqIndex, regWrites);
871 863
872 if (IS_CHAN_A_FAST_CLOCK(ah, chan)) { 864 if (IS_CHAN_A_FAST_CLOCK(ah, chan))
873 REG_WRITE_ARRAY(&ah->iniModesAdditional, modesIndex, 865 REG_WRITE_ARRAY(&ah->iniModesFastClock, modesIndex,
874 regWrites); 866 regWrites);
875 }
876 867
877 ar5008_hw_override_ini(ah, chan); 868 ar5008_hw_override_ini(ah, chan);
878 ar5008_hw_set_channel_regs(ah, chan); 869 ar5008_hw_set_channel_regs(ah, chan);
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
index e3f268900763..d9a69fc470cd 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
@@ -34,23 +34,8 @@ static void ar9002_hw_init_mode_regs(struct ath_hw *ah)
34 ARRAY_SIZE(ar9271Modes_9271), 5); 34 ARRAY_SIZE(ar9271Modes_9271), 5);
35 INIT_INI_ARRAY(&ah->iniCommon, ar9271Common_9271, 35 INIT_INI_ARRAY(&ah->iniCommon, ar9271Common_9271,
36 ARRAY_SIZE(ar9271Common_9271), 2); 36 ARRAY_SIZE(ar9271Common_9271), 2);
37 INIT_INI_ARRAY(&ah->iniCommon_normal_cck_fir_coeff_9271,
38 ar9287Common_normal_cck_fir_coeff_9287_1_1,
39 ARRAY_SIZE(ar9287Common_normal_cck_fir_coeff_9287_1_1), 2);
40 INIT_INI_ARRAY(&ah->iniCommon_japan_2484_cck_fir_coeff_9271,
41 ar9287Common_japan_2484_cck_fir_coeff_9287_1_1,
42 ARRAY_SIZE(ar9287Common_japan_2484_cck_fir_coeff_9287_1_1), 2);
43 INIT_INI_ARRAY(&ah->iniModes_9271_1_0_only,
44 ar9271Modes_9271_1_0_only,
45 ARRAY_SIZE(ar9271Modes_9271_1_0_only), 5);
46 INIT_INI_ARRAY(&ah->iniModes_9271_ANI_reg, ar9271Modes_9271_ANI_reg, 37 INIT_INI_ARRAY(&ah->iniModes_9271_ANI_reg, ar9271Modes_9271_ANI_reg,
47 ARRAY_SIZE(ar9271Modes_9271_ANI_reg), 5); 38 ARRAY_SIZE(ar9271Modes_9271_ANI_reg), 5);
48 INIT_INI_ARRAY(&ah->iniModes_high_power_tx_gain_9271,
49 ar9271Modes_high_power_tx_gain_9271,
50 ARRAY_SIZE(ar9271Modes_high_power_tx_gain_9271), 5);
51 INIT_INI_ARRAY(&ah->iniModes_normal_power_tx_gain_9271,
52 ar9271Modes_normal_power_tx_gain_9271,
53 ARRAY_SIZE(ar9271Modes_normal_power_tx_gain_9271), 5);
54 return; 39 return;
55 } 40 }
56 41
@@ -79,7 +64,7 @@ static void ar9002_hw_init_mode_regs(struct ath_hw *ah)
79 INIT_INI_ARRAY(&ah->iniCommon, ar9280Common_9280_2, 64 INIT_INI_ARRAY(&ah->iniCommon, ar9280Common_9280_2,
80 ARRAY_SIZE(ar9280Common_9280_2), 2); 65 ARRAY_SIZE(ar9280Common_9280_2), 2);
81 66
82 INIT_INI_ARRAY(&ah->iniModesAdditional, 67 INIT_INI_ARRAY(&ah->iniModesFastClock,
83 ar9280Modes_fast_clock_9280_2, 68 ar9280Modes_fast_clock_9280_2,
84 ARRAY_SIZE(ar9280Modes_fast_clock_9280_2), 3); 69 ARRAY_SIZE(ar9280Modes_fast_clock_9280_2), 3);
85 } else if (AR_SREV_9160_10_OR_LATER(ah)) { 70 } else if (AR_SREV_9160_10_OR_LATER(ah)) {
@@ -160,11 +145,6 @@ static void ar9002_hw_init_mode_regs(struct ath_hw *ah)
160 INI_RA(addac, 31,1) = 0; 145 INI_RA(addac, 31,1) = 0;
161 } 146 }
162 } 147 }
163}
164
165/* Support for Japan ch.14 (2484) spread */
166void ar9002_hw_cck_chan14_spread(struct ath_hw *ah)
167{
168 if (AR_SREV_9287_11_OR_LATER(ah)) { 148 if (AR_SREV_9287_11_OR_LATER(ah)) {
169 INIT_INI_ARRAY(&ah->iniCckfirNormal, 149 INIT_INI_ARRAY(&ah->iniCckfirNormal,
170 ar9287Common_normal_cck_fir_coeff_9287_1_1, 150 ar9287Common_normal_cck_fir_coeff_9287_1_1,
@@ -204,14 +184,10 @@ static void ar9280_20_hw_init_rxgain_ini(struct ath_hw *ah)
204 } 184 }
205} 185}
206 186
207static void ar9280_20_hw_init_txgain_ini(struct ath_hw *ah) 187static void ar9280_20_hw_init_txgain_ini(struct ath_hw *ah, u32 txgain_type)
208{ 188{
209 u32 txgain_type;
210
211 if (ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV) >= 189 if (ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV) >=
212 AR5416_EEP_MINOR_VER_19) { 190 AR5416_EEP_MINOR_VER_19) {
213 txgain_type = ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE);
214
215 if (txgain_type == AR5416_EEP_TXGAIN_HIGH_POWER) 191 if (txgain_type == AR5416_EEP_TXGAIN_HIGH_POWER)
216 INIT_INI_ARRAY(&ah->iniModesTxGain, 192 INIT_INI_ARRAY(&ah->iniModesTxGain,
217 ar9280Modes_high_power_tx_gain_9280_2, 193 ar9280Modes_high_power_tx_gain_9280_2,
@@ -227,8 +203,22 @@ static void ar9280_20_hw_init_txgain_ini(struct ath_hw *ah)
227 } 203 }
228} 204}
229 205
206static void ar9271_hw_init_txgain_ini(struct ath_hw *ah, u32 txgain_type)
207{
208 if (txgain_type == AR5416_EEP_TXGAIN_HIGH_POWER)
209 INIT_INI_ARRAY(&ah->iniModesTxGain,
210 ar9271Modes_high_power_tx_gain_9271,
211 ARRAY_SIZE(ar9271Modes_high_power_tx_gain_9271), 5);
212 else
213 INIT_INI_ARRAY(&ah->iniModesTxGain,
214 ar9271Modes_normal_power_tx_gain_9271,
215 ARRAY_SIZE(ar9271Modes_normal_power_tx_gain_9271), 5);
216}
217
230static void ar9002_hw_init_mode_gain_regs(struct ath_hw *ah) 218static void ar9002_hw_init_mode_gain_regs(struct ath_hw *ah)
231{ 219{
220 u32 txgain_type = ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE);
221
232 if (AR_SREV_9287_11_OR_LATER(ah)) 222 if (AR_SREV_9287_11_OR_LATER(ah))
233 INIT_INI_ARRAY(&ah->iniModesRxGain, 223 INIT_INI_ARRAY(&ah->iniModesRxGain,
234 ar9287Modes_rx_gain_9287_1_1, 224 ar9287Modes_rx_gain_9287_1_1,
@@ -236,15 +226,15 @@ static void ar9002_hw_init_mode_gain_regs(struct ath_hw *ah)
236 else if (AR_SREV_9280_20(ah)) 226 else if (AR_SREV_9280_20(ah))
237 ar9280_20_hw_init_rxgain_ini(ah); 227 ar9280_20_hw_init_rxgain_ini(ah);
238 228
239 if (AR_SREV_9287_11_OR_LATER(ah)) { 229 if (AR_SREV_9271(ah)) {
230 ar9271_hw_init_txgain_ini(ah, txgain_type);
231 } else if (AR_SREV_9287_11_OR_LATER(ah)) {
240 INIT_INI_ARRAY(&ah->iniModesTxGain, 232 INIT_INI_ARRAY(&ah->iniModesTxGain,
241 ar9287Modes_tx_gain_9287_1_1, 233 ar9287Modes_tx_gain_9287_1_1,
242 ARRAY_SIZE(ar9287Modes_tx_gain_9287_1_1), 5); 234 ARRAY_SIZE(ar9287Modes_tx_gain_9287_1_1), 5);
243 } else if (AR_SREV_9280_20(ah)) { 235 } else if (AR_SREV_9280_20(ah)) {
244 ar9280_20_hw_init_txgain_ini(ah); 236 ar9280_20_hw_init_txgain_ini(ah, txgain_type);
245 } else if (AR_SREV_9285_12_OR_LATER(ah)) { 237 } else if (AR_SREV_9285_12_OR_LATER(ah)) {
246 u32 txgain_type = ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE);
247
248 /* txgain table */ 238 /* txgain table */
249 if (txgain_type == AR5416_EEP_TXGAIN_HIGH_POWER) { 239 if (txgain_type == AR5416_EEP_TXGAIN_HIGH_POWER) {
250 if (AR_SREV_9285E_20(ah)) { 240 if (AR_SREV_9285E_20(ah)) {
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_initvals.h b/drivers/net/wireless/ath/ath9k/ar9002_initvals.h
index d571c329ee59..4d18c66a6790 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_initvals.h
+++ b/drivers/net/wireless/ath/ath9k/ar9002_initvals.h
@@ -3092,12 +3092,6 @@ static const u32 ar9271Common_9271[][2] = {
3092 {0x0000d384, 0xf3307ff0}, 3092 {0x0000d384, 0xf3307ff0},
3093}; 3093};
3094 3094
3095static const u32 ar9271Modes_9271_1_0_only[][5] = {
3096 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
3097 {0x00009910, 0x30002311, 0x30002311, 0x30002311, 0x30002311},
3098 {0x00009828, 0x0a020001, 0x0a020001, 0x0a020001, 0x0a020001},
3099};
3100
3101static const u32 ar9271Modes_9271_ANI_reg[][5] = { 3095static const u32 ar9271Modes_9271_ANI_reg[][5] = {
3102 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 3096 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
3103 {0x00009850, 0x6d4000e2, 0x6d4000e2, 0x6d4000e2, 0x6d4000e2}, 3097 {0x00009850, 0x6d4000e2, 0x6d4000e2, 0x6d4000e2, 0x6d4000e2},
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_mac.c b/drivers/net/wireless/ath/ath9k/ar9002_mac.c
index 7b6417b5212e..aa2abaf31cba 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_mac.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_mac.c
@@ -347,15 +347,12 @@ void ath9k_hw_setuprxdesc(struct ath_hw *ah, struct ath_desc *ds,
347 u32 size, u32 flags) 347 u32 size, u32 flags)
348{ 348{
349 struct ar5416_desc *ads = AR5416DESC(ds); 349 struct ar5416_desc *ads = AR5416DESC(ds);
350 struct ath9k_hw_capabilities *pCap = &ah->caps;
351 350
352 ads->ds_ctl1 = size & AR_BufLen; 351 ads->ds_ctl1 = size & AR_BufLen;
353 if (flags & ATH9K_RXDESC_INTREQ) 352 if (flags & ATH9K_RXDESC_INTREQ)
354 ads->ds_ctl1 |= AR_RxIntrReq; 353 ads->ds_ctl1 |= AR_RxIntrReq;
355 354
356 ads->ds_rxstatus8 &= ~AR_RxDone; 355 memset(&ads->u.rx, 0, sizeof(ads->u.rx));
357 if (!(pCap->hw_caps & ATH9K_HW_CAP_AUTOSLEEP))
358 memset(&(ads->u), 0, sizeof(ads->u));
359} 356}
360EXPORT_SYMBOL(ath9k_hw_setuprxdesc); 357EXPORT_SYMBOL(ath9k_hw_setuprxdesc);
361 358
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_phy.h b/drivers/net/wireless/ath/ath9k/ar9002_phy.h
index 453af6dc514b..f9eb2c357169 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.h
+++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.h
@@ -60,6 +60,8 @@
60#define AR_PHY_RF_CTL3 0x9828 60#define AR_PHY_RF_CTL3 0x9828
61#define AR_PHY_TX_END_TO_A2_RX_ON 0x00FF0000 61#define AR_PHY_TX_END_TO_A2_RX_ON 0x00FF0000
62#define AR_PHY_TX_END_TO_A2_RX_ON_S 16 62#define AR_PHY_TX_END_TO_A2_RX_ON_S 16
63#define AR_PHY_TX_END_TO_ADC_ON 0xFF000000
64#define AR_PHY_TX_END_TO_ADC_ON_S 24
63 65
64#define AR_PHY_ADC_CTL 0x982C 66#define AR_PHY_ADC_CTL 0x982C
65#define AR_PHY_ADC_CTL_OFF_INBUFGAIN 0x00000003 67#define AR_PHY_ADC_CTL_OFF_INBUFGAIN 0x00000003
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
index 026f9de15d15..46c79a3d4737 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
@@ -295,266 +295,6 @@ static const u32 ar9300_2p2_radio_core[][2] = {
295 {0x00016bd4, 0x00000000}, 295 {0x00016bd4, 0x00000000},
296}; 296};
297 297
298static const u32 ar9300Common_rx_gain_table_merlin_2p2[][2] = {
299 /* Addr allmodes */
300 {0x0000a000, 0x02000101},
301 {0x0000a004, 0x02000102},
302 {0x0000a008, 0x02000103},
303 {0x0000a00c, 0x02000104},
304 {0x0000a010, 0x02000200},
305 {0x0000a014, 0x02000201},
306 {0x0000a018, 0x02000202},
307 {0x0000a01c, 0x02000203},
308 {0x0000a020, 0x02000204},
309 {0x0000a024, 0x02000205},
310 {0x0000a028, 0x02000208},
311 {0x0000a02c, 0x02000302},
312 {0x0000a030, 0x02000303},
313 {0x0000a034, 0x02000304},
314 {0x0000a038, 0x02000400},
315 {0x0000a03c, 0x02010300},
316 {0x0000a040, 0x02010301},
317 {0x0000a044, 0x02010302},
318 {0x0000a048, 0x02000500},
319 {0x0000a04c, 0x02010400},
320 {0x0000a050, 0x02020300},
321 {0x0000a054, 0x02020301},
322 {0x0000a058, 0x02020302},
323 {0x0000a05c, 0x02020303},
324 {0x0000a060, 0x02020400},
325 {0x0000a064, 0x02030300},
326 {0x0000a068, 0x02030301},
327 {0x0000a06c, 0x02030302},
328 {0x0000a070, 0x02030303},
329 {0x0000a074, 0x02030400},
330 {0x0000a078, 0x02040300},
331 {0x0000a07c, 0x02040301},
332 {0x0000a080, 0x02040302},
333 {0x0000a084, 0x02040303},
334 {0x0000a088, 0x02030500},
335 {0x0000a08c, 0x02040400},
336 {0x0000a090, 0x02050203},
337 {0x0000a094, 0x02050204},
338 {0x0000a098, 0x02050205},
339 {0x0000a09c, 0x02040500},
340 {0x0000a0a0, 0x02050301},
341 {0x0000a0a4, 0x02050302},
342 {0x0000a0a8, 0x02050303},
343 {0x0000a0ac, 0x02050400},
344 {0x0000a0b0, 0x02050401},
345 {0x0000a0b4, 0x02050402},
346 {0x0000a0b8, 0x02050403},
347 {0x0000a0bc, 0x02050500},
348 {0x0000a0c0, 0x02050501},
349 {0x0000a0c4, 0x02050502},
350 {0x0000a0c8, 0x02050503},
351 {0x0000a0cc, 0x02050504},
352 {0x0000a0d0, 0x02050600},
353 {0x0000a0d4, 0x02050601},
354 {0x0000a0d8, 0x02050602},
355 {0x0000a0dc, 0x02050603},
356 {0x0000a0e0, 0x02050604},
357 {0x0000a0e4, 0x02050700},
358 {0x0000a0e8, 0x02050701},
359 {0x0000a0ec, 0x02050702},
360 {0x0000a0f0, 0x02050703},
361 {0x0000a0f4, 0x02050704},
362 {0x0000a0f8, 0x02050705},
363 {0x0000a0fc, 0x02050708},
364 {0x0000a100, 0x02050709},
365 {0x0000a104, 0x0205070a},
366 {0x0000a108, 0x0205070b},
367 {0x0000a10c, 0x0205070c},
368 {0x0000a110, 0x0205070d},
369 {0x0000a114, 0x02050710},
370 {0x0000a118, 0x02050711},
371 {0x0000a11c, 0x02050712},
372 {0x0000a120, 0x02050713},
373 {0x0000a124, 0x02050714},
374 {0x0000a128, 0x02050715},
375 {0x0000a12c, 0x02050730},
376 {0x0000a130, 0x02050731},
377 {0x0000a134, 0x02050732},
378 {0x0000a138, 0x02050733},
379 {0x0000a13c, 0x02050734},
380 {0x0000a140, 0x02050735},
381 {0x0000a144, 0x02050750},
382 {0x0000a148, 0x02050751},
383 {0x0000a14c, 0x02050752},
384 {0x0000a150, 0x02050753},
385 {0x0000a154, 0x02050754},
386 {0x0000a158, 0x02050755},
387 {0x0000a15c, 0x02050770},
388 {0x0000a160, 0x02050771},
389 {0x0000a164, 0x02050772},
390 {0x0000a168, 0x02050773},
391 {0x0000a16c, 0x02050774},
392 {0x0000a170, 0x02050775},
393 {0x0000a174, 0x00000776},
394 {0x0000a178, 0x00000776},
395 {0x0000a17c, 0x00000776},
396 {0x0000a180, 0x00000776},
397 {0x0000a184, 0x00000776},
398 {0x0000a188, 0x00000776},
399 {0x0000a18c, 0x00000776},
400 {0x0000a190, 0x00000776},
401 {0x0000a194, 0x00000776},
402 {0x0000a198, 0x00000776},
403 {0x0000a19c, 0x00000776},
404 {0x0000a1a0, 0x00000776},
405 {0x0000a1a4, 0x00000776},
406 {0x0000a1a8, 0x00000776},
407 {0x0000a1ac, 0x00000776},
408 {0x0000a1b0, 0x00000776},
409 {0x0000a1b4, 0x00000776},
410 {0x0000a1b8, 0x00000776},
411 {0x0000a1bc, 0x00000776},
412 {0x0000a1c0, 0x00000776},
413 {0x0000a1c4, 0x00000776},
414 {0x0000a1c8, 0x00000776},
415 {0x0000a1cc, 0x00000776},
416 {0x0000a1d0, 0x00000776},
417 {0x0000a1d4, 0x00000776},
418 {0x0000a1d8, 0x00000776},
419 {0x0000a1dc, 0x00000776},
420 {0x0000a1e0, 0x00000776},
421 {0x0000a1e4, 0x00000776},
422 {0x0000a1e8, 0x00000776},
423 {0x0000a1ec, 0x00000776},
424 {0x0000a1f0, 0x00000776},
425 {0x0000a1f4, 0x00000776},
426 {0x0000a1f8, 0x00000776},
427 {0x0000a1fc, 0x00000776},
428 {0x0000b000, 0x02000101},
429 {0x0000b004, 0x02000102},
430 {0x0000b008, 0x02000103},
431 {0x0000b00c, 0x02000104},
432 {0x0000b010, 0x02000200},
433 {0x0000b014, 0x02000201},
434 {0x0000b018, 0x02000202},
435 {0x0000b01c, 0x02000203},
436 {0x0000b020, 0x02000204},
437 {0x0000b024, 0x02000205},
438 {0x0000b028, 0x02000208},
439 {0x0000b02c, 0x02000302},
440 {0x0000b030, 0x02000303},
441 {0x0000b034, 0x02000304},
442 {0x0000b038, 0x02000400},
443 {0x0000b03c, 0x02010300},
444 {0x0000b040, 0x02010301},
445 {0x0000b044, 0x02010302},
446 {0x0000b048, 0x02000500},
447 {0x0000b04c, 0x02010400},
448 {0x0000b050, 0x02020300},
449 {0x0000b054, 0x02020301},
450 {0x0000b058, 0x02020302},
451 {0x0000b05c, 0x02020303},
452 {0x0000b060, 0x02020400},
453 {0x0000b064, 0x02030300},
454 {0x0000b068, 0x02030301},
455 {0x0000b06c, 0x02030302},
456 {0x0000b070, 0x02030303},
457 {0x0000b074, 0x02030400},
458 {0x0000b078, 0x02040300},
459 {0x0000b07c, 0x02040301},
460 {0x0000b080, 0x02040302},
461 {0x0000b084, 0x02040303},
462 {0x0000b088, 0x02030500},
463 {0x0000b08c, 0x02040400},
464 {0x0000b090, 0x02050203},
465 {0x0000b094, 0x02050204},
466 {0x0000b098, 0x02050205},
467 {0x0000b09c, 0x02040500},
468 {0x0000b0a0, 0x02050301},
469 {0x0000b0a4, 0x02050302},
470 {0x0000b0a8, 0x02050303},
471 {0x0000b0ac, 0x02050400},
472 {0x0000b0b0, 0x02050401},
473 {0x0000b0b4, 0x02050402},
474 {0x0000b0b8, 0x02050403},
475 {0x0000b0bc, 0x02050500},
476 {0x0000b0c0, 0x02050501},
477 {0x0000b0c4, 0x02050502},
478 {0x0000b0c8, 0x02050503},
479 {0x0000b0cc, 0x02050504},
480 {0x0000b0d0, 0x02050600},
481 {0x0000b0d4, 0x02050601},
482 {0x0000b0d8, 0x02050602},
483 {0x0000b0dc, 0x02050603},
484 {0x0000b0e0, 0x02050604},
485 {0x0000b0e4, 0x02050700},
486 {0x0000b0e8, 0x02050701},
487 {0x0000b0ec, 0x02050702},
488 {0x0000b0f0, 0x02050703},
489 {0x0000b0f4, 0x02050704},
490 {0x0000b0f8, 0x02050705},
491 {0x0000b0fc, 0x02050708},
492 {0x0000b100, 0x02050709},
493 {0x0000b104, 0x0205070a},
494 {0x0000b108, 0x0205070b},
495 {0x0000b10c, 0x0205070c},
496 {0x0000b110, 0x0205070d},
497 {0x0000b114, 0x02050710},
498 {0x0000b118, 0x02050711},
499 {0x0000b11c, 0x02050712},
500 {0x0000b120, 0x02050713},
501 {0x0000b124, 0x02050714},
502 {0x0000b128, 0x02050715},
503 {0x0000b12c, 0x02050730},
504 {0x0000b130, 0x02050731},
505 {0x0000b134, 0x02050732},
506 {0x0000b138, 0x02050733},
507 {0x0000b13c, 0x02050734},
508 {0x0000b140, 0x02050735},
509 {0x0000b144, 0x02050750},
510 {0x0000b148, 0x02050751},
511 {0x0000b14c, 0x02050752},
512 {0x0000b150, 0x02050753},
513 {0x0000b154, 0x02050754},
514 {0x0000b158, 0x02050755},
515 {0x0000b15c, 0x02050770},
516 {0x0000b160, 0x02050771},
517 {0x0000b164, 0x02050772},
518 {0x0000b168, 0x02050773},
519 {0x0000b16c, 0x02050774},
520 {0x0000b170, 0x02050775},
521 {0x0000b174, 0x00000776},
522 {0x0000b178, 0x00000776},
523 {0x0000b17c, 0x00000776},
524 {0x0000b180, 0x00000776},
525 {0x0000b184, 0x00000776},
526 {0x0000b188, 0x00000776},
527 {0x0000b18c, 0x00000776},
528 {0x0000b190, 0x00000776},
529 {0x0000b194, 0x00000776},
530 {0x0000b198, 0x00000776},
531 {0x0000b19c, 0x00000776},
532 {0x0000b1a0, 0x00000776},
533 {0x0000b1a4, 0x00000776},
534 {0x0000b1a8, 0x00000776},
535 {0x0000b1ac, 0x00000776},
536 {0x0000b1b0, 0x00000776},
537 {0x0000b1b4, 0x00000776},
538 {0x0000b1b8, 0x00000776},
539 {0x0000b1bc, 0x00000776},
540 {0x0000b1c0, 0x00000776},
541 {0x0000b1c4, 0x00000776},
542 {0x0000b1c8, 0x00000776},
543 {0x0000b1cc, 0x00000776},
544 {0x0000b1d0, 0x00000776},
545 {0x0000b1d4, 0x00000776},
546 {0x0000b1d8, 0x00000776},
547 {0x0000b1dc, 0x00000776},
548 {0x0000b1e0, 0x00000776},
549 {0x0000b1e4, 0x00000776},
550 {0x0000b1e8, 0x00000776},
551 {0x0000b1ec, 0x00000776},
552 {0x0000b1f0, 0x00000776},
553 {0x0000b1f4, 0x00000776},
554 {0x0000b1f8, 0x00000776},
555 {0x0000b1fc, 0x00000776},
556};
557
558static const u32 ar9300_2p2_mac_postamble[][5] = { 298static const u32 ar9300_2p2_mac_postamble[][5] = {
559 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 299 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
560 {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160}, 300 {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160},
@@ -572,48 +312,6 @@ static const u32 ar9300_2p2_soc_postamble[][5] = {
572 {0x00007010, 0x00000023, 0x00000023, 0x00000023, 0x00000023}, 312 {0x00007010, 0x00000023, 0x00000023, 0x00000023, 0x00000023},
573}; 313};
574 314
575static const u32 ar9200_merlin_2p2_radio_core[][2] = {
576 /* Addr allmodes */
577 {0x00007800, 0x00040000},
578 {0x00007804, 0xdb005012},
579 {0x00007808, 0x04924914},
580 {0x0000780c, 0x21084210},
581 {0x00007810, 0x6d801300},
582 {0x00007814, 0x0019beff},
583 {0x00007818, 0x07e41000},
584 {0x0000781c, 0x00392000},
585 {0x00007820, 0x92592480},
586 {0x00007824, 0x00040000},
587 {0x00007828, 0xdb005012},
588 {0x0000782c, 0x04924914},
589 {0x00007830, 0x21084210},
590 {0x00007834, 0x6d801300},
591 {0x00007838, 0x0019beff},
592 {0x0000783c, 0x07e40000},
593 {0x00007840, 0x00392000},
594 {0x00007844, 0x92592480},
595 {0x00007848, 0x00100000},
596 {0x0000784c, 0x773f0567},
597 {0x00007850, 0x54214514},
598 {0x00007854, 0x12035828},
599 {0x00007858, 0x92592692},
600 {0x0000785c, 0x00000000},
601 {0x00007860, 0x56400000},
602 {0x00007864, 0x0a8e370e},
603 {0x00007868, 0xc0102850},
604 {0x0000786c, 0x812d4000},
605 {0x00007870, 0x807ec400},
606 {0x00007874, 0x001b6db0},
607 {0x00007878, 0x00376b63},
608 {0x0000787c, 0x06db6db6},
609 {0x00007880, 0x006d8000},
610 {0x00007884, 0xffeffffe},
611 {0x00007888, 0xffeffffe},
612 {0x0000788c, 0x00010000},
613 {0x00007890, 0x02060aeb},
614 {0x00007894, 0x5a108000},
615};
616
617static const u32 ar9300_2p2_baseband_postamble[][5] = { 315static const u32 ar9300_2p2_baseband_postamble[][5] = {
618 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 316 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
619 {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8011, 0xd00a8011}, 317 {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8011, 0xd00a8011},
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_hw.c b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
index 7b4aa000cc2e..0f56e322dd3b 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
@@ -87,11 +87,11 @@ static void ar9003_hw_init_mode_regs(struct ath_hw *ah)
87 87
88 /* additional clock settings */ 88 /* additional clock settings */
89 if (ah->is_clk_25mhz) 89 if (ah->is_clk_25mhz)
90 INIT_INI_ARRAY(&ah->iniModesAdditional, 90 INIT_INI_ARRAY(&ah->iniAdditional,
91 ar9331_1p1_xtal_25M, 91 ar9331_1p1_xtal_25M,
92 ARRAY_SIZE(ar9331_1p1_xtal_25M), 2); 92 ARRAY_SIZE(ar9331_1p1_xtal_25M), 2);
93 else 93 else
94 INIT_INI_ARRAY(&ah->iniModesAdditional, 94 INIT_INI_ARRAY(&ah->iniAdditional,
95 ar9331_1p1_xtal_40M, 95 ar9331_1p1_xtal_40M,
96 ARRAY_SIZE(ar9331_1p1_xtal_40M), 2); 96 ARRAY_SIZE(ar9331_1p1_xtal_40M), 2);
97 } else if (AR_SREV_9330_12(ah)) { 97 } else if (AR_SREV_9330_12(ah)) {
@@ -140,11 +140,11 @@ static void ar9003_hw_init_mode_regs(struct ath_hw *ah)
140 140
141 /* additional clock settings */ 141 /* additional clock settings */
142 if (ah->is_clk_25mhz) 142 if (ah->is_clk_25mhz)
143 INIT_INI_ARRAY(&ah->iniModesAdditional, 143 INIT_INI_ARRAY(&ah->iniAdditional,
144 ar9331_1p2_xtal_25M, 144 ar9331_1p2_xtal_25M,
145 ARRAY_SIZE(ar9331_1p2_xtal_25M), 2); 145 ARRAY_SIZE(ar9331_1p2_xtal_25M), 2);
146 else 146 else
147 INIT_INI_ARRAY(&ah->iniModesAdditional, 147 INIT_INI_ARRAY(&ah->iniAdditional,
148 ar9331_1p2_xtal_40M, 148 ar9331_1p2_xtal_40M,
149 ARRAY_SIZE(ar9331_1p2_xtal_40M), 2); 149 ARRAY_SIZE(ar9331_1p2_xtal_40M), 2);
150 } else if (AR_SREV_9340(ah)) { 150 } else if (AR_SREV_9340(ah)) {
@@ -194,15 +194,16 @@ static void ar9003_hw_init_mode_regs(struct ath_hw *ah)
194 ARRAY_SIZE(ar9340Modes_high_ob_db_tx_gain_table_1p0), 194 ARRAY_SIZE(ar9340Modes_high_ob_db_tx_gain_table_1p0),
195 5); 195 5);
196 196
197 INIT_INI_ARRAY(&ah->iniModesAdditional, 197 INIT_INI_ARRAY(&ah->iniModesFastClock,
198 ar9340Modes_fast_clock_1p0, 198 ar9340Modes_fast_clock_1p0,
199 ARRAY_SIZE(ar9340Modes_fast_clock_1p0), 199 ARRAY_SIZE(ar9340Modes_fast_clock_1p0),
200 3); 200 3);
201 201
202 INIT_INI_ARRAY(&ah->iniModesAdditional_40M, 202 if (!ah->is_clk_25mhz)
203 ar9340_1p0_radio_core_40M, 203 INIT_INI_ARRAY(&ah->iniAdditional,
204 ARRAY_SIZE(ar9340_1p0_radio_core_40M), 204 ar9340_1p0_radio_core_40M,
205 2); 205 ARRAY_SIZE(ar9340_1p0_radio_core_40M),
206 2);
206 } else if (AR_SREV_9485_11(ah)) { 207 } else if (AR_SREV_9485_11(ah)) {
207 /* mac */ 208 /* mac */
208 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0); 209 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
@@ -321,7 +322,7 @@ static void ar9003_hw_init_mode_regs(struct ath_hw *ah)
321 2); 322 2);
322 323
323 /* Fast clock modal settings */ 324 /* Fast clock modal settings */
324 INIT_INI_ARRAY(&ah->iniModesAdditional, 325 INIT_INI_ARRAY(&ah->iniModesFastClock,
325 ar9462_modes_fast_clock_2p0, 326 ar9462_modes_fast_clock_2p0,
326 ARRAY_SIZE(ar9462_modes_fast_clock_2p0), 3); 327 ARRAY_SIZE(ar9462_modes_fast_clock_2p0), 3);
327 328
@@ -378,7 +379,7 @@ static void ar9003_hw_init_mode_regs(struct ath_hw *ah)
378 ARRAY_SIZE(ar9580_1p0_low_ob_db_tx_gain_table), 379 ARRAY_SIZE(ar9580_1p0_low_ob_db_tx_gain_table),
379 5); 380 5);
380 381
381 INIT_INI_ARRAY(&ah->iniModesAdditional, 382 INIT_INI_ARRAY(&ah->iniModesFastClock,
382 ar9580_1p0_modes_fast_clock, 383 ar9580_1p0_modes_fast_clock,
383 ARRAY_SIZE(ar9580_1p0_modes_fast_clock), 384 ARRAY_SIZE(ar9580_1p0_modes_fast_clock),
384 3); 385 3);
@@ -445,7 +446,7 @@ static void ar9003_hw_init_mode_regs(struct ath_hw *ah)
445 2); 446 2);
446 447
447 /* Fast clock modal settings */ 448 /* Fast clock modal settings */
448 INIT_INI_ARRAY(&ah->iniModesAdditional, 449 INIT_INI_ARRAY(&ah->iniModesFastClock,
449 ar9300Modes_fast_clock_2p2, 450 ar9300Modes_fast_clock_2p2,
450 ARRAY_SIZE(ar9300Modes_fast_clock_2p2), 451 ARRAY_SIZE(ar9300Modes_fast_clock_2p2),
451 3); 452 3);
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
index 8d1bca03bc0e..a66a13b76848 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
@@ -326,7 +326,6 @@ static bool ar9003_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
326static int ar9003_hw_proc_txdesc(struct ath_hw *ah, void *ds, 326static int ar9003_hw_proc_txdesc(struct ath_hw *ah, void *ds,
327 struct ath_tx_status *ts) 327 struct ath_tx_status *ts)
328{ 328{
329 struct ar9003_txc *txc = (struct ar9003_txc *) ds;
330 struct ar9003_txs *ads; 329 struct ar9003_txs *ads;
331 u32 status; 330 u32 status;
332 331
@@ -336,11 +335,7 @@ static int ar9003_hw_proc_txdesc(struct ath_hw *ah, void *ds,
336 if ((status & AR_TxDone) == 0) 335 if ((status & AR_TxDone) == 0)
337 return -EINPROGRESS; 336 return -EINPROGRESS;
338 337
339 ts->qid = MS(ads->ds_info, AR_TxQcuNum); 338 ah->ts_tail = (ah->ts_tail + 1) % ah->ts_size;
340 if (!txc || (MS(txc->info, AR_TxQcuNum) == ts->qid))
341 ah->ts_tail = (ah->ts_tail + 1) % ah->ts_size;
342 else
343 return -ENOENT;
344 339
345 if ((MS(ads->ds_info, AR_DescId) != ATHEROS_VENDOR_ID) || 340 if ((MS(ads->ds_info, AR_DescId) != ATHEROS_VENDOR_ID) ||
346 (MS(ads->ds_info, AR_TxRxDesc) != 1)) { 341 (MS(ads->ds_info, AR_TxRxDesc) != 1)) {
@@ -354,6 +349,7 @@ static int ar9003_hw_proc_txdesc(struct ath_hw *ah, void *ds,
354 ts->ts_seqnum = MS(status, AR_SeqNum); 349 ts->ts_seqnum = MS(status, AR_SeqNum);
355 ts->tid = MS(status, AR_TxTid); 350 ts->tid = MS(status, AR_TxTid);
356 351
352 ts->qid = MS(ads->ds_info, AR_TxQcuNum);
357 ts->desc_id = MS(ads->status1, AR_TxDescId); 353 ts->desc_id = MS(ads->status1, AR_TxDescId);
358 ts->ts_tstamp = ads->status4; 354 ts->ts_tstamp = ads->status4;
359 ts->ts_status = 0; 355 ts->ts_status = 0;
@@ -440,20 +436,14 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs,
440 struct ar9003_rxs *rxsp = (struct ar9003_rxs *) buf_addr; 436 struct ar9003_rxs *rxsp = (struct ar9003_rxs *) buf_addr;
441 unsigned int phyerr; 437 unsigned int phyerr;
442 438
443 /* TODO: byte swap on big endian for ar9300_10 */ 439 if ((rxsp->status11 & AR_RxDone) == 0)
444 440 return -EINPROGRESS;
445 if (!rxs) {
446 if ((rxsp->status11 & AR_RxDone) == 0)
447 return -EINPROGRESS;
448
449 if (MS(rxsp->ds_info, AR_DescId) != 0x168c)
450 return -EINVAL;
451 441
452 if ((rxsp->ds_info & (AR_TxRxDesc | AR_CtrlStat)) != 0) 442 if (MS(rxsp->ds_info, AR_DescId) != 0x168c)
453 return -EINPROGRESS; 443 return -EINVAL;
454 444
455 return 0; 445 if ((rxsp->ds_info & (AR_TxRxDesc | AR_CtrlStat)) != 0)
456 } 446 return -EINPROGRESS;
457 447
458 rxs->rs_status = 0; 448 rxs->rs_status = 0;
459 rxs->rs_flags = 0; 449 rxs->rs_flags = 0;
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index 70e27d2a5e43..bc992b237ae5 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -679,18 +679,17 @@ static int ar9003_hw_process_ini(struct ath_hw *ah,
679 * different modal values. 679 * different modal values.
680 */ 680 */
681 if (IS_CHAN_A_FAST_CLOCK(ah, chan)) 681 if (IS_CHAN_A_FAST_CLOCK(ah, chan))
682 REG_WRITE_ARRAY(&ah->iniModesAdditional, 682 REG_WRITE_ARRAY(&ah->iniModesFastClock,
683 modesIndex, regWrites); 683 modesIndex, regWrites);
684 684
685 if (AR_SREV_9330(ah)) 685 REG_WRITE_ARRAY(&ah->iniAdditional, 1, regWrites);
686 REG_WRITE_ARRAY(&ah->iniModesAdditional, 1, regWrites);
687
688 if (AR_SREV_9340(ah) && !ah->is_clk_25mhz)
689 REG_WRITE_ARRAY(&ah->iniModesAdditional_40M, 1, regWrites);
690 686
691 if (AR_SREV_9462(ah)) 687 if (AR_SREV_9462(ah))
692 ar9003_hw_prog_ini(ah, &ah->ini_BTCOEX_MAX_TXPWR, 1); 688 ar9003_hw_prog_ini(ah, &ah->ini_BTCOEX_MAX_TXPWR, 1);
693 689
690 if (chan->channel == 2484)
691 ar9003_hw_prog_ini(ah, &ah->ini_japan2484, 1);
692
694 ah->modes_index = modesIndex; 693 ah->modes_index = modesIndex;
695 ar9003_hw_override_ini(ah); 694 ar9003_hw_override_ini(ah);
696 ar9003_hw_set_channel_regs(ah, chan); 695 ar9003_hw_set_channel_regs(ah, chan);
@@ -1320,13 +1319,9 @@ static int ar9003_hw_fast_chan_change(struct ath_hw *ah,
1320 * different modal values. 1319 * different modal values.
1321 */ 1320 */
1322 if (IS_CHAN_A_FAST_CLOCK(ah, chan)) 1321 if (IS_CHAN_A_FAST_CLOCK(ah, chan))
1323 REG_WRITE_ARRAY(&ah->iniModesAdditional, modesIndex, regWrites); 1322 REG_WRITE_ARRAY(&ah->iniModesFastClock, modesIndex, regWrites);
1324
1325 if (AR_SREV_9330(ah))
1326 REG_WRITE_ARRAY(&ah->iniModesAdditional, 1, regWrites);
1327 1323
1328 if (AR_SREV_9340(ah) && !ah->is_clk_25mhz) 1324 REG_WRITE_ARRAY(&ah->iniAdditional, 1, regWrites);
1329 REG_WRITE_ARRAY(&ah->iniModesAdditional_40M, 1, regWrites);
1330 1325
1331 ah->modes_index = modesIndex; 1326 ah->modes_index = modesIndex;
1332 *ini_reloaded = true; 1327 *ini_reloaded = true;
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index c2ccba676eca..8c84049682ab 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -299,7 +299,6 @@ struct ath_tx {
299 299
300struct ath_rx_edma { 300struct ath_rx_edma {
301 struct sk_buff_head rx_fifo; 301 struct sk_buff_head rx_fifo;
302 struct sk_buff_head rx_buffers;
303 u32 rx_fifo_hwsize; 302 u32 rx_fifo_hwsize;
304}; 303};
305 304
@@ -584,19 +583,13 @@ struct ath_ant_comb {
584 583
585#define SC_OP_INVALID BIT(0) 584#define SC_OP_INVALID BIT(0)
586#define SC_OP_BEACONS BIT(1) 585#define SC_OP_BEACONS BIT(1)
587#define SC_OP_RXAGGR BIT(2) 586#define SC_OP_OFFCHANNEL BIT(2)
588#define SC_OP_TXAGGR BIT(3) 587#define SC_OP_RXFLUSH BIT(3)
589#define SC_OP_OFFCHANNEL BIT(4) 588#define SC_OP_TSF_RESET BIT(4)
590#define SC_OP_PREAMBLE_SHORT BIT(5) 589#define SC_OP_BT_PRIORITY_DETECTED BIT(5)
591#define SC_OP_PROTECT_ENABLE BIT(6) 590#define SC_OP_BT_SCAN BIT(6)
592#define SC_OP_RXFLUSH BIT(7) 591#define SC_OP_ANI_RUN BIT(7)
593#define SC_OP_LED_ASSOCIATED BIT(8) 592#define SC_OP_PRIM_STA_VIF BIT(8)
594#define SC_OP_LED_ON BIT(9)
595#define SC_OP_TSF_RESET BIT(11)
596#define SC_OP_BT_PRIORITY_DETECTED BIT(12)
597#define SC_OP_BT_SCAN BIT(13)
598#define SC_OP_ANI_RUN BIT(14)
599#define SC_OP_PRIM_STA_VIF BIT(15)
600 593
601/* Powersave flags */ 594/* Powersave flags */
602#define PS_WAIT_FOR_BEACON BIT(0) 595#define PS_WAIT_FOR_BEACON BIT(0)
@@ -618,15 +611,12 @@ struct ath9k_vif_iter_data {
618 int nstations; /* number of station vifs */ 611 int nstations; /* number of station vifs */
619 int nwds; /* number of WDS vifs */ 612 int nwds; /* number of WDS vifs */
620 int nadhocs; /* number of adhoc vifs */ 613 int nadhocs; /* number of adhoc vifs */
621 int nothers; /* number of vifs not specified above. */
622}; 614};
623 615
624struct ath_softc { 616struct ath_softc {
625 struct ieee80211_hw *hw; 617 struct ieee80211_hw *hw;
626 struct device *dev; 618 struct device *dev;
627 619
628 int chan_idx;
629 int chan_is_ht;
630 struct survey_info *cur_survey; 620 struct survey_info *cur_survey;
631 struct survey_info survey[ATH9K_NUM_CHANNELS]; 621 struct survey_info survey[ATH9K_NUM_CHANNELS];
632 622
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index b8967e482e6e..626418222c85 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -67,7 +67,7 @@ int ath_beaconq_config(struct ath_softc *sc)
67 * up rate codes, and channel flags. Beacons are always sent out at the 67 * up rate codes, and channel flags. Beacons are always sent out at the
68 * lowest rate, and are not retried. 68 * lowest rate, and are not retried.
69*/ 69*/
70static void ath_beacon_setup(struct ath_softc *sc, struct ath_vif *avp, 70static void ath_beacon_setup(struct ath_softc *sc, struct ieee80211_vif *vif,
71 struct ath_buf *bf, int rateidx) 71 struct ath_buf *bf, int rateidx)
72{ 72{
73 struct sk_buff *skb = bf->bf_mpdu; 73 struct sk_buff *skb = bf->bf_mpdu;
@@ -82,7 +82,7 @@ static void ath_beacon_setup(struct ath_softc *sc, struct ath_vif *avp,
82 82
83 sband = &sc->sbands[common->hw->conf.channel->band]; 83 sband = &sc->sbands[common->hw->conf.channel->band];
84 rate = sband->bitrates[rateidx].hw_value; 84 rate = sband->bitrates[rateidx].hw_value;
85 if (sc->sc_flags & SC_OP_PREAMBLE_SHORT) 85 if (vif->bss_conf.use_short_preamble)
86 rate |= sband->bitrates[rateidx].hw_value_short; 86 rate |= sband->bitrates[rateidx].hw_value_short;
87 87
88 memset(&info, 0, sizeof(info)); 88 memset(&info, 0, sizeof(info));
@@ -91,7 +91,7 @@ static void ath_beacon_setup(struct ath_softc *sc, struct ath_vif *avp,
91 info.txpower = MAX_RATE_POWER; 91 info.txpower = MAX_RATE_POWER;
92 info.keyix = ATH9K_TXKEYIX_INVALID; 92 info.keyix = ATH9K_TXKEYIX_INVALID;
93 info.keytype = ATH9K_KEY_TYPE_CLEAR; 93 info.keytype = ATH9K_KEY_TYPE_CLEAR;
94 info.flags = ATH9K_TXDESC_NOACK; 94 info.flags = ATH9K_TXDESC_NOACK | ATH9K_TXDESC_INTREQ;
95 95
96 info.buf_addr[0] = bf->bf_buf_addr; 96 info.buf_addr[0] = bf->bf_buf_addr;
97 info.buf_len[0] = roundup(skb->len, 4); 97 info.buf_len[0] = roundup(skb->len, 4);
@@ -209,7 +209,7 @@ static struct ath_buf *ath_beacon_generate(struct ieee80211_hw *hw,
209 } 209 }
210 } 210 }
211 211
212 ath_beacon_setup(sc, avp, bf, info->control.rates[0].idx); 212 ath_beacon_setup(sc, vif, bf, info->control.rates[0].idx);
213 213
214 while (skb) { 214 while (skb) {
215 ath_tx_cabq(hw, skb); 215 ath_tx_cabq(hw, skb);
@@ -355,7 +355,6 @@ void ath_beacon_tasklet(unsigned long data)
355 struct ath_common *common = ath9k_hw_common(ah); 355 struct ath_common *common = ath9k_hw_common(ah);
356 struct ath_buf *bf = NULL; 356 struct ath_buf *bf = NULL;
357 struct ieee80211_vif *vif; 357 struct ieee80211_vif *vif;
358 struct ath_tx_status ts;
359 bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA); 358 bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA);
360 int slot; 359 int slot;
361 u32 bfaddr, bc = 0; 360 u32 bfaddr, bc = 0;
@@ -462,11 +461,6 @@ void ath_beacon_tasklet(unsigned long data)
462 ath9k_hw_txstart(ah, sc->beacon.beaconq); 461 ath9k_hw_txstart(ah, sc->beacon.beaconq);
463 462
464 sc->beacon.ast_be_xmit += bc; /* XXX per-vif? */ 463 sc->beacon.ast_be_xmit += bc; /* XXX per-vif? */
465 if (edma) {
466 spin_lock_bh(&sc->sc_pcu_lock);
467 ath9k_hw_txprocdesc(ah, bf->bf_desc, (void *)&ts);
468 spin_unlock_bh(&sc->sc_pcu_lock);
469 }
470 } 464 }
471} 465}
472 466
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index 228c18189a3a..35d1c8e91d1c 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -738,9 +738,9 @@ static ssize_t read_file_misc(struct file *file, char __user *user_buf,
738 738
739 len += snprintf(buf + len, sizeof(buf) - len, 739 len += snprintf(buf + len, sizeof(buf) - len,
740 "VIF-COUNTS: AP: %i STA: %i MESH: %i WDS: %i" 740 "VIF-COUNTS: AP: %i STA: %i MESH: %i WDS: %i"
741 " ADHOC: %i OTHER: %i TOTAL: %hi BEACON-VIF: %hi\n", 741 " ADHOC: %i TOTAL: %hi BEACON-VIF: %hi\n",
742 iter_data.naps, iter_data.nstations, iter_data.nmeshes, 742 iter_data.naps, iter_data.nstations, iter_data.nmeshes,
743 iter_data.nwds, iter_data.nadhocs, iter_data.nothers, 743 iter_data.nwds, iter_data.nadhocs,
744 sc->nvifs, sc->nbcnvifs); 744 sc->nvifs, sc->nbcnvifs);
745 745
746 if (len > sizeof(buf)) 746 if (len > sizeof(buf))
@@ -818,6 +818,7 @@ void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
818 if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN) 818 if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN)
819 TX_STAT_INC(qnum, delim_underrun); 819 TX_STAT_INC(qnum, delim_underrun);
820 820
821#ifdef CONFIG_ATH9K_MAC_DEBUG
821 spin_lock(&sc->debug.samp_lock); 822 spin_lock(&sc->debug.samp_lock);
822 TX_SAMP_DBG(jiffies) = jiffies; 823 TX_SAMP_DBG(jiffies) = jiffies;
823 TX_SAMP_DBG(rssi_ctl0) = ts->ts_rssi_ctl0; 824 TX_SAMP_DBG(rssi_ctl0) = ts->ts_rssi_ctl0;
@@ -844,6 +845,7 @@ void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
844 845
845 sc->debug.tsidx = (sc->debug.tsidx + 1) % ATH_DBG_MAX_SAMPLES; 846 sc->debug.tsidx = (sc->debug.tsidx + 1) % ATH_DBG_MAX_SAMPLES;
846 spin_unlock(&sc->debug.samp_lock); 847 spin_unlock(&sc->debug.samp_lock);
848#endif
847 849
848#undef TX_SAMP_DBG 850#undef TX_SAMP_DBG
849} 851}
@@ -942,27 +944,6 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf,
942 PHY_ERR("HT-RATE ERR", ATH9K_PHYERR_HT_RATE_ILLEGAL); 944 PHY_ERR("HT-RATE ERR", ATH9K_PHYERR_HT_RATE_ILLEGAL);
943 945
944 len += snprintf(buf + len, size - len, 946 len += snprintf(buf + len, size - len,
945 "%22s : %10d\n", "RSSI-CTL0",
946 sc->debug.stats.rxstats.rs_rssi_ctl0);
947 len += snprintf(buf + len, size - len,
948 "%22s : %10d\n", "RSSI-CTL1",
949 sc->debug.stats.rxstats.rs_rssi_ctl1);
950 len += snprintf(buf + len, size - len,
951 "%22s : %10d\n", "RSSI-CTL2",
952 sc->debug.stats.rxstats.rs_rssi_ctl2);
953 len += snprintf(buf + len, size - len,
954 "%22s : %10d\n", "RSSI-EXT0",
955 sc->debug.stats.rxstats.rs_rssi_ext0);
956 len += snprintf(buf + len, size - len,
957 "%22s : %10d\n", "RSSI-EXT1",
958 sc->debug.stats.rxstats.rs_rssi_ext1);
959 len += snprintf(buf + len, size - len,
960 "%22s : %10d\n", "RSSI-EXT2",
961 sc->debug.stats.rxstats.rs_rssi_ext2);
962 len += snprintf(buf + len, size - len,
963 "%22s : %10d\n", "Rx Antenna",
964 sc->debug.stats.rxstats.rs_antenna);
965 len += snprintf(buf + len, size - len,
966 "%22s : %10u\n", "RX-Pkts-All", 947 "%22s : %10u\n", "RX-Pkts-All",
967 sc->debug.stats.rxstats.rx_pkts_all); 948 sc->debug.stats.rxstats.rx_pkts_all);
968 len += snprintf(buf + len, size - len, 949 len += snprintf(buf + len, size - len,
@@ -1009,16 +990,7 @@ void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs)
1009 RX_PHY_ERR_INC(rs->rs_phyerr); 990 RX_PHY_ERR_INC(rs->rs_phyerr);
1010 } 991 }
1011 992
1012 sc->debug.stats.rxstats.rs_rssi_ctl0 = rs->rs_rssi_ctl0; 993#ifdef CONFIG_ATH9K_MAC_DEBUG
1013 sc->debug.stats.rxstats.rs_rssi_ctl1 = rs->rs_rssi_ctl1;
1014 sc->debug.stats.rxstats.rs_rssi_ctl2 = rs->rs_rssi_ctl2;
1015
1016 sc->debug.stats.rxstats.rs_rssi_ext0 = rs->rs_rssi_ext0;
1017 sc->debug.stats.rxstats.rs_rssi_ext1 = rs->rs_rssi_ext1;
1018 sc->debug.stats.rxstats.rs_rssi_ext2 = rs->rs_rssi_ext2;
1019
1020 sc->debug.stats.rxstats.rs_antenna = rs->rs_antenna;
1021
1022 spin_lock(&sc->debug.samp_lock); 994 spin_lock(&sc->debug.samp_lock);
1023 RX_SAMP_DBG(jiffies) = jiffies; 995 RX_SAMP_DBG(jiffies) = jiffies;
1024 RX_SAMP_DBG(rssi_ctl0) = rs->rs_rssi_ctl0; 996 RX_SAMP_DBG(rssi_ctl0) = rs->rs_rssi_ctl0;
@@ -1035,6 +1007,8 @@ void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs)
1035 sc->debug.rsidx = (sc->debug.rsidx + 1) % ATH_DBG_MAX_SAMPLES; 1007 sc->debug.rsidx = (sc->debug.rsidx + 1) % ATH_DBG_MAX_SAMPLES;
1036 spin_unlock(&sc->debug.samp_lock); 1008 spin_unlock(&sc->debug.samp_lock);
1037 1009
1010#endif
1011
1038#undef RX_STAT_INC 1012#undef RX_STAT_INC
1039#undef RX_PHY_ERR_INC 1013#undef RX_PHY_ERR_INC
1040#undef RX_SAMP_DBG 1014#undef RX_SAMP_DBG
@@ -1278,6 +1252,8 @@ static const struct file_operations fops_modal_eeprom = {
1278 .llseek = default_llseek, 1252 .llseek = default_llseek,
1279}; 1253};
1280 1254
1255#ifdef CONFIG_ATH9K_MAC_DEBUG
1256
1281void ath9k_debug_samp_bb_mac(struct ath_softc *sc) 1257void ath9k_debug_samp_bb_mac(struct ath_softc *sc)
1282{ 1258{
1283#define ATH_SAMP_DBG(c) (sc->debug.bb_mac_samp[sc->debug.sampidx].c) 1259#define ATH_SAMP_DBG(c) (sc->debug.bb_mac_samp[sc->debug.sampidx].c)
@@ -1551,6 +1527,7 @@ static const struct file_operations fops_samps = {
1551 .llseek = default_llseek, 1527 .llseek = default_llseek,
1552}; 1528};
1553 1529
1530#endif
1554 1531
1555int ath9k_init_debug(struct ath_hw *ah) 1532int ath9k_init_debug(struct ath_hw *ah)
1556{ 1533{
@@ -1604,8 +1581,10 @@ int ath9k_init_debug(struct ath_hw *ah)
1604 &fops_base_eeprom); 1581 &fops_base_eeprom);
1605 debugfs_create_file("modal_eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, 1582 debugfs_create_file("modal_eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
1606 &fops_modal_eeprom); 1583 &fops_modal_eeprom);
1584#ifdef CONFIG_ATH9K_MAC_DEBUG
1607 debugfs_create_file("samples", S_IRUSR, sc->debug.debugfs_phy, sc, 1585 debugfs_create_file("samples", S_IRUSR, sc->debug.debugfs_phy, sc,
1608 &fops_samps); 1586 &fops_samps);
1587#endif
1609 1588
1610 debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR, 1589 debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR,
1611 sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); 1590 sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask);
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h
index 776a24ada600..64fcfad467bf 100644
--- a/drivers/net/wireless/ath/ath9k/debug.h
+++ b/drivers/net/wireless/ath/ath9k/debug.h
@@ -165,13 +165,6 @@ struct ath_rx_stats {
165 u32 post_delim_crc_err; 165 u32 post_delim_crc_err;
166 u32 decrypt_busy_err; 166 u32 decrypt_busy_err;
167 u32 phy_err_stats[ATH9K_PHYERR_MAX]; 167 u32 phy_err_stats[ATH9K_PHYERR_MAX];
168 int8_t rs_rssi_ctl0;
169 int8_t rs_rssi_ctl1;
170 int8_t rs_rssi_ctl2;
171 int8_t rs_rssi_ext0;
172 int8_t rs_rssi_ext1;
173 int8_t rs_rssi_ext2;
174 u8 rs_antenna;
175}; 168};
176 169
177enum ath_reset_type { 170enum ath_reset_type {
@@ -235,16 +228,17 @@ struct ath9k_debug {
235 struct dentry *debugfs_phy; 228 struct dentry *debugfs_phy;
236 u32 regidx; 229 u32 regidx;
237 struct ath_stats stats; 230 struct ath_stats stats;
231#ifdef CONFIG_ATH9K_MAC_DEBUG
238 spinlock_t samp_lock; 232 spinlock_t samp_lock;
239 struct ath_dbg_bb_mac_samp bb_mac_samp[ATH_DBG_MAX_SAMPLES]; 233 struct ath_dbg_bb_mac_samp bb_mac_samp[ATH_DBG_MAX_SAMPLES];
240 u8 sampidx; 234 u8 sampidx;
241 u8 tsidx; 235 u8 tsidx;
242 u8 rsidx; 236 u8 rsidx;
237#endif
243}; 238};
244 239
245int ath9k_init_debug(struct ath_hw *ah); 240int ath9k_init_debug(struct ath_hw *ah);
246 241
247void ath9k_debug_samp_bb_mac(struct ath_softc *sc);
248void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status); 242void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
249void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, 243void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
250 struct ath_tx_status *ts, struct ath_txq *txq, 244 struct ath_tx_status *ts, struct ath_txq *txq,
@@ -258,10 +252,6 @@ static inline int ath9k_init_debug(struct ath_hw *ah)
258 return 0; 252 return 0;
259} 253}
260 254
261static inline void ath9k_debug_samp_bb_mac(struct ath_softc *sc)
262{
263}
264
265static inline void ath_debug_stat_interrupt(struct ath_softc *sc, 255static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
266 enum ath9k_int status) 256 enum ath9k_int status)
267{ 257{
@@ -282,4 +272,17 @@ static inline void ath_debug_stat_rx(struct ath_softc *sc,
282 272
283#endif /* CONFIG_ATH9K_DEBUGFS */ 273#endif /* CONFIG_ATH9K_DEBUGFS */
284 274
275#ifdef CONFIG_ATH9K_MAC_DEBUG
276
277void ath9k_debug_samp_bb_mac(struct ath_softc *sc);
278
279#else
280
281static inline void ath9k_debug_samp_bb_mac(struct ath_softc *sc)
282{
283}
284
285#endif
286
287
285#endif /* DEBUG_H */ 288#endif /* DEBUG_H */
diff --git a/drivers/net/wireless/ath/ath9k/gpio.c b/drivers/net/wireless/ath/ath9k/gpio.c
index 63e4c4b1cb3d..fbe23de1297f 100644
--- a/drivers/net/wireless/ath/ath9k/gpio.c
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
@@ -362,7 +362,8 @@ void ath9k_stop_btcoex(struct ath_softc *sc)
362 ath9k_hw_btcoex_disable(ah); 362 ath9k_hw_btcoex_disable(ah);
363 if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE) 363 if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE)
364 ath9k_btcoex_timer_pause(sc); 364 ath9k_btcoex_timer_pause(sc);
365 ath_mci_flush_profile(&sc->btcoex.mci); 365 if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_MCI)
366 ath_mci_flush_profile(&sc->btcoex.mci);
366 } 367 }
367} 368}
368 369
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 2a29a7cdef18..2b8f61c210e1 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -919,7 +919,6 @@ static int ath9k_htc_start(struct ieee80211_hw *hw)
919 /* setup initial channel */ 919 /* setup initial channel */
920 init_channel = ath9k_cmn_get_curchannel(hw, ah); 920 init_channel = ath9k_cmn_get_curchannel(hw, ah);
921 921
922 ath9k_hw_htc_resetinit(ah);
923 ret = ath9k_hw_reset(ah, init_channel, ah->caldata, false); 922 ret = ath9k_hw_reset(ah, init_channel, ah->caldata, false);
924 if (ret) { 923 if (ret) {
925 ath_err(common, 924 ath_err(common,
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 8c840cad3ac2..3022c4e4d103 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -449,6 +449,7 @@ static void ath9k_hw_init_defaults(struct ath_hw *ah)
449 ah->slottime = ATH9K_SLOT_TIME_9; 449 ah->slottime = ATH9K_SLOT_TIME_9;
450 ah->globaltxtimeout = (u32) -1; 450 ah->globaltxtimeout = (u32) -1;
451 ah->power_mode = ATH9K_PM_UNDEFINED; 451 ah->power_mode = ATH9K_PM_UNDEFINED;
452 ah->htc_reset_init = true;
452} 453}
453 454
454static int ath9k_hw_init_macaddr(struct ath_hw *ah) 455static int ath9k_hw_init_macaddr(struct ath_hw *ah)
@@ -555,7 +556,7 @@ static int __ath9k_hw_init(struct ath_hw *ah)
555 return -EIO; 556 return -EIO;
556 } 557 }
557 558
558 if (ah->config.serialize_regmode == SER_REG_MODE_AUTO) { 559 if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_AUTO) {
559 if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI || 560 if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI ||
560 ((AR_SREV_9160(ah) || AR_SREV_9280(ah)) && 561 ((AR_SREV_9160(ah) || AR_SREV_9280(ah)) &&
561 !ah->is_pciexpress)) { 562 !ah->is_pciexpress)) {
@@ -619,9 +620,6 @@ static int __ath9k_hw_init(struct ath_hw *ah)
619 if (!ah->is_pciexpress) 620 if (!ah->is_pciexpress)
620 ath9k_hw_disablepcie(ah); 621 ath9k_hw_disablepcie(ah);
621 622
622 if (!AR_SREV_9300_20_OR_LATER(ah))
623 ar9002_hw_cck_chan14_spread(ah);
624
625 r = ath9k_hw_post_init(ah); 623 r = ath9k_hw_post_init(ah);
626 if (r) 624 if (r)
627 return r; 625 return r;
@@ -1386,10 +1384,16 @@ static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type)
1386static bool ath9k_hw_chip_reset(struct ath_hw *ah, 1384static bool ath9k_hw_chip_reset(struct ath_hw *ah,
1387 struct ath9k_channel *chan) 1385 struct ath9k_channel *chan)
1388{ 1386{
1389 if (AR_SREV_9280(ah) && ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) { 1387 int reset_type = ATH9K_RESET_WARM;
1390 if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) 1388
1391 return false; 1389 if (AR_SREV_9280(ah)) {
1392 } else if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_WARM)) 1390 if (ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL))
1391 reset_type = ATH9K_RESET_POWER_ON;
1392 else
1393 reset_type = ATH9K_RESET_COLD;
1394 }
1395
1396 if (!ath9k_hw_set_reset_reg(ah, reset_type))
1393 return false; 1397 return false;
1394 1398
1395 if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) 1399 if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
@@ -1515,17 +1519,81 @@ bool ath9k_hw_check_alive(struct ath_hw *ah)
1515} 1519}
1516EXPORT_SYMBOL(ath9k_hw_check_alive); 1520EXPORT_SYMBOL(ath9k_hw_check_alive);
1517 1521
1522/*
1523 * Fast channel change:
1524 * (Change synthesizer based on channel freq without resetting chip)
1525 *
1526 * Don't do FCC when
1527 * - Flag is not set
1528 * - Chip is just coming out of full sleep
1529 * - Channel to be set is same as current channel
1530 * - Channel flags are different, (eg.,moving from 2GHz to 5GHz channel)
1531 */
1532static int ath9k_hw_do_fastcc(struct ath_hw *ah, struct ath9k_channel *chan)
1533{
1534 struct ath_common *common = ath9k_hw_common(ah);
1535 int ret;
1536
1537 if (AR_SREV_9280(ah) && common->bus_ops->ath_bus_type == ATH_PCI)
1538 goto fail;
1539
1540 if (ah->chip_fullsleep)
1541 goto fail;
1542
1543 if (!ah->curchan)
1544 goto fail;
1545
1546 if (chan->channel == ah->curchan->channel)
1547 goto fail;
1548
1549 if ((chan->channelFlags & CHANNEL_ALL) !=
1550 (ah->curchan->channelFlags & CHANNEL_ALL))
1551 goto fail;
1552
1553 if (!ath9k_hw_check_alive(ah))
1554 goto fail;
1555
1556 /*
1557 * For AR9462, make sure that calibration data for
1558 * re-using are present.
1559 */
1560 if (AR_SREV_9462(ah) && (!ah->caldata ||
1561 !ah->caldata->done_txiqcal_once ||
1562 !ah->caldata->done_txclcal_once ||
1563 !ah->caldata->rtt_hist.num_readings))
1564 goto fail;
1565
1566 ath_dbg(common, RESET, "FastChannelChange for %d -> %d\n",
1567 ah->curchan->channel, chan->channel);
1568
1569 ret = ath9k_hw_channel_change(ah, chan);
1570 if (!ret)
1571 goto fail;
1572
1573 ath9k_hw_loadnf(ah, ah->curchan);
1574 ath9k_hw_start_nfcal(ah, true);
1575
1576 if ((ah->caps.hw_caps & ATH9K_HW_CAP_MCI) && ar9003_mci_is_ready(ah))
1577 ar9003_mci_2g5g_switch(ah, true);
1578
1579 if (AR_SREV_9271(ah))
1580 ar9002_hw_load_ani_reg(ah, chan);
1581
1582 return 0;
1583fail:
1584 return -EINVAL;
1585}
1586
1518int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, 1587int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
1519 struct ath9k_hw_cal_data *caldata, bool bChannelChange) 1588 struct ath9k_hw_cal_data *caldata, bool fastcc)
1520{ 1589{
1521 struct ath_common *common = ath9k_hw_common(ah); 1590 struct ath_common *common = ath9k_hw_common(ah);
1522 u32 saveLedState; 1591 u32 saveLedState;
1523 struct ath9k_channel *curchan = ah->curchan;
1524 u32 saveDefAntenna; 1592 u32 saveDefAntenna;
1525 u32 macStaId1; 1593 u32 macStaId1;
1526 u64 tsf = 0; 1594 u64 tsf = 0;
1527 int i, r; 1595 int i, r;
1528 bool allow_fbs = false, start_mci_reset = false; 1596 bool start_mci_reset = false;
1529 bool mci = !!(ah->caps.hw_caps & ATH9K_HW_CAP_MCI); 1597 bool mci = !!(ah->caps.hw_caps & ATH9K_HW_CAP_MCI);
1530 bool save_fullsleep = ah->chip_fullsleep; 1598 bool save_fullsleep = ah->chip_fullsleep;
1531 1599
@@ -1538,8 +1606,8 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
1538 if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) 1606 if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
1539 return -EIO; 1607 return -EIO;
1540 1608
1541 if (curchan && !ah->chip_fullsleep) 1609 if (ah->curchan && !ah->chip_fullsleep)
1542 ath9k_hw_getnf(ah, curchan); 1610 ath9k_hw_getnf(ah, ah->curchan);
1543 1611
1544 ah->caldata = caldata; 1612 ah->caldata = caldata;
1545 if (caldata && 1613 if (caldata &&
@@ -1552,32 +1620,10 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
1552 } 1620 }
1553 ah->noise = ath9k_hw_getchan_noise(ah, chan); 1621 ah->noise = ath9k_hw_getchan_noise(ah, chan);
1554 1622
1555 if (AR_SREV_9280(ah) && common->bus_ops->ath_bus_type == ATH_PCI) 1623 if (fastcc) {
1556 bChannelChange = false; 1624 r = ath9k_hw_do_fastcc(ah, chan);
1557 1625 if (!r)
1558 if (caldata && 1626 return r;
1559 caldata->done_txiqcal_once &&
1560 caldata->done_txclcal_once &&
1561 caldata->rtt_hist.num_readings)
1562 allow_fbs = true;
1563
1564 if (bChannelChange &&
1565 (ah->chip_fullsleep != true) &&
1566 (ah->curchan != NULL) &&
1567 (chan->channel != ah->curchan->channel) &&
1568 (allow_fbs ||
1569 ((chan->channelFlags & CHANNEL_ALL) ==
1570 (ah->curchan->channelFlags & CHANNEL_ALL)))) {
1571 if (ath9k_hw_channel_change(ah, chan)) {
1572 ath9k_hw_loadnf(ah, ah->curchan);
1573 ath9k_hw_start_nfcal(ah, true);
1574 if (mci && ar9003_mci_is_ready(ah))
1575 ar9003_mci_2g5g_switch(ah, true);
1576
1577 if (AR_SREV_9271(ah))
1578 ar9002_hw_load_ani_reg(ah, chan);
1579 return 0;
1580 }
1581 } 1627 }
1582 1628
1583 if (mci) 1629 if (mci)
@@ -2384,8 +2430,17 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
2384 if (AR_SREV_9485_OR_LATER(ah)) 2430 if (AR_SREV_9485_OR_LATER(ah))
2385 ah->enabled_cals |= TX_IQ_ON_AGC_CAL; 2431 ah->enabled_cals |= TX_IQ_ON_AGC_CAL;
2386 } 2432 }
2387 if (AR_SREV_9462(ah)) 2433
2388 pCap->hw_caps |= ATH9K_HW_CAP_RTT | ATH9K_HW_CAP_MCI; 2434 if (AR_SREV_9462(ah)) {
2435
2436 if (!(ah->ent_mode & AR_ENT_OTP_49GHZ_DISABLE))
2437 pCap->hw_caps |= ATH9K_HW_CAP_MCI;
2438
2439 if (AR_SREV_9462_20(ah))
2440 pCap->hw_caps |= ATH9K_HW_CAP_RTT;
2441
2442 }
2443
2389 2444
2390 return 0; 2445 return 0;
2391} 2446}
@@ -2511,12 +2566,6 @@ void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val)
2511} 2566}
2512EXPORT_SYMBOL(ath9k_hw_set_gpio); 2567EXPORT_SYMBOL(ath9k_hw_set_gpio);
2513 2568
2514u32 ath9k_hw_getdefantenna(struct ath_hw *ah)
2515{
2516 return REG_READ(ah, AR_DEF_ANTENNA) & 0x7;
2517}
2518EXPORT_SYMBOL(ath9k_hw_getdefantenna);
2519
2520void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna) 2569void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna)
2521{ 2570{
2522 REG_WRITE(ah, AR_DEF_ANTENNA, (antenna & 0x7)); 2571 REG_WRITE(ah, AR_DEF_ANTENNA, (antenna & 0x7));
@@ -2574,6 +2623,7 @@ bool ath9k_hw_phy_disable(struct ath_hw *ah)
2574 return false; 2623 return false;
2575 2624
2576 ath9k_hw_init_pll(ah, NULL); 2625 ath9k_hw_init_pll(ah, NULL);
2626 ah->htc_reset_init = true;
2577 return true; 2627 return true;
2578} 2628}
2579EXPORT_SYMBOL(ath9k_hw_phy_disable); 2629EXPORT_SYMBOL(ath9k_hw_phy_disable);
@@ -2934,12 +2984,6 @@ EXPORT_SYMBOL(ath_gen_timer_isr);
2934/* HTC */ 2984/* HTC */
2935/********/ 2985/********/
2936 2986
2937void ath9k_hw_htc_resetinit(struct ath_hw *ah)
2938{
2939 ah->htc_reset_init = true;
2940}
2941EXPORT_SYMBOL(ath9k_hw_htc_resetinit);
2942
2943static struct { 2987static struct {
2944 u32 version; 2988 u32 version;
2945 const char * name; 2989 const char * name;
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 1707137e0a30..aa1680a0c7fd 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -827,19 +827,14 @@ struct ath_hw {
827 struct ar5416IniArray iniAddac; 827 struct ar5416IniArray iniAddac;
828 struct ar5416IniArray iniPcieSerdes; 828 struct ar5416IniArray iniPcieSerdes;
829 struct ar5416IniArray iniPcieSerdesLowPower; 829 struct ar5416IniArray iniPcieSerdesLowPower;
830 struct ar5416IniArray iniModesAdditional; 830 struct ar5416IniArray iniModesFastClock;
831 struct ar5416IniArray iniModesAdditional_40M; 831 struct ar5416IniArray iniAdditional;
832 struct ar5416IniArray iniModesRxGain; 832 struct ar5416IniArray iniModesRxGain;
833 struct ar5416IniArray iniModesTxGain; 833 struct ar5416IniArray iniModesTxGain;
834 struct ar5416IniArray iniModes_9271_1_0_only;
835 struct ar5416IniArray iniCckfirNormal; 834 struct ar5416IniArray iniCckfirNormal;
836 struct ar5416IniArray iniCckfirJapan2484; 835 struct ar5416IniArray iniCckfirJapan2484;
837 struct ar5416IniArray ini_japan2484; 836 struct ar5416IniArray ini_japan2484;
838 struct ar5416IniArray iniCommon_normal_cck_fir_coeff_9271;
839 struct ar5416IniArray iniCommon_japan_2484_cck_fir_coeff_9271;
840 struct ar5416IniArray iniModes_9271_ANI_reg; 837 struct ar5416IniArray iniModes_9271_ANI_reg;
841 struct ar5416IniArray iniModes_high_power_tx_gain_9271;
842 struct ar5416IniArray iniModes_normal_power_tx_gain_9271;
843 struct ar5416IniArray ini_radio_post_sys2ant; 838 struct ar5416IniArray ini_radio_post_sys2ant;
844 struct ar5416IniArray ini_BTCOEX_MAX_TXPWR; 839 struct ar5416IniArray ini_BTCOEX_MAX_TXPWR;
845 840
@@ -924,7 +919,7 @@ const char *ath9k_hw_probe(u16 vendorid, u16 devid);
924void ath9k_hw_deinit(struct ath_hw *ah); 919void ath9k_hw_deinit(struct ath_hw *ah);
925int ath9k_hw_init(struct ath_hw *ah); 920int ath9k_hw_init(struct ath_hw *ah);
926int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, 921int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
927 struct ath9k_hw_cal_data *caldata, bool bChannelChange); 922 struct ath9k_hw_cal_data *caldata, bool fastcc);
928int ath9k_hw_fill_cap_info(struct ath_hw *ah); 923int ath9k_hw_fill_cap_info(struct ath_hw *ah);
929u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan); 924u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan);
930 925
@@ -934,7 +929,6 @@ u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio);
934void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio, 929void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio,
935 u32 ah_signal_type); 930 u32 ah_signal_type);
936void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val); 931void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val);
937u32 ath9k_hw_getdefantenna(struct ath_hw *ah);
938void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna); 932void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna);
939 933
940/* General Operation */ 934/* General Operation */
@@ -988,9 +982,6 @@ void ath_gen_timer_isr(struct ath_hw *hw);
988 982
989void ath9k_hw_name(struct ath_hw *ah, char *hw_name, size_t len); 983void ath9k_hw_name(struct ath_hw *ah, char *hw_name, size_t len);
990 984
991/* HTC */
992void ath9k_hw_htc_resetinit(struct ath_hw *ah);
993
994/* PHY */ 985/* PHY */
995void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, 986void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled,
996 u32 *coef_mantissa, u32 *coef_exponent); 987 u32 *coef_mantissa, u32 *coef_exponent);
@@ -1000,7 +991,6 @@ void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan);
1000 * Code Specific to AR5008, AR9001 or AR9002, 991 * Code Specific to AR5008, AR9001 or AR9002,
1001 * we stuff these here to avoid callbacks for AR9003. 992 * we stuff these here to avoid callbacks for AR9003.
1002 */ 993 */
1003void ar9002_hw_cck_chan14_spread(struct ath_hw *ah);
1004int ar9002_hw_rf_claim(struct ath_hw *ah); 994int ar9002_hw_rf_claim(struct ath_hw *ah);
1005void ar9002_hw_enable_async_fifo(struct ath_hw *ah); 995void ar9002_hw_enable_async_fifo(struct ath_hw *ah);
1006 996
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index d8b05961f7e3..60159f4ee532 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -172,7 +172,7 @@ static void ath9k_iowrite32(void *hw_priv, u32 val, u32 reg_offset)
172 struct ath_common *common = ath9k_hw_common(ah); 172 struct ath_common *common = ath9k_hw_common(ah);
173 struct ath_softc *sc = (struct ath_softc *) common->priv; 173 struct ath_softc *sc = (struct ath_softc *) common->priv;
174 174
175 if (ah->config.serialize_regmode == SER_REG_MODE_ON) { 175 if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_ON) {
176 unsigned long flags; 176 unsigned long flags;
177 spin_lock_irqsave(&sc->sc_serial_rw, flags); 177 spin_lock_irqsave(&sc->sc_serial_rw, flags);
178 iowrite32(val, sc->mem + reg_offset); 178 iowrite32(val, sc->mem + reg_offset);
@@ -188,7 +188,7 @@ static unsigned int ath9k_ioread32(void *hw_priv, u32 reg_offset)
188 struct ath_softc *sc = (struct ath_softc *) common->priv; 188 struct ath_softc *sc = (struct ath_softc *) common->priv;
189 u32 val; 189 u32 val;
190 190
191 if (ah->config.serialize_regmode == SER_REG_MODE_ON) { 191 if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_ON) {
192 unsigned long flags; 192 unsigned long flags;
193 spin_lock_irqsave(&sc->sc_serial_rw, flags); 193 spin_lock_irqsave(&sc->sc_serial_rw, flags);
194 val = ioread32(sc->mem + reg_offset); 194 val = ioread32(sc->mem + reg_offset);
@@ -219,7 +219,7 @@ static unsigned int ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 cl
219 unsigned long uninitialized_var(flags); 219 unsigned long uninitialized_var(flags);
220 u32 val; 220 u32 val;
221 221
222 if (ah->config.serialize_regmode == SER_REG_MODE_ON) { 222 if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_ON) {
223 spin_lock_irqsave(&sc->sc_serial_rw, flags); 223 spin_lock_irqsave(&sc->sc_serial_rw, flags);
224 val = __ath9k_reg_rmw(sc, reg_offset, set, clr); 224 val = __ath9k_reg_rmw(sc, reg_offset, set, clr);
225 spin_unlock_irqrestore(&sc->sc_serial_rw, flags); 225 spin_unlock_irqrestore(&sc->sc_serial_rw, flags);
@@ -484,19 +484,11 @@ static void ath9k_init_misc(struct ath_softc *sc)
484{ 484{
485 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 485 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
486 int i = 0; 486 int i = 0;
487
487 setup_timer(&common->ani.timer, ath_ani_calibrate, (unsigned long)sc); 488 setup_timer(&common->ani.timer, ath_ani_calibrate, (unsigned long)sc);
488 489
489 sc->config.txpowlimit = ATH_TXPOWER_MAX; 490 sc->config.txpowlimit = ATH_TXPOWER_MAX;
490
491 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
492 sc->sc_flags |= SC_OP_TXAGGR;
493 sc->sc_flags |= SC_OP_RXAGGR;
494 }
495
496 sc->rx.defant = ath9k_hw_getdefantenna(sc->sc_ah);
497
498 memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN); 491 memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN);
499
500 sc->beacon.slottime = ATH9K_SLOT_TIME_9; 492 sc->beacon.slottime = ATH9K_SLOT_TIME_9;
501 493
502 for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) 494 for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++)
@@ -555,9 +547,11 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
555 mutex_init(&sc->mutex); 547 mutex_init(&sc->mutex);
556#ifdef CONFIG_ATH9K_DEBUGFS 548#ifdef CONFIG_ATH9K_DEBUGFS
557 spin_lock_init(&sc->nodes_lock); 549 spin_lock_init(&sc->nodes_lock);
558 spin_lock_init(&sc->debug.samp_lock);
559 INIT_LIST_HEAD(&sc->nodes); 550 INIT_LIST_HEAD(&sc->nodes);
560#endif 551#endif
552#ifdef CONFIG_ATH9K_MAC_DEBUG
553 spin_lock_init(&sc->debug.samp_lock);
554#endif
561 tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc); 555 tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc);
562 tasklet_init(&sc->bcon_tasklet, ath_beacon_tasklet, 556 tasklet_init(&sc->bcon_tasklet, ath_beacon_tasklet,
563 (unsigned long)sc); 557 (unsigned long)sc);
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
index e196aba77acf..f7bd2532269c 100644
--- a/drivers/net/wireless/ath/ath9k/mac.c
+++ b/drivers/net/wireless/ath/ath9k/mac.c
@@ -185,13 +185,6 @@ bool ath9k_hw_stop_dma_queue(struct ath_hw *ah, u32 q)
185} 185}
186EXPORT_SYMBOL(ath9k_hw_stop_dma_queue); 186EXPORT_SYMBOL(ath9k_hw_stop_dma_queue);
187 187
188void ath9k_hw_gettxintrtxqs(struct ath_hw *ah, u32 *txqs)
189{
190 *txqs &= ah->intr_txqs;
191 ah->intr_txqs &= ~(*txqs);
192}
193EXPORT_SYMBOL(ath9k_hw_gettxintrtxqs);
194
195bool ath9k_hw_set_txq_props(struct ath_hw *ah, int q, 188bool ath9k_hw_set_txq_props(struct ath_hw *ah, int q,
196 const struct ath9k_tx_queue_info *qinfo) 189 const struct ath9k_tx_queue_info *qinfo)
197{ 190{
@@ -340,6 +333,15 @@ int ath9k_hw_setuptxqueue(struct ath_hw *ah, enum ath9k_tx_queue type,
340} 333}
341EXPORT_SYMBOL(ath9k_hw_setuptxqueue); 334EXPORT_SYMBOL(ath9k_hw_setuptxqueue);
342 335
336static void ath9k_hw_clear_queue_interrupts(struct ath_hw *ah, u32 q)
337{
338 ah->txok_interrupt_mask &= ~(1 << q);
339 ah->txerr_interrupt_mask &= ~(1 << q);
340 ah->txdesc_interrupt_mask &= ~(1 << q);
341 ah->txeol_interrupt_mask &= ~(1 << q);
342 ah->txurn_interrupt_mask &= ~(1 << q);
343}
344
343bool ath9k_hw_releasetxqueue(struct ath_hw *ah, u32 q) 345bool ath9k_hw_releasetxqueue(struct ath_hw *ah, u32 q)
344{ 346{
345 struct ath_common *common = ath9k_hw_common(ah); 347 struct ath_common *common = ath9k_hw_common(ah);
@@ -354,11 +356,7 @@ bool ath9k_hw_releasetxqueue(struct ath_hw *ah, u32 q)
354 ath_dbg(common, QUEUE, "Release TX queue: %u\n", q); 356 ath_dbg(common, QUEUE, "Release TX queue: %u\n", q);
355 357
356 qi->tqi_type = ATH9K_TX_QUEUE_INACTIVE; 358 qi->tqi_type = ATH9K_TX_QUEUE_INACTIVE;
357 ah->txok_interrupt_mask &= ~(1 << q); 359 ath9k_hw_clear_queue_interrupts(ah, q);
358 ah->txerr_interrupt_mask &= ~(1 << q);
359 ah->txdesc_interrupt_mask &= ~(1 << q);
360 ah->txeol_interrupt_mask &= ~(1 << q);
361 ah->txurn_interrupt_mask &= ~(1 << q);
362 ath9k_hw_set_txq_interrupts(ah, qi); 360 ath9k_hw_set_txq_interrupts(ah, qi);
363 361
364 return true; 362 return true;
@@ -510,26 +508,17 @@ bool ath9k_hw_resettxqueue(struct ath_hw *ah, u32 q)
510 if (AR_SREV_9300_20_OR_LATER(ah)) 508 if (AR_SREV_9300_20_OR_LATER(ah))
511 REG_WRITE(ah, AR_Q_DESC_CRCCHK, AR_Q_DESC_CRCCHK_EN); 509 REG_WRITE(ah, AR_Q_DESC_CRCCHK, AR_Q_DESC_CRCCHK_EN);
512 510
513 if (qi->tqi_qflags & TXQ_FLAG_TXOKINT_ENABLE) 511 ath9k_hw_clear_queue_interrupts(ah, q);
512 if (qi->tqi_qflags & TXQ_FLAG_TXINT_ENABLE) {
514 ah->txok_interrupt_mask |= 1 << q; 513 ah->txok_interrupt_mask |= 1 << q;
515 else
516 ah->txok_interrupt_mask &= ~(1 << q);
517 if (qi->tqi_qflags & TXQ_FLAG_TXERRINT_ENABLE)
518 ah->txerr_interrupt_mask |= 1 << q; 514 ah->txerr_interrupt_mask |= 1 << q;
519 else 515 }
520 ah->txerr_interrupt_mask &= ~(1 << q);
521 if (qi->tqi_qflags & TXQ_FLAG_TXDESCINT_ENABLE) 516 if (qi->tqi_qflags & TXQ_FLAG_TXDESCINT_ENABLE)
522 ah->txdesc_interrupt_mask |= 1 << q; 517 ah->txdesc_interrupt_mask |= 1 << q;
523 else
524 ah->txdesc_interrupt_mask &= ~(1 << q);
525 if (qi->tqi_qflags & TXQ_FLAG_TXEOLINT_ENABLE) 518 if (qi->tqi_qflags & TXQ_FLAG_TXEOLINT_ENABLE)
526 ah->txeol_interrupt_mask |= 1 << q; 519 ah->txeol_interrupt_mask |= 1 << q;
527 else
528 ah->txeol_interrupt_mask &= ~(1 << q);
529 if (qi->tqi_qflags & TXQ_FLAG_TXURNINT_ENABLE) 520 if (qi->tqi_qflags & TXQ_FLAG_TXURNINT_ENABLE)
530 ah->txurn_interrupt_mask |= 1 << q; 521 ah->txurn_interrupt_mask |= 1 << q;
531 else
532 ah->txurn_interrupt_mask &= ~(1 << q);
533 ath9k_hw_set_txq_interrupts(ah, qi); 522 ath9k_hw_set_txq_interrupts(ah, qi);
534 523
535 return true; 524 return true;
@@ -745,7 +734,10 @@ int ath9k_hw_beaconq_setup(struct ath_hw *ah)
745 qi.tqi_aifs = 1; 734 qi.tqi_aifs = 1;
746 qi.tqi_cwmin = 0; 735 qi.tqi_cwmin = 0;
747 qi.tqi_cwmax = 0; 736 qi.tqi_cwmax = 0;
748 /* NB: don't enable any interrupts */ 737
738 if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
739 qi.tqi_qflags = TXQ_FLAG_TXINT_ENABLE;
740
749 return ath9k_hw_setuptxqueue(ah, ATH9K_TX_QUEUE_BEACON, &qi); 741 return ath9k_hw_setuptxqueue(ah, ATH9K_TX_QUEUE_BEACON, &qi);
750} 742}
751EXPORT_SYMBOL(ath9k_hw_beaconq_setup); 743EXPORT_SYMBOL(ath9k_hw_beaconq_setup);
diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h
index 11dbd1473a13..21c955609e6c 100644
--- a/drivers/net/wireless/ath/ath9k/mac.h
+++ b/drivers/net/wireless/ath/ath9k/mac.h
@@ -583,8 +583,7 @@ enum ath9k_tx_queue {
583#define ATH9K_WME_UPSD 4 583#define ATH9K_WME_UPSD 4
584 584
585enum ath9k_tx_queue_flags { 585enum ath9k_tx_queue_flags {
586 TXQ_FLAG_TXOKINT_ENABLE = 0x0001, 586 TXQ_FLAG_TXINT_ENABLE = 0x0001,
587 TXQ_FLAG_TXERRINT_ENABLE = 0x0001,
588 TXQ_FLAG_TXDESCINT_ENABLE = 0x0002, 587 TXQ_FLAG_TXDESCINT_ENABLE = 0x0002,
589 TXQ_FLAG_TXEOLINT_ENABLE = 0x0004, 588 TXQ_FLAG_TXEOLINT_ENABLE = 0x0004,
590 TXQ_FLAG_TXURNINT_ENABLE = 0x0008, 589 TXQ_FLAG_TXURNINT_ENABLE = 0x0008,
@@ -714,7 +713,6 @@ u32 ath9k_hw_numtxpending(struct ath_hw *ah, u32 q);
714bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel); 713bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel);
715bool ath9k_hw_stop_dma_queue(struct ath_hw *ah, u32 q); 714bool ath9k_hw_stop_dma_queue(struct ath_hw *ah, u32 q);
716void ath9k_hw_abort_tx_dma(struct ath_hw *ah); 715void ath9k_hw_abort_tx_dma(struct ath_hw *ah);
717void ath9k_hw_gettxintrtxqs(struct ath_hw *ah, u32 *txqs);
718bool ath9k_hw_set_txq_props(struct ath_hw *ah, int q, 716bool ath9k_hw_set_txq_props(struct ath_hw *ah, int q,
719 const struct ath9k_tx_queue_info *qinfo); 717 const struct ath9k_tx_queue_info *qinfo);
720bool ath9k_hw_get_txq_props(struct ath_hw *ah, int q, 718bool ath9k_hw_get_txq_props(struct ath_hw *ah, int q,
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 02e95c8e7465..38794850f005 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -118,13 +118,15 @@ void ath9k_ps_restore(struct ath_softc *sc)
118 if (--sc->ps_usecount != 0) 118 if (--sc->ps_usecount != 0)
119 goto unlock; 119 goto unlock;
120 120
121 if (sc->ps_idle && (sc->ps_flags & PS_WAIT_FOR_TX_ACK)) 121 if (sc->ps_flags & PS_WAIT_FOR_TX_ACK)
122 goto unlock;
123
124 if (sc->ps_idle)
122 mode = ATH9K_PM_FULL_SLEEP; 125 mode = ATH9K_PM_FULL_SLEEP;
123 else if (sc->ps_enabled && 126 else if (sc->ps_enabled &&
124 !(sc->ps_flags & (PS_WAIT_FOR_BEACON | 127 !(sc->ps_flags & (PS_WAIT_FOR_BEACON |
125 PS_WAIT_FOR_CAB | 128 PS_WAIT_FOR_CAB |
126 PS_WAIT_FOR_PSPOLL_DATA | 129 PS_WAIT_FOR_PSPOLL_DATA)))
127 PS_WAIT_FOR_TX_ACK)))
128 mode = ATH9K_PM_NETWORK_SLEEP; 130 mode = ATH9K_PM_NETWORK_SLEEP;
129 else 131 else
130 goto unlock; 132 goto unlock;
@@ -332,10 +334,6 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan,
332 hchan = ah->curchan; 334 hchan = ah->curchan;
333 } 335 }
334 336
335 if (fastcc && (ah->chip_fullsleep ||
336 !ath9k_hw_check_alive(ah)))
337 fastcc = false;
338
339 if (!ath_prepare_reset(sc, retry_tx, flush)) 337 if (!ath_prepare_reset(sc, retry_tx, flush))
340 fastcc = false; 338 fastcc = false;
341 339
@@ -641,7 +639,8 @@ static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta,
641#endif 639#endif
642 an->sta = sta; 640 an->sta = sta;
643 an->vif = vif; 641 an->vif = vif;
644 if (sc->sc_flags & SC_OP_TXAGGR) { 642
643 if (sta->ht_cap.ht_supported) {
645 ath_tx_node_init(sc, an); 644 ath_tx_node_init(sc, an);
646 an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + 645 an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR +
647 sta->ht_cap.ampdu_factor); 646 sta->ht_cap.ampdu_factor);
@@ -660,7 +659,7 @@ static void ath_node_detach(struct ath_softc *sc, struct ieee80211_sta *sta)
660 an->sta = NULL; 659 an->sta = NULL;
661#endif 660#endif
662 661
663 if (sc->sc_flags & SC_OP_TXAGGR) 662 if (sta->ht_cap.ht_supported)
664 ath_tx_node_cleanup(sc, an); 663 ath_tx_node_cleanup(sc, an);
665} 664}
666 665
@@ -993,12 +992,8 @@ static int ath9k_start(struct ieee80211_hw *hw)
993 curchan->center_freq); 992 curchan->center_freq);
994 993
995 ath9k_ps_wakeup(sc); 994 ath9k_ps_wakeup(sc);
996
997 mutex_lock(&sc->mutex); 995 mutex_lock(&sc->mutex);
998 996
999 /* setup initial channel */
1000 sc->chan_idx = curchan->hw_value;
1001
1002 init_channel = ath9k_cmn_get_curchannel(hw, ah); 997 init_channel = ath9k_cmn_get_curchannel(hw, ah);
1003 998
1004 /* Reset SERDES registers */ 999 /* Reset SERDES registers */
@@ -1047,9 +1042,6 @@ static int ath9k_start(struct ieee80211_hw *hw)
1047 sc->sc_flags &= ~SC_OP_INVALID; 1042 sc->sc_flags &= ~SC_OP_INVALID;
1048 sc->sc_ah->is_monitoring = false; 1043 sc->sc_ah->is_monitoring = false;
1049 1044
1050 /* Disable BMISS interrupt when we're not associated */
1051 ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);
1052
1053 if (!ath_complete_reset(sc, false)) { 1045 if (!ath_complete_reset(sc, false)) {
1054 r = -EIO; 1046 r = -EIO;
1055 spin_unlock_bh(&sc->sc_pcu_lock); 1047 spin_unlock_bh(&sc->sc_pcu_lock);
@@ -1277,7 +1269,6 @@ static void ath9k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
1277 iter_data->nwds++; 1269 iter_data->nwds++;
1278 break; 1270 break;
1279 default: 1271 default:
1280 iter_data->nothers++;
1281 break; 1272 break;
1282 } 1273 }
1283} 1274}
@@ -1761,7 +1752,7 @@ static void ath9k_sta_notify(struct ieee80211_hw *hw,
1761 struct ath_softc *sc = hw->priv; 1752 struct ath_softc *sc = hw->priv;
1762 struct ath_node *an = (struct ath_node *) sta->drv_priv; 1753 struct ath_node *an = (struct ath_node *) sta->drv_priv;
1763 1754
1764 if (!(sc->sc_flags & SC_OP_TXAGGR)) 1755 if (!sta->ht_cap.ht_supported)
1765 return; 1756 return;
1766 1757
1767 switch (cmd) { 1758 switch (cmd) {
@@ -1973,7 +1964,7 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
1973 ath9k_ps_wakeup(sc); 1964 ath9k_ps_wakeup(sc);
1974 mutex_lock(&sc->mutex); 1965 mutex_lock(&sc->mutex);
1975 1966
1976 if (changed & BSS_CHANGED_BSSID) { 1967 if (changed & BSS_CHANGED_ASSOC) {
1977 ath9k_config_bss(sc, vif); 1968 ath9k_config_bss(sc, vif);
1978 1969
1979 ath_dbg(common, CONFIG, "BSSID: %pM aid: 0x%x\n", 1970 ath_dbg(common, CONFIG, "BSSID: %pM aid: 0x%x\n",
@@ -2053,25 +2044,6 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
2053 ath_beacon_config(sc, vif); 2044 ath_beacon_config(sc, vif);
2054 } 2045 }
2055 2046
2056 if (changed & BSS_CHANGED_ERP_PREAMBLE) {
2057 ath_dbg(common, CONFIG, "BSS Changed PREAMBLE %d\n",
2058 bss_conf->use_short_preamble);
2059 if (bss_conf->use_short_preamble)
2060 sc->sc_flags |= SC_OP_PREAMBLE_SHORT;
2061 else
2062 sc->sc_flags &= ~SC_OP_PREAMBLE_SHORT;
2063 }
2064
2065 if (changed & BSS_CHANGED_ERP_CTS_PROT) {
2066 ath_dbg(common, CONFIG, "BSS Changed CTS PROT %d\n",
2067 bss_conf->use_cts_prot);
2068 if (bss_conf->use_cts_prot &&
2069 hw->conf.channel->band != IEEE80211_BAND_5GHZ)
2070 sc->sc_flags |= SC_OP_PROTECT_ENABLE;
2071 else
2072 sc->sc_flags &= ~SC_OP_PROTECT_ENABLE;
2073 }
2074
2075 mutex_unlock(&sc->mutex); 2047 mutex_unlock(&sc->mutex);
2076 ath9k_ps_restore(sc); 2048 ath9k_ps_restore(sc);
2077} 2049}
@@ -2129,15 +2101,10 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
2129 2101
2130 switch (action) { 2102 switch (action) {
2131 case IEEE80211_AMPDU_RX_START: 2103 case IEEE80211_AMPDU_RX_START:
2132 if (!(sc->sc_flags & SC_OP_RXAGGR))
2133 ret = -ENOTSUPP;
2134 break; 2104 break;
2135 case IEEE80211_AMPDU_RX_STOP: 2105 case IEEE80211_AMPDU_RX_STOP:
2136 break; 2106 break;
2137 case IEEE80211_AMPDU_TX_START: 2107 case IEEE80211_AMPDU_TX_START:
2138 if (!(sc->sc_flags & SC_OP_TXAGGR))
2139 return -EOPNOTSUPP;
2140
2141 ath9k_ps_wakeup(sc); 2108 ath9k_ps_wakeup(sc);
2142 ret = ath_tx_aggr_start(sc, sta, tid, ssn); 2109 ret = ath_tx_aggr_start(sc, sta, tid, ssn);
2143 if (!ret) 2110 if (!ret)
@@ -2300,6 +2267,7 @@ static int ath9k_tx_last_beacon(struct ieee80211_hw *hw)
2300 struct ath_vif *avp; 2267 struct ath_vif *avp;
2301 struct ath_buf *bf; 2268 struct ath_buf *bf;
2302 struct ath_tx_status ts; 2269 struct ath_tx_status ts;
2270 bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA);
2303 int status; 2271 int status;
2304 2272
2305 vif = sc->beacon.bslot[0]; 2273 vif = sc->beacon.bslot[0];
@@ -2310,7 +2278,7 @@ static int ath9k_tx_last_beacon(struct ieee80211_hw *hw)
2310 if (!avp->is_bslot_active) 2278 if (!avp->is_bslot_active)
2311 return 0; 2279 return 0;
2312 2280
2313 if (!sc->beacon.tx_processed) { 2281 if (!sc->beacon.tx_processed && !edma) {
2314 tasklet_disable(&sc->bcon_tasklet); 2282 tasklet_disable(&sc->bcon_tasklet);
2315 2283
2316 bf = avp->av_bcbuf; 2284 bf = avp->av_bcbuf;
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index b8c6c38cbb98..4f848493fece 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -748,7 +748,8 @@ static void ath_rc_rate_set_rtscts(struct ath_softc *sc,
748 * If 802.11g protection is enabled, determine whether to use RTS/CTS or 748 * If 802.11g protection is enabled, determine whether to use RTS/CTS or
749 * just CTS. Note that this is only done for OFDM/HT unicast frames. 749 * just CTS. Note that this is only done for OFDM/HT unicast frames.
750 */ 750 */
751 if ((sc->sc_flags & SC_OP_PROTECT_ENABLE) && 751 if ((tx_info->control.vif &&
752 tx_info->control.vif->bss_conf.use_cts_prot) &&
752 (rate_table->info[rix].phy == WLAN_RC_PHY_OFDM || 753 (rate_table->info[rix].phy == WLAN_RC_PHY_OFDM ||
753 WLAN_RC_PHY_HT(rate_table->info[rix].phy))) { 754 WLAN_RC_PHY_HT(rate_table->info[rix].phy))) {
754 rates[0].flags |= IEEE80211_TX_RC_USE_CTS_PROTECT; 755 rates[0].flags |= IEEE80211_TX_RC_USE_CTS_PROTECT;
@@ -1226,7 +1227,7 @@ static void ath_rc_init(struct ath_softc *sc,
1226 ath_rc_init_valid_rate_idx(ath_rc_priv); 1227 ath_rc_init_valid_rate_idx(ath_rc_priv);
1227 1228
1228 for (i = 0; i < WLAN_RC_PHY_MAX; i++) { 1229 for (i = 0; i < WLAN_RC_PHY_MAX; i++) {
1229 for (j = 0; j < MAX_TX_RATE_PHY; j++) 1230 for (j = 0; j < RATE_TABLE_SIZE; j++)
1230 ath_rc_priv->valid_phy_rateidx[i][j] = 0; 1231 ath_rc_priv->valid_phy_rateidx[i][j] = 0;
1231 ath_rc_priv->valid_phy_ratecnt[i] = 0; 1232 ath_rc_priv->valid_phy_ratecnt[i] = 0;
1232 } 1233 }
@@ -1298,12 +1299,13 @@ static u8 ath_rc_build_ht_caps(struct ath_softc *sc, struct ieee80211_sta *sta,
1298 return caps; 1299 return caps;
1299} 1300}
1300 1301
1301static bool ath_tx_aggr_check(struct ath_softc *sc, struct ath_node *an, 1302static bool ath_tx_aggr_check(struct ath_softc *sc, struct ieee80211_sta *sta,
1302 u8 tidno) 1303 u8 tidno)
1303{ 1304{
1305 struct ath_node *an = (struct ath_node *)sta->drv_priv;
1304 struct ath_atx_tid *txtid; 1306 struct ath_atx_tid *txtid;
1305 1307
1306 if (!(sc->sc_flags & SC_OP_TXAGGR)) 1308 if (!sta->ht_cap.ht_supported)
1307 return false; 1309 return false;
1308 1310
1309 txtid = ATH_AN_2_TID(an, tidno); 1311 txtid = ATH_AN_2_TID(an, tidno);
@@ -1374,13 +1376,11 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband,
1374 if (ieee80211_is_data_qos(fc) && 1376 if (ieee80211_is_data_qos(fc) &&
1375 skb_get_queue_mapping(skb) != IEEE80211_AC_VO) { 1377 skb_get_queue_mapping(skb) != IEEE80211_AC_VO) {
1376 u8 *qc, tid; 1378 u8 *qc, tid;
1377 struct ath_node *an;
1378 1379
1379 qc = ieee80211_get_qos_ctl(hdr); 1380 qc = ieee80211_get_qos_ctl(hdr);
1380 tid = qc[0] & 0xf; 1381 tid = qc[0] & 0xf;
1381 an = (struct ath_node *)sta->drv_priv;
1382 1382
1383 if(ath_tx_aggr_check(sc, an, tid)) 1383 if(ath_tx_aggr_check(sc, sta, tid))
1384 ieee80211_start_tx_ba_session(sta, tid, 0); 1384 ieee80211_start_tx_ba_session(sta, tid, 0);
1385 } 1385 }
1386 } 1386 }
diff --git a/drivers/net/wireless/ath/ath9k/rc.h b/drivers/net/wireless/ath/ath9k/rc.h
index b7a4bcd3eec7..75f8e9b06b28 100644
--- a/drivers/net/wireless/ath/ath9k/rc.h
+++ b/drivers/net/wireless/ath/ath9k/rc.h
@@ -25,8 +25,6 @@ struct ath_softc;
25 25
26#define ATH_RATE_MAX 30 26#define ATH_RATE_MAX 30
27#define RATE_TABLE_SIZE 72 27#define RATE_TABLE_SIZE 72
28#define MAX_TX_RATE_PHY 48
29
30 28
31#define RC_INVALID 0x0000 29#define RC_INVALID 0x0000
32#define RC_LEGACY 0x0001 30#define RC_LEGACY 0x0001
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 7e1a91af1497..f4ae3ba994a8 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -169,22 +169,17 @@ static void ath_rx_addbuffer_edma(struct ath_softc *sc,
169 enum ath9k_rx_qtype qtype, int size) 169 enum ath9k_rx_qtype qtype, int size)
170{ 170{
171 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 171 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
172 u32 nbuf = 0; 172 struct ath_buf *bf, *tbf;
173 173
174 if (list_empty(&sc->rx.rxbuf)) { 174 if (list_empty(&sc->rx.rxbuf)) {
175 ath_dbg(common, QUEUE, "No free rx buf available\n"); 175 ath_dbg(common, QUEUE, "No free rx buf available\n");
176 return; 176 return;
177 } 177 }
178 178
179 while (!list_empty(&sc->rx.rxbuf)) { 179 list_for_each_entry_safe(bf, tbf, &sc->rx.rxbuf, list)
180 nbuf++;
181
182 if (!ath_rx_edma_buf_link(sc, qtype)) 180 if (!ath_rx_edma_buf_link(sc, qtype))
183 break; 181 break;
184 182
185 if (nbuf >= size)
186 break;
187 }
188} 183}
189 184
190static void ath_rx_remove_buffer(struct ath_softc *sc, 185static void ath_rx_remove_buffer(struct ath_softc *sc,
@@ -232,7 +227,6 @@ static void ath_rx_edma_cleanup(struct ath_softc *sc)
232static void ath_rx_edma_init_queue(struct ath_rx_edma *rx_edma, int size) 227static void ath_rx_edma_init_queue(struct ath_rx_edma *rx_edma, int size)
233{ 228{
234 skb_queue_head_init(&rx_edma->rx_fifo); 229 skb_queue_head_init(&rx_edma->rx_fifo);
235 skb_queue_head_init(&rx_edma->rx_buffers);
236 rx_edma->rx_fifo_hwsize = size; 230 rx_edma->rx_fifo_hwsize = size;
237} 231}
238 232
@@ -658,7 +652,9 @@ static void ath_rx_ps(struct ath_softc *sc, struct sk_buff *skb, bool mybeacon)
658} 652}
659 653
660static bool ath_edma_get_buffers(struct ath_softc *sc, 654static bool ath_edma_get_buffers(struct ath_softc *sc,
661 enum ath9k_rx_qtype qtype) 655 enum ath9k_rx_qtype qtype,
656 struct ath_rx_status *rs,
657 struct ath_buf **dest)
662{ 658{
663 struct ath_rx_edma *rx_edma = &sc->rx.rx_edma[qtype]; 659 struct ath_rx_edma *rx_edma = &sc->rx.rx_edma[qtype];
664 struct ath_hw *ah = sc->sc_ah; 660 struct ath_hw *ah = sc->sc_ah;
@@ -677,7 +673,7 @@ static bool ath_edma_get_buffers(struct ath_softc *sc,
677 dma_sync_single_for_cpu(sc->dev, bf->bf_buf_addr, 673 dma_sync_single_for_cpu(sc->dev, bf->bf_buf_addr,
678 common->rx_bufsize, DMA_FROM_DEVICE); 674 common->rx_bufsize, DMA_FROM_DEVICE);
679 675
680 ret = ath9k_hw_process_rxdesc_edma(ah, NULL, skb->data); 676 ret = ath9k_hw_process_rxdesc_edma(ah, rs, skb->data);
681 if (ret == -EINPROGRESS) { 677 if (ret == -EINPROGRESS) {
682 /*let device gain the buffer again*/ 678 /*let device gain the buffer again*/
683 dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, 679 dma_sync_single_for_device(sc->dev, bf->bf_buf_addr,
@@ -690,20 +686,21 @@ static bool ath_edma_get_buffers(struct ath_softc *sc,
690 /* corrupt descriptor, skip this one and the following one */ 686 /* corrupt descriptor, skip this one and the following one */
691 list_add_tail(&bf->list, &sc->rx.rxbuf); 687 list_add_tail(&bf->list, &sc->rx.rxbuf);
692 ath_rx_edma_buf_link(sc, qtype); 688 ath_rx_edma_buf_link(sc, qtype);
693 skb = skb_peek(&rx_edma->rx_fifo);
694 if (!skb)
695 return true;
696 689
697 bf = SKB_CB_ATHBUF(skb); 690 skb = skb_peek(&rx_edma->rx_fifo);
698 BUG_ON(!bf); 691 if (skb) {
692 bf = SKB_CB_ATHBUF(skb);
693 BUG_ON(!bf);
699 694
700 __skb_unlink(skb, &rx_edma->rx_fifo); 695 __skb_unlink(skb, &rx_edma->rx_fifo);
701 list_add_tail(&bf->list, &sc->rx.rxbuf); 696 list_add_tail(&bf->list, &sc->rx.rxbuf);
702 ath_rx_edma_buf_link(sc, qtype); 697 ath_rx_edma_buf_link(sc, qtype);
703 return true; 698 } else {
699 bf = NULL;
700 }
704 } 701 }
705 skb_queue_tail(&rx_edma->rx_buffers, skb);
706 702
703 *dest = bf;
707 return true; 704 return true;
708} 705}
709 706
@@ -711,18 +708,15 @@ static struct ath_buf *ath_edma_get_next_rx_buf(struct ath_softc *sc,
711 struct ath_rx_status *rs, 708 struct ath_rx_status *rs,
712 enum ath9k_rx_qtype qtype) 709 enum ath9k_rx_qtype qtype)
713{ 710{
714 struct ath_rx_edma *rx_edma = &sc->rx.rx_edma[qtype]; 711 struct ath_buf *bf = NULL;
715 struct sk_buff *skb;
716 struct ath_buf *bf;
717 712
718 while (ath_edma_get_buffers(sc, qtype)); 713 while (ath_edma_get_buffers(sc, qtype, rs, &bf)) {
719 skb = __skb_dequeue(&rx_edma->rx_buffers); 714 if (!bf)
720 if (!skb) 715 continue;
721 return NULL;
722 716
723 bf = SKB_CB_ATHBUF(skb); 717 return bf;
724 ath9k_hw_process_rxdesc_edma(sc->sc_ah, rs, skb->data); 718 }
725 return bf; 719 return NULL;
726} 720}
727 721
728static struct ath_buf *ath_get_next_rx_buf(struct ath_softc *sc, 722static struct ath_buf *ath_get_next_rx_buf(struct ath_softc *sc,
@@ -954,6 +948,7 @@ static void ath9k_process_rssi(struct ath_common *common,
954 struct ath_softc *sc = hw->priv; 948 struct ath_softc *sc = hw->priv;
955 struct ath_hw *ah = common->ah; 949 struct ath_hw *ah = common->ah;
956 int last_rssi; 950 int last_rssi;
951 int rssi = rx_stats->rs_rssi;
957 952
958 if (!rx_stats->is_mybeacon || 953 if (!rx_stats->is_mybeacon ||
959 ((ah->opmode != NL80211_IFTYPE_STATION) && 954 ((ah->opmode != NL80211_IFTYPE_STATION) &&
@@ -965,13 +960,12 @@ static void ath9k_process_rssi(struct ath_common *common,
965 960
966 last_rssi = sc->last_rssi; 961 last_rssi = sc->last_rssi;
967 if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER)) 962 if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER))
968 rx_stats->rs_rssi = ATH_EP_RND(last_rssi, 963 rssi = ATH_EP_RND(last_rssi, ATH_RSSI_EP_MULTIPLIER);
969 ATH_RSSI_EP_MULTIPLIER); 964 if (rssi < 0)
970 if (rx_stats->rs_rssi < 0) 965 rssi = 0;
971 rx_stats->rs_rssi = 0;
972 966
973 /* Update Beacon RSSI, this is used by ANI. */ 967 /* Update Beacon RSSI, this is used by ANI. */
974 ah->stats.avgbrssi = rx_stats->rs_rssi; 968 ah->stats.avgbrssi = rssi;
975} 969}
976 970
977/* 971/*
@@ -988,8 +982,6 @@ static int ath9k_rx_skb_preprocess(struct ath_common *common,
988{ 982{
989 struct ath_hw *ah = common->ah; 983 struct ath_hw *ah = common->ah;
990 984
991 memset(rx_status, 0, sizeof(struct ieee80211_rx_status));
992
993 /* 985 /*
994 * everything but the rate is checked here, the rate check is done 986 * everything but the rate is checked here, the rate check is done
995 * separately to avoid doing two lookups for a rate for each frame. 987 * separately to avoid doing two lookups for a rate for each frame.
@@ -1011,6 +1003,8 @@ static int ath9k_rx_skb_preprocess(struct ath_common *common,
1011 rx_status->signal = ah->noise + rx_stats->rs_rssi; 1003 rx_status->signal = ah->noise + rx_stats->rs_rssi;
1012 rx_status->antenna = rx_stats->rs_antenna; 1004 rx_status->antenna = rx_stats->rs_antenna;
1013 rx_status->flag |= RX_FLAG_MACTIME_MPDU; 1005 rx_status->flag |= RX_FLAG_MACTIME_MPDU;
1006 if (rx_stats->rs_moreaggr)
1007 rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL;
1014 1008
1015 return 0; 1009 return 0;
1016} 1010}
@@ -1845,6 +1839,8 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
1845 if (sc->sc_flags & SC_OP_RXFLUSH) 1839 if (sc->sc_flags & SC_OP_RXFLUSH)
1846 goto requeue_drop_frag; 1840 goto requeue_drop_frag;
1847 1841
1842 memset(rxs, 0, sizeof(struct ieee80211_rx_status));
1843
1848 rxs->mactime = (tsf & ~0xffffffffULL) | rs.rs_tstamp; 1844 rxs->mactime = (tsf & ~0xffffffffULL) | rs.rs_tstamp;
1849 if (rs.rs_tstamp > tsf_lower && 1845 if (rs.rs_tstamp > tsf_lower &&
1850 unlikely(rs.rs_tstamp - tsf_lower > 0x10000000)) 1846 unlikely(rs.rs_tstamp - tsf_lower > 0x10000000))
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h
index 80b1856f817d..458f81b4a7cb 100644
--- a/drivers/net/wireless/ath/ath9k/reg.h
+++ b/drivers/net/wireless/ath/ath9k/reg.h
@@ -1151,6 +1151,7 @@ enum {
1151#define AR_INTR_PRIO_ASYNC_ENABLE (AR_SREV_9340(ah) ? 0x4094 : 0x40d4) 1151#define AR_INTR_PRIO_ASYNC_ENABLE (AR_SREV_9340(ah) ? 0x4094 : 0x40d4)
1152#define AR_ENT_OTP 0x40d8 1152#define AR_ENT_OTP 0x40d8
1153#define AR_ENT_OTP_CHAIN2_DISABLE 0x00020000 1153#define AR_ENT_OTP_CHAIN2_DISABLE 0x00020000
1154#define AR_ENT_OTP_49GHZ_DISABLE 0x00100000
1154#define AR_ENT_OTP_MIN_PKT_SIZE_DISABLE 0x00800000 1155#define AR_ENT_OTP_MIN_PKT_SIZE_DISABLE 0x00800000
1155 1156
1156#define AR_CH0_BB_DPLL1 0x16180 1157#define AR_CH0_BB_DPLL1 0x16180
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 5dd27d2712fc..834e6bc45e8b 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -955,7 +955,9 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf,
955 */ 955 */
956 rate = ieee80211_get_rts_cts_rate(sc->hw, tx_info); 956 rate = ieee80211_get_rts_cts_rate(sc->hw, tx_info);
957 info->rtscts_rate = rate->hw_value; 957 info->rtscts_rate = rate->hw_value;
958 if (sc->sc_flags & SC_OP_PREAMBLE_SHORT) 958
959 if (tx_info->control.vif &&
960 tx_info->control.vif->bss_conf.use_short_preamble)
959 info->rtscts_rate |= rate->hw_value_short; 961 info->rtscts_rate |= rate->hw_value_short;
960 962
961 for (i = 0; i < 4; i++) { 963 for (i = 0; i < 4; i++) {
@@ -1290,14 +1292,11 @@ void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid
1290 1292
1291 an = (struct ath_node *)sta->drv_priv; 1293 an = (struct ath_node *)sta->drv_priv;
1292 1294
1293 if (sc->sc_flags & SC_OP_TXAGGR) { 1295 txtid = ATH_AN_2_TID(an, tid);
1294 txtid = ATH_AN_2_TID(an, tid); 1296 txtid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor;
1295 txtid->baw_size = 1297 txtid->state |= AGGR_ADDBA_COMPLETE;
1296 IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor; 1298 txtid->state &= ~AGGR_ADDBA_PROGRESS;
1297 txtid->state |= AGGR_ADDBA_COMPLETE; 1299 ath_tx_resume_tid(sc, txtid);
1298 txtid->state &= ~AGGR_ADDBA_PROGRESS;
1299 ath_tx_resume_tid(sc, txtid);
1300 }
1301} 1300}
1302 1301
1303/********************/ 1302/********************/
@@ -1356,8 +1355,7 @@ struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype)
1356 * based intr on the EOSP frames. 1355 * based intr on the EOSP frames.
1357 */ 1356 */
1358 if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { 1357 if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
1359 qi.tqi_qflags = TXQ_FLAG_TXOKINT_ENABLE | 1358 qi.tqi_qflags = TXQ_FLAG_TXINT_ENABLE;
1360 TXQ_FLAG_TXERRINT_ENABLE;
1361 } else { 1359 } else {
1362 if (qtype == ATH9K_TX_QUEUE_UAPSD) 1360 if (qtype == ATH9K_TX_QUEUE_UAPSD)
1363 qi.tqi_qflags = TXQ_FLAG_TXDESCINT_ENABLE; 1361 qi.tqi_qflags = TXQ_FLAG_TXDESCINT_ENABLE;
@@ -1523,7 +1521,7 @@ void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx)
1523 ath_drain_txq_list(sc, txq, &txq->axq_q, retry_tx); 1521 ath_drain_txq_list(sc, txq, &txq->axq_q, retry_tx);
1524 1522
1525 /* flush any pending frames if aggregation is enabled */ 1523 /* flush any pending frames if aggregation is enabled */
1526 if ((sc->sc_flags & SC_OP_TXAGGR) && !retry_tx) 1524 if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) && !retry_tx)
1527 ath_txq_drain_pending_buffers(sc, txq); 1525 ath_txq_drain_pending_buffers(sc, txq);
1528 1526
1529 ath_txq_unlock_complete(sc, txq); 1527 ath_txq_unlock_complete(sc, txq);
@@ -1871,7 +1869,7 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct sk_buff *skb,
1871 struct ath_buf *bf; 1869 struct ath_buf *bf;
1872 u8 tidno; 1870 u8 tidno;
1873 1871
1874 if ((sc->sc_flags & SC_OP_TXAGGR) && txctl->an && 1872 if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) && txctl->an &&
1875 ieee80211_is_data_qos(hdr->frame_control)) { 1873 ieee80211_is_data_qos(hdr->frame_control)) {
1876 tidno = ieee80211_get_qos_ctl(hdr)[0] & 1874 tidno = ieee80211_get_qos_ctl(hdr)[0] &
1877 IEEE80211_QOS_CTL_TID_MASK; 1875 IEEE80211_QOS_CTL_TID_MASK;
@@ -2141,7 +2139,7 @@ static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq,
2141 } else 2139 } else
2142 ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok, true); 2140 ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok, true);
2143 2141
2144 if (sc->sc_flags & SC_OP_TXAGGR) 2142 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT)
2145 ath_txq_schedule(sc, txq); 2143 ath_txq_schedule(sc, txq);
2146} 2144}
2147 2145
@@ -2166,7 +2164,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
2166 2164
2167 if (list_empty(&txq->axq_q)) { 2165 if (list_empty(&txq->axq_q)) {
2168 txq->axq_link = NULL; 2166 txq->axq_link = NULL;
2169 if (sc->sc_flags & SC_OP_TXAGGR) 2167 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT)
2170 ath_txq_schedule(sc, txq); 2168 ath_txq_schedule(sc, txq);
2171 break; 2169 break;
2172 } 2170 }
@@ -2263,10 +2261,9 @@ static void ath_tx_complete_poll_work(struct work_struct *work)
2263 2261
2264void ath_tx_tasklet(struct ath_softc *sc) 2262void ath_tx_tasklet(struct ath_softc *sc)
2265{ 2263{
2264 struct ath_hw *ah = sc->sc_ah;
2265 u32 qcumask = ((1 << ATH9K_NUM_TX_QUEUES) - 1) & ah->intr_txqs;
2266 int i; 2266 int i;
2267 u32 qcumask = ((1 << ATH9K_NUM_TX_QUEUES) - 1);
2268
2269 ath9k_hw_gettxintrtxqs(sc->sc_ah, &qcumask);
2270 2267
2271 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { 2268 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
2272 if (ATH_TXQ_SETUP(sc, i) && (qcumask & (1 << i))) 2269 if (ATH_TXQ_SETUP(sc, i) && (qcumask & (1 << i)))
@@ -2296,9 +2293,12 @@ void ath_tx_edma_tasklet(struct ath_softc *sc)
2296 break; 2293 break;
2297 } 2294 }
2298 2295
2299 /* Skip beacon completions */ 2296 /* Process beacon completions separately */
2300 if (ts.qid == sc->beacon.beaconq) 2297 if (ts.qid == sc->beacon.beaconq) {
2298 sc->beacon.tx_processed = true;
2299 sc->beacon.tx_last = !(ts.ts_status & ATH9K_TXERR_MASK);
2301 continue; 2300 continue;
2301 }
2302 2302
2303 txq = &sc->tx.txq[ts.qid]; 2303 txq = &sc->tx.txq[ts.qid];
2304 2304
diff --git a/drivers/net/wireless/ath/main.c b/drivers/net/wireless/ath/main.c
index d9218fe02036..ea2c737138d3 100644
--- a/drivers/net/wireless/ath/main.c
+++ b/drivers/net/wireless/ath/main.c
@@ -57,7 +57,8 @@ struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
57} 57}
58EXPORT_SYMBOL(ath_rxbuf_alloc); 58EXPORT_SYMBOL(ath_rxbuf_alloc);
59 59
60void ath_printk(const char *level, const char *fmt, ...) 60void ath_printk(const char *level, const struct ath_common* common,
61 const char *fmt, ...)
61{ 62{
62 struct va_format vaf; 63 struct va_format vaf;
63 va_list args; 64 va_list args;
@@ -67,7 +68,11 @@ void ath_printk(const char *level, const char *fmt, ...)
67 vaf.fmt = fmt; 68 vaf.fmt = fmt;
68 vaf.va = &args; 69 vaf.va = &args;
69 70
70 printk("%sath: %pV", level, &vaf); 71 if (common && common->hw && common->hw->wiphy)
72 printk("%sath: %s: %pV",
73 level, wiphy_name(common->hw->wiphy), &vaf);
74 else
75 printk("%sath: %pV", level, &vaf);
71 76
72 va_end(args); 77 va_end(args);
73} 78}