ath5k: channel change fix
[openwrt/staging/yousong.git] / package / kernel / mac80211 / patches / 311-ath9k-do-not-access-hardware-on-IRQs-during-reset.patch
1 From: Felix Fietkau <nbd@openwrt.org>
2 Date: Thu, 13 Nov 2014 18:29:26 +0100
3 Subject: [PATCH] ath9k: do not access hardware on IRQs during reset
4
5 Instead of killing interrupts during reset when the first one happens,
6 kill them before issuing the reset.
7 This fixes an easy to reproduce crash with multiple cards sharing the
8 same IRQ.
9
10 Cc: stable@vger.kernel.org
11 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
12 ---
13
14 --- a/drivers/net/wireless/ath/ath9k/main.c
15 +++ b/drivers/net/wireless/ath/ath9k/main.c
16 @@ -512,16 +512,13 @@ irqreturn_t ath_isr(int irq, void *dev)
17 if (!ah || test_bit(ATH_OP_INVALID, &common->op_flags))
18 return IRQ_NONE;
19
20 - /* shared irq, not for us */
21 + if (!AR_SREV_9100(ah) && test_bit(ATH_OP_HW_RESET, &common->op_flags))
22 + return IRQ_NONE;
23
24 + /* shared irq, not for us */
25 if (!ath9k_hw_intrpend(ah))
26 return IRQ_NONE;
27
28 - if (test_bit(ATH_OP_HW_RESET, &common->op_flags)) {
29 - ath9k_hw_kill_interrupts(ah);
30 - return IRQ_HANDLED;
31 - }
32 -
33 /*
34 * Figure out the reason(s) for the interrupt. Note
35 * that the hal returns a pseudo-ISR that may include
36 @@ -532,6 +529,9 @@ irqreturn_t ath_isr(int irq, void *dev)
37 ath9k_debug_sync_cause(sc, sync_cause);
38 status &= ah->imask; /* discard unasked-for bits */
39
40 + if (AR_SREV_9100(ah) && test_bit(ATH_OP_HW_RESET, &common->op_flags))
41 + return IRQ_HANDLED;
42 +
43 /*
44 * If there are no status bits set, then this interrupt was not
45 * for me (should have been caught above).
46 @@ -613,6 +613,7 @@ int ath_reset(struct ath_softc *sc, stru
47 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
48 int r;
49
50 + ath9k_hw_kill_interrupts(sc->sc_ah);
51 set_bit(ATH_OP_HW_RESET, &common->op_flags);
52
53 ath9k_ps_wakeup(sc);
54 @@ -633,6 +634,7 @@ void ath9k_queue_reset(struct ath_softc
55 #ifdef CPTCFG_ATH9K_DEBUGFS
56 RESET_STAT_INC(sc, type);
57 #endif
58 + ath9k_hw_kill_interrupts(sc->sc_ah);
59 set_bit(ATH_OP_HW_RESET, &common->op_flags);
60 ieee80211_queue_work(sc->hw, &sc->hw_reset_work);
61 }