ath9k: improve reliability of the rx stuck fixup
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 550-ath9k_bb_fix.patch
1 --- a/drivers/net/wireless/ath/ath9k/hw.c
2 +++ b/drivers/net/wireless/ath/ath9k/hw.c
3 @@ -1172,6 +1172,34 @@ static bool ath9k_hw_channel_change(stru
4 return true;
5 }
6
7 +bool ath9k_hw_check_alive(struct ath_hw *ah)
8 +{
9 + int count = 50;
10 + u32 reg;
11 +
12 + if (AR_SREV_9285_10_OR_LATER(ah))
13 + return true;
14 +
15 + do {
16 + reg = REG_READ(ah, AR_OBS_BUS_1);
17 +
18 + if ((reg & 0x7E7FFFEF) == 0x00702400)
19 + continue;
20 +
21 + switch (reg & 0x7E000B00) {
22 + case 0x1E000000:
23 + case 0x52000B00:
24 + case 0x18000B00:
25 + continue;
26 + default:
27 + return true;
28 + }
29 + } while (count-- > 0);
30 +
31 + return false;
32 +}
33 +EXPORT_SYMBOL(ath9k_hw_check_alive);
34 +
35 int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
36 bool bChannelChange)
37 {
38 --- a/drivers/net/wireless/ath/ath9k/hw.h
39 +++ b/drivers/net/wireless/ath/ath9k/hw.h
40 @@ -869,6 +869,7 @@ void ath9k_hw_set11nmac2040(struct ath_h
41 void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period);
42 void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah,
43 const struct ath9k_beacon_state *bs);
44 +bool ath9k_hw_check_alive(struct ath_hw *ah);
45
46 bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
47
48 --- a/drivers/net/wireless/ath/ath9k/main.c
49 +++ b/drivers/net/wireless/ath/ath9k/main.c
50 @@ -406,7 +406,8 @@ void ath9k_tasklet(unsigned long data)
51
52 ath9k_ps_wakeup(sc);
53
54 - if (status & ATH9K_INT_FATAL) {
55 + if ((status & ATH9K_INT_FATAL) ||
56 + !ath9k_hw_check_alive(ah)) {
57 ath_reset(sc, false);
58 ath9k_ps_restore(sc);
59 return;