Skip to content

Commit 73f0b56

Browse files
Sujith Manoharanlinvjw
authored andcommitted
ath9k: Fix interrupt handling for the AR9002 family
This patch adds a driver workaround for a HW issue. A race condition in the HW results in missing interrupts, which can be avoided by a read/write with the ISR register. All chips in the AR9002 series are affected by this bug - AR9003 and above do not have this problem. Cc: stable@vger.kernel.org Cc: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 9278db6 commit 73f0b56

1 file changed

Lines changed: 43 additions & 9 deletions

File tree

‎drivers/net/wireless/ath/ath9k/ar9002_mac.c‎

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,16 @@ static bool ar9002_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
7676
mask2 |= ATH9K_INT_CST;
7777
if (isr2 & AR_ISR_S2_TSFOOR)
7878
mask2 |= ATH9K_INT_TSFOOR;
79+
80+
if (!(pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED)) {
81+
REG_WRITE(ah, AR_ISR_S2, isr2);
82+
isr &= ~AR_ISR_BCNMISC;
83+
}
7984
}
8085

81-
isr = REG_READ(ah, AR_ISR_RAC);
86+
if (pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED)
87+
isr = REG_READ(ah, AR_ISR_RAC);
88+
8289
if (isr == 0xffffffff) {
8390
*masked = 0;
8491
return false;
@@ -97,11 +104,23 @@ static bool ar9002_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
97104

98105
*masked |= ATH9K_INT_TX;
99106

100-
s0_s = REG_READ(ah, AR_ISR_S0_S);
107+
if (pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED) {
108+
s0_s = REG_READ(ah, AR_ISR_S0_S);
109+
s1_s = REG_READ(ah, AR_ISR_S1_S);
110+
} else {
111+
s0_s = REG_READ(ah, AR_ISR_S0);
112+
REG_WRITE(ah, AR_ISR_S0, s0_s);
113+
s1_s = REG_READ(ah, AR_ISR_S1);
114+
REG_WRITE(ah, AR_ISR_S1, s1_s);
115+
116+
isr &= ~(AR_ISR_TXOK |
117+
AR_ISR_TXDESC |
118+
AR_ISR_TXERR |
119+
AR_ISR_TXEOL);
120+
}
121+
101122
ah->intr_txqs |= MS(s0_s, AR_ISR_S0_QCU_TXOK);
102123
ah->intr_txqs |= MS(s0_s, AR_ISR_S0_QCU_TXDESC);
103-
104-
s1_s = REG_READ(ah, AR_ISR_S1_S);
105124
ah->intr_txqs |= MS(s1_s, AR_ISR_S1_QCU_TXERR);
106125
ah->intr_txqs |= MS(s1_s, AR_ISR_S1_QCU_TXEOL);
107126
}
@@ -114,13 +133,15 @@ static bool ar9002_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
114133
*masked |= mask2;
115134
}
116135

117-
if (AR_SREV_9100(ah))
118-
return true;
119-
120-
if (isr & AR_ISR_GENTMR) {
136+
if (!AR_SREV_9100(ah) && (isr & AR_ISR_GENTMR)) {
121137
u32 s5_s;
122138

123-
s5_s = REG_READ(ah, AR_ISR_S5_S);
139+
if (pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED) {
140+
s5_s = REG_READ(ah, AR_ISR_S5_S);
141+
} else {
142+
s5_s = REG_READ(ah, AR_ISR_S5);
143+
}
144+
124145
ah->intr_gen_timer_trigger =
125146
MS(s5_s, AR_ISR_S5_GENTIMER_TRIG);
126147

@@ -133,8 +154,21 @@ static bool ar9002_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
133154
if ((s5_s & AR_ISR_S5_TIM_TIMER) &&
134155
!(pCap->hw_caps & ATH9K_HW_CAP_AUTOSLEEP))
135156
*masked |= ATH9K_INT_TIM_TIMER;
157+
158+
if (!(pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED)) {
159+
REG_WRITE(ah, AR_ISR_S5, s5_s);
160+
isr &= ~AR_ISR_GENTMR;
161+
}
136162
}
137163

164+
if (!(pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED)) {
165+
REG_WRITE(ah, AR_ISR, isr);
166+
REG_READ(ah, AR_ISR);
167+
}
168+
169+
if (AR_SREV_9100(ah))
170+
return true;
171+
138172
if (sync_cause) {
139173
ath9k_debug_sync_cause(common, sync_cause);
140174
fatal_int =

0 commit comments

Comments
 (0)