diff options
author | Sujith <Sujith.Manoharan@atheros.com> | 2009-02-09 02:57:12 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-13 13:45:05 -0500 |
commit | cbe61d8a41210600bc76b212edcd4dc0f55c014f (patch) | |
tree | d8bd8e43d3556c58d410f1bef0d2ca3bf7d75c92 /drivers/net/wireless/ath9k/mac.c | |
parent | ba52da58be0acf3b7775972b2b5234ce64388c79 (diff) |
ath9k: Merge ath_hal and ath_hal_5416 structures
Finally, merge these structures and have a single
HW specific data structure.
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/mac.c')
-rw-r--r-- | drivers/net/wireless/ath9k/mac.c | 144 |
1 files changed, 66 insertions, 78 deletions
diff --git a/drivers/net/wireless/ath9k/mac.c b/drivers/net/wireless/ath9k/mac.c index b375a2964d2..ac207144401 100644 --- a/drivers/net/wireless/ath9k/mac.c +++ b/drivers/net/wireless/ath9k/mac.c | |||
@@ -16,40 +16,38 @@ | |||
16 | 16 | ||
17 | #include "ath9k.h" | 17 | #include "ath9k.h" |
18 | 18 | ||
19 | static void ath9k_hw_set_txq_interrupts(struct ath_hal *ah, | 19 | static void ath9k_hw_set_txq_interrupts(struct ath_hw *ah, |
20 | struct ath9k_tx_queue_info *qi) | 20 | struct ath9k_tx_queue_info *qi) |
21 | { | 21 | { |
22 | struct ath_hal_5416 *ahp = AH5416(ah); | ||
23 | |||
24 | DPRINTF(ah->ah_sc, ATH_DBG_INTERRUPT, | 22 | DPRINTF(ah->ah_sc, ATH_DBG_INTERRUPT, |
25 | "tx ok 0x%x err 0x%x desc 0x%x eol 0x%x urn 0x%x\n", | 23 | "tx ok 0x%x err 0x%x desc 0x%x eol 0x%x urn 0x%x\n", |
26 | ahp->ah_txOkInterruptMask, ahp->ah_txErrInterruptMask, | 24 | ah->ah_txOkInterruptMask, ah->ah_txErrInterruptMask, |
27 | ahp->ah_txDescInterruptMask, ahp->ah_txEolInterruptMask, | 25 | ah->ah_txDescInterruptMask, ah->ah_txEolInterruptMask, |
28 | ahp->ah_txUrnInterruptMask); | 26 | ah->ah_txUrnInterruptMask); |
29 | 27 | ||
30 | REG_WRITE(ah, AR_IMR_S0, | 28 | REG_WRITE(ah, AR_IMR_S0, |
31 | SM(ahp->ah_txOkInterruptMask, AR_IMR_S0_QCU_TXOK) | 29 | SM(ah->ah_txOkInterruptMask, AR_IMR_S0_QCU_TXOK) |
32 | | SM(ahp->ah_txDescInterruptMask, AR_IMR_S0_QCU_TXDESC)); | 30 | | SM(ah->ah_txDescInterruptMask, AR_IMR_S0_QCU_TXDESC)); |
33 | REG_WRITE(ah, AR_IMR_S1, | 31 | REG_WRITE(ah, AR_IMR_S1, |
34 | SM(ahp->ah_txErrInterruptMask, AR_IMR_S1_QCU_TXERR) | 32 | SM(ah->ah_txErrInterruptMask, AR_IMR_S1_QCU_TXERR) |
35 | | SM(ahp->ah_txEolInterruptMask, AR_IMR_S1_QCU_TXEOL)); | 33 | | SM(ah->ah_txEolInterruptMask, AR_IMR_S1_QCU_TXEOL)); |
36 | REG_RMW_FIELD(ah, AR_IMR_S2, | 34 | REG_RMW_FIELD(ah, AR_IMR_S2, |
37 | AR_IMR_S2_QCU_TXURN, ahp->ah_txUrnInterruptMask); | 35 | AR_IMR_S2_QCU_TXURN, ah->ah_txUrnInterruptMask); |
38 | } | 36 | } |
39 | 37 | ||
40 | u32 ath9k_hw_gettxbuf(struct ath_hal *ah, u32 q) | 38 | u32 ath9k_hw_gettxbuf(struct ath_hw *ah, u32 q) |
41 | { | 39 | { |
42 | return REG_READ(ah, AR_QTXDP(q)); | 40 | return REG_READ(ah, AR_QTXDP(q)); |
43 | } | 41 | } |
44 | 42 | ||
45 | bool ath9k_hw_puttxbuf(struct ath_hal *ah, u32 q, u32 txdp) | 43 | bool ath9k_hw_puttxbuf(struct ath_hw *ah, u32 q, u32 txdp) |
46 | { | 44 | { |
47 | REG_WRITE(ah, AR_QTXDP(q), txdp); | 45 | REG_WRITE(ah, AR_QTXDP(q), txdp); |
48 | 46 | ||
49 | return true; | 47 | return true; |
50 | } | 48 | } |
51 | 49 | ||
52 | bool ath9k_hw_txstart(struct ath_hal *ah, u32 q) | 50 | bool ath9k_hw_txstart(struct ath_hw *ah, u32 q) |
53 | { | 51 | { |
54 | DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "queue %u\n", q); | 52 | DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "queue %u\n", q); |
55 | 53 | ||
@@ -58,7 +56,7 @@ bool ath9k_hw_txstart(struct ath_hal *ah, u32 q) | |||
58 | return true; | 56 | return true; |
59 | } | 57 | } |
60 | 58 | ||
61 | u32 ath9k_hw_numtxpending(struct ath_hal *ah, u32 q) | 59 | u32 ath9k_hw_numtxpending(struct ath_hw *ah, u32 q) |
62 | { | 60 | { |
63 | u32 npend; | 61 | u32 npend; |
64 | 62 | ||
@@ -72,16 +70,15 @@ u32 ath9k_hw_numtxpending(struct ath_hal *ah, u32 q) | |||
72 | return npend; | 70 | return npend; |
73 | } | 71 | } |
74 | 72 | ||
75 | bool ath9k_hw_updatetxtriglevel(struct ath_hal *ah, bool bIncTrigLevel) | 73 | bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel) |
76 | { | 74 | { |
77 | struct ath_hal_5416 *ahp = AH5416(ah); | ||
78 | u32 txcfg, curLevel, newLevel; | 75 | u32 txcfg, curLevel, newLevel; |
79 | enum ath9k_int omask; | 76 | enum ath9k_int omask; |
80 | 77 | ||
81 | if (ah->ah_txTrigLevel >= MAX_TX_FIFO_THRESHOLD) | 78 | if (ah->ah_txTrigLevel >= MAX_TX_FIFO_THRESHOLD) |
82 | return false; | 79 | return false; |
83 | 80 | ||
84 | omask = ath9k_hw_set_interrupts(ah, ahp->ah_maskReg & ~ATH9K_INT_GLOBAL); | 81 | omask = ath9k_hw_set_interrupts(ah, ah->ah_maskReg & ~ATH9K_INT_GLOBAL); |
85 | 82 | ||
86 | txcfg = REG_READ(ah, AR_TXCFG); | 83 | txcfg = REG_READ(ah, AR_TXCFG); |
87 | curLevel = MS(txcfg, AR_FTRIG); | 84 | curLevel = MS(txcfg, AR_FTRIG); |
@@ -102,12 +99,11 @@ bool ath9k_hw_updatetxtriglevel(struct ath_hal *ah, bool bIncTrigLevel) | |||
102 | return newLevel != curLevel; | 99 | return newLevel != curLevel; |
103 | } | 100 | } |
104 | 101 | ||
105 | bool ath9k_hw_stoptxdma(struct ath_hal *ah, u32 q) | 102 | bool ath9k_hw_stoptxdma(struct ath_hw *ah, u32 q) |
106 | { | 103 | { |
107 | #define ATH9K_TX_STOP_DMA_TIMEOUT 4000 /* usec */ | 104 | #define ATH9K_TX_STOP_DMA_TIMEOUT 4000 /* usec */ |
108 | #define ATH9K_TIME_QUANTUM 100 /* usec */ | 105 | #define ATH9K_TIME_QUANTUM 100 /* usec */ |
109 | 106 | ||
110 | struct ath_hal_5416 *ahp = AH5416(ah); | ||
111 | struct ath9k_hw_capabilities *pCap = &ah->ah_caps; | 107 | struct ath9k_hw_capabilities *pCap = &ah->ah_caps; |
112 | struct ath9k_tx_queue_info *qi; | 108 | struct ath9k_tx_queue_info *qi; |
113 | u32 tsfLow, j, wait; | 109 | u32 tsfLow, j, wait; |
@@ -118,7 +114,7 @@ bool ath9k_hw_stoptxdma(struct ath_hal *ah, u32 q) | |||
118 | return false; | 114 | return false; |
119 | } | 115 | } |
120 | 116 | ||
121 | qi = &ahp->ah_txq[q]; | 117 | qi = &ah->ah_txq[q]; |
122 | if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) { | 118 | if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) { |
123 | DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "inactive queue\n"); | 119 | DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "inactive queue\n"); |
124 | return false; | 120 | return false; |
@@ -180,7 +176,7 @@ bool ath9k_hw_stoptxdma(struct ath_hal *ah, u32 q) | |||
180 | #undef ATH9K_TIME_QUANTUM | 176 | #undef ATH9K_TIME_QUANTUM |
181 | } | 177 | } |
182 | 178 | ||
183 | bool ath9k_hw_filltxdesc(struct ath_hal *ah, struct ath_desc *ds, | 179 | bool ath9k_hw_filltxdesc(struct ath_hw *ah, struct ath_desc *ds, |
184 | u32 segLen, bool firstSeg, | 180 | u32 segLen, bool firstSeg, |
185 | bool lastSeg, const struct ath_desc *ds0) | 181 | bool lastSeg, const struct ath_desc *ds0) |
186 | { | 182 | { |
@@ -208,7 +204,7 @@ bool ath9k_hw_filltxdesc(struct ath_hal *ah, struct ath_desc *ds, | |||
208 | return true; | 204 | return true; |
209 | } | 205 | } |
210 | 206 | ||
211 | void ath9k_hw_cleartxdesc(struct ath_hal *ah, struct ath_desc *ds) | 207 | void ath9k_hw_cleartxdesc(struct ath_hw *ah, struct ath_desc *ds) |
212 | { | 208 | { |
213 | struct ar5416_desc *ads = AR5416DESC(ds); | 209 | struct ar5416_desc *ads = AR5416DESC(ds); |
214 | 210 | ||
@@ -219,7 +215,7 @@ void ath9k_hw_cleartxdesc(struct ath_hal *ah, struct ath_desc *ds) | |||
219 | ads->ds_txstatus8 = ads->ds_txstatus9 = 0; | 215 | ads->ds_txstatus8 = ads->ds_txstatus9 = 0; |
220 | } | 216 | } |
221 | 217 | ||
222 | int ath9k_hw_txprocdesc(struct ath_hal *ah, struct ath_desc *ds) | 218 | int ath9k_hw_txprocdesc(struct ath_hw *ah, struct ath_desc *ds) |
223 | { | 219 | { |
224 | struct ar5416_desc *ads = AR5416DESC(ds); | 220 | struct ar5416_desc *ads = AR5416DESC(ds); |
225 | 221 | ||
@@ -294,14 +290,13 @@ int ath9k_hw_txprocdesc(struct ath_hal *ah, struct ath_desc *ds) | |||
294 | return 0; | 290 | return 0; |
295 | } | 291 | } |
296 | 292 | ||
297 | void ath9k_hw_set11n_txdesc(struct ath_hal *ah, struct ath_desc *ds, | 293 | void ath9k_hw_set11n_txdesc(struct ath_hw *ah, struct ath_desc *ds, |
298 | u32 pktLen, enum ath9k_pkt_type type, u32 txPower, | 294 | u32 pktLen, enum ath9k_pkt_type type, u32 txPower, |
299 | u32 keyIx, enum ath9k_key_type keyType, u32 flags) | 295 | u32 keyIx, enum ath9k_key_type keyType, u32 flags) |
300 | { | 296 | { |
301 | struct ar5416_desc *ads = AR5416DESC(ds); | 297 | struct ar5416_desc *ads = AR5416DESC(ds); |
302 | struct ath_hal_5416 *ahp = AH5416(ah); | ||
303 | 298 | ||
304 | txPower += ahp->ah_txPowerIndexOffset; | 299 | txPower += ah->ah_txPowerIndexOffset; |
305 | if (txPower > 63) | 300 | if (txPower > 63) |
306 | txPower = 63; | 301 | txPower = 63; |
307 | 302 | ||
@@ -330,7 +325,7 @@ void ath9k_hw_set11n_txdesc(struct ath_hal *ah, struct ath_desc *ds, | |||
330 | } | 325 | } |
331 | } | 326 | } |
332 | 327 | ||
333 | void ath9k_hw_set11n_ratescenario(struct ath_hal *ah, struct ath_desc *ds, | 328 | void ath9k_hw_set11n_ratescenario(struct ath_hw *ah, struct ath_desc *ds, |
334 | struct ath_desc *lastds, | 329 | struct ath_desc *lastds, |
335 | u32 durUpdateEn, u32 rtsctsRate, | 330 | u32 durUpdateEn, u32 rtsctsRate, |
336 | u32 rtsctsDuration, | 331 | u32 rtsctsDuration, |
@@ -385,7 +380,7 @@ void ath9k_hw_set11n_ratescenario(struct ath_hal *ah, struct ath_desc *ds, | |||
385 | last_ads->ds_ctl3 = ads->ds_ctl3; | 380 | last_ads->ds_ctl3 = ads->ds_ctl3; |
386 | } | 381 | } |
387 | 382 | ||
388 | void ath9k_hw_set11n_aggr_first(struct ath_hal *ah, struct ath_desc *ds, | 383 | void ath9k_hw_set11n_aggr_first(struct ath_hw *ah, struct ath_desc *ds, |
389 | u32 aggrLen) | 384 | u32 aggrLen) |
390 | { | 385 | { |
391 | struct ar5416_desc *ads = AR5416DESC(ds); | 386 | struct ar5416_desc *ads = AR5416DESC(ds); |
@@ -395,7 +390,7 @@ void ath9k_hw_set11n_aggr_first(struct ath_hal *ah, struct ath_desc *ds, | |||
395 | ads->ds_ctl6 |= SM(aggrLen, AR_AggrLen); | 390 | ads->ds_ctl6 |= SM(aggrLen, AR_AggrLen); |
396 | } | 391 | } |
397 | 392 | ||
398 | void ath9k_hw_set11n_aggr_middle(struct ath_hal *ah, struct ath_desc *ds, | 393 | void ath9k_hw_set11n_aggr_middle(struct ath_hw *ah, struct ath_desc *ds, |
399 | u32 numDelims) | 394 | u32 numDelims) |
400 | { | 395 | { |
401 | struct ar5416_desc *ads = AR5416DESC(ds); | 396 | struct ar5416_desc *ads = AR5416DESC(ds); |
@@ -409,7 +404,7 @@ void ath9k_hw_set11n_aggr_middle(struct ath_hal *ah, struct ath_desc *ds, | |||
409 | ads->ds_ctl6 = ctl6; | 404 | ads->ds_ctl6 = ctl6; |
410 | } | 405 | } |
411 | 406 | ||
412 | void ath9k_hw_set11n_aggr_last(struct ath_hal *ah, struct ath_desc *ds) | 407 | void ath9k_hw_set11n_aggr_last(struct ath_hw *ah, struct ath_desc *ds) |
413 | { | 408 | { |
414 | struct ar5416_desc *ads = AR5416DESC(ds); | 409 | struct ar5416_desc *ads = AR5416DESC(ds); |
415 | 410 | ||
@@ -418,14 +413,14 @@ void ath9k_hw_set11n_aggr_last(struct ath_hal *ah, struct ath_desc *ds) | |||
418 | ads->ds_ctl6 &= ~AR_PadDelim; | 413 | ads->ds_ctl6 &= ~AR_PadDelim; |
419 | } | 414 | } |
420 | 415 | ||
421 | void ath9k_hw_clr11n_aggr(struct ath_hal *ah, struct ath_desc *ds) | 416 | void ath9k_hw_clr11n_aggr(struct ath_hw *ah, struct ath_desc *ds) |
422 | { | 417 | { |
423 | struct ar5416_desc *ads = AR5416DESC(ds); | 418 | struct ar5416_desc *ads = AR5416DESC(ds); |
424 | 419 | ||
425 | ads->ds_ctl1 &= (~AR_IsAggr & ~AR_MoreAggr); | 420 | ads->ds_ctl1 &= (~AR_IsAggr & ~AR_MoreAggr); |
426 | } | 421 | } |
427 | 422 | ||
428 | void ath9k_hw_set11n_burstduration(struct ath_hal *ah, struct ath_desc *ds, | 423 | void ath9k_hw_set11n_burstduration(struct ath_hw *ah, struct ath_desc *ds, |
429 | u32 burstDuration) | 424 | u32 burstDuration) |
430 | { | 425 | { |
431 | struct ar5416_desc *ads = AR5416DESC(ds); | 426 | struct ar5416_desc *ads = AR5416DESC(ds); |
@@ -434,7 +429,7 @@ void ath9k_hw_set11n_burstduration(struct ath_hal *ah, struct ath_desc *ds, | |||
434 | ads->ds_ctl2 |= SM(burstDuration, AR_BurstDur); | 429 | ads->ds_ctl2 |= SM(burstDuration, AR_BurstDur); |
435 | } | 430 | } |
436 | 431 | ||
437 | void ath9k_hw_set11n_virtualmorefrag(struct ath_hal *ah, struct ath_desc *ds, | 432 | void ath9k_hw_set11n_virtualmorefrag(struct ath_hw *ah, struct ath_desc *ds, |
438 | u32 vmf) | 433 | u32 vmf) |
439 | { | 434 | { |
440 | struct ar5416_desc *ads = AR5416DESC(ds); | 435 | struct ar5416_desc *ads = AR5416DESC(ds); |
@@ -445,19 +440,16 @@ void ath9k_hw_set11n_virtualmorefrag(struct ath_hal *ah, struct ath_desc *ds, | |||
445 | ads->ds_ctl0 &= ~AR_VirtMoreFrag; | 440 | ads->ds_ctl0 &= ~AR_VirtMoreFrag; |
446 | } | 441 | } |
447 | 442 | ||
448 | void ath9k_hw_gettxintrtxqs(struct ath_hal *ah, u32 *txqs) | 443 | void ath9k_hw_gettxintrtxqs(struct ath_hw *ah, u32 *txqs) |
449 | { | 444 | { |
450 | struct ath_hal_5416 *ahp = AH5416(ah); | 445 | *txqs &= ah->ah_intrTxqs; |
451 | 446 | ah->ah_intrTxqs &= ~(*txqs); | |
452 | *txqs &= ahp->ah_intrTxqs; | ||
453 | ahp->ah_intrTxqs &= ~(*txqs); | ||
454 | } | 447 | } |
455 | 448 | ||
456 | bool ath9k_hw_set_txq_props(struct ath_hal *ah, int q, | 449 | bool ath9k_hw_set_txq_props(struct ath_hw *ah, int q, |
457 | const struct ath9k_tx_queue_info *qinfo) | 450 | const struct ath9k_tx_queue_info *qinfo) |
458 | { | 451 | { |
459 | u32 cw; | 452 | u32 cw; |
460 | struct ath_hal_5416 *ahp = AH5416(ah); | ||
461 | struct ath9k_hw_capabilities *pCap = &ah->ah_caps; | 453 | struct ath9k_hw_capabilities *pCap = &ah->ah_caps; |
462 | struct ath9k_tx_queue_info *qi; | 454 | struct ath9k_tx_queue_info *qi; |
463 | 455 | ||
@@ -466,7 +458,7 @@ bool ath9k_hw_set_txq_props(struct ath_hal *ah, int q, | |||
466 | return false; | 458 | return false; |
467 | } | 459 | } |
468 | 460 | ||
469 | qi = &ahp->ah_txq[q]; | 461 | qi = &ah->ah_txq[q]; |
470 | if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) { | 462 | if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) { |
471 | DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "inactive queue\n"); | 463 | DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "inactive queue\n"); |
472 | return false; | 464 | return false; |
@@ -522,10 +514,9 @@ bool ath9k_hw_set_txq_props(struct ath_hal *ah, int q, | |||
522 | return true; | 514 | return true; |
523 | } | 515 | } |
524 | 516 | ||
525 | bool ath9k_hw_get_txq_props(struct ath_hal *ah, int q, | 517 | bool ath9k_hw_get_txq_props(struct ath_hw *ah, int q, |
526 | struct ath9k_tx_queue_info *qinfo) | 518 | struct ath9k_tx_queue_info *qinfo) |
527 | { | 519 | { |
528 | struct ath_hal_5416 *ahp = AH5416(ah); | ||
529 | struct ath9k_hw_capabilities *pCap = &ah->ah_caps; | 520 | struct ath9k_hw_capabilities *pCap = &ah->ah_caps; |
530 | struct ath9k_tx_queue_info *qi; | 521 | struct ath9k_tx_queue_info *qi; |
531 | 522 | ||
@@ -534,7 +525,7 @@ bool ath9k_hw_get_txq_props(struct ath_hal *ah, int q, | |||
534 | return false; | 525 | return false; |
535 | } | 526 | } |
536 | 527 | ||
537 | qi = &ahp->ah_txq[q]; | 528 | qi = &ah->ah_txq[q]; |
538 | if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) { | 529 | if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) { |
539 | DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "inactive queue\n"); | 530 | DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "inactive queue\n"); |
540 | return false; | 531 | return false; |
@@ -558,10 +549,9 @@ bool ath9k_hw_get_txq_props(struct ath_hal *ah, int q, | |||
558 | return true; | 549 | return true; |
559 | } | 550 | } |
560 | 551 | ||
561 | int ath9k_hw_setuptxqueue(struct ath_hal *ah, enum ath9k_tx_queue type, | 552 | int ath9k_hw_setuptxqueue(struct ath_hw *ah, enum ath9k_tx_queue type, |
562 | const struct ath9k_tx_queue_info *qinfo) | 553 | const struct ath9k_tx_queue_info *qinfo) |
563 | { | 554 | { |
564 | struct ath_hal_5416 *ahp = AH5416(ah); | ||
565 | struct ath9k_tx_queue_info *qi; | 555 | struct ath9k_tx_queue_info *qi; |
566 | struct ath9k_hw_capabilities *pCap = &ah->ah_caps; | 556 | struct ath9k_hw_capabilities *pCap = &ah->ah_caps; |
567 | int q; | 557 | int q; |
@@ -581,7 +571,7 @@ int ath9k_hw_setuptxqueue(struct ath_hal *ah, enum ath9k_tx_queue type, | |||
581 | break; | 571 | break; |
582 | case ATH9K_TX_QUEUE_DATA: | 572 | case ATH9K_TX_QUEUE_DATA: |
583 | for (q = 0; q < pCap->total_queues; q++) | 573 | for (q = 0; q < pCap->total_queues; q++) |
584 | if (ahp->ah_txq[q].tqi_type == | 574 | if (ah->ah_txq[q].tqi_type == |
585 | ATH9K_TX_QUEUE_INACTIVE) | 575 | ATH9K_TX_QUEUE_INACTIVE) |
586 | break; | 576 | break; |
587 | if (q == pCap->total_queues) { | 577 | if (q == pCap->total_queues) { |
@@ -597,7 +587,7 @@ int ath9k_hw_setuptxqueue(struct ath_hal *ah, enum ath9k_tx_queue type, | |||
597 | 587 | ||
598 | DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "queue %u\n", q); | 588 | DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "queue %u\n", q); |
599 | 589 | ||
600 | qi = &ahp->ah_txq[q]; | 590 | qi = &ah->ah_txq[q]; |
601 | if (qi->tqi_type != ATH9K_TX_QUEUE_INACTIVE) { | 591 | if (qi->tqi_type != ATH9K_TX_QUEUE_INACTIVE) { |
602 | DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, | 592 | DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, |
603 | "tx queue %u already active\n", q); | 593 | "tx queue %u already active\n", q); |
@@ -624,9 +614,8 @@ int ath9k_hw_setuptxqueue(struct ath_hal *ah, enum ath9k_tx_queue type, | |||
624 | return q; | 614 | return q; |
625 | } | 615 | } |
626 | 616 | ||
627 | bool ath9k_hw_releasetxqueue(struct ath_hal *ah, u32 q) | 617 | bool ath9k_hw_releasetxqueue(struct ath_hw *ah, u32 q) |
628 | { | 618 | { |
629 | struct ath_hal_5416 *ahp = AH5416(ah); | ||
630 | struct ath9k_hw_capabilities *pCap = &ah->ah_caps; | 619 | struct ath9k_hw_capabilities *pCap = &ah->ah_caps; |
631 | struct ath9k_tx_queue_info *qi; | 620 | struct ath9k_tx_queue_info *qi; |
632 | 621 | ||
@@ -634,7 +623,7 @@ bool ath9k_hw_releasetxqueue(struct ath_hal *ah, u32 q) | |||
634 | DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "invalid queue num %u\n", q); | 623 | DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "invalid queue num %u\n", q); |
635 | return false; | 624 | return false; |
636 | } | 625 | } |
637 | qi = &ahp->ah_txq[q]; | 626 | qi = &ah->ah_txq[q]; |
638 | if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) { | 627 | if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) { |
639 | DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "inactive queue %u\n", q); | 628 | DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "inactive queue %u\n", q); |
640 | return false; | 629 | return false; |
@@ -643,19 +632,18 @@ bool ath9k_hw_releasetxqueue(struct ath_hal *ah, u32 q) | |||
643 | DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "release queue %u\n", q); | 632 | DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "release queue %u\n", q); |
644 | 633 | ||
645 | qi->tqi_type = ATH9K_TX_QUEUE_INACTIVE; | 634 | qi->tqi_type = ATH9K_TX_QUEUE_INACTIVE; |
646 | ahp->ah_txOkInterruptMask &= ~(1 << q); | 635 | ah->ah_txOkInterruptMask &= ~(1 << q); |
647 | ahp->ah_txErrInterruptMask &= ~(1 << q); | 636 | ah->ah_txErrInterruptMask &= ~(1 << q); |
648 | ahp->ah_txDescInterruptMask &= ~(1 << q); | 637 | ah->ah_txDescInterruptMask &= ~(1 << q); |
649 | ahp->ah_txEolInterruptMask &= ~(1 << q); | 638 | ah->ah_txEolInterruptMask &= ~(1 << q); |
650 | ahp->ah_txUrnInterruptMask &= ~(1 << q); | 639 | ah->ah_txUrnInterruptMask &= ~(1 << q); |
651 | ath9k_hw_set_txq_interrupts(ah, qi); | 640 | ath9k_hw_set_txq_interrupts(ah, qi); |
652 | 641 | ||
653 | return true; | 642 | return true; |
654 | } | 643 | } |
655 | 644 | ||
656 | bool ath9k_hw_resettxqueue(struct ath_hal *ah, u32 q) | 645 | bool ath9k_hw_resettxqueue(struct ath_hw *ah, u32 q) |
657 | { | 646 | { |
658 | struct ath_hal_5416 *ahp = AH5416(ah); | ||
659 | struct ath9k_hw_capabilities *pCap = &ah->ah_caps; | 647 | struct ath9k_hw_capabilities *pCap = &ah->ah_caps; |
660 | struct ath9k_channel *chan = ah->ah_curchan; | 648 | struct ath9k_channel *chan = ah->ah_curchan; |
661 | struct ath9k_tx_queue_info *qi; | 649 | struct ath9k_tx_queue_info *qi; |
@@ -666,7 +654,7 @@ bool ath9k_hw_resettxqueue(struct ath_hal *ah, u32 q) | |||
666 | return false; | 654 | return false; |
667 | } | 655 | } |
668 | 656 | ||
669 | qi = &ahp->ah_txq[q]; | 657 | qi = &ah->ah_txq[q]; |
670 | if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) { | 658 | if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) { |
671 | DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "inactive queue %u\n", q); | 659 | DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "inactive queue %u\n", q); |
672 | return true; | 660 | return true; |
@@ -784,31 +772,31 @@ bool ath9k_hw_resettxqueue(struct ath_hal *ah, u32 q) | |||
784 | } | 772 | } |
785 | 773 | ||
786 | if (qi->tqi_qflags & TXQ_FLAG_TXOKINT_ENABLE) | 774 | if (qi->tqi_qflags & TXQ_FLAG_TXOKINT_ENABLE) |
787 | ahp->ah_txOkInterruptMask |= 1 << q; | 775 | ah->ah_txOkInterruptMask |= 1 << q; |
788 | else | 776 | else |
789 | ahp->ah_txOkInterruptMask &= ~(1 << q); | 777 | ah->ah_txOkInterruptMask &= ~(1 << q); |
790 | if (qi->tqi_qflags & TXQ_FLAG_TXERRINT_ENABLE) | 778 | if (qi->tqi_qflags & TXQ_FLAG_TXERRINT_ENABLE) |
791 | ahp->ah_txErrInterruptMask |= 1 << q; | 779 | ah->ah_txErrInterruptMask |= 1 << q; |
792 | else | 780 | else |
793 | ahp->ah_txErrInterruptMask &= ~(1 << q); | 781 | ah->ah_txErrInterruptMask &= ~(1 << q); |
794 | if (qi->tqi_qflags & TXQ_FLAG_TXDESCINT_ENABLE) | 782 | if (qi->tqi_qflags & TXQ_FLAG_TXDESCINT_ENABLE) |
795 | ahp->ah_txDescInterruptMask |= 1 << q; | 783 | ah->ah_txDescInterruptMask |= 1 << q; |
796 | else | 784 | else |
797 | ahp->ah_txDescInterruptMask &= ~(1 << q); | 785 | ah->ah_txDescInterruptMask &= ~(1 << q); |
798 | if (qi->tqi_qflags & TXQ_FLAG_TXEOLINT_ENABLE) | 786 | if (qi->tqi_qflags & TXQ_FLAG_TXEOLINT_ENABLE) |
799 | ahp->ah_txEolInterruptMask |= 1 << q; | 787 | ah->ah_txEolInterruptMask |= 1 << q; |
800 | else | 788 | else |
801 | ahp->ah_txEolInterruptMask &= ~(1 << q); | 789 | ah->ah_txEolInterruptMask &= ~(1 << q); |
802 | if (qi->tqi_qflags & TXQ_FLAG_TXURNINT_ENABLE) | 790 | if (qi->tqi_qflags & TXQ_FLAG_TXURNINT_ENABLE) |
803 | ahp->ah_txUrnInterruptMask |= 1 << q; | 791 | ah->ah_txUrnInterruptMask |= 1 << q; |
804 | else | 792 | else |
805 | ahp->ah_txUrnInterruptMask &= ~(1 << q); | 793 | ah->ah_txUrnInterruptMask &= ~(1 << q); |
806 | ath9k_hw_set_txq_interrupts(ah, qi); | 794 | ath9k_hw_set_txq_interrupts(ah, qi); |
807 | 795 | ||
808 | return true; | 796 | return true; |
809 | } | 797 | } |
810 | 798 | ||
811 | int ath9k_hw_rxprocdesc(struct ath_hal *ah, struct ath_desc *ds, | 799 | int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds, |
812 | u32 pa, struct ath_desc *nds, u64 tsf) | 800 | u32 pa, struct ath_desc *nds, u64 tsf) |
813 | { | 801 | { |
814 | struct ar5416_desc ads; | 802 | struct ar5416_desc ads; |
@@ -873,7 +861,7 @@ int ath9k_hw_rxprocdesc(struct ath_hal *ah, struct ath_desc *ds, | |||
873 | return 0; | 861 | return 0; |
874 | } | 862 | } |
875 | 863 | ||
876 | bool ath9k_hw_setuprxdesc(struct ath_hal *ah, struct ath_desc *ds, | 864 | bool ath9k_hw_setuprxdesc(struct ath_hw *ah, struct ath_desc *ds, |
877 | u32 size, u32 flags) | 865 | u32 size, u32 flags) |
878 | { | 866 | { |
879 | struct ar5416_desc *ads = AR5416DESC(ds); | 867 | struct ar5416_desc *ads = AR5416DESC(ds); |
@@ -890,7 +878,7 @@ bool ath9k_hw_setuprxdesc(struct ath_hal *ah, struct ath_desc *ds, | |||
890 | return true; | 878 | return true; |
891 | } | 879 | } |
892 | 880 | ||
893 | bool ath9k_hw_setrxabort(struct ath_hal *ah, bool set) | 881 | bool ath9k_hw_setrxabort(struct ath_hw *ah, bool set) |
894 | { | 882 | { |
895 | u32 reg; | 883 | u32 reg; |
896 | 884 | ||
@@ -917,17 +905,17 @@ bool ath9k_hw_setrxabort(struct ath_hal *ah, bool set) | |||
917 | return true; | 905 | return true; |
918 | } | 906 | } |
919 | 907 | ||
920 | void ath9k_hw_putrxbuf(struct ath_hal *ah, u32 rxdp) | 908 | void ath9k_hw_putrxbuf(struct ath_hw *ah, u32 rxdp) |
921 | { | 909 | { |
922 | REG_WRITE(ah, AR_RXDP, rxdp); | 910 | REG_WRITE(ah, AR_RXDP, rxdp); |
923 | } | 911 | } |
924 | 912 | ||
925 | void ath9k_hw_rxena(struct ath_hal *ah) | 913 | void ath9k_hw_rxena(struct ath_hw *ah) |
926 | { | 914 | { |
927 | REG_WRITE(ah, AR_CR, AR_CR_RXE); | 915 | REG_WRITE(ah, AR_CR, AR_CR_RXE); |
928 | } | 916 | } |
929 | 917 | ||
930 | void ath9k_hw_startpcureceive(struct ath_hal *ah) | 918 | void ath9k_hw_startpcureceive(struct ath_hw *ah) |
931 | { | 919 | { |
932 | ath9k_enable_mib_counters(ah); | 920 | ath9k_enable_mib_counters(ah); |
933 | 921 | ||
@@ -936,14 +924,14 @@ void ath9k_hw_startpcureceive(struct ath_hal *ah) | |||
936 | REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); | 924 | REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); |
937 | } | 925 | } |
938 | 926 | ||
939 | void ath9k_hw_stoppcurecv(struct ath_hal *ah) | 927 | void ath9k_hw_stoppcurecv(struct ath_hw *ah) |
940 | { | 928 | { |
941 | REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_DIS); | 929 | REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_DIS); |
942 | 930 | ||
943 | ath9k_hw_disable_mib_counters(ah); | 931 | ath9k_hw_disable_mib_counters(ah); |
944 | } | 932 | } |
945 | 933 | ||
946 | bool ath9k_hw_stopdmarecv(struct ath_hal *ah) | 934 | bool ath9k_hw_stopdmarecv(struct ath_hw *ah) |
947 | { | 935 | { |
948 | REG_WRITE(ah, AR_CR, AR_CR_RXD); | 936 | REG_WRITE(ah, AR_CR, AR_CR_RXD); |
949 | 937 | ||