Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
dma.c File Reference
#include "ath5k.h"
#include "reg.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 

Functions

void ath5k_hw_start_rx_dma (struct ath5k_hw *ah)
 
u32 ath5k_hw_get_rxdp (struct ath5k_hw *ah)
 
int ath5k_hw_set_rxdp (struct ath5k_hw *ah, u32 phys_addr)
 
int ath5k_hw_start_tx_dma (struct ath5k_hw *ah, unsigned int queue)
 
int ath5k_hw_stop_beacon_queue (struct ath5k_hw *ah, unsigned int queue)
 
u32 ath5k_hw_get_txdp (struct ath5k_hw *ah, unsigned int queue)
 
int ath5k_hw_set_txdp (struct ath5k_hw *ah, unsigned int queue, u32 phys_addr)
 
int ath5k_hw_update_tx_triglevel (struct ath5k_hw *ah, bool increase)
 
bool ath5k_hw_is_intr_pending (struct ath5k_hw *ah)
 
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)
 
void ath5k_hw_dma_init (struct ath5k_hw *ah)
 
int ath5k_hw_dma_stop (struct ath5k_hw *ah)
 

Macro Definition Documentation

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

DOC: DMA and interrupt masking functions

Here we setup descriptor pointers (rxdp/txdp) start/stop dma engine and handle queue setup for 5210 chipset (rest are handled on qcu.c). Also we setup interrupt mask register (IMR) and read the various interrupt status registers (ISR).

Definition at line 32 of file dma.c.

Function Documentation

void ath5k_hw_dma_init ( struct ath5k_hw ah)

ath5k_hw_dma_init() - Initialize DMA unit : The &struct ath5k_hw

Set DMA size and pre-enable interrupts (driver handles tx/rx buffer setup and dma start/stop)

XXX: Save/restore RXDP/TXDP registers ?

Definition at line 847 of file dma.c.

int ath5k_hw_dma_stop ( struct ath5k_hw ah)

ath5k_hw_dma_stop() - stop DMA unit : The &struct ath5k_hw

Stop tx/rx DMA and interrupts. Returns -EBUSY if tx or rx dma failed to stop.

XXX: Sometimes DMA unit hangs and we have stuck frames on tx queues, only a reset can fix that.

Definition at line 887 of file dma.c.

int ath5k_hw_get_isr ( struct ath5k_hw ah,
enum ath5k_int interrupt_mask 
)

Definition at line 527 of file dma.c.

u32 ath5k_hw_get_rxdp ( struct ath5k_hw ah)

ath5k_hw_get_rxdp() - Get RX Descriptor's address : The &struct ath5k_hw

Definition at line 85 of file dma.c.

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 : The &struct ath5k_hw : 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 353 of file dma.c.

bool ath5k_hw_is_intr_pending ( struct ath5k_hw ah)

ath5k_hw_is_intr_pending() - Check if we have pending interrupts : 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 506 of file dma.c.

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

ath5k_hw_set_imr() - Set interrupt mask : The &struct ath5k_hw : 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 746 of file dma.c.

int ath5k_hw_set_rxdp ( struct ath5k_hw ah,
u32  phys_addr 
)

ath5k_hw_set_rxdp() - Set RX Descriptor's address : The &struct ath5k_hw : RX descriptor address

Returns -EIO if rx is active

Definition at line 98 of file dma.c.

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 : The &struct ath5k_hw : The hw queue number : The physical address

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 396 of file dma.c.

void ath5k_hw_start_rx_dma ( struct ath5k_hw ah)

ath5k_hw_start_rx_dma() - Start DMA receive : The &struct ath5k_hw

Definition at line 48 of file dma.c.

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 : The &struct ath5k_hw : 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 130 of file dma.c.

int ath5k_hw_stop_beacon_queue ( struct ath5k_hw ah,
unsigned int  queue 
)

ath5k_hw_stop_beacon_queue() - Stop beacon queue : The &struct ath5k_hw : The queue number

Returns -EIO if queue didn't stop

Definition at line 328 of file dma.c.

int ath5k_hw_update_tx_triglevel ( struct ath5k_hw ah,
bool  increase 
)

ath5k_hw_update_tx_triglevel() - Update tx trigger level : The &struct ath5k_hw : 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 its data. Lowering this results sending small frames more quickly but can lead to tx underruns, raising it a lot can result other problems. 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 reached maximum/minimum.

XXX: Link this with tx DMA size ? XXX2: Use it to save interrupts ?

Definition at line 453 of file dma.c.