183a4f1557e4540aaf272a4d6a9d1988c5cded74
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 570-ath9k-add-external_reset-callback-to-ath9k_platfom_d.patch
1 --- a/drivers/net/wireless/ath/ath9k/hw.c
2 +++ b/drivers/net/wireless/ath/ath9k/hw.c
3 @@ -1170,6 +1170,41 @@ static bool ath9k_hw_set_reset(struct at
4 rst_flags |= AR_RTC_RC_MAC_COLD;
5 }
6
7 + if (AR_SREV_9330(ah)) {
8 + int npend = 0;
9 + int i;
10 +
11 + /* AR9330 WAR:
12 + * call external reset function to reset WMAC if:
13 + * - doing a cold reset
14 + * - we have pending frames in the TX queues
15 + */
16 +
17 + for (i = 0; i < AR_NUM_QCU; i++) {
18 + npend = ath9k_hw_numtxpending(ah, i);
19 + if (npend)
20 + break;
21 + }
22 +
23 + if (ah->external_reset &&
24 + (npend || type == ATH9K_RESET_COLD)) {
25 + int reset_err = 0;
26 +
27 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_RESET,
28 + "reset MAC via external reset\n");
29 +
30 + reset_err = ah->external_reset();
31 + if (reset_err) {
32 + ath_err(ath9k_hw_common(ah),
33 + "External reset failed, err=%d\n",
34 + reset_err);
35 + return false;
36 + }
37 +
38 + REG_WRITE(ah, AR_RTC_RESET, 1);
39 + }
40 + }
41 +
42 REG_WRITE(ah, AR_RTC_RC, rst_flags);
43
44 REGWRITE_BUFFER_FLUSH(ah);
45 --- a/drivers/net/wireless/ath/ath9k/hw.h
46 +++ b/drivers/net/wireless/ath/ath9k/hw.h
47 @@ -864,6 +864,7 @@ struct ath_hw {
48
49 bool is_clk_25mhz;
50 int (*get_mac_revision)(void);
51 + int (*external_reset)(void);
52 };
53
54 struct ath_bus_ops {
55 --- a/drivers/net/wireless/ath/ath9k/init.c
56 +++ b/drivers/net/wireless/ath/ath9k/init.c
57 @@ -576,6 +576,7 @@ static int ath9k_init_softc(u16 devid, s
58 sc->sc_ah->led_pin = pdata->led_pin;
59 ah->is_clk_25mhz = pdata->is_clk_25mhz;
60 ah->get_mac_revision = pdata->get_mac_revision;
61 + ah->external_reset = pdata->external_reset;
62 }
63
64 common = ath9k_hw_common(ah);
65 --- a/include/linux/ath9k_platform.h
66 +++ b/include/linux/ath9k_platform.h
67 @@ -31,6 +31,7 @@ struct ath9k_platform_data {
68
69 bool is_clk_25mhz;
70 int (*get_mac_revision)(void);
71 + int (*external_reset)(void);
72 };
73
74 #endif /* _LINUX_ATH9K_PLATFORM_H */