iPXE
Data Structures | Macros | Enumerations | Functions
ath5k.h File Reference
#include <stddef.h>
#include <string.h>
#include <byteswap.h>
#include <ipxe/io.h>
#include <ipxe/netdevice.h>
#include <ipxe/net80211.h>
#include <errno.h>
#include "desc.h"
#include "eeprom.h"

Go to the source code of this file.

Data Structures

struct  ath5k_srev_name
 
struct  ath5k_tx_status
 
struct  ath5k_txq_info
 
struct  ath5k_rx_status
 
struct  ath5k_gain
 
struct  ath5k_athchan_2ghz
 
struct  ath5k_capabilities
 
struct  ath5k_hw
 ath5k_hw_get_isr - Get interrupt status More...
 

Macros

#define ERRFILE   ERRFILE_ath5k
 
#define PCI_DEVICE_ID_ATHEROS_AR5210   0x0007 /* AR5210 */
 
#define PCI_DEVICE_ID_ATHEROS_AR5311   0x0011 /* AR5311 */
 
#define PCI_DEVICE_ID_ATHEROS_AR5211   0x0012 /* AR5211 */
 
#define PCI_DEVICE_ID_ATHEROS_AR5212   0x0013 /* AR5212 */
 
#define PCI_DEVICE_ID_3COM_3CRDAG675   0x0013 /* 3CRDAG675 (Atheros AR5212) */
 
#define PCI_DEVICE_ID_3COM_2_3CRPAG175   0x0013 /* 3CRPAG175 (Atheros AR5212) */
 
#define PCI_DEVICE_ID_ATHEROS_AR5210_AP   0x0207 /* AR5210 (Early) */
 
#define PCI_DEVICE_ID_ATHEROS_AR5212_IBM   0x1014 /* AR5212 (IBM MiniPCI) */
 
#define PCI_DEVICE_ID_ATHEROS_AR5210_DEFAULT   0x1107 /* AR5210 (no eeprom) */
 
#define PCI_DEVICE_ID_ATHEROS_AR5212_DEFAULT   0x1113 /* AR5212 (no eeprom) */
 
#define PCI_DEVICE_ID_ATHEROS_AR5211_DEFAULT   0x1112 /* AR5211 (no eeprom) */
 
#define PCI_DEVICE_ID_ATHEROS_AR5212_FPGA   0xf013 /* AR5212 (emulation board) */
 
#define PCI_DEVICE_ID_ATHEROS_AR5211_LEGACY   0xff12 /* AR5211 (emulation board) */
 
#define PCI_DEVICE_ID_ATHEROS_AR5211_FPGA11B   0xf11b /* AR5211 (emulation board) */
 
#define PCI_DEVICE_ID_ATHEROS_AR5312_REV2   0x0052 /* AR5312 WMAC (AP31) */
 
#define PCI_DEVICE_ID_ATHEROS_AR5312_REV7   0x0057 /* AR5312 WMAC (AP30-040) */
 
#define PCI_DEVICE_ID_ATHEROS_AR5312_REV8   0x0058 /* AR5312 WMAC (AP43-030) */
 
#define PCI_DEVICE_ID_ATHEROS_AR5212_0014   0x0014 /* AR5212 compatible */
 
#define PCI_DEVICE_ID_ATHEROS_AR5212_0015   0x0015 /* AR5212 compatible */
 
#define PCI_DEVICE_ID_ATHEROS_AR5212_0016   0x0016 /* AR5212 compatible */
 
#define PCI_DEVICE_ID_ATHEROS_AR5212_0017   0x0017 /* AR5212 compatible */
 
#define PCI_DEVICE_ID_ATHEROS_AR5212_0018   0x0018 /* AR5212 compatible */
 
#define PCI_DEVICE_ID_ATHEROS_AR5212_0019   0x0019 /* AR5212 compatible */
 
#define PCI_DEVICE_ID_ATHEROS_AR2413   0x001a /* AR2413 (Griffin-lite) */
 
#define PCI_DEVICE_ID_ATHEROS_AR5413   0x001b /* AR5413 (Eagle) */
 
#define PCI_DEVICE_ID_ATHEROS_AR5424   0x001c /* AR5424 (Condor PCI-E) */
 
#define PCI_DEVICE_ID_ATHEROS_AR5416   0x0023 /* AR5416 */
 
#define PCI_DEVICE_ID_ATHEROS_AR5418   0x0024 /* AR5418 */
 
#define AR5K_REG_SM(_val, _flags)   (((_val) << _flags##_S) & (_flags))
 
#define AR5K_REG_MS(_val, _flags)   (((_val) & (_flags)) >> _flags##_S)
 
#define AR5K_REG_WRITE_BITS(ah, _reg, _flags, _val)
 
#define AR5K_REG_MASKED_BITS(ah, _reg, _flags, _mask)
 
#define AR5K_REG_ENABLE_BITS(ah, _reg, _flags)   ath5k_hw_reg_write(ah, ath5k_hw_reg_read(ah, _reg) | (_flags), _reg)
 
#define AR5K_REG_DISABLE_BITS(ah, _reg, _flags)   ath5k_hw_reg_write(ah, ath5k_hw_reg_read(ah, _reg) & ~(_flags), _reg)
 
#define AR5K_PHY_READ(ah, _reg)   ath5k_hw_reg_read(ah, (ah)->ah_phy + ((_reg) << 2))
 
#define AR5K_PHY_WRITE(ah, _reg, _val)   ath5k_hw_reg_write(ah, _val, (ah)->ah_phy + ((_reg) << 2))
 
#define AR5K_REG_READ_Q(ah, _reg, _queue)   (ath5k_hw_reg_read(ah, _reg) & (1 << _queue)) \
 
#define AR5K_REG_WRITE_Q(ah, _reg, _queue)   ath5k_hw_reg_write(ah, (1 << _queue), _reg)
 
#define AR5K_Q_ENABLE_BITS(_reg, _queue)
 
#define AR5K_Q_DISABLE_BITS(_reg, _queue)
 
#define AR5K_REG_WAIT(_i)
 
#define AR5K_INI_RFGAIN_5GHZ   0
 
#define AR5K_INI_RFGAIN_2GHZ   1
 
#define AR5K_INI_VAL_11A   0
 
#define AR5K_INI_VAL_11A_TURBO   1
 
#define AR5K_INI_VAL_11B   2
 
#define AR5K_INI_VAL_11G   3
 
#define AR5K_INI_VAL_11G_TURBO   4
 
#define AR5K_INI_VAL_XR   0
 
#define AR5K_INI_VAL_MAX   5
 
#define AR5K_LOW_ID(_a)
 
#define AR5K_HIGH_ID(_a)   ((_a)[4] | (_a)[5] << 8)
 
#define IEEE80211_MAX_LEN   2352
 
#define AR5K_TUNE_DMA_BEACON_RESP   2
 
#define AR5K_TUNE_SW_BEACON_RESP   10
 
#define AR5K_TUNE_ADDITIONAL_SWBA_BACKOFF   0
 
#define AR5K_TUNE_RADAR_ALERT   0
 
#define AR5K_TUNE_MIN_TX_FIFO_THRES   1
 
#define AR5K_TUNE_MAX_TX_FIFO_THRES   ((IEEE80211_MAX_LEN / 64) + 1)
 
#define AR5K_TUNE_REGISTER_TIMEOUT   20000
 
#define AR5K_TUNE_RSSI_THRES   129
 
#define AR5K_TUNE_BMISS_THRES   7
 
#define AR5K_TUNE_REGISTER_DWELL_TIME   20000
 
#define AR5K_TUNE_BEACON_INTERVAL   100
 
#define AR5K_TUNE_AIFS   2
 
#define AR5K_TUNE_AIFS_11B   2
 
#define AR5K_TUNE_AIFS_XR   0
 
#define AR5K_TUNE_CWMIN   15
 
#define AR5K_TUNE_CWMIN_11B   31
 
#define AR5K_TUNE_CWMIN_XR   3
 
#define AR5K_TUNE_CWMAX   1023
 
#define AR5K_TUNE_CWMAX_11B   1023
 
#define AR5K_TUNE_CWMAX_XR   7
 
#define AR5K_TUNE_NOISE_FLOOR   -72
 
#define AR5K_TUNE_MAX_TXPOWER   63
 
#define AR5K_TUNE_DEFAULT_TXPOWER   25
 
#define AR5K_TUNE_TPC_TXPOWER   0
 
#define AR5K_TUNE_ANT_DIVERSITY   1
 
#define AR5K_TUNE_HWTXTRIES   4
 
#define AR5K_INIT_CARR_SENSE_EN   1
 
#define AR5K_INIT_CFG   0x00000000
 
#define AR5K_INIT_CYCRSSI_THR1   2
 
#define AR5K_INIT_TX_LATENCY   502
 
#define AR5K_INIT_USEC   39
 
#define AR5K_INIT_USEC_TURBO   79
 
#define AR5K_INIT_USEC_32   31
 
#define AR5K_INIT_SLOT_TIME   396
 
#define AR5K_INIT_SLOT_TIME_TURBO   480
 
#define AR5K_INIT_ACK_CTS_TIMEOUT   1024
 
#define AR5K_INIT_ACK_CTS_TIMEOUT_TURBO   0x08000800
 
#define AR5K_INIT_PROG_IFS   920
 
#define AR5K_INIT_PROG_IFS_TURBO   960
 
#define AR5K_INIT_EIFS   3440
 
#define AR5K_INIT_EIFS_TURBO   6880
 
#define AR5K_INIT_SIFS   560
 
#define AR5K_INIT_SIFS_TURBO   480
 
#define AR5K_INIT_SH_RETRY   10
 
#define AR5K_INIT_LG_RETRY   AR5K_INIT_SH_RETRY
 
#define AR5K_INIT_SSH_RETRY   32
 
#define AR5K_INIT_SLG_RETRY   AR5K_INIT_SSH_RETRY
 
#define AR5K_INIT_TX_RETRY   10
 
#define AR5K_INIT_TRANSMIT_LATENCY
 
#define AR5K_INIT_TRANSMIT_LATENCY_TURBO
 
#define AR5K_INIT_PROTO_TIME_CNTRL
 
#define AR5K_INIT_PROTO_TIME_CNTRL_TURBO
 
#define AR5K_TXQ_USEDEFAULT   ((u32) -1)
 
#define AR5K_SREV_UNKNOWN   0xffff
 
#define AR5K_SREV_AR5210   0x00 /* Crete */
 
#define AR5K_SREV_AR5311   0x10 /* Maui 1 */
 
#define AR5K_SREV_AR5311A   0x20 /* Maui 2 */
 
#define AR5K_SREV_AR5311B   0x30 /* Spirit */
 
#define AR5K_SREV_AR5211   0x40 /* Oahu */
 
#define AR5K_SREV_AR5212   0x50 /* Venice */
 
#define AR5K_SREV_AR5213   0x55 /* ??? */
 
#define AR5K_SREV_AR5213A   0x59 /* Hainan */
 
#define AR5K_SREV_AR2413   0x78 /* Griffin lite */
 
#define AR5K_SREV_AR2414   0x70 /* Griffin */
 
#define AR5K_SREV_AR5424   0x90 /* Condor */
 
#define AR5K_SREV_AR5413   0xa4 /* Eagle lite */
 
#define AR5K_SREV_AR5414   0xa0 /* Eagle */
 
#define AR5K_SREV_AR2415   0xb0 /* Talon */
 
#define AR5K_SREV_AR5416   0xc0 /* PCI-E */
 
#define AR5K_SREV_AR5418   0xca /* PCI-E */
 
#define AR5K_SREV_AR2425   0xe0 /* Swan */
 
#define AR5K_SREV_AR2417   0xf0 /* Nala */
 
#define AR5K_SREV_RAD_5110   0x00
 
#define AR5K_SREV_RAD_5111   0x10
 
#define AR5K_SREV_RAD_5111A   0x15
 
#define AR5K_SREV_RAD_2111   0x20
 
#define AR5K_SREV_RAD_5112   0x30
 
#define AR5K_SREV_RAD_5112A   0x35
 
#define AR5K_SREV_RAD_5112B   0x36
 
#define AR5K_SREV_RAD_2112   0x40
 
#define AR5K_SREV_RAD_2112A   0x45
 
#define AR5K_SREV_RAD_2112B   0x46
 
#define AR5K_SREV_RAD_2413   0x50
 
#define AR5K_SREV_RAD_5413   0x60
 
#define AR5K_SREV_RAD_2316   0x70 /* Cobra SoC */
 
#define AR5K_SREV_RAD_2317   0x80
 
#define AR5K_SREV_RAD_5424   0xa0 /* Mostly same as 5413 */
 
#define AR5K_SREV_RAD_2425   0xa2
 
#define AR5K_SREV_RAD_5133   0xc0
 
#define AR5K_SREV_PHY_5211   0x30
 
#define AR5K_SREV_PHY_5212   0x41
 
#define AR5K_SREV_PHY_5212A   0x42
 
#define AR5K_SREV_PHY_5212B   0x43
 
#define AR5K_SREV_PHY_2413   0x45
 
#define AR5K_SREV_PHY_5413   0x61
 
#define AR5K_SREV_PHY_2425   0x70
 
#define MODULATION_XR   0x00000200
 
#define MODULATION_TURBO   0x00000080
 
#define AR5K_TXSTAT_ALTRATE   0x80
 
#define AR5K_TXERR_XRETRY   0x01
 
#define AR5K_TXERR_FILT   0x02
 
#define AR5K_TXERR_FIFO   0x04
 
#define AR5K_TXQ_FLAG_TXOKINT_ENABLE   0x0001 /* Enable TXOK interrupt */
 
#define AR5K_TXQ_FLAG_TXERRINT_ENABLE   0x0002 /* Enable TXERR interrupt */
 
#define AR5K_TXQ_FLAG_TXEOLINT_ENABLE   0x0004 /* Enable TXEOL interrupt -not used- */
 
#define AR5K_TXQ_FLAG_TXDESCINT_ENABLE   0x0008 /* Enable TXDESC interrupt -not used- */
 
#define AR5K_TXQ_FLAG_TXURNINT_ENABLE   0x0010 /* Enable TXURN interrupt */
 
#define AR5K_TXQ_FLAG_CBRORNINT_ENABLE   0x0020 /* Enable CBRORN interrupt */
 
#define AR5K_TXQ_FLAG_CBRURNINT_ENABLE   0x0040 /* Enable CBRURN interrupt */
 
#define AR5K_TXQ_FLAG_QTRIGINT_ENABLE   0x0080 /* Enable QTRIG interrupt */
 
#define AR5K_TXQ_FLAG_TXNOFRMINT_ENABLE   0x0100 /* Enable TXNOFRM interrupt */
 
#define AR5K_TXQ_FLAG_BACKOFF_DISABLE   0x0200 /* Disable random post-backoff */
 
#define AR5K_TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE   0x0300 /* Enable ready time expiry policy (?)*/
 
#define AR5K_TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE   0x0800 /* Enable backoff while bursting */
 
#define AR5K_TXQ_FLAG_POST_FR_BKOFF_DIS   0x1000 /* Disable backoff while bursting */
 
#define AR5K_TXQ_FLAG_COMPRESSION_ENABLE   0x2000 /* Enable hw compression -not implemented-*/
 
#define AR5K_TXPOWER_OFDM(_r, _v)
 
#define AR5K_TXPOWER_CCK(_r, _v)
 
#define AR5K_RXERR_CRC   0x01
 
#define AR5K_RXERR_PHY   0x02
 
#define AR5K_RXERR_FIFO   0x04
 
#define AR5K_RXERR_DECRYPT   0x08
 
#define AR5K_RXERR_MIC   0x10
 
#define AR5K_RXKEYIX_INVALID   ((u8) - 1)
 
#define AR5K_TXKEYIX_INVALID   ((u32) - 1)
 
#define TSF_TO_TU(_tsf)   (u32)((_tsf) >> 10)
 
#define AR5K_SLOT_TIME_9   396
 
#define AR5K_SLOT_TIME_20   880
 
#define AR5K_SLOT_TIME_MAX   0xffff
 
#define CHANNEL_CW_INT   0x0008 /* Contention Window interference detected */
 
#define CHANNEL_TURBO   0x0010 /* Turbo Channel */
 
#define CHANNEL_CCK   0x0020 /* CCK channel */
 
#define CHANNEL_OFDM   0x0040 /* OFDM channel */
 
#define CHANNEL_2GHZ   0x0080 /* 2GHz channel. */
 
#define CHANNEL_5GHZ   0x0100 /* 5GHz channel */
 
#define CHANNEL_PASSIVE   0x0200 /* Only passive scan allowed */
 
#define CHANNEL_DYN   0x0400 /* Dynamic CCK-OFDM channel (for g operation) */
 
#define CHANNEL_XR   0x0800 /* XR channel */
 
#define CHANNEL_A   (CHANNEL_5GHZ|CHANNEL_OFDM)
 
#define CHANNEL_B   (CHANNEL_2GHZ|CHANNEL_CCK)
 
#define CHANNEL_G   (CHANNEL_2GHZ|CHANNEL_OFDM)
 
#define CHANNEL_T   (CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_TURBO)
 
#define CHANNEL_TG   (CHANNEL_2GHZ|CHANNEL_OFDM|CHANNEL_TURBO)
 
#define CHANNEL_108A   CHANNEL_T
 
#define CHANNEL_108G   CHANNEL_TG
 
#define CHANNEL_X   (CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_XR)
 
#define CHANNEL_ALL
 
#define CHANNEL_ALL_NOTURBO   (CHANNEL_ALL & ~CHANNEL_TURBO)
 
#define CHANNEL_MODES   CHANNEL_ALL
 
#define IS_CHAN_XR(_c)   ((_c->hw_value & CHANNEL_XR) != 0)
 
#define IS_CHAN_B(_c)   ((_c->hw_value & CHANNEL_B) != 0)
 
#define AR5K_MAX_RATES   32
 Seems the ar5xxx harware supports up to 32 rates, indexed by 1-32. More...
 
#define ATH5K_RATE_CODE_1M   0x1B
 
#define ATH5K_RATE_CODE_2M   0x1A
 
#define ATH5K_RATE_CODE_5_5M   0x19
 
#define ATH5K_RATE_CODE_11M   0x18
 
#define ATH5K_RATE_CODE_6M   0x0B
 
#define ATH5K_RATE_CODE_9M   0x0F
 
#define ATH5K_RATE_CODE_12M   0x0A
 
#define ATH5K_RATE_CODE_18M   0x0E
 
#define ATH5K_RATE_CODE_24M   0x09
 
#define ATH5K_RATE_CODE_36M   0x0D
 
#define ATH5K_RATE_CODE_48M   0x08
 
#define ATH5K_RATE_CODE_54M   0x0C
 
#define ATH5K_RATE_CODE_XR_500K   0x07
 
#define ATH5K_RATE_CODE_XR_1M   0x02
 
#define ATH5K_RATE_CODE_XR_2M   0x06
 
#define ATH5K_RATE_CODE_XR_3M   0x01
 
#define AR5K_SET_SHORT_PREAMBLE   0x04
 
#define AR5K_KEYCACHE_SIZE   8
 
#define AR5K_RSSI_EP_MULTIPLIER   (1<<7)
 
#define AR5K_ASSERT_ENTRY(_e, _s)
 
#define AR5K_SOFTLED_PIN   0
 
#define AR5K_SOFTLED_ON   0
 
#define AR5K_SOFTLED_OFF   1
 
#define AR5K_MAX_GPIO   10
 
#define AR5K_MAX_RF_BANKS   8
 
#define ah_regdomain   ah_capabilities.cap_regdomain.reg_current
 
#define ah_regdomain_hw   ah_capabilities.cap_regdomain.reg_hw
 
#define ah_modes   ah_capabilities.cap_mode
 
#define ah_ee_version   ah_capabilities.cap_eeprom.ee_version
 

Enumerations

enum  ath5k_version { AR5K_AR5210 = 0, AR5K_AR5211 = 1, AR5K_AR5212 = 2 }
 
enum  ath5k_radio {
  AR5K_RF5110 = 0, AR5K_RF5111 = 1, AR5K_RF5112 = 2, AR5K_RF2413 = 3,
  AR5K_RF5413 = 4, AR5K_RF2316 = 5, AR5K_RF2317 = 6, AR5K_RF2425 = 7
}
 
enum  ath5k_srev_type { AR5K_VERSION_MAC, AR5K_VERSION_RAD }
 
enum  ath5k_driver_mode {
  AR5K_MODE_11A = 0, AR5K_MODE_11A_TURBO = 1, AR5K_MODE_11B = 2, AR5K_MODE_11G = 3,
  AR5K_MODE_11G_TURBO = 4, AR5K_MODE_XR = 5
}
 
enum  {
  AR5K_MODE_BIT_11A = (1 << AR5K_MODE_11A), AR5K_MODE_BIT_11A_TURBO = (1 << AR5K_MODE_11A_TURBO), AR5K_MODE_BIT_11B = (1 << AR5K_MODE_11B), AR5K_MODE_BIT_11G = (1 << AR5K_MODE_11G),
  AR5K_MODE_BIT_11G_TURBO = (1 << AR5K_MODE_11G_TURBO), AR5K_MODE_BIT_XR = (1 << AR5K_MODE_XR)
}
 
enum  ath5k_tx_queue {
  AR5K_TX_QUEUE_INACTIVE = 0, AR5K_TX_QUEUE_DATA, AR5K_TX_QUEUE_XR_DATA, AR5K_TX_QUEUE_BEACON,
  AR5K_TX_QUEUE_CAB, AR5K_TX_QUEUE_UAPSD
}
 enum ath5k_tx_queue - Queue types used to classify tx queues. More...
 
enum  ath5k_tx_queue_subtype { AR5K_WME_AC_BK = 0, AR5K_WME_AC_BE, AR5K_WME_AC_VI, AR5K_WME_AC_VO }
 
enum  ath5k_tx_queue_id {
  AR5K_TX_QUEUE_ID_NOQCU_DATA = 0, AR5K_TX_QUEUE_ID_NOQCU_BEACON = 1, AR5K_TX_QUEUE_ID_DATA_MIN = 0, AR5K_TX_QUEUE_ID_DATA_MAX = 4,
  AR5K_TX_QUEUE_ID_DATA_SVP = 5, AR5K_TX_QUEUE_ID_CAB = 6, AR5K_TX_QUEUE_ID_BEACON = 7, AR5K_TX_QUEUE_ID_UAPSD = 8,
  AR5K_TX_QUEUE_ID_XR_DATA = 9
}
 
enum  ath5k_pkt_type {
  AR5K_PKT_TYPE_NORMAL = 0, AR5K_PKT_TYPE_ATIM = 1, AR5K_PKT_TYPE_PSPOLL = 2, AR5K_PKT_TYPE_BEACON = 3,
  AR5K_PKT_TYPE_PROBE_RESP = 4, AR5K_PKT_TYPE_PIFS = 5
}
 
enum  ath5k_dmasize {
  AR5K_DMASIZE_4B = 0, AR5K_DMASIZE_8B, AR5K_DMASIZE_16B, AR5K_DMASIZE_32B,
  AR5K_DMASIZE_64B, AR5K_DMASIZE_128B, AR5K_DMASIZE_256B, AR5K_DMASIZE_512B
}
 
enum  ath5k_rfgain { AR5K_RFGAIN_INACTIVE = 0, AR5K_RFGAIN_ACTIVE, AR5K_RFGAIN_READ_REQUESTED, AR5K_RFGAIN_NEED_CHANGE }
 
enum  ath5k_int {
  AR5K_INT_RXOK = 0x00000001, AR5K_INT_RXDESC = 0x00000002, AR5K_INT_RXERR = 0x00000004, AR5K_INT_RXNOFRM = 0x00000008,
  AR5K_INT_RXEOL = 0x00000010, AR5K_INT_RXORN = 0x00000020, AR5K_INT_TXOK = 0x00000040, AR5K_INT_TXDESC = 0x00000080,
  AR5K_INT_TXERR = 0x00000100, AR5K_INT_TXNOFRM = 0x00000200, AR5K_INT_TXEOL = 0x00000400, AR5K_INT_TXURN = 0x00000800,
  AR5K_INT_MIB = 0x00001000, AR5K_INT_SWI = 0x00002000, AR5K_INT_RXPHY = 0x00004000, AR5K_INT_RXKCM = 0x00008000,
  AR5K_INT_SWBA = 0x00010000, AR5K_INT_BRSSI = 0x00020000, AR5K_INT_BMISS = 0x00040000, AR5K_INT_FATAL = 0x00080000,
  AR5K_INT_BNR = 0x00100000, AR5K_INT_TIM = 0x00200000, AR5K_INT_DTIM = 0x00400000, AR5K_INT_DTIM_SYNC = 0x00800000,
  AR5K_INT_GPIO = 0x01000000, AR5K_INT_BCN_TIMEOUT = 0x02000000, AR5K_INT_CAB_TIMEOUT = 0x04000000, AR5K_INT_RX_DOPPLER = 0x08000000,
  AR5K_INT_QCBRORN = 0x10000000, AR5K_INT_QCBRURN = 0x20000000, AR5K_INT_QTRIG = 0x40000000, AR5K_INT_GLOBAL = 0x80000000,
  AR5K_INT_COMMON, AR5K_INT_NOCARD = 0xffffffff
}
 enum ath5k_int - Hardware interrupt masks helpers More...
 
enum  ath5k_power_mode {
  AR5K_PM_UNDEFINED = 0, AR5K_PM_AUTO, AR5K_PM_AWAKE, AR5K_PM_FULL_SLEEP,
  AR5K_PM_NETWORK_SLEEP
}
 
enum  ath5k_capability_type {
  AR5K_CAP_REG_DMN = 0, AR5K_CAP_TKIP_MIC = 2, AR5K_CAP_TKIP_SPLIT = 3, AR5K_CAP_PHYCOUNTERS = 4,
  AR5K_CAP_DIVERSITY = 5, AR5K_CAP_NUM_TXQUEUES = 6, AR5K_CAP_VEOL = 7, AR5K_CAP_COMPRESSION = 8,
  AR5K_CAP_BURST = 9, AR5K_CAP_FASTFRAME = 10, AR5K_CAP_TXPOW = 11, AR5K_CAP_TPC = 12,
  AR5K_CAP_BSSIDMASK = 13, AR5K_CAP_MCAST_KEYSRCH = 14, AR5K_CAP_TSF_ADJUST = 15, AR5K_CAP_XR = 16,
  AR5K_CAP_WME_TKIPMIC = 17, AR5K_CAP_CHAN_HALFRATE = 18, AR5K_CAP_CHAN_QUARTERRATE = 19, AR5K_CAP_RFSILENT = 20
}
 

Functions

 FILE_LICENCE (MIT)
 
 FILE_SECBOOT (FORBIDDEN)
 
int ath5k_bitrate_to_hw_rix (int bitrate)
 
int ath5k_hw_attach (struct ath5k_softc *sc, u8 mac_version, struct ath5k_hw **ah)
 ath5k_hw_attach - Check if hw is supported and init the needed structs More...
 
void ath5k_hw_detach (struct ath5k_hw *ah)
 ath5k_hw_detach - Free the ath5k_hw struct More...
 
int ath5k_init_leds (struct ath5k_softc *sc)
 
void ath5k_led_enable (struct ath5k_softc *sc)
 
void ath5k_led_off (struct ath5k_softc *sc)
 
void ath5k_unregister_leds (struct ath5k_softc *sc)
 
int ath5k_hw_nic_wakeup (struct ath5k_hw *ah, int flags, int initial)
 
int ath5k_hw_reset (struct ath5k_hw *ah, struct net80211_channel *channel, int change_channel)
 
int ath5k_hw_set_power (struct ath5k_hw *ah, enum ath5k_power_mode mode, int set_chip, u16 sleep_duration)
 
void ath5k_hw_start_rx_dma (struct ath5k_hw *ah)
 ath5k_hw_start_rx_dma - Start DMA receive More...
 
int ath5k_hw_stop_rx_dma (struct ath5k_hw *ah)
 ath5k_hw_stop_rx_dma - Stop DMA receive More...
 
u32 ath5k_hw_get_rxdp (struct ath5k_hw *ah)
 ath5k_hw_get_rxdp - Get RX Descriptor's address More...
 
void ath5k_hw_set_rxdp (struct ath5k_hw *ah, u32 phys_addr)
 ath5k_hw_set_rxdp - Set RX Descriptor's address More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
int ath5k_hw_update_tx_triglevel (struct ath5k_hw *ah, int increase)
 ath5k_hw_update_tx_triglevel - Update tx trigger level More...
 
int ath5k_hw_is_intr_pending (struct ath5k_hw *ah)
 ath5k_hw_is_intr_pending - Check if we have pending interrupts More...
 
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 More...
 
int ath5k_eeprom_init (struct ath5k_hw *ah)
 
void ath5k_eeprom_detach (struct ath5k_hw *ah)
 
int ath5k_eeprom_read_mac (struct ath5k_hw *ah, u8 *mac)
 
int ath5k_eeprom_is_hb63 (struct ath5k_hw *ah)
 
int ath5k_hw_set_opmode (struct ath5k_hw *ah)
 ath5k_hw_set_opmode - Set PCU operating mode More...
 
void ath5k_hw_get_lladdr (struct ath5k_hw *ah, u8 *mac)
 ath5k_hw_get_lladdr - Get station id More...
 
int ath5k_hw_set_lladdr (struct ath5k_hw *ah, const u8 *mac)
 ath5k_hw_set_lladdr - Set station id More...
 
void ath5k_hw_set_associd (struct ath5k_hw *ah, const u8 *bssid, u16 assoc_id)
 ath5k_hw_set_associd - Set BSSID for association More...
 
int ath5k_hw_set_bssid_mask (struct ath5k_hw *ah, const u8 *mask)
 ath5k_hw_set_bssid_mask - filter out bssids we listen More...
 
void ath5k_hw_start_rx_pcu (struct ath5k_hw *ah)
 ath5k_hw_start_rx_pcu - Start RX engine More...
 
void ath5k_hw_stop_rx_pcu (struct ath5k_hw *ah)
 at5k_hw_stop_rx_pcu - Stop RX engine More...
 
void ath5k_hw_set_mcast_filter (struct ath5k_hw *ah, u32 filter0, u32 filter1)
 
u32 ath5k_hw_get_rx_filter (struct ath5k_hw *ah)
 ath5k_hw_get_rx_filter - Get current rx filter More...
 
void ath5k_hw_set_rx_filter (struct ath5k_hw *ah, u32 filter)
 ath5k_hw_set_rx_filter - Set rx filter More...
 
void ath5k_hw_set_ack_bitrate_high (struct ath5k_hw *ah, int high)
 ath5k_hw_set_ack_bitrate - set bitrate for ACKs More...
 
int ath5k_hw_set_ack_timeout (struct ath5k_hw *ah, unsigned int timeout)
 ath5k_hw_set_ack_timeout - Set ACK timeout on PCU More...
 
unsigned int ath5k_hw_get_ack_timeout (struct ath5k_hw *ah)
 ath5k_hw_het_ack_timeout - Get ACK timeout from PCU in usec More...
 
int ath5k_hw_set_cts_timeout (struct ath5k_hw *ah, unsigned int timeout)
 ath5k_hw_set_cts_timeout - Set CTS timeout on PCU More...
 
unsigned int ath5k_hw_get_cts_timeout (struct ath5k_hw *ah)
 ath5k_hw_get_cts_timeout - Get CTS timeout from PCU in usec More...
 
int ath5k_hw_reset_key (struct ath5k_hw *ah, u16 entry)
 
int ath5k_hw_set_tx_queueprops (struct ath5k_hw *ah, const struct ath5k_txq_info *queue_info)
 
int ath5k_hw_setup_tx_queue (struct ath5k_hw *ah, enum ath5k_tx_queue queue_type, struct ath5k_txq_info *queue_info)
 
u32 ath5k_hw_num_tx_pending (struct ath5k_hw *ah)
 
void ath5k_hw_release_tx_queue (struct ath5k_hw *ah)
 
int ath5k_hw_reset_tx_queue (struct ath5k_hw *ah)
 
int ath5k_hw_set_slot_time (struct ath5k_hw *ah, unsigned int slot_time)
 
int ath5k_hw_init_desc_functions (struct ath5k_hw *ah)
 
int ath5k_hw_set_gpio_input (struct ath5k_hw *ah, u32 gpio)
 
int ath5k_hw_set_gpio_output (struct ath5k_hw *ah, u32 gpio)
 
u32 ath5k_hw_get_gpio (struct ath5k_hw *ah, u32 gpio)
 
int ath5k_hw_set_gpio (struct ath5k_hw *ah, u32 gpio, u32 val)
 
void ath5k_hw_set_gpio_intr (struct ath5k_hw *ah, unsigned int gpio, u32 interrupt_level)
 
void ath5k_rfkill_hw_start (struct ath5k_hw *ah)
 
void ath5k_rfkill_hw_stop (struct ath5k_hw *ah)
 
int ath5k_hw_set_capabilities (struct ath5k_hw *ah)
 
int ath5k_hw_get_capability (struct ath5k_hw *ah, enum ath5k_capability_type cap_type, u32 capability, u32 *result)
 
int ath5k_hw_enable_pspoll (struct ath5k_hw *ah, u8 *bssid, u16 assoc_id)
 
int ath5k_hw_disable_pspoll (struct ath5k_hw *ah)
 
int ath5k_hw_write_initvals (struct ath5k_hw *ah, u8 mode, int change_channel)
 
int ath5k_hw_rfregs_init (struct ath5k_hw *ah, struct net80211_channel *channel, unsigned int mode)
 
int ath5k_hw_rfgain_init (struct ath5k_hw *ah, unsigned int freq)
 
enum ath5k_rfgain ath5k_hw_gainf_calibrate (struct ath5k_hw *ah)
 
int ath5k_hw_rfgain_opt_init (struct ath5k_hw *ah)
 
int ath5k_channel_ok (struct ath5k_hw *ah, u16 freq, unsigned int flags)
 
int ath5k_hw_channel (struct ath5k_hw *ah, struct net80211_channel *channel)
 
int ath5k_hw_phy_calibrate (struct ath5k_hw *ah, struct net80211_channel *channel)
 
int ath5k_hw_noise_floor_calibration (struct ath5k_hw *ah, short freq)
 ath5k_hw_noise_floor_calibration - perform PHY noise floor calibration More...
 
u16 ath5k_hw_radio_revision (struct ath5k_hw *ah, unsigned int chan)
 
void ath5k_hw_set_def_antenna (struct ath5k_hw *ah, unsigned int ant)
 
unsigned int ath5k_hw_get_def_antenna (struct ath5k_hw *ah)
 
int ath5k_hw_phy_disable (struct ath5k_hw *ah)
 
int ath5k_hw_txpower (struct ath5k_hw *ah, struct net80211_channel *channel, u8 ee_mode, u8 txpower)
 
int ath5k_hw_set_txpower_limit (struct ath5k_hw *ah, u8 ee_mode, u8 txpower)
 
static unsigned int ath5k_hw_htoclock (unsigned int usec, int turbo)
 
static unsigned int ath5k_hw_clocktoh (unsigned int clock, int turbo)
 
static u32 ath5k_hw_reg_read (struct ath5k_hw *ah, u16 reg)
 
static void ath5k_hw_reg_write (struct ath5k_hw *ah, u32 val, u16 reg)
 
static u32 ath5k_hw_bitswap (u32 val, unsigned int bits)
 

Macro Definition Documentation

◆ ERRFILE

#define ERRFILE   ERRFILE_ath5k

Definition at line 37 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5210

#define PCI_DEVICE_ID_ATHEROS_AR5210   0x0007 /* AR5210 */

Definition at line 46 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5311

#define PCI_DEVICE_ID_ATHEROS_AR5311   0x0011 /* AR5311 */

Definition at line 47 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5211

#define PCI_DEVICE_ID_ATHEROS_AR5211   0x0012 /* AR5211 */

Definition at line 48 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5212

#define PCI_DEVICE_ID_ATHEROS_AR5212   0x0013 /* AR5212 */

Definition at line 49 of file ath5k.h.

◆ PCI_DEVICE_ID_3COM_3CRDAG675

#define PCI_DEVICE_ID_3COM_3CRDAG675   0x0013 /* 3CRDAG675 (Atheros AR5212) */

Definition at line 50 of file ath5k.h.

◆ PCI_DEVICE_ID_3COM_2_3CRPAG175

#define PCI_DEVICE_ID_3COM_2_3CRPAG175   0x0013 /* 3CRPAG175 (Atheros AR5212) */

Definition at line 51 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5210_AP

#define PCI_DEVICE_ID_ATHEROS_AR5210_AP   0x0207 /* AR5210 (Early) */

Definition at line 52 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5212_IBM

#define PCI_DEVICE_ID_ATHEROS_AR5212_IBM   0x1014 /* AR5212 (IBM MiniPCI) */

Definition at line 53 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5210_DEFAULT

#define PCI_DEVICE_ID_ATHEROS_AR5210_DEFAULT   0x1107 /* AR5210 (no eeprom) */

Definition at line 54 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5212_DEFAULT

#define PCI_DEVICE_ID_ATHEROS_AR5212_DEFAULT   0x1113 /* AR5212 (no eeprom) */

Definition at line 55 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5211_DEFAULT

#define PCI_DEVICE_ID_ATHEROS_AR5211_DEFAULT   0x1112 /* AR5211 (no eeprom) */

Definition at line 56 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5212_FPGA

#define PCI_DEVICE_ID_ATHEROS_AR5212_FPGA   0xf013 /* AR5212 (emulation board) */

Definition at line 57 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5211_LEGACY

#define PCI_DEVICE_ID_ATHEROS_AR5211_LEGACY   0xff12 /* AR5211 (emulation board) */

Definition at line 58 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5211_FPGA11B

#define PCI_DEVICE_ID_ATHEROS_AR5211_FPGA11B   0xf11b /* AR5211 (emulation board) */

Definition at line 59 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5312_REV2

#define PCI_DEVICE_ID_ATHEROS_AR5312_REV2   0x0052 /* AR5312 WMAC (AP31) */

Definition at line 60 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5312_REV7

#define PCI_DEVICE_ID_ATHEROS_AR5312_REV7   0x0057 /* AR5312 WMAC (AP30-040) */

Definition at line 61 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5312_REV8

#define PCI_DEVICE_ID_ATHEROS_AR5312_REV8   0x0058 /* AR5312 WMAC (AP43-030) */

Definition at line 62 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5212_0014

#define PCI_DEVICE_ID_ATHEROS_AR5212_0014   0x0014 /* AR5212 compatible */

Definition at line 63 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5212_0015

#define PCI_DEVICE_ID_ATHEROS_AR5212_0015   0x0015 /* AR5212 compatible */

Definition at line 64 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5212_0016

#define PCI_DEVICE_ID_ATHEROS_AR5212_0016   0x0016 /* AR5212 compatible */

Definition at line 65 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5212_0017

#define PCI_DEVICE_ID_ATHEROS_AR5212_0017   0x0017 /* AR5212 compatible */

Definition at line 66 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5212_0018

#define PCI_DEVICE_ID_ATHEROS_AR5212_0018   0x0018 /* AR5212 compatible */

Definition at line 67 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5212_0019

#define PCI_DEVICE_ID_ATHEROS_AR5212_0019   0x0019 /* AR5212 compatible */

Definition at line 68 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR2413

#define PCI_DEVICE_ID_ATHEROS_AR2413   0x001a /* AR2413 (Griffin-lite) */

Definition at line 69 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5413

#define PCI_DEVICE_ID_ATHEROS_AR5413   0x001b /* AR5413 (Eagle) */

Definition at line 70 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5424

#define PCI_DEVICE_ID_ATHEROS_AR5424   0x001c /* AR5424 (Condor PCI-E) */

Definition at line 71 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5416

#define PCI_DEVICE_ID_ATHEROS_AR5416   0x0023 /* AR5416 */

Definition at line 72 of file ath5k.h.

◆ PCI_DEVICE_ID_ATHEROS_AR5418

#define PCI_DEVICE_ID_ATHEROS_AR5418   0x0024 /* AR5418 */

Definition at line 73 of file ath5k.h.

◆ AR5K_REG_SM

#define AR5K_REG_SM (   _val,
  _flags 
)    (((_val) << _flags##_S) & (_flags))

Definition at line 86 of file ath5k.h.

◆ AR5K_REG_MS

#define AR5K_REG_MS (   _val,
  _flags 
)    (((_val) & (_flags)) >> _flags##_S)

Definition at line 90 of file ath5k.h.

◆ AR5K_REG_WRITE_BITS

#define AR5K_REG_WRITE_BITS (   ah,
  _reg,
  _flags,
  _val 
)
Value:
ath5k_hw_reg_write(ah, (ath5k_hw_reg_read(ah, _reg) & ~(_flags)) | \
(((_val) << _flags##_S) & (_flags)), _reg)
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216

Definition at line 98 of file ath5k.h.

◆ AR5K_REG_MASKED_BITS

#define AR5K_REG_MASKED_BITS (   ah,
  _reg,
  _flags,
  _mask 
)
Value:
(_mask)) | (_flags), _reg)
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216

Definition at line 102 of file ath5k.h.

◆ AR5K_REG_ENABLE_BITS

#define AR5K_REG_ENABLE_BITS (   ah,
  _reg,
  _flags 
)    ath5k_hw_reg_write(ah, ath5k_hw_reg_read(ah, _reg) | (_flags), _reg)

Definition at line 106 of file ath5k.h.

◆ AR5K_REG_DISABLE_BITS

#define AR5K_REG_DISABLE_BITS (   ah,
  _reg,
  _flags 
)    ath5k_hw_reg_write(ah, ath5k_hw_reg_read(ah, _reg) & ~(_flags), _reg)

Definition at line 109 of file ath5k.h.

◆ AR5K_PHY_READ

#define AR5K_PHY_READ (   ah,
  _reg 
)    ath5k_hw_reg_read(ah, (ah)->ah_phy + ((_reg) << 2))

Definition at line 113 of file ath5k.h.

◆ AR5K_PHY_WRITE

#define AR5K_PHY_WRITE (   ah,
  _reg,
  _val 
)    ath5k_hw_reg_write(ah, _val, (ah)->ah_phy + ((_reg) << 2))

Definition at line 116 of file ath5k.h.

◆ AR5K_REG_READ_Q

#define AR5K_REG_READ_Q (   ah,
  _reg,
  _queue 
)    (ath5k_hw_reg_read(ah, _reg) & (1 << _queue)) \

Definition at line 120 of file ath5k.h.

◆ AR5K_REG_WRITE_Q

#define AR5K_REG_WRITE_Q (   ah,
  _reg,
  _queue 
)    ath5k_hw_reg_write(ah, (1 << _queue), _reg)

Definition at line 123 of file ath5k.h.

◆ AR5K_Q_ENABLE_BITS

#define AR5K_Q_ENABLE_BITS (   _reg,
  _queue 
)
Value:
do { \
_reg |= 1 << _queue; \
} while (0)

Definition at line 126 of file ath5k.h.

◆ AR5K_Q_DISABLE_BITS

#define AR5K_Q_DISABLE_BITS (   _reg,
  _queue 
)
Value:
do { \
_reg &= ~(1 << _queue); \
} while (0)

Definition at line 130 of file ath5k.h.

◆ AR5K_REG_WAIT

#define AR5K_REG_WAIT (   _i)
Value:
do { \
if (_i % 64) \
udelay(1); \
} while (0)

Definition at line 135 of file ath5k.h.

◆ AR5K_INI_RFGAIN_5GHZ

#define AR5K_INI_RFGAIN_5GHZ   0

Definition at line 141 of file ath5k.h.

◆ AR5K_INI_RFGAIN_2GHZ

#define AR5K_INI_RFGAIN_2GHZ   1

Definition at line 142 of file ath5k.h.

◆ AR5K_INI_VAL_11A

#define AR5K_INI_VAL_11A   0

Definition at line 145 of file ath5k.h.

◆ AR5K_INI_VAL_11A_TURBO

#define AR5K_INI_VAL_11A_TURBO   1

Definition at line 146 of file ath5k.h.

◆ AR5K_INI_VAL_11B

#define AR5K_INI_VAL_11B   2

Definition at line 147 of file ath5k.h.

◆ AR5K_INI_VAL_11G

#define AR5K_INI_VAL_11G   3

Definition at line 148 of file ath5k.h.

◆ AR5K_INI_VAL_11G_TURBO

#define AR5K_INI_VAL_11G_TURBO   4

Definition at line 149 of file ath5k.h.

◆ AR5K_INI_VAL_XR

#define AR5K_INI_VAL_XR   0

Definition at line 150 of file ath5k.h.

◆ AR5K_INI_VAL_MAX

#define AR5K_INI_VAL_MAX   5

Definition at line 151 of file ath5k.h.

◆ AR5K_LOW_ID

#define AR5K_LOW_ID (   _a)
Value:
( \
(_a)[0] | (_a)[1] << 8 | (_a)[2] << 16 | (_a)[3] << 24 \
)

Definition at line 154 of file ath5k.h.

◆ AR5K_HIGH_ID

#define AR5K_HIGH_ID (   _a)    ((_a)[4] | (_a)[5] << 8)

Definition at line 158 of file ath5k.h.

◆ IEEE80211_MAX_LEN

#define IEEE80211_MAX_LEN   2352

Definition at line 160 of file ath5k.h.

◆ AR5K_TUNE_DMA_BEACON_RESP

#define AR5K_TUNE_DMA_BEACON_RESP   2

Definition at line 165 of file ath5k.h.

◆ AR5K_TUNE_SW_BEACON_RESP

#define AR5K_TUNE_SW_BEACON_RESP   10

Definition at line 166 of file ath5k.h.

◆ AR5K_TUNE_ADDITIONAL_SWBA_BACKOFF

#define AR5K_TUNE_ADDITIONAL_SWBA_BACKOFF   0

Definition at line 167 of file ath5k.h.

◆ AR5K_TUNE_RADAR_ALERT

#define AR5K_TUNE_RADAR_ALERT   0

Definition at line 168 of file ath5k.h.

◆ AR5K_TUNE_MIN_TX_FIFO_THRES

#define AR5K_TUNE_MIN_TX_FIFO_THRES   1

Definition at line 169 of file ath5k.h.

◆ AR5K_TUNE_MAX_TX_FIFO_THRES

#define AR5K_TUNE_MAX_TX_FIFO_THRES   ((IEEE80211_MAX_LEN / 64) + 1)

Definition at line 170 of file ath5k.h.

◆ AR5K_TUNE_REGISTER_TIMEOUT

#define AR5K_TUNE_REGISTER_TIMEOUT   20000

Definition at line 171 of file ath5k.h.

◆ AR5K_TUNE_RSSI_THRES

#define AR5K_TUNE_RSSI_THRES   129

Definition at line 174 of file ath5k.h.

◆ AR5K_TUNE_BMISS_THRES

#define AR5K_TUNE_BMISS_THRES   7

Definition at line 180 of file ath5k.h.

◆ AR5K_TUNE_REGISTER_DWELL_TIME

#define AR5K_TUNE_REGISTER_DWELL_TIME   20000

Definition at line 181 of file ath5k.h.

◆ AR5K_TUNE_BEACON_INTERVAL

#define AR5K_TUNE_BEACON_INTERVAL   100

Definition at line 182 of file ath5k.h.

◆ AR5K_TUNE_AIFS

#define AR5K_TUNE_AIFS   2

Definition at line 183 of file ath5k.h.

◆ AR5K_TUNE_AIFS_11B

#define AR5K_TUNE_AIFS_11B   2

Definition at line 184 of file ath5k.h.

◆ AR5K_TUNE_AIFS_XR

#define AR5K_TUNE_AIFS_XR   0

Definition at line 185 of file ath5k.h.

◆ AR5K_TUNE_CWMIN

#define AR5K_TUNE_CWMIN   15

Definition at line 186 of file ath5k.h.

◆ AR5K_TUNE_CWMIN_11B

#define AR5K_TUNE_CWMIN_11B   31

Definition at line 187 of file ath5k.h.

◆ AR5K_TUNE_CWMIN_XR

#define AR5K_TUNE_CWMIN_XR   3

Definition at line 188 of file ath5k.h.

◆ AR5K_TUNE_CWMAX

#define AR5K_TUNE_CWMAX   1023

Definition at line 189 of file ath5k.h.

◆ AR5K_TUNE_CWMAX_11B

#define AR5K_TUNE_CWMAX_11B   1023

Definition at line 190 of file ath5k.h.

◆ AR5K_TUNE_CWMAX_XR

#define AR5K_TUNE_CWMAX_XR   7

Definition at line 191 of file ath5k.h.

◆ AR5K_TUNE_NOISE_FLOOR

#define AR5K_TUNE_NOISE_FLOOR   -72

Definition at line 192 of file ath5k.h.

◆ AR5K_TUNE_MAX_TXPOWER

#define AR5K_TUNE_MAX_TXPOWER   63

Definition at line 193 of file ath5k.h.

◆ AR5K_TUNE_DEFAULT_TXPOWER

#define AR5K_TUNE_DEFAULT_TXPOWER   25

Definition at line 194 of file ath5k.h.

◆ AR5K_TUNE_TPC_TXPOWER

#define AR5K_TUNE_TPC_TXPOWER   0

Definition at line 195 of file ath5k.h.

◆ AR5K_TUNE_ANT_DIVERSITY

#define AR5K_TUNE_ANT_DIVERSITY   1

Definition at line 196 of file ath5k.h.

◆ AR5K_TUNE_HWTXTRIES

#define AR5K_TUNE_HWTXTRIES   4

Definition at line 197 of file ath5k.h.

◆ AR5K_INIT_CARR_SENSE_EN

#define AR5K_INIT_CARR_SENSE_EN   1

Definition at line 199 of file ath5k.h.

◆ AR5K_INIT_CFG

#define AR5K_INIT_CFG   0x00000000

Definition at line 207 of file ath5k.h.

◆ AR5K_INIT_CYCRSSI_THR1

#define AR5K_INIT_CYCRSSI_THR1   2

Definition at line 211 of file ath5k.h.

◆ AR5K_INIT_TX_LATENCY

#define AR5K_INIT_TX_LATENCY   502

Definition at line 212 of file ath5k.h.

◆ AR5K_INIT_USEC

#define AR5K_INIT_USEC   39

Definition at line 213 of file ath5k.h.

◆ AR5K_INIT_USEC_TURBO

#define AR5K_INIT_USEC_TURBO   79

Definition at line 214 of file ath5k.h.

◆ AR5K_INIT_USEC_32

#define AR5K_INIT_USEC_32   31

Definition at line 215 of file ath5k.h.

◆ AR5K_INIT_SLOT_TIME

#define AR5K_INIT_SLOT_TIME   396

Definition at line 216 of file ath5k.h.

◆ AR5K_INIT_SLOT_TIME_TURBO

#define AR5K_INIT_SLOT_TIME_TURBO   480

Definition at line 217 of file ath5k.h.

◆ AR5K_INIT_ACK_CTS_TIMEOUT

#define AR5K_INIT_ACK_CTS_TIMEOUT   1024

Definition at line 218 of file ath5k.h.

◆ AR5K_INIT_ACK_CTS_TIMEOUT_TURBO

#define AR5K_INIT_ACK_CTS_TIMEOUT_TURBO   0x08000800

Definition at line 219 of file ath5k.h.

◆ AR5K_INIT_PROG_IFS

#define AR5K_INIT_PROG_IFS   920

Definition at line 220 of file ath5k.h.

◆ AR5K_INIT_PROG_IFS_TURBO

#define AR5K_INIT_PROG_IFS_TURBO   960

Definition at line 221 of file ath5k.h.

◆ AR5K_INIT_EIFS

#define AR5K_INIT_EIFS   3440

Definition at line 222 of file ath5k.h.

◆ AR5K_INIT_EIFS_TURBO

#define AR5K_INIT_EIFS_TURBO   6880

Definition at line 223 of file ath5k.h.

◆ AR5K_INIT_SIFS

#define AR5K_INIT_SIFS   560

Definition at line 224 of file ath5k.h.

◆ AR5K_INIT_SIFS_TURBO

#define AR5K_INIT_SIFS_TURBO   480

Definition at line 225 of file ath5k.h.

◆ AR5K_INIT_SH_RETRY

#define AR5K_INIT_SH_RETRY   10

Definition at line 226 of file ath5k.h.

◆ AR5K_INIT_LG_RETRY

#define AR5K_INIT_LG_RETRY   AR5K_INIT_SH_RETRY

Definition at line 227 of file ath5k.h.

◆ AR5K_INIT_SSH_RETRY

#define AR5K_INIT_SSH_RETRY   32

Definition at line 228 of file ath5k.h.

◆ AR5K_INIT_SLG_RETRY

#define AR5K_INIT_SLG_RETRY   AR5K_INIT_SSH_RETRY

Definition at line 229 of file ath5k.h.

◆ AR5K_INIT_TX_RETRY

#define AR5K_INIT_TX_RETRY   10

Definition at line 230 of file ath5k.h.

◆ AR5K_INIT_TRANSMIT_LATENCY

#define AR5K_INIT_TRANSMIT_LATENCY
Value:
( \
)
#define AR5K_INIT_USEC
Definition: ath5k.h:213
#define AR5K_INIT_TX_LATENCY
Definition: ath5k.h:212
#define AR5K_INIT_USEC_32
Definition: ath5k.h:215

Definition at line 232 of file ath5k.h.

◆ AR5K_INIT_TRANSMIT_LATENCY_TURBO

#define AR5K_INIT_TRANSMIT_LATENCY_TURBO
Value:
( \
)
#define AR5K_INIT_USEC_TURBO
Definition: ath5k.h:214
#define AR5K_INIT_TX_LATENCY
Definition: ath5k.h:212
#define AR5K_INIT_USEC_32
Definition: ath5k.h:215

Definition at line 236 of file ath5k.h.

◆ AR5K_INIT_PROTO_TIME_CNTRL

#define AR5K_INIT_PROTO_TIME_CNTRL
Value:
( \
)
#define AR5K_INIT_CARR_SENSE_EN
Definition: ath5k.h:199
#define AR5K_INIT_EIFS
Definition: ath5k.h:222
#define AR5K_INIT_PROG_IFS
Definition: ath5k.h:220

Definition at line 240 of file ath5k.h.

◆ AR5K_INIT_PROTO_TIME_CNTRL_TURBO

#define AR5K_INIT_PROTO_TIME_CNTRL_TURBO
Value:
( \
)
#define AR5K_INIT_PROG_IFS_TURBO
Definition: ath5k.h:221
#define AR5K_INIT_EIFS_TURBO
Definition: ath5k.h:223
#define AR5K_INIT_CARR_SENSE_EN
Definition: ath5k.h:199

Definition at line 244 of file ath5k.h.

◆ AR5K_TXQ_USEDEFAULT

#define AR5K_TXQ_USEDEFAULT   ((u32) -1)

Definition at line 250 of file ath5k.h.

◆ AR5K_SREV_UNKNOWN

#define AR5K_SREV_UNKNOWN   0xffff

Definition at line 288 of file ath5k.h.

◆ AR5K_SREV_AR5210

#define AR5K_SREV_AR5210   0x00 /* Crete */

Definition at line 290 of file ath5k.h.

◆ AR5K_SREV_AR5311

#define AR5K_SREV_AR5311   0x10 /* Maui 1 */

Definition at line 291 of file ath5k.h.

◆ AR5K_SREV_AR5311A

#define AR5K_SREV_AR5311A   0x20 /* Maui 2 */

Definition at line 292 of file ath5k.h.

◆ AR5K_SREV_AR5311B

#define AR5K_SREV_AR5311B   0x30 /* Spirit */

Definition at line 293 of file ath5k.h.

◆ AR5K_SREV_AR5211

#define AR5K_SREV_AR5211   0x40 /* Oahu */

Definition at line 294 of file ath5k.h.

◆ AR5K_SREV_AR5212

#define AR5K_SREV_AR5212   0x50 /* Venice */

Definition at line 295 of file ath5k.h.

◆ AR5K_SREV_AR5213

#define AR5K_SREV_AR5213   0x55 /* ??? */

Definition at line 296 of file ath5k.h.

◆ AR5K_SREV_AR5213A

#define AR5K_SREV_AR5213A   0x59 /* Hainan */

Definition at line 297 of file ath5k.h.

◆ AR5K_SREV_AR2413

#define AR5K_SREV_AR2413   0x78 /* Griffin lite */

Definition at line 298 of file ath5k.h.

◆ AR5K_SREV_AR2414

#define AR5K_SREV_AR2414   0x70 /* Griffin */

Definition at line 299 of file ath5k.h.

◆ AR5K_SREV_AR5424

#define AR5K_SREV_AR5424   0x90 /* Condor */

Definition at line 300 of file ath5k.h.

◆ AR5K_SREV_AR5413

#define AR5K_SREV_AR5413   0xa4 /* Eagle lite */

Definition at line 301 of file ath5k.h.

◆ AR5K_SREV_AR5414

#define AR5K_SREV_AR5414   0xa0 /* Eagle */

Definition at line 302 of file ath5k.h.

◆ AR5K_SREV_AR2415

#define AR5K_SREV_AR2415   0xb0 /* Talon */

Definition at line 303 of file ath5k.h.

◆ AR5K_SREV_AR5416

#define AR5K_SREV_AR5416   0xc0 /* PCI-E */

Definition at line 304 of file ath5k.h.

◆ AR5K_SREV_AR5418

#define AR5K_SREV_AR5418   0xca /* PCI-E */

Definition at line 305 of file ath5k.h.

◆ AR5K_SREV_AR2425

#define AR5K_SREV_AR2425   0xe0 /* Swan */

Definition at line 306 of file ath5k.h.

◆ AR5K_SREV_AR2417

#define AR5K_SREV_AR2417   0xf0 /* Nala */

Definition at line 307 of file ath5k.h.

◆ AR5K_SREV_RAD_5110

#define AR5K_SREV_RAD_5110   0x00

Definition at line 309 of file ath5k.h.

◆ AR5K_SREV_RAD_5111

#define AR5K_SREV_RAD_5111   0x10

Definition at line 310 of file ath5k.h.

◆ AR5K_SREV_RAD_5111A

#define AR5K_SREV_RAD_5111A   0x15

Definition at line 311 of file ath5k.h.

◆ AR5K_SREV_RAD_2111

#define AR5K_SREV_RAD_2111   0x20

Definition at line 312 of file ath5k.h.

◆ AR5K_SREV_RAD_5112

#define AR5K_SREV_RAD_5112   0x30

Definition at line 313 of file ath5k.h.

◆ AR5K_SREV_RAD_5112A

#define AR5K_SREV_RAD_5112A   0x35

Definition at line 314 of file ath5k.h.

◆ AR5K_SREV_RAD_5112B

#define AR5K_SREV_RAD_5112B   0x36

Definition at line 315 of file ath5k.h.

◆ AR5K_SREV_RAD_2112

#define AR5K_SREV_RAD_2112   0x40

Definition at line 316 of file ath5k.h.

◆ AR5K_SREV_RAD_2112A

#define AR5K_SREV_RAD_2112A   0x45

Definition at line 317 of file ath5k.h.

◆ AR5K_SREV_RAD_2112B

#define AR5K_SREV_RAD_2112B   0x46

Definition at line 318 of file ath5k.h.

◆ AR5K_SREV_RAD_2413

#define AR5K_SREV_RAD_2413   0x50

Definition at line 319 of file ath5k.h.

◆ AR5K_SREV_RAD_5413

#define AR5K_SREV_RAD_5413   0x60

Definition at line 320 of file ath5k.h.

◆ AR5K_SREV_RAD_2316

#define AR5K_SREV_RAD_2316   0x70 /* Cobra SoC */

Definition at line 321 of file ath5k.h.

◆ AR5K_SREV_RAD_2317

#define AR5K_SREV_RAD_2317   0x80

Definition at line 322 of file ath5k.h.

◆ AR5K_SREV_RAD_5424

#define AR5K_SREV_RAD_5424   0xa0 /* Mostly same as 5413 */

Definition at line 323 of file ath5k.h.

◆ AR5K_SREV_RAD_2425

#define AR5K_SREV_RAD_2425   0xa2

Definition at line 324 of file ath5k.h.

◆ AR5K_SREV_RAD_5133

#define AR5K_SREV_RAD_5133   0xc0

Definition at line 325 of file ath5k.h.

◆ AR5K_SREV_PHY_5211

#define AR5K_SREV_PHY_5211   0x30

Definition at line 327 of file ath5k.h.

◆ AR5K_SREV_PHY_5212

#define AR5K_SREV_PHY_5212   0x41

Definition at line 328 of file ath5k.h.

◆ AR5K_SREV_PHY_5212A

#define AR5K_SREV_PHY_5212A   0x42

Definition at line 329 of file ath5k.h.

◆ AR5K_SREV_PHY_5212B

#define AR5K_SREV_PHY_5212B   0x43

Definition at line 330 of file ath5k.h.

◆ AR5K_SREV_PHY_2413

#define AR5K_SREV_PHY_2413   0x45

Definition at line 331 of file ath5k.h.

◆ AR5K_SREV_PHY_5413

#define AR5K_SREV_PHY_5413   0x61

Definition at line 332 of file ath5k.h.

◆ AR5K_SREV_PHY_2425

#define AR5K_SREV_PHY_2425   0x70

Definition at line 333 of file ath5k.h.

◆ MODULATION_XR

#define MODULATION_XR   0x00000200

Definition at line 351 of file ath5k.h.

◆ MODULATION_TURBO

#define MODULATION_TURBO   0x00000080

Definition at line 391 of file ath5k.h.

◆ AR5K_TXSTAT_ALTRATE

#define AR5K_TXSTAT_ALTRATE   0x80

Definition at line 432 of file ath5k.h.

◆ AR5K_TXERR_XRETRY

#define AR5K_TXERR_XRETRY   0x01

Definition at line 433 of file ath5k.h.

◆ AR5K_TXERR_FILT

#define AR5K_TXERR_FILT   0x02

Definition at line 434 of file ath5k.h.

◆ AR5K_TXERR_FIFO

#define AR5K_TXERR_FIFO   0x04

Definition at line 435 of file ath5k.h.

◆ AR5K_TXQ_FLAG_TXOKINT_ENABLE

#define AR5K_TXQ_FLAG_TXOKINT_ENABLE   0x0001 /* Enable TXOK interrupt */

Definition at line 490 of file ath5k.h.

◆ AR5K_TXQ_FLAG_TXERRINT_ENABLE

#define AR5K_TXQ_FLAG_TXERRINT_ENABLE   0x0002 /* Enable TXERR interrupt */

Definition at line 491 of file ath5k.h.

◆ AR5K_TXQ_FLAG_TXEOLINT_ENABLE

#define AR5K_TXQ_FLAG_TXEOLINT_ENABLE   0x0004 /* Enable TXEOL interrupt -not used- */

Definition at line 492 of file ath5k.h.

◆ AR5K_TXQ_FLAG_TXDESCINT_ENABLE

#define AR5K_TXQ_FLAG_TXDESCINT_ENABLE   0x0008 /* Enable TXDESC interrupt -not used- */

Definition at line 493 of file ath5k.h.

◆ AR5K_TXQ_FLAG_TXURNINT_ENABLE

#define AR5K_TXQ_FLAG_TXURNINT_ENABLE   0x0010 /* Enable TXURN interrupt */

Definition at line 494 of file ath5k.h.

◆ AR5K_TXQ_FLAG_CBRORNINT_ENABLE

#define AR5K_TXQ_FLAG_CBRORNINT_ENABLE   0x0020 /* Enable CBRORN interrupt */

Definition at line 495 of file ath5k.h.

◆ AR5K_TXQ_FLAG_CBRURNINT_ENABLE

#define AR5K_TXQ_FLAG_CBRURNINT_ENABLE   0x0040 /* Enable CBRURN interrupt */

Definition at line 496 of file ath5k.h.

◆ AR5K_TXQ_FLAG_QTRIGINT_ENABLE

#define AR5K_TXQ_FLAG_QTRIGINT_ENABLE   0x0080 /* Enable QTRIG interrupt */

Definition at line 497 of file ath5k.h.

◆ AR5K_TXQ_FLAG_TXNOFRMINT_ENABLE

#define AR5K_TXQ_FLAG_TXNOFRMINT_ENABLE   0x0100 /* Enable TXNOFRM interrupt */

Definition at line 498 of file ath5k.h.

◆ AR5K_TXQ_FLAG_BACKOFF_DISABLE

#define AR5K_TXQ_FLAG_BACKOFF_DISABLE   0x0200 /* Disable random post-backoff */

Definition at line 499 of file ath5k.h.

◆ AR5K_TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE

#define AR5K_TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE   0x0300 /* Enable ready time expiry policy (?)*/

Definition at line 500 of file ath5k.h.

◆ AR5K_TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE

#define AR5K_TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE   0x0800 /* Enable backoff while bursting */

Definition at line 501 of file ath5k.h.

◆ AR5K_TXQ_FLAG_POST_FR_BKOFF_DIS

#define AR5K_TXQ_FLAG_POST_FR_BKOFF_DIS   0x1000 /* Disable backoff while bursting */

Definition at line 502 of file ath5k.h.

◆ AR5K_TXQ_FLAG_COMPRESSION_ENABLE

#define AR5K_TXQ_FLAG_COMPRESSION_ENABLE   0x2000 /* Enable hw compression -not implemented-*/

Definition at line 503 of file ath5k.h.

◆ AR5K_TXPOWER_OFDM

#define AR5K_TXPOWER_OFDM (   _r,
  _v 
)
Value:
( \
((0 & 1) << ((_v) + 6)) | \
(((ah->ah_txpower.txp_rates_power_table[(_r)]) & 0x3f) << (_v)) \
)
uint8_t ah
Definition: registers.h:85

Definition at line 538 of file ath5k.h.

◆ AR5K_TXPOWER_CCK

#define AR5K_TXPOWER_CCK (   _r,
  _v 
)
Value:
( \
(ah->ah_txpower.txp_rates_power_table[(_r)] & 0x3f) << (_v) \
)
uint8_t ah
Definition: registers.h:85

Definition at line 543 of file ath5k.h.

◆ AR5K_RXERR_CRC

#define AR5K_RXERR_CRC   0x01

Definition at line 581 of file ath5k.h.

◆ AR5K_RXERR_PHY

#define AR5K_RXERR_PHY   0x02

Definition at line 582 of file ath5k.h.

◆ AR5K_RXERR_FIFO

#define AR5K_RXERR_FIFO   0x04

Definition at line 583 of file ath5k.h.

◆ AR5K_RXERR_DECRYPT

#define AR5K_RXERR_DECRYPT   0x08

Definition at line 584 of file ath5k.h.

◆ AR5K_RXERR_MIC

#define AR5K_RXERR_MIC   0x10

Definition at line 585 of file ath5k.h.

◆ AR5K_RXKEYIX_INVALID

#define AR5K_RXKEYIX_INVALID   ((u8) - 1)

Definition at line 586 of file ath5k.h.

◆ AR5K_TXKEYIX_INVALID

#define AR5K_TXKEYIX_INVALID   ((u32) - 1)

Definition at line 587 of file ath5k.h.

◆ TSF_TO_TU

#define TSF_TO_TU (   _tsf)    (u32)((_tsf) >> 10)

Definition at line 597 of file ath5k.h.

◆ AR5K_SLOT_TIME_9

#define AR5K_SLOT_TIME_9   396

Definition at line 625 of file ath5k.h.

◆ AR5K_SLOT_TIME_20

#define AR5K_SLOT_TIME_20   880

Definition at line 626 of file ath5k.h.

◆ AR5K_SLOT_TIME_MAX

#define AR5K_SLOT_TIME_MAX   0xffff

Definition at line 627 of file ath5k.h.

◆ CHANNEL_CW_INT

#define CHANNEL_CW_INT   0x0008 /* Contention Window interference detected */

Definition at line 630 of file ath5k.h.

◆ CHANNEL_TURBO

#define CHANNEL_TURBO   0x0010 /* Turbo Channel */

Definition at line 631 of file ath5k.h.

◆ CHANNEL_CCK

#define CHANNEL_CCK   0x0020 /* CCK channel */

Definition at line 632 of file ath5k.h.

◆ CHANNEL_OFDM

#define CHANNEL_OFDM   0x0040 /* OFDM channel */

Definition at line 633 of file ath5k.h.

◆ CHANNEL_2GHZ

#define CHANNEL_2GHZ   0x0080 /* 2GHz channel. */

Definition at line 634 of file ath5k.h.

◆ CHANNEL_5GHZ

#define CHANNEL_5GHZ   0x0100 /* 5GHz channel */

Definition at line 635 of file ath5k.h.

◆ CHANNEL_PASSIVE

#define CHANNEL_PASSIVE   0x0200 /* Only passive scan allowed */

Definition at line 636 of file ath5k.h.

◆ CHANNEL_DYN

#define CHANNEL_DYN   0x0400 /* Dynamic CCK-OFDM channel (for g operation) */

Definition at line 637 of file ath5k.h.

◆ CHANNEL_XR

#define CHANNEL_XR   0x0800 /* XR channel */

Definition at line 638 of file ath5k.h.

◆ CHANNEL_A

#define CHANNEL_A   (CHANNEL_5GHZ|CHANNEL_OFDM)

Definition at line 640 of file ath5k.h.

◆ CHANNEL_B

#define CHANNEL_B   (CHANNEL_2GHZ|CHANNEL_CCK)

Definition at line 641 of file ath5k.h.

◆ CHANNEL_G

#define CHANNEL_G   (CHANNEL_2GHZ|CHANNEL_OFDM)

Definition at line 642 of file ath5k.h.

◆ CHANNEL_T

#define CHANNEL_T   (CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_TURBO)

Definition at line 643 of file ath5k.h.

◆ CHANNEL_TG

#define CHANNEL_TG   (CHANNEL_2GHZ|CHANNEL_OFDM|CHANNEL_TURBO)

Definition at line 644 of file ath5k.h.

◆ CHANNEL_108A

#define CHANNEL_108A   CHANNEL_T

Definition at line 645 of file ath5k.h.

◆ CHANNEL_108G

#define CHANNEL_108G   CHANNEL_TG

Definition at line 646 of file ath5k.h.

◆ CHANNEL_X

#define CHANNEL_X   (CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_XR)

Definition at line 647 of file ath5k.h.

◆ CHANNEL_ALL

#define CHANNEL_ALL
Value:
CHANNEL_TURBO)
#define CHANNEL_CCK
Definition: ath5k.h:632
#define CHANNEL_OFDM
Definition: ath5k.h:633
#define CHANNEL_5GHZ
Definition: ath5k.h:635
#define CHANNEL_2GHZ
Definition: ath5k.h:634

Definition at line 649 of file ath5k.h.

◆ CHANNEL_ALL_NOTURBO

#define CHANNEL_ALL_NOTURBO   (CHANNEL_ALL & ~CHANNEL_TURBO)

Definition at line 652 of file ath5k.h.

◆ CHANNEL_MODES

#define CHANNEL_MODES   CHANNEL_ALL

Definition at line 653 of file ath5k.h.

◆ IS_CHAN_XR

#define IS_CHAN_XR (   _c)    ((_c->hw_value & CHANNEL_XR) != 0)

Definition at line 659 of file ath5k.h.

◆ IS_CHAN_B

#define IS_CHAN_B (   _c)    ((_c->hw_value & CHANNEL_B) != 0)

Definition at line 660 of file ath5k.h.

◆ AR5K_MAX_RATES

#define AR5K_MAX_RATES   32

Seems the ar5xxx harware supports up to 32 rates, indexed by 1-32.

The rate code is used to get the RX rate or set the TX rate on the hardware descriptors. It is also used for internal modulation control and settings.

This is the hardware rate map we are aware of:

rate_code 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 rate_kbps 3000 1000 ? ? ? 2000 500 48000

rate_code 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F 0x10 rate_kbps 24000 12000 6000 54000 36000 18000 9000 ?

rate_code 17 18 19 20 21 22 23 24 rate_kbps ? ? ? ? ? ? ? 11000

rate_code 25 26 27 28 29 30 31 32 rate_kbps 5500 2000 1000 11000S 5500S 2000S ? ?

"S" indicates CCK rates with short preamble.

AR5211 has different rate codes for CCK (802.11B) rates. It only uses the lowest 4 bits, so they are the same as below with a 0xF mask. (0xB, 0xA, 0x9 and 0x8 for 1M, 2M, 5.5M and 11M). We handle this in ath5k_setup_bands().

Definition at line 705 of file ath5k.h.

◆ ATH5K_RATE_CODE_1M

#define ATH5K_RATE_CODE_1M   0x1B

Definition at line 708 of file ath5k.h.

◆ ATH5K_RATE_CODE_2M

#define ATH5K_RATE_CODE_2M   0x1A

Definition at line 709 of file ath5k.h.

◆ ATH5K_RATE_CODE_5_5M

#define ATH5K_RATE_CODE_5_5M   0x19

Definition at line 710 of file ath5k.h.

◆ ATH5K_RATE_CODE_11M

#define ATH5K_RATE_CODE_11M   0x18

Definition at line 711 of file ath5k.h.

◆ ATH5K_RATE_CODE_6M

#define ATH5K_RATE_CODE_6M   0x0B

Definition at line 713 of file ath5k.h.

◆ ATH5K_RATE_CODE_9M

#define ATH5K_RATE_CODE_9M   0x0F

Definition at line 714 of file ath5k.h.

◆ ATH5K_RATE_CODE_12M

#define ATH5K_RATE_CODE_12M   0x0A

Definition at line 715 of file ath5k.h.

◆ ATH5K_RATE_CODE_18M

#define ATH5K_RATE_CODE_18M   0x0E

Definition at line 716 of file ath5k.h.

◆ ATH5K_RATE_CODE_24M

#define ATH5K_RATE_CODE_24M   0x09

Definition at line 717 of file ath5k.h.

◆ ATH5K_RATE_CODE_36M

#define ATH5K_RATE_CODE_36M   0x0D

Definition at line 718 of file ath5k.h.

◆ ATH5K_RATE_CODE_48M

#define ATH5K_RATE_CODE_48M   0x08

Definition at line 719 of file ath5k.h.

◆ ATH5K_RATE_CODE_54M

#define ATH5K_RATE_CODE_54M   0x0C

Definition at line 720 of file ath5k.h.

◆ ATH5K_RATE_CODE_XR_500K

#define ATH5K_RATE_CODE_XR_500K   0x07

Definition at line 722 of file ath5k.h.

◆ ATH5K_RATE_CODE_XR_1M

#define ATH5K_RATE_CODE_XR_1M   0x02

Definition at line 723 of file ath5k.h.

◆ ATH5K_RATE_CODE_XR_2M

#define ATH5K_RATE_CODE_XR_2M   0x06

Definition at line 724 of file ath5k.h.

◆ ATH5K_RATE_CODE_XR_3M

#define ATH5K_RATE_CODE_XR_3M   0x01

Definition at line 725 of file ath5k.h.

◆ AR5K_SET_SHORT_PREAMBLE

#define AR5K_SET_SHORT_PREAMBLE   0x04

Definition at line 728 of file ath5k.h.

◆ AR5K_KEYCACHE_SIZE

#define AR5K_KEYCACHE_SIZE   8

Definition at line 734 of file ath5k.h.

◆ AR5K_RSSI_EP_MULTIPLIER

#define AR5K_RSSI_EP_MULTIPLIER   (1<<7)

Definition at line 743 of file ath5k.h.

◆ AR5K_ASSERT_ENTRY

#define AR5K_ASSERT_ENTRY (   _e,
  _s 
)
Value:
do { \
if (_e >= _s) \
return 0; \
} while (0)

Definition at line 745 of file ath5k.h.

◆ AR5K_SOFTLED_PIN

#define AR5K_SOFTLED_PIN   0

Definition at line 877 of file ath5k.h.

◆ AR5K_SOFTLED_ON

#define AR5K_SOFTLED_ON   0

Definition at line 878 of file ath5k.h.

◆ AR5K_SOFTLED_OFF

#define AR5K_SOFTLED_OFF   1

Definition at line 879 of file ath5k.h.

◆ AR5K_MAX_GPIO

#define AR5K_MAX_GPIO   10

Definition at line 951 of file ath5k.h.

◆ AR5K_MAX_RF_BANKS

#define AR5K_MAX_RF_BANKS   8

Definition at line 952 of file ath5k.h.

◆ ah_regdomain

#define ah_regdomain   ah_capabilities.cap_regdomain.reg_current

Definition at line 983 of file ath5k.h.

◆ ah_regdomain_hw

#define ah_regdomain_hw   ah_capabilities.cap_regdomain.reg_hw

Definition at line 984 of file ath5k.h.

◆ ah_modes

#define ah_modes   ah_capabilities.cap_mode

Definition at line 985 of file ath5k.h.

◆ ah_ee_version

#define ah_ee_version   ah_capabilities.cap_eeprom.ee_version

Definition at line 986 of file ath5k.h.

Enumeration Type Documentation

◆ ath5k_version

Enumerator
AR5K_AR5210 
AR5K_AR5211 
AR5K_AR5212 

Definition at line 255 of file ath5k.h.

255  {
256  AR5K_AR5210 = 0,
257  AR5K_AR5211 = 1,
258  AR5K_AR5212 = 2,
259 };

◆ ath5k_radio

Enumerator
AR5K_RF5110 
AR5K_RF5111 
AR5K_RF5112 
AR5K_RF2413 
AR5K_RF5413 
AR5K_RF2316 
AR5K_RF2317 
AR5K_RF2425 

Definition at line 262 of file ath5k.h.

262  {
263  AR5K_RF5110 = 0,
264  AR5K_RF5111 = 1,
265  AR5K_RF5112 = 2,
266  AR5K_RF2413 = 3,
267  AR5K_RF5413 = 4,
268  AR5K_RF2316 = 5,
269  AR5K_RF2317 = 6,
270  AR5K_RF2425 = 7,
271 };

◆ ath5k_srev_type

Enumerator
AR5K_VERSION_MAC 
AR5K_VERSION_RAD 

Definition at line 277 of file ath5k.h.

277  {
280 };

◆ ath5k_driver_mode

Enumerator
AR5K_MODE_11A 
AR5K_MODE_11A_TURBO 
AR5K_MODE_11B 
AR5K_MODE_11G 
AR5K_MODE_11G_TURBO 
AR5K_MODE_XR 

Definition at line 393 of file ath5k.h.

393  {
394  AR5K_MODE_11A = 0,
396  AR5K_MODE_11B = 2,
397  AR5K_MODE_11G = 3,
399  AR5K_MODE_XR = 5,
400 };

◆ anonymous enum

anonymous enum
Enumerator
AR5K_MODE_BIT_11A 
AR5K_MODE_BIT_11A_TURBO 
AR5K_MODE_BIT_11B 
AR5K_MODE_BIT_11G 
AR5K_MODE_BIT_11G_TURBO 
AR5K_MODE_BIT_XR 

Definition at line 402 of file ath5k.h.

◆ ath5k_tx_queue

enum ath5k_tx_queue - Queue types used to classify tx queues.

@AR5K_TX_QUEUE_INACTIVE: q is unused – see ath5k_hw_release_tx_queue @AR5K_TX_QUEUE_DATA: A normal data queue @AR5K_TX_QUEUE_XR_DATA: An XR-data queue @AR5K_TX_QUEUE_BEACON: The beacon queue @AR5K_TX_QUEUE_CAB: The after-beacon queue @AR5K_TX_QUEUE_UAPSD: Unscheduled Automatic Power Save Delivery queue

Enumerator
AR5K_TX_QUEUE_INACTIVE 
AR5K_TX_QUEUE_DATA 
AR5K_TX_QUEUE_XR_DATA 
AR5K_TX_QUEUE_BEACON 
AR5K_TX_QUEUE_CAB 
AR5K_TX_QUEUE_UAPSD 

Definition at line 446 of file ath5k.h.

◆ ath5k_tx_queue_subtype

Enumerator
AR5K_WME_AC_BK 
AR5K_WME_AC_BE 
AR5K_WME_AC_VI 
AR5K_WME_AC_VO 

Definition at line 462 of file ath5k.h.

462  {
463  AR5K_WME_AC_BK = 0, /*Background traffic*/
464  AR5K_WME_AC_BE, /*Best-effort (normal) traffic)*/
465  AR5K_WME_AC_VI, /*Video traffic*/
466  AR5K_WME_AC_VO, /*Voice traffic*/
467 };

◆ ath5k_tx_queue_id

Enumerator
AR5K_TX_QUEUE_ID_NOQCU_DATA 
AR5K_TX_QUEUE_ID_NOQCU_BEACON 
AR5K_TX_QUEUE_ID_DATA_MIN 
AR5K_TX_QUEUE_ID_DATA_MAX 
AR5K_TX_QUEUE_ID_DATA_SVP 
AR5K_TX_QUEUE_ID_CAB 
AR5K_TX_QUEUE_ID_BEACON 
AR5K_TX_QUEUE_ID_UAPSD 
AR5K_TX_QUEUE_ID_XR_DATA 

Definition at line 475 of file ath5k.h.

475  {
478  AR5K_TX_QUEUE_ID_DATA_MIN = 0, /*IEEE80211_TX_QUEUE_DATA0*/
479  AR5K_TX_QUEUE_ID_DATA_MAX = 4, /*IEEE80211_TX_QUEUE_DATA4*/
480  AR5K_TX_QUEUE_ID_DATA_SVP = 5, /*IEEE80211_TX_QUEUE_SVP - Spectralink Voice Protocol*/
481  AR5K_TX_QUEUE_ID_CAB = 6, /*IEEE80211_TX_QUEUE_AFTER_BEACON*/
482  AR5K_TX_QUEUE_ID_BEACON = 7, /*IEEE80211_TX_QUEUE_BEACON*/
485 };

◆ ath5k_pkt_type

Enumerator
AR5K_PKT_TYPE_NORMAL 
AR5K_PKT_TYPE_ATIM 
AR5K_PKT_TYPE_PSPOLL 
AR5K_PKT_TYPE_BEACON 
AR5K_PKT_TYPE_PROBE_RESP 
AR5K_PKT_TYPE_PIFS 

Definition at line 526 of file ath5k.h.

◆ ath5k_dmasize

Enumerator
AR5K_DMASIZE_4B 
AR5K_DMASIZE_8B 
AR5K_DMASIZE_16B 
AR5K_DMASIZE_32B 
AR5K_DMASIZE_64B 
AR5K_DMASIZE_128B 
AR5K_DMASIZE_256B 
AR5K_DMASIZE_512B 

Definition at line 550 of file ath5k.h.

◆ ath5k_rfgain

Enumerator
AR5K_RFGAIN_INACTIVE 
AR5K_RFGAIN_ACTIVE 
AR5K_RFGAIN_READ_REQUESTED 
AR5K_RFGAIN_NEED_CHANGE 

Definition at line 604 of file ath5k.h.

◆ ath5k_int

enum ath5k_int

enum ath5k_int - Hardware interrupt masks helpers

@AR5K_INT_RX: mask to identify received frame interrupts, of type AR5K_ISR_RXOK or AR5K_ISR_RXERR @AR5K_INT_RXDESC: Request RX descriptor/Read RX descriptor (?) @AR5K_INT_RXNOFRM: No frame received (?) @AR5K_INT_RXEOL: received End Of List for VEOL (Virtual End Of List). The Queue Control Unit (QCU) signals an EOL interrupt only if a descriptor's LinkPtr is NULL. For more details, refer to: http://www.freepatentsonline.com/20030225739.html @AR5K_INT_RXORN: Indicates we got RX overrun (eg. no more descriptors). Note that Rx overrun is not always fatal, on some chips we can continue operation without reseting the card, that's why int_fatal is not common for all chips. @AR5K_INT_TX: mask to identify received frame interrupts, of type AR5K_ISR_TXOK or AR5K_ISR_TXERR @AR5K_INT_TXDESC: Request TX descriptor/Read TX status descriptor (?) @AR5K_INT_TXURN: received when we should increase the TX trigger threshold We currently do increments on interrupt by (AR5K_TUNE_MAX_TX_FIFO_THRES - current_trigger_level) / 2 @AR5K_INT_MIB: Indicates the Management Information Base counters should be checked. We should do this with ath5k_hw_update_mib_counters() but it seems we should also then do some noise immunity work. @AR5K_INT_RXPHY: RX PHY Error @AR5K_INT_RXKCM: RX Key cache miss @AR5K_INT_SWBA: SoftWare Beacon Alert - indicates its time to send a beacon that must be handled in software. The alternative is if you have VEOL support, in that case you let the hardware deal with things. @AR5K_INT_BMISS: If in STA mode this indicates we have stopped seeing beacons from the AP have associated with, we should probably try to reassociate. When in IBSS mode this might mean we have not received any beacons from any local stations. Note that every station in an IBSS schedules to send beacons at the Target Beacon Transmission Time (TBTT) with a random backoff. @AR5K_INT_BNR: Beacon Not Ready interrupt - ?? @AR5K_INT_GPIO: GPIO interrupt is used for RF Kill, disabled for now until properly handled @AR5K_INT_FATAL: Fatal errors were encountered, typically caused by DMA errors. These types of errors we can enable seem to be of type AR5K_SIMR2_MCABT, AR5K_SIMR2_SSERR and AR5K_SIMR2_DPERR. @AR5K_INT_GLOBAL: Used to clear and set the IER @AR5K_INT_NOCARD: signals the card has been removed @AR5K_INT_COMMON: common interrupts shared amogst MACs with the same bit value

These are mapped to take advantage of some common bits between the MACs, to be able to set intr properties easier. Some of them are not used yet inside hw.c. Most map to the respective hw interrupt value as they are common amogst different MACs.

Enumerator
AR5K_INT_RXOK 
AR5K_INT_RXDESC 
AR5K_INT_RXERR 
AR5K_INT_RXNOFRM 
AR5K_INT_RXEOL 
AR5K_INT_RXORN 
AR5K_INT_TXOK 
AR5K_INT_TXDESC 
AR5K_INT_TXERR 
AR5K_INT_TXNOFRM 
AR5K_INT_TXEOL 
AR5K_INT_TXURN 
AR5K_INT_MIB 
AR5K_INT_SWI 
AR5K_INT_RXPHY 
AR5K_INT_RXKCM 
AR5K_INT_SWBA 
AR5K_INT_BRSSI 
AR5K_INT_BMISS 
AR5K_INT_FATAL 
AR5K_INT_BNR 
AR5K_INT_TIM 
AR5K_INT_DTIM 
AR5K_INT_DTIM_SYNC 
AR5K_INT_GPIO 
AR5K_INT_BCN_TIMEOUT 
AR5K_INT_CAB_TIMEOUT 
AR5K_INT_RX_DOPPLER 
AR5K_INT_QCBRORN 
AR5K_INT_QCBRURN 
AR5K_INT_QTRIG 
AR5K_INT_GLOBAL 
AR5K_INT_COMMON 
AR5K_INT_NOCARD 

Definition at line 806 of file ath5k.h.

806  {
807  AR5K_INT_RXOK = 0x00000001,
808  AR5K_INT_RXDESC = 0x00000002,
809  AR5K_INT_RXERR = 0x00000004,
810  AR5K_INT_RXNOFRM = 0x00000008,
811  AR5K_INT_RXEOL = 0x00000010,
812  AR5K_INT_RXORN = 0x00000020,
813  AR5K_INT_TXOK = 0x00000040,
814  AR5K_INT_TXDESC = 0x00000080,
815  AR5K_INT_TXERR = 0x00000100,
816  AR5K_INT_TXNOFRM = 0x00000200,
817  AR5K_INT_TXEOL = 0x00000400,
818  AR5K_INT_TXURN = 0x00000800,
819  AR5K_INT_MIB = 0x00001000,
820  AR5K_INT_SWI = 0x00002000,
821  AR5K_INT_RXPHY = 0x00004000,
822  AR5K_INT_RXKCM = 0x00008000,
823  AR5K_INT_SWBA = 0x00010000,
824  AR5K_INT_BRSSI = 0x00020000,
825  AR5K_INT_BMISS = 0x00040000,
826  AR5K_INT_FATAL = 0x00080000, /* Non common */
827  AR5K_INT_BNR = 0x00100000, /* Non common */
828  AR5K_INT_TIM = 0x00200000, /* Non common */
829  AR5K_INT_DTIM = 0x00400000, /* Non common */
830  AR5K_INT_DTIM_SYNC = 0x00800000, /* Non common */
831  AR5K_INT_GPIO = 0x01000000,
832  AR5K_INT_BCN_TIMEOUT = 0x02000000, /* Non common */
833  AR5K_INT_CAB_TIMEOUT = 0x04000000, /* Non common */
834  AR5K_INT_RX_DOPPLER = 0x08000000, /* Non common */
835  AR5K_INT_QCBRORN = 0x10000000, /* Non common */
836  AR5K_INT_QCBRURN = 0x20000000, /* Non common */
837  AR5K_INT_QTRIG = 0x40000000, /* Non common */
838  AR5K_INT_GLOBAL = 0x80000000,
839 
846  | AR5K_INT_TXOK
852  | AR5K_INT_MIB
853  | AR5K_INT_SWI
856  | AR5K_INT_SWBA
859  | AR5K_INT_GPIO
860  | AR5K_INT_GLOBAL,
861 
862  AR5K_INT_NOCARD = 0xffffffff
863 };

◆ ath5k_power_mode

Enumerator
AR5K_PM_UNDEFINED 
AR5K_PM_AUTO 
AR5K_PM_AWAKE 
AR5K_PM_FULL_SLEEP 
AR5K_PM_NETWORK_SLEEP 

Definition at line 868 of file ath5k.h.

◆ ath5k_capability_type

Enumerator
AR5K_CAP_REG_DMN 
AR5K_CAP_TKIP_MIC 
AR5K_CAP_TKIP_SPLIT 
AR5K_CAP_PHYCOUNTERS 
AR5K_CAP_DIVERSITY 
AR5K_CAP_NUM_TXQUEUES 
AR5K_CAP_VEOL 
AR5K_CAP_COMPRESSION 
AR5K_CAP_BURST 
AR5K_CAP_FASTFRAME 
AR5K_CAP_TXPOW 
AR5K_CAP_TPC 
AR5K_CAP_BSSIDMASK 
AR5K_CAP_MCAST_KEYSRCH 
AR5K_CAP_TSF_ADJUST 
AR5K_CAP_XR 
AR5K_CAP_WME_TKIPMIC 
AR5K_CAP_CHAN_HALFRATE 
AR5K_CAP_CHAN_QUARTERRATE 
AR5K_CAP_RFSILENT 

Definition at line 887 of file ath5k.h.

887  {
888  AR5K_CAP_REG_DMN = 0, /* Used to get current reg. domain id */
889  AR5K_CAP_TKIP_MIC = 2, /* Can handle TKIP MIC in hardware */
890  AR5K_CAP_TKIP_SPLIT = 3, /* TKIP uses split keys */
891  AR5K_CAP_PHYCOUNTERS = 4, /* PHY error counters */
892  AR5K_CAP_DIVERSITY = 5, /* Supports fast diversity */
893  AR5K_CAP_NUM_TXQUEUES = 6, /* Used to get max number of hw txqueues */
894  AR5K_CAP_VEOL = 7, /* Supports virtual EOL */
895  AR5K_CAP_COMPRESSION = 8, /* Supports compression */
896  AR5K_CAP_BURST = 9, /* Supports packet bursting */
897  AR5K_CAP_FASTFRAME = 10, /* Supports fast frames */
898  AR5K_CAP_TXPOW = 11, /* Used to get global tx power limit */
899  AR5K_CAP_TPC = 12, /* Can do per-packet tx power control (needed for 802.11a) */
900  AR5K_CAP_BSSIDMASK = 13, /* Supports bssid mask */
901  AR5K_CAP_MCAST_KEYSRCH = 14, /* Supports multicast key search */
902  AR5K_CAP_TSF_ADJUST = 15, /* Supports beacon tsf adjust */
903  AR5K_CAP_XR = 16, /* Supports XR mode */
904  AR5K_CAP_WME_TKIPMIC = 17, /* Supports TKIP MIC when using WMM */
905  AR5K_CAP_CHAN_HALFRATE = 18, /* Supports half rate channels */
906  AR5K_CAP_CHAN_QUARTERRATE = 19, /* Supports quarter rate channels */
907  AR5K_CAP_RFSILENT = 20, /* Supports RFsilent */
908 };

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( MIT  )

◆ FILE_SECBOOT()

FILE_SECBOOT ( FORBIDDEN  )

◆ ath5k_bitrate_to_hw_rix()

int ath5k_bitrate_to_hw_rix ( int  bitrate)

Definition at line 719 of file ath5k.c.

720 {
721  int i;
722 
723  for (i = 0; i < ATH5K_NR_RATES; i++) {
724  if (ath5k_rates[i].bitrate == bitrate)
725  return ath5k_rates[i].hw_code;
726  }
727 
728  DBG("ath5k: invalid bitrate %d\n", bitrate);
729  return ATH5K_RATE_CODE_1M; /* use lowest rate */
730 }
#define ATH5K_NR_RATES
Definition: ath5k.c:116
static const struct @10 ath5k_rates[]
u16 bitrate
Definition: ath5k.c:94
#define ATH5K_RATE_CODE_1M
Definition: ath5k.h:708
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498

References ATH5K_NR_RATES, ATH5K_RATE_CODE_1M, ath5k_rates, bitrate, and DBG.

Referenced by ath5k_hw_write_rate_duration().

◆ ath5k_hw_attach()

int ath5k_hw_attach ( struct ath5k_softc sc,
u8  mac_version,
struct ath5k_hw **  hw 
)

ath5k_hw_attach - Check if hw is supported and init the needed structs

@sc: The &struct ath5k_softc we got from the driver's attach function @mac_version: The mac version id (check out ath5k.h) based on pci id @hw: Returned newly allocated hardware structure, on success

Check if the device is supported, perform a POST and initialize the needed structs. Returns -ENOMEM if we don't have memory for the needed structs, -ENODEV if the device is not supported or prints an error msg if something else went wrong.

Definition at line 113 of file ath5k_attach.c.

115 {
116  struct ath5k_hw *ah;
117  struct pci_device *pdev = sc->pdev;
118  int ret;
119  u32 srev;
120 
121  ah = zalloc(sizeof(struct ath5k_hw));
122  if (ah == NULL) {
123  ret = -ENOMEM;
124  DBG("ath5k: out of memory\n");
125  goto err;
126  }
127 
128  ah->ah_sc = sc;
129  ah->ah_iobase = sc->iobase;
130 
131  /*
132  * HW information
133  */
134  ah->ah_turbo = 0;
135  ah->ah_txpower.txp_tpc = 0;
136  ah->ah_imr = 0;
137  ah->ah_atim_window = 0;
138  ah->ah_aifs = AR5K_TUNE_AIFS;
139  ah->ah_cw_min = AR5K_TUNE_CWMIN;
140  ah->ah_limit_tx_retries = AR5K_INIT_TX_RETRY;
141  ah->ah_software_retry = 0;
142  ah->ah_ant_diversity = AR5K_TUNE_ANT_DIVERSITY;
143 
144  /*
145  * Set the mac version based on the pci id
146  */
147  ah->ah_version = mac_version;
148 
149  /*Fill the ath5k_hw struct with the needed functions*/
151  if (ret)
152  goto err_free;
153 
154  /* Bring device out of sleep and reset it's units */
155  ret = ath5k_hw_nic_wakeup(ah, CHANNEL_B, 1);
156  if (ret)
157  goto err_free;
158 
159  /* Get MAC, PHY and RADIO revisions */
160  srev = ath5k_hw_reg_read(ah, AR5K_SREV);
161  ah->ah_mac_srev = srev;
162  ah->ah_mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER);
163  ah->ah_mac_revision = AR5K_REG_MS(srev, AR5K_SREV_REV);
164  ah->ah_phy_revision = ath5k_hw_reg_read(ah, AR5K_PHY_CHIP_ID);
165  ah->ah_radio_5ghz_revision = ath5k_hw_radio_revision(ah, CHANNEL_5GHZ);
166  ah->ah_phy = AR5K_PHY(0);
167 
168  /* Try to identify radio chip based on it's srev */
169  switch (ah->ah_radio_5ghz_revision & 0xf0) {
170  case AR5K_SREV_RAD_5111:
171  ah->ah_radio = AR5K_RF5111;
172  ah->ah_single_chip = 0;
173  ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah,
174  CHANNEL_2GHZ);
175  break;
176  case AR5K_SREV_RAD_5112:
177  case AR5K_SREV_RAD_2112:
178  ah->ah_radio = AR5K_RF5112;
179  ah->ah_single_chip = 0;
180  ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah,
181  CHANNEL_2GHZ);
182  break;
183  case AR5K_SREV_RAD_2413:
184  ah->ah_radio = AR5K_RF2413;
185  ah->ah_single_chip = 1;
186  break;
187  case AR5K_SREV_RAD_5413:
188  ah->ah_radio = AR5K_RF5413;
189  ah->ah_single_chip = 1;
190  break;
191  case AR5K_SREV_RAD_2316:
192  ah->ah_radio = AR5K_RF2316;
193  ah->ah_single_chip = 1;
194  break;
195  case AR5K_SREV_RAD_2317:
196  ah->ah_radio = AR5K_RF2317;
197  ah->ah_single_chip = 1;
198  break;
199  case AR5K_SREV_RAD_5424:
200  if (ah->ah_mac_version == AR5K_SREV_AR2425 ||
201  ah->ah_mac_version == AR5K_SREV_AR2417) {
202  ah->ah_radio = AR5K_RF2425;
203  } else {
204  ah->ah_radio = AR5K_RF5413;
205  }
206  ah->ah_single_chip = 1;
207  break;
208  default:
209  /* Identify radio based on mac/phy srev */
210  if (ah->ah_version == AR5K_AR5210) {
211  ah->ah_radio = AR5K_RF5110;
212  ah->ah_single_chip = 0;
213  } else if (ah->ah_version == AR5K_AR5211) {
214  ah->ah_radio = AR5K_RF5111;
215  ah->ah_single_chip = 0;
216  ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah,
217  CHANNEL_2GHZ);
218  } else if (ah->ah_mac_version == (AR5K_SREV_AR2425 >> 4) ||
219  ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4) ||
220  ah->ah_phy_revision == AR5K_SREV_PHY_2425) {
221  ah->ah_radio = AR5K_RF2425;
222  ah->ah_single_chip = 1;
223  ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_2425;
224  } else if (srev == AR5K_SREV_AR5213A &&
225  ah->ah_phy_revision == AR5K_SREV_PHY_5212B) {
226  ah->ah_radio = AR5K_RF5112;
227  ah->ah_single_chip = 0;
228  ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_5112B;
229  } else if (ah->ah_mac_version == (AR5K_SREV_AR2415 >> 4)) {
230  ah->ah_radio = AR5K_RF2316;
231  ah->ah_single_chip = 1;
232  ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_2316;
233  } else if (ah->ah_mac_version == (AR5K_SREV_AR5414 >> 4) ||
234  ah->ah_phy_revision == AR5K_SREV_PHY_5413) {
235  ah->ah_radio = AR5K_RF5413;
236  ah->ah_single_chip = 1;
237  ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_5413;
238  } else if (ah->ah_mac_version == (AR5K_SREV_AR2414 >> 4) ||
239  ah->ah_phy_revision == AR5K_SREV_PHY_2413) {
240  ah->ah_radio = AR5K_RF2413;
241  ah->ah_single_chip = 1;
242  ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_2413;
243  } else {
244  DBG("ath5k: Couldn't identify radio revision.\n");
245  ret = -ENOTSUP;
246  goto err_free;
247  }
248  }
249 
250  /* Return on unsuported chips (unsupported eeprom etc) */
251  if ((srev >= AR5K_SREV_AR5416) &&
252  (srev < AR5K_SREV_AR2425)) {
253  DBG("ath5k: Device not yet supported.\n");
254  ret = -ENOTSUP;
255  goto err_free;
256  }
257 
258  /*
259  * Write PCI-E power save settings
260  */
261  if ((ah->ah_version == AR5K_AR5212) &&
263  ath5k_hw_reg_write(ah, 0x9248fc00, AR5K_PCIE_SERDES);
264  ath5k_hw_reg_write(ah, 0x24924924, AR5K_PCIE_SERDES);
265  /* Shut off RX when elecidle is asserted */
266  ath5k_hw_reg_write(ah, 0x28000039, AR5K_PCIE_SERDES);
267  ath5k_hw_reg_write(ah, 0x53160824, AR5K_PCIE_SERDES);
268  /* TODO: EEPROM work */
269  ath5k_hw_reg_write(ah, 0xe5980579, AR5K_PCIE_SERDES);
270  /* Shut off PLL and CLKREQ active in L1 */
271  ath5k_hw_reg_write(ah, 0x001defff, AR5K_PCIE_SERDES);
272  /* Preserce other settings */
273  ath5k_hw_reg_write(ah, 0x1aaabe40, AR5K_PCIE_SERDES);
274  ath5k_hw_reg_write(ah, 0xbe105554, AR5K_PCIE_SERDES);
275  ath5k_hw_reg_write(ah, 0x000e3007, AR5K_PCIE_SERDES);
276  /* Reset SERDES to load new settings */
278  mdelay(1);
279  }
280 
281  /*
282  * POST
283  */
284  ret = ath5k_hw_post(ah);
285  if (ret)
286  goto err_free;
287 
288  /* Enable pci core retry fix on Hainan (5213A) and later chips */
289  if (srev >= AR5K_SREV_AR5213A)
291 
292  /*
293  * Get card capabilities, calibration values etc
294  * TODO: EEPROM work
295  */
296  ret = ath5k_eeprom_init(ah);
297  if (ret) {
298  DBG("ath5k: unable to init EEPROM\n");
299  goto err_free;
300  }
301 
302  /* Get misc capabilities */
304  if (ret) {
305  DBG("ath5k: unable to get device capabilities: 0x%04x\n",
306  sc->pdev->device);
307  goto err_free;
308  }
309 
310  if (srev >= AR5K_SREV_AR2414) {
311  ah->ah_combined_mic = 1;
314  }
315 
316  /* Set BSSID to bcast address: ff:ff:ff:ff:ff:ff for now */
317  memset(ah->ah_bssid, 0xff, ETH_ALEN);
318  ath5k_hw_set_associd(ah, ah->ah_bssid, 0);
320 
322 
323  *hw = ah;
324  return 0;
325 err_free:
326  free(ah);
327 err:
328  return ret;
329 }
#define AR5K_SREV
Definition: reg.h:959
static int ath5k_hw_post(struct ath5k_hw *ah)
ath5k_hw_post - Power On Self Test helper function
Definition: ath5k_attach.c:41
#define AR5K_SREV_RAD_5413
Definition: ath5k.h:320
#define AR5K_SREV_RAD_2112
Definition: ath5k.h:316
int pci_find_capability(struct pci_device *pci, int cap)
Look for a PCI capability.
Definition: pciextra.c:39
#define AR5K_PHY_CHIP_ID
Definition: reg.h:1929
#define AR5K_SREV_PHY_2413
Definition: ath5k.h:331
u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, unsigned int chan)
Definition: ath5k_phy.c:1373
#define AR5K_SREV_REV
Definition: reg.h:960
#define AR5K_PCIE_SERDES
Definition: reg.h:1016
#define AR5K_SREV_AR5414
Definition: ath5k.h:302
#define AR5K_TUNE_ANT_DIVERSITY
Definition: ath5k.h:196
#define AR5K_SREV_PHY_5212B
Definition: ath5k.h:330
#define AR5K_INIT_TX_RETRY
Definition: ath5k.h:230
#define AR5K_PCICFG
Definition: reg.h:882
#define AR5K_REG_MS(_val, _flags)
Definition: ath5k.h:90
#define AR5K_SREV_RAD_5112
Definition: ath5k.h:313
#define AR5K_SREV_AR2417
Definition: ath5k.h:307
#define AR5K_TUNE_CWMIN
Definition: ath5k.h:186
void ath5k_hw_set_associd(struct ath5k_hw *ah, const u8 *bssid, u16 assoc_id)
ath5k_hw_set_associd - Set BSSID for association
Definition: ath5k_pcu.c:229
Definition: hw.c:16
#define AR5K_SREV_RAD_2413
Definition: ath5k.h:319
#define AR5K_SREV_RAD_5424
Definition: ath5k.h:323
int ath5k_hw_init_desc_functions(struct ath5k_hw *ah)
Definition: ath5k_desc.c:523
ath5k_hw_get_isr - Get interrupt status
Definition: ath5k.h:955
#define ENOTSUP
Operation not supported.
Definition: errno.h:590
#define ENOMEM
Not enough space.
Definition: errno.h:535
#define AR5K_SREV_RAD_2317
Definition: ath5k.h:322
#define AR5K_PCICFG_RETRY_FIX
Definition: reg.h:900
uint16_t device
Device ID.
Definition: pci.h:230
#define AR5K_SREV_RAD_2425
Definition: ath5k.h:324
#define AR5K_PCIE_SERDES_RESET
Definition: reg.h:1017
int ath5k_hw_set_capabilities(struct ath5k_hw *ah)
Definition: ath5k_caps.c:37
int ath5k_hw_rfgain_opt_init(struct ath5k_hw *ah)
Definition: ath5k_phy.c:159
#define AR5K_SREV_PHY_2425
Definition: ath5k.h:333
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:55
#define AR5K_SREV_RAD_5112B
Definition: ath5k.h:315
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:662
#define AR5K_SREV_RAD_2316
Definition: ath5k.h:321
A PCI device.
Definition: pci.h:211
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define ETH_ALEN
Definition: if_ether.h:9
int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, int initial)
Definition: ath5k_reset.c:283
#define PCI_CAP_ID_EXP
PCI Express.
Definition: pci.h:98
#define AR5K_SREV_AR5213A
Definition: ath5k.h:297
struct pci_device * pdev
Definition: base.h:90
#define AR5K_SREV_AR2425
Definition: ath5k.h:306
#define AR5K_TUNE_AIFS
Definition: ath5k.h:183
#define AR5K_SREV_AR5416
Definition: ath5k.h:304
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
Definition: timer.c:79
#define AR5K_SREV_AR2415
Definition: ath5k.h:303
int ath5k_hw_set_opmode(struct ath5k_hw *ah)
ath5k_hw_set_opmode - Set PCU operating mode
Definition: ath5k_pcu.c:49
#define AR5K_PHY(_n)
Definition: reg.h:1863
#define AR5K_SREV_PHY_5413
Definition: ath5k.h:332
void * iobase
Definition: base.h:91
#define AR5K_SREV_VER
Definition: reg.h:962
#define CHANNEL_5GHZ
Definition: ath5k.h:635
#define AR5K_SREV_RAD_5111
Definition: ath5k.h:310
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define CHANNEL_B
Definition: ath5k.h:641
#define CHANNEL_2GHZ
Definition: ath5k.h:634
#define AR5K_MISC_MODE
Definition: reg.h:1747
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
int ath5k_eeprom_init(struct ath5k_hw *ah)
uint32_t u32
Definition: stdint.h:24
#define AR5K_SREV_AR2414
Definition: ath5k.h:299
#define AR5K_MISC_MODE_COMBINED_MIC
Definition: reg.h:1750
#define AR5K_REG_ENABLE_BITS(ah, _reg, _flags)
Definition: ath5k.h:106
void * memset(void *dest, int character, size_t len) __nonnull

References ah, AR5K_AR5210, AR5K_AR5211, AR5K_AR5212, AR5K_INIT_TX_RETRY, AR5K_MISC_MODE, AR5K_MISC_MODE_COMBINED_MIC, AR5K_PCICFG, AR5K_PCICFG_RETRY_FIX, AR5K_PCIE_SERDES, AR5K_PCIE_SERDES_RESET, AR5K_PHY, AR5K_PHY_CHIP_ID, AR5K_REG_ENABLE_BITS, AR5K_REG_MS, AR5K_RF2316, AR5K_RF2317, AR5K_RF2413, AR5K_RF2425, AR5K_RF5110, AR5K_RF5111, AR5K_RF5112, AR5K_RF5413, AR5K_SREV, AR5K_SREV_AR2414, AR5K_SREV_AR2415, AR5K_SREV_AR2417, AR5K_SREV_AR2425, AR5K_SREV_AR5213A, AR5K_SREV_AR5414, AR5K_SREV_AR5416, AR5K_SREV_PHY_2413, AR5K_SREV_PHY_2425, AR5K_SREV_PHY_5212B, AR5K_SREV_PHY_5413, AR5K_SREV_RAD_2112, AR5K_SREV_RAD_2316, AR5K_SREV_RAD_2317, AR5K_SREV_RAD_2413, AR5K_SREV_RAD_2425, AR5K_SREV_RAD_5111, AR5K_SREV_RAD_5112, AR5K_SREV_RAD_5112B, AR5K_SREV_RAD_5413, AR5K_SREV_RAD_5424, AR5K_SREV_REV, AR5K_SREV_VER, AR5K_TUNE_AIFS, AR5K_TUNE_ANT_DIVERSITY, AR5K_TUNE_CWMIN, ath5k_eeprom_init(), ath5k_hw_init_desc_functions(), ath5k_hw_nic_wakeup(), ath5k_hw_post(), ath5k_hw_radio_revision(), ath5k_hw_reg_read(), ath5k_hw_reg_write(), ath5k_hw_rfgain_opt_init(), ath5k_hw_set_associd(), ath5k_hw_set_capabilities(), ath5k_hw_set_opmode(), CHANNEL_2GHZ, CHANNEL_5GHZ, CHANNEL_B, DBG, pci_device::device, ENOMEM, ENOTSUP, ETH_ALEN, free, ath5k_softc::iobase, mdelay(), memset(), NULL, PCI_CAP_ID_EXP, pci_find_capability(), ath5k_softc::pdev, and zalloc().

Referenced by ath5k_probe().

◆ ath5k_hw_detach()

void ath5k_hw_detach ( struct ath5k_hw ah)

ath5k_hw_detach - Free the ath5k_hw struct

@ah: The &struct ath5k_hw

Definition at line 336 of file ath5k_attach.c.

337 {
338  free(ah->ah_rf_banks);
340  free(ah);
341 }
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:55
void ath5k_eeprom_detach(struct ath5k_hw *ah)
uint8_t ah
Definition: registers.h:85

References ah, ath5k_eeprom_detach(), and free.

Referenced by ath5k_probe(), and ath5k_remove().

◆ ath5k_init_leds()

int ath5k_init_leds ( struct ath5k_softc sc)

◆ ath5k_led_enable()

void ath5k_led_enable ( struct ath5k_softc sc)

◆ ath5k_led_off()

void ath5k_led_off ( struct ath5k_softc sc)

◆ ath5k_unregister_leds()

void ath5k_unregister_leds ( struct ath5k_softc sc)

◆ ath5k_hw_nic_wakeup()

int ath5k_hw_nic_wakeup ( struct ath5k_hw ah,
int  flags,
int  initial 
)

Definition at line 283 of file ath5k_reset.c.

284 {
285  struct pci_device *pdev = ah->ah_sc->pdev;
286  u32 turbo, mode, clock, bus_flags;
287  int ret;
288 
289  turbo = 0;
290  mode = 0;
291  clock = 0;
292 
293  /* Wakeup the device */
294  ret = ath5k_hw_wake(ah);
295  if (ret) {
296  DBG("ath5k: failed to wake up the MAC chip\n");
297  return ret;
298  }
299 
300  if (ah->ah_version != AR5K_AR5210) {
301  /*
302  * Get channel mode flags
303  */
304 
305  if (ah->ah_radio >= AR5K_RF5112) {
307  clock = AR5K_PHY_PLL_RF5112;
308  } else {
309  mode = AR5K_PHY_MODE_RAD_RF5111; /*Zero*/
310  clock = AR5K_PHY_PLL_RF5111; /*Zero*/
311  }
312 
313  if (flags & CHANNEL_2GHZ) {
315  clock |= AR5K_PHY_PLL_44MHZ;
316 
317  if (flags & CHANNEL_CCK) {
319  } else if (flags & CHANNEL_OFDM) {
320  /* XXX Dynamic OFDM/CCK is not supported by the
321  * AR5211 so we set MOD_OFDM for plain g (no
322  * CCK headers) operation. We need to test
323  * this, 5211 might support ofdm-only g after
324  * all, there are also initial register values
325  * in the code for g mode (see initvals.c). */
326  if (ah->ah_version == AR5K_AR5211)
328  else
330  } else {
331  DBG("ath5k: invalid radio modulation mode\n");
332  return -EINVAL;
333  }
334  } else if (flags & CHANNEL_5GHZ) {
336 
337  if (ah->ah_radio == AR5K_RF5413)
338  clock = AR5K_PHY_PLL_40MHZ_5413;
339  else
340  clock |= AR5K_PHY_PLL_40MHZ;
341 
342  if (flags & CHANNEL_OFDM)
344  else {
345  DBG("ath5k: invalid radio modulation mode\n");
346  return -EINVAL;
347  }
348  } else {
349  DBG("ath5k: invalid radio frequency mode\n");
350  return -EINVAL;
351  }
352 
353  if (flags & CHANNEL_TURBO)
355  } else { /* Reset the device */
356 
357  /* ...enable Atheros turbo mode if requested */
358  if (flags & CHANNEL_TURBO)
361  }
362 
363  /* reseting PCI on PCI-E cards results card to hang
364  * and always return 0xffff... so we ingore that flag
365  * for PCI-E cards */
367  bus_flags = 0;
368  else
369  bus_flags = AR5K_RESET_CTL_PCI;
370 
371  /* Reset chipset */
372  if (ah->ah_version == AR5K_AR5210) {
376  mdelay(2);
377  } else {
379  AR5K_RESET_CTL_BASEBAND | bus_flags);
380  }
381  if (ret) {
382  DBG("ath5k: failed to reset the MAC chip\n");
383  return -EIO;
384  }
385 
386  /* ...wakeup again!*/
387  ret = ath5k_hw_wake(ah);
388  if (ret) {
389  DBG("ath5k: failed to resume the MAC chip\n");
390  return ret;
391  }
392 
393  /* ...final warm reset */
394  if (ath5k_hw_nic_reset(ah, 0)) {
395  DBG("ath5k: failed to warm reset the MAC chip\n");
396  return -EIO;
397  }
398 
399  if (ah->ah_version != AR5K_AR5210) {
400 
401  /* ...update PLL if needed */
402  if (ath5k_hw_reg_read(ah, AR5K_PHY_PLL) != clock) {
404  udelay(300);
405  }
406 
407  /* ...set the PHY operating mode */
410  }
411 
412  return 0;
413 }
#define EINVAL
Invalid argument.
Definition: errno.h:429
#define AR5K_PHY_MODE_RAD_RF5112
Definition: reg.h:2515
int pci_find_capability(struct pci_device *pci, int cap)
Look for a PCI capability.
Definition: pciextra.c:39
#define AR5K_PHY_PLL_40MHZ
Definition: reg.h:2105
uint16_t mode
Acceleration mode.
Definition: ena.h:26
int ath5k_hw_wake(struct ath5k_hw *ah)
Definition: ath5k_reset.c:241
#define AR5K_PHY_PLL_44MHZ
Definition: reg.h:2110
#define AR5K_PHY_MODE_MOD_DYN
Definition: reg.h:2512
#define AR5K_PHY_PLL
Definition: reg.h:2099
#define CHANNEL_CCK
Definition: ath5k.h:632
#define AR5K_RESET_CTL_PCI
Definition: reg.h:848
#define AR5K_PHY_PLL_RF5112
Definition: reg.h:2114
#define AR5K_RESET_CTL_MAC
Definition: reg.h:846
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:61
#define AR5K_PHY_TURBO_MODE
Definition: reg.h:1899
#define AR5K_PHY_TURBO
Definition: reg.h:1898
static int ath5k_hw_nic_reset(struct ath5k_hw *ah, u32 val)
Definition: ath5k_reset.c:199
#define AR5K_RESET_CTL_PCU
Definition: reg.h:843
#define AR5K_PHY_MODE_MOD_CCK
Definition: reg.h:2508
uint8_t flags
Flags.
Definition: ena.h:18
#define AR5K_PHY_MODE_FREQ_5GHZ
Definition: reg.h:2510
#define AR5K_PHY_MODE
Definition: reg.h:2505
A PCI device.
Definition: pci.h:211
#define AR5K_PHY_MODE_RAD_RF5111
Definition: reg.h:2514
#define CHANNEL_TURBO
Definition: ath5k.h:631
#define AR5K_PHY_MODE_MOD_OFDM
Definition: reg.h:2507
#define CHANNEL_OFDM
Definition: ath5k.h:633
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define PCI_CAP_ID_EXP
PCI Express.
Definition: pci.h:98
#define AR5K_PHY_TURBO_SHORT
Definition: reg.h:1900
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
Definition: timer.c:79
#define AR5K_PHY_PLL_RF5111
Definition: reg.h:2113
#define CHANNEL_5GHZ
Definition: ath5k.h:635
#define EIO
Input/output error.
Definition: errno.h:434
#define AR5K_PHY_PLL_40MHZ_5413
Definition: reg.h:2104
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
#define AR5K_RESET_CTL_PHY
Definition: reg.h:847
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define CHANNEL_2GHZ
Definition: ath5k.h:634
#define AR5K_RESET_CTL_DMA
Definition: reg.h:844
#define AR5K_PHY_MODE_FREQ_2GHZ
Definition: reg.h:2511
uint32_t u32
Definition: stdint.h:24
#define AR5K_RESET_CTL_BASEBAND
Definition: reg.h:845

References ah, AR5K_AR5210, AR5K_AR5211, AR5K_PHY_MODE, AR5K_PHY_MODE_FREQ_2GHZ, AR5K_PHY_MODE_FREQ_5GHZ, AR5K_PHY_MODE_MOD_CCK, AR5K_PHY_MODE_MOD_DYN, AR5K_PHY_MODE_MOD_OFDM, AR5K_PHY_MODE_RAD_RF5111, AR5K_PHY_MODE_RAD_RF5112, AR5K_PHY_PLL, AR5K_PHY_PLL_40MHZ, AR5K_PHY_PLL_40MHZ_5413, AR5K_PHY_PLL_44MHZ, AR5K_PHY_PLL_RF5111, AR5K_PHY_PLL_RF5112, AR5K_PHY_TURBO, AR5K_PHY_TURBO_MODE, AR5K_PHY_TURBO_SHORT, AR5K_RESET_CTL_BASEBAND, AR5K_RESET_CTL_DMA, AR5K_RESET_CTL_MAC, AR5K_RESET_CTL_PCI, AR5K_RESET_CTL_PCU, AR5K_RESET_CTL_PHY, AR5K_RF5112, AR5K_RF5413, ath5k_hw_nic_reset(), ath5k_hw_reg_read(), ath5k_hw_reg_write(), ath5k_hw_wake(), CHANNEL_2GHZ, CHANNEL_5GHZ, CHANNEL_CCK, CHANNEL_OFDM, CHANNEL_TURBO, DBG, EINVAL, EIO, flags, mdelay(), mode, PCI_CAP_ID_EXP, pci_find_capability(), and udelay().

Referenced by ath5k_hw_attach(), and ath5k_hw_reset().

◆ ath5k_hw_reset()

int ath5k_hw_reset ( struct ath5k_hw ah,
struct net80211_channel channel,
int  change_channel 
)

Definition at line 691 of file ath5k_reset.c.

693 {
694  u32 s_seq[10], s_ant, s_led[3], staid1_flags;
695  u32 phy_tst1;
696  u8 mode, freq, ee_mode, ant[2];
697  int i, ret;
698 
699  s_ant = 0;
700  ee_mode = 0;
701  staid1_flags = 0;
702  freq = 0;
703  mode = 0;
704 
705  /*
706  * Save some registers before a reset
707  */
708  /*DCU/Antenna selection not available on 5210*/
709  if (ah->ah_version != AR5K_AR5210) {
710 
711  switch (channel->hw_value & CHANNEL_MODES) {
712  case CHANNEL_A:
714  freq = AR5K_INI_RFGAIN_5GHZ;
715  ee_mode = AR5K_EEPROM_MODE_11A;
716  break;
717  case CHANNEL_G:
719  freq = AR5K_INI_RFGAIN_2GHZ;
720  ee_mode = AR5K_EEPROM_MODE_11G;
721  break;
722  case CHANNEL_B:
724  freq = AR5K_INI_RFGAIN_2GHZ;
725  ee_mode = AR5K_EEPROM_MODE_11B;
726  break;
727  case CHANNEL_T:
729  freq = AR5K_INI_RFGAIN_5GHZ;
730  ee_mode = AR5K_EEPROM_MODE_11A;
731  break;
732  case CHANNEL_TG:
733  if (ah->ah_version == AR5K_AR5211) {
734  DBG("ath5k: TurboG not available on 5211\n");
735  return -EINVAL;
736  }
738  freq = AR5K_INI_RFGAIN_2GHZ;
739  ee_mode = AR5K_EEPROM_MODE_11G;
740  break;
741  case CHANNEL_XR:
742  if (ah->ah_version == AR5K_AR5211) {
743  DBG("ath5k: XR mode not available on 5211\n");
744  return -EINVAL;
745  }
746  mode = AR5K_MODE_XR;
747  freq = AR5K_INI_RFGAIN_5GHZ;
748  ee_mode = AR5K_EEPROM_MODE_11A;
749  break;
750  default:
751  DBG("ath5k: invalid channel (%d MHz)\n",
752  channel->center_freq);
753  return -EINVAL;
754  }
755 
756  if (change_channel) {
757  /*
758  * Save frame sequence count
759  * For revs. after Oahu, only save
760  * seq num for DCU 0 (Global seq num)
761  */
762  if (ah->ah_mac_srev < AR5K_SREV_AR5211) {
763 
764  for (i = 0; i < 10; i++)
765  s_seq[i] = ath5k_hw_reg_read(ah,
767 
768  } else {
769  s_seq[0] = ath5k_hw_reg_read(ah,
771  }
772  }
773 
774  /* Save default antenna */
776 
777  if (ah->ah_version == AR5K_AR5212) {
778  /* Since we are going to write rf buffer
779  * check if we have any pending gain_F
780  * optimization settings */
781  if (change_channel && ah->ah_rf_banks != NULL)
783  }
784  }
785 
786  /*GPIOs*/
787  s_led[0] = ath5k_hw_reg_read(ah, AR5K_PCICFG) &
789  s_led[1] = ath5k_hw_reg_read(ah, AR5K_GPIOCR);
790  s_led[2] = ath5k_hw_reg_read(ah, AR5K_GPIODO);
791 
792  /* AR5K_STA_ID1 flags, only preserve antenna
793  * settings and ack/cts rate mode */
794  staid1_flags = ath5k_hw_reg_read(ah, AR5K_STA_ID1) &
801 
802  /* Wakeup the device */
803  ret = ath5k_hw_nic_wakeup(ah, channel->hw_value, 0);
804  if (ret)
805  return ret;
806 
807  /* PHY access enable */
808  if (ah->ah_mac_srev >= AR5K_SREV_AR5211)
810  else
812  AR5K_PHY(0));
813 
814  /* Write initial settings */
815  ret = ath5k_hw_write_initvals(ah, mode, change_channel);
816  if (ret)
817  return ret;
818 
819  /*
820  * 5211/5212 Specific
821  */
822  if (ah->ah_version != AR5K_AR5210) {
823 
824  /*
825  * Write initial RF gain settings
826  * This should work for both 5111/5112
827  */
828  ret = ath5k_hw_rfgain_init(ah, freq);
829  if (ret)
830  return ret;
831 
832  mdelay(1);
833 
834  /*
835  * Tweak initval settings for revised
836  * chipsets and add some more config
837  * bits
838  */
840 
841  /*
842  * Set TX power (FIXME)
843  */
844  ret = ath5k_hw_txpower(ah, channel, ee_mode,
846  if (ret)
847  return ret;
848 
849  /* Write rate duration table only on AR5212 */
850  if (ah->ah_version == AR5K_AR5212)
852 
853  /*
854  * Write RF buffer
855  */
857  if (ret)
858  return ret;
859 
860 
861  /* Write OFDM timings on 5212*/
862  if (ah->ah_version == AR5K_AR5212 &&
863  channel->hw_value & CHANNEL_OFDM) {
865  if (ret)
866  return ret;
867  }
868 
869  /*Enable/disable 802.11b mode on 5111
870  (enable 2111 frequency converter + CCK)*/
871  if (ah->ah_radio == AR5K_RF5111) {
872  if (mode == AR5K_MODE_11B)
875  else
878  }
879 
880  /*
881  * In case a fixed antenna was set as default
882  * write the same settings on both AR5K_PHY_ANT_SWITCH_TABLE
883  * registers.
884  */
885  if (s_ant != 0) {
886  if (s_ant == AR5K_ANT_FIXED_A) /* 1 - Main */
887  ant[0] = ant[1] = AR5K_ANT_FIXED_A;
888  else /* 2 - Aux */
889  ant[0] = ant[1] = AR5K_ANT_FIXED_B;
890  } else {
891  ant[0] = AR5K_ANT_FIXED_A;
892  ant[1] = AR5K_ANT_FIXED_B;
893  }
894 
895  /* Commit values from EEPROM */
897 
898  } else {
899  /*
900  * For 5210 we do all initialization using
901  * initvals, so we don't have to modify
902  * any settings (5210 also only supports
903  * a/aturbo modes)
904  */
905  mdelay(1);
906  /* Disable phy and wait */
908  mdelay(1);
909  }
910 
911  /*
912  * Restore saved values
913  */
914 
915  /*DCU/Antenna selection not available on 5210*/
916  if (ah->ah_version != AR5K_AR5210) {
917 
918  if (change_channel) {
919  if (ah->ah_mac_srev < AR5K_SREV_AR5211) {
920  for (i = 0; i < 10; i++)
921  ath5k_hw_reg_write(ah, s_seq[i],
923  } else {
924  ath5k_hw_reg_write(ah, s_seq[0],
926  }
927  }
928 
930  }
931 
932  /* Ledstate */
933  AR5K_REG_ENABLE_BITS(ah, AR5K_PCICFG, s_led[0]);
934 
935  /* Gpio settings */
936  ath5k_hw_reg_write(ah, s_led[1], AR5K_GPIOCR);
937  ath5k_hw_reg_write(ah, s_led[2], AR5K_GPIODO);
938 
939  /* Restore sta_id flags and preserve our mac address*/
940  ath5k_hw_reg_write(ah, AR5K_LOW_ID(ah->ah_sta_id),
941  AR5K_STA_ID0);
942  ath5k_hw_reg_write(ah, staid1_flags | AR5K_HIGH_ID(ah->ah_sta_id),
943  AR5K_STA_ID1);
944 
945 
946  /*
947  * Configure PCU
948  */
949 
950  /* Restore bssid and bssid mask */
951  /* XXX: add ah->aid once mac80211 gives this to us */
952  ath5k_hw_set_associd(ah, ah->ah_bssid, 0);
953 
954  /* Set PCU config */
956 
957  /* Clear any pending interrupts
958  * PISR/SISR Not available on 5210 */
959  if (ah->ah_version != AR5K_AR5210)
960  ath5k_hw_reg_write(ah, 0xffffffff, AR5K_PISR);
961 
962  /* Set RSSI/BRSSI thresholds
963  *
964  * Note: If we decide to set this value
965  * dynamicaly, have in mind that when AR5K_RSSI_THR
966  * register is read it might return 0x40 if we haven't
967  * wrote anything to it plus BMISS RSSI threshold is zeroed.
968  * So doing a save/restore procedure here isn't the right
969  * choice. Instead store it on ath5k_hw */
973  AR5K_RSSI_THR);
974 
975  /* MIC QoS support */
976  if (ah->ah_mac_srev >= AR5K_SREV_AR2413) {
977  ath5k_hw_reg_write(ah, 0x000100aa, AR5K_MIC_QOS_CTL);
978  ath5k_hw_reg_write(ah, 0x00003210, AR5K_MIC_QOS_SEL);
979  }
980 
981  /* QoS NOACK Policy */
982  if (ah->ah_version == AR5K_AR5212) {
988  }
989 
990 
991  /*
992  * Configure PHY
993  */
994 
995  /* Set channel on PHY */
996  ret = ath5k_hw_channel(ah, channel);
997  if (ret)
998  return ret;
999 
1000  /*
1001  * Enable the PHY and wait until completion
1002  * This includes BaseBand and Synthesizer
1003  * activation.
1004  */
1006 
1007  /*
1008  * On 5211+ read activation -> rx delay
1009  * and use it.
1010  *
1011  * TODO: Half/quarter rate support
1012  */
1013  if (ah->ah_version != AR5K_AR5210) {
1014  u32 delay;
1017  delay = (channel->hw_value & CHANNEL_CCK) ?
1018  ((delay << 2) / 22) : (delay / 10);
1019 
1020  udelay(100 + (2 * delay));
1021  } else {
1022  mdelay(1);
1023  }
1024 
1025  /*
1026  * Perform ADC test to see if baseband is ready
1027  * Set tx hold and check adc test register
1028  */
1029  phy_tst1 = ath5k_hw_reg_read(ah, AR5K_PHY_TST1);
1031  for (i = 0; i <= 20; i++) {
1032  if (!(ath5k_hw_reg_read(ah, AR5K_PHY_ADC_TEST) & 0x10))
1033  break;
1034  udelay(200);
1035  }
1036  ath5k_hw_reg_write(ah, phy_tst1, AR5K_PHY_TST1);
1037 
1038  /*
1039  * Start automatic gain control calibration
1040  *
1041  * During AGC calibration RX path is re-routed to
1042  * a power detector so we don't receive anything.
1043  *
1044  * This method is used to calibrate some static offsets
1045  * used together with on-the fly I/Q calibration (the
1046  * one performed via ath5k_hw_phy_calibrate), that doesn't
1047  * interrupt rx path.
1048  *
1049  * While rx path is re-routed to the power detector we also
1050  * start a noise floor calibration, to measure the
1051  * card's noise floor (the noise we measure when we are not
1052  * transmiting or receiving anything).
1053  *
1054  * If we are in a noisy environment AGC calibration may time
1055  * out and/or noise floor calibration might timeout.
1056  */
1059 
1060  /* At the same time start I/Q calibration for QAM constellation
1061  * -no need for CCK- */
1062  ah->ah_calibration = 0;
1063  if (!(mode == AR5K_MODE_11B)) {
1064  ah->ah_calibration = 1;
1068  AR5K_PHY_IQ_RUN);
1069  }
1070 
1071  /* Wait for gain calibration to finish (we check for I/Q calibration
1072  * during ath5k_phy_calibrate) */
1073  if (ath5k_hw_register_timeout(ah, AR5K_PHY_AGCCTL,
1074  AR5K_PHY_AGCCTL_CAL, 0, 0)) {
1075  DBG("ath5k: gain calibration timeout (%d MHz)\n",
1076  channel->center_freq);
1077  }
1078 
1079  /*
1080  * If we run NF calibration before AGC, it always times out.
1081  * Binary HAL starts NF and AGC calibration at the same time
1082  * and only waits for AGC to finish. Also if AGC or NF cal.
1083  * times out, reset doesn't fail on binary HAL. I believe
1084  * that's wrong because since rx path is routed to a detector,
1085  * if cal. doesn't finish we won't have RX. Sam's HAL for AR5210/5211
1086  * enables noise floor calibration after offset calibration and if noise
1087  * floor calibration fails, reset fails. I believe that's
1088  * a better approach, we just need to find a polling interval
1089  * that suits best, even if reset continues we need to make
1090  * sure that rx path is ready.
1091  */
1093 
1094 
1095  /*
1096  * Configure QCUs/DCUs
1097  */
1098 
1099  /* TODO: HW Compression support for data queues */
1100  /* TODO: Burst prefetch for data queues */
1101 
1102  /*
1103  * Reset queues and start beacon timers at the end of the reset routine
1104  * This also sets QCU mask on each DCU for 1:1 qcu to dcu mapping
1105  * Note: If we want we can assign multiple qcus on one dcu.
1106  */
1107  ret = ath5k_hw_reset_tx_queue(ah);
1108  if (ret) {
1109  DBG("ath5k: failed to reset TX queue\n");
1110  return ret;
1111  }
1112 
1113  /*
1114  * Configure DMA/Interrupts
1115  */
1116 
1117  /*
1118  * Set Rx/Tx DMA Configuration
1119  *
1120  * Set standard DMA size (128). Note that
1121  * a DMA size of 512 causes rx overruns and tx errors
1122  * on pci-e cards (tested on 5424 but since rx overruns
1123  * also occur on 5416/5418 with madwifi we set 128
1124  * for all PCI-E cards to be safe).
1125  *
1126  * XXX: need to check 5210 for this
1127  * TODO: Check out tx triger level, it's always 64 on dumps but I
1128  * guess we can tweak it and see how it goes ;-)
1129  */
1130  if (ah->ah_version != AR5K_AR5210) {
1135  }
1136 
1137  /* Pre-enable interrupts on 5211/5212*/
1138  if (ah->ah_version != AR5K_AR5210)
1139  ath5k_hw_set_imr(ah, ah->ah_imr);
1140 
1141  /*
1142  * Setup RFKill interrupt if rfkill flag is set on eeprom.
1143  * TODO: Use gpio pin and polarity infos from eeprom
1144  * TODO: Handle this in ath5k_intr because it'll result
1145  * a nasty interrupt storm.
1146  */
1147 #if 0
1148  if (AR5K_EEPROM_HDR_RFKILL(ah->ah_capabilities.cap_eeprom.ee_header)) {
1150  ah->ah_gpio[0] = ath5k_hw_get_gpio(ah, 0);
1151  if (ah->ah_gpio[0] == 0)
1152  ath5k_hw_set_gpio_intr(ah, 0, 1);
1153  else
1154  ath5k_hw_set_gpio_intr(ah, 0, 0);
1155  }
1156 #endif
1157 
1158  /*
1159  * Disable beacons and reset the register
1160  */
1163 
1164  return 0;
1165 }
#define AR5K_PHY_SHIFT_5GHZ
Definition: reg.h:1886
#define AR5K_QOS_NOACK_BYTE_OFFSET
Definition: reg.h:1709
#define AR5K_TXCFG_SDMAMR
Definition: reg.h:172
#define AR5K_PHY_RX_DELAY_M
Definition: reg.h:2181
#define EINVAL
Invalid argument.
Definition: errno.h:429
#define AR5K_TUNE_RSSI_THRES
Definition: ath5k.h:174
#define AR5K_MIC_QOS_CTL
Definition: reg.h:1734
#define AR5K_EEPROM_MODE_11G
Definition: eeprom.h:66
#define AR5K_PHY_TST1_TXHOLD
Definition: reg.h:1910
#define AR5K_EEPROM_MODE_11A
Definition: eeprom.h:64
#define AR5K_BEACON_ENABLE
Definition: reg.h:1250
#define AR5K_BEACON_RESET_TSF
Definition: reg.h:1251
#define AR5K_BEACON
Definition: reg.h:1244
uint16_t mode
Acceleration mode.
Definition: ena.h:26
#define AR5K_INI_RFGAIN_5GHZ
Definition: ath5k.h:141
int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, int initial __unused)
Definition: ath5k_reset.c:283
#define AR5K_PCICFG_LEDSTATE
Definition: reg.h:911
#define AR5K_PHY_AGCCTL_CAL
Definition: reg.h:2031
#define AR5K_GPIODO
Definition: reg.h:948
#define AR5K_PCICFG
Definition: reg.h:882
#define AR5K_PHY_IQ
Definition: reg.h:2192
#define AR5K_TXCFG
Definition: reg.h:171
void ath5k_hw_set_gpio_intr(struct ath5k_hw *ah, unsigned int gpio, u32 interrupt_level)
Definition: ath5k_gpio.c:99
int ath5k_hw_rfgain_init(struct ath5k_hw *ah, unsigned int freq)
Definition: ath5k_phy.c:453
#define AR5K_STA_ID0
Definition: reg.h:1124
int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah)
Definition: ath5k_qcu.c:98
void ath5k_hw_set_associd(struct ath5k_hw *ah, const u8 *bssid, u16 assoc_id)
ath5k_hw_set_associd - Set BSSID for association
Definition: ath5k_pcu.c:229
#define CHANNEL_A
Definition: ath5k.h:640
#define AR5K_QOS_NOACK_BIT_OFFSET
Definition: reg.h:1707
#define AR5K_LOW_ID(_a)
Definition: ath5k.h:154
#define CHANNEL_CCK
Definition: ath5k.h:632
#define AR5K_TUNE_DEFAULT_TXPOWER
Definition: ath5k.h:194
int ath5k_hw_noise_floor_calibration(struct ath5k_hw *ah, short freq)
ath5k_hw_noise_floor_calibration - perform PHY noise floor calibration
Definition: ath5k_phy.c:1128
int ath5k_hw_rfregs_init(struct ath5k_hw *ah, struct net80211_channel *channel, unsigned int mode)
Definition: ath5k_phy.c:515
#define AR5K_STA_ID1_BASE_RATE_11B
Definition: reg.h:1145
#define AR5K_HIGH_ID(_a)
Definition: ath5k.h:158
#define AR5K_PHY_AGCCTL
Definition: reg.h:2030
#define CHANNEL_G
Definition: ath5k.h:642
#define AR5K_REG_WRITE_BITS(ah, _reg, _flags, _val)
Definition: ath5k.h:98
#define AR5K_STA_ID1
Definition: reg.h:1130
#define AR5K_STA_ID1_SELFGEN_DEF_ANT
Definition: reg.h:1146
#define AR5K_GPIOCR
Definition: reg.h:935
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:61
#define CHANNEL_XR
Definition: ath5k.h:638
#define AR5K_PISR
Definition: reg.h:288
int ath5k_hw_channel(struct ath5k_hw *ah, struct net80211_channel *channel)
Definition: ath5k_phy.c:1049
#define AR5K_MIC_QOS_SEL
Definition: reg.h:1741
static void ath5k_hw_tweak_initval_settings(struct ath5k_hw *ah, struct net80211_channel *channel)
Definition: ath5k_reset.c:436
uint32_t channel
RNDIS channel.
Definition: netvsc.h:14
#define AR5K_QOS_NOACK_2BIT_VALUES
Definition: reg.h:1705
int ath5k_hw_set_gpio_input(struct ath5k_hw *ah, u32 gpio)
Definition: ath5k_gpio.c:35
#define AR5K_STA_ID1_RTS_DEF_ANTENNA
Definition: reg.h:1143
#define AR5K_RSSI_THR_BMISS_S
Definition: reg.h:1192
#define AR5K_QUEUE_DCU_SEQNUM(_q)
Definition: reg.h:759
#define AR5K_SREV_AR2413
Definition: ath5k.h:298
#define AR5K_DEFAULT_ANTENNA
Definition: reg.h:1478
#define AR5K_EEPROM_MODE_11B
Definition: eeprom.h:65
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
#define CHANNEL_OFDM
Definition: ath5k.h:633
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define AR5K_QOS_NOACK
Definition: reg.h:1704
#define AR5K_PHY_ADC_TEST
Definition: reg.h:2436
#define AR5K_PHY_ACT_DISABLE
Definition: reg.h:1936
#define AR5K_TXCFG_B_MODE
Definition: reg.h:174
#define AR5K_RSSI_THR
Definition: reg.h:1184
#define AR5K_EEPROM_HDR_RFKILL(_v)
Definition: eeprom.h:75
#define AR5K_TUNE_BMISS_THRES
Definition: ath5k.h:180
#define AR5K_PHY_TST1
Definition: reg.h:1908
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
Definition: timer.c:79
#define AR5K_REG_DISABLE_BITS(ah, _reg, _flags)
Definition: ath5k.h:109
#define CHANNEL_T
Definition: ath5k.h:643
#define AR5K_PHY_IQ_CAL_NUM_LOG_MAX
Definition: reg.h:2197
int ath5k_hw_set_opmode(struct ath5k_hw *ah)
ath5k_hw_set_opmode - Set PCU operating mode
Definition: ath5k_pcu.c:49
#define AR5K_PHY(_n)
Definition: reg.h:1863
#define AR5K_STA_ID1_DESC_ANTENNA
Definition: reg.h:1142
#define AR5K_INI_RFGAIN_2GHZ
Definition: ath5k.h:142
uint16_t delay
Forward delay.
Definition: stp.h:41
#define AR5K_STA_ID1_DEFAULT_ANTENNA
Definition: reg.h:1141
static int ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah, struct net80211_channel *channel)
ath5k_hw_write_ofdm_timings - set OFDM timings on AR5212
Definition: ath5k_reset.c:86
enum ath5k_rfgain ath5k_hw_gainf_calibrate(struct ath5k_hw *ah)
Definition: ath5k_phy.c:390
#define CHANNEL_MODES
Definition: ath5k.h:653
uint8_t ah
Definition: registers.h:85
#define AR5K_RXCFG
Definition: reg.h:198
static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah, struct net80211_channel *channel, u8 *ant, u8 ee_mode)
Definition: ath5k_reset.c:538
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
#define AR5K_SREV_AR5211
Definition: ath5k.h:294
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define CHANNEL_B
Definition: ath5k.h:641
int ath5k_hw_txpower(struct ath5k_hw *ah, struct net80211_channel *channel, u8 ee_mode, u8 txpower)
Definition: ath5k_phy.c:2475
#define AR5K_PHY_IQ_RUN
Definition: reg.h:2199
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
#define AR5K_PHY_RX_DELAY
Definition: reg.h:2180
int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, int change_channel)
#define CHANNEL_TG
Definition: ath5k.h:644
static void ath5k_hw_write_rate_duration(struct ath5k_hw *ah, unsigned int mode __unused)
ath5k_hw_write_rate_duration - fill rate code to duration table
Definition: ath5k_reset.c:157
#define AR5K_STA_ID1_ACKCTS_6MB
Definition: reg.h:1144
u32 ath5k_hw_get_gpio(struct ath5k_hw *ah, u32 gpio)
Definition: ath5k_gpio.c:65
uint8_t u8
Definition: stdint.h:20
uint32_t u32
Definition: stdint.h:24
#define AR5K_PHY_ACT_ENABLE
Definition: reg.h:1935
#define AR5K_RXCFG_SDMAMW
Definition: reg.h:199
#define AR5K_REG_ENABLE_BITS(ah, _reg, _flags)
Definition: ath5k.h:106
#define AR5K_PHY_ACT
Definition: reg.h:1934
#define AR5K_REG_SM(_val, _flags)
Definition: ath5k.h:86

References ah, AR5K_ANT_FIXED_A, AR5K_ANT_FIXED_B, AR5K_AR5210, AR5K_AR5211, AR5K_AR5212, AR5K_BEACON, AR5K_BEACON_ENABLE, AR5K_BEACON_RESET_TSF, AR5K_DEFAULT_ANTENNA, AR5K_DMASIZE_128B, AR5K_EEPROM_HDR_RFKILL, AR5K_EEPROM_MODE_11A, AR5K_EEPROM_MODE_11B, AR5K_EEPROM_MODE_11G, AR5K_GPIOCR, AR5K_GPIODO, AR5K_HIGH_ID, AR5K_INI_RFGAIN_2GHZ, AR5K_INI_RFGAIN_5GHZ, AR5K_LOW_ID, AR5K_MIC_QOS_CTL, AR5K_MIC_QOS_SEL, AR5K_MODE_11A, AR5K_MODE_11A_TURBO, AR5K_MODE_11B, AR5K_MODE_11G, AR5K_MODE_11G_TURBO, AR5K_MODE_XR, AR5K_PCICFG, AR5K_PCICFG_LEDSTATE, AR5K_PHY, AR5K_PHY_ACT, AR5K_PHY_ACT_DISABLE, AR5K_PHY_ACT_ENABLE, AR5K_PHY_ADC_TEST, AR5K_PHY_AGCCTL, AR5K_PHY_AGCCTL_CAL, AR5K_PHY_IQ, AR5K_PHY_IQ_CAL_NUM_LOG_MAX, AR5K_PHY_IQ_RUN, AR5K_PHY_RX_DELAY, AR5K_PHY_RX_DELAY_M, AR5K_PHY_SHIFT_5GHZ, AR5K_PHY_TST1, AR5K_PHY_TST1_TXHOLD, AR5K_PISR, AR5K_QOS_NOACK, AR5K_QOS_NOACK_2BIT_VALUES, AR5K_QOS_NOACK_BIT_OFFSET, AR5K_QOS_NOACK_BYTE_OFFSET, AR5K_QUEUE_DCU_SEQNUM, AR5K_REG_DISABLE_BITS, AR5K_REG_ENABLE_BITS, AR5K_REG_SM, AR5K_REG_WRITE_BITS, AR5K_RF5111, AR5K_RSSI_THR, AR5K_RSSI_THR_BMISS_S, AR5K_RXCFG, AR5K_RXCFG_SDMAMW, AR5K_SREV_AR2413, AR5K_SREV_AR5211, AR5K_STA_ID0, AR5K_STA_ID1, AR5K_STA_ID1_ACKCTS_6MB, AR5K_STA_ID1_BASE_RATE_11B, AR5K_STA_ID1_DEFAULT_ANTENNA, AR5K_STA_ID1_DESC_ANTENNA, AR5K_STA_ID1_RTS_DEF_ANTENNA, AR5K_STA_ID1_SELFGEN_DEF_ANT, AR5K_TUNE_BMISS_THRES, AR5K_TUNE_DEFAULT_TXPOWER, AR5K_TUNE_RSSI_THRES, AR5K_TXCFG, AR5K_TXCFG_B_MODE, AR5K_TXCFG_SDMAMR, ath5k_hw_channel(), ath5k_hw_commit_eeprom_settings(), ath5k_hw_gainf_calibrate(), ath5k_hw_get_gpio(), ath5k_hw_nic_wakeup(), ath5k_hw_noise_floor_calibration(), ath5k_hw_reg_read(), ath5k_hw_reg_write(), ath5k_hw_reset_tx_queue(), ath5k_hw_rfgain_init(), ath5k_hw_rfregs_init(), ath5k_hw_set_associd(), ath5k_hw_set_gpio_input(), ath5k_hw_set_gpio_intr(), ath5k_hw_set_imr(), ath5k_hw_set_opmode(), ath5k_hw_tweak_initval_settings(), ath5k_hw_txpower(), ath5k_hw_write_initvals(), ath5k_hw_write_ofdm_timings(), ath5k_hw_write_rate_duration(), channel, CHANNEL_A, CHANNEL_B, CHANNEL_CCK, CHANNEL_G, CHANNEL_MODES, CHANNEL_OFDM, CHANNEL_T, CHANNEL_TG, CHANNEL_XR, DBG, delay, EINVAL, mdelay(), mode, NULL, and udelay().

Referenced by ath5k_reset().

◆ ath5k_hw_set_power()

int ath5k_hw_set_power ( struct ath5k_hw ah,
enum ath5k_power_mode  mode,
int  set_chip,
u16  sleep_duration 
)

◆ 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_RXE
Definition: reg.h:58
#define AR5K_CR
Definition: reg.h:55
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216

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_RXE
Definition: reg.h:58
#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
#define AR5K_CR
Definition: reg.h:55
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
uint8_t ah
Definition: registers.h:85
#define AR5K_CR_RXD
Definition: reg.h:61
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216

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
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216

References ah, AR5K_RXDP, and ath5k_hw_reg_read().

◆ 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 }
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define AR5K_RXDP
Definition: reg.h:67
uint8_t ah
Definition: registers.h:85

References ah, AR5K_RXDP, and ath5k_hw_reg_write().

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_TXE
Definition: reg.h:561
#define AR5K_REG_WRITE_Q(ah, _reg, _queue)
Definition: ath5k.h:123
#define AR5K_CR_TXD0
Definition: reg.h:59
#define AR5K_QCU_TXD
Definition: reg.h:568
#define AR5K_CR
Definition: reg.h:55
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define AR5K_REG_READ_Q(ah, _reg, _queue)
Definition: ath5k.h:120
#define EIO
Input/output error.
Definition: errno.h:434
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
uint16_t queue
Queue ID.
Definition: ena.h:22
uint32_t u32
Definition: stdint.h:24
#define AR5K_CR_TXE0
Definition: reg.h:56

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, and queue.

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_CTL1
Definition: reg.h:1682
#define EBUSY
Device or resource busy.
Definition: errno.h:339
#define AR5K_QUIET_CTL2_QT_DUR
Definition: reg.h:1691
uint32_t pending
Pending events.
Definition: hyperv.h:12
#define AR5K_REG_WRITE_Q(ah, _reg, _queue)
Definition: ath5k.h:123
#define AR5K_QCU_STS_FRMPENDCNT
Definition: reg.h:629
#define AR5K_CR_TXD0
Definition: reg.h:59
#define AR5K_QUIET_CTL2_QT_PER
Definition: reg.h:1689
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:61
#define AR5K_DIAG_SW_CHANEL_IDLE_HIGH
Definition: reg.h:1435
#define AR5K_QCU_TXD
Definition: reg.h:568
#define AR5K_CR
Definition: reg.h:55
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define AR5K_QUIET_CTL1_QT_EN
Definition: reg.h:1685
#define AR5K_REG_DISABLE_BITS(ah, _reg, _flags)
Definition: ath5k.h:109
#define AR5K_QUEUE_STATUS(_q)
Definition: reg.h:631
#define AR5K_DIAG_SW_5211
Definition: reg.h:1393
#define EIO
Input/output error.
Definition: errno.h:434
#define AR5K_QUIET_CTL2
Definition: reg.h:1688
uint8_t ah
Definition: registers.h:85
#define AR5K_QUIET_CTL1_NEXT_QT_TSF
Definition: reg.h:1683
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
uint16_t queue
Queue ID.
Definition: ena.h:22
#define AR5K_TSF_L32_5211
Definition: reg.h:1442
uint32_t u32
Definition: stdint.h:24
#define AR5K_SREV_AR2414
Definition: ath5k.h:299
#define AR5K_CR_TXE0
Definition: reg.h:56
#define AR5K_REG_ENABLE_BITS(ah, _reg, _flags)
Definition: ath5k.h:106
#define AR5K_REG_SM(_val, _flags)
Definition: ath5k.h:86

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, 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 }
uint16_t u16
Definition: stdint.h:22
#define AR5K_NOQCU_TXDP0
Definition: reg.h:49
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
#define AR5K_QUEUE_TXDP(_q)
Definition: reg.h:556
uint16_t queue
Queue ID.
Definition: ena.h:22

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

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 }
uint16_t u16
Definition: stdint.h:22
#define AR5K_QCU_TXE
Definition: reg.h:561
#define AR5K_NOQCU_TXDP0
Definition: reg.h:49
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define AR5K_REG_READ_Q(ah, _reg, _queue)
Definition: ath5k.h:120
#define EIO
Input/output error.
Definition: errno.h:434
uint8_t ah
Definition: registers.h:85
#define AR5K_QUEUE_TXDP(_q)
Definition: reg.h:556
uint16_t queue
Queue ID.
Definition: ena.h:22

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

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  */
348  imr = ath5k_hw_set_imr(ah, ah->ah_imr & ~AR5K_INT_GLOBAL);
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 
371 done:
372  /*
373  * Restore interrupt mask
374  */
376 
377  return ret;
378 }
Definition: sis900.h:27
#define AR5K_REG_MS(_val, _flags)
Definition: ath5k.h:90
#define AR5K_TXCFG
Definition: reg.h:171
#define AR5K_REG_WRITE_BITS(ah, _reg, _flags, _val)
Definition: ath5k.h:98
#define AR5K_TUNE_MIN_TX_FIFO_THRES
Definition: ath5k.h:169
#define AR5K_TRIG_LVL
Definition: reg.h:1383
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define AR5K_TXCFG_TXFULL
Definition: reg.h:176
#define EIO
Input/output error.
Definition: errno.h:434
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
#define AR5K_TUNE_MAX_TX_FIFO_THRES
Definition: ath5k.h:170
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
uint32_t u32
Definition: stdint.h:24

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, and imr.

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:869
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216

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 
477  if (data & AR5K_ISR_RXDOPPLER)
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_SISR2_TIM
Definition: reg.h:347
#define AR5K_ISR_QCBRURN
Definition: reg.h:320
#define AR5K_RAC_SISR3
Definition: reg.h:372
#define AR5K_ISR_HIUERR
Definition: reg.h:308
#define AR5K_SISR2_CAB_TIMEOUT
Definition: reg.h:351
#define AR5K_SISR2_DPERR
Definition: reg.h:346
#define AR5K_ISR_MCABT
Definition: reg.h:310
#define AR5K_ISR_TIM
Definition: reg.h:315
#define AR5K_REG_MS(_val, _flags)
Definition: ath5k.h:90
#define AR5K_RAC_PISR
Definition: reg.h:368
#define AR5K_ISR_TXDESC
Definition: reg.h:296
#define AR5K_SISR3_QCBRURN
Definition: reg.h:358
#define AR5K_SISR1_QCU_TXEOL
Definition: reg.h:338
#define AR5K_ISR_RXDOPPLER
Definition: reg.h:314
#define AR5K_SISR2_DTIM_SYNC
Definition: reg.h:349
#define AR5K_SISR1_QCU_TXERR
Definition: reg.h:336
#define AR5K_ISR_QTRIG
Definition: reg.h:321
#define AR5K_RAC_SISR4
Definition: reg.h:373
#define AR5K_ISR_TXEOL
Definition: reg.h:299
#define AR5K_ISR_QCBRORN
Definition: reg.h:319
#define AR5K_ISR_SSERR
Definition: reg.h:312
#define AR5K_ISR_BCNMISC
Definition: reg.h:316
#define ENODEV
No such device.
Definition: errno.h:510
#define AR5K_ISR_TXURN
Definition: reg.h:300
#define AR5K_ISR_TXOK
Definition: reg.h:295
#define AR5K_ISR
Definition: reg.h:287
#define AR5K_RAC_SISR1
Definition: reg.h:370
#define AR5K_SISR2_QCU_TXURN
Definition: reg.h:342
#define AR5K_ISR_TXERR
Definition: reg.h:297
#define AR5K_ISR_DPERR
Definition: reg.h:313
uint8_t data[48]
Additional event data.
Definition: ena.h:22
#define AR5K_SISR4_QTRIG
Definition: reg.h:362
uint8_t ah
Definition: registers.h:85
#define AR5K_SISR2_BCN_TIMEOUT
Definition: reg.h:350
#define AR5K_SISR0_QCU_TXDESC
Definition: reg.h:332
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
#define AR5K_RAC_SISR0
Definition: reg.h:369
#define AR5K_SISR3_QCBRORN
Definition: reg.h:356
#define AR5K_SISR2_SSERR
Definition: reg.h:345
#define AR5K_ISR_BNR
Definition: reg.h:309
#define AR5K_SISR2_DTIM
Definition: reg.h:352
#define AR5K_SISR0_QCU_TXOK
Definition: reg.h:330
uint32_t u32
Definition: stdint.h:24
#define AR5K_SISR2_MCABT
Definition: reg.h:344
if(natsemi->flags &NATSEMI_64BIT) return 1
#define AR5K_RAC_SISR2
Definition: reg.h:371

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 if().

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;
579  | AR5K_SIMR2_DPERR);
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_SISR2_TIM
Definition: reg.h:347
#define AR5K_SIMR2_MCABT
Definition: reg.h:435
#define AR5K_SISR2_CAB_TIMEOUT
Definition: reg.h:351
#define AR5K_IMR_SSERR
Definition: reg.h:406
#define AR5K_IMR_MCABT
Definition: reg.h:404
#define AR5K_IMR_TIM
Definition: reg.h:409
#define AR5K_SISR2_DTIM_SYNC
Definition: reg.h:349
#define AR5K_PIMR
Definition: reg.h:382
#define AR5K_SIMR2
Definition: reg.h:432
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define AR5K_SIMR2_SSERR
Definition: reg.h:436
#define AR5K_IMR_RXDOPPLER
Definition: reg.h:408
#define AR5K_IER_DISABLE
Definition: reg.h:93
#define AR5K_RXNOFRM
Definition: reg.h:231
#define AR5K_IMR
Definition: reg.h:381
uint8_t ah
Definition: registers.h:85
#define AR5K_IER
Definition: reg.h:92
#define AR5K_SISR2_BCN_TIMEOUT
Definition: reg.h:350
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
#define AR5K_IMR_HIUERR
Definition: reg.h:402
#define AR5K_IMR_DPERR
Definition: reg.h:407
#define AR5K_SISR2_DTIM
Definition: reg.h:352
#define AR5K_SIMR2_DPERR
Definition: reg.h:437
#define AR5K_SIMR2_QCU_TXURN
Definition: reg.h:433
ath5k_int
enum ath5k_int - Hardware interrupt masks helpers
Definition: ath5k.h:806
uint32_t u32
Definition: stdint.h:24

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(), and ath5k_hw_reg_write().

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

◆ ath5k_eeprom_init()

int ath5k_eeprom_init ( struct ath5k_hw ah)

Definition at line 1698 of file ath5k_eeprom.c.

1699 {
1700  int err;
1701 
1703  if (err < 0)
1704  return err;
1705 
1706  err = ath5k_eeprom_init_modes(ah);
1707  if (err < 0)
1708  return err;
1709 
1711  if (err < 0)
1712  return err;
1713 
1715  if (err < 0)
1716  return err;
1717 
1718  return 0;
1719 }
static int ath5k_eeprom_read_pcal_info(struct ath5k_hw *ah)
static int ath5k_eeprom_read_ctl_info(struct ath5k_hw *ah)
static int ath5k_eeprom_init_header(struct ath5k_hw *ah)
Definition: ath5k_eeprom.c:104
uint8_t ah
Definition: registers.h:85
static int ath5k_eeprom_init_modes(struct ath5k_hw *ah)
Definition: ath5k_eeprom.c:464

References ah, ath5k_eeprom_init_header(), ath5k_eeprom_init_modes(), ath5k_eeprom_read_ctl_info(), and ath5k_eeprom_read_pcal_info().

Referenced by ath5k_hw_attach().

◆ ath5k_eeprom_detach()

void ath5k_eeprom_detach ( struct ath5k_hw ah)

Definition at line 1577 of file ath5k_eeprom.c.

1578 {
1579  u8 mode;
1580 
1583 }
#define AR5K_EEPROM_MODE_11G
Definition: eeprom.h:66
#define AR5K_EEPROM_MODE_11A
Definition: eeprom.h:64
uint16_t mode
Acceleration mode.
Definition: ena.h:26
static int ath5k_eeprom_free_pcal_info(struct ath5k_hw *ah, int mode)
uint8_t ah
Definition: registers.h:85
uint8_t u8
Definition: stdint.h:20

References ah, AR5K_EEPROM_MODE_11A, AR5K_EEPROM_MODE_11G, ath5k_eeprom_free_pcal_info(), and mode.

Referenced by ath5k_hw_detach().

◆ ath5k_eeprom_read_mac()

int ath5k_eeprom_read_mac ( struct ath5k_hw ah,
u8 mac 
)

Definition at line 1724 of file ath5k_eeprom.c.

1725 {
1726  u8 mac_d[ETH_ALEN] = {};
1727  u32 total, offset;
1728  u16 data;
1729  int octet, ret;
1730 
1731  ret = ath5k_hw_eeprom_read(ah, 0x20, &data);
1732  if (ret)
1733  return ret;
1734 
1735  for (offset = 0x1f, octet = 0, total = 0; offset >= 0x1d; offset--) {
1736  ret = ath5k_hw_eeprom_read(ah, offset, &data);
1737  if (ret)
1738  return ret;
1739 
1740  total += data;
1741  mac_d[octet + 1] = data & 0xff;
1742  mac_d[octet] = data >> 8;
1743  octet += 2;
1744  }
1745 
1746  if (!total || total == 3 * 0xffff)
1747  return -EINVAL;
1748 
1749  memcpy(mac, mac_d, ETH_ALEN);
1750 
1751  return 0;
1752 }
uint16_t u16
Definition: stdint.h:22
#define EINVAL
Invalid argument.
Definition: errno.h:429
uint8_t mac[ETH_ALEN]
MAC address.
Definition: ena.h:24
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static int ath5k_hw_eeprom_read(struct ath5k_hw *ah, u32 offset, u16 *data)
Definition: ath5k_eeprom.c:39
#define ETH_ALEN
Definition: if_ether.h:9
uint8_t data[48]
Additional event data.
Definition: ena.h:22
uint8_t ah
Definition: registers.h:85
uint16_t offset
Offset to command line.
Definition: bzimage.h:8
uint8_t u8
Definition: stdint.h:20
uint32_t u32
Definition: stdint.h:24

References ah, ath5k_hw_eeprom_read(), data, EINVAL, ETH_ALEN, mac, memcpy(), and offset.

Referenced by ath5k_attach().

◆ ath5k_eeprom_is_hb63()

int ath5k_eeprom_is_hb63 ( struct ath5k_hw ah)

Definition at line 1754 of file ath5k_eeprom.c.

1755 {
1756  u16 data;
1757 
1759 
1760  if ((ah->ah_mac_version == (AR5K_SREV_AR2425 >> 4)) && data)
1761  return 1;
1762  else
1763  return 0;
1764 }
uint16_t u16
Definition: stdint.h:22
#define AR5K_EEPROM_IS_HB63
Definition: eeprom.h:30
static int ath5k_hw_eeprom_read(struct ath5k_hw *ah, u32 offset, u16 *data)
Definition: ath5k_eeprom.c:39
#define AR5K_SREV_AR2425
Definition: ath5k.h:306
uint8_t data[48]
Additional event data.
Definition: ena.h:22
uint8_t ah
Definition: registers.h:85

References ah, AR5K_EEPROM_IS_HB63, AR5K_SREV_AR2425, ath5k_hw_eeprom_read(), and data.

Referenced by ath5k_hw_tweak_initval_settings().

◆ ath5k_hw_set_opmode()

int ath5k_hw_set_opmode ( struct ath5k_hw ah)

ath5k_hw_set_opmode - Set PCU operating mode

@ah: The &struct ath5k_hw

Initialize PCU for the various operating modes (AP/STA etc)

For iPXE we always assume STA mode.

Definition at line 49 of file ath5k_pcu.c.

50 {
51  u32 pcu_reg, beacon_reg, low_id, high_id;
52 
53 
54  /* Preserve rest settings */
55  pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000;
56  pcu_reg &= ~(AR5K_STA_ID1_ADHOC | AR5K_STA_ID1_AP
58  | (ah->ah_version == AR5K_AR5210 ?
60 
61  beacon_reg = 0;
62 
63  pcu_reg |= AR5K_STA_ID1_KEYSRCH_MODE
64  | (ah->ah_version == AR5K_AR5210 ?
66 
67  /*
68  * Set PCU registers
69  */
70  low_id = AR5K_LOW_ID(ah->ah_sta_id);
71  high_id = AR5K_HIGH_ID(ah->ah_sta_id);
73  ath5k_hw_reg_write(ah, pcu_reg | high_id, AR5K_STA_ID1);
74 
75  /*
76  * Set Beacon Control Register on 5210
77  */
78  if (ah->ah_version == AR5K_AR5210)
79  ath5k_hw_reg_write(ah, beacon_reg, AR5K_BCR);
80 
81  return 0;
82 }
#define AR5K_STA_ID1_KEYSRCH_MODE
Definition: reg.h:1148
#define AR5K_BCR
Definition: reg.h:105
#define AR5K_STA_ID0
Definition: reg.h:1124
#define AR5K_STA_ID1_ADHOC
Definition: reg.h:1133
#define AR5K_LOW_ID(_a)
Definition: ath5k.h:154
#define AR5K_HIGH_ID(_a)
Definition: ath5k.h:158
#define AR5K_STA_ID1
Definition: reg.h:1130
#define AR5K_STA_ID1_PWR_SV
Definition: reg.h:1134
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define AR5K_STA_ID1_AP
Definition: reg.h:1132
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
uint32_t u32
Definition: stdint.h:24
#define AR5K_STA_ID1_NO_PSPOLL
Definition: reg.h:1136

References ah, AR5K_AR5210, AR5K_BCR, AR5K_HIGH_ID, AR5K_LOW_ID, AR5K_STA_ID0, AR5K_STA_ID1, AR5K_STA_ID1_ADHOC, AR5K_STA_ID1_AP, AR5K_STA_ID1_KEYSRCH_MODE, AR5K_STA_ID1_NO_PSPOLL, AR5K_STA_ID1_PWR_SV, ath5k_hw_reg_read(), and ath5k_hw_reg_write().

Referenced by ath5k_hw_attach(), ath5k_hw_reset(), and ath5k_mode_setup().

◆ ath5k_hw_get_lladdr()

void ath5k_hw_get_lladdr ( struct ath5k_hw ah,
u8 mac 
)

ath5k_hw_get_lladdr - Get station id

@ah: The &struct ath5k_hw @mac: The card's mac address

Initialize ah->ah_sta_id using the mac address provided (just a memcpy).

TODO: Remove it once we merge ath5k_softc and ath5k_hw

Definition at line 188 of file ath5k_pcu.c.

189 {
190  memcpy(mac, ah->ah_sta_id, ETH_ALEN);
191 }
uint8_t mac[ETH_ALEN]
MAC address.
Definition: ena.h:24
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define ETH_ALEN
Definition: if_ether.h:9
uint8_t ah
Definition: registers.h:85

References ah, ETH_ALEN, mac, and memcpy().

◆ ath5k_hw_set_lladdr()

int ath5k_hw_set_lladdr ( struct ath5k_hw ah,
const u8 mac 
)

ath5k_hw_set_lladdr - Set station id

@ah: The &struct ath5k_hw @mac: The card's mac address

Set station id on hw using the provided mac address

Definition at line 201 of file ath5k_pcu.c.

202 {
203  u32 low_id, high_id;
204  u32 pcu_reg;
205 
206  /* Set new station ID */
207  memcpy(ah->ah_sta_id, mac, ETH_ALEN);
208 
209  pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000;
210 
211  low_id = AR5K_LOW_ID(mac);
212  high_id = AR5K_HIGH_ID(mac);
213 
215  ath5k_hw_reg_write(ah, pcu_reg | high_id, AR5K_STA_ID1);
216 
217  return 0;
218 }
uint8_t mac[ETH_ALEN]
MAC address.
Definition: ena.h:24
#define AR5K_STA_ID0
Definition: reg.h:1124
#define AR5K_LOW_ID(_a)
Definition: ath5k.h:154
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define AR5K_HIGH_ID(_a)
Definition: ath5k.h:158
#define AR5K_STA_ID1
Definition: reg.h:1130
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define ETH_ALEN
Definition: if_ether.h:9
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
uint32_t u32
Definition: stdint.h:24

References ah, AR5K_HIGH_ID, AR5K_LOW_ID, AR5K_STA_ID0, AR5K_STA_ID1, ath5k_hw_reg_read(), ath5k_hw_reg_write(), ETH_ALEN, mac, and memcpy().

Referenced by ath5k_start(), and ath5k_stop().

◆ ath5k_hw_set_associd()

void ath5k_hw_set_associd ( struct ath5k_hw ah,
const u8 bssid,
u16  assoc_id 
)

ath5k_hw_set_associd - Set BSSID for association

@ah: The &struct ath5k_hw @bssid: BSSID @assoc_id: Assoc id

Sets the BSSID which trigers the "SME Join" operation

Definition at line 229 of file ath5k_pcu.c.

230 {
231  u32 low_id, high_id;
232 
233  /*
234  * Set simple BSSID mask on 5212
235  */
236  if (ah->ah_version == AR5K_AR5212) {
237  ath5k_hw_reg_write(ah, AR5K_LOW_ID(ah->ah_bssid_mask),
238  AR5K_BSS_IDM0);
239  ath5k_hw_reg_write(ah, AR5K_HIGH_ID(ah->ah_bssid_mask),
240  AR5K_BSS_IDM1);
241  }
242 
243  /*
244  * Set BSSID which triggers the "SME Join" operation
245  */
246  low_id = AR5K_LOW_ID(bssid);
247  high_id = AR5K_HIGH_ID(bssid);
249  ath5k_hw_reg_write(ah, high_id | ((assoc_id & 0x3fff) <<
251 }
#define AR5K_BSS_ID0
Definition: reg.h:1156
#define AR5K_BSS_ID1_AID_S
Definition: reg.h:1165
#define AR5K_BSS_IDM0
Definition: reg.h:1652
#define AR5K_LOW_ID(_a)
Definition: ath5k.h:154
#define AR5K_HIGH_ID(_a)
Definition: ath5k.h:158
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define AR5K_BSS_IDM1
Definition: reg.h:1653
#define AR5K_BSS_ID1
Definition: reg.h:1163
uint8_t ah
Definition: registers.h:85
uint32_t u32
Definition: stdint.h:24

References ah, AR5K_AR5212, AR5K_BSS_ID0, AR5K_BSS_ID1, AR5K_BSS_ID1_AID_S, AR5K_BSS_IDM0, AR5K_BSS_IDM1, AR5K_HIGH_ID, AR5K_LOW_ID, and ath5k_hw_reg_write().

Referenced by ath5k_config(), ath5k_hw_attach(), and ath5k_hw_reset().

◆ ath5k_hw_set_bssid_mask()

int ath5k_hw_set_bssid_mask ( struct ath5k_hw ah,
const u8 mask 
)

ath5k_hw_set_bssid_mask - filter out bssids we listen

@ah: the &struct ath5k_hw @mask: the bssid_mask, a u8 array of size ETH_ALEN

BSSID masking is a method used by AR5212 and newer hardware to inform PCU which bits of the interface's MAC address should be looked at when trying to decide which packets to ACK. In station mode and AP mode with a single BSS every bit matters since we lock to only one BSS. In AP mode with multiple BSSes (virtual interfaces) not every bit matters because hw must accept frames for all BSSes and so we tweak some bits of our mac address in order to have multiple BSSes.

NOTE: This is a simple filter and does not filter out all relevant frames. Some frames that are not for us might get ACKed from us by PCU because they just match the mask.

When handling multiple BSSes you can get the BSSID mask by computing the set of ~ ( MAC XOR BSSID ) for all bssids we handle.

When you do this you are essentially computing the common bits of all your BSSes. Later it is assumed the harware will "and" (&) the BSSID mask with the MAC address to obtain the relevant bits and compare the result with (frame's BSSID & mask) to see if they match.

Definition at line 349 of file ath5k_pcu.c.

350 {
351  u32 low_id, high_id;
352 
353  /* Cache bssid mask so that we can restore it
354  * on reset */
355  memcpy(ah->ah_bssid_mask, mask, ETH_ALEN);
356  if (ah->ah_version == AR5K_AR5212) {
357  low_id = AR5K_LOW_ID(mask);
358  high_id = AR5K_HIGH_ID(mask);
359 
362 
363  return 0;
364  }
365 
366  return -EIO;
367 }
#define AR5K_BSS_IDM0
Definition: reg.h:1652
#define AR5K_LOW_ID(_a)
Definition: ath5k.h:154
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define AR5K_HIGH_ID(_a)
Definition: ath5k.h:158
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define ETH_ALEN
Definition: if_ether.h:9
#define AR5K_BSS_IDM1
Definition: reg.h:1653
#define EIO
Input/output error.
Definition: errno.h:434
uint8_t ah
Definition: registers.h:85
uint32_t u32
Definition: stdint.h:24

References ah, AR5K_AR5212, AR5K_BSS_IDM0, AR5K_BSS_IDM1, AR5K_HIGH_ID, AR5K_LOW_ID, ath5k_hw_reg_write(), EIO, ETH_ALEN, and memcpy().

Referenced by ath5k_attach(), and ath5k_mode_setup().

◆ ath5k_hw_start_rx_pcu()

void ath5k_hw_start_rx_pcu ( struct ath5k_hw ah)

ath5k_hw_start_rx_pcu - Start RX engine

@ah: The &struct ath5k_hw

Starts RX engine on PCU so that hw can process RXed frames (ACK etc).

NOTE: RX DMA should be already enabled using ath5k_hw_start_rx_dma TODO: Init ANI here

Definition at line 385 of file ath5k_pcu.c.

386 {
388 }
#define AR5K_DIAG_SW_DIS_RX
Definition: reg.h:1404
#define AR5K_REG_DISABLE_BITS(ah, _reg, _flags)
Definition: ath5k.h:109
#define AR5K_DIAG_SW
Definition: reg.h:1394
uint8_t ah
Definition: registers.h:85

References ah, AR5K_DIAG_SW, AR5K_DIAG_SW_DIS_RX, and AR5K_REG_DISABLE_BITS.

Referenced by ath5k_rx_start().

◆ ath5k_hw_stop_rx_pcu()

void ath5k_hw_stop_rx_pcu ( struct ath5k_hw ah)

at5k_hw_stop_rx_pcu - Stop RX engine

@ah: The &struct ath5k_hw

Stops RX engine on PCU

TODO: Detach ANI here

Definition at line 399 of file ath5k_pcu.c.

400 {
402 }
#define AR5K_DIAG_SW_DIS_RX
Definition: reg.h:1404
#define AR5K_DIAG_SW
Definition: reg.h:1394
uint8_t ah
Definition: registers.h:85
#define AR5K_REG_ENABLE_BITS(ah, _reg, _flags)
Definition: ath5k.h:106

References ah, AR5K_DIAG_SW, AR5K_DIAG_SW_DIS_RX, and AR5K_REG_ENABLE_BITS.

Referenced by ath5k_rx_stop().

◆ ath5k_hw_set_mcast_filter()

void ath5k_hw_set_mcast_filter ( struct ath5k_hw ah,
u32  filter0,
u32  filter1 
)

Definition at line 407 of file ath5k_pcu.c.

408 {
409  /* Set the multicat filter */
412 }
#define AR5K_MCAST_FILTER0
Definition: reg.h:1353
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define AR5K_MCAST_FILTER1
Definition: reg.h:1361
uint8_t ah
Definition: registers.h:85

References ah, AR5K_MCAST_FILTER0, AR5K_MCAST_FILTER1, and ath5k_hw_reg_write().

Referenced by ath5k_configure_filter(), and ath5k_mode_setup().

◆ ath5k_hw_get_rx_filter()

u32 ath5k_hw_get_rx_filter ( struct ath5k_hw ah)

ath5k_hw_get_rx_filter - Get current rx filter

@ah: The &struct ath5k_hw

Returns the RX filter by reading rx filter and phy error filter registers. RX filter is used to set the allowed frame types that PCU will accept and pass to the driver. For a list of frame types check out reg.h.

Definition at line 425 of file ath5k_pcu.c.

426 {
427  u32 data, filter = 0;
428 
430 
431  /*Radar detection for 5212*/
432  if (ah->ah_version == AR5K_AR5212) {
434 
439  }
440 
441  return filter;
442 }
#define AR5K_PHY_ERR_FIL_RADAR
Definition: reg.h:1716
#define AR5K_PHY_ERR_FIL_OFDM
Definition: reg.h:1717
#define AR5K_RX_FILTER_RADARERR
Definition: reg.h:1344
UINT8_t filter
Receive packet filter.
Definition: pxe_api.h:68
#define AR5K_PHY_ERR_FIL
Definition: reg.h:1715
#define AR5K_RX_FILTER
Definition: reg.h:1327
#define AR5K_RX_FILTER_PHYERR
Definition: reg.h:1341
uint8_t data[48]
Additional event data.
Definition: ena.h:22
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
#define AR5K_PHY_ERR_FIL_CCK
Definition: reg.h:1718
uint32_t u32
Definition: stdint.h:24

References ah, AR5K_AR5212, AR5K_PHY_ERR_FIL, AR5K_PHY_ERR_FIL_CCK, AR5K_PHY_ERR_FIL_OFDM, AR5K_PHY_ERR_FIL_RADAR, AR5K_RX_FILTER, AR5K_RX_FILTER_PHYERR, AR5K_RX_FILTER_RADARERR, ath5k_hw_reg_read(), data, and filter.

◆ ath5k_hw_set_rx_filter()

void ath5k_hw_set_rx_filter ( struct ath5k_hw ah,
u32  filter 
)

ath5k_hw_set_rx_filter - Set rx filter

@ah: The &struct ath5k_hw @filter: RX filter mask (see reg.h)

Sets RX filter register and also handles PHY error filter register on 5212 and newer chips so that we have proper PHY error reporting.

Definition at line 454 of file ath5k_pcu.c.

455 {
456  u32 data = 0;
457 
458  /* Set PHY error filter register on 5212*/
459  if (ah->ah_version == AR5K_AR5212) {
464  }
465 
466  /*
467  * The AR5210 uses promiscous mode to detect radar activity
468  */
469  if (ah->ah_version == AR5K_AR5210 &&
473  }
474 
475  /*Zero length DMA (phy error reporting) */
476  if (data)
478  else
480 
481  /*Write RX Filter register*/
483 
484  /*Write PHY error filter register on 5212*/
485  if (ah->ah_version == AR5K_AR5212)
487 
488 }
#define AR5K_PHY_ERR_FIL_RADAR
Definition: reg.h:1716
#define AR5K_PHY_ERR_FIL_OFDM
Definition: reg.h:1717
#define AR5K_RX_FILTER_RADARERR
Definition: reg.h:1344
UINT8_t filter
Receive packet filter.
Definition: pxe_api.h:68
#define AR5K_RXCFG_ZLFDMA
Definition: reg.h:201
#define AR5K_RX_FILTER_PROM
Definition: reg.h:1334
#define AR5K_PHY_ERR_FIL
Definition: reg.h:1715
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define AR5K_RX_FILTER
Definition: reg.h:1327
#define AR5K_RX_FILTER_PHYERR
Definition: reg.h:1341
#define AR5K_REG_DISABLE_BITS(ah, _reg, _flags)
Definition: ath5k.h:109
uint8_t data[48]
Additional event data.
Definition: ena.h:22
uint8_t ah
Definition: registers.h:85
#define AR5K_RXCFG
Definition: reg.h:198
#define AR5K_PHY_ERR_FIL_CCK
Definition: reg.h:1718
uint32_t u32
Definition: stdint.h:24
#define AR5K_REG_ENABLE_BITS(ah, _reg, _flags)
Definition: ath5k.h:106

References ah, AR5K_AR5210, AR5K_AR5212, AR5K_PHY_ERR_FIL, AR5K_PHY_ERR_FIL_CCK, AR5K_PHY_ERR_FIL_OFDM, AR5K_PHY_ERR_FIL_RADAR, AR5K_REG_DISABLE_BITS, AR5K_REG_ENABLE_BITS, AR5K_RX_FILTER, AR5K_RX_FILTER_PHYERR, AR5K_RX_FILTER_PROM, AR5K_RX_FILTER_RADARERR, AR5K_RXCFG, AR5K_RXCFG_ZLFDMA, ath5k_hw_reg_write(), data, and filter.

Referenced by ath5k_configure_filter(), ath5k_mode_setup(), and ath5k_rx_stop().

◆ ath5k_hw_set_ack_bitrate_high()

void ath5k_hw_set_ack_bitrate_high ( struct ath5k_hw ah,
int  high 
)

ath5k_hw_set_ack_bitrate - set bitrate for ACKs

@ah: The &struct ath5k_hw @high: Flag to determine if we want to use high transmition rate for ACKs or not

If high flag is set, we tell hw to use a set of control rates based on the current transmition rate (check out control_rates array inside reset.c). If not hw just uses the lowest rate available for the current modulation scheme being used (1Mbit for CCK and 6Mbits for OFDM).

Definition at line 96 of file ath5k_pcu.c.

97 {
98  if (ah->ah_version != AR5K_AR5212)
99  return;
100  else {
102  if (high)
104  else
106  }
107 }
void __asmcall int val
Definition: setjmp.h:12
#define AR5K_STA_ID1_BASE_RATE_11B
Definition: reg.h:1145
#define AR5K_STA_ID1
Definition: reg.h:1130
uint32_t high
High 32 bits of address.
Definition: myson.h:20
#define AR5K_REG_DISABLE_BITS(ah, _reg, _flags)
Definition: ath5k.h:109
uint8_t ah
Definition: registers.h:85
#define AR5K_STA_ID1_ACKCTS_6MB
Definition: reg.h:1144
uint32_t u32
Definition: stdint.h:24
#define AR5K_REG_ENABLE_BITS(ah, _reg, _flags)
Definition: ath5k.h:106

References ah, AR5K_AR5212, AR5K_REG_DISABLE_BITS, AR5K_REG_ENABLE_BITS, AR5K_STA_ID1, AR5K_STA_ID1_ACKCTS_6MB, AR5K_STA_ID1_BASE_RATE_11B, high, and val.

Referenced by ath5k_init().

◆ ath5k_hw_set_ack_timeout()

int ath5k_hw_set_ack_timeout ( struct ath5k_hw ah,
unsigned int  timeout 
)

ath5k_hw_set_ack_timeout - Set ACK timeout on PCU

@ah: The &struct ath5k_hw @timeout: Timeout in usec

Definition at line 131 of file ath5k_pcu.c.

132 {
134  ah->ah_turbo) <= timeout)
135  return -EINVAL;
136 
138  ath5k_hw_htoclock(timeout, ah->ah_turbo));
139 
140  return 0;
141 }
#define EINVAL
Invalid argument.
Definition: errno.h:429
#define AR5K_TIME_OUT
Definition: reg.h:1175
#define AR5K_REG_MS(_val, _flags)
Definition: ath5k.h:90
#define AR5K_REG_WRITE_BITS(ah, _reg, _flags, _val)
Definition: ath5k.h:98
static unsigned int ath5k_hw_htoclock(unsigned int usec, int turbo)
Definition: ath5k.h:1199
#define AR5K_TIME_OUT_ACK
Definition: reg.h:1176
static unsigned int ath5k_hw_clocktoh(unsigned int clock, int turbo)
Definition: ath5k.h:1208
uint8_t ah
Definition: registers.h:85
void timeout(int)

References ah, AR5K_REG_MS, AR5K_REG_WRITE_BITS, AR5K_TIME_OUT, AR5K_TIME_OUT_ACK, ath5k_hw_clocktoh(), ath5k_hw_htoclock(), EINVAL, and timeout().

◆ ath5k_hw_get_ack_timeout()

unsigned int ath5k_hw_get_ack_timeout ( struct ath5k_hw ah)

ath5k_hw_het_ack_timeout - Get ACK timeout from PCU in usec

@ah: The &struct ath5k_hw

Definition at line 119 of file ath5k_pcu.c.

120 {
122  AR5K_TIME_OUT), AR5K_TIME_OUT_ACK), ah->ah_turbo);
123 }
#define AR5K_TIME_OUT
Definition: reg.h:1175
#define AR5K_REG_MS(_val, _flags)
Definition: ath5k.h:90
#define AR5K_TIME_OUT_ACK
Definition: reg.h:1176
static unsigned int ath5k_hw_clocktoh(unsigned int clock, int turbo)
Definition: ath5k.h:1208
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216

References ah, AR5K_REG_MS, AR5K_TIME_OUT, AR5K_TIME_OUT_ACK, ath5k_hw_clocktoh(), and ath5k_hw_reg_read().

◆ ath5k_hw_set_cts_timeout()

int ath5k_hw_set_cts_timeout ( struct ath5k_hw ah,
unsigned int  timeout 
)

ath5k_hw_set_cts_timeout - Set CTS timeout on PCU

@ah: The &struct ath5k_hw @timeout: Timeout in usec

Definition at line 160 of file ath5k_pcu.c.

161 {
163  ah->ah_turbo) <= timeout)
164  return -EINVAL;
165 
167  ath5k_hw_htoclock(timeout, ah->ah_turbo));
168 
169  return 0;
170 }
#define EINVAL
Invalid argument.
Definition: errno.h:429
#define AR5K_TIME_OUT
Definition: reg.h:1175
#define AR5K_REG_MS(_val, _flags)
Definition: ath5k.h:90
#define AR5K_REG_WRITE_BITS(ah, _reg, _flags, _val)
Definition: ath5k.h:98
static unsigned int ath5k_hw_htoclock(unsigned int usec, int turbo)
Definition: ath5k.h:1199
#define AR5K_TIME_OUT_CTS
Definition: reg.h:1178
static unsigned int ath5k_hw_clocktoh(unsigned int clock, int turbo)
Definition: ath5k.h:1208
uint8_t ah
Definition: registers.h:85
void timeout(int)

References ah, AR5K_REG_MS, AR5K_REG_WRITE_BITS, AR5K_TIME_OUT, AR5K_TIME_OUT_CTS, ath5k_hw_clocktoh(), ath5k_hw_htoclock(), EINVAL, and timeout().

◆ ath5k_hw_get_cts_timeout()

unsigned int ath5k_hw_get_cts_timeout ( struct ath5k_hw ah)

ath5k_hw_get_cts_timeout - Get CTS timeout from PCU in usec

@ah: The &struct ath5k_hw

Definition at line 148 of file ath5k_pcu.c.

149 {
151  AR5K_TIME_OUT), AR5K_TIME_OUT_CTS), ah->ah_turbo);
152 }
#define AR5K_TIME_OUT
Definition: reg.h:1175
#define AR5K_REG_MS(_val, _flags)
Definition: ath5k.h:90
#define AR5K_TIME_OUT_CTS
Definition: reg.h:1178
static unsigned int ath5k_hw_clocktoh(unsigned int clock, int turbo)
Definition: ath5k.h:1208
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216

References ah, AR5K_REG_MS, AR5K_TIME_OUT, AR5K_TIME_OUT_CTS, ath5k_hw_clocktoh(), and ath5k_hw_reg_read().

◆ ath5k_hw_reset_key()

int ath5k_hw_reset_key ( struct ath5k_hw ah,
u16  entry 
)

Definition at line 497 of file ath5k_pcu.c.

498 {
499  unsigned int i, type;
500  u16 micentry = entry + AR5K_KEYTABLE_MIC_OFFSET;
501 
503 
504  for (i = 0; i < AR5K_KEYCACHE_SIZE; i++)
505  ath5k_hw_reg_write(ah, 0, AR5K_KEYTABLE_OFF(entry, i));
506 
507  /* Reset associated MIC entry if TKIP
508  * is enabled located at offset (entry + 64) */
509  if (type == AR5K_KEYTABLE_TYPE_TKIP) {
510  for (i = 0; i < AR5K_KEYCACHE_SIZE / 2 ; i++)
512  AR5K_KEYTABLE_OFF(micentry, i));
513  }
514 
515  /*
516  * Set NULL encryption on AR5212+
517  *
518  * Note: AR5K_KEYTABLE_TYPE -> AR5K_KEYTABLE_OFF(entry, 5)
519  * AR5K_KEYTABLE_TYPE_NULL -> 0x00000007
520  *
521  * Note2: Windows driver (ndiswrapper) sets this to
522  * 0x00000714 instead of 0x00000007
523  */
524  if (ah->ah_version >= AR5K_AR5211) {
526  AR5K_KEYTABLE_TYPE(entry));
527 
528  if (type == AR5K_KEYTABLE_TYPE_TKIP) {
530  AR5K_KEYTABLE_TYPE(micentry));
531  }
532  }
533 
534  return 0;
535 }
uint16_t u16
Definition: stdint.h:22
#define AR5K_KEYTABLE_OFF(_n, x)
Definition: reg.h:1821
#define AR5K_KEYTABLE_TYPE_NULL
Definition: reg.h:1829
uint32_t type
Operating system type.
Definition: ena.h:12
#define AR5K_KEYTABLE_TYPE(_n)
Definition: reg.h:1822
#define AR5K_KEYTABLE_TYPE_TKIP
Definition: reg.h:1826
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
#define AR5K_KEYTABLE_MIC_OFFSET
Definition: reg.h:1837
#define AR5K_KEYCACHE_SIZE
Definition: ath5k.h:734

References ah, AR5K_AR5211, AR5K_KEYCACHE_SIZE, AR5K_KEYTABLE_MIC_OFFSET, AR5K_KEYTABLE_OFF, AR5K_KEYTABLE_TYPE, AR5K_KEYTABLE_TYPE_NULL, AR5K_KEYTABLE_TYPE_TKIP, ath5k_hw_reg_read(), ath5k_hw_reg_write(), and type.

Referenced by ath5k_init().

◆ ath5k_hw_set_tx_queueprops()

int ath5k_hw_set_tx_queueprops ( struct ath5k_hw ah,
const struct ath5k_txq_info queue_info 
)

Definition at line 35 of file ath5k_qcu.c.

37 {
38  if (ah->ah_txq.tqi_type == AR5K_TX_QUEUE_INACTIVE)
39  return -EIO;
40 
41  memcpy(&ah->ah_txq, queue_info, sizeof(struct ath5k_txq_info));
42 
43  /*XXX: Is this supported on 5210 ?*/
44  if ((queue_info->tqi_type == AR5K_TX_QUEUE_DATA &&
45  ((queue_info->tqi_subtype == AR5K_WME_AC_VI) ||
46  (queue_info->tqi_subtype == AR5K_WME_AC_VO))) ||
47  queue_info->tqi_type == AR5K_TX_QUEUE_UAPSD)
48  ah->ah_txq.tqi_flags |= AR5K_TXQ_FLAG_POST_FR_BKOFF_DIS;
49 
50  return 0;
51 }
void * memcpy(void *dest, const void *src, size_t len) __nonnull
enum ath5k_tx_queue tqi_type
Definition: ath5k.h:509
enum ath5k_tx_queue_subtype tqi_subtype
Definition: ath5k.h:510
#define EIO
Input/output error.
Definition: errno.h:434
#define AR5K_TXQ_FLAG_POST_FR_BKOFF_DIS
Definition: ath5k.h:502
uint8_t ah
Definition: registers.h:85

References ah, AR5K_TX_QUEUE_DATA, AR5K_TX_QUEUE_INACTIVE, AR5K_TX_QUEUE_UAPSD, AR5K_TXQ_FLAG_POST_FR_BKOFF_DIS, AR5K_WME_AC_VI, AR5K_WME_AC_VO, EIO, memcpy(), ath5k_txq_info::tqi_subtype, and ath5k_txq_info::tqi_type.

Referenced by ath5k_hw_setup_tx_queue().

◆ ath5k_hw_setup_tx_queue()

int ath5k_hw_setup_tx_queue ( struct ath5k_hw ah,
enum ath5k_tx_queue  queue_type,
struct ath5k_txq_info queue_info 
)

Definition at line 56 of file ath5k_qcu.c.

58 {
59  int ret;
60 
61  /*
62  * Setup internal queue structure
63  */
64  memset(&ah->ah_txq, 0, sizeof(struct ath5k_txq_info));
65  ah->ah_txq.tqi_type = queue_type;
66 
67  if (queue_info != NULL) {
68  queue_info->tqi_type = queue_type;
69  ret = ath5k_hw_set_tx_queueprops(ah, queue_info);
70  if (ret)
71  return ret;
72  }
73 
74  /*
75  * We use ah_txq_status to hold a temp value for
76  * the Secondary interrupt mask registers on 5211+
77  * check out ath5k_hw_reset_tx_queue
78  */
79  AR5K_Q_ENABLE_BITS(ah->ah_txq_status, 0);
80 
81  return 0;
82 }
int ath5k_hw_set_tx_queueprops(struct ath5k_hw *ah, const struct ath5k_txq_info *queue_info)
Definition: ath5k_qcu.c:35
#define AR5K_Q_ENABLE_BITS(_reg, _queue)
Definition: ath5k.h:126
enum ath5k_tx_queue tqi_type
Definition: ath5k.h:509
uint8_t ah
Definition: registers.h:85
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
void * memset(void *dest, int character, size_t len) __nonnull

References ah, AR5K_Q_ENABLE_BITS, ath5k_hw_set_tx_queueprops(), memset(), NULL, and ath5k_txq_info::tqi_type.

Referenced by ath5k_txq_setup().

◆ ath5k_hw_num_tx_pending()

u32 ath5k_hw_num_tx_pending ( struct ath5k_hw ah)

◆ ath5k_hw_release_tx_queue()

void ath5k_hw_release_tx_queue ( struct ath5k_hw ah)

Definition at line 87 of file ath5k_qcu.c.

88 {
89  /* This queue will be skipped in further operations */
90  ah->ah_txq.tqi_type = AR5K_TX_QUEUE_INACTIVE;
91  /*For SIMR setup*/
92  AR5K_Q_DISABLE_BITS(ah->ah_txq_status, 0);
93 }
#define AR5K_Q_DISABLE_BITS(_reg, _queue)
Definition: ath5k.h:130
uint8_t ah
Definition: registers.h:85

References ah, AR5K_Q_DISABLE_BITS, and AR5K_TX_QUEUE_INACTIVE.

Referenced by ath5k_txq_release().

◆ ath5k_hw_reset_tx_queue()

int ath5k_hw_reset_tx_queue ( struct ath5k_hw ah)

Definition at line 98 of file ath5k_qcu.c.

99 {
100  u32 cw_min, cw_max, retry_lg, retry_sh;
101  struct ath5k_txq_info *tq = &ah->ah_txq;
102  const int queue = 0;
103 
104  tq = &ah->ah_txq;
105 
106  if (tq->tqi_type == AR5K_TX_QUEUE_INACTIVE)
107  return 0;
108 
109  if (ah->ah_version == AR5K_AR5210) {
110  /* Only handle data queues, others will be ignored */
111  if (tq->tqi_type != AR5K_TX_QUEUE_DATA)
112  return 0;
113 
114  /* Set Slot time */
115  ath5k_hw_reg_write(ah, ah->ah_turbo ?
118  /* Set ACK_CTS timeout */
119  ath5k_hw_reg_write(ah, ah->ah_turbo ?
122  /* Set Transmit Latency */
123  ath5k_hw_reg_write(ah, ah->ah_turbo ?
126 
127  /* Set IFS0 */
128  if (ah->ah_turbo) {
130  (ah->ah_aifs + tq->tqi_aifs) *
133  AR5K_IFS0);
134  } else {
136  (ah->ah_aifs + tq->tqi_aifs) *
139  }
140 
141  /* Set IFS1 */
142  ath5k_hw_reg_write(ah, ah->ah_turbo ?
145  /* Set AR5K_PHY_SETTLING */
146  ath5k_hw_reg_write(ah, ah->ah_turbo ?
148  | 0x38 :
150  | 0x1C,
152  /* Set Frame Control Register */
153  ath5k_hw_reg_write(ah, ah->ah_turbo ?
155  AR5K_PHY_TURBO_SHORT | 0x2020) :
156  (AR5K_PHY_FRAME_CTL_INI | 0x1020),
158  }
159 
160  /*
161  * Calculate cwmin/max by channel mode
162  */
163  cw_min = ah->ah_cw_min = AR5K_TUNE_CWMIN;
164  cw_max = ah->ah_cw_max = AR5K_TUNE_CWMAX;
165  ah->ah_aifs = AR5K_TUNE_AIFS;
166  /*XR is only supported on 5212*/
167  if (IS_CHAN_XR(ah->ah_current_channel) &&
168  ah->ah_version == AR5K_AR5212) {
169  cw_min = ah->ah_cw_min = AR5K_TUNE_CWMIN_XR;
170  cw_max = ah->ah_cw_max = AR5K_TUNE_CWMAX_XR;
171  ah->ah_aifs = AR5K_TUNE_AIFS_XR;
172  /*B mode is not supported on 5210*/
173  } else if (IS_CHAN_B(ah->ah_current_channel) &&
174  ah->ah_version != AR5K_AR5210) {
175  cw_min = ah->ah_cw_min = AR5K_TUNE_CWMIN_11B;
176  cw_max = ah->ah_cw_max = AR5K_TUNE_CWMAX_11B;
177  ah->ah_aifs = AR5K_TUNE_AIFS_11B;
178  }
179 
180  cw_min = 1;
181  while (cw_min < ah->ah_cw_min)
182  cw_min = (cw_min << 1) | 1;
183 
184  cw_min = tq->tqi_cw_min < 0 ? (cw_min >> (-tq->tqi_cw_min)) :
185  ((cw_min << tq->tqi_cw_min) + (1 << tq->tqi_cw_min) - 1);
186  cw_max = tq->tqi_cw_max < 0 ? (cw_max >> (-tq->tqi_cw_max)) :
187  ((cw_max << tq->tqi_cw_max) + (1 << tq->tqi_cw_max) - 1);
188 
189  /*
190  * Calculate and set retry limits
191  */
192  if (ah->ah_software_retry) {
193  /* XXX Need to test this */
194  retry_lg = ah->ah_limit_tx_retries;
195  retry_sh = retry_lg = retry_lg > AR5K_DCU_RETRY_LMT_SH_RETRY ?
196  AR5K_DCU_RETRY_LMT_SH_RETRY : retry_lg;
197  } else {
198  retry_lg = AR5K_INIT_LG_RETRY;
199  retry_sh = AR5K_INIT_SH_RETRY;
200  }
201 
202  /*No QCU/DCU [5210]*/
203  if (ah->ah_version == AR5K_AR5210) {
213  } else {
214  /*QCU/DCU [5211+]*/
223 
224  /*===Rest is also for QCU/DCU only [5211+]===*/
225 
226  /*
227  * Set initial content window (cw_min/cw_max)
228  * and arbitrated interframe space (aifs)...
229  */
233  AR5K_REG_SM(ah->ah_aifs + tq->tqi_aifs,
236 
237  /*
238  * Set misc registers
239  */
240  /* Enable DCU early termination for this queue */
243 
244  /* Enable DCU to wait for next fragment from QCU */
247 
248  /* On Maui and Spirit use the global seqnum on DCU */
249  if (ah->ah_mac_version < AR5K_SREV_AR5211)
252 
253  if (tq->tqi_cbr_period) {
261  if (tq->tqi_cbr_overflow_limit)
265  }
266 
267  if (tq->tqi_ready_time &&
268  (tq->tqi_type != AR5K_TX_QUEUE_CAB))
273 
274  if (tq->tqi_burst_time) {
279 
280  if (tq->tqi_flags
285  }
286 
290 
294 
295  /* TODO: Handle frame compression */
296 
297  /*
298  * Enable interrupts for this tx queue
299  * in the secondary interrupt mask registers
300  */
302  AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txok, queue);
303 
305  AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txerr, queue);
306 
308  AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txurn, queue);
309 
311  AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txdesc, queue);
312 
314  AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txeol, queue);
315 
317  AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_cbrorn, queue);
318 
320  AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_cbrurn, queue);
321 
323  AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_qtrig, queue);
324 
326  AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_nofrm, queue);
327 
328  /* Update secondary interrupt mask registers */
329 
330  /* Filter out inactive queues */
331  ah->ah_txq_imr_txok &= ah->ah_txq_status;
332  ah->ah_txq_imr_txerr &= ah->ah_txq_status;
333  ah->ah_txq_imr_txurn &= ah->ah_txq_status;
334  ah->ah_txq_imr_txdesc &= ah->ah_txq_status;
335  ah->ah_txq_imr_txeol &= ah->ah_txq_status;
336  ah->ah_txq_imr_cbrorn &= ah->ah_txq_status;
337  ah->ah_txq_imr_cbrurn &= ah->ah_txq_status;
338  ah->ah_txq_imr_qtrig &= ah->ah_txq_status;
339  ah->ah_txq_imr_nofrm &= ah->ah_txq_status;
340 
341  ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_txok,
343  AR5K_REG_SM(ah->ah_txq_imr_txdesc,
345  ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_txerr,
347  AR5K_REG_SM(ah->ah_txq_imr_txeol,
349  /* Update simr2 but don't overwrite rest simr2 settings */
352  AR5K_REG_SM(ah->ah_txq_imr_txurn,
354  ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_cbrorn,
356  AR5K_REG_SM(ah->ah_txq_imr_cbrurn,
358  ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_qtrig,
360  /* Set TXNOFRM_QCU for the queues with TXNOFRM enabled */
361  ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_nofrm,
363  /* No queue has TXNOFRM enabled, disable the interrupt
364  * by setting AR5K_TXNOFRM to zero */
365  if (ah->ah_txq_imr_nofrm == 0)
367 
368  /* Set QCU mask for this DCU to save power */
370  }
371 
372  return 0;
373 }
#define AR5K_QCU_MISC_DCU_EARLY
Definition: reg.h:620
#define AR5K_TXQ_FLAG_TXNOFRMINT_ENABLE
Definition: ath5k.h:498
#define AR5K_PHY_SETTLING
Definition: reg.h:1977
#define AR5K_QCU_MISC_RDY_VEOL_POLICY
Definition: reg.h:618
#define AR5K_TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE
Definition: ath5k.h:501
#define AR5K_QCU_RDYTIMECFG_INTVAL
Definition: reg.h:586
#define AR5K_TXQ_FLAG_CBRORNINT_ENABLE
Definition: ath5k.h:495
#define AR5K_NODCU_RETRY_LMT_SLG_RETRY
Definition: reg.h:1214
#define AR5K_INIT_SLG_RETRY
Definition: ath5k.h:229
#define AR5K_SIMR3
Definition: reg.h:446
#define AR5K_INIT_PROTO_TIME_CNTRL
Definition: ath5k.h:240
#define IS_CHAN_B(_c)
Definition: ath5k.h:660
#define AR5K_DCU_CHAN_TIME_ENABLE
Definition: reg.h:710
#define AR5K_TXQ_FLAG_TXERRINT_ENABLE
Definition: ath5k.h:491
#define AR5K_NODCU_RETRY_LMT_SSH_RETRY
Definition: reg.h:1212
#define AR5K_TUNE_CWMAX
Definition: ath5k.h:189
#define AR5K_Q_ENABLE_BITS(_reg, _queue)
Definition: ath5k.h:126
#define AR5K_SIMR1_QCU_TXEOL
Definition: reg.h:429
#define AR5K_DCU_MISC_POST_FR_BKOFF_DIS
Definition: reg.h:748
#define AR5K_INIT_ACK_CTS_TIMEOUT
Definition: ath5k.h:218
#define AR5K_NODCU_RETRY_LMT
Definition: reg.h:1207
#define AR5K_TUNE_CWMAX_XR
Definition: ath5k.h:191
#define AR5K_SIMR0_QCU_TXDESC
Definition: reg.h:423
#define AR5K_QUEUE_RDYTIMECFG(_q)
Definition: reg.h:589
#define AR5K_QUEUE_DFS_MISC(_q)
Definition: reg.h:752
#define AR5K_TUNE_CWMIN
Definition: ath5k.h:186
#define AR5K_QUEUE_CBRCFG(_q)
Definition: reg.h:580
#define AR5K_QUEUE_QCUMASK(_q)
Definition: reg.h:675
#define IS_CHAN_XR(_c)
Definition: ath5k.h:659
#define AR5K_QCU_MISC_FRSHED_CBR
Definition: reg.h:609
#define AR5K_INIT_SH_RETRY
Definition: ath5k.h:226
#define AR5K_DCU_MISC_SEQNUM_CTL
Definition: reg.h:751
#define AR5K_TUNE_CWMIN_XR
Definition: ath5k.h:188
#define AR5K_DCU_LCL_IFS_CW_MIN
Definition: reg.h:681
u32 tqi_burst_time
Definition: ath5k.h:517
#define AR5K_INIT_SSH_RETRY
Definition: ath5k.h:228
#define AR5K_USEC_5210
Definition: reg.h:1222
#define AR5K_TXQ_FLAG_BACKOFF_DISABLE
Definition: ath5k.h:499
#define AR5K_QUEUE_DFS_CHANNEL_TIME(_q)
Definition: reg.h:711
#define AR5K_SIMR4
Definition: reg.h:452
#define AR5K_REG_WRITE_Q(ah, _reg, _queue)
Definition: ath5k.h:123
#define AR5K_SIMR1_QCU_TXERR
Definition: reg.h:427
#define AR5K_INIT_TRANSMIT_LATENCY
Definition: ath5k.h:232
u32 tqi_cbr_period
Definition: ath5k.h:515
#define AR5K_DCU_LCL_IFS_AIFS
Definition: reg.h:685
#define AR5K_DCU_MISC_FRAG_WAIT
Definition: reg.h:732
#define AR5K_TXQ_FLAG_CBRURNINT_ENABLE
Definition: ath5k.h:496
#define AR5K_DCU_RETRY_LMT_SSH_RETRY
Definition: reg.h:698
#define AR5K_TXQ_FLAG_TXURNINT_ENABLE
Definition: ath5k.h:494
#define AR5K_PHY_TURBO_MODE
Definition: reg.h:1899
#define AR5K_QCU_CBRCFG_ORN_THRES
Definition: reg.h:578
#define AR5K_QUEUE_DFS_LOCAL_IFS(_q)
Definition: reg.h:688
#define AR5K_DCU_LCL_IFS_CW_MAX
Definition: reg.h:683
#define AR5K_IFS0_DIFS_S
Definition: reg.h:1301
#define AR5K_INIT_LG_RETRY
Definition: ath5k.h:227
enum ath5k_tx_queue tqi_type
Definition: ath5k.h:509
u32 tqi_cbr_overflow_limit
Definition: ath5k.h:516
#define AR5K_DCU_RETRY_LMT_LG_RETRY
Definition: reg.h:696
#define AR5K_NODCU_RETRY_LMT_LG_RETRY
Definition: reg.h:1210
#define AR5K_INIT_SLOT_TIME_TURBO
Definition: ath5k.h:217
#define AR5K_SIMR4_QTRIG
Definition: reg.h:453
#define AR5K_NODCU_RETRY_LMT_CW_MIN_S
Definition: reg.h:1217
#define AR5K_INIT_PROTO_TIME_CNTRL_TURBO
Definition: ath5k.h:244
#define AR5K_SIMR2
Definition: reg.h:432
u32 tqi_aifs
Definition: ath5k.h:512
#define AR5K_TXNOFRM
Definition: reg.h:237
s32 tqi_cw_max
Definition: ath5k.h:514
#define AR5K_SIMR3_QCBRURN
Definition: reg.h:449
#define AR5K_INIT_SIFS
Definition: ath5k.h:224
#define AR5K_DCU_RETRY_LMT_SH_RETRY
Definition: reg.h:694
#define AR5K_PHY_FRAME_CTL_INI
Definition: reg.h:2290
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define AR5K_TXQ_FLAG_TXEOLINT_ENABLE
Definition: ath5k.h:492
#define AR5K_SIMR1
Definition: reg.h:426
#define AR5K_INIT_SLOT_TIME
Definition: ath5k.h:216
#define AR5K_INIT_TRANSMIT_LATENCY_TURBO
Definition: ath5k.h:236
#define AR5K_DCU_MISC_BACKOFF_FRAG
Definition: reg.h:733
#define AR5K_QUEUE_MISC(_q)
Definition: reg.h:622
#define AR5K_SIMR0
Definition: reg.h:420
#define AR5K_TXNOFRM_QCU
Definition: reg.h:239
#define AR5K_PHY_TURBO_SHORT
Definition: reg.h:1900
#define AR5K_TUNE_AIFS
Definition: ath5k.h:183
#define AR5K_QCU_MISC_CBR_THRES_ENABLE
Definition: reg.h:617
#define AR5K_REG_DISABLE_BITS(ah, _reg, _flags)
Definition: ath5k.h:109
#define AR5K_PHY_FRAME_CTL_5210
Definition: reg.h:2273
#define AR5K_SIMR0_QCU_TXOK
Definition: reg.h:421
#define AR5K_QUEUE_DFS_RETRY_LIMIT(_q)
Definition: reg.h:702
#define AR5K_IFS1
Definition: reg.h:1306
u16 tqi_flags
Definition: ath5k.h:511
#define AR5K_TXQ_FLAG_TXOKINT_ENABLE
Definition: ath5k.h:490
#define AR5K_SIMR3_QCBRORN
Definition: reg.h:447
s32 tqi_cw_min
Definition: ath5k.h:513
#define AR5K_SLOT_TIME
Definition: reg.h:1170
#define AR5K_INIT_ACK_CTS_TIMEOUT_TURBO
Definition: ath5k.h:219
u32 tqi_ready_time
Definition: ath5k.h:518
#define AR5K_TXQ_FLAG_TXDESCINT_ENABLE
Definition: ath5k.h:493
#define AR5K_TUNE_AIFS_XR
Definition: ath5k.h:185
#define AR5K_NODCU_RETRY_LMT_SH_RETRY
Definition: reg.h:1208
#define AR5K_TUNE_CWMAX_11B
Definition: ath5k.h:190
#define AR5K_TUNE_AIFS_11B
Definition: ath5k.h:184
uint8_t ah
Definition: registers.h:85
#define AR5K_DCU_CHAN_TIME_DUR
Definition: reg.h:708
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
#define AR5K_TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE
Definition: ath5k.h:500
#define AR5K_QCU_CBRCFG_INTVAL
Definition: reg.h:576
#define AR5K_SREV_AR5211
Definition: ath5k.h:294
#define AR5K_IFS0
Definition: reg.h:1297
uint16_t queue
Queue ID.
Definition: ena.h:22
#define AR5K_TUNE_CWMIN_11B
Definition: ath5k.h:187
#define AR5K_TXQ_FLAG_QTRIGINT_ENABLE
Definition: ath5k.h:497
#define AR5K_SIMR2_QCU_TXURN
Definition: reg.h:433
uint32_t u32
Definition: stdint.h:24
#define AR5K_DCU_RETRY_LMT_SLG_RETRY
Definition: reg.h:700
#define AR5K_REG_ENABLE_BITS(ah, _reg, _flags)
Definition: ath5k.h:106
#define AR5K_INIT_SIFS_TURBO
Definition: ath5k.h:225
#define AR5K_REG_SM(_val, _flags)
Definition: ath5k.h:86
#define AR5K_QCU_RDYTIMECFG_ENABLE
Definition: reg.h:588

References ah, AR5K_AR5210, AR5K_AR5212, AR5K_DCU_CHAN_TIME_DUR, AR5K_DCU_CHAN_TIME_ENABLE, AR5K_DCU_LCL_IFS_AIFS, AR5K_DCU_LCL_IFS_CW_MAX, AR5K_DCU_LCL_IFS_CW_MIN, AR5K_DCU_MISC_BACKOFF_FRAG, AR5K_DCU_MISC_FRAG_WAIT, AR5K_DCU_MISC_POST_FR_BKOFF_DIS, AR5K_DCU_MISC_SEQNUM_CTL, AR5K_DCU_RETRY_LMT_LG_RETRY, AR5K_DCU_RETRY_LMT_SH_RETRY, AR5K_DCU_RETRY_LMT_SLG_RETRY, AR5K_DCU_RETRY_LMT_SSH_RETRY, AR5K_IFS0, AR5K_IFS0_DIFS_S, AR5K_IFS1, AR5K_INIT_ACK_CTS_TIMEOUT, AR5K_INIT_ACK_CTS_TIMEOUT_TURBO, AR5K_INIT_LG_RETRY, AR5K_INIT_PROTO_TIME_CNTRL, AR5K_INIT_PROTO_TIME_CNTRL_TURBO, AR5K_INIT_SH_RETRY, AR5K_INIT_SIFS, AR5K_INIT_SIFS_TURBO, AR5K_INIT_SLG_RETRY, AR5K_INIT_SLOT_TIME, AR5K_INIT_SLOT_TIME_TURBO, AR5K_INIT_SSH_RETRY, AR5K_INIT_TRANSMIT_LATENCY, AR5K_INIT_TRANSMIT_LATENCY_TURBO, AR5K_NODCU_RETRY_LMT, AR5K_NODCU_RETRY_LMT_CW_MIN_S, AR5K_NODCU_RETRY_LMT_LG_RETRY, AR5K_NODCU_RETRY_LMT_SH_RETRY, AR5K_NODCU_RETRY_LMT_SLG_RETRY, AR5K_NODCU_RETRY_LMT_SSH_RETRY, AR5K_PHY_FRAME_CTL_5210, AR5K_PHY_FRAME_CTL_INI, AR5K_PHY_SETTLING, AR5K_PHY_TURBO_MODE, AR5K_PHY_TURBO_SHORT, AR5K_Q_ENABLE_BITS, AR5K_QCU_CBRCFG_INTVAL, AR5K_QCU_CBRCFG_ORN_THRES, AR5K_QCU_MISC_CBR_THRES_ENABLE, AR5K_QCU_MISC_DCU_EARLY, AR5K_QCU_MISC_FRSHED_CBR, AR5K_QCU_MISC_RDY_VEOL_POLICY, AR5K_QCU_RDYTIMECFG_ENABLE, AR5K_QCU_RDYTIMECFG_INTVAL, AR5K_QUEUE_CBRCFG, AR5K_QUEUE_DFS_CHANNEL_TIME, AR5K_QUEUE_DFS_LOCAL_IFS, AR5K_QUEUE_DFS_MISC, AR5K_QUEUE_DFS_RETRY_LIMIT, AR5K_QUEUE_MISC, AR5K_QUEUE_QCUMASK, AR5K_QUEUE_RDYTIMECFG, AR5K_REG_DISABLE_BITS, AR5K_REG_ENABLE_BITS, AR5K_REG_SM, AR5K_REG_WRITE_Q, AR5K_SIMR0, AR5K_SIMR0_QCU_TXDESC, AR5K_SIMR0_QCU_TXOK, AR5K_SIMR1, AR5K_SIMR1_QCU_TXEOL, AR5K_SIMR1_QCU_TXERR, AR5K_SIMR2, AR5K_SIMR2_QCU_TXURN, AR5K_SIMR3, AR5K_SIMR3_QCBRORN, AR5K_SIMR3_QCBRURN, AR5K_SIMR4, AR5K_SIMR4_QTRIG, AR5K_SLOT_TIME, AR5K_SREV_AR5211, AR5K_TUNE_AIFS, AR5K_TUNE_AIFS_11B, AR5K_TUNE_AIFS_XR, AR5K_TUNE_CWMAX, AR5K_TUNE_CWMAX_11B, AR5K_TUNE_CWMAX_XR, AR5K_TUNE_CWMIN, AR5K_TUNE_CWMIN_11B, AR5K_TUNE_CWMIN_XR, AR5K_TX_QUEUE_CAB, AR5K_TX_QUEUE_DATA, AR5K_TX_QUEUE_INACTIVE, AR5K_TXNOFRM, AR5K_TXNOFRM_QCU, AR5K_TXQ_FLAG_BACKOFF_DISABLE, AR5K_TXQ_FLAG_CBRORNINT_ENABLE, AR5K_TXQ_FLAG_CBRURNINT_ENABLE, AR5K_TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE, AR5K_TXQ_FLAG_QTRIGINT_ENABLE, AR5K_TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE, AR5K_TXQ_FLAG_TXDESCINT_ENABLE, AR5K_TXQ_FLAG_TXEOLINT_ENABLE, AR5K_TXQ_FLAG_TXERRINT_ENABLE, AR5K_TXQ_FLAG_TXNOFRMINT_ENABLE, AR5K_TXQ_FLAG_TXOKINT_ENABLE, AR5K_TXQ_FLAG_TXURNINT_ENABLE, AR5K_USEC_5210, ath5k_hw_reg_read(), ath5k_hw_reg_write(), IS_CHAN_B, IS_CHAN_XR, queue, ath5k_txq_info::tqi_aifs, ath5k_txq_info::tqi_burst_time, ath5k_txq_info::tqi_cbr_overflow_limit, ath5k_txq_info::tqi_cbr_period, ath5k_txq_info::tqi_cw_max, ath5k_txq_info::tqi_cw_min, ath5k_txq_info::tqi_flags, ath5k_txq_info::tqi_ready_time, and ath5k_txq_info::tqi_type.

Referenced by ath5k_hw_reset().

◆ ath5k_hw_set_slot_time()

int ath5k_hw_set_slot_time ( struct ath5k_hw ah,
unsigned int  slot_time 
)

Definition at line 378 of file ath5k_qcu.c.

379 {
380  if (slot_time < AR5K_SLOT_TIME_9 || slot_time > AR5K_SLOT_TIME_MAX)
381  return -EINVAL;
382 
383  if (ah->ah_version == AR5K_AR5210)
385  ah->ah_turbo), AR5K_SLOT_TIME);
386  else
388 
389  return 0;
390 }
#define EINVAL
Invalid argument.
Definition: errno.h:429
#define AR5K_SLOT_TIME_MAX
Definition: ath5k.h:627
#define AR5K_DCU_GBL_IFS_SLOT
Definition: reg.h:770
static unsigned int ath5k_hw_htoclock(unsigned int usec, int turbo)
Definition: ath5k.h:1199
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define AR5K_SLOT_TIME
Definition: reg.h:1170
uint8_t ah
Definition: registers.h:85

References ah, AR5K_AR5210, AR5K_DCU_GBL_IFS_SLOT, AR5K_SLOT_TIME, AR5K_SLOT_TIME_MAX, ath5k_hw_htoclock(), ath5k_hw_reg_write(), and EINVAL.

◆ ath5k_hw_init_desc_functions()

int ath5k_hw_init_desc_functions ( struct ath5k_hw ah)

Definition at line 523 of file ath5k_desc.c.

524 {
525 
526  if (ah->ah_version != AR5K_AR5210 &&
527  ah->ah_version != AR5K_AR5211 &&
528  ah->ah_version != AR5K_AR5212)
529  return -ENOTSUP;
530 
531  if (ah->ah_version == AR5K_AR5212) {
532  ah->ah_setup_rx_desc = ath5k_hw_setup_rx_desc;
533  ah->ah_setup_tx_desc = ath5k_hw_setup_4word_tx_desc;
534  ah->ah_proc_tx_desc = ath5k_hw_proc_4word_tx_status;
535  } else {
536  ah->ah_setup_rx_desc = ath5k_hw_setup_rx_desc;
537  ah->ah_setup_tx_desc = ath5k_hw_setup_2word_tx_desc;
538  ah->ah_proc_tx_desc = ath5k_hw_proc_2word_tx_status;
539  }
540 
541  if (ah->ah_version == AR5K_AR5212)
542  ah->ah_proc_rx_desc = ath5k_hw_proc_5212_rx_status;
543  else if (ah->ah_version <= AR5K_AR5211)
544  ah->ah_proc_rx_desc = ath5k_hw_proc_5210_rx_status;
545 
546  return 0;
547 }
static int ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc, unsigned int pkt_len, unsigned int hdr_len, enum ath5k_pkt_type type, unsigned int tx_power __unused, unsigned int tx_rate0, unsigned int tx_tries0, unsigned int key_index __unused, unsigned int antenna_mode, unsigned int flags, unsigned int rtscts_rate __unused, unsigned int rtscts_duration)
Definition: ath5k_desc.c:43
#define ENOTSUP
Operation not supported.
Definition: errno.h:590
static int ath5k_hw_proc_5210_rx_status(struct ath5k_hw *ah __unused, struct ath5k_desc *desc, struct ath5k_rx_status *rs)
Definition: ath5k_desc.c:396
static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc, unsigned int pkt_len, unsigned int hdr_len __unused, enum ath5k_pkt_type type, unsigned int tx_power, unsigned int tx_rate0, unsigned int tx_tries0, unsigned int key_index __unused, unsigned int antenna_mode, unsigned int flags, unsigned int rtscts_rate, unsigned int rtscts_duration)
Definition: ath5k_desc.c:157
static int ath5k_hw_proc_5212_rx_status(struct ath5k_hw *ah __unused, struct ath5k_desc *desc, struct ath5k_rx_status *rs)
Definition: ath5k_desc.c:458
static int ath5k_hw_proc_4word_tx_status(struct ath5k_hw *ah __unused, struct ath5k_desc *desc, struct ath5k_tx_status *ts)
Definition: ath5k_desc.c:305
uint8_t ah
Definition: registers.h:85
static int ath5k_hw_proc_2word_tx_status(struct ath5k_hw *ah __unused, struct ath5k_desc *desc, struct ath5k_tx_status *ts)
Definition: ath5k_desc.c:253
static int ath5k_hw_setup_rx_desc(struct ath5k_hw *ah __unused, struct ath5k_desc *desc, u32 size, unsigned int flags)
Definition: ath5k_desc.c:365

References ah, AR5K_AR5210, AR5K_AR5211, AR5K_AR5212, ath5k_hw_proc_2word_tx_status(), ath5k_hw_proc_4word_tx_status(), ath5k_hw_proc_5210_rx_status(), ath5k_hw_proc_5212_rx_status(), ath5k_hw_setup_2word_tx_desc(), ath5k_hw_setup_4word_tx_desc(), ath5k_hw_setup_rx_desc(), and ENOTSUP.

Referenced by ath5k_hw_attach().

◆ ath5k_hw_set_gpio_input()

int ath5k_hw_set_gpio_input ( struct ath5k_hw ah,
u32  gpio 
)

Definition at line 35 of file ath5k_gpio.c.

36 {
37  if (gpio >= AR5K_NUM_GPIO)
38  return -EINVAL;
39 
43 
44  return 0;
45 }
#define EINVAL
Invalid argument.
Definition: errno.h:429
#define AR5K_GPIOCR_IN(n)
Definition: reg.h:939
#define AR5K_GPIOCR
Definition: reg.h:935
#define AR5K_NUM_GPIO
Definition: reg.h:933
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define AR5K_GPIOCR_OUT(n)
Definition: reg.h:942
uint8_t ah
Definition: registers.h:85
A GPIO pin.
Definition: gpio.h:18
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216

References ah, AR5K_GPIOCR, AR5K_GPIOCR_IN, AR5K_GPIOCR_OUT, AR5K_NUM_GPIO, ath5k_hw_reg_read(), ath5k_hw_reg_write(), and EINVAL.

Referenced by ath5k_hw_reset(), and ath5k_rfkill_set_intr().

◆ ath5k_hw_set_gpio_output()

int ath5k_hw_set_gpio_output ( struct ath5k_hw ah,
u32  gpio 
)

Definition at line 50 of file ath5k_gpio.c.

51 {
52  if (gpio >= AR5K_NUM_GPIO)
53  return -EINVAL;
54 
58 
59  return 0;
60 }
#define EINVAL
Invalid argument.
Definition: errno.h:429
#define AR5K_GPIOCR
Definition: reg.h:935
#define AR5K_NUM_GPIO
Definition: reg.h:933
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define AR5K_GPIOCR_OUT(n)
Definition: reg.h:942
uint8_t ah
Definition: registers.h:85
A GPIO pin.
Definition: gpio.h:18
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216

References ah, AR5K_GPIOCR, AR5K_GPIOCR_OUT, AR5K_NUM_GPIO, ath5k_hw_reg_read(), ath5k_hw_reg_write(), and EINVAL.

Referenced by ath5k_rfkill_disable(), and ath5k_rfkill_enable().

◆ ath5k_hw_get_gpio()

u32 ath5k_hw_get_gpio ( struct ath5k_hw ah,
u32  gpio 
)

Definition at line 65 of file ath5k_gpio.c.

66 {
67  if (gpio >= AR5K_NUM_GPIO)
68  return 0xffffffff;
69 
70  /* GPIO input magic */
72  0x1;
73 }
#define AR5K_GPIODI_M
Definition: reg.h:954
#define AR5K_NUM_GPIO
Definition: reg.h:933
#define AR5K_GPIODI
Definition: reg.h:953
uint8_t ah
Definition: registers.h:85
A GPIO pin.
Definition: gpio.h:18
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216

References ah, AR5K_GPIODI, AR5K_GPIODI_M, AR5K_NUM_GPIO, and ath5k_hw_reg_read().

Referenced by ath5k_hw_reset(), ath5k_is_rfkill_set(), and ath5k_rfkill_set_intr().

◆ ath5k_hw_set_gpio()

int ath5k_hw_set_gpio ( struct ath5k_hw ah,
u32  gpio,
u32  val 
)

Definition at line 78 of file ath5k_gpio.c.

79 {
80  u32 data;
81 
82  if (gpio >= AR5K_NUM_GPIO)
83  return -EINVAL;
84 
85  /* GPIO output magic */
87 
88  data &= ~(1 << gpio);
89  data |= (val & 1) << gpio;
90 
92 
93  return 0;
94 }
#define EINVAL
Invalid argument.
Definition: errno.h:429
void __asmcall int val
Definition: setjmp.h:12
#define AR5K_GPIODO
Definition: reg.h:948
pseudo_bit_t gpio[0x00001]
Definition: arbel.h:30
#define AR5K_NUM_GPIO
Definition: reg.h:933
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
uint8_t data[48]
Additional event data.
Definition: ena.h:22
uint8_t ah
Definition: registers.h:85
A GPIO pin.
Definition: gpio.h:18
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
uint32_t u32
Definition: stdint.h:24

References ah, AR5K_GPIODO, AR5K_NUM_GPIO, ath5k_hw_reg_read(), ath5k_hw_reg_write(), data, EINVAL, gpio, and val.

Referenced by ath5k_rfkill_disable(), and ath5k_rfkill_enable().

◆ ath5k_hw_set_gpio_intr()

void ath5k_hw_set_gpio_intr ( struct ath5k_hw ah,
unsigned int  gpio,
u32  interrupt_level 
)

Definition at line 99 of file ath5k_gpio.c.

101 {
102  u32 data;
103 
104  if (gpio >= AR5K_NUM_GPIO)
105  return;
106 
107  /*
108  * Set the GPIO interrupt
109  */
114 
115  ath5k_hw_reg_write(ah, interrupt_level ? data :
117 
118  ah->ah_imr |= AR5K_IMR_GPIO;
119 
120  /* Enable GPIO interrupts */
122 }
#define AR5K_GPIOCR_INT_ENA
Definition: reg.h:936
#define AR5K_IMR_GPIO
Definition: reg.h:412
#define AR5K_GPIOCR_INT_SEL(n)
Definition: reg.h:943
#define AR5K_GPIOCR
Definition: reg.h:935
#define AR5K_PIMR
Definition: reg.h:382
#define AR5K_NUM_GPIO
Definition: reg.h:933
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
uint8_t data[48]
Additional event data.
Definition: ena.h:22
#define AR5K_GPIOCR_OUT(n)
Definition: reg.h:942
uint8_t ah
Definition: registers.h:85
A GPIO pin.
Definition: gpio.h:18
#define AR5K_GPIOCR_INT_SELH
Definition: reg.h:938
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
uint32_t u32
Definition: stdint.h:24
#define AR5K_REG_ENABLE_BITS(ah, _reg, _flags)
Definition: ath5k.h:106

References ah, AR5K_GPIOCR, AR5K_GPIOCR_INT_ENA, AR5K_GPIOCR_INT_SEL, AR5K_GPIOCR_INT_SELH, AR5K_GPIOCR_OUT, AR5K_IMR_GPIO, AR5K_NUM_GPIO, AR5K_PIMR, AR5K_REG_ENABLE_BITS, ath5k_hw_reg_read(), ath5k_hw_reg_write(), and data.

Referenced by ath5k_hw_reset(), and ath5k_rfkill_set_intr().

◆ ath5k_rfkill_hw_start()

void ath5k_rfkill_hw_start ( struct ath5k_hw ah)

Definition at line 81 of file ath5k_rfkill.c.

82 {
83  struct ath5k_softc *sc = ah->ah_sc;
84 
85  /* read rfkill GPIO configuration from EEPROM header */
86  sc->rf_kill.gpio = ah->ah_capabilities.cap_eeprom.ee_rfkill_pin;
87  sc->rf_kill.polarity = ah->ah_capabilities.cap_eeprom.ee_rfkill_pol;
88 
90 
91  /* enable interrupt for rfkill switch */
92  if (AR5K_EEPROM_HDR_RFKILL(ah->ah_capabilities.cap_eeprom.ee_header))
93  ath5k_rfkill_set_intr(sc, 1);
94 }
static void ath5k_rfkill_disable(struct ath5k_softc *sc)
Definition: ath5k_rfkill.c:43
struct ath5k_softc::@16 rf_kill
unsigned polarity
Definition: base.h:129
#define AR5K_EEPROM_HDR_RFKILL(_v)
Definition: eeprom.h:75
static void ath5k_rfkill_set_intr(struct ath5k_softc *sc, int enable)
Definition: ath5k_rfkill.c:60
uint8_t ah
Definition: registers.h:85
u16 gpio
Definition: base.h:128

References ah, AR5K_EEPROM_HDR_RFKILL, ath5k_rfkill_disable(), ath5k_rfkill_set_intr(), ath5k_softc::gpio, ath5k_softc::polarity, and ath5k_softc::rf_kill.

Referenced by ath5k_init().

◆ ath5k_rfkill_hw_stop()

void ath5k_rfkill_hw_stop ( struct ath5k_hw ah)

Definition at line 98 of file ath5k_rfkill.c.

99 {
100  struct ath5k_softc *sc = ah->ah_sc;
101 
102  /* disable interrupt for rfkill switch */
103  if (AR5K_EEPROM_HDR_RFKILL(ah->ah_capabilities.cap_eeprom.ee_header))
104  ath5k_rfkill_set_intr(sc, 0);
105 
106  /* enable RFKILL when stopping HW so Wifi LED is turned off */
108 }
#define AR5K_EEPROM_HDR_RFKILL(_v)
Definition: eeprom.h:75
static void ath5k_rfkill_set_intr(struct ath5k_softc *sc, int enable)
Definition: ath5k_rfkill.c:60
static void ath5k_rfkill_enable(struct ath5k_softc *sc)
Definition: ath5k_rfkill.c:52
uint8_t ah
Definition: registers.h:85

References ah, AR5K_EEPROM_HDR_RFKILL, ath5k_rfkill_enable(), and ath5k_rfkill_set_intr().

Referenced by ath5k_stop_hw().

◆ ath5k_hw_set_capabilities()

int ath5k_hw_set_capabilities ( struct ath5k_hw ah)

Definition at line 37 of file ath5k_caps.c.

38 {
39  u16 ee_header;
40 
41  /* Capabilities stored in the EEPROM */
42  ee_header = ah->ah_capabilities.cap_eeprom.ee_header;
43 
44  if (ah->ah_version == AR5K_AR5210) {
45  /*
46  * Set radio capabilities
47  * (The AR5110 only supports the middle 5GHz band)
48  */
49  ah->ah_capabilities.cap_range.range_5ghz_min = 5120;
50  ah->ah_capabilities.cap_range.range_5ghz_max = 5430;
51  ah->ah_capabilities.cap_range.range_2ghz_min = 0;
52  ah->ah_capabilities.cap_range.range_2ghz_max = 0;
53 
54  /* Set supported modes */
55  ah->ah_capabilities.cap_mode |= AR5K_MODE_BIT_11A;
56  ah->ah_capabilities.cap_mode |= AR5K_MODE_BIT_11A_TURBO;
57  } else {
58  /*
59  * XXX The tranceiver supports frequencies from 4920 to 6100GHz
60  * XXX and from 2312 to 2732GHz. There are problems with the
61  * XXX current ieee80211 implementation because the IEEE
62  * XXX channel mapping does not support negative channel
63  * XXX numbers (2312MHz is channel -19). Of course, this
64  * XXX doesn't matter because these channels are out of range
65  * XXX but some regulation domains like MKK (Japan) will
66  * XXX support frequencies somewhere around 4.8GHz.
67  */
68 
69  /*
70  * Set radio capabilities
71  */
72 
73  if (AR5K_EEPROM_HDR_11A(ee_header)) {
74  /* 4920 */
75  ah->ah_capabilities.cap_range.range_5ghz_min = 5005;
76  ah->ah_capabilities.cap_range.range_5ghz_max = 6100;
77 
78  /* Set supported modes */
79  ah->ah_capabilities.cap_mode |= AR5K_MODE_BIT_11A;
80  ah->ah_capabilities.cap_mode |= AR5K_MODE_BIT_11A_TURBO;
81  if (ah->ah_version == AR5K_AR5212)
82  ah->ah_capabilities.cap_mode |=
84  }
85 
86  /* Enable 802.11b if a 2GHz capable radio (2111/5112) is
87  * connected */
88  if (AR5K_EEPROM_HDR_11B(ee_header) ||
89  (AR5K_EEPROM_HDR_11G(ee_header) &&
90  ah->ah_version != AR5K_AR5211)) {
91  /* 2312 */
92  ah->ah_capabilities.cap_range.range_2ghz_min = 2412;
93  ah->ah_capabilities.cap_range.range_2ghz_max = 2732;
94 
95  if (AR5K_EEPROM_HDR_11B(ee_header))
96  ah->ah_capabilities.cap_mode |=
98 
99  if (AR5K_EEPROM_HDR_11G(ee_header) &&
100  ah->ah_version != AR5K_AR5211)
101  ah->ah_capabilities.cap_mode |=
103  }
104  }
105 
106  /* GPIO */
107  ah->ah_gpio_npins = AR5K_NUM_GPIO;
108 
109  /* Set number of supported TX queues */
110  ah->ah_capabilities.cap_queues.q_tx_num = 1;
111 
112  return 0;
113 }
uint16_t u16
Definition: stdint.h:22
#define AR5K_EEPROM_HDR_11B(_v)
Definition: eeprom.h:70
#define AR5K_EEPROM_HDR_11A(_v)
Definition: eeprom.h:69
#define AR5K_NUM_GPIO
Definition: reg.h:933
uint8_t ah
Definition: registers.h:85
#define AR5K_EEPROM_HDR_11G(_v)
Definition: eeprom.h:71

References ah, AR5K_AR5210, AR5K_AR5211, AR5K_AR5212, AR5K_EEPROM_HDR_11A, AR5K_EEPROM_HDR_11B, AR5K_EEPROM_HDR_11G, AR5K_MODE_BIT_11A, AR5K_MODE_BIT_11A_TURBO, AR5K_MODE_BIT_11B, AR5K_MODE_BIT_11G, AR5K_MODE_BIT_11G_TURBO, and AR5K_NUM_GPIO.

Referenced by ath5k_hw_attach().

◆ ath5k_hw_get_capability()

int ath5k_hw_get_capability ( struct ath5k_hw ah,
enum ath5k_capability_type  cap_type,
u32  capability,
u32 result 
)

Definition at line 116 of file ath5k_caps.c.

119 {
120  switch (cap_type) {
122  if (result) {
123  *result = 1;
124  goto yes;
125  }
126  case AR5K_CAP_VEOL:
127  goto yes;
129  if (ah->ah_version == AR5K_AR5212)
130  goto yes;
131  else
132  goto no;
133  case AR5K_CAP_BURST:
134  goto yes;
135  case AR5K_CAP_TPC:
136  goto yes;
137  case AR5K_CAP_BSSIDMASK:
138  if (ah->ah_version == AR5K_AR5212)
139  goto yes;
140  else
141  goto no;
142  case AR5K_CAP_XR:
143  if (ah->ah_version == AR5K_AR5212)
144  goto yes;
145  else
146  goto no;
147  default:
148  goto no;
149  }
150 
151 no:
152  return -EINVAL;
153 yes:
154  return 0;
155 }
#define EINVAL
Invalid argument.
Definition: errno.h:429
uint16_t result
Definition: hyperv.h:33
uint8_t ah
Definition: registers.h:85

References ah, AR5K_AR5212, AR5K_CAP_BSSIDMASK, AR5K_CAP_BURST, AR5K_CAP_COMPRESSION, AR5K_CAP_NUM_TXQUEUES, AR5K_CAP_TPC, AR5K_CAP_VEOL, AR5K_CAP_XR, EINVAL, and result.

◆ ath5k_hw_enable_pspoll()

int ath5k_hw_enable_pspoll ( struct ath5k_hw ah,
u8 bssid,
u16  assoc_id 
)

◆ ath5k_hw_disable_pspoll()

int ath5k_hw_disable_pspoll ( struct ath5k_hw ah)

◆ ath5k_hw_write_initvals()

int ath5k_hw_write_initvals ( struct ath5k_hw ah,
u8  mode,
int  change_channel 
)

Definition at line 1419 of file ath5k_initvals.c.

1420 {
1421  /*
1422  * Write initial register settings
1423  */
1424 
1425  /* For AR5212 and combatible */
1426  if (ah->ah_version == AR5K_AR5212) {
1427 
1428  /* First set of mode-specific settings */
1432 
1433  /*
1434  * Write initial settings common for all modes
1435  */
1437  ar5212_ini_common_start, change_channel);
1438 
1439  /* Second set of mode-specific settings */
1440  switch (ah->ah_radio) {
1441  case AR5K_RF5111:
1442 
1446 
1449  rf5111_ini_common_end, change_channel);
1450 
1451  /* Baseband gain table */
1454  rf5111_ini_bbgain, change_channel);
1455 
1456  break;
1457  case AR5K_RF5112:
1458 
1462 
1465  rf5112_ini_common_end, change_channel);
1466 
1469  rf5112_ini_bbgain, change_channel);
1470 
1471  break;
1472  case AR5K_RF5413:
1473 
1477 
1480  rf5413_ini_common_end, change_channel);
1481 
1484  rf5112_ini_bbgain, change_channel);
1485 
1486  break;
1487  case AR5K_RF2316:
1488  case AR5K_RF2413:
1489 
1493 
1496  rf2413_ini_common_end, change_channel);
1497 
1498  /* Override settings from rf2413_ini_common_end */
1499  if (ah->ah_radio == AR5K_RF2316) {
1500  ath5k_hw_reg_write(ah, 0x00004000,
1501  AR5K_PHY_AGC);
1502  ath5k_hw_reg_write(ah, 0x081b7caa,
1503  0xa274);
1504  }
1505 
1508  rf5112_ini_bbgain, change_channel);
1509  break;
1510  case AR5K_RF2317:
1511  case AR5K_RF2425:
1512 
1516 
1519  rf2425_ini_common_end, change_channel);
1520 
1523  rf5112_ini_bbgain, change_channel);
1524  break;
1525  default:
1526  return -EINVAL;
1527 
1528  }
1529 
1530  /* For AR5211 */
1531  } else if (ah->ah_version == AR5K_AR5211) {
1532 
1533  /* AR5K_MODE_11B */
1534  if (mode > 2) {
1535  DBG("ath5k: unsupported channel mode %d\n", mode);
1536  return -EINVAL;
1537  }
1538 
1539  /* Mode-specific settings */
1542 
1543  /*
1544  * Write initial settings common for all modes
1545  */
1547  ar5211_ini, change_channel);
1548 
1549  /* AR5211 only comes with 5111 */
1550 
1551  /* Baseband gain table */
1553  rf5111_ini_bbgain, change_channel);
1554  /* For AR5210 (for mode settings check out ath5k_hw_reset_tx_queue) */
1555  } else if (ah->ah_version == AR5K_AR5210) {
1557  ar5210_ini, change_channel);
1558  }
1559 
1560  return 0;
1561 }
#define EINVAL
Invalid argument.
Definition: errno.h:429
static const struct ath5k_ini rf2413_ini_common_end[]
uint16_t mode
Acceleration mode.
Definition: ena.h:26
static const struct ath5k_ini_mode rf5111_ini_mode_end[]
static const struct ath5k_ini rf5112_ini_common_end[]
static const struct ath5k_ini_mode rf2425_ini_mode_end[]
static const struct ath5k_ini rf5111_ini_bbgain[]
#define AR5K_PHY_AGC
Definition: reg.h:1907
static const struct ath5k_ini_mode ar5212_ini_mode_start[]
static const struct ath5k_ini_mode rf2413_ini_mode_end[]
static const struct ath5k_ini ar5211_ini[]
static const struct ath5k_ini rf5112_ini_bbgain[]
static const struct ath5k_ini ar5210_ini[]
#define ARRAY_SIZE(x)
Definition: efx_common.h:43
static const struct ath5k_ini rf5111_ini_common_end[]
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
static const struct ath5k_ini ar5212_ini_common_start[]
static const struct ath5k_ini_mode rf5413_ini_mode_end[]
static const struct ath5k_ini_mode rf5112_ini_mode_end[]
uint8_t ah
Definition: registers.h:85
static const struct ath5k_ini rf5413_ini_common_end[]
static void ath5k_hw_ini_registers(struct ath5k_hw *ah, unsigned int size, const struct ath5k_ini *ini_regs, int change_channel)
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
static const struct ath5k_ini_mode ar5211_ini_mode[]
static const struct ath5k_ini rf2425_ini_common_end[]
static void ath5k_hw_ini_mode_registers(struct ath5k_hw *ah, unsigned int size, const struct ath5k_ini_mode *ini_mode, u8 mode)

References ah, ar5210_ini, ar5211_ini, ar5211_ini_mode, ar5212_ini_common_start, ar5212_ini_mode_start, AR5K_AR5210, AR5K_AR5211, AR5K_AR5212, AR5K_PHY_AGC, AR5K_RF2316, AR5K_RF2317, AR5K_RF2413, AR5K_RF2425, AR5K_RF5111, AR5K_RF5112, AR5K_RF5413, ARRAY_SIZE, ath5k_hw_ini_mode_registers(), ath5k_hw_ini_registers(), ath5k_hw_reg_write(), DBG, EINVAL, mode, rf2413_ini_common_end, rf2413_ini_mode_end, rf2425_ini_common_end, rf2425_ini_mode_end, rf5111_ini_bbgain, rf5111_ini_common_end, rf5111_ini_mode_end, rf5112_ini_bbgain, rf5112_ini_common_end, rf5112_ini_mode_end, rf5413_ini_common_end, and rf5413_ini_mode_end.

Referenced by ath5k_hw_reset().

◆ ath5k_hw_rfregs_init()

int ath5k_hw_rfregs_init ( struct ath5k_hw ah,
struct net80211_channel channel,
unsigned int  mode 
)

Definition at line 515 of file ath5k_phy.c.

517 {
518  const struct ath5k_rf_reg *rf_regs;
519  const struct ath5k_ini_rfbuffer *ini_rfb;
520  const struct ath5k_gain_opt *go = NULL;
521  const struct ath5k_gain_opt_step *g_step;
522  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
523  u8 ee_mode = 0;
524  u32 *rfb;
525  int obdb = -1, bank = -1;
526  unsigned i;
527 
528  switch (ah->ah_radio) {
529  case AR5K_RF5111:
530  rf_regs = rf_regs_5111;
531  ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_5111);
532  ini_rfb = rfb_5111;
533  ah->ah_rf_banks_size = ARRAY_SIZE(rfb_5111);
534  go = &rfgain_opt_5111;
535  break;
536  case AR5K_RF5112:
537  if (ah->ah_radio_5ghz_revision >= AR5K_SREV_RAD_5112A) {
538  rf_regs = rf_regs_5112a;
539  ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_5112a);
540  ini_rfb = rfb_5112a;
541  ah->ah_rf_banks_size = ARRAY_SIZE(rfb_5112a);
542  } else {
543  rf_regs = rf_regs_5112;
544  ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_5112);
545  ini_rfb = rfb_5112;
546  ah->ah_rf_banks_size = ARRAY_SIZE(rfb_5112);
547  }
548  go = &rfgain_opt_5112;
549  break;
550  case AR5K_RF2413:
551  rf_regs = rf_regs_2413;
552  ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_2413);
553  ini_rfb = rfb_2413;
554  ah->ah_rf_banks_size = ARRAY_SIZE(rfb_2413);
555  break;
556  case AR5K_RF2316:
557  rf_regs = rf_regs_2316;
558  ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_2316);
559  ini_rfb = rfb_2316;
560  ah->ah_rf_banks_size = ARRAY_SIZE(rfb_2316);
561  break;
562  case AR5K_RF5413:
563  rf_regs = rf_regs_5413;
564  ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_5413);
565  ini_rfb = rfb_5413;
566  ah->ah_rf_banks_size = ARRAY_SIZE(rfb_5413);
567  break;
568  case AR5K_RF2317:
569  rf_regs = rf_regs_2425;
570  ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_2425);
571  ini_rfb = rfb_2317;
572  ah->ah_rf_banks_size = ARRAY_SIZE(rfb_2317);
573  break;
574  case AR5K_RF2425:
575  rf_regs = rf_regs_2425;
576  ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_2425);
577  if (ah->ah_mac_srev < AR5K_SREV_AR2417) {
578  ini_rfb = rfb_2425;
579  ah->ah_rf_banks_size = ARRAY_SIZE(rfb_2425);
580  } else {
581  ini_rfb = rfb_2417;
582  ah->ah_rf_banks_size = ARRAY_SIZE(rfb_2417);
583  }
584  break;
585  default:
586  return -EINVAL;
587  }
588 
589  /* If it's the first time we set rf buffer, allocate
590  * ah->ah_rf_banks based on ah->ah_rf_banks_size
591  * we set above */
592  if (ah->ah_rf_banks == NULL) {
593  ah->ah_rf_banks = malloc(sizeof(u32) * ah->ah_rf_banks_size);
594  if (ah->ah_rf_banks == NULL) {
595  return -ENOMEM;
596  }
597  }
598 
599  /* Copy values to modify them */
600  rfb = ah->ah_rf_banks;
601 
602  for (i = 0; i < ah->ah_rf_banks_size; i++) {
603  if (ini_rfb[i].rfb_bank >= AR5K_MAX_RF_BANKS) {
604  DBG("ath5k: invalid RF register bank\n");
605  return -EINVAL;
606  }
607 
608  /* Bank changed, write down the offset */
609  if (bank != ini_rfb[i].rfb_bank) {
610  bank = ini_rfb[i].rfb_bank;
611  ah->ah_offset[bank] = i;
612  }
613 
614  rfb[i] = ini_rfb[i].rfb_mode_data[mode];
615  }
616 
617  /* Set Output and Driver bias current (OB/DB) */
618  if (channel->hw_value & CHANNEL_2GHZ) {
619 
620  if (channel->hw_value & CHANNEL_CCK)
621  ee_mode = AR5K_EEPROM_MODE_11B;
622  else
623  ee_mode = AR5K_EEPROM_MODE_11G;
624 
625  /* For RF511X/RF211X combination we
626  * use b_OB and b_DB parameters stored
627  * in eeprom on ee->ee_ob[ee_mode][0]
628  *
629  * For all other chips we use OB/DB for 2Ghz
630  * stored in the b/g modal section just like
631  * 802.11a on ee->ee_ob[ee_mode][1] */
632  if ((ah->ah_radio == AR5K_RF5111) ||
633  (ah->ah_radio == AR5K_RF5112))
634  obdb = 0;
635  else
636  obdb = 1;
637 
638  ath5k_hw_rfb_op(ah, rf_regs, ee->ee_ob[ee_mode][obdb],
639  AR5K_RF_OB_2GHZ, 1);
640 
641  ath5k_hw_rfb_op(ah, rf_regs, ee->ee_db[ee_mode][obdb],
642  AR5K_RF_DB_2GHZ, 1);
643 
644  /* RF5111 always needs OB/DB for 5GHz, even if we use 2GHz */
645  } else if ((channel->hw_value & CHANNEL_5GHZ) ||
646  (ah->ah_radio == AR5K_RF5111)) {
647 
648  /* For 11a, Turbo and XR we need to choose
649  * OB/DB based on frequency range */
650  ee_mode = AR5K_EEPROM_MODE_11A;
651  obdb = channel->center_freq >= 5725 ? 3 :
652  (channel->center_freq >= 5500 ? 2 :
653  (channel->center_freq >= 5260 ? 1 :
654  (channel->center_freq > 4000 ? 0 : -1)));
655 
656  if (obdb < 0)
657  return -EINVAL;
658 
659  ath5k_hw_rfb_op(ah, rf_regs, ee->ee_ob[ee_mode][obdb],
660  AR5K_RF_OB_5GHZ, 1);
661 
662  ath5k_hw_rfb_op(ah, rf_regs, ee->ee_db[ee_mode][obdb],
663  AR5K_RF_DB_5GHZ, 1);
664  }
665 
666  g_step = &go->go_step[ah->ah_gain.g_step_idx];
667 
668  /* Bank Modifications (chip-specific) */
669  if (ah->ah_radio == AR5K_RF5111) {
670 
671  /* Set gain_F settings according to current step */
672  if (channel->hw_value & CHANNEL_OFDM) {
673 
676  g_step->gos_param[0]);
677 
678  ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[1],
679  AR5K_RF_PWD_90, 1);
680 
681  ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[2],
682  AR5K_RF_PWD_84, 1);
683 
684  ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[3],
685  AR5K_RF_RFGAIN_SEL, 1);
686 
687  /* We programmed gain_F parameters, switch back
688  * to active state */
689  ah->ah_gain.g_state = AR5K_RFGAIN_ACTIVE;
690 
691  }
692 
693  /* Bank 6/7 setup */
694 
695  ath5k_hw_rfb_op(ah, rf_regs, !ee->ee_xpd[ee_mode],
696  AR5K_RF_PWD_XPD, 1);
697 
698  ath5k_hw_rfb_op(ah, rf_regs, ee->ee_x_gain[ee_mode],
699  AR5K_RF_XPD_GAIN, 1);
700 
701  ath5k_hw_rfb_op(ah, rf_regs, ee->ee_i_gain[ee_mode],
702  AR5K_RF_GAIN_I, 1);
703 
704  ath5k_hw_rfb_op(ah, rf_regs, ee->ee_xpd[ee_mode],
705  AR5K_RF_PLO_SEL, 1);
706 
707  /* TODO: Half/quarter channel support */
708  }
709 
710  if (ah->ah_radio == AR5K_RF5112) {
711 
712  /* Set gain_F settings according to current step */
713  if (channel->hw_value & CHANNEL_OFDM) {
714 
715  ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[0],
717 
718  ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[1],
719  AR5K_RF_PWD_138, 1);
720 
721  ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[2],
722  AR5K_RF_PWD_137, 1);
723 
724  ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[3],
725  AR5K_RF_PWD_136, 1);
726 
727  ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[4],
728  AR5K_RF_PWD_132, 1);
729 
730  ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[5],
731  AR5K_RF_PWD_131, 1);
732 
733  ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[6],
734  AR5K_RF_PWD_130, 1);
735 
736  /* We programmed gain_F parameters, switch back
737  * to active state */
738  ah->ah_gain.g_state = AR5K_RFGAIN_ACTIVE;
739  }
740 
741  /* Bank 6/7 setup */
742 
743  ath5k_hw_rfb_op(ah, rf_regs, ee->ee_xpd[ee_mode],
744  AR5K_RF_XPD_SEL, 1);
745 
746  if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_5112A) {
747  /* Rev. 1 supports only one xpd */
748  ath5k_hw_rfb_op(ah, rf_regs,
749  ee->ee_x_gain[ee_mode],
750  AR5K_RF_XPD_GAIN, 1);
751 
752  } else {
753  /* TODO: Set high and low gain bits */
754  ath5k_hw_rfb_op(ah, rf_regs,
755  ee->ee_x_gain[ee_mode],
756  AR5K_RF_PD_GAIN_LO, 1);
757  ath5k_hw_rfb_op(ah, rf_regs,
758  ee->ee_x_gain[ee_mode],
759  AR5K_RF_PD_GAIN_HI, 1);
760 
761  /* Lower synth voltage on Rev 2 */
762  ath5k_hw_rfb_op(ah, rf_regs, 2,
763  AR5K_RF_HIGH_VC_CP, 1);
764 
765  ath5k_hw_rfb_op(ah, rf_regs, 2,
766  AR5K_RF_MID_VC_CP, 1);
767 
768  ath5k_hw_rfb_op(ah, rf_regs, 2,
769  AR5K_RF_LOW_VC_CP, 1);
770 
771  ath5k_hw_rfb_op(ah, rf_regs, 2,
772  AR5K_RF_PUSH_UP, 1);
773 
774  /* Decrease power consumption on 5213+ BaseBand */
775  if (ah->ah_phy_revision >= AR5K_SREV_PHY_5212A) {
776  ath5k_hw_rfb_op(ah, rf_regs, 1,
777  AR5K_RF_PAD2GND, 1);
778 
779  ath5k_hw_rfb_op(ah, rf_regs, 1,
780  AR5K_RF_XB2_LVL, 1);
781 
782  ath5k_hw_rfb_op(ah, rf_regs, 1,
783  AR5K_RF_XB5_LVL, 1);
784 
785  ath5k_hw_rfb_op(ah, rf_regs, 1,
786  AR5K_RF_PWD_167, 1);
787 
788  ath5k_hw_rfb_op(ah, rf_regs, 1,
789  AR5K_RF_PWD_166, 1);
790  }
791  }
792 
793  ath5k_hw_rfb_op(ah, rf_regs, ee->ee_i_gain[ee_mode],
794  AR5K_RF_GAIN_I, 1);
795 
796  /* TODO: Half/quarter channel support */
797 
798  }
799 
800  if (ah->ah_radio == AR5K_RF5413 &&
801  channel->hw_value & CHANNEL_2GHZ) {
802 
804  1);
805 
806  /* Set optimum value for early revisions (on pci-e chips) */
807  if (ah->ah_mac_srev >= AR5K_SREV_AR5424 &&
808  ah->ah_mac_srev < AR5K_SREV_AR5413)
809  ath5k_hw_rfb_op(ah, rf_regs, ath5k_hw_bitswap(6, 3),
811 
812  }
813 
814  /* Write RF banks on hw */
815  for (i = 0; i < ah->ah_rf_banks_size; i++) {
816  AR5K_REG_WAIT(i);
817  ath5k_hw_reg_write(ah, rfb[i], ini_rfb[i].rfb_ctrl_register);
818  }
819 
820  return 0;
821 }
static const struct ath5k_rf_reg rf_regs_2413[]
Definition: rfbuffer.h:644
#define EINVAL
Invalid argument.
Definition: errno.h:429
static const struct ath5k_rf_reg rf_regs_5112a[]
Definition: rfbuffer.h:480
#define AR5K_PHY_FRAME_CTL
Definition: reg.h:2275
static const struct ath5k_rf_reg rf_regs_5112[]
Definition: rfbuffer.h:310
#define AR5K_EEPROM_MODE_11G
Definition: eeprom.h:66
#define AR5K_REG_WAIT(_i)
Definition: ath5k.h:135
#define AR5K_EEPROM_MODE_11A
Definition: eeprom.h:64
uint16_t mode
Acceleration mode.
Definition: ena.h:26
static u32 ath5k_hw_bitswap(u32 val, unsigned int bits)
Definition: ath5k.h:1267
static const struct ath5k_rf_reg rf_regs_2425[]
Definition: rfbuffer.h:939
static const struct ath5k_ini_rfbuffer rfb_5413[]
Definition: rfbuffer.h:838
#define AR5K_MAX_RF_BANKS
Definition: ath5k.h:952
static const struct ath5k_ini_rfbuffer rfb_2417[]
Definition: rfbuffer.h:1108
u16 ee_x_gain[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:412
u32 rfb_mode_data[5]
Definition: rfbuffer.h:55
#define AR5K_SREV_AR5424
Definition: ath5k.h:300
#define AR5K_SREV_AR2417
Definition: ath5k.h:307
static const struct ath5k_gain_opt rfgain_opt_5111
Definition: rfgain.h:478
const struct ath5k_gain_opt_step go_step[AR5K_GAIN_STEP_COUNT]
Definition: rfgain.h:468
u16 ee_db[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_OBDB]
Definition: eeprom.h:405
#define CHANNEL_CCK
Definition: ath5k.h:632
#define ENOMEM
Not enough space.
Definition: errno.h:535
static const struct ath5k_rf_reg rf_regs_5413[]
Definition: rfbuffer.h:828
static unsigned int ath5k_hw_rfb_op(struct ath5k_hw *ah, const struct ath5k_rf_reg *rf_regs, u32 val, u8 reg_id, int set)
Definition: ath5k_phy.c:52
#define AR5K_REG_WRITE_BITS(ah, _reg, _flags, _val)
Definition: ath5k.h:98
static const struct ath5k_ini_rfbuffer rfb_2316[]
Definition: rfbuffer.h:738
s8 gos_param[AR5K_GAIN_CRN_MAX_FIX_BITS]
Definition: rfgain.h:461
#define AR5K_SREV_AR5413
Definition: ath5k.h:301
uint32_t channel
RNDIS channel.
Definition: netvsc.h:14
static const struct ath5k_ini_rfbuffer rfb_5112[]
Definition: rfbuffer.h:338
static const struct ath5k_rf_reg rf_regs_2316[]
Definition: rfbuffer.h:732
static const struct ath5k_ini_rfbuffer rfb_2425[]
Definition: rfbuffer.h:947
#define AR5K_EEPROM_MODE_11B
Definition: eeprom.h:65
#define ARRAY_SIZE(x)
Definition: efx_common.h:43
static const struct ath5k_gain_opt rfgain_opt_5112
Definition: rfgain.h:504
#define CHANNEL_OFDM
Definition: ath5k.h:633
static const struct ath5k_rf_reg rf_regs_5111[]
Definition: rfbuffer.h:161
u16 ee_i_gain[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:413
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
static const struct ath5k_ini_rfbuffer rfb_2413[]
Definition: rfbuffer.h:652
void * malloc(size_t size)
Allocate memory.
Definition: malloc.c:621
u16 ee_xpd[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:411
static const struct ath5k_ini_rfbuffer rfb_5112a[]
Definition: rfbuffer.h:518
#define AR5K_SREV_RAD_5112A
Definition: ath5k.h:314
#define CHANNEL_5GHZ
Definition: ath5k.h:635
uint8_t ah
Definition: registers.h:85
#define AR5K_SREV_PHY_5212A
Definition: ath5k.h:329
u16 ee_ob[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_OBDB]
Definition: eeprom.h:404
static const struct ath5k_ini_rfbuffer rfb_2317[]
Definition: rfbuffer.h:1027
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define CHANNEL_2GHZ
Definition: ath5k.h:634
#define AR5K_PHY_FRAME_CTL_TX_CLIP
Definition: reg.h:2278
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
uint8_t u8
Definition: stdint.h:20
uint32_t u32
Definition: stdint.h:24
static const struct ath5k_ini_rfbuffer rfb_5111[]
Definition: rfbuffer.h:180

References ah, AR5K_EEPROM_MODE_11A, AR5K_EEPROM_MODE_11B, AR5K_EEPROM_MODE_11G, AR5K_MAX_RF_BANKS, AR5K_PHY_FRAME_CTL, AR5K_PHY_FRAME_CTL_TX_CLIP, AR5K_REG_WAIT, AR5K_REG_WRITE_BITS, AR5K_RF2316, AR5K_RF2317, AR5K_RF2413, AR5K_RF2425, AR5K_RF5111, AR5K_RF5112, AR5K_RF5413, AR5K_RF_DB_2GHZ, AR5K_RF_DB_5GHZ, AR5K_RF_DERBY_CHAN_SEL_MODE, AR5K_RF_GAIN_I, AR5K_RF_HIGH_VC_CP, AR5K_RF_LOW_VC_CP, AR5K_RF_MID_VC_CP, AR5K_RF_MIXGAIN_OVR, AR5K_RF_OB_2GHZ, AR5K_RF_OB_5GHZ, AR5K_RF_PAD2GND, AR5K_RF_PD_GAIN_HI, AR5K_RF_PD_GAIN_LO, AR5K_RF_PLO_SEL, AR5K_RF_PUSH_UP, AR5K_RF_PWD_130, AR5K_RF_PWD_131, AR5K_RF_PWD_132, AR5K_RF_PWD_136, AR5K_RF_PWD_137, AR5K_RF_PWD_138, AR5K_RF_PWD_166, AR5K_RF_PWD_167, AR5K_RF_PWD_84, AR5K_RF_PWD_90, AR5K_RF_PWD_ICLOBUF_2G, AR5K_RF_PWD_XPD, AR5K_RF_RFGAIN_SEL, AR5K_RF_XB2_LVL, AR5K_RF_XB5_LVL, AR5K_RF_XPD_GAIN, AR5K_RF_XPD_SEL, AR5K_RFGAIN_ACTIVE, AR5K_SREV_AR2417, AR5K_SREV_AR5413, AR5K_SREV_AR5424, AR5K_SREV_PHY_5212A, AR5K_SREV_RAD_5112A, ARRAY_SIZE, ath5k_hw_bitswap(), ath5k_hw_reg_write(), ath5k_hw_rfb_op(), channel, CHANNEL_2GHZ, CHANNEL_5GHZ, CHANNEL_CCK, CHANNEL_OFDM, DBG, ath5k_eeprom_info::ee_db, ath5k_eeprom_info::ee_i_gain, ath5k_eeprom_info::ee_ob, ath5k_eeprom_info::ee_x_gain, ath5k_eeprom_info::ee_xpd, EINVAL, ENOMEM, ath5k_gain_opt::go_step, ath5k_gain_opt_step::gos_param, malloc(), mode, NULL, rf_regs_2316, rf_regs_2413, rf_regs_2425, rf_regs_5111, rf_regs_5112, rf_regs_5112a, rf_regs_5413, rfb_2316, rfb_2317, rfb_2413, rfb_2417, rfb_2425, rfb_5111, rfb_5112, rfb_5112a, rfb_5413, ath5k_ini_rfbuffer::rfb_bank, ath5k_ini_rfbuffer::rfb_mode_data, rfgain_opt_5111, and rfgain_opt_5112.

Referenced by ath5k_hw_reset().

◆ ath5k_hw_rfgain_init()

int ath5k_hw_rfgain_init ( struct ath5k_hw ah,
unsigned int  freq 
)

Definition at line 453 of file ath5k_phy.c.

454 {
455  const struct ath5k_ini_rfgain *ath5k_rfg;
456  unsigned int i, size;
457 
458  switch (ah->ah_radio) {
459  case AR5K_RF5111:
460  ath5k_rfg = rfgain_5111;
462  break;
463  case AR5K_RF5112:
464  ath5k_rfg = rfgain_5112;
466  break;
467  case AR5K_RF2413:
468  ath5k_rfg = rfgain_2413;
470  break;
471  case AR5K_RF2316:
472  ath5k_rfg = rfgain_2316;
474  break;
475  case AR5K_RF5413:
476  ath5k_rfg = rfgain_5413;
478  break;
479  case AR5K_RF2317:
480  case AR5K_RF2425:
481  ath5k_rfg = rfgain_2425;
483  break;
484  default:
485  return -EINVAL;
486  }
487 
488  switch (freq) {
491  break;
492  default:
493  return -EINVAL;
494  }
495 
496  for (i = 0; i < size; i++) {
497  AR5K_REG_WAIT(i);
498  ath5k_hw_reg_write(ah, ath5k_rfg[i].rfg_value[freq],
499  (u32)ath5k_rfg[i].rfg_register);
500  }
501 
502  return 0;
503 }
#define EINVAL
Invalid argument.
Definition: errno.h:429
u16 rfg_register
Definition: rfgain.h:29
#define AR5K_REG_WAIT(_i)
Definition: ath5k.h:135
#define AR5K_INI_RFGAIN_5GHZ
Definition: ath5k.h:141
uint16_t size
Buffer size.
Definition: dwmac.h:14
static const struct ath5k_ini_rfgain rfgain_2425[]
Definition: rfgain.h:379
static const struct ath5k_ini_rfgain rfgain_2316[]
Definition: rfgain.h:240
static const struct ath5k_ini_rfgain rfgain_5112[]
Definition: rfgain.h:103
static const struct ath5k_ini_rfgain rfgain_2413[]
Definition: rfgain.h:172
#define ARRAY_SIZE(x)
Definition: efx_common.h:43
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define AR5K_INI_RFGAIN_2GHZ
Definition: ath5k.h:142
static const struct ath5k_ini_rfgain rfgain_5111[]
Definition: rfgain.h:34
uint8_t ah
Definition: registers.h:85
u32 rfg_value[2]
Definition: rfgain.h:30
static const struct ath5k_ini_rfgain rfgain_5413[]
Definition: rfgain.h:309
uint32_t u32
Definition: stdint.h:24

References ah, AR5K_INI_RFGAIN_2GHZ, AR5K_INI_RFGAIN_5GHZ, AR5K_REG_WAIT, AR5K_RF2316, AR5K_RF2317, AR5K_RF2413, AR5K_RF2425, AR5K_RF5111, AR5K_RF5112, AR5K_RF5413, ARRAY_SIZE, ath5k_hw_reg_write(), EINVAL, ath5k_ini_rfgain::rfg_register, ath5k_ini_rfgain::rfg_value, rfgain_2316, rfgain_2413, rfgain_2425, rfgain_5111, rfgain_5112, rfgain_5413, and size.

Referenced by ath5k_hw_reset().

◆ ath5k_hw_gainf_calibrate()

enum ath5k_rfgain ath5k_hw_gainf_calibrate ( struct ath5k_hw ah)

Definition at line 390 of file ath5k_phy.c.

391 {
392  u32 data, type;
393  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
394 
395  if (ah->ah_rf_banks == NULL ||
396  ah->ah_gain.g_state == AR5K_RFGAIN_INACTIVE)
397  return AR5K_RFGAIN_INACTIVE;
398 
399  /* No check requested, either engine is inactive
400  * or an adjustment is already requested */
401  if (ah->ah_gain.g_state != AR5K_RFGAIN_READ_REQUESTED)
402  goto done;
403 
404  /* Read the PAPD (Peak to Average Power Detector)
405  * register */
407 
408  /* No probe is scheduled, read gain_F measurement */
410  ah->ah_gain.g_current = data >> AR5K_PHY_PAPD_PROBE_GAINF_S;
412 
413  /* If tx packet is CCK correct the gain_F measurement
414  * by cck ofdm gain delta */
416  if (ah->ah_radio_5ghz_revision >= AR5K_SREV_RAD_5112A)
417  ah->ah_gain.g_current +=
419  else
420  ah->ah_gain.g_current +=
422  }
423 
424  /* Further correct gain_F measurement for
425  * RF5112A radios */
426  if (ah->ah_radio_5ghz_revision >= AR5K_SREV_RAD_5112A) {
428  ah->ah_gain.g_current =
429  ah->ah_gain.g_current >= ah->ah_gain.g_f_corr ?
430  (ah->ah_gain.g_current-ah->ah_gain.g_f_corr) :
431  0;
432  }
433 
434  /* Check if measurement is ok and if we need
435  * to adjust gain, schedule a gain adjustment,
436  * else switch back to the acive state */
438  AR5K_GAIN_CHECK_ADJUST(&ah->ah_gain) &&
440  ah->ah_gain.g_state = AR5K_RFGAIN_NEED_CHANGE;
441  } else {
442  ah->ah_gain.g_state = AR5K_RFGAIN_ACTIVE;
443  }
444  }
445 
446 done:
447  return ah->ah_gain.g_state;
448 }
#define AR5K_PHY_PAPD_PROBE_GAINF_S
Definition: reg.h:2256
#define AR5K_PHY_PAPD_PROBE
Definition: reg.h:2242
#define AR5K_PHY_PAPD_PROBE_TYPE
Definition: reg.h:2250
uint32_t type
Operating system type.
Definition: ena.h:12
#define AR5K_GAIN_CCK_PROBE_CORR
Definition: rfgain.h:451
#define AR5K_PHY_PAPD_PROBE_TYPE_CCK
Definition: reg.h:2254
#define AR5K_REG_MS(_val, _flags)
Definition: ath5k.h:90
static u32 ath5k_hw_rf_gainf_corr(struct ath5k_hw *ah)
Definition: ath5k_phy.c:215
#define AR5K_GAIN_CHECK_ADJUST(_g)
Definition: rfgain.h:457
static int ath5k_hw_rf_check_gainf_readback(struct ath5k_hw *ah)
Definition: ath5k_phy.c:270
#define AR5K_PHY_PAPD_PROBE_TX_NEXT
Definition: reg.h:2248
static s8 ath5k_hw_rf_gainf_adjust(struct ath5k_hw *ah)
Definition: ath5k_phy.c:321
#define AR5K_SREV_RAD_5112A
Definition: ath5k.h:314
uint8_t data[48]
Additional event data.
Definition: ena.h:22
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
u16 ee_cck_ofdm_gain_delta
Definition: eeprom.h:391
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
struct bofm_section_header done
Definition: bofm_test.c:46
uint32_t u32
Definition: stdint.h:24

References ah, AR5K_GAIN_CCK_PROBE_CORR, AR5K_GAIN_CHECK_ADJUST, AR5K_PHY_PAPD_PROBE, AR5K_PHY_PAPD_PROBE_GAINF_S, AR5K_PHY_PAPD_PROBE_TX_NEXT, AR5K_PHY_PAPD_PROBE_TYPE, AR5K_PHY_PAPD_PROBE_TYPE_CCK, AR5K_REG_MS, AR5K_RFGAIN_ACTIVE, AR5K_RFGAIN_INACTIVE, AR5K_RFGAIN_NEED_CHANGE, AR5K_RFGAIN_READ_REQUESTED, AR5K_SREV_RAD_5112A, ath5k_hw_reg_read(), ath5k_hw_rf_check_gainf_readback(), ath5k_hw_rf_gainf_adjust(), ath5k_hw_rf_gainf_corr(), data, done, ath5k_eeprom_info::ee_cck_ofdm_gain_delta, NULL, and type.

Referenced by ath5k_calibrate(), and ath5k_hw_reset().

◆ ath5k_hw_rfgain_opt_init()

int ath5k_hw_rfgain_opt_init ( struct ath5k_hw ah)

Definition at line 159 of file ath5k_phy.c.

160 {
161  /* Initialize the gain optimization values */
162  switch (ah->ah_radio) {
163  case AR5K_RF5111:
164  ah->ah_gain.g_step_idx = rfgain_opt_5111.go_default;
165  ah->ah_gain.g_low = 20;
166  ah->ah_gain.g_high = 35;
167  ah->ah_gain.g_state = AR5K_RFGAIN_ACTIVE;
168  break;
169  case AR5K_RF5112:
170  ah->ah_gain.g_step_idx = rfgain_opt_5112.go_default;
171  ah->ah_gain.g_low = 20;
172  ah->ah_gain.g_high = 85;
173  ah->ah_gain.g_state = AR5K_RFGAIN_ACTIVE;
174  break;
175  default:
176  return -EINVAL;
177  }
178 
179  return 0;
180 }
#define EINVAL
Invalid argument.
Definition: errno.h:429
static const struct ath5k_gain_opt rfgain_opt_5111
Definition: rfgain.h:478
static const struct ath5k_gain_opt rfgain_opt_5112
Definition: rfgain.h:504
uint8_t ah
Definition: registers.h:85

References ah, AR5K_RF5111, AR5K_RF5112, AR5K_RFGAIN_ACTIVE, EINVAL, ath5k_gain_opt::go_default, rfgain_opt_5111, and rfgain_opt_5112.

Referenced by ath5k_hw_attach().

◆ ath5k_channel_ok()

int ath5k_channel_ok ( struct ath5k_hw ah,
u16  freq,
unsigned int  flags 
)

Definition at line 831 of file ath5k_phy.c.

832 {
833  /* Check if the channel is in our supported range */
834  if (flags & CHANNEL_2GHZ) {
835  if ((freq >= ah->ah_capabilities.cap_range.range_2ghz_min) &&
836  (freq <= ah->ah_capabilities.cap_range.range_2ghz_max))
837  return 1;
838  } else if (flags & CHANNEL_5GHZ)
839  if ((freq >= ah->ah_capabilities.cap_range.range_5ghz_min) &&
840  (freq <= ah->ah_capabilities.cap_range.range_5ghz_max))
841  return 1;
842 
843  return 0;
844 }
uint8_t flags
Flags.
Definition: ena.h:18
#define CHANNEL_5GHZ
Definition: ath5k.h:635
uint8_t ah
Definition: registers.h:85
#define CHANNEL_2GHZ
Definition: ath5k.h:634

References ah, CHANNEL_2GHZ, CHANNEL_5GHZ, and flags.

Referenced by ath5k_copy_channels(), and ath5k_hw_channel().

◆ ath5k_hw_channel()

int ath5k_hw_channel ( struct ath5k_hw ah,
struct net80211_channel channel 
)

Definition at line 1049 of file ath5k_phy.c.

1050 {
1051  int ret;
1052  /*
1053  * Check bounds supported by the PHY (we don't care about regultory
1054  * restrictions at this point). Note: hw_value already has the band
1055  * (CHANNEL_2GHZ, or CHANNEL_5GHZ) so we inform ath5k_channel_ok()
1056  * of the band by that */
1057  if (!ath5k_channel_ok(ah, channel->center_freq, channel->hw_value)) {
1058  DBG("ath5k: channel frequency (%d MHz) out of supported "
1059  "range\n", channel->center_freq);
1060  return -EINVAL;
1061  }
1062 
1063  /*
1064  * Set the channel and wait
1065  */
1066  switch (ah->ah_radio) {
1067  case AR5K_RF5110:
1069  break;
1070  case AR5K_RF5111:
1072  break;
1073  case AR5K_RF2425:
1075  break;
1076  default:
1078  break;
1079  }
1080 
1081  if (ret) {
1082  DBG("ath5k: setting channel failed: %s\n", strerror(ret));
1083  return ret;
1084  }
1085 
1086  /* Set JAPAN setting for channel 14 */
1087  if (channel->center_freq == 2484) {
1090  } else {
1093  }
1094 
1095  ah->ah_current_channel = channel;
1096  ah->ah_turbo = (channel->hw_value == CHANNEL_T ? 1 : 0);
1097 
1098  return 0;
1099 }
#define EINVAL
Invalid argument.
Definition: errno.h:429
static int ath5k_hw_rf2425_channel(struct ath5k_hw *ah, struct net80211_channel *channel)
Definition: ath5k_phy.c:1010
static int ath5k_hw_rf5112_channel(struct ath5k_hw *ah, struct net80211_channel *channel)
Definition: ath5k_phy.c:962
uint32_t channel
RNDIS channel.
Definition: netvsc.h:14
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:79
static int ath5k_hw_rf5110_channel(struct ath5k_hw *ah, struct net80211_channel *channel)
Definition: ath5k_phy.c:868
#define CHANNEL_T
Definition: ath5k.h:643
int ath5k_channel_ok(struct ath5k_hw *ah, u16 freq, unsigned int flags)
Definition: ath5k_phy.c:831
uint8_t ah
Definition: registers.h:85
#define AR5K_PHY_CCKTXCTL_WORLD
Definition: reg.h:2524
static int ath5k_hw_rf5111_channel(struct ath5k_hw *ah, struct net80211_channel *channel)
Definition: ath5k_phy.c:916
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define AR5K_PHY_CCKTXCTL
Definition: reg.h:2523
#define AR5K_REG_ENABLE_BITS(ah, _reg, _flags)
Definition: ath5k.h:106
#define AR5K_PHY_CCKTXCTL_JAPAN
Definition: reg.h:2525

References ah, AR5K_PHY_CCKTXCTL, AR5K_PHY_CCKTXCTL_JAPAN, AR5K_PHY_CCKTXCTL_WORLD, AR5K_REG_ENABLE_BITS, AR5K_RF2425, AR5K_RF5110, AR5K_RF5111, ath5k_channel_ok(), ath5k_hw_rf2425_channel(), ath5k_hw_rf5110_channel(), ath5k_hw_rf5111_channel(), ath5k_hw_rf5112_channel(), channel, CHANNEL_T, DBG, EINVAL, and strerror().

Referenced by ath5k_hw_reset(), and ath5k_hw_rf5110_calibrate().

◆ ath5k_hw_phy_calibrate()

int ath5k_hw_phy_calibrate ( struct ath5k_hw ah,
struct net80211_channel channel 
)

Definition at line 1346 of file ath5k_phy.c.

1348 {
1349  int ret;
1350 
1351  if (ah->ah_radio == AR5K_RF5110)
1353  else
1355 
1356  return ret;
1357 }
static int ath5k_hw_rf5110_calibrate(struct ath5k_hw *ah, struct net80211_channel *channel)
Definition: ath5k_phy.c:1178
uint32_t channel
RNDIS channel.
Definition: netvsc.h:14
static int ath5k_hw_rf511x_calibrate(struct ath5k_hw *ah, struct net80211_channel *channel)
Definition: ath5k_phy.c:1278
uint8_t ah
Definition: registers.h:85

References ah, AR5K_RF5110, ath5k_hw_rf5110_calibrate(), ath5k_hw_rf511x_calibrate(), and channel.

Referenced by ath5k_calibrate().

◆ ath5k_hw_noise_floor_calibration()

int ath5k_hw_noise_floor_calibration ( struct ath5k_hw ah,
short  freq 
)

ath5k_hw_noise_floor_calibration - perform PHY noise floor calibration

@ah: struct ath5k_hw pointer we are operating on @freq: the channel frequency, just used for error logging

This function performs a noise floor calibration of the PHY and waits for it to complete. Then the noise floor value is compared to some maximum noise floor we consider valid.

Note that this is different from what the madwifi HAL does: it reads the noise floor and afterwards initiates the calibration. Since the noise floor calibration can take some time to finish, depending on the current channel use, that avoids the occasional timeout warnings we are seeing now.

See the following link for an Atheros patent on noise floor calibration: http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PALL \ &p=1&u=%2Fnetahtml%2FPTO%2Fsrchnum.htm&r=1&f=G&l=50&s1=7245893.PN.&OS=PN/7

XXX: Since during noise floor calibration antennas are detached according to the patent, we should stop tx queues here.

Definition at line 1128 of file ath5k_phy.c.

1129 {
1130  int ret;
1131  unsigned int i;
1132  s32 noise_floor;
1133 
1134  /*
1135  * Enable noise floor calibration
1136  */
1139 
1140  ret = ath5k_hw_register_timeout(ah, AR5K_PHY_AGCCTL,
1141  AR5K_PHY_AGCCTL_NF, 0, 0);
1142 
1143  if (ret) {
1144  DBG("ath5k: noise floor calibration timeout (%d MHz)\n", freq);
1145  return -EAGAIN;
1146  }
1147 
1148  /* Wait until the noise floor is calibrated and read the value */
1149  for (i = 20; i > 0; i--) {
1150  mdelay(1);
1151  noise_floor = ath5k_hw_reg_read(ah, AR5K_PHY_NF);
1152  noise_floor = AR5K_PHY_NF_RVAL(noise_floor);
1153  if (noise_floor & AR5K_PHY_NF_ACTIVE) {
1154  noise_floor = AR5K_PHY_NF_AVAL(noise_floor);
1155 
1156  if (noise_floor <= AR5K_TUNE_NOISE_FLOOR)
1157  break;
1158  }
1159  }
1160 
1161  DBG2("ath5k: noise floor %d\n", noise_floor);
1162 
1163  if (noise_floor > AR5K_TUNE_NOISE_FLOOR) {
1164  DBG("ath5k: noise floor calibration failed (%d MHz)\n", freq);
1165  return -EAGAIN;
1166  }
1167 
1168  ah->ah_noise_floor = noise_floor;
1169 
1170  return 0;
1171 }
#define AR5K_PHY_AGCCTL_NF
Definition: reg.h:2032
int32_t s32
Definition: stdint.h:23
#define AR5K_PHY_NF_ACTIVE
Definition: reg.h:2041
#define AR5K_PHY_NF_RVAL(_n)
Definition: reg.h:2042
#define AR5K_PHY_NF_AVAL(_n)
Definition: reg.h:2043
#define AR5K_PHY_AGCCTL
Definition: reg.h:2030
#define AR5K_PHY_NF
Definition: reg.h:2039
#define EAGAIN
Resource temporarily unavailable.
Definition: errno.h:319
#define AR5K_TUNE_NOISE_FLOOR
Definition: ath5k.h:192
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
Definition: timer.c:79
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define DBG2(...)
Definition: compiler.h:515
#define AR5K_REG_ENABLE_BITS(ah, _reg, _flags)
Definition: ath5k.h:106

References ah, AR5K_PHY_AGCCTL, AR5K_PHY_AGCCTL_NF, AR5K_PHY_NF, AR5K_PHY_NF_ACTIVE, AR5K_PHY_NF_AVAL, AR5K_PHY_NF_RVAL, AR5K_REG_ENABLE_BITS, AR5K_TUNE_NOISE_FLOOR, ath5k_hw_reg_read(), DBG, DBG2, EAGAIN, and mdelay().

Referenced by ath5k_hw_reset(), ath5k_hw_rf5110_calibrate(), and ath5k_hw_rf511x_calibrate().

◆ ath5k_hw_radio_revision()

u16 ath5k_hw_radio_revision ( struct ath5k_hw ah,
unsigned int  chan 
)

Definition at line 1373 of file ath5k_phy.c.

1374 {
1375  unsigned int i;
1376  u32 srev;
1377  u16 ret;
1378 
1379  /*
1380  * Set the radio chip access register
1381  */
1382  switch (chan) {
1383  case CHANNEL_2GHZ:
1385  break;
1386  case CHANNEL_5GHZ:
1388  break;
1389  default:
1390  return 0;
1391  }
1392 
1393  mdelay(2);
1394 
1395  /* ...wait until PHY is ready and read the selected radio revision */
1396  ath5k_hw_reg_write(ah, 0x00001c16, AR5K_PHY(0x34));
1397 
1398  for (i = 0; i < 8; i++)
1399  ath5k_hw_reg_write(ah, 0x00010000, AR5K_PHY(0x20));
1400 
1401  if (ah->ah_version == AR5K_AR5210) {
1402  srev = ath5k_hw_reg_read(ah, AR5K_PHY(256) >> 28) & 0xf;
1403  ret = (u16)ath5k_hw_bitswap(srev, 4) + 1;
1404  } else {
1405  srev = (ath5k_hw_reg_read(ah, AR5K_PHY(0x100)) >> 24) & 0xff;
1406  ret = (u16)ath5k_hw_bitswap(((srev & 0xf0) >> 4) |
1407  ((srev & 0x0f) << 4), 8);
1408  }
1409 
1410  /* Reset to the 5GHz mode */
1412 
1413  return ret;
1414 }
#define AR5K_PHY_SHIFT_5GHZ
Definition: reg.h:1886
#define u16
Definition: vga.h:20
uint16_t u16
Definition: stdint.h:22
static u32 ath5k_hw_bitswap(u32 val, unsigned int bits)
Definition: ath5k.h:1267
#define AR5K_PHY_SHIFT_2GHZ
Definition: reg.h:1885
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
Definition: timer.c:79
#define AR5K_PHY(_n)
Definition: reg.h:1863
#define CHANNEL_5GHZ
Definition: ath5k.h:635
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
#define CHANNEL_2GHZ
Definition: ath5k.h:634
uint32_t u32
Definition: stdint.h:24

References ah, AR5K_AR5210, AR5K_PHY, AR5K_PHY_SHIFT_2GHZ, AR5K_PHY_SHIFT_5GHZ, ath5k_hw_bitswap(), ath5k_hw_reg_read(), ath5k_hw_reg_write(), CHANNEL_2GHZ, CHANNEL_5GHZ, mdelay(), and u16.

Referenced by ath5k_hw_attach().

◆ ath5k_hw_set_def_antenna()

void ath5k_hw_set_def_antenna ( struct ath5k_hw ah,
unsigned int  ant 
)

Definition at line 1417 of file ath5k_phy.c.

1418 {
1419  if (ah->ah_version != AR5K_AR5210)
1421 }
#define AR5K_DEFAULT_ANTENNA
Definition: reg.h:1478
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
uint8_t ah
Definition: registers.h:85

References ah, AR5K_AR5210, AR5K_DEFAULT_ANTENNA, and ath5k_hw_reg_write().

◆ ath5k_hw_get_def_antenna()

unsigned int ath5k_hw_get_def_antenna ( struct ath5k_hw ah)

Definition at line 1423 of file ath5k_phy.c.

1424 {
1425  if (ah->ah_version != AR5K_AR5210)
1427 
1428  return 0; /*XXX: What do we return for 5210 ?*/
1429 }
#define AR5K_DEFAULT_ANTENNA
Definition: reg.h:1478
uint8_t ah
Definition: registers.h:85
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216

References ah, AR5K_AR5210, AR5K_DEFAULT_ANTENNA, and ath5k_hw_reg_read().

◆ ath5k_hw_phy_disable()

int ath5k_hw_phy_disable ( struct ath5k_hw ah)

Definition at line 1359 of file ath5k_phy.c.

1360 {
1362 
1363  return 0;
1364 }
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define AR5K_PHY_ACT_DISABLE
Definition: reg.h:1936
uint8_t ah
Definition: registers.h:85
#define AR5K_PHY_ACT
Definition: reg.h:1934

References ah, AR5K_PHY_ACT, AR5K_PHY_ACT_DISABLE, and ath5k_hw_reg_write().

Referenced by ath5k_stop_hw().

◆ ath5k_hw_txpower()

int ath5k_hw_txpower ( struct ath5k_hw ah,
struct net80211_channel channel,
u8  ee_mode,
u8  txpower 
)

Definition at line 2475 of file ath5k_phy.c.

2477 {
2478  struct ath5k_rate_pcal_info rate_info;
2479  u8 type;
2480  int ret;
2481 
2482  if (txpower > AR5K_TUNE_MAX_TXPOWER) {
2483  DBG("ath5k: invalid tx power %d\n", txpower);
2484  return -EINVAL;
2485  }
2486  if (txpower == 0)
2487  txpower = AR5K_TUNE_DEFAULT_TXPOWER;
2488 
2489  /* Reset TX power values */
2490  memset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower));
2491  ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER;
2492  ah->ah_txpower.txp_min_pwr = 0;
2493  ah->ah_txpower.txp_max_pwr = AR5K_TUNE_MAX_TXPOWER;
2494 
2495  /* Initialize TX power table */
2496  switch (ah->ah_radio) {
2497  case AR5K_RF5111:
2499  break;
2500  case AR5K_RF5112:
2502  break;
2503  case AR5K_RF2413:
2504  case AR5K_RF5413:
2505  case AR5K_RF2316:
2506  case AR5K_RF2317:
2507  case AR5K_RF2425:
2509  break;
2510  default:
2511  return -EINVAL;
2512  }
2513 
2514  /* FIXME: Only on channel/mode change */
2515  ret = ath5k_setup_channel_powertable(ah, channel, ee_mode, type);
2516  if (ret)
2517  return ret;
2518 
2519  /* Limit max power if we have a CTL available */
2521 
2522  /* FIXME: Tx power limit for this regdomain
2523  * XXX: Mac80211/CRDA will do that anyway ? */
2524 
2525  /* FIXME: Antenna reduction stuff */
2526 
2527  /* FIXME: Limit power on turbo modes */
2528 
2529  /* FIXME: TPC scale reduction */
2530 
2531  /* Get surounding channels for per-rate power table
2532  * calibration */
2533  ath5k_get_rate_pcal_data(ah, channel, &rate_info);
2534 
2535  /* Setup rate power table */
2536  ath5k_setup_rate_powertable(ah, txpower, &rate_info, ee_mode);
2537 
2538  /* Write rate power table on hw */
2540  AR5K_TXPOWER_OFDM(2, 16) | AR5K_TXPOWER_OFDM(1, 8) |
2542 
2544  AR5K_TXPOWER_OFDM(6, 16) | AR5K_TXPOWER_OFDM(5, 8) |
2546 
2548  AR5K_TXPOWER_CCK(9, 16) | AR5K_TXPOWER_CCK(15, 8) |
2550 
2552  AR5K_TXPOWER_CCK(13, 16) | AR5K_TXPOWER_CCK(12, 8) |
2554 
2555  /* FIXME: TPC support */
2556  if (ah->ah_txpower.txp_tpc) {
2559 
2564  AR5K_TPC);
2565  } else {
2568  }
2569 
2570  return 0;
2571 }
#define EINVAL
Invalid argument.
Definition: errno.h:429
#define AR5K_PHY_TXPOWER_RATE_MAX
Definition: reg.h:2265
#define AR5K_TXPOWER_CCK(_r, _v)
Definition: ath5k.h:543
uint32_t type
Operating system type.
Definition: ena.h:12
#define AR5K_REG_MS(_val, _flags)
Definition: ath5k.h:90
#define AR5K_TPC_CHIRP
Definition: reg.h:1566
#define AR5K_PHY_TXPOWER_RATE1
Definition: reg.h:2263
#define AR5K_TUNE_DEFAULT_TXPOWER
Definition: ath5k.h:194
static void ath5k_setup_rate_powertable(struct ath5k_hw *ah, u16 max_pwr, struct ath5k_rate_pcal_info *rate_info, u8 ee_mode)
Definition: ath5k_phy.c:2413
#define AR5K_TPC
Definition: reg.h:1561
uint32_t channel
RNDIS channel.
Definition: netvsc.h:14
#define AR5K_TXPOWER_OFDM(_r, _v)
Definition: ath5k.h:538
#define AR5K_PHY_TXPOWER_RATE3
Definition: reg.h:2267
static int ath5k_setup_channel_powertable(struct ath5k_hw *ah, struct net80211_channel *channel, u8 ee_mode, u8 type)
Definition: ath5k_phy.c:2191
#define AR5K_TPC_CTS
Definition: reg.h:1564
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
#define AR5K_TUNE_TPC_TXPOWER
Definition: ath5k.h:195
static void ath5k_get_rate_pcal_data(struct ath5k_hw *ah, struct net80211_channel *channel, struct ath5k_rate_pcal_info *rates)
Definition: ath5k_phy.c:1661
#define AR5K_TPC_ACK
Definition: reg.h:1562
uint8_t ah
Definition: registers.h:85
#define AR5K_PHY_TXPOWER_RATE4
Definition: reg.h:2268
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
static void ath5k_get_max_ctl_power(struct ath5k_hw *ah, struct net80211_channel *channel)
Definition: ath5k_phy.c:1749
#define AR5K_PHY_TXPOWER_RATE_MAX_TPC_ENABLE
Definition: reg.h:2266
#define AR5K_PHY_TXPOWER_RATE2
Definition: reg.h:2264
uint8_t u8
Definition: stdint.h:20
#define AR5K_TUNE_MAX_TXPOWER
Definition: ath5k.h:193
void * memset(void *dest, int character, size_t len) __nonnull

References ah, AR5K_PHY_TXPOWER_RATE1, AR5K_PHY_TXPOWER_RATE2, AR5K_PHY_TXPOWER_RATE3, AR5K_PHY_TXPOWER_RATE4, AR5K_PHY_TXPOWER_RATE_MAX, AR5K_PHY_TXPOWER_RATE_MAX_TPC_ENABLE, AR5K_PWRTABLE_LINEAR_PCDAC, AR5K_PWRTABLE_PWR_TO_PCDAC, AR5K_PWRTABLE_PWR_TO_PDADC, AR5K_REG_MS, AR5K_RF2316, AR5K_RF2317, AR5K_RF2413, AR5K_RF2425, AR5K_RF5111, AR5K_RF5112, AR5K_RF5413, AR5K_TPC, AR5K_TPC_ACK, AR5K_TPC_CHIRP, AR5K_TPC_CTS, AR5K_TUNE_DEFAULT_TXPOWER, AR5K_TUNE_MAX_TXPOWER, AR5K_TUNE_TPC_TXPOWER, AR5K_TXPOWER_CCK, AR5K_TXPOWER_OFDM, ath5k_get_max_ctl_power(), ath5k_get_rate_pcal_data(), ath5k_hw_reg_write(), ath5k_setup_channel_powertable(), ath5k_setup_rate_powertable(), channel, DBG, EINVAL, memset(), and type.

Referenced by ath5k_hw_reset(), and ath5k_hw_set_txpower_limit().

◆ ath5k_hw_set_txpower_limit()

int ath5k_hw_set_txpower_limit ( struct ath5k_hw ah,
u8  ee_mode,
u8  txpower 
)

Definition at line 2573 of file ath5k_phy.c.

2574 {
2575  struct net80211_channel *channel = ah->ah_current_channel;
2576 
2577  DBG2("ath5k: changing txpower to %d\n", txpower);
2578 
2579  return ath5k_hw_txpower(ah, channel, mode, txpower);
2580 }
uint16_t mode
Acceleration mode.
Definition: ena.h:26
uint32_t channel
RNDIS channel.
Definition: netvsc.h:14
An 802.11 RF channel.
Definition: net80211.h:385
uint8_t ah
Definition: registers.h:85
int ath5k_hw_txpower(struct ath5k_hw *ah, struct net80211_channel *channel, u8 ee_mode, u8 txpower)
Definition: ath5k_phy.c:2475
#define DBG2(...)
Definition: compiler.h:515

References ah, ath5k_hw_txpower(), channel, DBG2, and mode.

◆ ath5k_hw_htoclock()

static unsigned int ath5k_hw_htoclock ( unsigned int  usec,
int  turbo 
)
inlinestatic

Definition at line 1199 of file ath5k.h.

1200 {
1201  return turbo ? (usec * 80) : (usec * 40);
1202 }

Referenced by ath5k_hw_set_ack_timeout(), ath5k_hw_set_cts_timeout(), ath5k_hw_set_slot_time(), and ath5k_hw_write_ofdm_timings().

◆ ath5k_hw_clocktoh()

static unsigned int ath5k_hw_clocktoh ( unsigned int  clock,
int  turbo 
)
inlinestatic

Definition at line 1208 of file ath5k.h.

1209 {
1210  return turbo ? (clock / 80) : (clock / 40);
1211 }

Referenced by ath5k_hw_get_ack_timeout(), ath5k_hw_get_cts_timeout(), ath5k_hw_set_ack_timeout(), and ath5k_hw_set_cts_timeout().

◆ ath5k_hw_reg_read()

static u32 ath5k_hw_reg_read ( struct ath5k_hw ah,
u16  reg 
)
inlinestatic

◆ ath5k_hw_reg_write()

static void ath5k_hw_reg_write ( struct ath5k_hw ah,
u32  val,
u16  reg 
)
inlinestatic

Definition at line 1224 of file ath5k.h.

1225 {
1226  writel(val, ah->ah_iobase + reg);
1227 }
static unsigned int unsigned int reg
Definition: myson.h:162
void __asmcall int val
Definition: setjmp.h:12
void writel(uint32_t data, volatile uint32_t *io_addr)
Write 32-bit dword to memory-mapped device.
uint8_t ah
Definition: registers.h:85

References ah, reg, val, and writel().

Referenced by ath5k_combine_pwr_to_pdadc_curves(), ath5k_hw_attach(), ath5k_hw_commit_eeprom_settings(), ath5k_hw_eeprom_read(), ath5k_hw_ini_mode_registers(), ath5k_hw_ini_registers(), ath5k_hw_nic_reset(), ath5k_hw_nic_wakeup(), ath5k_hw_phy_disable(), ath5k_hw_post(), ath5k_hw_radio_revision(), ath5k_hw_request_rfgain_probe(), ath5k_hw_reset(), ath5k_hw_reset_key(), ath5k_hw_reset_tx_queue(), ath5k_hw_rf2425_channel(), ath5k_hw_rf5110_calibrate(), ath5k_hw_rf5110_channel(), ath5k_hw_rf5111_channel(), ath5k_hw_rf5112_channel(), ath5k_hw_rfgain_init(), ath5k_hw_rfregs_init(), ath5k_hw_set_associd(), ath5k_hw_set_bssid_mask(), ath5k_hw_set_def_antenna(), ath5k_hw_set_gpio(), ath5k_hw_set_gpio_input(), ath5k_hw_set_gpio_intr(), ath5k_hw_set_gpio_output(), ath5k_hw_set_imr(), ath5k_hw_set_lladdr(), ath5k_hw_set_mcast_filter(), ath5k_hw_set_opmode(), ath5k_hw_set_rx_filter(), ath5k_hw_set_rxdp(), ath5k_hw_set_slot_time(), ath5k_hw_set_txdp(), ath5k_hw_start_rx_dma(), ath5k_hw_start_tx_dma(), ath5k_hw_stop_rx_dma(), ath5k_hw_stop_tx_dma(), ath5k_hw_tweak_initval_settings(), ath5k_hw_txpower(), ath5k_hw_update_tx_triglevel(), ath5k_hw_wake(), ath5k_hw_write_initvals(), ath5k_hw_write_rate_duration(), ath5k_irq(), ath5k_setup_pcdac_table(), and ath5k_setup_pwr_to_pdadc_table().

◆ ath5k_hw_bitswap()

static u32 ath5k_hw_bitswap ( u32  val,
unsigned int  bits 
)
inlinestatic

Definition at line 1267 of file ath5k.h.

1268 {
1269  u32 retval = 0, bit, i;
1270 
1271  for (i = 0; i < bits; i++) {
1272  bit = (val >> i) & 1;
1273  retval = (retval << 1) | bit;
1274  }
1275 
1276  return retval;
1277 }
void __asmcall int val
Definition: setjmp.h:12
static unsigned int unsigned int bit
Definition: bigint.h:392
unsigned long retval
Definition: xen.h:46
static volatile void * bits
Definition: bitops.h:28
uint32_t u32
Definition: stdint.h:24

References bit, bits, retval, and val.

Referenced by ath5k_hw_radio_revision(), ath5k_hw_rf2425_channel(), ath5k_hw_rf5110_chan2athchan(), ath5k_hw_rf5111_channel(), ath5k_hw_rf5112_channel(), ath5k_hw_rfb_op(), and ath5k_hw_rfregs_init().