Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
reset.c File Reference
#include <asm/unaligned.h>
#include <linux/pci.h>
#include <linux/log2.h>
#include <linux/platform_device.h>
#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

int ath5k_hw_register_timeout (struct ath5k_hw *ah, u32 reg, u32 flag, u32 val, bool is_set)
 
unsigned int ath5k_hw_htoclock (struct ath5k_hw *ah, unsigned int usec)
 
unsigned int ath5k_hw_clocktoh (struct ath5k_hw *ah, unsigned int clock)
 
int ath5k_hw_on_hold (struct ath5k_hw *ah)
 
int ath5k_hw_nic_wakeup (struct ath5k_hw *ah, struct ieee80211_channel *channel)
 
int ath5k_hw_reset (struct ath5k_hw *ah, enum nl80211_iftype op_mode, struct ieee80211_channel *channel, bool fast, bool skip_pcu)
 

Macro Definition Documentation

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 26 of file reset.c.

Function Documentation

unsigned int ath5k_hw_clocktoh ( struct ath5k_hw ah,
unsigned int  clock 
)

ath5k_hw_clocktoh() - Translate hw clock units to usec : The &struct ath5k_hw : value in hw clock units

Translate hw clock units to usecs based on the current hw clock rate.

Returns number of usecs

Definition at line 118 of file reset.c.

unsigned int ath5k_hw_htoclock ( struct ath5k_hw ah,
unsigned int  usec 
)

ath5k_hw_htoclock() - Translate usec to hw clock units : The &struct ath5k_hw : value in microseconds

Translate usecs to hw clock units based on the current hw clock rate.

Returns number of clock units

Definition at line 101 of file reset.c.

int ath5k_hw_nic_wakeup ( struct ath5k_hw ah,
struct ieee80211_channel channel 
)

ath5k_hw_nic_wakeup() - Force card out of sleep : The &struct ath5k_hw : The &struct ieee80211_channel

Bring up MAC + PHY Chips and program PLL NOTE: Channel is NULL for the initial wakeup.

Returns 0 on success, -EIO on hw failure or -EINVAL for false channel infos

Definition at line 669 of file reset.c.

int ath5k_hw_on_hold ( struct ath5k_hw ah)

ath5k_hw_on_hold() - Put device on hold : The &struct ath5k_hw

Put MAC and Baseband on warm reset and keep that state (don't clean sleep control register). After this MAC and Baseband are disabled and a full reset is needed to come back. This way we save as much power as possible without putting the card on full sleep.

Returns 0 on success or -EIO on error

Definition at line 607 of file reset.c.

int ath5k_hw_register_timeout ( struct ath5k_hw ah,
u32  reg,
u32  flag,
u32  val,
bool  is_set 
)

DOC: Reset function and helpers

Here we implement the main reset routine, used to bring the card to a working state and ready to receive. We also handle routines that don't fit on other places such as clock, sleep and power control ath5k_hw_register_timeout() - Poll a register for a flag/field change : The &struct ath5k_hw : The register to read : The flag/field to check on the register : The field value we expect (if we check a field) : Instead of checking if the flag got cleared, check if it got set

Some registers contain flags that indicate that an operation is running. We use this function to poll these registers and check if these flags get cleared. We also use it to poll a register field (containing multiple flags) until it gets a specific value.

Returns -EAGAIN if we exceeded AR5K_TUNE_REGISTER_TIMEOUT * 15us or 0

Definition at line 67 of file reset.c.

int ath5k_hw_reset ( struct ath5k_hw ah,
enum nl80211_iftype  op_mode,
struct ieee80211_channel channel,
bool  fast,
bool  skip_pcu 
)

ath5k_hw_reset() - The main reset function : The &struct ath5k_hw : One of enum nl80211_iftype : The &struct ieee80211_channel : Enable fast channel switching : Skip pcu initialization

This is the function we call each time we want to (re)initialize the card and pass new settings to hw. We also call it when hw runs into trouble to make it come back to a working state.

Returns 0 on success, -EINVAL on false op_mode or channel infos, or -EIO on failure.

Definition at line 1146 of file reset.c.