2 * Copyright (c) 2010-2011 Atheros Communications Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 #include <linux/export.h>
18 #include "ar9003_mac.h"
19 #include "ar9003_mci.h"
21 static void ar9003_hw_rx_enable(struct ath_hw
*hw
)
23 REG_WRITE(hw
, AR_CR
, 0);
27 ar9003_set_txdesc(struct ath_hw
*ah
, void *ds
, struct ath_tx_info
*i
)
29 struct ar9003_txc
*ads
= ds
;
31 u32 val
, ctl12
, ctl17
;
34 desc_len
= ((AR_SREV_9462(ah
) || AR_SREV_9565(ah
)) ? 0x18 : 0x17);
36 val
= (ATHEROS_VENDOR_ID
<< AR_DescId_S
) |
37 (1 << AR_TxRxDesc_S
) |
38 (1 << AR_CtrlStat_S
) |
39 (i
->qcu
<< AR_TxQcuNum_S
) | desc_len
;
42 ACCESS_ONCE(ads
->info
) = val
;
45 ACCESS_ONCE(ads
->link
) = i
->link
;
47 checksum
+= i
->buf_addr
[0];
48 ACCESS_ONCE(ads
->data0
) = i
->buf_addr
[0];
49 checksum
+= i
->buf_addr
[1];
50 ACCESS_ONCE(ads
->data1
) = i
->buf_addr
[1];
51 checksum
+= i
->buf_addr
[2];
52 ACCESS_ONCE(ads
->data2
) = i
->buf_addr
[2];
53 checksum
+= i
->buf_addr
[3];
54 ACCESS_ONCE(ads
->data3
) = i
->buf_addr
[3];
56 checksum
+= (val
= (i
->buf_len
[0] << AR_BufLen_S
) & AR_BufLen
);
57 ACCESS_ONCE(ads
->ctl3
) = val
;
58 checksum
+= (val
= (i
->buf_len
[1] << AR_BufLen_S
) & AR_BufLen
);
59 ACCESS_ONCE(ads
->ctl5
) = val
;
60 checksum
+= (val
= (i
->buf_len
[2] << AR_BufLen_S
) & AR_BufLen
);
61 ACCESS_ONCE(ads
->ctl7
) = val
;
62 checksum
+= (val
= (i
->buf_len
[3] << AR_BufLen_S
) & AR_BufLen
);
63 ACCESS_ONCE(ads
->ctl9
) = val
;
65 checksum
= (u16
) (((checksum
& 0xffff) + (checksum
>> 16)) & 0xffff);
66 ACCESS_ONCE(ads
->ctl10
) = checksum
;
68 if (i
->is_first
|| i
->is_last
) {
69 ACCESS_ONCE(ads
->ctl13
) = set11nTries(i
->rates
, 0)
70 | set11nTries(i
->rates
, 1)
71 | set11nTries(i
->rates
, 2)
72 | set11nTries(i
->rates
, 3)
73 | (i
->dur_update
? AR_DurUpdateEna
: 0)
76 ACCESS_ONCE(ads
->ctl14
) = set11nRate(i
->rates
, 0)
77 | set11nRate(i
->rates
, 1)
78 | set11nRate(i
->rates
, 2)
79 | set11nRate(i
->rates
, 3);
81 ACCESS_ONCE(ads
->ctl13
) = 0;
82 ACCESS_ONCE(ads
->ctl14
) = 0;
90 ctl17
= SM(i
->keytype
, AR_EncrType
);
92 ACCESS_ONCE(ads
->ctl11
) = 0;
93 ACCESS_ONCE(ads
->ctl12
) = i
->is_last
? 0 : AR_TxMore
;
94 ACCESS_ONCE(ads
->ctl15
) = 0;
95 ACCESS_ONCE(ads
->ctl16
) = 0;
96 ACCESS_ONCE(ads
->ctl17
) = ctl17
;
97 ACCESS_ONCE(ads
->ctl18
) = 0;
98 ACCESS_ONCE(ads
->ctl19
) = 0;
102 ACCESS_ONCE(ads
->ctl11
) = (i
->pkt_len
& AR_FrameLen
)
103 | (i
->flags
& ATH9K_TXDESC_VMF
? AR_VirtMoreFrag
: 0)
104 | SM(i
->txpower
, AR_XmitPower
)
105 | (i
->flags
& ATH9K_TXDESC_VEOL
? AR_VEOL
: 0)
106 | (i
->keyix
!= ATH9K_TXKEYIX_INVALID
? AR_DestIdxValid
: 0)
107 | (i
->flags
& ATH9K_TXDESC_LOWRXCHAIN
? AR_LowRxChain
: 0)
108 | (i
->flags
& ATH9K_TXDESC_CLRDMASK
? AR_ClrDestMask
: 0)
109 | (i
->flags
& ATH9K_TXDESC_RTSENA
? AR_RTSEnable
:
110 (i
->flags
& ATH9K_TXDESC_CTSENA
? AR_CTSEnable
: 0));
112 ctl12
= (i
->keyix
!= ATH9K_TXKEYIX_INVALID
?
113 SM(i
->keyix
, AR_DestIdx
) : 0)
114 | SM(i
->type
, AR_FrameType
)
115 | (i
->flags
& ATH9K_TXDESC_NOACK
? AR_NoAck
: 0)
116 | (i
->flags
& ATH9K_TXDESC_EXT_ONLY
? AR_ExtOnly
: 0)
117 | (i
->flags
& ATH9K_TXDESC_EXT_AND_CTL
? AR_ExtAndCtl
: 0);
119 ctl17
|= (i
->flags
& ATH9K_TXDESC_LDPC
? AR_LDPC
: 0);
122 ctl17
|= SM(i
->aggr_len
, AR_AggrLen
);
124 case AGGR_BUF_MIDDLE
:
125 ctl12
|= AR_IsAggr
| AR_MoreAggr
;
126 ctl17
|= SM(i
->ndelim
, AR_PadDelim
);
135 val
= (i
->flags
& ATH9K_TXDESC_PAPRD
) >> ATH9K_TXDESC_PAPRD_S
;
136 ctl12
|= SM(val
, AR_PAPRDChainMask
);
138 ACCESS_ONCE(ads
->ctl12
) = ctl12
;
139 ACCESS_ONCE(ads
->ctl17
) = ctl17
;
141 ACCESS_ONCE(ads
->ctl15
) = set11nPktDurRTSCTS(i
->rates
, 0)
142 | set11nPktDurRTSCTS(i
->rates
, 1);
144 ACCESS_ONCE(ads
->ctl16
) = set11nPktDurRTSCTS(i
->rates
, 2)
145 | set11nPktDurRTSCTS(i
->rates
, 3);
147 ACCESS_ONCE(ads
->ctl18
) = set11nRateFlags(i
->rates
, 0)
148 | set11nRateFlags(i
->rates
, 1)
149 | set11nRateFlags(i
->rates
, 2)
150 | set11nRateFlags(i
->rates
, 3)
151 | SM(i
->rtscts_rate
, AR_RTSCTSRate
);
153 ACCESS_ONCE(ads
->ctl19
) = AR_Not_Sounding
;
156 static u16
ar9003_calc_ptr_chksum(struct ar9003_txc
*ads
)
160 checksum
= ads
->info
+ ads
->link
161 + ads
->data0
+ ads
->ctl3
162 + ads
->data1
+ ads
->ctl5
163 + ads
->data2
+ ads
->ctl7
164 + ads
->data3
+ ads
->ctl9
;
166 return ((checksum
& 0xffff) + (checksum
>> 16)) & AR_TxPtrChkSum
;
169 static void ar9003_hw_set_desc_link(void *ds
, u32 ds_link
)
171 struct ar9003_txc
*ads
= ds
;
174 ads
->ctl10
&= ~AR_TxPtrChkSum
;
175 ads
->ctl10
|= ar9003_calc_ptr_chksum(ads
);
178 static bool ar9003_hw_get_isr(struct ath_hw
*ah
, enum ath9k_int
*masked
,
183 struct ath9k_hw_capabilities
*pCap
= &ah
->caps
;
184 struct ath_common
*common
= ath9k_hw_common(ah
);
185 u32 sync_cause
= 0, async_cause
, async_mask
= AR_INTR_MAC_IRQ
;
188 if (ath9k_hw_mci_is_enabled(ah
))
189 async_mask
|= AR_INTR_ASYNC_MASK_MCI
;
191 async_cause
= REG_READ(ah
, AR_INTR_ASYNC_CAUSE
);
193 if (async_cause
& async_mask
) {
194 if ((REG_READ(ah
, AR_RTC_STATUS
) & AR_RTC_STATUS_M
)
196 isr
= REG_READ(ah
, AR_ISR
);
200 sync_cause
= REG_READ(ah
, AR_INTR_SYNC_CAUSE
) & AR_INTR_SYNC_DEFAULT
;
204 if (!isr
&& !sync_cause
&& !async_cause
)
208 if (isr
& AR_ISR_BCNMISC
) {
210 isr2
= REG_READ(ah
, AR_ISR_S2
);
212 mask2
|= ((isr2
& AR_ISR_S2_TIM
) >>
214 mask2
|= ((isr2
& AR_ISR_S2_DTIM
) >>
216 mask2
|= ((isr2
& AR_ISR_S2_DTIMSYNC
) >>
217 MAP_ISR_S2_DTIMSYNC
);
218 mask2
|= ((isr2
& AR_ISR_S2_CABEND
) >>
220 mask2
|= ((isr2
& AR_ISR_S2_GTT
) <<
222 mask2
|= ((isr2
& AR_ISR_S2_CST
) <<
224 mask2
|= ((isr2
& AR_ISR_S2_TSFOOR
) >>
226 mask2
|= ((isr2
& AR_ISR_S2_BB_WATCHDOG
) >>
227 MAP_ISR_S2_BB_WATCHDOG
);
229 if (!(pCap
->hw_caps
& ATH9K_HW_CAP_RAC_SUPPORTED
)) {
230 REG_WRITE(ah
, AR_ISR_S2
, isr2
);
231 isr
&= ~AR_ISR_BCNMISC
;
235 if ((pCap
->hw_caps
& ATH9K_HW_CAP_RAC_SUPPORTED
))
236 isr
= REG_READ(ah
, AR_ISR_RAC
);
238 if (isr
== 0xffffffff) {
243 *masked
= isr
& ATH9K_INT_COMMON
;
245 if (ah
->config
.rx_intr_mitigation
)
246 if (isr
& (AR_ISR_RXMINTR
| AR_ISR_RXINTM
))
247 *masked
|= ATH9K_INT_RXLP
;
249 if (ah
->config
.tx_intr_mitigation
)
250 if (isr
& (AR_ISR_TXMINTR
| AR_ISR_TXINTM
))
251 *masked
|= ATH9K_INT_TX
;
253 if (isr
& (AR_ISR_LP_RXOK
| AR_ISR_RXERR
))
254 *masked
|= ATH9K_INT_RXLP
;
256 if (isr
& AR_ISR_HP_RXOK
)
257 *masked
|= ATH9K_INT_RXHP
;
259 if (isr
& (AR_ISR_TXOK
| AR_ISR_TXERR
| AR_ISR_TXEOL
)) {
260 *masked
|= ATH9K_INT_TX
;
262 if (!(pCap
->hw_caps
& ATH9K_HW_CAP_RAC_SUPPORTED
)) {
264 s0
= REG_READ(ah
, AR_ISR_S0
);
265 REG_WRITE(ah
, AR_ISR_S0
, s0
);
266 s1
= REG_READ(ah
, AR_ISR_S1
);
267 REG_WRITE(ah
, AR_ISR_S1
, s1
);
269 isr
&= ~(AR_ISR_TXOK
| AR_ISR_TXERR
|
274 if (isr
& AR_ISR_GENTMR
) {
277 if (pCap
->hw_caps
& ATH9K_HW_CAP_RAC_SUPPORTED
)
278 s5
= REG_READ(ah
, AR_ISR_S5_S
);
280 s5
= REG_READ(ah
, AR_ISR_S5
);
282 ah
->intr_gen_timer_trigger
=
283 MS(s5
, AR_ISR_S5_GENTIMER_TRIG
);
285 ah
->intr_gen_timer_thresh
=
286 MS(s5
, AR_ISR_S5_GENTIMER_THRESH
);
288 if (ah
->intr_gen_timer_trigger
)
289 *masked
|= ATH9K_INT_GENTIMER
;
291 if (!(pCap
->hw_caps
& ATH9K_HW_CAP_RAC_SUPPORTED
)) {
292 REG_WRITE(ah
, AR_ISR_S5
, s5
);
293 isr
&= ~AR_ISR_GENTMR
;
300 if (!(pCap
->hw_caps
& ATH9K_HW_CAP_RAC_SUPPORTED
)) {
301 REG_WRITE(ah
, AR_ISR
, isr
);
303 (void) REG_READ(ah
, AR_ISR
);
306 if (*masked
& ATH9K_INT_BB_WATCHDOG
)
307 ar9003_hw_bb_watchdog_read(ah
);
310 if (async_cause
& AR_INTR_ASYNC_MASK_MCI
)
311 ar9003_mci_get_isr(ah
, masked
);
315 *sync_cause_p
= sync_cause
;
318 (AR_INTR_SYNC_HOST1_FATAL
| AR_INTR_SYNC_HOST1_PERR
))
322 if (sync_cause
& AR_INTR_SYNC_HOST1_FATAL
) {
324 "received PCI FATAL interrupt\n");
326 if (sync_cause
& AR_INTR_SYNC_HOST1_PERR
) {
328 "received PCI PERR interrupt\n");
330 *masked
|= ATH9K_INT_FATAL
;
333 if (sync_cause
& AR_INTR_SYNC_RADM_CPL_TIMEOUT
) {
334 REG_WRITE(ah
, AR_RC
, AR_RC_HOSTIF
);
335 REG_WRITE(ah
, AR_RC
, 0);
336 *masked
|= ATH9K_INT_FATAL
;
339 if (sync_cause
& AR_INTR_SYNC_LOCAL_TIMEOUT
)
340 ath_dbg(common
, INTERRUPT
,
341 "AR_INTR_SYNC_LOCAL_TIMEOUT\n");
343 REG_WRITE(ah
, AR_INTR_SYNC_CAUSE_CLR
, sync_cause
);
344 (void) REG_READ(ah
, AR_INTR_SYNC_CAUSE_CLR
);
350 static int ar9003_hw_proc_txdesc(struct ath_hw
*ah
, void *ds
,
351 struct ath_tx_status
*ts
)
353 struct ar9003_txs
*ads
;
356 ads
= &ah
->ts_ring
[ah
->ts_tail
];
358 status
= ACCESS_ONCE(ads
->status8
);
359 if ((status
& AR_TxDone
) == 0)
362 ah
->ts_tail
= (ah
->ts_tail
+ 1) % ah
->ts_size
;
364 if ((MS(ads
->ds_info
, AR_DescId
) != ATHEROS_VENDOR_ID
) ||
365 (MS(ads
->ds_info
, AR_TxRxDesc
) != 1)) {
366 ath_dbg(ath9k_hw_common(ah
), XMIT
,
367 "Tx Descriptor error %x\n", ads
->ds_info
);
368 memset(ads
, 0, sizeof(*ads
));
372 ts
->ts_rateindex
= MS(status
, AR_FinalTxIdx
);
373 ts
->ts_seqnum
= MS(status
, AR_SeqNum
);
374 ts
->tid
= MS(status
, AR_TxTid
);
376 ts
->qid
= MS(ads
->ds_info
, AR_TxQcuNum
);
377 ts
->desc_id
= MS(ads
->status1
, AR_TxDescId
);
378 ts
->ts_tstamp
= ads
->status4
;
382 if (status
& AR_TxOpExceeded
)
383 ts
->ts_status
|= ATH9K_TXERR_XTXOP
;
384 status
= ACCESS_ONCE(ads
->status2
);
385 ts
->ts_rssi_ctl0
= MS(status
, AR_TxRSSIAnt00
);
386 ts
->ts_rssi_ctl1
= MS(status
, AR_TxRSSIAnt01
);
387 ts
->ts_rssi_ctl2
= MS(status
, AR_TxRSSIAnt02
);
388 if (status
& AR_TxBaStatus
) {
389 ts
->ts_flags
|= ATH9K_TX_BA
;
390 ts
->ba_low
= ads
->status5
;
391 ts
->ba_high
= ads
->status6
;
394 status
= ACCESS_ONCE(ads
->status3
);
395 if (status
& AR_ExcessiveRetries
)
396 ts
->ts_status
|= ATH9K_TXERR_XRETRY
;
397 if (status
& AR_Filtered
)
398 ts
->ts_status
|= ATH9K_TXERR_FILT
;
399 if (status
& AR_FIFOUnderrun
) {
400 ts
->ts_status
|= ATH9K_TXERR_FIFO
;
401 ath9k_hw_updatetxtriglevel(ah
, true);
403 if (status
& AR_TxTimerExpired
)
404 ts
->ts_status
|= ATH9K_TXERR_TIMER_EXPIRED
;
405 if (status
& AR_DescCfgErr
)
406 ts
->ts_flags
|= ATH9K_TX_DESC_CFG_ERR
;
407 if (status
& AR_TxDataUnderrun
) {
408 ts
->ts_flags
|= ATH9K_TX_DATA_UNDERRUN
;
409 ath9k_hw_updatetxtriglevel(ah
, true);
411 if (status
& AR_TxDelimUnderrun
) {
412 ts
->ts_flags
|= ATH9K_TX_DELIM_UNDERRUN
;
413 ath9k_hw_updatetxtriglevel(ah
, true);
415 ts
->ts_shortretry
= MS(status
, AR_RTSFailCnt
);
416 ts
->ts_longretry
= MS(status
, AR_DataFailCnt
);
417 ts
->ts_virtcol
= MS(status
, AR_VirtRetryCnt
);
419 status
= ACCESS_ONCE(ads
->status7
);
420 ts
->ts_rssi
= MS(status
, AR_TxRSSICombined
);
421 ts
->ts_rssi_ext0
= MS(status
, AR_TxRSSIAnt10
);
422 ts
->ts_rssi_ext1
= MS(status
, AR_TxRSSIAnt11
);
423 ts
->ts_rssi_ext2
= MS(status
, AR_TxRSSIAnt12
);
425 memset(ads
, 0, sizeof(*ads
));
430 void ar9003_hw_attach_mac_ops(struct ath_hw
*hw
)
432 struct ath_hw_ops
*ops
= ath9k_hw_ops(hw
);
434 ops
->rx_enable
= ar9003_hw_rx_enable
;
435 ops
->set_desc_link
= ar9003_hw_set_desc_link
;
436 ops
->get_isr
= ar9003_hw_get_isr
;
437 ops
->set_txdesc
= ar9003_set_txdesc
;
438 ops
->proc_txdesc
= ar9003_hw_proc_txdesc
;
441 void ath9k_hw_set_rx_bufsize(struct ath_hw
*ah
, u16 buf_size
)
443 REG_WRITE(ah
, AR_DATABUF_SIZE
, buf_size
& AR_DATABUF_SIZE_MASK
);
445 EXPORT_SYMBOL(ath9k_hw_set_rx_bufsize
);
447 void ath9k_hw_addrxbuf_edma(struct ath_hw
*ah
, u32 rxdp
,
448 enum ath9k_rx_qtype qtype
)
450 if (qtype
== ATH9K_RX_QUEUE_HP
)
451 REG_WRITE(ah
, AR_HP_RXDP
, rxdp
);
453 REG_WRITE(ah
, AR_LP_RXDP
, rxdp
);
455 EXPORT_SYMBOL(ath9k_hw_addrxbuf_edma
);
457 int ath9k_hw_process_rxdesc_edma(struct ath_hw
*ah
, struct ath_rx_status
*rxs
,
460 struct ar9003_rxs
*rxsp
= (struct ar9003_rxs
*) buf_addr
;
463 if ((rxsp
->status11
& AR_RxDone
) == 0)
466 if (MS(rxsp
->ds_info
, AR_DescId
) != 0x168c)
469 if ((rxsp
->ds_info
& (AR_TxRxDesc
| AR_CtrlStat
)) != 0)
476 rxs
->rs_datalen
= rxsp
->status2
& AR_DataLen
;
477 rxs
->rs_tstamp
= rxsp
->status3
;
480 rxs
->rs_rssi
= MS(rxsp
->status5
, AR_RxRSSICombined
);
481 rxs
->rs_rssi_ctl
[0] = MS(rxsp
->status1
, AR_RxRSSIAnt00
);
482 rxs
->rs_rssi_ctl
[1] = MS(rxsp
->status1
, AR_RxRSSIAnt01
);
483 rxs
->rs_rssi_ctl
[2] = MS(rxsp
->status1
, AR_RxRSSIAnt02
);
484 rxs
->rs_rssi_ext
[0] = MS(rxsp
->status5
, AR_RxRSSIAnt10
);
485 rxs
->rs_rssi_ext
[1] = MS(rxsp
->status5
, AR_RxRSSIAnt11
);
486 rxs
->rs_rssi_ext
[2] = MS(rxsp
->status5
, AR_RxRSSIAnt12
);
488 if (rxsp
->status11
& AR_RxKeyIdxValid
)
489 rxs
->rs_keyix
= MS(rxsp
->status11
, AR_KeyIdx
);
491 rxs
->rs_keyix
= ATH9K_RXKEYIX_INVALID
;
493 rxs
->rs_rate
= MS(rxsp
->status1
, AR_RxRate
);
494 rxs
->rs_more
= (rxsp
->status2
& AR_RxMore
) ? 1 : 0;
496 rxs
->rs_firstaggr
= (rxsp
->status11
& AR_RxFirstAggr
) ? 1 : 0;
497 rxs
->rs_isaggr
= (rxsp
->status11
& AR_RxAggr
) ? 1 : 0;
498 rxs
->rs_moreaggr
= (rxsp
->status11
& AR_RxMoreAggr
) ? 1 : 0;
499 rxs
->rs_antenna
= (MS(rxsp
->status4
, AR_RxAntenna
) & 0x7);
500 rxs
->flag
|= (rxsp
->status4
& AR_GI
) ? RX_FLAG_SHORT_GI
: 0;
501 rxs
->flag
|= (rxsp
->status4
& AR_2040
) ? RX_FLAG_40MHZ
: 0;
503 rxs
->evm0
= rxsp
->status6
;
504 rxs
->evm1
= rxsp
->status7
;
505 rxs
->evm2
= rxsp
->status8
;
506 rxs
->evm3
= rxsp
->status9
;
507 rxs
->evm4
= (rxsp
->status10
& 0xffff);
509 if (rxsp
->status11
& AR_PreDelimCRCErr
)
510 rxs
->rs_flags
|= ATH9K_RX_DELIM_CRC_PRE
;
512 if (rxsp
->status11
& AR_PostDelimCRCErr
)
513 rxs
->rs_flags
|= ATH9K_RX_DELIM_CRC_POST
;
515 if (rxsp
->status11
& AR_DecryptBusyErr
)
516 rxs
->rs_flags
|= ATH9K_RX_DECRYPT_BUSY
;
518 if ((rxsp
->status11
& AR_RxFrameOK
) == 0) {
520 * AR_CRCErr will bet set to true if we're on the last
521 * subframe and the AR_PostDelimCRCErr is caught.
522 * In a way this also gives us a guarantee that when
523 * (!(AR_CRCErr) && (AR_PostDelimCRCErr)) we cannot
524 * possibly be reviewing the last subframe. AR_CRCErr
525 * is the CRC of the actual data.
527 if (rxsp
->status11
& AR_CRCErr
)
528 rxs
->rs_status
|= ATH9K_RXERR_CRC
;
529 else if (rxsp
->status11
& AR_DecryptCRCErr
)
530 rxs
->rs_status
|= ATH9K_RXERR_DECRYPT
;
531 else if (rxsp
->status11
& AR_MichaelErr
)
532 rxs
->rs_status
|= ATH9K_RXERR_MIC
;
533 if (rxsp
->status11
& AR_PHYErr
) {
534 phyerr
= MS(rxsp
->status11
, AR_PHYErrCode
);
536 * If we reach a point here where AR_PostDelimCRCErr is
537 * true it implies we're *not* on the last subframe. In
538 * in that case that we know already that the CRC of
539 * the frame was OK, and MAC would send an ACK for that
540 * subframe, even if we did get a phy error of type
541 * ATH9K_PHYERR_OFDM_RESTART. This is only applicable
542 * to frame that are prior to the last subframe.
543 * The AR_PostDelimCRCErr is the CRC for the MPDU
544 * delimiter, which contains the 4 reserved bits,
545 * the MPDU length (12 bits), and follows the MPDU
546 * delimiter for an A-MPDU subframe (0x4E = 'N' ASCII).
548 if ((phyerr
== ATH9K_PHYERR_OFDM_RESTART
) &&
549 (rxsp
->status11
& AR_PostDelimCRCErr
)) {
552 rxs
->rs_status
|= ATH9K_RXERR_PHY
;
553 rxs
->rs_phyerr
= phyerr
;
558 if (rxsp
->status11
& AR_KeyMiss
)
559 rxs
->rs_status
|= ATH9K_RXERR_KEYMISS
;
563 EXPORT_SYMBOL(ath9k_hw_process_rxdesc_edma
);
565 void ath9k_hw_reset_txstatus_ring(struct ath_hw
*ah
)
569 memset((void *) ah
->ts_ring
, 0,
570 ah
->ts_size
* sizeof(struct ar9003_txs
));
572 ath_dbg(ath9k_hw_common(ah
), XMIT
,
573 "TS Start 0x%x End 0x%x Virt %p, Size %d\n",
574 ah
->ts_paddr_start
, ah
->ts_paddr_end
,
575 ah
->ts_ring
, ah
->ts_size
);
577 REG_WRITE(ah
, AR_Q_STATUS_RING_START
, ah
->ts_paddr_start
);
578 REG_WRITE(ah
, AR_Q_STATUS_RING_END
, ah
->ts_paddr_end
);
581 void ath9k_hw_setup_statusring(struct ath_hw
*ah
, void *ts_start
,
586 ah
->ts_paddr_start
= ts_paddr_start
;
587 ah
->ts_paddr_end
= ts_paddr_start
+ (size
* sizeof(struct ar9003_txs
));
589 ah
->ts_ring
= (struct ar9003_txs
*) ts_start
;
591 ath9k_hw_reset_txstatus_ring(ah
);
593 EXPORT_SYMBOL(ath9k_hw_setup_statusring
);