1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Sat, 9 Jul 2016 15:26:44 +0200
3 Subject: [PATCH] ath9k_hw: issue external reset for QCA955x
5 The RTC interface on the SoC needs to be reset along with the rest of
8 Signed-off-by: Felix Fietkau <nbd@nbd.name>
11 --- a/drivers/net/wireless/ath/ath9k/hw.c
12 +++ b/drivers/net/wireless/ath/ath9k/hw.c
13 @@ -1298,39 +1298,56 @@ void ath9k_hw_get_delta_slope_vals(struc
14 *coef_exponent = coef_exp - 16;
18 - * call external reset function to reset WMAC if:
19 - * - doing a cold reset
20 - * - we have pending frames in the TX queues.
22 -static bool ath9k_hw_ar9330_reset_war(struct ath_hw *ah, int type)
23 +static bool ath9k_hw_need_external_reset(struct ath_hw *ah, int type)
28 - for (i = 0; i < AR_NUM_QCU; i++) {
29 - npend = ath9k_hw_numtxpending(ah, i);
34 - if (ah->external_reset &&
35 - (npend || type == ATH9K_RESET_COLD)) {
38 - ath_dbg(ath9k_hw_common(ah), RESET,
39 - "reset MAC via external reset\n");
41 - reset_err = ah->external_reset();
43 - ath_err(ath9k_hw_common(ah),
44 - "External reset failed, err=%d\n",
47 + if (type == ATH9K_RESET_COLD)
50 + if (AR_SREV_9550(ah))
54 + * call external reset function to reset WMAC if:
55 + * - doing a cold reset
56 + * - we have pending frames in the TX queues.
58 + if (AR_SREV_9330(ah)) {
59 + for (i = 0; i < AR_NUM_QCU; i++) {
60 + if (ath9k_hw_numtxpending(ah, i))
68 +static bool ath9k_hw_external_reset(struct ath_hw *ah, int type)
72 + if (!ah->external_reset || !ath9k_hw_need_external_reset(ah, type))
75 + ath_dbg(ath9k_hw_common(ah), RESET,
76 + "reset MAC via external reset\n");
78 - REG_WRITE(ah, AR_RTC_RESET, 1);
79 + err = ah->external_reset();
81 + ath_err(ath9k_hw_common(ah),
82 + "External reset failed, err=%d\n", err);
86 + if (AR_SREV_9550(ah)) {
87 + REG_WRITE(ah, AR_RTC_RESET, 0);
91 + REG_WRITE(ah, AR_RTC_RESET, 1);
97 @@ -1383,24 +1400,24 @@ static bool ath9k_hw_set_reset(struct at
98 rst_flags |= AR_RTC_RC_MAC_COLD;
101 - if (AR_SREV_9330(ah)) {
102 - if (!ath9k_hw_ar9330_reset_war(ah, type))
106 if (ath9k_hw_mci_is_enabled(ah))
107 ar9003_mci_check_gpm_offset(ah);
109 /* DMA HALT added to resolve ar9300 and ar9580 bus error during
111 + * RTC_RC reg read. Also needed for AR9550 external reset
113 - if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) {
114 + if (AR_SREV_9300(ah) || AR_SREV_9580(ah) || AR_SREV_9550(ah)) {
115 REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
116 ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK,
117 20 * AH_WAIT_TIMEOUT);
118 - REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
121 + if (!AR_SREV_9100(ah))
122 + ath9k_hw_external_reset(ah, type);
124 + if (AR_SREV_9300(ah) || AR_SREV_9580(ah))
125 + REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
127 REG_WRITE(ah, AR_RTC_RC, rst_flags);
129 REGWRITE_BUFFER_FLUSH(ah);