aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-09-09 05:33:11 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-07 16:39:20 -0400
commitaf03abecd8e3646736904431f3335dad5e28cb8d (patch)
treef3522e1dac8916ec7fabcf40f5577cabac3eb43a /drivers
parent2e20250a2ce1f4a7ba7c83ccb62d9b7b9b96c736 (diff)
ath9k: move hw specific btcoex info to ath_hw
Since we now access it via the ath_hw declare the ath_hw pointer at the header of some routines and se it. ath9k.h no longer needs to access btcoex.h and to adjust for this move ath_btcoex_set_weight() into btcoex.h and instead give main.c a helper for setting initial values upon drv_start() Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/btcoex.c57
-rw-r--r--drivers/net/wireless/ath/ath9k/btcoex.h14
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h7
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c70
6 files changed, 88 insertions, 65 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 831874c621ec..e8a630ccfd96 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -26,7 +26,6 @@
26#include "rc.h" 26#include "rc.h"
27#include "debug.h" 27#include "debug.h"
28#include "../ath.h" 28#include "../ath.h"
29#include "btcoex.h"
30 29
31struct ath_node; 30struct ath_node;
32 31
@@ -622,7 +621,6 @@ struct ath_softc {
622 struct ath_bus_ops *bus_ops; 621 struct ath_bus_ops *bus_ops;
623 struct ath_beacon_config cur_beacon_conf; 622 struct ath_beacon_config cur_beacon_conf;
624 struct delayed_work tx_complete_work; 623 struct delayed_work tx_complete_work;
625 struct ath_btcoex_info btcoex_info;
626 struct ath_btcoex btcoex; 624 struct ath_btcoex btcoex;
627}; 625};
628 626
diff --git a/drivers/net/wireless/ath/ath9k/btcoex.c b/drivers/net/wireless/ath/ath9k/btcoex.c
index e88a0a3f68f0..dfbcbd0969e6 100644
--- a/drivers/net/wireless/ath/ath9k/btcoex.c
+++ b/drivers/net/wireless/ath/ath9k/btcoex.c
@@ -43,14 +43,29 @@ bool ath_btcoex_supported(u16 subsysid)
43 return false; 43 return false;
44} 44}
45 45
46static void ath_btcoex_set_weight(struct ath_btcoex_info *btcoex_info,
47 u32 bt_weight,
48 u32 wlan_weight)
49{
50 btcoex_info->bt_coex_weights = SM(bt_weight, AR_BTCOEX_BT_WGHT) |
51 SM(wlan_weight, AR_BTCOEX_WL_WGHT);
52}
53
54void ath9k_hw_btcoex_init_weight(struct ath_hw *ah)
55{
56 ath_btcoex_set_weight(&ah->btcoex_info, AR_BT_COEX_WGHT,
57 AR_STOMP_LOW_WLAN_WGHT);
58}
59
46/* 60/*
47 * Detects if there is any priority bt traffic 61 * Detects if there is any priority bt traffic
48 */ 62 */
49static void ath_detect_bt_priority(struct ath_softc *sc) 63static void ath_detect_bt_priority(struct ath_softc *sc)
50{ 64{
51 struct ath_btcoex *btcoex = &sc->btcoex; 65 struct ath_btcoex *btcoex = &sc->btcoex;
66 struct ath_hw *ah = sc->sc_ah;
52 67
53 if (ath9k_hw_gpio_get(sc->sc_ah, sc->btcoex_info.btpriority_gpio)) 68 if (ath9k_hw_gpio_get(sc->sc_ah, ah->btcoex_info.btpriority_gpio))
54 btcoex->bt_priority_cnt++; 69 btcoex->bt_priority_cnt++;
55 70
56 if (time_after(jiffies, btcoex->bt_priority_time + 71 if (time_after(jiffies, btcoex->bt_priority_time +
@@ -106,8 +121,9 @@ static void ath_btcoex_bt_stomp(struct ath_softc *sc,
106static void ath_btcoex_period_timer(unsigned long data) 121static void ath_btcoex_period_timer(unsigned long data)
107{ 122{
108 struct ath_softc *sc = (struct ath_softc *) data; 123 struct ath_softc *sc = (struct ath_softc *) data;
124 struct ath_hw *ah = sc->sc_ah;
109 struct ath_btcoex *btcoex = &sc->btcoex; 125 struct ath_btcoex *btcoex = &sc->btcoex;
110 struct ath_btcoex_info *btinfo = &sc->btcoex_info; 126 struct ath_btcoex_info *btinfo = &ah->btcoex_info;
111 127
112 ath_detect_bt_priority(sc); 128 ath_detect_bt_priority(sc);
113 129
@@ -119,9 +135,9 @@ static void ath_btcoex_period_timer(unsigned long data)
119 135
120 if (btcoex->btcoex_period != btcoex->btcoex_no_stomp) { 136 if (btcoex->btcoex_period != btcoex->btcoex_no_stomp) {
121 if (btcoex->hw_timer_enabled) 137 if (btcoex->hw_timer_enabled)
122 ath_gen_timer_stop(sc->sc_ah, btinfo->no_stomp_timer); 138 ath_gen_timer_stop(ah, btinfo->no_stomp_timer);
123 139
124 ath_gen_timer_start(sc->sc_ah, 140 ath_gen_timer_start(ah,
125 btinfo->no_stomp_timer, 141 btinfo->no_stomp_timer,
126 (ath9k_hw_gettsf32(sc->sc_ah) + 142 (ath9k_hw_gettsf32(sc->sc_ah) +
127 btcoex->btcoex_no_stomp), 143 btcoex->btcoex_no_stomp),
@@ -141,10 +157,11 @@ static void ath_btcoex_period_timer(unsigned long data)
141static void ath_btcoex_no_stomp_timer(void *arg) 157static void ath_btcoex_no_stomp_timer(void *arg)
142{ 158{
143 struct ath_softc *sc = (struct ath_softc *)arg; 159 struct ath_softc *sc = (struct ath_softc *)arg;
160 struct ath_hw *ah = sc->sc_ah;
144 struct ath_btcoex *btcoex = &sc->btcoex; 161 struct ath_btcoex *btcoex = &sc->btcoex;
145 struct ath_btcoex_info *btinfo = &sc->btcoex_info; 162 struct ath_btcoex_info *btinfo = &ah->btcoex_info;
146 163
147 DPRINTF(sc->sc_ah, ATH_DBG_BTCOEX, "no stomp timer running \n"); 164 DPRINTF(ah, ATH_DBG_BTCOEX, "no stomp timer running \n");
148 165
149 spin_lock_bh(&btcoex->btcoex_lock); 166 spin_lock_bh(&btcoex->btcoex_lock);
150 167
@@ -156,14 +173,14 @@ static void ath_btcoex_no_stomp_timer(void *arg)
156 spin_unlock_bh(&btcoex->btcoex_lock); 173 spin_unlock_bh(&btcoex->btcoex_lock);
157} 174}
158 175
159static int ath_init_btcoex_info(struct ath_hw *hw, 176static int ath_init_btcoex_info(struct ath_hw *ah,
160 struct ath_btcoex_info *btcoex_info) 177 struct ath_btcoex_info *btcoex_info)
161{ 178{
162 struct ath_btcoex *btcoex = &hw->ah_sc->btcoex; 179 struct ath_btcoex *btcoex = &ah->ah_sc->btcoex;
163 u32 i; 180 u32 i;
164 int qnum; 181 int qnum;
165 182
166 qnum = ath_tx_get_qnum(hw->ah_sc, ATH9K_TX_QUEUE_DATA, ATH9K_WME_AC_BE); 183 qnum = ath_tx_get_qnum(ah->ah_sc, ATH9K_TX_QUEUE_DATA, ATH9K_WME_AC_BE);
167 184
168 btcoex_info->bt_coex_mode = 185 btcoex_info->bt_coex_mode =
169 (btcoex_info->bt_coex_mode & AR_BT_QCU_THRESH) | 186 (btcoex_info->bt_coex_mode & AR_BT_QCU_THRESH) |
@@ -190,15 +207,15 @@ static int ath_init_btcoex_info(struct ath_hw *hw,
190 btcoex->btcoex_period / 100; 207 btcoex->btcoex_period / 100;
191 208
192 for (i = 0; i < 32; i++) 209 for (i = 0; i < 32; i++)
193 hw->hw_gen_timers.gen_timer_index[(debruijn32 << i) >> 27] = i; 210 ah->hw_gen_timers.gen_timer_index[(debruijn32 << i) >> 27] = i;
194 211
195 setup_timer(&btcoex->period_timer, ath_btcoex_period_timer, 212 setup_timer(&btcoex->period_timer, ath_btcoex_period_timer,
196 (unsigned long) hw->ah_sc); 213 (unsigned long) ah->ah_sc);
197 214
198 btcoex_info->no_stomp_timer = ath_gen_timer_alloc(hw, 215 btcoex_info->no_stomp_timer = ath_gen_timer_alloc(ah,
199 ath_btcoex_no_stomp_timer, 216 ath_btcoex_no_stomp_timer,
200 ath_btcoex_no_stomp_timer, 217 ath_btcoex_no_stomp_timer,
201 (void *)hw->ah_sc, AR_FIRST_NDP_TIMER); 218 (void *)ah->ah_sc, AR_FIRST_NDP_TIMER);
202 219
203 if (btcoex_info->no_stomp_timer == NULL) 220 if (btcoex_info->no_stomp_timer == NULL)
204 return -ENOMEM; 221 return -ENOMEM;
@@ -210,7 +227,7 @@ static int ath_init_btcoex_info(struct ath_hw *hw,
210 227
211int ath9k_hw_btcoex_init(struct ath_hw *ah) 228int ath9k_hw_btcoex_init(struct ath_hw *ah)
212{ 229{
213 struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info; 230 struct ath_btcoex_info *btcoex_info = &ah->btcoex_info;
214 int ret = 0; 231 int ret = 0;
215 232
216 if (btcoex_info->btcoex_scheme == ATH_BTCOEX_CFG_2WIRE) { 233 if (btcoex_info->btcoex_scheme == ATH_BTCOEX_CFG_2WIRE) {
@@ -258,7 +275,7 @@ int ath9k_hw_btcoex_init(struct ath_hw *ah)
258 275
259void ath9k_hw_btcoex_enable(struct ath_hw *ah) 276void ath9k_hw_btcoex_enable(struct ath_hw *ah)
260{ 277{
261 struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info; 278 struct ath_btcoex_info *btcoex_info = &ah->btcoex_info;
262 279
263 if (btcoex_info->btcoex_scheme == ATH_BTCOEX_CFG_2WIRE) { 280 if (btcoex_info->btcoex_scheme == ATH_BTCOEX_CFG_2WIRE) {
264 /* Configure the desired GPIO port for TX_FRAME output */ 281 /* Configure the desired GPIO port for TX_FRAME output */
@@ -291,7 +308,7 @@ void ath9k_hw_btcoex_enable(struct ath_hw *ah)
291 308
292void ath9k_hw_btcoex_disable(struct ath_hw *ah) 309void ath9k_hw_btcoex_disable(struct ath_hw *ah)
293{ 310{
294 struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info; 311 struct ath_btcoex_info *btcoex_info = &ah->btcoex_info;
295 312
296 ath9k_hw_set_gpio(ah, btcoex_info->wlanactive_gpio, 0); 313 ath9k_hw_set_gpio(ah, btcoex_info->wlanactive_gpio, 0);
297 314
@@ -313,11 +330,12 @@ void ath9k_hw_btcoex_disable(struct ath_hw *ah)
313void ath_btcoex_timer_pause(struct ath_softc *sc) 330void ath_btcoex_timer_pause(struct ath_softc *sc)
314{ 331{
315 struct ath_btcoex *btcoex = &sc->btcoex; 332 struct ath_btcoex *btcoex = &sc->btcoex;
333 struct ath_hw *ah = sc->sc_ah;
316 334
317 del_timer_sync(&btcoex->period_timer); 335 del_timer_sync(&btcoex->period_timer);
318 336
319 if (btcoex->hw_timer_enabled) 337 if (btcoex->hw_timer_enabled)
320 ath_gen_timer_stop(sc->sc_ah, sc->btcoex_info.no_stomp_timer); 338 ath_gen_timer_stop(ah, ah->btcoex_info.no_stomp_timer);
321 339
322 btcoex->hw_timer_enabled = false; 340 btcoex->hw_timer_enabled = false;
323} 341}
@@ -328,12 +346,13 @@ void ath_btcoex_timer_pause(struct ath_softc *sc)
328void ath_btcoex_timer_resume(struct ath_softc *sc) 346void ath_btcoex_timer_resume(struct ath_softc *sc)
329{ 347{
330 struct ath_btcoex *btcoex = &sc->btcoex; 348 struct ath_btcoex *btcoex = &sc->btcoex;
349 struct ath_hw *ah = sc->sc_ah;
331 350
332 DPRINTF(sc->sc_ah, ATH_DBG_BTCOEX, "Starting btcoex timers"); 351 DPRINTF(ah, ATH_DBG_BTCOEX, "Starting btcoex timers");
333 352
334 /* make sure duty cycle timer is also stopped when resuming */ 353 /* make sure duty cycle timer is also stopped when resuming */
335 if (btcoex->hw_timer_enabled) 354 if (btcoex->hw_timer_enabled)
336 ath_gen_timer_stop(sc->sc_ah, sc->btcoex_info.no_stomp_timer); 355 ath_gen_timer_stop(sc->sc_ah, ah->btcoex_info.no_stomp_timer);
337 356
338 btcoex->bt_priority_cnt = 0; 357 btcoex->bt_priority_cnt = 0;
339 btcoex->bt_priority_time = jiffies; 358 btcoex->bt_priority_time = jiffies;
diff --git a/drivers/net/wireless/ath/ath9k/btcoex.h b/drivers/net/wireless/ath/ath9k/btcoex.h
index 6cbbc14f9c39..12e86b70d950 100644
--- a/drivers/net/wireless/ath/ath9k/btcoex.h
+++ b/drivers/net/wireless/ath/ath9k/btcoex.h
@@ -17,6 +17,8 @@
17#ifndef BTCOEX_H 17#ifndef BTCOEX_H
18#define BTCOEX_H 18#define BTCOEX_H
19 19
20#include "hw.h"
21
20#define ATH_WLANACTIVE_GPIO 5 22#define ATH_WLANACTIVE_GPIO 5
21#define ATH_BTACTIVE_GPIO 6 23#define ATH_BTACTIVE_GPIO 6
22#define ATH_BTPRIORITY_GPIO 7 24#define ATH_BTPRIORITY_GPIO 7
@@ -74,19 +76,9 @@ struct ath_btcoex_info {
74}; 76};
75 77
76bool ath_btcoex_supported(u16 subsysid); 78bool ath_btcoex_supported(u16 subsysid);
79void ath9k_hw_btcoex_init_weight(struct ath_hw *ah);
77int ath9k_hw_btcoex_init(struct ath_hw *ah); 80int ath9k_hw_btcoex_init(struct ath_hw *ah);
78void ath9k_hw_btcoex_enable(struct ath_hw *ah); 81void ath9k_hw_btcoex_enable(struct ath_hw *ah);
79void ath9k_hw_btcoex_disable(struct ath_hw *ah); 82void ath9k_hw_btcoex_disable(struct ath_hw *ah);
80 83
81void ath_btcoex_timer_resume(struct ath_softc *sc);
82void ath_btcoex_timer_pause(struct ath_softc *sc);
83
84static inline void ath_btcoex_set_weight(struct ath_btcoex_info *btcoex_info,
85 u32 bt_weight,
86 u32 wlan_weight)
87{
88 btcoex_info->bt_coex_weights = SM(bt_weight, AR_BTCOEX_BT_WGHT) |
89 SM(wlan_weight, AR_BTCOEX_WL_WGHT);
90}
91
92#endif 84#endif
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 0342091dfe7d..6e33aadc161c 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -18,6 +18,7 @@
18#include <asm/unaligned.h> 18#include <asm/unaligned.h>
19#include <linux/pci.h> 19#include <linux/pci.h>
20 20
21#include "hw.h"
21#include "ath9k.h" 22#include "ath9k.h"
22#include "initvals.h" 23#include "initvals.h"
23 24
@@ -3558,7 +3559,7 @@ void ath9k_hw_fill_cap_info(struct ath_hw *ah)
3558{ 3559{
3559 struct ath9k_hw_capabilities *pCap = &ah->caps; 3560 struct ath9k_hw_capabilities *pCap = &ah->caps;
3560 struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); 3561 struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
3561 struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info; 3562 struct ath_btcoex_info *btcoex_info = &ah->btcoex_info;
3562 3563
3563 u16 capField = 0, eeval; 3564 u16 capField = 0, eeval;
3564 3565
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index b89234571829..f2b3a601d6a9 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -27,6 +27,7 @@
27#include "calib.h" 27#include "calib.h"
28#include "reg.h" 28#include "reg.h"
29#include "phy.h" 29#include "phy.h"
30#include "btcoex.h"
30 31
31#include "../regd.h" 32#include "../regd.h"
32 33
@@ -553,6 +554,9 @@ struct ath_hw {
553 int firpwr[5]; 554 int firpwr[5];
554 enum ath9k_ani_cmd ani_function; 555 enum ath9k_ani_cmd ani_function;
555 556
557 /* Bluetooth coexistance */
558 struct ath_btcoex_info btcoex_info;
559
556 u32 intr_txqs; 560 u32 intr_txqs;
557 enum ath9k_ht_extprotspacing extprotspacing; 561 enum ath9k_ht_extprotspacing extprotspacing;
558 u8 txchainmask; 562 u8 txchainmask;
@@ -675,4 +679,7 @@ u32 ath9k_hw_gettsf32(struct ath_hw *ah);
675#define ATH_PCIE_CAP_LINK_L1 2 679#define ATH_PCIE_CAP_LINK_L1 2
676 680
677void ath_pcie_aspm_disable(struct ath_softc *sc); 681void ath_pcie_aspm_disable(struct ath_softc *sc);
682
683void ath_btcoex_timer_resume(struct ath_softc *sc);
684void ath_btcoex_timer_pause(struct ath_softc *sc);
678#endif 685#endif
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 612e83678b23..63e1f183b470 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -16,6 +16,7 @@
16 16
17#include <linux/nl80211.h> 17#include <linux/nl80211.h>
18#include "ath9k.h" 18#include "ath9k.h"
19#include "btcoex.h"
19 20
20static char *dev_info = "ath9k"; 21static char *dev_info = "ath9k";
21 22
@@ -439,8 +440,10 @@ static void ath_start_ani(struct ath_softc *sc)
439 */ 440 */
440void ath_update_chainmask(struct ath_softc *sc, int is_ht) 441void ath_update_chainmask(struct ath_softc *sc, int is_ht)
441{ 442{
443 struct ath_hw *ah = sc->sc_ah;
444
442 if ((sc->sc_flags & SC_OP_SCANNING) || is_ht || 445 if ((sc->sc_flags & SC_OP_SCANNING) || is_ht ||
443 (sc->btcoex_info.btcoex_scheme != ATH_BTCOEX_CFG_NONE)) { 446 (ah->btcoex_info.btcoex_scheme != ATH_BTCOEX_CFG_NONE)) {
444 sc->tx_chainmask = sc->sc_ah->caps.tx_chainmask; 447 sc->tx_chainmask = sc->sc_ah->caps.tx_chainmask;
445 sc->rx_chainmask = sc->sc_ah->caps.rx_chainmask; 448 sc->rx_chainmask = sc->sc_ah->caps.rx_chainmask;
446 } else { 449 } else {
@@ -448,7 +451,7 @@ void ath_update_chainmask(struct ath_softc *sc, int is_ht)
448 sc->rx_chainmask = 1; 451 sc->rx_chainmask = 1;
449 } 452 }
450 453
451 DPRINTF(sc->sc_ah, ATH_DBG_CONFIG, "tx chmask: %d, rx chmask: %d\n", 454 DPRINTF(ah, ATH_DBG_CONFIG, "tx chmask: %d, rx chmask: %d\n",
452 sc->tx_chainmask, sc->rx_chainmask); 455 sc->tx_chainmask, sc->rx_chainmask);
453} 456}
454 457
@@ -478,6 +481,8 @@ static void ath_node_detach(struct ath_softc *sc, struct ieee80211_sta *sta)
478static void ath9k_tasklet(unsigned long data) 481static void ath9k_tasklet(unsigned long data)
479{ 482{
480 struct ath_softc *sc = (struct ath_softc *)data; 483 struct ath_softc *sc = (struct ath_softc *)data;
484 struct ath_hw *ah = sc->sc_ah;
485
481 u32 status = sc->intrstatus; 486 u32 status = sc->intrstatus;
482 487
483 ath9k_ps_wakeup(sc); 488 ath9k_ps_wakeup(sc);
@@ -502,16 +507,16 @@ static void ath9k_tasklet(unsigned long data)
502 * TSF sync does not look correct; remain awake to sync with 507 * TSF sync does not look correct; remain awake to sync with
503 * the next Beacon. 508 * the next Beacon.
504 */ 509 */
505 DPRINTF(sc->sc_ah, ATH_DBG_PS, "TSFOOR - Sync with next Beacon\n"); 510 DPRINTF(ah, ATH_DBG_PS, "TSFOOR - Sync with next Beacon\n");
506 sc->sc_flags |= SC_OP_WAIT_FOR_BEACON | SC_OP_BEACON_SYNC; 511 sc->sc_flags |= SC_OP_WAIT_FOR_BEACON | SC_OP_BEACON_SYNC;
507 } 512 }
508 513
509 if (sc->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE) 514 if (ah->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE)
510 if (status & ATH9K_INT_GENTIMER) 515 if (status & ATH9K_INT_GENTIMER)
511 ath_gen_timer_isr(sc->sc_ah); 516 ath_gen_timer_isr(sc->sc_ah);
512 517
513 /* re-enable hardware interrupt */ 518 /* re-enable hardware interrupt */
514 ath9k_hw_set_interrupts(sc->sc_ah, sc->imask); 519 ath9k_hw_set_interrupts(ah, sc->imask);
515 ath9k_ps_restore(sc); 520 ath9k_ps_restore(sc);
516} 521}
517 522
@@ -1281,12 +1286,12 @@ void ath_detach(struct ath_softc *sc)
1281 if (ATH_TXQ_SETUP(sc, i)) 1286 if (ATH_TXQ_SETUP(sc, i))
1282 ath_tx_cleanupq(sc, &sc->tx.txq[i]); 1287 ath_tx_cleanupq(sc, &sc->tx.txq[i]);
1283 1288
1284 if ((sc->btcoex_info.no_stomp_timer) && 1289 if ((ah->btcoex_info.no_stomp_timer) &&
1285 sc->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE) 1290 ah->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE)
1286 ath_gen_timer_free(ah, sc->btcoex_info.no_stomp_timer); 1291 ath_gen_timer_free(ah, ah->btcoex_info.no_stomp_timer);
1287 1292
1288 ath9k_hw_detach(ah); 1293 ath9k_hw_detach(ah);
1289 ath9k_exit_debug(sc->sc_ah); 1294 ath9k_exit_debug(ah);
1290 sc->sc_ah = NULL; 1295 sc->sc_ah = NULL;
1291} 1296}
1292 1297
@@ -1516,7 +1521,7 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid)
1516 ARRAY_SIZE(ath9k_5ghz_chantable); 1521 ARRAY_SIZE(ath9k_5ghz_chantable);
1517 } 1522 }
1518 1523
1519 if (sc->btcoex_info.btcoex_scheme != ATH_BTCOEX_CFG_NONE) { 1524 if (ah->btcoex_info.btcoex_scheme != ATH_BTCOEX_CFG_NONE) {
1520 r = ath9k_hw_btcoex_init(ah); 1525 r = ath9k_hw_btcoex_init(ah);
1521 if (r) 1526 if (r)
1522 goto bad2; 1527 goto bad2;
@@ -1905,11 +1910,12 @@ static int ath9k_start(struct ieee80211_hw *hw)
1905{ 1910{
1906 struct ath_wiphy *aphy = hw->priv; 1911 struct ath_wiphy *aphy = hw->priv;
1907 struct ath_softc *sc = aphy->sc; 1912 struct ath_softc *sc = aphy->sc;
1913 struct ath_hw *ah = sc->sc_ah;
1908 struct ieee80211_channel *curchan = hw->conf.channel; 1914 struct ieee80211_channel *curchan = hw->conf.channel;
1909 struct ath9k_channel *init_channel; 1915 struct ath9k_channel *init_channel;
1910 int r; 1916 int r;
1911 1917
1912 DPRINTF(sc->sc_ah, ATH_DBG_CONFIG, "Starting driver with " 1918 DPRINTF(ah, ATH_DBG_CONFIG, "Starting driver with "
1913 "initial channel: %d MHz\n", curchan->center_freq); 1919 "initial channel: %d MHz\n", curchan->center_freq);
1914 1920
1915 mutex_lock(&sc->mutex); 1921 mutex_lock(&sc->mutex);
@@ -1942,7 +1948,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
1942 init_channel = ath_get_curchannel(sc, hw); 1948 init_channel = ath_get_curchannel(sc, hw);
1943 1949
1944 /* Reset SERDES registers */ 1950 /* Reset SERDES registers */
1945 ath9k_hw_configpcipowersave(sc->sc_ah, 0, 0); 1951 ath9k_hw_configpcipowersave(ah, 0, 0);
1946 1952
1947 /* 1953 /*
1948 * The basic interface to setting the hardware in a good 1954 * The basic interface to setting the hardware in a good
@@ -1952,9 +1958,9 @@ static int ath9k_start(struct ieee80211_hw *hw)
1952 * and then setup of the interrupt mask. 1958 * and then setup of the interrupt mask.
1953 */ 1959 */
1954 spin_lock_bh(&sc->sc_resetlock); 1960 spin_lock_bh(&sc->sc_resetlock);
1955 r = ath9k_hw_reset(sc->sc_ah, init_channel, false); 1961 r = ath9k_hw_reset(ah, init_channel, false);
1956 if (r) { 1962 if (r) {
1957 DPRINTF(sc->sc_ah, ATH_DBG_FATAL, 1963 DPRINTF(ah, ATH_DBG_FATAL,
1958 "Unable to reset hardware; reset status %d " 1964 "Unable to reset hardware; reset status %d "
1959 "(freq %u MHz)\n", r, 1965 "(freq %u MHz)\n", r,
1960 curchan->center_freq); 1966 curchan->center_freq);
@@ -1977,7 +1983,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
1977 * here except setup the interrupt mask. 1983 * here except setup the interrupt mask.
1978 */ 1984 */
1979 if (ath_startrecv(sc) != 0) { 1985 if (ath_startrecv(sc) != 0) {
1980 DPRINTF(sc->sc_ah, ATH_DBG_FATAL, "Unable to start recv logic\n"); 1986 DPRINTF(ah, ATH_DBG_FATAL, "Unable to start recv logic\n");
1981 r = -EIO; 1987 r = -EIO;
1982 goto mutex_unlock; 1988 goto mutex_unlock;
1983 } 1989 }
@@ -1987,10 +1993,10 @@ static int ath9k_start(struct ieee80211_hw *hw)
1987 | ATH9K_INT_RXEOL | ATH9K_INT_RXORN 1993 | ATH9K_INT_RXEOL | ATH9K_INT_RXORN
1988 | ATH9K_INT_FATAL | ATH9K_INT_GLOBAL; 1994 | ATH9K_INT_FATAL | ATH9K_INT_GLOBAL;
1989 1995
1990 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_GTT) 1996 if (ah->caps.hw_caps & ATH9K_HW_CAP_GTT)
1991 sc->imask |= ATH9K_INT_GTT; 1997 sc->imask |= ATH9K_INT_GTT;
1992 1998
1993 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) 1999 if (ah->caps.hw_caps & ATH9K_HW_CAP_HT)
1994 sc->imask |= ATH9K_INT_CST; 2000 sc->imask |= ATH9K_INT_CST;
1995 2001
1996 ath_cache_conf_rate(sc, &hw->conf); 2002 ath_cache_conf_rate(sc, &hw->conf);
@@ -1999,20 +2005,19 @@ static int ath9k_start(struct ieee80211_hw *hw)
1999 2005
2000 /* Disable BMISS interrupt when we're not associated */ 2006 /* Disable BMISS interrupt when we're not associated */
2001 sc->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS); 2007 sc->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);
2002 ath9k_hw_set_interrupts(sc->sc_ah, sc->imask); 2008 ath9k_hw_set_interrupts(ah, sc->imask);
2003 2009
2004 ieee80211_wake_queues(hw); 2010 ieee80211_wake_queues(hw);
2005 2011
2006 ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0); 2012 ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0);
2007 2013
2008 if ((sc->btcoex_info.btcoex_scheme != ATH_BTCOEX_CFG_NONE) && 2014 if ((ah->btcoex_info.btcoex_scheme != ATH_BTCOEX_CFG_NONE) &&
2009 !(sc->sc_flags & SC_OP_BTCOEX_ENABLED)) { 2015 !(sc->sc_flags & SC_OP_BTCOEX_ENABLED)) {
2010 ath_btcoex_set_weight(&sc->btcoex_info, AR_BT_COEX_WGHT, 2016 ath9k_hw_btcoex_init_weight(ah);
2011 AR_STOMP_LOW_WLAN_WGHT); 2017 ath9k_hw_btcoex_enable(ah);
2012 ath9k_hw_btcoex_enable(sc->sc_ah);
2013 2018
2014 ath_pcie_aspm_disable(sc); 2019 ath_pcie_aspm_disable(sc);
2015 if (sc->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE) 2020 if (ah->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE)
2016 ath_btcoex_timer_resume(sc); 2021 ath_btcoex_timer_resume(sc);
2017 } 2022 }
2018 2023
@@ -2125,6 +2130,7 @@ static void ath9k_stop(struct ieee80211_hw *hw)
2125{ 2130{
2126 struct ath_wiphy *aphy = hw->priv; 2131 struct ath_wiphy *aphy = hw->priv;
2127 struct ath_softc *sc = aphy->sc; 2132 struct ath_softc *sc = aphy->sc;
2133 struct ath_hw *ah = sc->sc_ah;
2128 2134
2129 mutex_lock(&sc->mutex); 2135 mutex_lock(&sc->mutex);
2130 2136
@@ -2139,7 +2145,7 @@ static void ath9k_stop(struct ieee80211_hw *hw)
2139 } 2145 }
2140 2146
2141 if (sc->sc_flags & SC_OP_INVALID) { 2147 if (sc->sc_flags & SC_OP_INVALID) {
2142 DPRINTF(sc->sc_ah, ATH_DBG_ANY, "Device not present\n"); 2148 DPRINTF(ah, ATH_DBG_ANY, "Device not present\n");
2143 mutex_unlock(&sc->mutex); 2149 mutex_unlock(&sc->mutex);
2144 return; 2150 return;
2145 } 2151 }
@@ -2150,32 +2156,32 @@ static void ath9k_stop(struct ieee80211_hw *hw)
2150 } 2156 }
2151 2157
2152 if (sc->sc_flags & SC_OP_BTCOEX_ENABLED) { 2158 if (sc->sc_flags & SC_OP_BTCOEX_ENABLED) {
2153 ath9k_hw_btcoex_disable(sc->sc_ah); 2159 ath9k_hw_btcoex_disable(ah);
2154 if (sc->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE) 2160 if (ah->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE)
2155 ath_btcoex_timer_pause(sc); 2161 ath_btcoex_timer_pause(sc);
2156 } 2162 }
2157 2163
2158 /* make sure h/w will not generate any interrupt 2164 /* make sure h/w will not generate any interrupt
2159 * before setting the invalid flag. */ 2165 * before setting the invalid flag. */
2160 ath9k_hw_set_interrupts(sc->sc_ah, 0); 2166 ath9k_hw_set_interrupts(ah, 0);
2161 2167
2162 if (!(sc->sc_flags & SC_OP_INVALID)) { 2168 if (!(sc->sc_flags & SC_OP_INVALID)) {
2163 ath_drain_all_txq(sc, false); 2169 ath_drain_all_txq(sc, false);
2164 ath_stoprecv(sc); 2170 ath_stoprecv(sc);
2165 ath9k_hw_phy_disable(sc->sc_ah); 2171 ath9k_hw_phy_disable(ah);
2166 } else 2172 } else
2167 sc->rx.rxlink = NULL; 2173 sc->rx.rxlink = NULL;
2168 2174
2169 /* disable HAL and put h/w to sleep */ 2175 /* disable HAL and put h/w to sleep */
2170 ath9k_hw_disable(sc->sc_ah); 2176 ath9k_hw_disable(ah);
2171 ath9k_hw_configpcipowersave(sc->sc_ah, 1, 1); 2177 ath9k_hw_configpcipowersave(ah, 1, 1);
2172 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_FULL_SLEEP); 2178 ath9k_hw_setpower(ah, ATH9K_PM_FULL_SLEEP);
2173 2179
2174 sc->sc_flags |= SC_OP_INVALID; 2180 sc->sc_flags |= SC_OP_INVALID;
2175 2181
2176 mutex_unlock(&sc->mutex); 2182 mutex_unlock(&sc->mutex);
2177 2183
2178 DPRINTF(sc->sc_ah, ATH_DBG_CONFIG, "Driver halt\n"); 2184 DPRINTF(ah, ATH_DBG_CONFIG, "Driver halt\n");
2179} 2185}
2180 2186
2181static int ath9k_add_interface(struct ieee80211_hw *hw, 2187static int ath9k_add_interface(struct ieee80211_hw *hw,