ath9k: add support for registering extra leds connected to the wmac gpio lines
[openwrt.git] / package / mac80211 / patches / 571-ath9k_btcoex_optional.patch
1 --- a/drivers/net/wireless/ath/ath9k/Kconfig
2 +++ b/drivers/net/wireless/ath/ath9k/Kconfig
3 @@ -59,6 +59,14 @@ config ATH9K_RATE_CONTROL
4 Say Y, if you want to use the ath9k specific rate control
5 module instead of minstrel_ht.
6
7 +config ATH9K_BTCOEX_SUPPORT
8 + bool "Atheros ath9k bluetooth coexistence support"
9 + depends on ATH9K
10 + default y
11 + ---help---
12 + Say Y, if you want to use the ath9k radios together with
13 + Bluetooth modules in the same system.
14 +
15 config ATH9K_HTC
16 tristate "Atheros HTC based wireless cards support"
17 depends on USB && MAC80211
18 --- a/drivers/net/wireless/ath/ath9k/hw.h
19 +++ b/drivers/net/wireless/ath/ath9k/hw.h
20 @@ -210,7 +210,11 @@ enum ath9k_hw_caps {
21 ATH9K_HW_CAP_5GHZ = BIT(14),
22 ATH9K_HW_CAP_APM = BIT(15),
23 ATH9K_HW_CAP_RTT = BIT(16),
24 +#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
25 ATH9K_HW_CAP_MCI = BIT(17),
26 +#else
27 + ATH9K_HW_CAP_MCI = 0,
28 +#endif
29 };
30
31 struct ath9k_hw_capabilities {
32 --- a/drivers/net/wireless/ath/ath9k/btcoex.h
33 +++ b/drivers/net/wireless/ath/ath9k/btcoex.h
34 @@ -98,6 +98,16 @@ struct ath_btcoex_hw {
35 u32 wlan_weight[AR9300_NUM_WLAN_WEIGHTS];
36 };
37
38 +#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
39 +static inline enum ath_btcoex_scheme
40 +ath9k_hw_get_btcoex_scheme(struct ath_hw *ah)
41 +{
42 + return ah->btcoex_hw.scheme;
43 +}
44 +#else
45 +#define ath9k_hw_get_btcoex_scheme(...) ATH_BTCOEX_CFG_NONE
46 +#endif
47 +
48 void ath9k_hw_btcoex_init_2wire(struct ath_hw *ah);
49 void ath9k_hw_btcoex_init_3wire(struct ath_hw *ah);
50 void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum);
51 --- a/drivers/net/wireless/ath/ath9k/init.c
52 +++ b/drivers/net/wireless/ath/ath9k/init.c
53 @@ -411,7 +411,7 @@ static int ath9k_init_btcoex(struct ath_
54 struct ath_hw *ah = sc->sc_ah;
55 int r;
56
57 - switch (sc->sc_ah->btcoex_hw.scheme) {
58 + switch (ath9k_hw_get_btcoex_scheme(sc->sc_ah)) {
59 case ATH_BTCOEX_CFG_NONE:
60 break;
61 case ATH_BTCOEX_CFG_2WIRE:
62 @@ -866,10 +866,10 @@ static void ath9k_deinit_softc(struct at
63 kfree(sc->sbands[IEEE80211_BAND_5GHZ].channels);
64
65 if ((sc->btcoex.no_stomp_timer) &&
66 - sc->sc_ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE)
67 + ath9k_hw_get_btcoex_scheme(sc->sc_ah) == ATH_BTCOEX_CFG_3WIRE)
68 ath_gen_timer_free(sc->sc_ah, sc->btcoex.no_stomp_timer);
69
70 - if (sc->sc_ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_MCI)
71 + if (ath9k_hw_get_btcoex_scheme(sc->sc_ah) == ATH_BTCOEX_CFG_MCI)
72 ath_mci_cleanup(sc);
73
74 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++)
75 --- a/drivers/net/wireless/ath/ath9k/pci.c
76 +++ b/drivers/net/wireless/ath/ath9k/pci.c
77 @@ -121,7 +121,7 @@ static void ath_pci_aspm_init(struct ath
78 if (!parent)
79 return;
80
81 - if (ah->btcoex_hw.scheme != ATH_BTCOEX_CFG_NONE) {
82 + if (ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) {
83 /* Bluetooth coexistance requires disabling ASPM. */
84 pci_read_config_byte(pdev, pos + PCI_EXP_LNKCTL, &aspm);
85 aspm &= ~(PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1);
86 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
87 +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
88 @@ -610,7 +610,7 @@ static void ath9k_init_btcoex(struct ath
89 {
90 int qnum;
91
92 - switch (priv->ah->btcoex_hw.scheme) {
93 + switch (ath9k_hw_get_btcoex_scheme(priv->ah)) {
94 case ATH_BTCOEX_CFG_NONE:
95 break;
96 case ATH_BTCOEX_CFG_3WIRE:
97 @@ -704,7 +704,8 @@ static int ath9k_init_priv(struct ath9k_
98
99 if (product && strncmp(product, ATH_HTC_BTCOEX_PRODUCT_ID, 5) == 0) {
100 ah->btcoex_hw.scheme = ATH_BTCOEX_CFG_3WIRE;
101 - ath9k_init_btcoex(priv);
102 + if (ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE)
103 + ath9k_init_btcoex(priv);
104 }
105
106 return 0;
107 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
108 +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
109 @@ -958,7 +958,7 @@ static int ath9k_htc_start(struct ieee80
110 mod_timer(&priv->tx.cleanup_timer,
111 jiffies + msecs_to_jiffies(ATH9K_HTC_TX_CLEANUP_INTERVAL));
112
113 - if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) {
114 + if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE) {
115 ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT,
116 AR_STOMP_LOW_WLAN_WGHT);
117 ath9k_hw_btcoex_enable(ah);
118 @@ -1010,7 +1010,8 @@ static void ath9k_htc_stop(struct ieee80
119
120 mutex_lock(&priv->mutex);
121
122 - if (ah->btcoex_hw.enabled) {
123 + if (ah->btcoex_hw.enabled &&
124 + ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) {
125 ath9k_hw_btcoex_disable(ah);
126 if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE)
127 ath_htc_cancel_btcoex_work(priv);
128 --- a/drivers/net/wireless/ath/ath9k/main.c
129 +++ b/drivers/net/wireless/ath/ath9k/main.c
130 @@ -742,11 +742,11 @@ void ath9k_tasklet(unsigned long data)
131 ath_tx_tasklet(sc);
132 }
133
134 - if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE)
135 + if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE)
136 if (status & ATH9K_INT_GENTIMER)
137 ath_gen_timer_isr(sc->sc_ah);
138
139 - if (status & ATH9K_INT_MCI)
140 + if ((status & ATH9K_INT_MCI) && ATH9K_HW_CAP_MCI)
141 ath_mci_intr(sc);
142
143 out:
144 @@ -1083,14 +1083,14 @@ static int ath9k_start(struct ieee80211_
145
146 spin_unlock_bh(&sc->sc_pcu_lock);
147
148 - if ((ah->btcoex_hw.scheme != ATH_BTCOEX_CFG_NONE) &&
149 + if ((ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) &&
150 !ah->btcoex_hw.enabled) {
151 if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_MCI))
152 ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT,
153 AR_STOMP_LOW_WLAN_WGHT);
154 ath9k_hw_btcoex_enable(ah);
155
156 - if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE)
157 + if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE)
158 ath9k_btcoex_timer_resume(sc);
159 }
160
161 @@ -1194,9 +1194,10 @@ static void ath9k_stop(struct ieee80211_
162 /* Ensure HW is awake when we try to shut it down. */
163 ath9k_ps_wakeup(sc);
164
165 - if (ah->btcoex_hw.enabled) {
166 + if (ah->btcoex_hw.enabled &&
167 + ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) {
168 ath9k_hw_btcoex_disable(ah);
169 - if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE)
170 + if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE)
171 ath9k_btcoex_timer_pause(sc);
172 ath_mci_flush_profile(&sc->btcoex.mci);
173 }
174 --- a/drivers/net/wireless/ath/ath9k/gpio.c
175 +++ b/drivers/net/wireless/ath/ath9k/gpio.c
176 @@ -253,6 +253,9 @@ int ath_init_btcoex_timer(struct ath_sof
177 {
178 struct ath_btcoex *btcoex = &sc->btcoex;
179
180 + if (ath9k_hw_get_btcoex_scheme(sc->sc_ah) == ATH_BTCOEX_CFG_NONE)
181 + return 0;
182 +
183 btcoex->btcoex_period = ATH_BTCOEX_DEF_BT_PERIOD * 1000;
184 btcoex->btcoex_no_stomp = (100 - ATH_BTCOEX_DEF_DUTY_CYCLE) *
185 btcoex->btcoex_period / 100;
186 @@ -286,6 +289,9 @@ void ath9k_btcoex_timer_resume(struct at
187 ath_dbg(ath9k_hw_common(ah), ATH_DBG_BTCOEX,
188 "Starting btcoex timers\n");
189
190 + if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE)
191 + return;
192 +
193 /* make sure duty cycle timer is also stopped when resuming */
194 if (btcoex->hw_timer_enabled)
195 ath9k_gen_timer_stop(sc->sc_ah, btcoex->no_stomp_timer);
196 @@ -306,6 +312,9 @@ void ath9k_btcoex_timer_pause(struct ath
197 struct ath_btcoex *btcoex = &sc->btcoex;
198 struct ath_hw *ah = sc->sc_ah;
199
200 + if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE)
201 + return;
202 +
203 del_timer_sync(&btcoex->period_timer);
204
205 if (btcoex->hw_timer_enabled)
206 --- a/drivers/net/wireless/ath/ath9k/hw.c
207 +++ b/drivers/net/wireless/ath/ath9k/hw.c
208 @@ -1929,7 +1929,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
209 #endif
210 }
211
212 - if (ah->btcoex_hw.enabled)
213 + if (ah->btcoex_hw.enabled &&
214 + ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE)
215 ath9k_hw_btcoex_enable(ah);
216
217 if (mci && mci_hw->ready) {
218 --- a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
219 +++ b/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
220 @@ -116,6 +116,9 @@ void ath_htc_init_btcoex_work(struct ath
221 {
222 struct ath_btcoex *btcoex = &priv->btcoex;
223
224 + if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE)
225 + return;
226 +
227 btcoex->btcoex_period = ATH_BTCOEX_DEF_BT_PERIOD;
228 btcoex->btcoex_no_stomp = (100 - ATH_BTCOEX_DEF_DUTY_CYCLE) *
229 btcoex->btcoex_period / 100;
230 @@ -134,6 +137,9 @@ void ath_htc_resume_btcoex_work(struct a
231 struct ath_btcoex *btcoex = &priv->btcoex;
232 struct ath_hw *ah = priv->ah;
233
234 + if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE)
235 + return;
236 +
237 ath_dbg(ath9k_hw_common(ah), ATH_DBG_BTCOEX, "Starting btcoex work\n");
238
239 btcoex->bt_priority_cnt = 0;
240 @@ -148,6 +154,9 @@ void ath_htc_resume_btcoex_work(struct a
241 */
242 void ath_htc_cancel_btcoex_work(struct ath9k_htc_priv *priv)
243 {
244 + if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE)
245 + return;
246 +
247 cancel_delayed_work_sync(&priv->coex_period_work);
248 cancel_delayed_work_sync(&priv->duty_cycle_work);
249 }
250 --- a/drivers/net/wireless/ath/ath9k/btcoex.c
251 +++ b/drivers/net/wireless/ath/ath9k/btcoex.c
252 @@ -68,6 +68,9 @@ void ath9k_hw_init_btcoex_hw(struct ath_
253 u32 i, idx;
254 bool rxclear_polarity = ath_bt_config.bt_rxclear_polarity;
255
256 + if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE)
257 + return;
258 +
259 if (AR_SREV_9300_20_OR_LATER(ah))
260 rxclear_polarity = !ath_bt_config.bt_rxclear_polarity;
261
262 @@ -99,6 +102,9 @@ void ath9k_hw_btcoex_init_2wire(struct a
263 {
264 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
265
266 + if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE)
267 + return;
268 +
269 /* connect bt_active to baseband */
270 REG_CLR_BIT(ah, AR_GPIO_INPUT_EN_VAL,
271 (AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_DEF |
272 @@ -121,6 +127,9 @@ void ath9k_hw_btcoex_init_3wire(struct a
273 {
274 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
275
276 + if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE)
277 + return;
278 +
279 /* btcoex 3-wire */
280 REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL,
281 (AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_BB |
282 @@ -147,6 +156,9 @@ static void ath9k_hw_btcoex_enable_2wire
283 {
284 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
285
286 + if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE)
287 + return;
288 +
289 /* Configure the desired GPIO port for TX_FRAME output */
290 ath9k_hw_cfg_output(ah, btcoex_hw->wlanactive_gpio,
291 AR_GPIO_OUTPUT_MUX_AS_TX_FRAME);
292 @@ -158,6 +170,9 @@ void ath9k_hw_btcoex_set_weight(struct a
293 {
294 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
295
296 + if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE)
297 + return;
298 +
299 btcoex_hw->bt_coex_weights = SM(bt_weight, AR_BTCOEX_BT_WGHT) |
300 SM(wlan_weight, AR_BTCOEX_WL_WGHT);
301 }
302 @@ -219,9 +234,9 @@ void ath9k_hw_btcoex_enable(struct ath_h
303 {
304 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
305
306 - switch (btcoex_hw->scheme) {
307 + switch (ath9k_hw_get_btcoex_scheme(ah)) {
308 case ATH_BTCOEX_CFG_NONE:
309 - break;
310 + return;
311 case ATH_BTCOEX_CFG_2WIRE:
312 ath9k_hw_btcoex_enable_2wire(ah);
313 break;
314 @@ -246,6 +261,9 @@ void ath9k_hw_btcoex_disable(struct ath_
315 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
316 int i;
317
318 + if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE)
319 + return;
320 +
321 btcoex_hw->enabled = false;
322 if (btcoex_hw->scheme == ATH_BTCOEX_CFG_MCI) {
323 ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE);
324 @@ -294,6 +312,9 @@ static void ar9003_btcoex_bt_stomp(struc
325 void ath9k_hw_btcoex_bt_stomp(struct ath_hw *ah,
326 enum ath_stomp_type stomp_type)
327 {
328 + if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_NONE)
329 + return;
330 +
331 if (AR_SREV_9300_20_OR_LATER(ah)) {
332 ar9003_btcoex_bt_stomp(ah, stomp_type);
333 return;
334 --- a/drivers/net/wireless/ath/ath9k/ar9003_mci.c
335 +++ b/drivers/net/wireless/ath/ath9k/ar9003_mci.c
336 @@ -85,6 +85,9 @@ void ar9003_mci_remote_reset(struct ath_
337 {
338 u32 payload[4] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffff00};
339
340 + if (!ATH9K_HW_CAP_MCI)
341 + return;
342 +
343 ar9003_mci_send_message(ah, MCI_REMOTE_RESET, 0, payload, 16,
344 wait_done, false);
345 udelay(5);
346 @@ -94,6 +97,9 @@ void ar9003_mci_send_lna_transfer(struct
347 {
348 u32 payload = 0x00000000;
349
350 + if (!ATH9K_HW_CAP_MCI)
351 + return;
352 +
353 ar9003_mci_send_message(ah, MCI_LNA_TRANS, 0, &payload, 1,
354 wait_done, false);
355 }
356 @@ -107,6 +113,9 @@ static void ar9003_mci_send_req_wake(str
357
358 void ar9003_mci_send_sys_waking(struct ath_hw *ah, bool wait_done)
359 {
360 + if (!ATH9K_HW_CAP_MCI)
361 + return;
362 +
363 ar9003_mci_send_message(ah, MCI_SYS_WAKING, MCI_FLAG_DISABLE_TIMESTAMP,
364 NULL, 0, wait_done, false);
365 }
366 @@ -221,6 +230,9 @@ void ar9003_mci_send_coex_halt_bt_gpm(st
367 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci;
368 u32 payload[4] = {0, 0, 0, 0};
369
370 + if (!ATH9K_HW_CAP_MCI)
371 + return;
372 +
373 ath_dbg(common, ATH_DBG_MCI, "MCI Send Coex %s BT GPM.\n",
374 (halt) ? "halt" : "unhalt");
375
376 @@ -381,12 +393,17 @@ static void ar9003_mci_prep_interface(st
377
378 void ar9003_mci_disable_interrupt(struct ath_hw *ah)
379 {
380 + if (!ATH9K_HW_CAP_MCI)
381 + return;
382 +
383 REG_WRITE(ah, AR_MCI_INTERRUPT_EN, 0);
384 REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_EN, 0);
385 }
386
387 void ar9003_mci_enable_interrupt(struct ath_hw *ah)
388 {
389 + if (!ATH9K_HW_CAP_MCI)
390 + return;
391
392 REG_WRITE(ah, AR_MCI_INTERRUPT_EN, AR_MCI_INTERRUPT_DEFAULT);
393 REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_EN,
394 @@ -397,6 +414,9 @@ bool ar9003_mci_check_int(struct ath_hw
395 {
396 u32 intr;
397
398 + if (!ATH9K_HW_CAP_MCI)
399 + return false;
400 +
401 intr = REG_READ(ah, AR_MCI_INTERRUPT_RX_MSG_RAW);
402 return ((intr & ints) == ints);
403 }
404 @@ -405,6 +425,10 @@ void ar9003_mci_get_interrupt(struct ath
405 u32 *rx_msg_intr)
406 {
407 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci;
408 +
409 + if (!ATH9K_HW_CAP_MCI)
410 + return;
411 +
412 *raw_intr = mci->raw_intr;
413 *rx_msg_intr = mci->rx_msg_intr;
414
415 @@ -418,6 +442,9 @@ void ar9003_mci_2g5g_changed(struct ath_
416 {
417 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci;
418
419 + if (!ATH9K_HW_CAP_MCI)
420 + return;
421 +
422 if (!mci->update_2g5g &&
423 (mci->is_2g != is_2g))
424 mci->update_2g5g = true;
425 @@ -531,6 +558,9 @@ void ar9003_mci_reset(struct ath_hw *ah,
426 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci;
427 u32 regval, thresh;
428
429 + if (!ATH9K_HW_CAP_MCI)
430 + return;
431 +
432 ath_dbg(common, ATH_DBG_MCI, "MCI full_sleep = %d, is_2g = %d\n",
433 is_full_sleep, is_2g);
434
435 @@ -661,6 +691,9 @@ void ar9003_mci_mute_bt(struct ath_hw *a
436 {
437 struct ath_common *common = ath9k_hw_common(ah);
438
439 + if (!ATH9K_HW_CAP_MCI)
440 + return;
441 +
442 /* disable all MCI messages */
443 REG_WRITE(ah, AR_MCI_MSG_ATTRIBUTES_TABLE, 0xffff0000);
444 REG_WRITE(ah, AR_BTCOEX_WL_WEIGHTS0, 0xffffffff);
445 @@ -693,6 +726,9 @@ void ar9003_mci_sync_bt_state(struct ath
446 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci;
447 u32 cur_bt_state;
448
449 + if (!ATH9K_HW_CAP_MCI)
450 + return;
451 +
452 cur_bt_state = ar9003_mci_state(ah, MCI_STATE_REMOTE_SLEEP, NULL);
453
454 if (mci->bt_state != cur_bt_state) {
455 @@ -857,6 +893,9 @@ void ar9003_mci_2g5g_switch(struct ath_h
456 struct ath_common *common = ath9k_hw_common(ah);
457 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci;
458
459 + if (!ATH9K_HW_CAP_MCI)
460 + return;
461 +
462 if (mci->update_2g5g) {
463 if (mci->is_2g) {
464
465 @@ -908,6 +947,9 @@ bool ar9003_mci_send_message(struct ath_
466 u32 saved_mci_int_en;
467 int i;
468
469 + if (!ATH9K_HW_CAP_MCI)
470 + return false;
471 +
472 saved_mci_int_en = REG_READ(ah, AR_MCI_INTERRUPT_EN);
473 regval = REG_READ(ah, AR_BTCOEX_CTRL);
474
475 @@ -973,6 +1015,9 @@ void ar9003_mci_setup(struct ath_hw *ah,
476 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci;
477 void *sched_buf = (void *)((char *) gpm_buf + (sched_addr - gpm_addr));
478
479 + if (!ATH9K_HW_CAP_MCI)
480 + return;
481 +
482 mci->gpm_addr = gpm_addr;
483 mci->gpm_buf = gpm_buf;
484 mci->gpm_len = len;
485 @@ -987,6 +1032,9 @@ void ar9003_mci_cleanup(struct ath_hw *a
486 {
487 struct ath_common *common = ath9k_hw_common(ah);
488
489 + if (!ATH9K_HW_CAP_MCI)
490 + return;
491 +
492 /* Turn off MCI and Jupiter mode. */
493 REG_WRITE(ah, AR_BTCOEX_CTRL, 0x00);
494 ath_dbg(common, ATH_DBG_MCI, "MCI ar9003_mci_cleanup\n");
495 @@ -1056,6 +1104,9 @@ u32 ar9003_mci_wait_for_gpm(struct ath_h
496 u8 recv_type = 0, recv_opcode = 0;
497 bool b_is_bt_cal_done = (gpm_type == MCI_GPM_BT_CAL_DONE);
498
499 + if (!ATH9K_HW_CAP_MCI)
500 + return 0;
501 +
502 more_data = time_out ? MCI_GPM_NOMORE : MCI_GPM_MORE;
503
504 while (time_out > 0) {
505 @@ -1188,6 +1239,9 @@ u32 ar9003_mci_state(struct ath_hw *ah,
506 u32 value = 0, more_gpm = 0, gpm_ptr;
507 u8 query_type;
508
509 + if (!ATH9K_HW_CAP_MCI)
510 + return 0;
511 +
512 switch (state_type) {
513 case MCI_STATE_ENABLE:
514 if (mci->ready) {
515 --- a/drivers/net/wireless/ath/ath9k/mci.c
516 +++ b/drivers/net/wireless/ath/ath9k/mci.c
517 @@ -425,6 +425,9 @@ int ath_mci_setup(struct ath_softc *sc)
518 struct ath_mci_coex *mci = &sc->mci_coex;
519 int error = 0;
520
521 + if (!ATH9K_HW_CAP_MCI)
522 + return 0;
523 +
524 mci->sched_buf.bf_len = ATH_MCI_SCHED_BUF_SIZE + ATH_MCI_GPM_BUF_SIZE;
525
526 if (ath_mci_buf_alloc(sc, &mci->sched_buf)) {
527 @@ -458,6 +461,9 @@ void ath_mci_cleanup(struct ath_softc *s
528 struct ath_hw *ah = sc->sc_ah;
529 struct ath_mci_coex *mci = &sc->mci_coex;
530
531 + if (!ATH9K_HW_CAP_MCI)
532 + return;
533 +
534 /*
535 * both schedule and gpm buffers will be released
536 */
537 @@ -476,6 +482,9 @@ void ath_mci_intr(struct ath_softc *sc)
538 u32 more_data = MCI_GPM_MORE;
539 bool skip_gpm = false;
540
541 + if (!ATH9K_HW_CAP_MCI)
542 + return;
543 +
544 ar9003_mci_get_interrupt(sc->sc_ah, &mci_int, &mci_int_rxmsg);
545
546 if (ar9003_mci_state(ah, MCI_STATE_ENABLE, NULL) == 0) {
This page took 0.068774 seconds and 5 git commands to generate.