iPXE
ath5k_dma.c File Reference
#include <unistd.h>
#include "ath5k.h"
#include "reg.h"
#include "base.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (MIT)
 FILE_SECBOOT (FORBIDDEN)
void ath5k_hw_start_rx_dma (struct ath5k_hw *ah)
 ath5k_hw_start_rx_dma - Start DMA receive
int ath5k_hw_stop_rx_dma (struct ath5k_hw *ah)
 ath5k_hw_stop_rx_dma - Stop DMA receive
u32 ath5k_hw_get_rxdp (struct ath5k_hw *ah)
 ath5k_hw_get_rxdp - Get RX Descriptor's address
void ath5k_hw_set_rxdp (struct ath5k_hw *ah, u32 phys_addr)
 ath5k_hw_set_rxdp - Set RX Descriptor's address
int ath5k_hw_start_tx_dma (struct ath5k_hw *ah, unsigned int queue)
 ath5k_hw_start_tx_dma - Start DMA transmit for a specific queue
int ath5k_hw_stop_tx_dma (struct ath5k_hw *ah, unsigned int queue)
 ath5k_hw_stop_tx_dma - Stop DMA transmit on a specific queue
u32 ath5k_hw_get_txdp (struct ath5k_hw *ah, unsigned int queue)
 ath5k_hw_get_txdp - Get TX Descriptor's address for a specific queue
int ath5k_hw_set_txdp (struct ath5k_hw *ah, unsigned int queue, u32 phys_addr)
 ath5k_hw_set_txdp - Set TX Descriptor's address for a specific queue
int ath5k_hw_update_tx_triglevel (struct ath5k_hw *ah, int increase)
 ath5k_hw_update_tx_triglevel - Update tx trigger level
int ath5k_hw_is_intr_pending (struct ath5k_hw *ah)
 ath5k_hw_is_intr_pending - Check if we have pending interrupts
int ath5k_hw_get_isr (struct ath5k_hw *ah, enum ath5k_int *interrupt_mask)
enum ath5k_int ath5k_hw_set_imr (struct ath5k_hw *ah, enum ath5k_int new_mask)
 ath5k_hw_set_imr - Set interrupt mask

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( MIT )

◆ FILE_SECBOOT()

FILE_SECBOOT ( FORBIDDEN )

◆ ath5k_hw_start_rx_dma()

void ath5k_hw_start_rx_dma ( struct ath5k_hw * ah)

ath5k_hw_start_rx_dma - Start DMA receive

@ah: The &struct ath5k_hw

Definition at line 55 of file ath5k_dma.c.

56{
59}
#define AR5K_CR
Definition reg.h:55
#define AR5K_CR_RXE
Definition reg.h:58
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition ath5k.h:1216
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition ath5k.h:1224
uint8_t ah
Definition registers.h:1

References ah, AR5K_CR, AR5K_CR_RXE, ath5k_hw_reg_read(), and ath5k_hw_reg_write().

Referenced by ath5k_rx_start().

◆ ath5k_hw_stop_rx_dma()

int ath5k_hw_stop_rx_dma ( struct ath5k_hw * ah)

ath5k_hw_stop_rx_dma - Stop DMA receive

@ah: The &struct ath5k_hw

Definition at line 66 of file ath5k_dma.c.

67{
68 unsigned int i;
69
71
72 /*
73 * It may take some time to disable the DMA receive unit
74 */
75 for (i = 1000; i > 0 &&
77 i--)
78 udelay(10);
79
80 return i ? 0 : -EBUSY;
81}
#define AR5K_CR_RXD
Definition reg.h:61
#define EBUSY
Device or resource busy.
Definition errno.h:339
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition timer.c:61

References ah, AR5K_CR, AR5K_CR_RXD, AR5K_CR_RXE, ath5k_hw_reg_read(), ath5k_hw_reg_write(), EBUSY, and udelay().

Referenced by ath5k_rx_stop().

◆ ath5k_hw_get_rxdp()

u32 ath5k_hw_get_rxdp ( struct ath5k_hw * ah)

ath5k_hw_get_rxdp - Get RX Descriptor's address

@ah: The &struct ath5k_hw

XXX: Is RXDP read and clear ?

Definition at line 90 of file ath5k_dma.c.

91{
93}
#define AR5K_RXDP
Definition reg.h:67

References ah, AR5K_RXDP, ath5k_hw_reg_read(), and u32.

◆ ath5k_hw_set_rxdp()

void ath5k_hw_set_rxdp ( struct ath5k_hw * ah,
u32 phys_addr )

ath5k_hw_set_rxdp - Set RX Descriptor's address

@ah: The &struct ath5k_hw @phys_addr: RX descriptor address

XXX: Should we check if rx is enabled before setting rxdp ?

Definition at line 103 of file ath5k_dma.c.

104{
105 ath5k_hw_reg_write(ah, phys_addr, AR5K_RXDP);
106}

References ah, AR5K_RXDP, ath5k_hw_reg_write(), and u32.

Referenced by ath5k_rx_start().

◆ ath5k_hw_start_tx_dma()

int ath5k_hw_start_tx_dma ( struct ath5k_hw * ah,
unsigned int queue )

ath5k_hw_start_tx_dma - Start DMA transmit for a specific queue

@ah: The &struct ath5k_hw @queue: The hw queue number

Start DMA transmit for a specific queue and since 5210 doesn't have QCU/DCU, set up queue parameters for 5210 here based on queue type (one queue for normal data and one queue for beacons). For queue setup on newer chips check out qcu.c. Returns -EINVAL if queue number is out of range or if queue is already disabled.

NOTE: Must be called after setting up tx control descriptor for that queue (see below).

Definition at line 128 of file ath5k_dma.c.

129{
130 u32 tx_queue;
131
132 /* Return if queue is declared inactive */
133 if (ah->ah_txq.tqi_type == AR5K_TX_QUEUE_INACTIVE)
134 return -EIO;
135
136 if (ah->ah_version == AR5K_AR5210) {
137 tx_queue = ath5k_hw_reg_read(ah, AR5K_CR);
138
139 /* Assume always a data queue */
140 tx_queue |= AR5K_CR_TXE0 & ~AR5K_CR_TXD0;
141
142 /* Start queue */
143 ath5k_hw_reg_write(ah, tx_queue, AR5K_CR);
145 } else {
146 /* Return if queue is disabled */
148 return -EIO;
149
150 /* Start queue */
152 }
153
154 return 0;
155}
#define AR5K_QCU_TXD
Definition reg.h:566
#define AR5K_CR_TXD0
Definition reg.h:59
#define AR5K_QCU_TXE
Definition reg.h:559
#define AR5K_CR_TXE0
Definition reg.h:56
#define AR5K_REG_WRITE_Q(ah, _reg, _queue)
Definition ath5k.h:123
@ AR5K_TX_QUEUE_INACTIVE
Definition ath5k.h:447
@ AR5K_AR5210
Definition ath5k.h:256
#define AR5K_REG_READ_Q(ah, _reg, _queue)
Definition ath5k.h:120
uint16_t queue
Queue ID.
Definition ena.h:11
#define EIO
Input/output error.
Definition errno.h:434
#define u32
Definition vga.h:21

References ah, AR5K_AR5210, AR5K_CR, AR5K_CR_TXD0, AR5K_CR_TXE0, AR5K_QCU_TXD, AR5K_QCU_TXE, AR5K_REG_READ_Q, AR5K_REG_WRITE_Q, AR5K_TX_QUEUE_INACTIVE, ath5k_hw_reg_read(), ath5k_hw_reg_write(), EIO, queue, and u32.

Referenced by ath5k_txbuf_setup().

◆ ath5k_hw_stop_tx_dma()

int ath5k_hw_stop_tx_dma ( struct ath5k_hw * ah,
unsigned int queue )

ath5k_hw_stop_tx_dma - Stop DMA transmit on a specific queue

@ah: The &struct ath5k_hw @queue: The hw queue number

Stop DMA transmit on a specific hw queue and drain queue so we don't have any pending frames. Returns -EBUSY if we still have pending frames, -EINVAL if queue number is out of range.

Definition at line 168 of file ath5k_dma.c.

169{
170 unsigned int i = 40;
171 u32 tx_queue, pending;
172
173 /* Return if queue is declared inactive */
174 if (ah->ah_txq.tqi_type == AR5K_TX_QUEUE_INACTIVE)
175 return -EIO;
176
177 if (ah->ah_version == AR5K_AR5210) {
178 tx_queue = ath5k_hw_reg_read(ah, AR5K_CR);
179
180 /* Assume a data queue */
181 tx_queue |= AR5K_CR_TXD0 & ~AR5K_CR_TXE0;
182
183 /* Stop queue */
184 ath5k_hw_reg_write(ah, tx_queue, AR5K_CR);
186 } else {
187 /*
188 * Schedule TX disable and wait until queue is empty
189 */
191
192 /*Check for pending frames*/
193 do {
197 udelay(100);
198 } while (--i && pending);
199
200 /* For 2413+ order PCU to drop packets using
201 * QUIET mechanism */
202 if (ah->ah_mac_version >= (AR5K_SREV_AR2414 >> 4) && pending) {
203 /* Set periodicity and duration */
208
209 /* Enable quiet period for current TSF */
213 AR5K_TSF_L32_5211) >> 10,
216
217 /* Force channel idle high */
220
221 /* Wait a while and disable mechanism */
222 udelay(200);
225
226 /* Re-check for pending frames */
227 i = 40;
228 do {
232 udelay(100);
233 } while (--i && pending);
234
237 }
238
239 /* Clear register */
241 if (pending)
242 return -EBUSY;
243 }
244
245 /* TODO: Check for success on 5210 else return error */
246 return 0;
247}
#define AR5K_QUIET_CTL2
Definition reg.h:1681
#define AR5K_QUEUE_STATUS(_q)
Definition reg.h:629
#define AR5K_TSF_L32_5211
Definition reg.h:1435
#define AR5K_QUIET_CTL1
Definition reg.h:1675
#define AR5K_DIAG_SW_CHANEL_IDLE_HIGH
Definition reg.h:1428
#define AR5K_DIAG_SW_5211
Definition reg.h:1386
#define AR5K_QUIET_CTL2_QT_PER
Definition reg.h:1682
#define AR5K_QUIET_CTL1_QT_EN
Definition reg.h:1678
#define AR5K_QUIET_CTL1_NEXT_QT_TSF
Definition reg.h:1676
#define AR5K_QUIET_CTL2_QT_DUR
Definition reg.h:1684
#define AR5K_QCU_STS_FRMPENDCNT
Definition reg.h:627
#define AR5K_SREV_AR2414
Definition ath5k.h:299
#define AR5K_REG_SM(_val, _flags)
Definition ath5k.h:86
#define AR5K_REG_ENABLE_BITS(ah, _reg, _flags)
Definition ath5k.h:106
#define AR5K_REG_DISABLE_BITS(ah, _reg, _flags)
Definition ath5k.h:109
uint32_t pending
Pending events.
Definition hyperv.h:1

References ah, AR5K_AR5210, AR5K_CR, AR5K_CR_TXD0, AR5K_CR_TXE0, AR5K_DIAG_SW_5211, AR5K_DIAG_SW_CHANEL_IDLE_HIGH, AR5K_QCU_STS_FRMPENDCNT, AR5K_QCU_TXD, AR5K_QUEUE_STATUS, AR5K_QUIET_CTL1, AR5K_QUIET_CTL1_NEXT_QT_TSF, AR5K_QUIET_CTL1_QT_EN, AR5K_QUIET_CTL2, AR5K_QUIET_CTL2_QT_DUR, AR5K_QUIET_CTL2_QT_PER, AR5K_REG_DISABLE_BITS, AR5K_REG_ENABLE_BITS, AR5K_REG_SM, AR5K_REG_WRITE_Q, AR5K_SREV_AR2414, AR5K_TSF_L32_5211, AR5K_TX_QUEUE_INACTIVE, ath5k_hw_reg_read(), ath5k_hw_reg_write(), EBUSY, EIO, pending, queue, u32, and udelay().

Referenced by ath5k_txq_cleanup().

◆ ath5k_hw_get_txdp()

u32 ath5k_hw_get_txdp ( struct ath5k_hw * ah,
unsigned int queue )

ath5k_hw_get_txdp - Get TX Descriptor's address for a specific queue

@ah: The &struct ath5k_hw @queue: The hw queue number

Get TX descriptor's address for a specific queue. For 5210 we ignore the queue number and use tx queue type since we only have 2 queues. We use TXDP0 for normal data queue and TXDP1 for beacon queue. For newer chips with QCU/DCU we just read the corresponding TXDP register.

XXX: Is TXDP read and clear ?

Definition at line 262 of file ath5k_dma.c.

263{
264 u16 tx_reg;
265
266 /*
267 * Get the transmit queue descriptor pointer from the selected queue
268 */
269 /*5210 doesn't have QCU*/
270 if (ah->ah_version == AR5K_AR5210) {
271 /* Assume a data queue */
272 tx_reg = AR5K_NOQCU_TXDP0;
273 } else {
274 tx_reg = AR5K_QUEUE_TXDP(queue);
275 }
276
277 return ath5k_hw_reg_read(ah, tx_reg);
278}
#define AR5K_NOQCU_TXDP0
Definition reg.h:49
#define AR5K_QUEUE_TXDP(_q)
Definition reg.h:554
#define u16
Definition vga.h:20

References ah, AR5K_AR5210, AR5K_NOQCU_TXDP0, AR5K_QUEUE_TXDP, ath5k_hw_reg_read(), queue, u16, and u32.

Referenced by ath5k_txq_cleanup().

◆ ath5k_hw_set_txdp()

int ath5k_hw_set_txdp ( struct ath5k_hw * ah,
unsigned int queue,
u32 phys_addr )

ath5k_hw_set_txdp - Set TX Descriptor's address for a specific queue

@ah: The &struct ath5k_hw @queue: The hw queue number

Set TX descriptor's address for a specific queue. For 5210 we ignore the queue number and we use tx queue type since we only have 2 queues so as above we use TXDP0 for normal data queue and TXDP1 for beacon queue. For newer chips with QCU/DCU we just set the corresponding TXDP register. Returns -EINVAL if queue type is invalid for 5210 and -EIO if queue is still active.

Definition at line 293 of file ath5k_dma.c.

294{
295 u16 tx_reg;
296
297 /*
298 * Set the transmit queue descriptor pointer register by type
299 * on 5210
300 */
301 if (ah->ah_version == AR5K_AR5210) {
302 /* Assume a data queue */
303 tx_reg = AR5K_NOQCU_TXDP0;
304 } else {
305 /*
306 * Set the transmit queue descriptor pointer for
307 * the selected queue on QCU for 5211+
308 * (this won't work if the queue is still active)
309 */
311 return -EIO;
312
313 tx_reg = AR5K_QUEUE_TXDP(queue);
314 }
315
316 /* Set descriptor pointer */
317 ath5k_hw_reg_write(ah, phys_addr, tx_reg);
318
319 return 0;
320}

References ah, AR5K_AR5210, AR5K_NOQCU_TXDP0, AR5K_QCU_TXE, AR5K_QUEUE_TXDP, AR5K_REG_READ_Q, ath5k_hw_reg_write(), EIO, queue, u16, and u32.

Referenced by ath5k_txbuf_setup().

◆ ath5k_hw_update_tx_triglevel()

int ath5k_hw_update_tx_triglevel ( struct ath5k_hw * ah,
int increase )

ath5k_hw_update_tx_triglevel - Update tx trigger level

@ah: The &struct ath5k_hw @increase: Flag to force increase of trigger level

This function increases/decreases the tx trigger level for the tx fifo buffer (aka FIFO threshold) that is used to indicate when PCU flushes the buffer and transmits it's data. Lowering this results sending small frames more quickly but can lead to tx underruns, raising it a lot can result other problems (i think bmiss is related). Right now we start with the lowest possible (64Bytes) and if we get tx underrun we increase it using the increase flag. Returns -EIO if we have have reached maximum/minimum.

XXX: Link this with tx DMA size ? XXX: Use it to save interrupts ? TODO: Needs testing, i think it's related to bmiss...

Definition at line 340 of file ath5k_dma.c.

341{
342 u32 trigger_level, imr;
343 int ret = -EIO;
344
345 /*
346 * Disable interrupts by setting the mask
347 */
349
350 trigger_level = AR5K_REG_MS(ath5k_hw_reg_read(ah, AR5K_TXCFG),
352
353 if (!increase) {
354 if (--trigger_level < AR5K_TUNE_MIN_TX_FIFO_THRES)
355 goto done;
356 } else
357 trigger_level +=
358 ((AR5K_TUNE_MAX_TX_FIFO_THRES - trigger_level) / 2);
359
360 /*
361 * Update trigger level on success
362 */
363 if (ah->ah_version == AR5K_AR5210)
364 ath5k_hw_reg_write(ah, trigger_level, AR5K_TRIG_LVL);
365 else
367 AR5K_TXCFG_TXFULL, trigger_level);
368
369 ret = 0;
370
371done:
372 /*
373 * Restore interrupt mask
374 */
376
377 return ret;
378}
#define AR5K_TXCFG
Definition reg.h:171
#define AR5K_TRIG_LVL
Definition reg.h:1376
#define AR5K_TXCFG_TXFULL
Definition reg.h:176
#define AR5K_TUNE_MAX_TX_FIFO_THRES
Definition ath5k.h:170
#define AR5K_REG_MS(_val, _flags)
Definition ath5k.h:90
#define AR5K_TUNE_MIN_TX_FIFO_THRES
Definition ath5k.h:169
#define AR5K_REG_WRITE_BITS(ah, _reg, _flags, _val)
Definition ath5k.h:98
@ AR5K_INT_GLOBAL
Definition ath5k.h:838
enum ath5k_int ath5k_hw_set_imr(struct ath5k_hw *ah, enum ath5k_int new_mask)
ath5k_hw_set_imr - Set interrupt mask
Definition ath5k_dma.c:549
struct bofm_section_header done
Definition bofm_test.c:46
@ imr
Definition sis900.h:27

References ah, AR5K_AR5210, AR5K_INT_GLOBAL, AR5K_REG_MS, AR5K_REG_WRITE_BITS, AR5K_TRIG_LVL, AR5K_TUNE_MAX_TX_FIFO_THRES, AR5K_TUNE_MIN_TX_FIFO_THRES, AR5K_TXCFG, AR5K_TXCFG_TXFULL, ath5k_hw_reg_read(), ath5k_hw_reg_write(), ath5k_hw_set_imr(), done, EIO, imr, and u32.

Referenced by ath5k_poll().

◆ ath5k_hw_is_intr_pending()

int ath5k_hw_is_intr_pending ( struct ath5k_hw * ah)

ath5k_hw_is_intr_pending - Check if we have pending interrupts

@ah: The &struct ath5k_hw

Check if we have pending interrupts to process. Returns 1 if we have pending interrupts and 0 if we haven't.

Definition at line 392 of file ath5k_dma.c.

393{
394 return ath5k_hw_reg_read(ah, AR5K_INTPEND) == 1 ? 1 : 0;
395}
#define AR5K_INTPEND
Definition reg.h:864

References ah, AR5K_INTPEND, and ath5k_hw_reg_read().

Referenced by ath5k_poll().

◆ ath5k_hw_get_isr()

int ath5k_hw_get_isr ( struct ath5k_hw * ah,
enum ath5k_int * interrupt_mask )

Definition at line 413 of file ath5k_dma.c.

414{
415 u32 data;
416
417 /*
418 * Read interrupt status from the Interrupt Status register
419 * on 5210
420 */
421 if (ah->ah_version == AR5K_AR5210) {
423 if (data == AR5K_INT_NOCARD) {
424 *interrupt_mask = data;
425 return -ENODEV;
426 }
427 } else {
428 /*
429 * Read interrupt status from Interrupt
430 * Status Register shadow copy (Read And Clear)
431 *
432 * Note: PISR/SISR Not available on 5210
433 */
435 if (data == AR5K_INT_NOCARD) {
436 *interrupt_mask = data;
437 return -ENODEV;
438 }
439 }
440
441 /*
442 * Get abstract interrupt mask (driver-compatible)
443 */
444 *interrupt_mask = (data & AR5K_INT_COMMON) & ah->ah_imr;
445
446 if (ah->ah_version != AR5K_AR5210) {
448
449 /*HIU = Host Interface Unit (PCI etc)*/
450 if (data & (AR5K_ISR_HIUERR))
451 *interrupt_mask |= AR5K_INT_FATAL;
452
453 /*Beacon Not Ready*/
454 if (data & (AR5K_ISR_BNR))
455 *interrupt_mask |= AR5K_INT_BNR;
456
457 if (sisr2 & (AR5K_SISR2_SSERR | AR5K_SISR2_DPERR |
459 *interrupt_mask |= AR5K_INT_FATAL;
460
461 if (data & AR5K_ISR_TIM)
462 *interrupt_mask |= AR5K_INT_TIM;
463
464 if (data & AR5K_ISR_BCNMISC) {
465 if (sisr2 & AR5K_SISR2_TIM)
466 *interrupt_mask |= AR5K_INT_TIM;
467 if (sisr2 & AR5K_SISR2_DTIM)
468 *interrupt_mask |= AR5K_INT_DTIM;
469 if (sisr2 & AR5K_SISR2_DTIM_SYNC)
470 *interrupt_mask |= AR5K_INT_DTIM_SYNC;
471 if (sisr2 & AR5K_SISR2_BCN_TIMEOUT)
472 *interrupt_mask |= AR5K_INT_BCN_TIMEOUT;
473 if (sisr2 & AR5K_SISR2_CAB_TIMEOUT)
474 *interrupt_mask |= AR5K_INT_CAB_TIMEOUT;
475 }
476
478 *interrupt_mask |= AR5K_INT_RX_DOPPLER;
479 if (data & AR5K_ISR_QCBRORN) {
480 *interrupt_mask |= AR5K_INT_QCBRORN;
481 ah->ah_txq_isr |= AR5K_REG_MS(
484 }
485 if (data & AR5K_ISR_QCBRURN) {
486 *interrupt_mask |= AR5K_INT_QCBRURN;
487 ah->ah_txq_isr |= AR5K_REG_MS(
490 }
491 if (data & AR5K_ISR_QTRIG) {
492 *interrupt_mask |= AR5K_INT_QTRIG;
493 ah->ah_txq_isr |= AR5K_REG_MS(
496 }
497
498 if (data & AR5K_ISR_TXOK)
499 ah->ah_txq_isr |= AR5K_REG_MS(
502
503 if (data & AR5K_ISR_TXDESC)
504 ah->ah_txq_isr |= AR5K_REG_MS(
507
508 if (data & AR5K_ISR_TXERR)
509 ah->ah_txq_isr |= AR5K_REG_MS(
512
513 if (data & AR5K_ISR_TXEOL)
514 ah->ah_txq_isr |= AR5K_REG_MS(
517
518 if (data & AR5K_ISR_TXURN)
519 ah->ah_txq_isr |= AR5K_REG_MS(
522 } else {
525 *interrupt_mask |= AR5K_INT_FATAL;
526
527 /*
528 * XXX: BMISS interrupts may occur after association.
529 * I found this on 5210 code but it needs testing. If this is
530 * true we should disable them before assoc and re-enable them
531 * after a successful assoc + some jiffies.
532 interrupt_mask &= ~AR5K_INT_BMISS;
533 */
534 }
535
536 return 0;
537}
#define AR5K_ISR_TXEOL
Definition reg.h:299
#define AR5K_ISR_TXOK
Definition reg.h:295
#define AR5K_ISR_RXDOPPLER
Definition reg.h:314
#define AR5K_RAC_PISR
Definition reg.h:367
#define AR5K_SISR4_QTRIG
Definition reg.h:361
#define AR5K_SISR2_DTIM
Definition reg.h:351
#define AR5K_SISR2_DPERR
Definition reg.h:345
#define AR5K_ISR_BNR
Definition reg.h:309
#define AR5K_ISR_DPERR
Definition reg.h:313
#define AR5K_ISR_TXDESC
Definition reg.h:296
#define AR5K_ISR_BCNMISC
Definition reg.h:316
#define AR5K_ISR_TXURN
Definition reg.h:300
#define AR5K_SISR1_QCU_TXERR
Definition reg.h:335
#define AR5K_RAC_SISR2
Definition reg.h:370
#define AR5K_SISR1_QCU_TXEOL
Definition reg.h:337
#define AR5K_ISR_MCABT
Definition reg.h:310
#define AR5K_RAC_SISR4
Definition reg.h:372
#define AR5K_SISR2_QCU_TXURN
Definition reg.h:341
#define AR5K_SISR2_TIM
Definition reg.h:346
#define AR5K_ISR_TIM
Definition reg.h:315
#define AR5K_SISR0_QCU_TXDESC
Definition reg.h:331
#define AR5K_ISR_HIUERR
Definition reg.h:308
#define AR5K_ISR_TXERR
Definition reg.h:297
#define AR5K_SISR3_QCBRORN
Definition reg.h:355
#define AR5K_ISR_QCBRURN
Definition reg.h:319
#define AR5K_ISR_QCBRORN
Definition reg.h:318
#define AR5K_RAC_SISR1
Definition reg.h:369
#define AR5K_SISR3_QCBRURN
Definition reg.h:357
#define AR5K_ISR_SSERR
Definition reg.h:312
#define AR5K_SISR2_DTIM_SYNC
Definition reg.h:348
#define AR5K_SISR0_QCU_TXOK
Definition reg.h:329
#define AR5K_SISR2_MCABT
Definition reg.h:343
#define AR5K_SISR2_SSERR
Definition reg.h:344
#define AR5K_SISR2_BCN_TIMEOUT
Definition reg.h:349
#define AR5K_ISR
Definition reg.h:287
#define AR5K_ISR_QTRIG
Definition reg.h:320
#define AR5K_RAC_SISR3
Definition reg.h:371
#define AR5K_SISR2_CAB_TIMEOUT
Definition reg.h:350
#define AR5K_RAC_SISR0
Definition reg.h:368
@ AR5K_INT_CAB_TIMEOUT
Definition ath5k.h:833
@ AR5K_INT_TIM
Definition ath5k.h:828
@ AR5K_INT_BCN_TIMEOUT
Definition ath5k.h:832
@ AR5K_INT_FATAL
Definition ath5k.h:826
@ AR5K_INT_QCBRORN
Definition ath5k.h:835
@ AR5K_INT_BNR
Definition ath5k.h:827
@ AR5K_INT_QTRIG
Definition ath5k.h:837
@ AR5K_INT_RX_DOPPLER
Definition ath5k.h:834
@ AR5K_INT_DTIM_SYNC
Definition ath5k.h:830
@ AR5K_INT_NOCARD
Definition ath5k.h:862
@ AR5K_INT_COMMON
Definition ath5k.h:840
@ AR5K_INT_DTIM
Definition ath5k.h:829
@ AR5K_INT_QCBRURN
Definition ath5k.h:836
uint8_t data[48]
Additional event data.
Definition ena.h:11
#define ENODEV
No such device.
Definition errno.h:510

References ah, AR5K_AR5210, AR5K_INT_BCN_TIMEOUT, AR5K_INT_BNR, AR5K_INT_CAB_TIMEOUT, AR5K_INT_COMMON, AR5K_INT_DTIM, AR5K_INT_DTIM_SYNC, AR5K_INT_FATAL, AR5K_INT_NOCARD, AR5K_INT_QCBRORN, AR5K_INT_QCBRURN, AR5K_INT_QTRIG, AR5K_INT_RX_DOPPLER, AR5K_INT_TIM, AR5K_ISR, AR5K_ISR_BCNMISC, AR5K_ISR_BNR, AR5K_ISR_DPERR, AR5K_ISR_HIUERR, AR5K_ISR_MCABT, AR5K_ISR_QCBRORN, AR5K_ISR_QCBRURN, AR5K_ISR_QTRIG, AR5K_ISR_RXDOPPLER, AR5K_ISR_SSERR, AR5K_ISR_TIM, AR5K_ISR_TXDESC, AR5K_ISR_TXEOL, AR5K_ISR_TXERR, AR5K_ISR_TXOK, AR5K_ISR_TXURN, AR5K_RAC_PISR, AR5K_RAC_SISR0, AR5K_RAC_SISR1, AR5K_RAC_SISR2, AR5K_RAC_SISR3, AR5K_RAC_SISR4, AR5K_REG_MS, AR5K_SISR0_QCU_TXDESC, AR5K_SISR0_QCU_TXOK, AR5K_SISR1_QCU_TXEOL, AR5K_SISR1_QCU_TXERR, AR5K_SISR2_BCN_TIMEOUT, AR5K_SISR2_CAB_TIMEOUT, AR5K_SISR2_DPERR, AR5K_SISR2_DTIM, AR5K_SISR2_DTIM_SYNC, AR5K_SISR2_MCABT, AR5K_SISR2_QCU_TXURN, AR5K_SISR2_SSERR, AR5K_SISR2_TIM, AR5K_SISR3_QCBRORN, AR5K_SISR3_QCBRURN, AR5K_SISR4_QTRIG, ath5k_hw_reg_read(), data, ENODEV, and u32.

Referenced by ath5k_poll().

◆ ath5k_hw_set_imr()

enum ath5k_int ath5k_hw_set_imr ( struct ath5k_hw * ah,
enum ath5k_int new_mask )

ath5k_hw_set_imr - Set interrupt mask

@ah: The &struct ath5k_hw @new_mask: The new interrupt mask to be set

Set the interrupt mask in hw to save interrupts. We do that by mapping ath5k_int bits to hw-specific bits to remove abstraction and writing Interrupt Mask Register.

Definition at line 549 of file ath5k_dma.c.

550{
551 enum ath5k_int old_mask, int_mask;
552
553 old_mask = ah->ah_imr;
554
555 /*
556 * Disable card interrupts to prevent any race conditions
557 * (they will be re-enabled afterwards if AR5K_INT GLOBAL
558 * is set again on the new mask).
559 */
560 if (old_mask & AR5K_INT_GLOBAL) {
563 }
564
565 /*
566 * Add additional, chipset-dependent interrupt mask flags
567 * and write them to the IMR (interrupt mask register).
568 */
569 int_mask = new_mask & AR5K_INT_COMMON;
570
571 if (ah->ah_version != AR5K_AR5210) {
572 /* Preserve per queue TXURN interrupt mask */
575
576 if (new_mask & AR5K_INT_FATAL) {
577 int_mask |= AR5K_IMR_HIUERR;
580 }
581
582 /*Beacon Not Ready*/
583 if (new_mask & AR5K_INT_BNR)
584 int_mask |= AR5K_INT_BNR;
585
586 if (new_mask & AR5K_INT_TIM)
587 int_mask |= AR5K_IMR_TIM;
588
589 if (new_mask & AR5K_INT_TIM)
590 simr2 |= AR5K_SISR2_TIM;
591 if (new_mask & AR5K_INT_DTIM)
592 simr2 |= AR5K_SISR2_DTIM;
593 if (new_mask & AR5K_INT_DTIM_SYNC)
594 simr2 |= AR5K_SISR2_DTIM_SYNC;
595 if (new_mask & AR5K_INT_BCN_TIMEOUT)
596 simr2 |= AR5K_SISR2_BCN_TIMEOUT;
597 if (new_mask & AR5K_INT_CAB_TIMEOUT)
598 simr2 |= AR5K_SISR2_CAB_TIMEOUT;
599
600 if (new_mask & AR5K_INT_RX_DOPPLER)
601 int_mask |= AR5K_IMR_RXDOPPLER;
602
603 /* Note: Per queue interrupt masks
604 * are set via reset_tx_queue (qcu.c) */
605 ath5k_hw_reg_write(ah, int_mask, AR5K_PIMR);
607
608 } else {
609 if (new_mask & AR5K_INT_FATAL)
610 int_mask |= (AR5K_IMR_SSERR | AR5K_IMR_MCABT
612
613 ath5k_hw_reg_write(ah, int_mask, AR5K_IMR);
614 }
615
616 /* If RXNOFRM interrupt is masked disable it
617 * by setting AR5K_RXNOFRM to zero */
618 if (!(new_mask & AR5K_INT_RXNOFRM))
620
621 /* Store new interrupt mask */
622 ah->ah_imr = new_mask;
623
624 /* ..re-enable interrupts if AR5K_INT_GLOBAL is set */
625 if (new_mask & AR5K_INT_GLOBAL) {
626 ath5k_hw_reg_write(ah, ah->ah_ier, AR5K_IER);
628 }
629
630 return old_mask;
631}
#define AR5K_IMR_DPERR
Definition reg.h:406
#define AR5K_IMR_SSERR
Definition reg.h:405
#define AR5K_IMR
Definition reg.h:380
#define AR5K_IER_DISABLE
Definition reg.h:93
#define AR5K_SIMR2_QCU_TXURN
Definition reg.h:431
#define AR5K_SIMR2_DPERR
Definition reg.h:435
#define AR5K_SIMR2_SSERR
Definition reg.h:434
#define AR5K_RXNOFRM
Definition reg.h:231
#define AR5K_IMR_RXDOPPLER
Definition reg.h:407
#define AR5K_SIMR2
Definition reg.h:430
#define AR5K_IMR_TIM
Definition reg.h:408
#define AR5K_IMR_MCABT
Definition reg.h:403
#define AR5K_IER
Definition reg.h:92
#define AR5K_PIMR
Definition reg.h:381
#define AR5K_IMR_HIUERR
Definition reg.h:401
#define AR5K_SIMR2_MCABT
Definition reg.h:433
ath5k_int
enum ath5k_int - Hardware interrupt masks helpers
Definition ath5k.h:806
@ AR5K_INT_RXNOFRM
Definition ath5k.h:810

References ah, AR5K_AR5210, AR5K_IER, AR5K_IER_DISABLE, AR5K_IMR, AR5K_IMR_DPERR, AR5K_IMR_HIUERR, AR5K_IMR_MCABT, AR5K_IMR_RXDOPPLER, AR5K_IMR_SSERR, AR5K_IMR_TIM, AR5K_INT_BCN_TIMEOUT, AR5K_INT_BNR, AR5K_INT_CAB_TIMEOUT, AR5K_INT_COMMON, AR5K_INT_DTIM, AR5K_INT_DTIM_SYNC, AR5K_INT_FATAL, AR5K_INT_GLOBAL, AR5K_INT_RX_DOPPLER, AR5K_INT_RXNOFRM, AR5K_INT_TIM, AR5K_PIMR, AR5K_RXNOFRM, AR5K_SIMR2, AR5K_SIMR2_DPERR, AR5K_SIMR2_MCABT, AR5K_SIMR2_QCU_TXURN, AR5K_SIMR2_SSERR, AR5K_SISR2_BCN_TIMEOUT, AR5K_SISR2_CAB_TIMEOUT, AR5K_SISR2_DTIM, AR5K_SISR2_DTIM_SYNC, AR5K_SISR2_TIM, ath5k_hw_reg_read(), ath5k_hw_reg_write(), and u32.

Referenced by ath5k_hw_reset(), ath5k_hw_update_tx_triglevel(), ath5k_irq(), ath5k_reset(), and ath5k_stop_hw().