iPXE
ath9k_hw.c File Reference
#include <ipxe/vsprintf.h>
#include <ipxe/io.h>
#include "hw.h"
#include "hw-ops.h"
#include "ar9003_mac.h"

Go to the source code of this file.

Macros

#define MS_REG_READ(x, y)

Functions

 FILE_SECBOOT (FORBIDDEN)
static int ath9k_hw_set_reset_reg (struct ath_hw *ah, u32 type)
static void ath9k_hw_init_cal_settings (struct ath_hw *ah)
static void ath9k_hw_init_mode_regs (struct ath_hw *ah)
static u32 ath9k_hw_compute_pll_control (struct ath_hw *ah, struct ath9k_channel *chan)
static void ath9k_hw_init_mode_gain_regs (struct ath_hw *ah)
static void ath9k_hw_ani_cache_ini_regs (struct ath_hw *ah)
static void ath9k_hw_set_clockrate (struct ath_hw *ah)
static u32 ath9k_hw_mac_to_clks (struct ath_hw *ah, u32 usecs)
int ath9k_hw_wait (struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout)
void ath9k_hw_write_array (struct ath_hw *ah, struct ar5416IniArray *array, int column, unsigned int *writecnt)
u32 ath9k_hw_reverse_bits (u32 val, u32 n)
u16 ath9k_hw_computetxtime (struct ath_hw *ah, u8 phy, int kbps, u32 frameLen, u16 rateix, int shortPreamble)
void ath9k_hw_get_channel_centers (struct ath_hw *ah __unused, struct ath9k_channel *chan, struct chan_centers *centers)
static void ath9k_hw_read_revisions (struct ath_hw *ah)
static void ath9k_hw_disablepcie (struct ath_hw *ah)
static int ath9k_hw_chip_test (struct ath_hw *ah)
static void ath9k_hw_init_config (struct ath_hw *ah)
static void ath9k_hw_init_defaults (struct ath_hw *ah)
static int ath9k_hw_init_macaddr (struct ath_hw *ah)
static int ath9k_hw_post_init (struct ath_hw *ah)
static void ath9k_hw_attach_ops (struct ath_hw *ah)
static int __ath9k_hw_init (struct ath_hw *ah)
int ath9k_hw_init (struct ath_hw *ah)
u32 ar9003_get_pll_sqsum_dvc (struct ath_hw *ah)
static void ath9k_hw_init_pll (struct ath_hw *ah, struct ath9k_channel *chan)
static void ath9k_hw_init_interrupt_masks (struct ath_hw *ah)
static void ath9k_hw_setslottime (struct ath_hw *ah, u32 us)
static void ath9k_hw_set_ack_timeout (struct ath_hw *ah, u32 us)
static void ath9k_hw_set_cts_timeout (struct ath_hw *ah, u32 us)
static int ath9k_hw_set_global_txtimeout (struct ath_hw *ah, u32 tu)
void ath9k_hw_init_global_settings (struct ath_hw *ah)
void ath9k_hw_deinit (struct ath_hw *ah)
u32 ath9k_regd_get_ctl (struct ath_regulatory *reg, struct ath9k_channel *chan)
static void ath9k_hw_set_dma (struct ath_hw *ah)
static void ath9k_hw_set_operating_mode (struct ath_hw *ah)
void ath9k_hw_get_delta_slope_vals (struct ath_hw *ah __unused, u32 coef_scaled, u32 *coef_mantissa, u32 *coef_exponent)
static int ath9k_hw_set_reset (struct ath_hw *ah, int type)
static int ath9k_hw_set_reset_power_on (struct ath_hw *ah)
static int ath9k_hw_chip_reset (struct ath_hw *ah, struct ath9k_channel *chan)
static int ath9k_hw_channel_change (struct ath_hw *ah, struct ath9k_channel *chan)
static void ath9k_hw_apply_gpio_override (struct ath_hw *ah)
int ath9k_hw_check_alive (struct ath_hw *ah)
int ath9k_hw_reset (struct ath_hw *ah, struct ath9k_channel *chan, struct ath9k_hw_cal_data *caldata, int bChannelChange)
static void ath9k_set_power_sleep (struct ath_hw *ah, int setChip)
static int ath9k_hw_set_power_awake (struct ath_hw *ah, int setChip)
int ath9k_hw_setpower (struct ath_hw *ah, enum ath9k_power_mode mode)
int ath9k_hw_fill_cap_info (struct ath_hw *ah)
static void ath9k_hw_gpio_cfg_output_mux (struct ath_hw *ah, u32 gpio, u32 type)
void ath9k_hw_cfg_gpio_input (struct ath_hw *ah, u32 gpio)
u32 ath9k_hw_gpio_get (struct ath_hw *ah, u32 gpio)
void ath9k_hw_cfg_output (struct ath_hw *ah, u32 gpio, u32 ah_signal_type)
void ath9k_hw_set_gpio (struct ath_hw *ah, u32 gpio, u32 val)
u32 ath9k_hw_getdefantenna (struct ath_hw *ah)
void ath9k_hw_setantenna (struct ath_hw *ah, u32 antenna)
u32 ath9k_hw_getrxfilter (struct ath_hw *ah)
void ath9k_hw_setrxfilter (struct ath_hw *ah, u32 bits)
int ath9k_hw_phy_disable (struct ath_hw *ah)
int ath9k_hw_disable (struct ath_hw *ah)
void ath9k_hw_set_txpowerlimit (struct ath_hw *ah, u32 limit, int test)
void ath9k_hw_setopmode (struct ath_hw *ah)
void ath9k_hw_setmcastfilter (struct ath_hw *ah, u32 filter0, u32 filter1)
void ath9k_hw_write_associd (struct ath_hw *ah)
void ath9k_hw_set11nmac2040 (struct ath_hw *ah)
static const char * ath9k_hw_mac_bb_name (u32 mac_bb_version)
static const char * ath9k_hw_rf_name (u16 rf_version)
void ath9k_hw_name (struct ath_hw *ah, char *hw_name, size_t len)

Variables

struct { 
   u32   version 
   const char *   name 
ath_mac_bb_names []
struct { 
   u16   version 
   const char *   name 
ath_rf_names []

Macro Definition Documentation

◆ MS_REG_READ

#define MS_REG_READ ( x,
y )
Value:
(MS(REG_READ(ah, AR_GPIO_IN_OUT), x##_GPIO_IN_VAL) & (AR_GPIO_BIT(y)))
#define AR_GPIO_IN_OUT
Definition reg.h:995
#define MS(_v, _f)
Definition hw.h:103
#define REG_READ(_ah, _reg)
Definition hw.h:81
#define AR_GPIO_BIT(_gpio)
Definition hw.h:132
static unsigned int unsigned int y
Definition pixbuf.h:63
static unsigned int x
Definition pixbuf.h:63
uint8_t ah
Definition registers.h:1

Referenced by ath9k_hw_gpio_get().

Function Documentation

◆ FILE_SECBOOT()

FILE_SECBOOT ( FORBIDDEN )

References ah, type, and u32.

◆ ath9k_hw_set_reset_reg()

int ath9k_hw_set_reset_reg ( struct ath_hw * ah,
u32 type )
static

Definition at line 1090 of file ath9k_hw.c.

1091{
1093 REG_WRITE(ah, AR_WA, ah->WARegVal);
1094 udelay(10);
1095 }
1096
1099
1100 switch (type) {
1103 case ATH9K_RESET_WARM:
1104 case ATH9K_RESET_COLD:
1105 return ath9k_hw_set_reset(ah, type);
1106 default:
1107 return 0;
1108 }
1109}
#define AR_RTC_FORCE_WAKE_ON_INT
Definition reg.h:1221
#define AR_RTC_FORCE_WAKE_EN
Definition reg.h:1220
#define AR_RTC_FORCE_WAKE
Definition reg.h:1218
#define AR_WA
Definition reg.h:699
#define AR_SREV_9300_20_OR_LATER(_ah)
Definition reg.h:865
static int ath9k_hw_set_reset_power_on(struct ath_hw *ah)
Definition ath9k_hw.c:1050
static int ath9k_hw_set_reset(struct ath_hw *ah, int type)
Definition ath9k_hw.c:983
uint32_t type
Operating system type.
Definition ena.h:1
@ ATH9K_RESET_POWER_ON
Definition hw.h:429
@ ATH9K_RESET_WARM
Definition hw.h:430
@ ATH9K_RESET_COLD
Definition hw.h:431
#define REG_WRITE(_ah, _reg, _val)
Definition hw.h:78
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition timer.c:61

References ah, AR_RTC_FORCE_WAKE, AR_RTC_FORCE_WAKE_EN, AR_RTC_FORCE_WAKE_ON_INT, AR_SREV_9300_20_OR_LATER, AR_WA, ath9k_hw_set_reset(), ath9k_hw_set_reset_power_on(), ATH9K_RESET_COLD, ATH9K_RESET_POWER_ON, ATH9K_RESET_WARM, REG_WRITE, type, u32, and udelay().

Referenced by __ath9k_hw_init(), ath9k_hw_chip_reset(), ath9k_hw_disable(), ath9k_hw_phy_disable(), and ath9k_hw_set_power_awake().

◆ ath9k_hw_init_cal_settings()

void ath9k_hw_init_cal_settings ( struct ath_hw * ah)
static

Definition at line 33 of file ath9k_hw.c.

34{
36}
static struct ath_hw_private_ops * ath9k_hw_private_ops(struct ath_hw *ah)
Definition hw.h:880
void(* init_cal_settings)(struct ath_hw *ah)
Definition hw.h:553

References ah, ath9k_hw_private_ops(), and ath_hw_private_ops::init_cal_settings.

Referenced by __ath9k_hw_init().

◆ ath9k_hw_init_mode_regs()

void ath9k_hw_init_mode_regs ( struct ath_hw * ah)
static

Definition at line 38 of file ath9k_hw.c.

39{
41}
void(* init_mode_regs)(struct ath_hw *ah)
Definition hw.h:556

References ah, ath9k_hw_private_ops(), and ath_hw_private_ops::init_mode_regs.

Referenced by __ath9k_hw_init().

◆ ath9k_hw_compute_pll_control()

u32 ath9k_hw_compute_pll_control ( struct ath_hw * ah,
struct ath9k_channel * chan )
static

Definition at line 43 of file ath9k_hw.c.

45{
47}
u32(* compute_pll_control)(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw.h:583

References ah, ath9k_hw_private_ops(), ath_hw_private_ops::compute_pll_control, and u32.

Referenced by ath9k_hw_init_pll().

◆ ath9k_hw_init_mode_gain_regs()

void ath9k_hw_init_mode_gain_regs ( struct ath_hw * ah)
static

Definition at line 49 of file ath9k_hw.c.

50{
51 if (!ath9k_hw_private_ops(ah)->init_mode_gain_regs)
52 return;
53
55}
void(* init_mode_gain_regs)(struct ath_hw *ah)
Definition hw.h:557

References ah, ath9k_hw_private_ops(), and ath_hw_private_ops::init_mode_gain_regs.

Referenced by __ath9k_hw_init().

◆ ath9k_hw_ani_cache_ini_regs()

void ath9k_hw_ani_cache_ini_regs ( struct ath_hw * ah)
static

Definition at line 57 of file ath9k_hw.c.

58{
59 /* You will not have this callback if using the old ANI */
60 if (!ath9k_hw_private_ops(ah)->ani_cache_ini_regs)
61 return;
62
64}
void(* ani_cache_ini_regs)(struct ath_hw *ah)
Definition hw.h:592

References ah, ath_hw_private_ops::ani_cache_ini_regs, and ath9k_hw_private_ops().

Referenced by ath9k_hw_reset().

◆ ath9k_hw_set_clockrate()

void ath9k_hw_set_clockrate ( struct ath_hw * ah)
static

Definition at line 70 of file ath9k_hw.c.

71{
73 struct net80211_device *dev = common->dev;
74 unsigned int clockrate;
75
76 if (!ah->curchan) /* should really check for CCK instead */
77 clockrate = ATH9K_CLOCK_RATE_CCK;
78 else if ((dev->channels + dev->channel)->band == NET80211_BAND_2GHZ)
80 else if (ah->caps.hw_caps & ATH9K_HW_CAP_FASTCLOCK)
82 else
84
85 common->clockrate = clockrate;
86}
#define NET80211_BAND_2GHZ
The 2.4 GHz ISM band, unlicensed in most countries.
Definition net80211.h:45
#define ATH9K_CLOCK_RATE_CCK
Definition hw.h:993
@ ATH9K_HW_CAP_FASTCLOCK
Definition hw.h:190
#define ATH9K_CLOCK_FAST_RATE_5GHZ_OFDM
Definition hw.h:996
#define ATH9K_CLOCK_RATE_2GHZ_OFDM
Definition hw.h:995
#define ATH9K_CLOCK_RATE_5GHZ_OFDM
Definition hw.h:994
static struct ath_common * ath9k_hw_common(struct ath_hw *ah)
Definition hw.h:870
struct ib_cm_common common
Definition ib_mad.h:0
Structure encapsulating the complete state of an 802.11 device.
Definition net80211.h:787
struct net80211_channel channels[NET80211_MAX_CHANNELS]
A list of all possible channels we might use.
Definition net80211.h:806
u8 channel
The channel currently in use, as an index into the channels array.
Definition net80211.h:812

References ah, ATH9K_CLOCK_FAST_RATE_5GHZ_OFDM, ATH9K_CLOCK_RATE_2GHZ_OFDM, ATH9K_CLOCK_RATE_5GHZ_OFDM, ATH9K_CLOCK_RATE_CCK, ATH9K_HW_CAP_FASTCLOCK, ath9k_hw_common(), net80211_device::channel, net80211_device::channels, common, and NET80211_BAND_2GHZ.

Referenced by ath9k_hw_channel_change(), and ath9k_hw_reset().

◆ ath9k_hw_mac_to_clks()

u32 ath9k_hw_mac_to_clks ( struct ath_hw * ah,
u32 usecs )
static

Definition at line 88 of file ath9k_hw.c.

89{
91
92 return usecs * common->clockrate;
93}

References ah, ath9k_hw_common(), common, and u32.

Referenced by ath9k_hw_set_ack_timeout(), ath9k_hw_set_cts_timeout(), and ath9k_hw_setslottime().

◆ ath9k_hw_wait()

int ath9k_hw_wait ( struct ath_hw * ah,
u32 reg,
u32 mask,
u32 val,
u32 timeout )

Definition at line 95 of file ath9k_hw.c.

96{
97 unsigned int i;
98
99 for (i = 0; i < (timeout / AH_TIME_QUANTUM); i++) {
100 if ((REG_READ(ah, reg) & mask) == val)
101 return 1;
102
104 }
105
106 DBG("ath9k: "
107 "timeout (%d us) on reg 0x%x: 0x%08x & 0x%08x != 0x%08x\n",
108 timeout, reg, REG_READ(ah, reg), mask, val);
109
110 return 0;
111}
void timeout(int)
#define DBG(...)
Print a debugging message.
Definition compiler.h:498
#define AH_TIME_QUANTUM
Definition hw.h:148
void __asmcall int val
Definition setjmp.h:12
static unsigned int unsigned int reg
Definition myson.h:162

References ah, AH_TIME_QUANTUM, DBG, reg, REG_READ, timeout(), u32, udelay(), and val.

Referenced by ar5008_hw_rfbus_req(), ar9002_hw_init_cal(), ar9003_hw_init_cal(), ar9003_hw_rfbus_req(), ar9003_hw_tx_iq_cal_run(), ar9285_hw_cl_cal(), ar9300_otp_read_word(), ath9k_hw_set_reset(), ath9k_hw_set_reset_power_on(), ath9k_hw_setrxabort(), and ath_pci_eeprom_read().

◆ ath9k_hw_write_array()

void ath9k_hw_write_array ( struct ath_hw * ah,
struct ar5416IniArray * array,
int column,
unsigned int * writecnt )

Definition at line 113 of file ath9k_hw.c.

115{
116 unsigned int r;
117
119 for (r = 0; r < array->ia_rows; r++) {
120 REG_WRITE(ah, INI_RA(array, r, 0),
121 INI_RA(array, r, column));
122 DO_DELAY(*writecnt);
123 }
125}
#define INI_RA(iniarray, row, column)
Definition calib.h:46
uint32_t array
Array number.
Definition edd.h:1
#define REGWRITE_BUFFER_FLUSH(_ah)
Definition hw.h:96
#define ENABLE_REGWRITE_BUFFER(_ah)
Definition hw.h:90
#define DO_DELAY(x)
Definition hw.h:113
static const uint8_t r[3][4]
MD4 shift amounts.
Definition md4.c:54

References ah, array, DO_DELAY, ENABLE_REGWRITE_BUFFER, INI_RA, r, REG_WRITE, and REGWRITE_BUFFER_FLUSH.

◆ ath9k_hw_reverse_bits()

u32 ath9k_hw_reverse_bits ( u32 val,
u32 n )

Definition at line 127 of file ath9k_hw.c.

128{
129 u32 retval;
130 unsigned int i;
131
132 for (i = 0, retval = 0; i < n; i++) {
133 retval = (retval << 1) | (val & 1);
134 val >>= 1;
135 }
136 return retval;
137}
unsigned long retval
Definition xen.h:46
#define u32
Definition vga.h:21

References retval, u32, and val.

Referenced by ar5008_hw_force_bias(), ar5008_hw_phy_modify_rx_buffer(), ar5008_hw_set_channel(), and ar9002_hw_get_radiorev().

◆ ath9k_hw_computetxtime()

u16 ath9k_hw_computetxtime ( struct ath_hw * ah,
u8 phy,
int kbps,
u32 frameLen,
u16 rateix,
int shortPreamble )

Definition at line 139 of file ath9k_hw.c.

143{
144 u32 bitsPerSymbol, numBits, numSymbols, phyTime, txTime;
145
146 if (kbps == 0)
147 return 0;
148
149 switch (phy) {
150 case CHANNEL_CCK:
152 if (shortPreamble)
153 phyTime >>= 1;
154 numBits = frameLen << 3;
155 txTime = CCK_SIFS_TIME + phyTime + ((numBits * 1000) / kbps);
156 break;
157 case CHANNEL_OFDM:
158 if (ah->curchan && IS_CHAN_QUARTER_RATE(ah->curchan)) {
159 bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME_QUARTER) / 1000;
160 numBits = OFDM_PLCP_BITS + (frameLen << 3);
161 numSymbols = DIV_ROUND_UP(numBits, bitsPerSymbol);
164 + (numSymbols * OFDM_SYMBOL_TIME_QUARTER);
165 } else if (ah->curchan &&
166 IS_CHAN_HALF_RATE(ah->curchan)) {
167 bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME_HALF) / 1000;
168 numBits = OFDM_PLCP_BITS + (frameLen << 3);
169 numSymbols = DIV_ROUND_UP(numBits, bitsPerSymbol);
170 txTime = OFDM_SIFS_TIME_HALF +
172 + (numSymbols * OFDM_SYMBOL_TIME_HALF);
173 } else {
174 bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME) / 1000;
175 numBits = OFDM_PLCP_BITS + (frameLen << 3);
176 numSymbols = DIV_ROUND_UP(numBits, bitsPerSymbol);
178 + (numSymbols * OFDM_SYMBOL_TIME);
179 }
180 break;
181 default:
182 DBG("ath9k: "
183 "Unknown phy %d (rate ix %d)\n", phy, rateix);
184 txTime = 0;
185 break;
186 }
187
188 return txTime;
189}
#define CHANNEL_CCK
Definition ath5k.h:632
#define CHANNEL_OFDM
Definition ath5k.h:633
#define OFDM_PLCP_BITS
Definition ath9k_xmit.c:28
#define DIV_ROUND_UP(n, d)
Definition ath.h:31
#define IS_CHAN_QUARTER_RATE(_c)
Definition hw.h:364
#define IS_CHAN_HALF_RATE(_c)
Definition hw.h:363
#define OFDM_SIFS_TIME_QUARTER
Definition mac.h:66
#define CCK_SIFS_TIME
Definition mac.h:52
#define CCK_PREAMBLE_BITS
Definition mac.h:53
#define OFDM_SYMBOL_TIME_HALF
Definition mac.h:64
#define OFDM_SIFS_TIME
Definition mac.h:56
#define OFDM_PREAMBLE_TIME_HALF
Definition mac.h:62
#define OFDM_SYMBOL_TIME_QUARTER
Definition mac.h:69
#define OFDM_SIFS_TIME_HALF
Definition mac.h:61
#define OFDM_SYMBOL_TIME
Definition mac.h:59
#define CCK_PLCP_BITS
Definition mac.h:54
#define OFDM_PREAMBLE_TIME
Definition mac.h:57
#define OFDM_PREAMBLE_TIME_QUARTER
Definition mac.h:67

References ah, CCK_PLCP_BITS, CCK_PREAMBLE_BITS, CCK_SIFS_TIME, CHANNEL_CCK, CHANNEL_OFDM, DBG, DIV_ROUND_UP, IS_CHAN_HALF_RATE, IS_CHAN_QUARTER_RATE, OFDM_PLCP_BITS, OFDM_PREAMBLE_TIME, OFDM_PREAMBLE_TIME_HALF, OFDM_PREAMBLE_TIME_QUARTER, OFDM_SIFS_TIME, OFDM_SIFS_TIME_HALF, OFDM_SIFS_TIME_QUARTER, OFDM_SYMBOL_TIME, OFDM_SYMBOL_TIME_HALF, OFDM_SYMBOL_TIME_QUARTER, u16, u32, and u8.

Referenced by ath_buf_set_rate().

◆ ath9k_hw_get_channel_centers()

void ath9k_hw_get_channel_centers ( struct ath_hw *ah __unused,
struct ath9k_channel * chan,
struct chan_centers * centers )

Definition at line 191 of file ath9k_hw.c.

194{
195 int8_t extoff;
196
197 if (!IS_CHAN_HT40(chan)) {
198 centers->ctl_center = centers->ext_center =
199 centers->synth_center = chan->channel;
200 return;
201 }
202
203 if ((chan->chanmode == CHANNEL_A_HT40PLUS) ||
204 (chan->chanmode == CHANNEL_G_HT40PLUS)) {
205 centers->synth_center =
207 extoff = 1;
208 } else {
209 centers->synth_center =
211 extoff = -1;
212 }
213
214 centers->ctl_center =
215 centers->synth_center - (extoff * HT40_CHANNEL_CENTER_SHIFT);
216 /* 25 MHz spacing is supported by hw but not on upper layers */
217 centers->ext_center =
218 centers->synth_center + (extoff * HT40_CHANNEL_CENTER_SHIFT);
219}
signed char int8_t
Definition stdint.h:15
#define HT40_CHANNEL_CENTER_SHIFT
Definition hw.h:137
#define IS_CHAN_HT40(_c)
Definition hw.h:373
#define CHANNEL_G_HT40PLUS
Definition hw.h:320
#define CHANNEL_A_HT40PLUS
Definition hw.h:322
u16 channel
Definition hw.h:350
u32 chanmode
Definition hw.h:352
u16 ext_center
Definition hw.h:425
u16 ctl_center
Definition hw.h:424
u16 synth_center
Definition hw.h:423

References __unused, ah, ath9k_channel::chanmode, ath9k_channel::channel, CHANNEL_A_HT40PLUS, CHANNEL_G_HT40PLUS, chan_centers::ctl_center, chan_centers::ext_center, HT40_CHANNEL_CENTER_SHIFT, IS_CHAN_HT40, and chan_centers::synth_center.

Referenced by ar5008_hw_set_channel(), ar5008_hw_set_delta_slope(), ar9002_hw_set_channel(), ar9002_hw_spur_mitigate(), ar9003_hw_set_channel(), ar9003_hw_set_delta_slope(), ar9003_hw_set_power_per_rate_table(), ar9287_eeprom_get_tx_gain_index(), ath9k_get_txgain_index(), ath9k_hw_def_set_addac(), ath9k_hw_get_gain_boundaries_pdadcs(), ath9k_hw_get_legacy_target_powers(), ath9k_hw_get_target_powers(), ath9k_hw_set_4k_power_per_rate_table(), ath9k_hw_set_ar9287_power_per_rate_table(), and ath9k_hw_set_def_power_per_rate_table().

◆ ath9k_hw_read_revisions()

void ath9k_hw_read_revisions ( struct ath_hw * ah)
static

Definition at line 225 of file ath9k_hw.c.

226{
227 u32 val;
228
229 switch (ah->hw_version.devid) {
231 ah->hw_version.macVersion = AR_SREV_VERSION_9100;
232 break;
234 ah->hw_version.macVersion = AR_SREV_VERSION_9340;
236 ah->hw_version.macRev = MS(val, AR_SREV_REVISION2);
237 return;
238 }
239
241
242 if (val == 0xFF) {
244 ah->hw_version.macVersion =
246 ah->hw_version.macRev = MS(val, AR_SREV_REVISION2);
247 ah->is_pciexpress = (val & AR_SREV_TYPE2_HOST_MODE) ? 0 : 1;
248 } else {
249 if (!AR_SREV_9100(ah))
250 ah->hw_version.macVersion = MS(val, AR_SREV_VERSION);
251
252 ah->hw_version.macRev = val & AR_SREV_REVISION;
253
254 if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCIE)
255 ah->is_pciexpress = 1;
256 }
257}
#define AR_SREV_VERSION_5416_PCIE
Definition reg.h:768
#define AR_SREV_VERSION
Definition reg.h:753
#define AR_SREV
Definition reg.h:747
#define AR_SREV_ID
Definition reg.h:751
#define AR_SREV_VERSION_9100
Definition reg.h:772
#define AR_SREV_9100(ah)
Definition reg.h:811
#define AR_SREV_TYPE2_HOST_MODE
Definition reg.h:763
#define AR_SREV_REVISION
Definition reg.h:755
#define AR_SREV_VERSION2
Definition reg.h:758
#define AR_SREV_VERSION_9340
Definition reg.h:797
#define AR_SREV_TYPE2_S
Definition reg.h:761
#define AR_SREV_REVISION2
Definition reg.h:764
#define AR9300_DEVID_AR9340
Definition hw.h:53
#define AR5416_AR9100_DEVID
Definition hw.h:56

References ah, AR5416_AR9100_DEVID, AR9300_DEVID_AR9340, AR_SREV, AR_SREV_9100, AR_SREV_ID, AR_SREV_REVISION, AR_SREV_REVISION2, AR_SREV_TYPE2_HOST_MODE, AR_SREV_TYPE2_S, AR_SREV_VERSION, AR_SREV_VERSION2, AR_SREV_VERSION_5416_PCIE, AR_SREV_VERSION_9100, AR_SREV_VERSION_9340, MS, REG_READ, u32, and val.

Referenced by __ath9k_hw_init().

◆ ath9k_hw_disablepcie()

void ath9k_hw_disablepcie ( struct ath_hw * ah)
static

Definition at line 263 of file ath9k_hw.c.

264{
265 if (!AR_SREV_5416(ah))
266 return;
267
268 REG_WRITE(ah, AR_PCIE_SERDES, 0x9248fc00);
269 REG_WRITE(ah, AR_PCIE_SERDES, 0x24924924);
270 REG_WRITE(ah, AR_PCIE_SERDES, 0x28000029);
271 REG_WRITE(ah, AR_PCIE_SERDES, 0x57160824);
272 REG_WRITE(ah, AR_PCIE_SERDES, 0x25980579);
273 REG_WRITE(ah, AR_PCIE_SERDES, 0x00000000);
274 REG_WRITE(ah, AR_PCIE_SERDES, 0x1aaabe40);
275 REG_WRITE(ah, AR_PCIE_SERDES, 0xbe105554);
276 REG_WRITE(ah, AR_PCIE_SERDES, 0x000e1007);
277
278 REG_WRITE(ah, AR_PCIE_SERDES2, 0x00000000);
279}
#define AR_PCIE_SERDES2
Definition reg.h:983
#define AR_PCIE_SERDES
Definition reg.h:982
#define AR_SREV_5416(_ah)
Definition reg.h:799

References ah, AR_PCIE_SERDES, AR_PCIE_SERDES2, AR_SREV_5416, and REG_WRITE.

Referenced by __ath9k_hw_init().

◆ ath9k_hw_chip_test()

int ath9k_hw_chip_test ( struct ath_hw * ah)
static

Definition at line 282 of file ath9k_hw.c.

283{
284 u32 regAddr[2] = { AR_STA_ID0 };
285 u32 regHold[2];
286 static const u32 patternData[4] = {
287 0x55555555, 0xaaaaaaaa, 0x66666666, 0x99999999
288 };
289 int i, j, loop_max;
290
292 loop_max = 2;
293 regAddr[1] = AR_PHY_BASE + (8 << 2);
294 } else
295 loop_max = 1;
296
297 for (i = 0; i < loop_max; i++) {
298 u32 addr = regAddr[i];
299 u32 wrData, rdData;
300
301 regHold[i] = REG_READ(ah, addr);
302 for (j = 0; j < 0x100; j++) {
303 wrData = (j << 16) | j;
304 REG_WRITE(ah, addr, wrData);
305 rdData = REG_READ(ah, addr);
306 if (rdData != wrData) {
307 DBG("ath9k: "
308 "address test failed addr: 0x%08x - wr:0x%08x != rd:0x%08x\n",
309 addr, wrData, rdData);
310 return 0;
311 }
312 }
313 for (j = 0; j < 4; j++) {
314 wrData = patternData[j];
315 REG_WRITE(ah, addr, wrData);
316 rdData = REG_READ(ah, addr);
317 if (wrData != rdData) {
318 DBG("ath9k: "
319 "address test failed addr: 0x%08x - wr:0x%08x != rd:0x%08x\n",
320 addr, wrData, rdData);
321 return 0;
322 }
323 }
324 REG_WRITE(ah, regAddr[i], regHold[i]);
325 }
326 udelay(100);
327
328 return 1;
329}
#define AR_STA_ID0
Definition reg.h:1432
uint32_t addr
Buffer address.
Definition dwmac.h:9
#define AR_PHY_BASE
Definition phy.h:27

References addr, ah, AR_PHY_BASE, AR_SREV_9300_20_OR_LATER, AR_STA_ID0, DBG, REG_READ, REG_WRITE, u32, and udelay().

Referenced by ath9k_hw_post_init().

◆ ath9k_hw_init_config()

void ath9k_hw_init_config ( struct ath_hw * ah)
static

Definition at line 331 of file ath9k_hw.c.

332{
333 int i;
334
335 ah->config.dma_beacon_response_time = 2;
336 ah->config.sw_beacon_response_time = 10;
337 ah->config.additional_swba_backoff = 0;
338 ah->config.ack_6mb = 0x0;
339 ah->config.cwm_ignore_extcca = 0;
340 ah->config.pcie_powersave_enable = 0;
341 ah->config.pcie_clock_req = 0;
342 ah->config.pcie_waen = 0;
343 ah->config.analog_shiftreg = 1;
344 ah->config.enable_ani = 1;
345
346 for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
347 ah->config.spurchans[i][0] = AR_NO_SPUR;
348 ah->config.spurchans[i][1] = AR_NO_SPUR;
349 }
350
351 /* PAPRD needs some more work to be enabled */
352 ah->config.paprd_disable = 1;
353
354 ah->config.rx_intr_mitigation = 1;
355 ah->config.pcieSerDesWrite = 1;
356}
#define AR_EEPROM_MODAL_SPURS
Definition eeprom.h:26
#define AR_NO_SPUR
Definition hw.h:241

References ah, AR_EEPROM_MODAL_SPURS, and AR_NO_SPUR.

Referenced by __ath9k_hw_init().

◆ ath9k_hw_init_defaults()

void ath9k_hw_init_defaults ( struct ath_hw * ah)
static

Definition at line 358 of file ath9k_hw.c.

359{
360 struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
361
362 regulatory->country_code = CTRY_DEFAULT;
363 regulatory->power_limit = MAX_RATE_POWER;
364 regulatory->tp_scale = ATH9K_TP_SCALE_MAX;
365
366 ah->hw_version.magic = AR5416_MAGIC;
367 ah->hw_version.subvendorid = 0;
368
369 ah->atim_window = 0;
370 ah->sta_id1_defaults =
373 if (AR_SREV_9100(ah))
374 ah->sta_id1_defaults |= AR_STA_ID1_AR9100_BA_FIX;
375 ah->enable_32kHz_clock = DONT_USE_32KHZ;
376 ah->slottime = 20;
377 ah->globaltxtimeout = (u32) -1;
378 ah->power_mode = ATH9K_PM_UNDEFINED;
379}
#define CTRY_DEFAULT
Definition eeprom.h:38
#define AR_STA_ID1_MCAST_KSRCH
Definition reg.h:1451
#define AR_STA_ID1_CRPT_MIC_ENABLE
Definition reg.h:1447
#define AR_STA_ID1_AR9100_BA_FIX
Definition reg.h:1442
static struct ath_regulatory * ath9k_hw_regulatory(struct ath_hw *ah)
Definition hw.h:875
@ ATH9K_TP_SCALE_MAX
Definition hw.h:387
#define AR5416_MAGIC
Definition hw.h:60
#define MAX_RATE_POWER
Definition hw.h:145
@ ATH9K_PM_UNDEFINED
Definition hw.h:383
u16 country_code
Definition ath.h:140
u32 tp_scale
Definition ath.h:142
int16_t power_limit
Definition ath.h:145

References ah, AR5416_MAGIC, AR_SREV_9100, AR_STA_ID1_AR9100_BA_FIX, AR_STA_ID1_CRPT_MIC_ENABLE, AR_STA_ID1_MCAST_KSRCH, ath9k_hw_regulatory(), ATH9K_PM_UNDEFINED, ATH9K_TP_SCALE_MAX, ath_regulatory::country_code, CTRY_DEFAULT, MAX_RATE_POWER, ath_regulatory::power_limit, ath_regulatory::tp_scale, and u32.

Referenced by __ath9k_hw_init().

◆ ath9k_hw_init_macaddr()

int ath9k_hw_init_macaddr ( struct ath_hw * ah)
static

Definition at line 381 of file ath9k_hw.c.

382{
384 u32 sum;
385 int i;
386 u16 eeval;
387 static const u32 EEP_MAC[] = { EEP_MAC_LSW, EEP_MAC_MID, EEP_MAC_MSW };
388
389 sum = 0;
390 for (i = 0; i < 3; i++) {
391 eeval = ah->eep_ops->get_eeprom(ah, EEP_MAC[i]);
392 sum += eeval;
393 common->macaddr[2 * i] = eeval >> 8;
394 common->macaddr[2 * i + 1] = eeval & 0xff;
395 }
396 if (sum == 0 || sum == 0xffff * 3)
397 return -EADDRNOTAVAIL;
398
399 return 0;
400}
@ EEP_MAC_MSW
Definition eeprom.h:229
@ EEP_MAC_LSW
Definition eeprom.h:231
@ EEP_MAC_MID
Definition eeprom.h:230
#define EADDRNOTAVAIL
Address not available.
Definition errno.h:309
#define u16
Definition vga.h:20

References ah, ath9k_hw_common(), common, EADDRNOTAVAIL, EEP_MAC_LSW, EEP_MAC_MID, EEP_MAC_MSW, u16, and u32.

Referenced by __ath9k_hw_init().

◆ ath9k_hw_post_init()

int ath9k_hw_post_init ( struct ath_hw * ah)
static

Definition at line 402 of file ath9k_hw.c.

403{
405 int ecode;
406
407 if (common->bus_ops->ath_bus_type != ATH_USB) {
409 return -ENODEV;
410 }
411
413 ecode = ar9002_hw_rf_claim(ah);
414 if (ecode != 0)
415 return ecode;
416 }
417
418 ecode = ath9k_hw_eeprom_init(ah);
419 if (ecode != 0)
420 return ecode;
421
422 DBG("ath9k: "
423 "Eeprom VER: %d, REV: %d\n",
424 ah->eep_ops->get_eeprom_ver(ah),
425 ah->eep_ops->get_eeprom_rev(ah));
426
428 if (ecode) {
429 DBG("ath9k: "
430 "Failed allocating banks for external radio\n");
432 return ecode;
433 }
434
435 if (!AR_SREV_9100(ah) && !AR_SREV_9340(ah)) {
438 }
439
440 return 0;
441}
void ath9k_hw_ani_setup(struct ath_hw *ah)
Definition ath9k_ani.c:649
void ath9k_hw_ani_init(struct ath_hw *ah)
Definition ath9k_ani.c:666
#define AR_SREV_9340(_ah)
Definition reg.h:879
int ar9002_hw_rf_claim(struct ath_hw *ah)
int ath9k_hw_eeprom_init(struct ath_hw *ah)
static int ath9k_hw_chip_test(struct ath_hw *ah)
Definition ath9k_hw.c:282
@ ATH_USB
Definition ath.h:129
#define ENODEV
No such device.
Definition errno.h:510
static int ath9k_hw_rf_alloc_ext_banks(struct ath_hw *ah)
Definition hw-ops.h:155
static void ath9k_hw_rf_free_ext_banks(struct ath_hw *ah)
Definition hw-ops.h:163

References ah, ar9002_hw_rf_claim(), AR_SREV_9100, AR_SREV_9300_20_OR_LATER, AR_SREV_9340, ath9k_hw_ani_init(), ath9k_hw_ani_setup(), ath9k_hw_chip_test(), ath9k_hw_common(), ath9k_hw_eeprom_init(), ath9k_hw_rf_alloc_ext_banks(), ath9k_hw_rf_free_ext_banks(), ATH_USB, common, DBG, and ENODEV.

Referenced by __ath9k_hw_init().

◆ ath9k_hw_attach_ops()

void ath9k_hw_attach_ops ( struct ath_hw * ah)
static

Definition at line 443 of file ath9k_hw.c.

444{
447 else
449}
void ar9002_hw_attach_ops(struct ath_hw *ah)
void ar9003_hw_attach_ops(struct ath_hw *ah)

References ah, ar9002_hw_attach_ops(), ar9003_hw_attach_ops(), and AR_SREV_9300_20_OR_LATER.

Referenced by __ath9k_hw_init().

◆ __ath9k_hw_init()

int __ath9k_hw_init ( struct ath_hw * ah)
static

Definition at line 452 of file ath9k_hw.c.

453{
455 int r = 0;
456
458
459 /*
460 * Read back AR_WA into a permanent copy and set bits 14 and 17.
461 * We need to do this to avoid RMW of this register. We cannot
462 * read the reg when chip is asleep.
463 */
464 ah->WARegVal = REG_READ(ah, AR_WA);
465 ah->WARegVal |= (AR_WA_D3_L1_DISABLE |
467
469 DBG("ath9k: Couldn't reset chip\n");
470 return -EIO;
471 }
472
475
477
479 DBG("ath9k: Couldn't wakeup chip\n");
480 return -EIO;
481 }
482
483 if (ah->config.serialize_regmode == SER_REG_MODE_AUTO) {
484 if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI ||
485 ((AR_SREV_9160(ah) || AR_SREV_9280(ah)) &&
486 !ah->is_pciexpress)) {
487 ah->config.serialize_regmode =
489 } else {
490 ah->config.serialize_regmode =
492 }
493 }
494
495 DBG2("ath9k: serialize_regmode is %d\n",
496 ah->config.serialize_regmode);
497
499 ah->config.max_txtrig_level = MAX_TX_FIFO_THRESHOLD >> 1;
500 else
501 ah->config.max_txtrig_level = MAX_TX_FIFO_THRESHOLD;
502
503 switch (ah->hw_version.macVersion) {
515 break;
516 default:
517 DBG("ath9k: "
518 "Mac Chip Rev 0x%02x.%x is not supported by this driver\n",
519 ah->hw_version.macVersion, ah->hw_version.macRev);
520 return -EOPNOTSUPP;
521 }
522
524 ah->is_pciexpress = 0;
525
526 ah->hw_version.phyRev = REG_READ(ah, AR_PHY_CHIP_ID);
528
529 ah->ani_function = ATH9K_ANI_ALL;
531 ah->ani_function &= ~ATH9K_ANI_NOISE_IMMUNITY_LEVEL;
533 ah->ani_function &= ~ATH9K_ANI_MRC_CCK;
534
536
537
538 if (ah->is_pciexpress)
540 else
542
545
547 if (r)
548 return r;
549
552 if (r)
553 return r;
554
556 if (r) {
557 DBG("ath9k: Failed to initialize MAC address\n");
558 return r;
559 }
560
562 ah->tx_trig_level = (AR_FTRIG_256B >> AR_FTRIG_S);
563 else
564 ah->tx_trig_level = (AR_FTRIG_512B >> AR_FTRIG_S);
565
566 common->state = ATH_HW_INITIALIZED;
567
568 return 0;
569}
@ ATH9K_ANI_NOISE_IMMUNITY_LEVEL
Definition ani.h:83
@ ATH9K_ANI_ALL
Definition ani.h:91
@ ATH9K_ANI_MRC_CCK
Definition ani.h:90
#define AR_FTRIG_512B
Definition reg.h:97
#define AR_SREV_VERSION_9485
Definition reg.h:794
#define AR_SREV_VERSION_9280
Definition reg.h:776
#define AR_SREV_VERSION_9271
Definition reg.h:789
#define AR_SREV_9280(_ah)
Definition reg.h:823
#define AR_SREV_9285(_ah)
Definition reg.h:830
#define AR_WA_ASPM_TIMER_BASED_DISABLE
Definition reg.h:705
#define AR_SREV_9280_20_OR_LATER(_ah)
Definition reg.h:825
#define AR_SREV_VERSION_5416_PCI
Definition reg.h:767
#define AR_SREV_VERSION_9160
Definition reg.h:773
#define AR_SREV_VERSION_9287
Definition reg.h:784
#define AR_SREV_VERSION_9285
Definition reg.h:780
#define AR_FTRIG_S
Definition reg.h:91
#define AR_SREV_9160(_ah)
Definition reg.h:816
#define AR_FTRIG_256B
Definition reg.h:96
#define AR_SREV_9271(_ah)
Definition reg.h:854
#define AR_SREV_VERSION_9300
Definition reg.h:792
#define AR_WA_D3_L1_DISABLE
Definition reg.h:703
void ar9002_hw_cck_chan14_spread(struct ath_hw *ah)
int ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode)
Definition ath9k_hw.c:1534
static int ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type)
Definition ath9k_hw.c:1090
static int ath9k_hw_init_macaddr(struct ath_hw *ah)
Definition ath9k_hw.c:381
static void ath9k_hw_disablepcie(struct ath_hw *ah)
Definition ath9k_hw.c:263
static void ath9k_hw_init_config(struct ath_hw *ah)
Definition ath9k_hw.c:331
static void ath9k_hw_init_defaults(struct ath_hw *ah)
Definition ath9k_hw.c:358
static void ath9k_hw_read_revisions(struct ath_hw *ah)
Definition ath9k_hw.c:225
int ath9k_hw_fill_cap_info(struct ath_hw *ah)
Definition ath9k_hw.c:1571
static void ath9k_hw_init_mode_gain_regs(struct ath_hw *ah)
Definition ath9k_hw.c:49
static int ath9k_hw_post_init(struct ath_hw *ah)
Definition ath9k_hw.c:402
static void ath9k_hw_init_cal_settings(struct ath_hw *ah)
Definition ath9k_hw.c:33
static void ath9k_hw_attach_ops(struct ath_hw *ah)
Definition ath9k_hw.c:443
static void ath9k_hw_init_mode_regs(struct ath_hw *ah)
Definition ath9k_hw.c:38
@ ATH_HW_INITIALIZED
Definition ath.h:123
#define DBG2(...)
Definition compiler.h:515
#define EOPNOTSUPP
Operation not supported on socket.
Definition errno.h:605
#define EIO
Input/output error.
Definition errno.h:434
static void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore, int power_off)
Definition hw-ops.h:27
@ ATH9K_PM_AWAKE
Definition hw.h:380
@ SER_REG_MODE_OFF
Definition hw.h:395
@ SER_REG_MODE_AUTO
Definition hw.h:397
@ SER_REG_MODE_ON
Definition hw.h:396
#define MAX_TX_FIFO_THRESHOLD
Definition mac.h:109
#define AR_PHY_CHIP_ID
Definition phy.h:46

References ah, ar9002_hw_cck_chan14_spread(), AR_FTRIG_256B, AR_FTRIG_512B, AR_FTRIG_S, AR_PHY_CHIP_ID, AR_SREV_9100, AR_SREV_9160, AR_SREV_9271, AR_SREV_9280, AR_SREV_9280_20_OR_LATER, AR_SREV_9285, AR_SREV_9300_20_OR_LATER, AR_SREV_9340, AR_SREV_VERSION_5416_PCI, AR_SREV_VERSION_5416_PCIE, AR_SREV_VERSION_9100, AR_SREV_VERSION_9160, AR_SREV_VERSION_9271, AR_SREV_VERSION_9280, AR_SREV_VERSION_9285, AR_SREV_VERSION_9287, AR_SREV_VERSION_9300, AR_SREV_VERSION_9340, AR_SREV_VERSION_9485, AR_WA, AR_WA_ASPM_TIMER_BASED_DISABLE, AR_WA_D3_L1_DISABLE, ATH9K_ANI_ALL, ATH9K_ANI_MRC_CCK, ATH9K_ANI_NOISE_IMMUNITY_LEVEL, ath9k_hw_attach_ops(), ath9k_hw_common(), ath9k_hw_configpcipowersave(), ath9k_hw_disablepcie(), ath9k_hw_fill_cap_info(), ath9k_hw_init_cal_settings(), ath9k_hw_init_config(), ath9k_hw_init_defaults(), ath9k_hw_init_macaddr(), ath9k_hw_init_mode_gain_regs(), ath9k_hw_init_mode_regs(), ath9k_hw_post_init(), ath9k_hw_read_revisions(), ath9k_hw_set_reset_reg(), ath9k_hw_setpower(), ATH9K_PM_AWAKE, ATH9K_RESET_POWER_ON, ATH_HW_INITIALIZED, common, DBG, DBG2, EIO, EOPNOTSUPP, MAX_TX_FIFO_THRESHOLD, r, REG_READ, SER_REG_MODE_AUTO, SER_REG_MODE_OFF, and SER_REG_MODE_ON.

Referenced by ath9k_hw_init().

◆ ath9k_hw_init()

int ath9k_hw_init ( struct ath_hw * ah)

Definition at line 571 of file ath9k_hw.c.

572{
573 int ret;
575
576 /* These are all the AR5008/AR9001/AR9002 hardware family of chipsets */
577 switch (ah->hw_version.devid) {
578 case AR5416_DEVID_PCI:
581 case AR9160_DEVID_PCI:
582 case AR9280_DEVID_PCI:
585 case AR9287_DEVID_PCI:
591 break;
592 default:
593 if (common->bus_ops->ath_bus_type == ATH_USB)
594 break;
595 DBG("ath9k: Hardware device ID 0x%04x not supported\n",
596 ah->hw_version.devid);
597 return -EOPNOTSUPP;
598 }
599
600 ret = __ath9k_hw_init(ah);
601 if (ret) {
602 DBG("ath9k: "
603 "Unable to initialize hardware; initialization status: %d\n",
604 ret);
605 return ret;
606 }
607
608 return 0;
609}
static int __ath9k_hw_init(struct ath_hw *ah)
Definition ath9k_hw.c:452
#define AR9287_DEVID_PCI
Definition hw.h:50
#define AR5416_DEVID_PCIE
Definition hw.h:44
#define AR9285_DEVID_PCIE
Definition hw.h:48
#define AR9300_DEVID_PCIE
Definition hw.h:52
#define AR9280_DEVID_PCI
Definition hw.h:46
#define AR2427_DEVID_PCIE
Definition hw.h:49
#define AR9300_DEVID_AR9485_PCIE
Definition hw.h:54
#define AR5416_DEVID_PCI
Definition hw.h:43
#define AR9280_DEVID_PCIE
Definition hw.h:47
#define AR9160_DEVID_PCI
Definition hw.h:45
#define AR9287_DEVID_PCIE
Definition hw.h:51

References __ath9k_hw_init(), ah, AR2427_DEVID_PCIE, AR5416_AR9100_DEVID, AR5416_DEVID_PCI, AR5416_DEVID_PCIE, AR9160_DEVID_PCI, AR9280_DEVID_PCI, AR9280_DEVID_PCIE, AR9285_DEVID_PCIE, AR9287_DEVID_PCI, AR9287_DEVID_PCIE, AR9300_DEVID_AR9340, AR9300_DEVID_AR9485_PCIE, AR9300_DEVID_PCIE, ath9k_hw_common(), ATH_USB, common, DBG, and EOPNOTSUPP.

Referenced by ath9k_init_softc().

◆ ar9003_get_pll_sqsum_dvc()

u32 ar9003_get_pll_sqsum_dvc ( struct ath_hw * ah)

Definition at line 611 of file ath9k_hw.c.

612{
614 udelay(100);
616
617 while ((REG_READ(ah, PLL4) & PLL4_MEAS_DONE) == 0)
618 udelay(100);
619
620 return (REG_READ(ah, PLL3) & SQSUM_DVC_MASK) >> 3;
621}
#define PLL3
Definition reg.h:1190
#define SQSUM_DVC_MASK
Definition reg.h:1194
#define PLL4_MEAS_DONE
Definition reg.h:1193
#define PLL3_DO_MEAS_MASK
Definition reg.h:1191
#define PLL4
Definition reg.h:1192
#define REG_CLR_BIT(_a, _r, _f)
Definition hw.h:110
#define REG_SET_BIT(_a, _r, _f)
Definition hw.h:108

References ah, PLL3, PLL3_DO_MEAS_MASK, PLL4, PLL4_MEAS_DONE, REG_CLR_BIT, REG_READ, REG_SET_BIT, SQSUM_DVC_MASK, u32, and udelay().

Referenced by ath_hw_pll_work().

◆ ath9k_hw_init_pll()

void ath9k_hw_init_pll ( struct ath_hw * ah,
struct ath9k_channel * chan )
static

Definition at line 623 of file ath9k_hw.c.

625{
626 u32 pll;
627
628 if (AR_SREV_9485(ah)) {
629
630 /* program BB PLL ki and kd value, ki=0x4, kd=0x40 */
634 AR_CH0_DPLL2_KD, 0x40);
636 AR_CH0_DPLL2_KI, 0x4);
637
644
651
652 /* program BB PLL phase_shift to 0x6 */
655
658 udelay(1000);
659 } else if (AR_SREV_9340(ah)) {
660 u32 regval, pll2_divint, pll2_divfrac, refdiv;
661
663 udelay(1000);
664
665 REG_SET_BIT(ah, AR_PHY_PLL_MODE, 0x1 << 16);
666 udelay(100);
667
668 if (ah->is_clk_25mhz) {
669 pll2_divint = 0x54;
670 pll2_divfrac = 0x1eb85;
671 refdiv = 3;
672 } else {
673 pll2_divint = 88;
674 pll2_divfrac = 0;
675 refdiv = 5;
676 }
677
678 regval = REG_READ(ah, AR_PHY_PLL_MODE);
679 regval |= (0x1 << 16);
680 REG_WRITE(ah, AR_PHY_PLL_MODE, regval);
681 udelay(100);
682
683 REG_WRITE(ah, AR_PHY_PLL_CONTROL, (refdiv << 27) |
684 (pll2_divint << 18) | pll2_divfrac);
685 udelay(100);
686
687 regval = REG_READ(ah, AR_PHY_PLL_MODE);
688 regval = (regval & 0x80071fff) | (0x1 << 30) | (0x1 << 13) |
689 (0x4 << 26) | (0x18 << 19);
690 REG_WRITE(ah, AR_PHY_PLL_MODE, regval);
692 REG_READ(ah, AR_PHY_PLL_MODE) & 0xfffeffff);
693 udelay(1000);
694 }
695
696 pll = ath9k_hw_compute_pll_control(ah, chan);
697
699
701 udelay(1000);
702
703 /* Switch the core clock for ar9271 to 117Mhz */
704 if (AR_SREV_9271(ah)) {
705 udelay(500);
706 REG_WRITE(ah, 0x50040, 0x304);
707 }
708
710
712
713 if (AR_SREV_9340(ah)) {
714 if (ah->is_clk_25mhz) {
715 REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1);
716 REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7);
717 REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae);
718 } else {
719 REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1);
720 REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400);
721 REG_WRITE(ah, AR_SLP32_INC, 0x0001e800);
722 }
723 udelay(100);
724 }
725}
#define AR_CH0_BB_DPLL3_PHASE_SHIFT
Definition reg.h:1135
#define AR_CH0_DPLL2_KI
Definition reg.h:1123
#define AR_CH0_BB_DPLL2_PLL_PWD
Definition reg.h:1129
#define AR_RTC_FORCE_DERIVED_CLK
Definition reg.h:1215
#define AR_CH0_BB_DPLL1
Definition reg.h:1112
#define AR_CH0_BB_DPLL2_EN_NEGTRIG
Definition reg.h:1127
#define AR_CH0_BB_DPLL2
Definition reg.h:1120
#define AR_SREV_9485(_ah)
Definition reg.h:868
#define AR_CH0_BB_DPLL3
Definition reg.h:1134
#define AR_CH0_DPLL2_KD
Definition reg.h:1125
#define AR_RTC_DERIVED_CLK
Definition reg.h:1235
#define AR_SLP32_MODE
Definition reg.h:1796
#define AR_CH0_BB_DPLL2_OUTDIV
Definition reg.h:1131
#define AR_RTC_SLEEP_CLK
Definition reg.h:1213
#define AR_CH0_BB_DPLL1_NFRAC
Definition reg.h:1117
#define AR_CH0_BB_DPLL1_NINI
Definition reg.h:1115
#define AR_RTC_PLL_CONTROL
Definition reg.h:1177
#define AR_CH0_BB_DPLL2_LOCAL_PLL
Definition reg.h:1121
#define AR_SLP32_INC
Definition reg.h:1804
#define AR_CH0_BB_DPLL1_REFDIV
Definition reg.h:1113
static u32 ath9k_hw_compute_pll_control(struct ath_hw *ah, struct ath9k_channel *chan)
Definition ath9k_hw.c:43
#define REG_RMW_FIELD(_a, _r, _f, _v)
Definition hw.h:104
#define RTC_PLL_SETTLE_DELAY
Definition hw.h:135
#define AR_PHY_PLL_MODE
Definition phy.h:52
#define AR_PHY_PLL_CONTROL
Definition phy.h:51

References ah, AR_CH0_BB_DPLL1, AR_CH0_BB_DPLL1_NFRAC, AR_CH0_BB_DPLL1_NINI, AR_CH0_BB_DPLL1_REFDIV, AR_CH0_BB_DPLL2, AR_CH0_BB_DPLL2_EN_NEGTRIG, AR_CH0_BB_DPLL2_LOCAL_PLL, AR_CH0_BB_DPLL2_OUTDIV, AR_CH0_BB_DPLL2_PLL_PWD, AR_CH0_BB_DPLL3, AR_CH0_BB_DPLL3_PHASE_SHIFT, AR_CH0_DPLL2_KD, AR_CH0_DPLL2_KI, AR_PHY_PLL_CONTROL, AR_PHY_PLL_MODE, AR_RTC_DERIVED_CLK, AR_RTC_FORCE_DERIVED_CLK, AR_RTC_PLL_CONTROL, AR_RTC_SLEEP_CLK, AR_SLP32_INC, AR_SLP32_MODE, AR_SREV_9271, AR_SREV_9340, AR_SREV_9485, ath9k_hw_compute_pll_control(), REG_READ, REG_RMW_FIELD, REG_SET_BIT, REG_WRITE, RTC_PLL_SETTLE_DELAY, u32, and udelay().

Referenced by ath9k_hw_chip_reset(), ath9k_hw_disable(), ath9k_hw_phy_disable(), and ath9k_hw_set_power_awake().

◆ ath9k_hw_init_interrupt_masks()

void ath9k_hw_init_interrupt_masks ( struct ath_hw * ah)
static

Definition at line 727 of file ath9k_hw.c.

728{
729 u32 sync_default = AR_INTR_SYNC_DEFAULT;
730 u32 imr_reg = AR_IMR_TXERR |
734
735 if (AR_SREV_9340(ah))
736 sync_default &= ~AR_INTR_SYNC_HOST1_FATAL;
737
739 imr_reg |= AR_IMR_RXOK_HP;
740 if (ah->config.rx_intr_mitigation)
741 imr_reg |= AR_IMR_RXINTM | AR_IMR_RXMINTR;
742 else
743 imr_reg |= AR_IMR_RXOK_LP;
744
745 } else {
746 if (ah->config.rx_intr_mitigation)
747 imr_reg |= AR_IMR_RXINTM | AR_IMR_RXMINTR;
748 else
749 imr_reg |= AR_IMR_RXOK;
750 }
751
752 if (ah->config.tx_intr_mitigation)
753 imr_reg |= AR_IMR_TXINTM | AR_IMR_TXMINTR;
754 else
755 imr_reg |= AR_IMR_TXOK;
756
758
759 REG_WRITE(ah, AR_IMR, imr_reg);
760// ah->imrs2_reg |= AR_IMR_S2_GTT;
761 REG_WRITE(ah, AR_IMR_S2, ah->imrs2_reg);
762
763 if (!AR_SREV_9100(ah)) {
764 REG_WRITE(ah, AR_INTR_SYNC_CAUSE, 0xFFFFFFFF);
765 REG_WRITE(ah, AR_INTR_SYNC_ENABLE, sync_default);
767 }
768
770
776 }
777}
#define AR_IMR_TXERR
Definition reg.h:270
#define AR_IMR_RXERR
Definition reg.h:264
#define AR_IMR_RXOK_HP
Definition reg.h:262
#define AR_INTR_PRIO_ASYNC_MASK
Definition reg.h:1105
#define AR_INTR_PRIO_SYNC_MASK
Definition reg.h:1106
#define AR_INTR_PRIO_ASYNC_ENABLE
Definition reg.h:1107
#define AR_IMR_S2
Definition reg.h:307
#define AR_IMR_TXMINTR
Definition reg.h:290
#define AR_INTR_PRIO_SYNC_ENABLE
Definition reg.h:1104
#define AR_IMR_TXURN
Definition reg.h:273
#define AR_IMR_RXOK_LP
Definition reg.h:263
#define AR_IMR
Definition reg.h:259
#define AR_INTR_SYNC_MASK
Definition reg.h:971
#define AR_IMR_RXORN
Definition reg.h:267
#define AR_INTR_SYNC_CAUSE
Definition reg.h:923
#define AR_IMR_TXINTM
Definition reg.h:292
#define AR_IMR_TXOK
Definition reg.h:268
@ AR_INTR_SYNC_HOST1_FATAL
Definition reg.h:937
@ AR_INTR_SYNC_DEFAULT
Definition reg.h:953
#define AR_INTR_SYNC_ENABLE
Definition reg.h:927
#define AR_IMR_RXINTM
Definition reg.h:293
#define AR_IMR_RXMINTR
Definition reg.h:291
#define AR_IMR_RXOK
Definition reg.h:260

References ah, AR_IMR, AR_IMR_RXERR, AR_IMR_RXINTM, AR_IMR_RXMINTR, AR_IMR_RXOK, AR_IMR_RXOK_HP, AR_IMR_RXOK_LP, AR_IMR_RXORN, AR_IMR_S2, AR_IMR_TXERR, AR_IMR_TXINTM, AR_IMR_TXMINTR, AR_IMR_TXOK, AR_IMR_TXURN, AR_INTR_PRIO_ASYNC_ENABLE, AR_INTR_PRIO_ASYNC_MASK, AR_INTR_PRIO_SYNC_ENABLE, AR_INTR_PRIO_SYNC_MASK, AR_INTR_SYNC_CAUSE, AR_INTR_SYNC_DEFAULT, AR_INTR_SYNC_ENABLE, AR_INTR_SYNC_HOST1_FATAL, AR_INTR_SYNC_MASK, AR_SREV_9100, AR_SREV_9300_20_OR_LATER, AR_SREV_9340, ENABLE_REGWRITE_BUFFER, REG_WRITE, REGWRITE_BUFFER_FLUSH, and u32.

Referenced by ath9k_hw_reset().

◆ ath9k_hw_setslottime()

void ath9k_hw_setslottime ( struct ath_hw * ah,
u32 us )
static

Definition at line 779 of file ath9k_hw.c.

780{
782 val = min(val, (u32) 0xFFFF);
784}
#define AR_D_GBL_IFS_SLOT
Definition reg.h:619
static u32 ath9k_hw_mac_to_clks(struct ath_hw *ah, u32 usecs)
Definition ath9k_hw.c:88
#define min(x, y)
Definition ath.h:36

References ah, AR_D_GBL_IFS_SLOT, ath9k_hw_mac_to_clks(), min, REG_WRITE, u32, and val.

Referenced by ath9k_hw_init_global_settings().

◆ ath9k_hw_set_ack_timeout()

void ath9k_hw_set_ack_timeout ( struct ath_hw * ah,
u32 us )
static

Definition at line 786 of file ath9k_hw.c.

787{
789 val = min(val, (u32) MS(0xFFFFFFFF, AR_TIME_OUT_ACK));
791}
#define AR_TIME_OUT
Definition reg.h:1462
#define AR_TIME_OUT_ACK
Definition reg.h:1463

References ah, AR_TIME_OUT, AR_TIME_OUT_ACK, ath9k_hw_mac_to_clks(), min, MS, REG_RMW_FIELD, u32, and val.

Referenced by ath9k_hw_init_global_settings().

◆ ath9k_hw_set_cts_timeout()

void ath9k_hw_set_cts_timeout ( struct ath_hw * ah,
u32 us )
static

Definition at line 793 of file ath9k_hw.c.

794{
796 val = min(val, (u32) MS(0xFFFFFFFF, AR_TIME_OUT_CTS));
798}
#define AR_TIME_OUT_CTS
Definition reg.h:1465

References ah, AR_TIME_OUT, AR_TIME_OUT_CTS, ath9k_hw_mac_to_clks(), min, MS, REG_RMW_FIELD, u32, and val.

Referenced by ath9k_hw_init_global_settings().

◆ ath9k_hw_set_global_txtimeout()

int ath9k_hw_set_global_txtimeout ( struct ath_hw * ah,
u32 tu )
static

Definition at line 800 of file ath9k_hw.c.

801{
802 if (tu > 0xFFFF) {
803 DBG("ath9k: "
804 "bad global tx timeout %d\n", tu);
805 ah->globaltxtimeout = (u32) -1;
806 return 0;
807 } else {
809 ah->globaltxtimeout = tu;
810 return 1;
811 }
812}
#define AR_GTXTO
Definition reg.h:153
#define AR_GTXTO_TIMEOUT_LIMIT
Definition reg.h:155

References ah, AR_GTXTO, AR_GTXTO_TIMEOUT_LIMIT, DBG, REG_RMW_FIELD, and u32.

Referenced by ath9k_hw_init_global_settings().

◆ ath9k_hw_init_global_settings()

void ath9k_hw_init_global_settings ( struct ath_hw * ah)

Definition at line 814 of file ath9k_hw.c.

815{
816 int acktimeout;
817 int slottime;
818 int sifstime;
819
820 DBG2("ath9k: ah->misc_mode 0x%x\n",
821 ah->misc_mode);
822
823 if (ah->misc_mode != 0)
824 REG_SET_BIT(ah, AR_PCU_MISC, ah->misc_mode);
825
826 if ((ah->dev->channels + ah->dev->channel)->band == NET80211_BAND_5GHZ)
827 sifstime = 16;
828 else
829 sifstime = 10;
830
831 /* As defined by IEEE 802.11-2007 17.3.8.6 */
832 slottime = ah->slottime + 3 * ah->coverage_class;
833 acktimeout = slottime + sifstime;
834
835 /*
836 * Workaround for early ACK timeouts, add an offset to match the
837 * initval's 64us ack timeout value.
838 * This was initially only meant to work around an issue with delayed
839 * BA frames in some implementations, but it has been found to fix ACK
840 * timeout issues in other cases as well.
841 */
842 if ((ah->dev->channels + ah->dev->channel)->band == NET80211_BAND_2GHZ)
843 acktimeout += 64 - sifstime - ah->slottime;
844
845 ath9k_hw_setslottime(ah, ah->slottime);
846 ath9k_hw_set_ack_timeout(ah, acktimeout);
847 ath9k_hw_set_cts_timeout(ah, acktimeout);
848 if (ah->globaltxtimeout != (u32) -1)
849 ath9k_hw_set_global_txtimeout(ah, ah->globaltxtimeout);
850}
#define AR_PCU_MISC
Definition reg.h:1641
static int ath9k_hw_set_global_txtimeout(struct ath_hw *ah, u32 tu)
Definition ath9k_hw.c:800
static void ath9k_hw_setslottime(struct ath_hw *ah, u32 us)
Definition ath9k_hw.c:779
static void ath9k_hw_set_cts_timeout(struct ath_hw *ah, u32 us)
Definition ath9k_hw.c:793
static void ath9k_hw_set_ack_timeout(struct ath_hw *ah, u32 us)
Definition ath9k_hw.c:786
#define NET80211_BAND_5GHZ
The band from 4.9 GHz to 5.7 GHz, which tends to be more restricted.
Definition net80211.h:47

References ah, AR_PCU_MISC, ath9k_hw_set_ack_timeout(), ath9k_hw_set_cts_timeout(), ath9k_hw_set_global_txtimeout(), ath9k_hw_setslottime(), DBG2, NET80211_BAND_2GHZ, NET80211_BAND_5GHZ, REG_SET_BIT, and u32.

Referenced by ath9k_bss_info_changed(), and ath9k_hw_reset().

◆ ath9k_hw_deinit()

void ath9k_hw_deinit ( struct ath_hw * ah)

Definition at line 852 of file ath9k_hw.c.

853{
855
856 if (common->state < ATH_HW_INITIALIZED)
857 goto free_hw;
858
860
861free_hw:
863}
@ ATH9K_PM_FULL_SLEEP
Definition hw.h:381

References ah, ath9k_hw_common(), ath9k_hw_rf_free_ext_banks(), ath9k_hw_setpower(), ATH9K_PM_FULL_SLEEP, ATH_HW_INITIALIZED, and common.

Referenced by ath9k_deinit_softc(), and ath9k_init_softc().

◆ ath9k_regd_get_ctl()

u32 ath9k_regd_get_ctl ( struct ath_regulatory * reg,
struct ath9k_channel * chan )

Definition at line 869 of file ath9k_hw.c.

870{
871 u32 ctl = ath_regd_get_band_ctl(reg, chan->chan->band);
872
873 if (IS_CHAN_B(chan))
874 ctl |= CTL_11B;
875 else if (IS_CHAN_G(chan))
876 ctl |= CTL_11G;
877 else
878 ctl |= CTL_11A;
879
880 return ctl;
881}
#define IS_CHAN_B(_c)
Definition ath5k.h:660
#define CTL_11G
Definition eeprom.h:73
#define CTL_11A
Definition eeprom.h:71
#define CTL_11B
Definition eeprom.h:72
u32 ath_regd_get_band_ctl(struct ath_regulatory *reg, int band)
Definition ath_regd.c:586
#define IS_CHAN_G(_c)
Definition hw.h:356
struct net80211_channel * chan
Definition hw.h:348
u8 band
The band with which this channel is associated.
Definition net80211.h:388

References ath_regd_get_band_ctl(), net80211_channel::band, ath9k_channel::chan, CTL_11A, CTL_11B, CTL_11G, IS_CHAN_B, IS_CHAN_G, reg, and u32.

Referenced by ar5008_hw_process_ini(), ar9003_hw_process_ini(), ath9k_hw_channel_change(), and ath9k_hw_set_txpowerlimit().

◆ ath9k_hw_set_dma()

void ath9k_hw_set_dma ( struct ath_hw * ah)
inlinestatic

Definition at line 887 of file ath9k_hw.c.

888{
890
892
893 /*
894 * set AHB_MODE not to do cacheline prefetches
895 */
898
899 /*
900 * let mac dma reads be in 128 byte chunks
901 */
903
905
906 /*
907 * Restore TX Trigger Level to its pre-reset value.
908 * The initial value depends on whether aggregation is enabled, and is
909 * adjusted whenever underruns are detected.
910 */
912 REG_RMW_FIELD(ah, AR_TXCFG, AR_FTRIG, ah->tx_trig_level);
913
915
916 /*
917 * let mac dma writes be in 128 byte chunks
918 */
920
921 /*
922 * Setup receive FIFO threshold to hold off TX activities
923 */
924 REG_WRITE(ah, AR_RXFIFO_CFG, 0x200);
925
929
930 ath9k_hw_set_rx_bufsize(ah, common->rx_bufsize -
931 ah->caps.rx_status_len);
932 }
933
934 /*
935 * reduce the number of usable entries in PCU TXBUF to avoid
936 * wrap around issues.
937 */
938 if (AR_SREV_9285(ah)) {
939 /* For AR9285 the number of Fifos are reduced to half.
940 * So set the usable tx buf size also to half to
941 * avoid data/delimiter underruns
942 */
945 } else if (!AR_SREV_9271(ah)) {
948 }
949
951
954}
void ath9k_hw_reset_txstatus_ring(struct ath_hw *ah)
void ath9k_hw_set_rx_bufsize(struct ath_hw *ah, u16 buf_size)
#define AR_AHB_MODE
Definition reg.h:902
#define AR_RXCFG
Definition reg.h:100
#define AR_RXFIFO_CFG
Definition reg.h:1635
#define AR_RXBP_THRESH_HP
Definition reg.h:46
#define AR_AHB_PREFETCH_RD_EN
Definition reg.h:907
#define AR_RXBP_THRESH
Definition reg.h:45
#define AR_RXCFG_DMASZ_128B
Definition reg.h:109
#define AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE
Definition reg.h:1829
#define AR_PCU_TXBUF_CTRL
Definition reg.h:1826
#define AR_RXCFG_DMASZ_MASK
Definition reg.h:103
#define AR_FTRIG
Definition reg.h:90
#define AR_TXCFG
Definition reg.h:80
#define AR_TXCFG_DMASZ_MASK
Definition reg.h:81
#define AR_RXBP_THRESH_LP
Definition reg.h:48
#define AR_PCU_TXBUF_CTRL_USABLE_SIZE
Definition reg.h:1828
#define AR_TXCFG_DMASZ_128B
Definition reg.h:87
#define REG_RMW(_ah, _reg, _set, _clr)
Definition hw.h:87

References ah, AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE, AR_AHB_MODE, AR_AHB_PREFETCH_RD_EN, AR_FTRIG, AR_PCU_TXBUF_CTRL, AR_PCU_TXBUF_CTRL_USABLE_SIZE, AR_RXBP_THRESH, AR_RXBP_THRESH_HP, AR_RXBP_THRESH_LP, AR_RXCFG, AR_RXCFG_DMASZ_128B, AR_RXCFG_DMASZ_MASK, AR_RXFIFO_CFG, AR_SREV_9271, AR_SREV_9285, AR_SREV_9300_20_OR_LATER, AR_TXCFG, AR_TXCFG_DMASZ_128B, AR_TXCFG_DMASZ_MASK, ath9k_hw_common(), ath9k_hw_reset_txstatus_ring(), ath9k_hw_set_rx_bufsize(), common, ENABLE_REGWRITE_BUFFER, REG_RMW, REG_RMW_FIELD, REG_SET_BIT, REG_WRITE, and REGWRITE_BUFFER_FLUSH.

Referenced by ath9k_hw_reset().

◆ ath9k_hw_set_operating_mode()

void ath9k_hw_set_operating_mode ( struct ath_hw * ah)
static

Definition at line 956 of file ath9k_hw.c.

957{
960
962
963 REG_RMW(ah, AR_STA_ID1, set, mask);
964}
#define AR_CFG_AP_ADHOC_INDICATION
Definition reg.h:38
#define AR_STA_ID1
Definition reg.h:1433
#define AR_STA_ID1_STA_AP
Definition reg.h:1435
#define AR_CFG
Definition reg.h:32
#define AR_STA_ID1_ADHOC
Definition reg.h:1436
#define AR_STA_ID1_KSRCH_MODE
Definition reg.h:1448
struct option_descriptor set[0]
Definition nvo_cmd.c:112

References ah, AR_CFG, AR_CFG_AP_ADHOC_INDICATION, AR_STA_ID1, AR_STA_ID1_ADHOC, AR_STA_ID1_KSRCH_MODE, AR_STA_ID1_STA_AP, REG_CLR_BIT, REG_RMW, set, and u32.

Referenced by ath9k_hw_reset(), and ath9k_hw_setopmode().

◆ ath9k_hw_get_delta_slope_vals()

void ath9k_hw_get_delta_slope_vals ( struct ath_hw *ah __unused,
u32 coef_scaled,
u32 * coef_mantissa,
u32 * coef_exponent )

Definition at line 966 of file ath9k_hw.c.

968{
969 u32 coef_exp, coef_man;
970
971 for (coef_exp = 31; coef_exp > 0; coef_exp--)
972 if ((coef_scaled >> coef_exp) & 0x1)
973 break;
974
975 coef_exp = 14 - (coef_exp - COEF_SCALE_S);
976
977 coef_man = coef_scaled + (1 << (COEF_SCALE_S - coef_exp - 1));
978
979 *coef_mantissa = coef_man >> (COEF_SCALE_S - coef_exp);
980 *coef_exponent = coef_exp - 16;
981}
#define COEF_SCALE_S
Definition hw.h:136

References __unused, ah, COEF_SCALE_S, and u32.

Referenced by ar5008_hw_set_delta_slope(), and ar9003_hw_set_delta_slope().

◆ ath9k_hw_set_reset()

int ath9k_hw_set_reset ( struct ath_hw * ah,
int type )
static

Definition at line 983 of file ath9k_hw.c.

984{
985 u32 rst_flags;
986 u32 tmpReg;
987
988 if (AR_SREV_9100(ah)) {
992 }
993
995
997 REG_WRITE(ah, AR_WA, ah->WARegVal);
998 udelay(10);
999 }
1000
1003
1004 if (AR_SREV_9100(ah)) {
1007 } else {
1008 tmpReg = REG_READ(ah, AR_INTR_SYNC_CAUSE);
1009 if (tmpReg &
1012 u32 val;
1014
1015 val = AR_RC_HOSTIF;
1017 val |= AR_RC_AHB;
1018 REG_WRITE(ah, AR_RC, val);
1019
1020 } else if (!AR_SREV_9300_20_OR_LATER(ah))
1022
1023 rst_flags = AR_RTC_RC_MAC_WARM;
1024 if (type == ATH9K_RESET_COLD)
1025 rst_flags |= AR_RTC_RC_MAC_COLD;
1026 }
1027
1028 REG_WRITE(ah, AR_RTC_RC, rst_flags);
1029
1031
1032 udelay(50);
1033
1034 REG_WRITE(ah, AR_RTC_RC, 0);
1036 DBG("ath9k: "
1037 "RTC stuck in MAC reset\n");
1038 return 0;
1039 }
1040
1041 if (!AR_SREV_9100(ah))
1042 REG_WRITE(ah, AR_RC, 0);
1043
1044 if (AR_SREV_9100(ah))
1045 udelay(50);
1046
1047 return 1;
1048}
#define AR_RTC_RC_WARM_RESET
Definition reg.h:1165
#define AR_RTC_RC_COLD_RESET
Definition reg.h:1164
#define AR_RC_HOSTIF
Definition reg.h:697
#define AR_RTC_DERIVED_CLK_PERIOD
Definition reg.h:1237
#define AR_RTC_RC_MAC_WARM
Definition reg.h:1162
#define AR_RTC_RC_MAC_COLD
Definition reg.h:1163
#define AR_RC_AHB
Definition reg.h:695
#define AR_RTC_RC_M
Definition reg.h:1161
@ AR_INTR_SYNC_RADM_CPL_TIMEOUT
Definition reg.h:944
@ AR_INTR_SYNC_LOCAL_TIMEOUT
Definition reg.h:945
#define AR_RC
Definition reg.h:694
#define AR_RTC_RC
Definition reg.h:1159
int ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout)
Definition ath9k_hw.c:95
#define AH_WAIT_TIMEOUT
Definition hw.h:146

References ah, AH_WAIT_TIMEOUT, AR_INTR_SYNC_CAUSE, AR_INTR_SYNC_ENABLE, AR_INTR_SYNC_LOCAL_TIMEOUT, AR_INTR_SYNC_RADM_CPL_TIMEOUT, AR_RC, AR_RC_AHB, AR_RC_HOSTIF, AR_RTC_DERIVED_CLK, AR_RTC_DERIVED_CLK_PERIOD, AR_RTC_FORCE_WAKE, AR_RTC_FORCE_WAKE_EN, AR_RTC_FORCE_WAKE_ON_INT, AR_RTC_RC, AR_RTC_RC_COLD_RESET, AR_RTC_RC_M, AR_RTC_RC_MAC_COLD, AR_RTC_RC_MAC_WARM, AR_RTC_RC_WARM_RESET, AR_SREV_9100, AR_SREV_9300_20_OR_LATER, AR_WA, ath9k_hw_wait(), ATH9K_RESET_COLD, DBG, ENABLE_REGWRITE_BUFFER, REG_READ, REG_RMW_FIELD, REG_WRITE, REGWRITE_BUFFER_FLUSH, type, u32, udelay(), and val.

Referenced by ath9k_hw_set_reset_power_on(), and ath9k_hw_set_reset_reg().

◆ ath9k_hw_set_reset_power_on()

int ath9k_hw_set_reset_power_on ( struct ath_hw * ah)
static

Definition at line 1050 of file ath9k_hw.c.

1051{
1053
1055 REG_WRITE(ah, AR_WA, ah->WARegVal);
1056 udelay(10);
1057 }
1058
1061
1064
1066
1068
1070 udelay(2);
1071
1073 REG_WRITE(ah, AR_RC, 0);
1074
1076
1077 if (!ath9k_hw_wait(ah,
1081 AH_WAIT_TIMEOUT)) {
1082 DBG("ath9k: "
1083 "RTC not waking up\n");
1084 return 0;
1085 }
1086
1088}
#define AR_RTC_STATUS_M
Definition reg.h:1203
#define AR_RTC_RESET
Definition reg.h:1196
#define AR_RTC_STATUS_ON
Definition reg.h:1209
#define AR_RTC_STATUS
Definition reg.h:1200

References ah, AH_WAIT_TIMEOUT, AR_RC, AR_RC_AHB, AR_RTC_FORCE_WAKE, AR_RTC_FORCE_WAKE_EN, AR_RTC_FORCE_WAKE_ON_INT, AR_RTC_RESET, AR_RTC_STATUS, AR_RTC_STATUS_M, AR_RTC_STATUS_ON, AR_SREV_9100, AR_SREV_9300_20_OR_LATER, AR_WA, ath9k_hw_set_reset(), ath9k_hw_wait(), ATH9K_RESET_WARM, DBG, ENABLE_REGWRITE_BUFFER, REG_WRITE, REGWRITE_BUFFER_FLUSH, and udelay().

Referenced by ath9k_hw_set_reset_reg().

◆ ath9k_hw_chip_reset()

int ath9k_hw_chip_reset ( struct ath_hw * ah,
struct ath9k_channel * chan )
static

Definition at line 1111 of file ath9k_hw.c.

1113{
1114 if (AR_SREV_9280(ah) && ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) {
1116 return 0;
1118 return 0;
1119
1121 return 0;
1122
1123 ah->chip_fullsleep = 0;
1124 ath9k_hw_init_pll(ah, chan);
1125 ath9k_hw_set_rfmode(ah, chan);
1126
1127 return 1;
1128}
@ EEP_OL_PWRCTRL
Definition eeprom.h:246
static void ath9k_hw_init_pll(struct ath_hw *ah, struct ath9k_channel *chan)
Definition ath9k_hw.c:623
static void ath9k_hw_set_rfmode(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw-ops.h:207

References ah, AR_SREV_9280, ath9k_hw_init_pll(), ath9k_hw_set_reset_reg(), ath9k_hw_set_rfmode(), ath9k_hw_setpower(), ATH9K_PM_AWAKE, ATH9K_RESET_POWER_ON, ATH9K_RESET_WARM, and EEP_OL_PWRCTRL.

Referenced by ath9k_hw_reset().

◆ ath9k_hw_channel_change()

int ath9k_hw_channel_change ( struct ath_hw * ah,
struct ath9k_channel * chan )
static

Definition at line 1130 of file ath9k_hw.c.

1132{
1133 struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
1134 struct net80211_channel *channel = chan->chan;
1135 u32 qnum;
1136 int r;
1137
1138 for (qnum = 0; qnum < AR_NUM_QCU; qnum++) {
1139 if (ath9k_hw_numtxpending(ah, qnum)) {
1140 DBG("ath9k: "
1141 "Transmit frames pending on queue %d\n", qnum);
1142 return 0;
1143 }
1144 }
1145
1146 if (!ath9k_hw_rfbus_req(ah)) {
1147 DBG("ath9k: Could not kill baseband RX\n");
1148 return 0;
1149 }
1150
1152
1153 r = ath9k_hw_rf_set_freq(ah, chan);
1154 if (r) {
1155 DBG("ath9k: Failed to set channel\n");
1156 return 0;
1157 }
1159
1160 ah->eep_ops->set_txpower(ah, chan,
1161 ath9k_regd_get_ctl(regulatory, chan),
1162 0,
1163 channel->maxpower * 2,
1165 (u32) regulatory->power_limit), 0);
1166
1168
1169 if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan))
1171
1173
1174 return 1;
1175}
#define AR_NUM_QCU
Definition reg.h:360
u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan)
Definition ath9k_hw.c:869
static void ath9k_hw_set_clockrate(struct ath_hw *ah)
Definition ath9k_hw.c:70
u32 ath9k_hw_numtxpending(struct ath_hw *ah, u32 q)
Definition ath9k_mac.c:64
static void ath9k_hw_spur_mitigate_freq(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw-ops.h:149
static int ath9k_hw_rfbus_req(struct ath_hw *ah)
Definition hw-ops.h:224
static int ath9k_hw_rf_set_freq(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw-ops.h:143
static void ath9k_hw_set_channel_regs(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw-ops.h:187
static void ath9k_hw_rfbus_done(struct ath_hw *ah)
Definition hw-ops.h:229
static void ath9k_hw_set_delta_slope(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw-ops.h:218
#define IS_CHAN_OFDM(_c)
Definition hw.h:360
#define IS_CHAN_HT(_c)
Definition hw.h:377
uint32_t channel
RNDIS channel.
Definition netvsc.h:3
An 802.11 RF channel.
Definition net80211.h:386

References ah, AR_NUM_QCU, ath9k_hw_numtxpending(), ath9k_hw_regulatory(), ath9k_hw_rf_set_freq(), ath9k_hw_rfbus_done(), ath9k_hw_rfbus_req(), ath9k_hw_set_channel_regs(), ath9k_hw_set_clockrate(), ath9k_hw_set_delta_slope(), ath9k_hw_spur_mitigate_freq(), ath9k_regd_get_ctl(), ath9k_channel::chan, channel, DBG, IS_CHAN_HT, IS_CHAN_OFDM, MAX_RATE_POWER, min, ath_regulatory::power_limit, r, and u32.

Referenced by ath9k_hw_reset().

◆ ath9k_hw_apply_gpio_override()

void ath9k_hw_apply_gpio_override ( struct ath_hw * ah)
static

Definition at line 1177 of file ath9k_hw.c.

1178{
1179 u32 gpio_mask = ah->gpio_mask;
1180 int i;
1181
1182 for (i = 0; gpio_mask; i++, gpio_mask >>= 1) {
1183 if (!(gpio_mask & 1))
1184 continue;
1185
1187 ath9k_hw_set_gpio(ah, i, !!(ah->gpio_val & BIT(i)));
1188 }
1189}
void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio, u32 ah_signal_type)
Definition ath9k_hw.c:1831
void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val)
Definition ath9k_hw.c:1852
#define BIT(nr)
Definition ath.h:34
#define AR_GPIO_OUTPUT_MUX_AS_OUTPUT
Definition hw.h:123

References ah, AR_GPIO_OUTPUT_MUX_AS_OUTPUT, ath9k_hw_cfg_output(), ath9k_hw_set_gpio(), BIT, and u32.

Referenced by ath9k_hw_reset().

◆ ath9k_hw_check_alive()

int ath9k_hw_check_alive ( struct ath_hw * ah)

Definition at line 1191 of file ath9k_hw.c.

1192{
1193 int count = 50;
1194 u32 reg;
1195
1197 return 1;
1198
1199 do {
1201
1202 if ((reg & 0x7E7FFFEF) == 0x00702400)
1203 continue;
1204
1205 switch (reg & 0x7E000B00) {
1206 case 0x1E000000:
1207 case 0x52000B00:
1208 case 0x18000B00:
1209 continue;
1210 default:
1211 return 1;
1212 }
1213 } while (count-- > 0);
1214
1215 return 0;
1216}
#define AR_SREV_9285_12_OR_LATER(_ah)
Definition reg.h:832
#define AR_OBS_BUS_1
Definition reg.h:1559
static unsigned int count
Number of entries.
Definition dwmac.h:220

References ah, AR_OBS_BUS_1, AR_SREV_9285_12_OR_LATER, count, reg, REG_READ, and u32.

Referenced by ath_hw_check(), and ath_set_channel().

◆ ath9k_hw_reset()

int ath9k_hw_reset ( struct ath_hw * ah,
struct ath9k_channel * chan,
struct ath9k_hw_cal_data * caldata,
int bChannelChange )

Definition at line 1218 of file ath9k_hw.c.

1220{
1222 u32 saveLedState;
1223 struct ath9k_channel *curchan = ah->curchan;
1224 u32 saveDefAntenna;
1225 u32 macStaId1;
1226 int i, r;
1227
1228 ah->txchainmask = common->tx_chainmask;
1229 ah->rxchainmask = common->rx_chainmask;
1230
1232 return -EIO;
1233
1234 if (curchan && !ah->chip_fullsleep)
1235 ath9k_hw_getnf(ah, curchan);
1236
1237 ah->caldata = caldata;
1238 if (caldata &&
1239 (chan->channel != caldata->channel ||
1240 (chan->channelFlags & ~CHANNEL_CW_INT) !=
1241 (caldata->channelFlags & ~CHANNEL_CW_INT))) {
1242 /* Operating channel changed, reset channel calibration data */
1243 memset(caldata, 0, sizeof(*caldata));
1245 }
1246
1247 if (bChannelChange &&
1248 (ah->chip_fullsleep != 1) &&
1249 (ah->curchan != NULL) &&
1250 (chan->channel != ah->curchan->channel) &&
1251 ((chan->channelFlags & CHANNEL_ALL) ==
1252 (ah->curchan->channelFlags & CHANNEL_ALL)) &&
1253 (!AR_SREV_9280(ah) || AR_DEVID_7010(ah))) {
1254
1256 ath9k_hw_loadnf(ah, ah->curchan);
1258 if (AR_SREV_9271(ah))
1260 return 0;
1261 }
1262 }
1263
1264 saveDefAntenna = REG_READ(ah, AR_DEF_ANTENNA);
1265 if (saveDefAntenna == 0)
1266 saveDefAntenna = 1;
1267
1269
1270 saveLedState = REG_READ(ah, AR_CFG_LED) &
1273
1275
1276 ah->paprd_table_write_done = 0;
1277
1278 /* Only required on the first reset */
1279 if (AR_SREV_9271(ah) && ah->htc_reset_init) {
1280 REG_WRITE(ah,
1283 udelay(50);
1284 }
1285
1286 if (!ath9k_hw_chip_reset(ah, chan)) {
1287 DBG("ath9k: Chip reset failed\n");
1288 return -EINVAL;
1289 }
1290
1291 /* Only required on the first reset */
1292 if (AR_SREV_9271(ah) && ah->htc_reset_init) {
1293 ah->htc_reset_init = 0;
1294 REG_WRITE(ah,
1297 udelay(50);
1298 }
1299
1302
1305
1307 if (r)
1308 return r;
1309
1310 /* Setup MFP options for CCMP */
1312 /* Mask Retry(b11), PwrMgt(b12), MoreData(b13) to 0 in mgmt
1313 * frames when constructing CCMP AAD. */
1315 0xc7ff);
1316 ah->sw_mgmt_crypto = 0;
1317 } else if (AR_SREV_9160_10_OR_LATER(ah)) {
1318 /* Disable hardware crypto for management frames */
1323 ah->sw_mgmt_crypto = 1;
1324 } else
1325 ah->sw_mgmt_crypto = 1;
1326
1329
1331 ah->eep_ops->set_board_values(ah, chan);
1332
1334
1337 | macStaId1
1339 | (ah->config.
1340 ack_6mb ? AR_STA_ID1_ACKCTS_6MB : 0)
1341 | ah->sta_id1_defaults);
1343 REG_WRITE(ah, AR_DEF_ANTENNA, saveDefAntenna);
1345 REG_WRITE(ah, AR_ISR, ~0);
1347
1349
1351
1353 if (r)
1354 return r;
1355
1357
1359
1360 for (i = 0; i < AR_NUM_DCU; i++)
1361 REG_WRITE(ah, AR_DQCUMASK(i), 1 << i);
1362
1364
1365 ah->intr_txqs = 0;
1366 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++)
1368
1371
1372 if (ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
1373 ath9k_hw_cfg_gpio_input(ah, ah->rfkill_gpio);
1374
1376
1380 }
1381
1383
1385
1386 REG_WRITE(ah, AR_OBS, 8);
1387
1388 if (ah->config.rx_intr_mitigation) {
1391 }
1392
1393 if (ah->config.tx_intr_mitigation) {
1396 }
1397
1399
1400 if (!ath9k_hw_init_cal(ah, chan))
1401 return -EIO;
1402
1404
1406 REG_WRITE(ah, AR_CFG_LED, saveLedState | AR_CFG_SCLK_32KHZ);
1407
1409
1410 /*
1411 * For big endian systems turn on swapping for descriptors
1412 */
1413 if (AR_SREV_9100(ah)) {
1414 u32 mask;
1415 mask = REG_READ(ah, AR_CFG);
1416 if (mask & (AR_CFG_SWRB | AR_CFG_SWTB | AR_CFG_SWRG)) {
1417 DBG2("ath9k: "
1418 "CFG Byte Swap Set 0x%x\n", mask);
1419 } else {
1420 mask =
1422 REG_WRITE(ah, AR_CFG, mask);
1423 DBG2("ath9k: "
1424 "Setting CFG 0x%x\n", REG_READ(ah, AR_CFG));
1425 }
1426 } else {
1427 if (common->bus_ops->ath_bus_type == ATH_USB) {
1428 /* Configure AR9271 target WLAN */
1429 if (AR_SREV_9271(ah))
1431 else
1433 }
1434#if __BYTE_ORDER == __BIG_ENDIAN
1435 else if (AR_SREV_9340(ah))
1437 else
1439#endif
1440 }
1441
1444 }
1445
1447
1448 return 0;
1449}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
#define CHANNEL_ALL
Definition ath5k.h:649
#define CHANNEL_CW_INT
Definition ath5k.h:630
#define AR_RIMT
Definition reg.h:65
#define AR_CFG_SWRB
Definition reg.h:36
#define AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE
Definition reg.h:1832
#define AR_CFG_LED_MODE_SEL
Definition reg.h:664
#define AR_CFG_SWTD
Definition reg.h:33
#define AR_GPIO_JTAG_DISABLE
Definition reg.h:1058
#define AR_STA_ID1_ACKCTS_6MB
Definition reg.h:1444
#define AR_RIMT_FIRST
Definition reg.h:68
#define AR_CFG_LED_BLINK_THRESH_SEL
Definition reg.h:663
#define AR_NUM_DCU
Definition reg.h:484
#define AR_ISR
Definition reg.h:172
#define AR_STA_ID1_RTS_USE_DEF
Definition reg.h:1443
#define AR_CFG_LED_BLINK_SLOW
Definition reg.h:662
#define AR_TIMT_LAST
Definition reg.h:60
#define AR_CFG_SWRG
Definition reg.h:37
#define AR_AES_MUTE_MASK1_FC_MGMT
Definition reg.h:1544
#define AR_RIMT_LAST
Definition reg.h:66
#define AR_CFG_LED
Definition reg.h:655
#define AR_GPIO_INPUT_EN_VAL
Definition reg.h:1041
#define AR_STA_ID1_PRESERVE_SEQNUM
Definition reg.h:1449
#define AR_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT
Definition reg.h:1833
#define AR_CFG_SWRD
Definition reg.h:35
#define AR_CFG_LED_ASSOC_CTL
Definition reg.h:678
#define AR_DEF_ANTENNA
Definition reg.h:1535
#define AR9271_RESET_POWER_DOWN_CONTROL
Definition reg.h:1428
#define AR_TIMT
Definition reg.h:59
#define AR_OBS
Definition reg.h:1095
#define AR_DQCUMASK(_i)
Definition reg.h:506
#define AR_PCU_MISC_MODE2
Definition reg.h:1831
#define AR_AES_MUTE_MASK1
Definition reg.h:1542
#define AR_SREV_9160_10_OR_LATER(_ah)
Definition reg.h:818
#define AR_TIMT_FIRST
Definition reg.h:62
#define AR_DEVID_7010(_ah)
Definition reg.h:892
#define AR9271_RADIO_RF_RST
Definition reg.h:1429
#define AR_RSSI_THR
Definition reg.h:1469
#define AR9271_GATE_MAC_CTL
Definition reg.h:1430
#define AR_CFG_SCLK_32KHZ
Definition reg.h:661
#define AR_CFG_SWTB
Definition reg.h:34
#define AR_STA_ID1_BASE_RATE_11B
Definition reg.h:1445
void ar9002_hw_enable_wep_aggregation(struct ath_hw *ah)
void ar9002_hw_update_async_fifo(struct ath_hw *ah)
void ar9002_hw_load_ani_reg(struct ath_hw *ah, struct ath9k_channel *chan)
void ar9002_hw_enable_async_fifo(struct ath_hw *ah)
void ar9003_hw_disable_phy_restart(struct ath_hw *ah)
void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan)
void ath9k_hw_start_nfcal(struct ath_hw *ah, int update)
int ath9k_hw_getnf(struct ath_hw *ah, struct ath9k_channel *chan)
void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah, struct ath9k_channel *chan)
static int ath9k_hw_channel_change(struct ath_hw *ah, struct ath9k_channel *chan)
Definition ath9k_hw.c:1130
void ath9k_hw_init_global_settings(struct ath_hw *ah)
Definition ath9k_hw.c:814
void ath9k_hw_write_associd(struct ath_hw *ah)
Definition ath9k_hw.c:1966
static void ath9k_hw_set_dma(struct ath_hw *ah)
Definition ath9k_hw.c:887
static int ath9k_hw_chip_reset(struct ath_hw *ah, struct ath9k_channel *chan)
Definition ath9k_hw.c:1111
void ath9k_hw_cfg_gpio_input(struct ath_hw *ah, u32 gpio)
Definition ath9k_hw.c:1785
static void ath9k_hw_set_operating_mode(struct ath_hw *ah)
Definition ath9k_hw.c:956
static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah)
Definition ath9k_hw.c:727
static void ath9k_hw_ani_cache_ini_regs(struct ath_hw *ah)
Definition ath9k_hw.c:57
static void ath9k_hw_apply_gpio_override(struct ath_hw *ah)
Definition ath9k_hw.c:1177
int ath9k_hw_resettxqueue(struct ath_hw *ah, u32 q)
Definition ath9k_mac.c:285
static u16 get_unaligned_le16(const void *p)
Definition ath.h:85
static u32 get_unaligned_le32(const void *p)
Definition ath.h:89
void ath_hw_setbssidmask(struct ath_common *common)
ath_hw_set_bssid_mask - filter out bssids we listen
Definition ath_hw.c:122
#define EINVAL
Invalid argument.
Definition errno.h:429
static void ath9k_hw_restore_chainmask(struct ath_hw *ah)
Definition hw-ops.h:234
static int ath9k_hw_init_cal(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw-ops.h:259
static int ath9k_hw_process_ini(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw-ops.h:193
static void ath9k_hw_mark_phy_inactive(struct ath_hw *ah)
Definition hw-ops.h:213
static void ath9k_hw_init_bb(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw-ops.h:181
@ ATH9K_HW_CAP_RFSILENT
Definition hw.h:183
#define INIT_RSSI_THR
Definition hw.h:159
#define INIT_CONFIG_STATUS
Definition hw.h:158
void * memset(void *dest, int character, size_t len) __nonnull
#define ATH9K_NUM_TX_QUEUES
Definition mac.h:581
u32 channelFlags
Definition hw.h:335

References ah, ar9002_hw_enable_async_fifo(), ar9002_hw_enable_wep_aggregation(), ar9002_hw_load_ani_reg(), ar9002_hw_update_async_fifo(), ar9003_hw_disable_phy_restart(), AR9271_GATE_MAC_CTL, AR9271_RADIO_RF_RST, AR9271_RESET_POWER_DOWN_CONTROL, AR_AES_MUTE_MASK1, AR_AES_MUTE_MASK1_FC_MGMT, AR_CFG, AR_CFG_LED, AR_CFG_LED_ASSOC_CTL, AR_CFG_LED_BLINK_SLOW, AR_CFG_LED_BLINK_THRESH_SEL, AR_CFG_LED_MODE_SEL, AR_CFG_SCLK_32KHZ, AR_CFG_SWRB, AR_CFG_SWRD, AR_CFG_SWRG, AR_CFG_SWTB, AR_CFG_SWTD, AR_DEF_ANTENNA, AR_DEVID_7010, AR_DQCUMASK, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE, AR_ISR, AR_NUM_DCU, AR_OBS, AR_PCU_MISC_MODE2, AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE, AR_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT, AR_RIMT, AR_RIMT_FIRST, AR_RIMT_LAST, AR_RSSI_THR, AR_SREV_9100, AR_SREV_9160_10_OR_LATER, AR_SREV_9271, AR_SREV_9280, AR_SREV_9280_20_OR_LATER, AR_SREV_9300_20_OR_LATER, AR_SREV_9340, AR_STA_ID0, AR_STA_ID1, AR_STA_ID1_ACKCTS_6MB, AR_STA_ID1_BASE_RATE_11B, AR_STA_ID1_PRESERVE_SEQNUM, AR_STA_ID1_RTS_USE_DEF, AR_TIMT, AR_TIMT_FIRST, AR_TIMT_LAST, ath9k_hw_ani_cache_ini_regs(), ath9k_hw_apply_gpio_override(), ATH9K_HW_CAP_RFSILENT, ath9k_hw_cfg_gpio_input(), ath9k_hw_channel_change(), ath9k_hw_chip_reset(), ath9k_hw_common(), ath9k_hw_getnf(), ath9k_hw_init_bb(), ath9k_hw_init_cal(), ath9k_hw_init_global_settings(), ath9k_hw_init_interrupt_masks(), ath9k_hw_loadnf(), ath9k_hw_mark_phy_inactive(), ath9k_hw_process_ini(), ath9k_hw_resettxqueue(), ath9k_hw_restore_chainmask(), ath9k_hw_rf_set_freq(), ath9k_hw_set_clockrate(), ath9k_hw_set_delta_slope(), ath9k_hw_set_dma(), ath9k_hw_set_operating_mode(), ath9k_hw_setpower(), ath9k_hw_spur_mitigate_freq(), ath9k_hw_start_nfcal(), ath9k_hw_write_associd(), ath9k_init_nfcal_hist_buffer(), ATH9K_NUM_TX_QUEUES, ATH9K_PM_AWAKE, ath_hw_setbssidmask(), ATH_USB, ath9k_channel::chan, ath9k_hw_cal_data::channel, CHANNEL_ALL, CHANNEL_CW_INT, ath9k_hw_cal_data::channelFlags, common, DBG, DBG2, EINVAL, EIO, ENABLE_REGWRITE_BUFFER, get_unaligned_le16(), get_unaligned_le32(), INIT_CONFIG_STATUS, INIT_RSSI_THR, IS_CHAN_HT, IS_CHAN_OFDM, memset(), NULL, r, REG_CLR_BIT, REG_READ, REG_RMW, REG_RMW_FIELD, REG_SET_BIT, REG_WRITE, REGWRITE_BUFFER_FLUSH, u32, and udelay().

Referenced by ath9k_start(), ath_radio_disable(), ath_reset(), and ath_set_channel().

◆ ath9k_set_power_sleep()

void ath9k_set_power_sleep ( struct ath_hw * ah,
int setChip )
static

Definition at line 1459 of file ath9k_hw.c.

1460{
1462 if (setChip) {
1463 /*
1464 * Clear the RTC force wake bit to allow the
1465 * mac to go to sleep.
1466 */
1471
1472 /* Shutdown chip. Active low */
1473 if (!AR_SREV_5416(ah) && !AR_SREV_9271(ah))
1476 }
1477
1478 /* Clear Bit 14 of AR_WA after putting chip into Full Sleep mode. */
1481 ah->WARegVal & ~AR_WA_D3_L1_DISABLE);
1482}
#define AR_RTC_RESET_EN
Definition reg.h:1198
#define AR_STA_ID1_PWR_SAV
Definition reg.h:1437

References ah, AR_RC, AR_RC_AHB, AR_RC_HOSTIF, AR_RTC_FORCE_WAKE, AR_RTC_FORCE_WAKE_EN, AR_RTC_RESET, AR_RTC_RESET_EN, AR_SREV_5416, AR_SREV_9100, AR_SREV_9271, AR_SREV_9300_20_OR_LATER, AR_STA_ID1, AR_STA_ID1_PWR_SAV, AR_WA, AR_WA_D3_L1_DISABLE, REG_CLR_BIT, REG_SET_BIT, and REG_WRITE.

Referenced by ath9k_hw_setpower().

◆ ath9k_hw_set_power_awake()

int ath9k_hw_set_power_awake ( struct ath_hw * ah,
int setChip )
static

Definition at line 1484 of file ath9k_hw.c.

1485{
1486 u32 val;
1487 int i;
1488
1489 /* Set Bits 14 and 17 of AR_WA before powering on the chip. */
1491 REG_WRITE(ah, AR_WA, ah->WARegVal);
1492 udelay(10);
1493 }
1494
1495 if (setChip) {
1496 if ((REG_READ(ah, AR_RTC_STATUS) &
1499 ATH9K_RESET_POWER_ON) != 1) {
1500 return 0;
1501 }
1504 }
1505 if (AR_SREV_9100(ah))
1508
1511 udelay(50);
1512
1513 for (i = POWER_UP_TIME / 50; i > 0; i--) {
1515 if (val == AR_RTC_STATUS_ON)
1516 break;
1517 udelay(50);
1520 }
1521 if (i == 0) {
1522 DBG("ath9k: "
1523 "Failed to wakeup in %dus\n",
1524 POWER_UP_TIME / 20);
1525 return 0;
1526 }
1527 }
1528
1530
1531 return 1;
1532}
#define AR_RTC_STATUS_SHUTDOWN
Definition reg.h:1208
#define POWER_UP_TIME
Definition hw.h:150

References ah, AR_RTC_FORCE_WAKE, AR_RTC_FORCE_WAKE_EN, AR_RTC_RESET, AR_RTC_RESET_EN, AR_RTC_STATUS, AR_RTC_STATUS_M, AR_RTC_STATUS_ON, AR_RTC_STATUS_SHUTDOWN, AR_SREV_9100, AR_SREV_9300_20_OR_LATER, AR_STA_ID1, AR_STA_ID1_PWR_SAV, AR_WA, ath9k_hw_init_pll(), ath9k_hw_set_reset_reg(), ATH9K_RESET_POWER_ON, DBG, NULL, POWER_UP_TIME, REG_CLR_BIT, REG_READ, REG_SET_BIT, REG_WRITE, u32, udelay(), and val.

Referenced by ath9k_hw_setpower().

◆ ath9k_hw_setpower()

int ath9k_hw_setpower ( struct ath_hw * ah,
enum ath9k_power_mode mode )

Definition at line 1534 of file ath9k_hw.c.

1535{
1536 int status = 1, setChip = 1;
1537 static const char *modes[] = {
1538 "AWAKE",
1539 "FULL-SLEEP",
1540 "NETWORK SLEEP",
1541 "UNDEFINED"
1542 };
1543
1544 if (ah->power_mode == mode)
1545 return status;
1546
1547 DBG2("ath9k: %s -> %s\n",
1548 modes[ah->power_mode], modes[mode]);
1549
1550 switch (mode) {
1551 case ATH9K_PM_AWAKE:
1553 break;
1555 ath9k_set_power_sleep(ah, setChip);
1556 ah->chip_fullsleep = 1;
1557 break;
1558 default:
1559 DBG("ath9k: Unknown power mode %d\n", mode);
1560 return 0;
1561 }
1562 ah->power_mode = mode;
1563
1564 return status;
1565}
static void ath9k_set_power_sleep(struct ath_hw *ah, int setChip)
Definition ath9k_hw.c:1459
static int ath9k_hw_set_power_awake(struct ath_hw *ah, int setChip)
Definition ath9k_hw.c:1484
uint8_t status
Status.
Definition ena.h:5
uint16_t mode
Acceleration mode.
Definition ena.h:15

References ah, ath9k_hw_set_power_awake(), ATH9K_PM_AWAKE, ATH9K_PM_FULL_SLEEP, ath9k_set_power_sleep(), DBG, DBG2, mode, and status.

Referenced by __ath9k_hw_init(), ath9k_hw_chip_reset(), ath9k_hw_deinit(), ath9k_hw_disable(), ath9k_hw_reset(), and ath9k_setpower().

◆ ath9k_hw_fill_cap_info()

int ath9k_hw_fill_cap_info ( struct ath_hw * ah)

Definition at line 1571 of file ath9k_hw.c.

1572{
1573 struct ath9k_hw_capabilities *pCap = &ah->caps;
1574 struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
1576
1577 u16 eeval;
1578 u8 ant_div_ctl1, tx_chainmask, rx_chainmask;
1579
1580 eeval = ah->eep_ops->get_eeprom(ah, EEP_REG_0);
1581 regulatory->current_rd = eeval;
1582
1583 eeval = ah->eep_ops->get_eeprom(ah, EEP_REG_1);
1585 eeval |= AR9285_RDEXT_DEFAULT;
1586 regulatory->current_rd_ext = eeval;
1587
1588 if (ah->hw_version.subvendorid == AR_SUBVENDOR_ID_NEW_A) {
1589 if (regulatory->current_rd == 0x64 ||
1590 regulatory->current_rd == 0x65)
1591 regulatory->current_rd += 5;
1592 else if (regulatory->current_rd == 0x41)
1593 regulatory->current_rd = 0x43;
1594 DBG2("ath9k: "
1595 "regdomain mapped to 0x%x\n", regulatory->current_rd);
1596 }
1597
1598 eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE);
1599 if ((eeval & (AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A)) == 0) {
1600 DBG("ath9k: "
1601 "no band has been marked as supported in EEPROM\n");
1602 return -EINVAL;
1603 }
1604
1605 if (eeval & AR5416_OPFLAGS_11A)
1606 pCap->hw_caps |= ATH9K_HW_CAP_5GHZ;
1607
1608 if (eeval & AR5416_OPFLAGS_11G)
1609 pCap->hw_caps |= ATH9K_HW_CAP_2GHZ;
1610
1611 pCap->tx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_TX_MASK);
1612 /*
1613 * For AR9271 we will temporarilly uses the rx chainmax as read from
1614 * the EEPROM.
1615 */
1616 if ((ah->hw_version.devid == AR5416_DEVID_PCI) &&
1617 !(eeval & AR5416_OPFLAGS_11A) &&
1618 !(AR_SREV_9271(ah)))
1619 /* CB71: GPIO 0 is pulled down to indicate 3 rx chains */
1620 pCap->rx_chainmask = ath9k_hw_gpio_get(ah, 0) ? 0x5 : 0x7;
1621 else if (AR_SREV_9100(ah))
1622 pCap->rx_chainmask = 0x7;
1623 else
1624 /* Use rx_chainmask from EEPROM. */
1625 pCap->rx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_RX_MASK);
1626
1627 ah->misc_mode |= AR_PCU_MIC_NEW_LOC_ENA;
1628
1629 /* enable key search for every frame in an aggregate */
1631 ah->misc_mode |= AR_PCU_ALWAYS_PERFORM_KEYSEARCH;
1632
1633 common->crypt_caps |= ATH_CRYPT_CAP_CIPHER_AESCCM;
1634
1635 pCap->hw_caps &= ~ATH9K_HW_CAP_HT;
1636
1637 if (AR_SREV_9271(ah))
1639 else if (AR_DEVID_7010(ah))
1641 else if (AR_SREV_9285_12_OR_LATER(ah))
1643 else if (AR_SREV_9280_20_OR_LATER(ah))
1645 else
1646 pCap->num_gpio_pins = AR_NUM_GPIO;
1647
1649 pCap->hw_caps |= ATH9K_HW_CAP_CST;
1651 } else {
1652 pCap->rts_aggr_limit = (8 * 1024);
1653 }
1654
1655 ah->rfsilent = ah->eep_ops->get_eeprom(ah, EEP_RF_SILENT);
1656 if (ah->rfsilent & EEP_RFSILENT_ENABLED) {
1657 ah->rfkill_gpio =
1658 MS(ah->rfsilent, EEP_RFSILENT_GPIO_SEL);
1659 ah->rfkill_polarity =
1660 MS(ah->rfsilent, EEP_RFSILENT_POLARITY);
1661
1663 }
1664
1666
1667 if (AR_SREV_9280(ah) || AR_SREV_9285(ah))
1669 else
1671
1674 if (!AR_SREV_9485(ah))
1675 pCap->hw_caps |= ATH9K_HW_CAP_LDPC;
1676
1679 pCap->rx_status_len = sizeof(struct ar9003_rxs);
1680 pCap->tx_desc_len = sizeof(struct ar9003_txc);
1681 pCap->txs_len = sizeof(struct ar9003_txs);
1682 if (!ah->config.paprd_disable &&
1683 ah->eep_ops->get_eeprom(ah, EEP_PAPRD))
1684 pCap->hw_caps |= ATH9K_HW_CAP_PAPRD;
1685 } else {
1686 pCap->tx_desc_len = sizeof(struct ath_desc);
1687 if (AR_SREV_9280_20(ah) &&
1688 ((ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV) <=
1690 ah->eep_ops->get_eeprom(ah, EEP_FSTCLK_5G)))
1692 }
1693
1696
1698 ah->ent_mode = REG_READ(ah, AR_ENT_OTP);
1699
1702
1703 if (AR_SREV_9285(ah))
1704 if (ah->eep_ops->get_eeprom(ah, EEP_MODAL_VER) >= 3) {
1705 ant_div_ctl1 =
1706 ah->eep_ops->get_eeprom(ah, EEP_ANT_DIV_CTL1);
1707 if ((ant_div_ctl1 & 0x1) && ((ant_div_ctl1 >> 3) & 0x1))
1709 }
1711 if (ah->eep_ops->get_eeprom(ah, EEP_CHAIN_MASK_REDUCE))
1712 pCap->hw_caps |= ATH9K_HW_CAP_APM;
1713 }
1714
1715
1716 if (AR_SREV_9485(ah)) {
1717 ant_div_ctl1 = ah->eep_ops->get_eeprom(ah, EEP_ANT_DIV_CTL1);
1718 /*
1719 * enable the diversity-combining algorithm only when
1720 * both enable_lna_div and enable_fast_div are set
1721 * Table for Diversity
1722 * ant_div_alt_lnaconf bit 0-1
1723 * ant_div_main_lnaconf bit 2-3
1724 * ant_div_alt_gaintb bit 4
1725 * ant_div_main_gaintb bit 5
1726 * enable_ant_div_lnadiv bit 6
1727 * enable_ant_fast_div bit 7
1728 */
1729 if ((ant_div_ctl1 >> 0x6) == 0x3)
1731 }
1732
1733 if (AR_SREV_9485_10(ah)) {
1734 pCap->pcie_lcr_extsync_en = 1;
1735 pCap->pcie_lcr_offset = 0x80;
1736 }
1737
1738 tx_chainmask = pCap->tx_chainmask;
1739 rx_chainmask = pCap->rx_chainmask;
1740 while (tx_chainmask || rx_chainmask) {
1741 if (tx_chainmask & BIT(0))
1742 pCap->max_txchains++;
1743 if (rx_chainmask & BIT(0))
1744 pCap->max_rxchains++;
1745
1746 tx_chainmask >>= 1;
1747 rx_chainmask >>= 1;
1748 }
1749
1750 return 0;
1751}
#define AR5416_OPFLAGS_11A
Definition eeprom.h:124
#define EEP_RFSILENT_POLARITY
Definition eeprom.h:119
#define EEP_RFSILENT_GPIO_SEL
Definition eeprom.h:121
#define AR5416_OPFLAGS_11G
Definition eeprom.h:125
#define AR9285_RDEXT_DEFAULT
Definition eeprom.h:100
#define EEP_RFSILENT_ENABLED
Definition eeprom.h:117
#define AR5416_EEP_MINOR_VER_16
Definition eeprom.h:138
@ EEP_RF_SILENT
Definition eeprom.h:236
@ EEP_REG_0
Definition eeprom.h:232
@ EEP_MINOR_REV
Definition eeprom.h:241
@ EEP_MODAL_VER
Definition eeprom.h:259
@ EEP_RX_MASK
Definition eeprom.h:243
@ EEP_FSTCLK_5G
Definition eeprom.h:244
@ EEP_PAPRD
Definition eeprom.h:258
@ EEP_OP_MODE
Definition eeprom.h:235
@ EEP_TX_MASK
Definition eeprom.h:242
@ EEP_REG_1
Definition eeprom.h:233
@ EEP_ANT_DIV_CTL1
Definition eeprom.h:260
@ EEP_CHAIN_MASK_REDUCE
Definition eeprom.h:261
#define AR_SREV_9485_10(_ah)
Definition reg.h:870
#define AR9271_NUM_GPIO
Definition reg.h:991
#define AR_SREV_9287_11_OR_LATER(_ah)
Definition reg.h:837
#define AR_PCU_ALWAYS_PERFORM_KEYSEARCH
Definition reg.h:1654
#define AR_SREV_9280_20(_ah)
Definition reg.h:827
#define AR9285_NUM_GPIO
Definition reg.h:989
#define AR928X_NUM_GPIO
Definition reg.h:988
#define AR7010_NUM_GPIO
Definition reg.h:993
#define AR_NUM_GPIO
Definition reg.h:987
#define AR_PCU_MIC_NEW_LOC_ENA
Definition reg.h:1643
#define AR_ENT_OTP
Definition reg.h:1108
u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio)
Definition ath9k_hw.c:1804
@ ATH_CRYPT_CAP_CIPHER_AESCCM
Definition ath.h:150
@ ATH9K_HW_CAP_ANT_DIV_COMB
Definition hw.h:193
@ ATH9K_HW_CAP_RAC_SUPPORTED
Definition hw.h:188
@ ATH9K_HW_CAP_AUTOSLEEP
Definition hw.h:185
@ ATH9K_HW_CAP_APM
Definition hw.h:196
@ ATH9K_HW_CAP_5GHZ
Definition hw.h:195
@ ATH9K_HW_CAP_LDPC
Definition hw.h:189
@ ATH9K_HW_CAP_HT
Definition hw.h:182
@ ATH9K_HW_CAP_CST
Definition hw.h:184
@ ATH9K_HW_CAP_SGI_20
Definition hw.h:191
@ ATH9K_HW_CAP_2GHZ
Definition hw.h:194
@ ATH9K_HW_CAP_4KB_SPLITTRANS
Definition hw.h:186
@ ATH9K_HW_CAP_PAPRD
Definition hw.h:192
#define ATH_AMPDU_LIMIT_MAX
Definition hw.h:69
#define ATH9K_HW_RX_HP_QDEPTH
Definition hw.h:164
#define AR_SUBVENDOR_ID_NEW_A
Definition hw.h:59
#define ATH9K_HW_RX_LP_QDEPTH
Definition hw.h:165
#define u8
Definition igbvf_osdep.h:40
int pcie_lcr_extsync_en
Definition hw.h:213
struct ath_regulatory regulatory
Definition ath.h:224
u8 rx_chainmask
Definition ath.h:212
u8 tx_chainmask
Definition ath.h:211
u16 current_rd_ext
Definition ath.h:144
u16 current_rd
Definition ath.h:143

References ah, AR5416_DEVID_PCI, AR5416_EEP_MINOR_VER_16, AR5416_OPFLAGS_11A, AR5416_OPFLAGS_11G, AR7010_NUM_GPIO, AR9271_NUM_GPIO, AR9285_NUM_GPIO, AR9285_RDEXT_DEFAULT, AR928X_NUM_GPIO, AR_DEVID_7010, AR_ENT_OTP, AR_NUM_GPIO, AR_PCU_ALWAYS_PERFORM_KEYSEARCH, AR_PCU_MIC_NEW_LOC_ENA, AR_SREV_9100, AR_SREV_9160_10_OR_LATER, AR_SREV_9271, AR_SREV_9280, AR_SREV_9280_20, AR_SREV_9280_20_OR_LATER, AR_SREV_9285, AR_SREV_9285_12_OR_LATER, AR_SREV_9287_11_OR_LATER, AR_SREV_9300_20_OR_LATER, AR_SREV_9485, AR_SREV_9485_10, AR_SUBVENDOR_ID_NEW_A, ATH9K_HW_CAP_2GHZ, ATH9K_HW_CAP_4KB_SPLITTRANS, ATH9K_HW_CAP_5GHZ, ATH9K_HW_CAP_ANT_DIV_COMB, ATH9K_HW_CAP_APM, ATH9K_HW_CAP_AUTOSLEEP, ATH9K_HW_CAP_CST, ATH9K_HW_CAP_FASTCLOCK, ATH9K_HW_CAP_HT, ATH9K_HW_CAP_LDPC, ATH9K_HW_CAP_PAPRD, ATH9K_HW_CAP_RAC_SUPPORTED, ATH9K_HW_CAP_RFSILENT, ATH9K_HW_CAP_SGI_20, ath9k_hw_common(), ath9k_hw_gpio_get(), ath9k_hw_regulatory(), ATH9K_HW_RX_HP_QDEPTH, ATH9K_HW_RX_LP_QDEPTH, ATH_AMPDU_LIMIT_MAX, ATH_CRYPT_CAP_CIPHER_AESCCM, BIT, common, ath_regulatory::current_rd, ath_regulatory::current_rd_ext, DBG, DBG2, EEP_ANT_DIV_CTL1, EEP_CHAIN_MASK_REDUCE, EEP_FSTCLK_5G, EEP_MINOR_REV, EEP_MODAL_VER, EEP_OP_MODE, EEP_PAPRD, EEP_REG_0, EEP_REG_1, EEP_RF_SILENT, EEP_RFSILENT_ENABLED, EEP_RFSILENT_GPIO_SEL, EEP_RFSILENT_POLARITY, EEP_RX_MASK, EEP_TX_MASK, EINVAL, ath9k_hw_capabilities::hw_caps, ath9k_hw_capabilities::max_rxchains, ath9k_hw_capabilities::max_txchains, MS, ath9k_hw_capabilities::num_gpio_pins, ath9k_hw_capabilities::pcie_lcr_extsync_en, ath9k_hw_capabilities::pcie_lcr_offset, REG_READ, ath_common::regulatory, ath9k_hw_capabilities::rts_aggr_limit, ath9k_hw_capabilities::rx_chainmask, ath_common::rx_chainmask, ath9k_hw_capabilities::rx_hp_qdepth, ath9k_hw_capabilities::rx_lp_qdepth, ath9k_hw_capabilities::rx_status_len, ath9k_hw_capabilities::tx_chainmask, ath_common::tx_chainmask, ath9k_hw_capabilities::tx_desc_len, ath9k_hw_capabilities::txs_len, u16, and u8.

Referenced by __ath9k_hw_init().

◆ ath9k_hw_gpio_cfg_output_mux()

void ath9k_hw_gpio_cfg_output_mux ( struct ath_hw * ah,
u32 gpio,
u32 type )
static

Definition at line 1757 of file ath9k_hw.c.

1759{
1760 int addr;
1761 u32 gpio_shift, tmp;
1762
1763 if (gpio > 11)
1765 else if (gpio > 5)
1767 else
1769
1770 gpio_shift = (gpio % 6) * 5;
1771
1773 || (addr != AR_GPIO_OUTPUT_MUX1)) {
1774 REG_RMW(ah, addr, (type << gpio_shift),
1775 (0x1f << gpio_shift));
1776 } else {
1777 tmp = REG_READ(ah, addr);
1778 tmp = ((tmp & 0x1F0) << 1) | (tmp & ~0x1F0);
1779 tmp &= ~(0x1f << gpio_shift);
1780 tmp |= (type << gpio_shift);
1781 REG_WRITE(ah, addr, tmp);
1782 }
1783}
#define AR_GPIO_OUTPUT_MUX2
Definition reg.h:1078
#define AR_GPIO_OUTPUT_MUX1
Definition reg.h:1076
#define AR_GPIO_OUTPUT_MUX3
Definition reg.h:1080
unsigned long tmp
Definition linux_pci.h:65
A GPIO pin.
Definition gpio.h:18

References addr, ah, AR_GPIO_OUTPUT_MUX1, AR_GPIO_OUTPUT_MUX2, AR_GPIO_OUTPUT_MUX3, AR_SREV_9280_20_OR_LATER, REG_READ, REG_RMW, REG_WRITE, tmp, type, and u32.

Referenced by ath9k_hw_cfg_output().

◆ ath9k_hw_cfg_gpio_input()

void ath9k_hw_cfg_gpio_input ( struct ath_hw * ah,
u32 gpio )

Definition at line 1785 of file ath9k_hw.c.

1786{
1787 u32 gpio_shift;
1788
1789 if (AR_DEVID_7010(ah)) {
1790 gpio_shift = gpio;
1792 (AR7010_GPIO_OE_AS_INPUT << gpio_shift),
1793 (AR7010_GPIO_OE_MASK << gpio_shift));
1794 return;
1795 }
1796
1797 gpio_shift = gpio << 1;
1798 REG_RMW(ah,
1800 (AR_GPIO_OE_OUT_DRV_NO << gpio_shift),
1801 (AR_GPIO_OE_OUT_DRV << gpio_shift));
1802}
#define AR7010_GPIO_OE
Definition reg.h:1021
#define AR_GPIO_OE_OUT_DRV_NO
Definition reg.h:1016
#define AR_GPIO_OE_OUT
Definition reg.h:1013
#define AR_GPIO_OE_OUT_DRV
Definition reg.h:1015
#define AR7010_GPIO_OE_MASK
Definition reg.h:1022
#define AR7010_GPIO_OE_AS_INPUT
Definition reg.h:1024

References ah, AR7010_GPIO_OE, AR7010_GPIO_OE_AS_INPUT, AR7010_GPIO_OE_MASK, AR_DEVID_7010, AR_GPIO_OE_OUT, AR_GPIO_OE_OUT_DRV, AR_GPIO_OE_OUT_DRV_NO, REG_RMW, and u32.

Referenced by ath9k_hw_reset(), and ath_radio_disable().

◆ ath9k_hw_gpio_get()

u32 ath9k_hw_gpio_get ( struct ath_hw * ah,
u32 gpio )

Definition at line 1804 of file ath9k_hw.c.

1805{
1806#define MS_REG_READ(x, y) \
1807 (MS(REG_READ(ah, AR_GPIO_IN_OUT), x##_GPIO_IN_VAL) & (AR_GPIO_BIT(y)))
1808
1809 if (gpio >= ah->caps.num_gpio_pins)
1810 return 0xffffffff;
1811
1812 if (AR_DEVID_7010(ah)) {
1813 u32 val;
1815 return (MS(val, AR7010_GPIO_IN_VAL) & AR_GPIO_BIT(gpio)) == 0;
1816 } else if (AR_SREV_9300_20_OR_LATER(ah))
1818 AR_GPIO_BIT(gpio)) != 0;
1819 else if (AR_SREV_9271(ah))
1820 return MS_REG_READ(AR9271, gpio) != 0;
1821 else if (AR_SREV_9287_11_OR_LATER(ah))
1822 return MS_REG_READ(AR9287, gpio) != 0;
1823 else if (AR_SREV_9285_12_OR_LATER(ah))
1824 return MS_REG_READ(AR9285, gpio) != 0;
1825 else if (AR_SREV_9280_20_OR_LATER(ah))
1826 return MS_REG_READ(AR928X, gpio) != 0;
1827 else
1828 return MS_REG_READ(AR, gpio) != 0;
1829}
#define AR7010_GPIO_IN_VAL
Definition reg.h:1006
#define AR7010_GPIO_IN
Definition reg.h:1025
#define AR9300_GPIO_IN_VAL
Definition reg.h:1010
#define AR_GPIO_IN
Definition reg.h:1009
#define MS_REG_READ(x, y)

References ah, AR7010_GPIO_IN, AR7010_GPIO_IN_VAL, AR9300_GPIO_IN_VAL, AR_DEVID_7010, AR_GPIO_BIT, AR_GPIO_IN, AR_SREV_9271, AR_SREV_9280_20_OR_LATER, AR_SREV_9285_12_OR_LATER, AR_SREV_9287_11_OR_LATER, AR_SREV_9300_20_OR_LATER, MS, MS_REG_READ, REG_READ, u32, and val.

Referenced by ath9k_hw_fill_cap_info().

◆ ath9k_hw_cfg_output()

void ath9k_hw_cfg_output ( struct ath_hw * ah,
u32 gpio,
u32 ah_signal_type )

Definition at line 1831 of file ath9k_hw.c.

1833{
1834 u32 gpio_shift;
1835
1836 if (AR_DEVID_7010(ah)) {
1837 gpio_shift = gpio;
1839 (AR7010_GPIO_OE_AS_OUTPUT << gpio_shift),
1840 (AR7010_GPIO_OE_MASK << gpio_shift));
1841 return;
1842 }
1843
1844 ath9k_hw_gpio_cfg_output_mux(ah, gpio, ah_signal_type);
1845 gpio_shift = 2 * gpio;
1846 REG_RMW(ah,
1848 (AR_GPIO_OE_OUT_DRV_ALL << gpio_shift),
1849 (AR_GPIO_OE_OUT_DRV << gpio_shift));
1850}
#define AR_GPIO_OE_OUT_DRV_ALL
Definition reg.h:1019
#define AR7010_GPIO_OE_AS_OUTPUT
Definition reg.h:1023
static void ath9k_hw_gpio_cfg_output_mux(struct ath_hw *ah, u32 gpio, u32 type)
Definition ath9k_hw.c:1757

References ah, AR7010_GPIO_OE, AR7010_GPIO_OE_AS_OUTPUT, AR7010_GPIO_OE_MASK, AR_DEVID_7010, AR_GPIO_OE_OUT, AR_GPIO_OE_OUT_DRV, AR_GPIO_OE_OUT_DRV_ALL, ath9k_hw_gpio_cfg_output_mux(), REG_RMW, and u32.

Referenced by ath9k_hw_apply_gpio_override().

◆ ath9k_hw_set_gpio()

void ath9k_hw_set_gpio ( struct ath_hw * ah,
u32 gpio,
u32 val )

Definition at line 1852 of file ath9k_hw.c.

1853{
1854 if (AR_DEVID_7010(ah)) {
1855 val = val ? 0 : 1;
1856 REG_RMW(ah, AR7010_GPIO_OUT, ((val&1) << gpio),
1857 AR_GPIO_BIT(gpio));
1858 return;
1859 }
1860
1861 if (AR_SREV_9271(ah))
1862 val = ~val;
1863
1864 REG_RMW(ah, AR_GPIO_IN_OUT, ((val & 1) << gpio),
1865 AR_GPIO_BIT(gpio));
1866}
#define AR7010_GPIO_OUT
Definition reg.h:1026

References ah, AR7010_GPIO_OUT, AR_DEVID_7010, AR_GPIO_BIT, AR_GPIO_IN_OUT, AR_SREV_9271, REG_RMW, u32, and val.

Referenced by ath9k_hw_apply_gpio_override(), and ath_radio_disable().

◆ ath9k_hw_getdefantenna()

u32 ath9k_hw_getdefantenna ( struct ath_hw * ah)

Definition at line 1868 of file ath9k_hw.c.

1869{
1870 return REG_READ(ah, AR_DEF_ANTENNA) & 0x7;
1871}

References ah, AR_DEF_ANTENNA, REG_READ, and u32.

Referenced by ath9k_init_misc().

◆ ath9k_hw_setantenna()

void ath9k_hw_setantenna ( struct ath_hw * ah,
u32 antenna )

Definition at line 1873 of file ath9k_hw.c.

1874{
1875 REG_WRITE(ah, AR_DEF_ANTENNA, (antenna & 0x7));
1876}

References ah, AR_DEF_ANTENNA, REG_WRITE, and u32.

Referenced by ath_setdefantenna().

◆ ath9k_hw_getrxfilter()

u32 ath9k_hw_getrxfilter ( struct ath_hw * ah)

Definition at line 1882 of file ath9k_hw.c.

1883{
1885 u32 phybits = REG_READ(ah, AR_PHY_ERR);
1886
1887 if (phybits & AR_PHY_ERR_RADAR)
1891
1892 return bits;
1893}
static volatile void * bits
Definition bitops.h:28
#define AR_PHY_ERR
Definition reg.h:1628
#define AR_PHY_ERR_CCK_TIMING
Definition reg.h:1633
#define AR_PHY_ERR_RADAR
Definition reg.h:1631
#define AR_PHY_ERR_OFDM_TIMING
Definition reg.h:1632
#define AR_RX_FILTER
Definition reg.h:1491
@ ATH9K_RX_FILTER_PHYRADAR
Definition mac.h:648
@ ATH9K_RX_FILTER_PHYERR
Definition mac.h:642

References ah, AR_PHY_ERR, AR_PHY_ERR_CCK_TIMING, AR_PHY_ERR_OFDM_TIMING, AR_PHY_ERR_RADAR, AR_RX_FILTER, ATH9K_RX_FILTER_PHYERR, ATH9K_RX_FILTER_PHYRADAR, bits, REG_READ, and u32.

Referenced by ath9k_ani_reset_old(), and ath_calcrxfilter().

◆ ath9k_hw_setrxfilter()

void ath9k_hw_setrxfilter ( struct ath_hw * ah,
u32 bits )

◆ ath9k_hw_phy_disable()

int ath9k_hw_phy_disable ( struct ath_hw * ah)

Definition at line 1918 of file ath9k_hw.c.

1919{
1921 return 0;
1922
1924 return 1;
1925}

References ah, ath9k_hw_init_pll(), ath9k_hw_set_reset_reg(), ATH9K_RESET_WARM, and NULL.

Referenced by ath9k_stop(), and ath_radio_disable().

◆ ath9k_hw_disable()

int ath9k_hw_disable ( struct ath_hw * ah)

Definition at line 1927 of file ath9k_hw.c.

1928{
1930 return 0;
1931
1933 return 0;
1934
1936 return 1;
1937}

References ah, ath9k_hw_init_pll(), ath9k_hw_set_reset_reg(), ath9k_hw_setpower(), ATH9K_PM_AWAKE, ATH9K_RESET_COLD, and NULL.

Referenced by ath9k_stop().

◆ ath9k_hw_set_txpowerlimit()

void ath9k_hw_set_txpowerlimit ( struct ath_hw * ah,
u32 limit,
int test )

Definition at line 1939 of file ath9k_hw.c.

1940{
1941 struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
1942 struct ath9k_channel *chan = ah->curchan;
1943 struct net80211_channel *channel = chan->chan;
1944
1945 regulatory->power_limit = min(limit, (u32) MAX_RATE_POWER);
1946
1947 ah->eep_ops->set_txpower(ah, chan,
1948 ath9k_regd_get_ctl(regulatory, chan),
1949 0,
1950 channel->maxpower * 2,
1952 (u32) regulatory->power_limit), test);
1953}
static int test
Definition epic100.c:73
uint16_t limit
Limit.
Definition librm.h:1

References ah, ath9k_hw_regulatory(), ath9k_regd_get_ctl(), ath9k_channel::chan, channel, limit, MAX_RATE_POWER, min, ath_regulatory::power_limit, test, and u32.

Referenced by ath9k_cmn_update_txpow(), and ath9k_init_band_txpower().

◆ ath9k_hw_setopmode()

void ath9k_hw_setopmode ( struct ath_hw * ah)

Definition at line 1955 of file ath9k_hw.c.

1956{
1958}

References ah, and ath9k_hw_set_operating_mode().

Referenced by ath_opmode_init().

◆ ath9k_hw_setmcastfilter()

void ath9k_hw_setmcastfilter ( struct ath_hw * ah,
u32 filter0,
u32 filter1 )

Definition at line 1960 of file ath9k_hw.c.

1961{
1962 REG_WRITE(ah, AR_MCAST_FIL0, filter0);
1963 REG_WRITE(ah, AR_MCAST_FIL1, filter1);
1964}
#define AR_MCAST_FIL1
Definition reg.h:1494
#define AR_MCAST_FIL0
Definition reg.h:1493

References ah, AR_MCAST_FIL0, AR_MCAST_FIL1, REG_WRITE, and u32.

Referenced by ath_opmode_init().

◆ ath9k_hw_write_associd()

void ath9k_hw_write_associd ( struct ath_hw * ah)

Definition at line 1966 of file ath9k_hw.c.

1967{
1969
1972 ((common->curaid & 0x3fff) << AR_BSS_ID1_AID_S));
1973}
#define AR_BSS_ID0
Definition reg.h:1453
#define AR_BSS_ID1
Definition reg.h:1454
#define AR_BSS_ID1_AID_S
Definition reg.h:1457

References ah, AR_BSS_ID0, AR_BSS_ID1, AR_BSS_ID1_AID_S, ath9k_hw_common(), common, get_unaligned_le16(), get_unaligned_le32(), and REG_WRITE.

Referenced by ath9k_bss_iter(), ath9k_config_bss(), and ath9k_hw_reset().

◆ ath9k_hw_set11nmac2040()

void ath9k_hw_set11nmac2040 ( struct ath_hw * ah)

Definition at line 1975 of file ath9k_hw.c.

1976{
1977 u32 macmode;
1978
1979 macmode = 0;
1980
1981 REG_WRITE(ah, AR_2040_MODE, macmode);
1982}
#define AR_2040_MODE
Definition reg.h:1818

References ah, AR_2040_MODE, REG_WRITE, and u32.

Referenced by ar5008_hw_set_channel_regs(), and ar9003_hw_set_channel_regs().

◆ ath9k_hw_mac_bb_name()

const char * ath9k_hw_mac_bb_name ( u32 mac_bb_version)
static

Definition at line 2017 of file ath9k_hw.c.

2018{
2019 unsigned int i;
2020
2021 for (i=0; i<ARRAY_SIZE(ath_mac_bb_names); i++) {
2022 if (ath_mac_bb_names[i].version == mac_bb_version) {
2023 return ath_mac_bb_names[i].name;
2024 }
2025 }
2026
2027 return "????";
2028}
u32 version
Driver version.
Definition ath9k_hw.c:1985
static struct @330141124141124302040353137243321263024222316177 ath_mac_bb_names[]
#define ARRAY_SIZE(x)
Definition efx_common.h:43

References ARRAY_SIZE, ath_mac_bb_names, u32, and version.

Referenced by ath9k_hw_name().

◆ ath9k_hw_rf_name()

const char * ath9k_hw_rf_name ( u16 rf_version)
static

Definition at line 2034 of file ath9k_hw.c.

2035{
2036 unsigned int i;
2037
2038 for (i=0; i<ARRAY_SIZE(ath_rf_names); i++) {
2039 if (ath_rf_names[i].version == rf_version) {
2040 return ath_rf_names[i].name;
2041 }
2042 }
2043
2044 return "????";
2045}
static struct @275024210143261150251224202276224162315300327331 ath_rf_names[]

References ARRAY_SIZE, ath_rf_names, u16, and version.

Referenced by ath9k_hw_name().

◆ ath9k_hw_name()

void ath9k_hw_name ( struct ath_hw * ah,
char * hw_name,
size_t len )

Definition at line 2047 of file ath9k_hw.c.

2048{
2049 int used;
2050
2051 /* chipsets >= AR9280 are single-chip */
2053 used = snprintf(hw_name, len,
2054 "Atheros AR%s Rev:%x",
2055 ath9k_hw_mac_bb_name(ah->hw_version.macVersion),
2056 ah->hw_version.macRev);
2057 }
2058 else {
2059 used = snprintf(hw_name, len,
2060 "Atheros AR%s MAC/BB Rev:%x AR%s RF Rev:%x",
2061 ath9k_hw_mac_bb_name(ah->hw_version.macVersion),
2062 ah->hw_version.macRev,
2063 ath9k_hw_rf_name((ah->hw_version.analog5GhzRev &
2065 ah->hw_version.phyRev);
2066 }
2067
2068 hw_name[used] = '\0';
2069}
#define AR_RADIO_SREV_MAJOR
Definition reg.h:896
static const char * ath9k_hw_mac_bb_name(u32 mac_bb_version)
Definition ath9k_hw.c:2017
static const char * ath9k_hw_rf_name(u16 rf_version)
Definition ath9k_hw.c:2034
ring len
Length.
Definition dwmac.h:226
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Definition vsprintf.c:383

References ah, AR_RADIO_SREV_MAJOR, AR_SREV_9280_20_OR_LATER, ath9k_hw_mac_bb_name(), ath9k_hw_rf_name(), len, and snprintf().

Referenced by ath_pci_probe().

Variable Documentation

◆ version

◆ name

const char* name

Definition at line 1986 of file ath9k_hw.c.

Referenced by acpi_name(), add_dynui_item(), add_tls(), alloc_form(), apply_dns_settings(), ath_descdma_setup(), autovivify_child_settings(), cms_decrypt(), cms_verify(), cms_verify_fail_okx(), cms_verify_okx(), com32_cfarcall_wrapper(), comboot_resolv(), cpio_header(), cpio_max(), cpio_name_len(), create_dynui(), create_parameters(), dhcp_tag_name(), dns_decode(), dns_encode(), dns_encode_fail_okx(), dns_encode_okx(), dns_label(), dns_list_okx(), dns_name(), dns_question(), dns_resolv(), dns_skip(), dns_skip_search(), dns_xfer_deliver(), draw_title_row(), dt_probe_node(), eepro_probe(), efi_binding_name(), efi_driver_name(), efi_driver_name(), efi_driver_name2(), efi_file_find(), efi_file_open(), efi_file_read_initrd(), efi_file_varlen(), efi_get_next_variable_name_wrapper(), efi_get_variable_wrapper(), efi_handle_name(), efi_iscsi_path(), efi_local_open_resolved(), efi_open_attributes_name(), efi_pecoff_debug_name(), efi_set_variable_wrapper(), efi_shim_get_variable(), efi_shim_is_sbatlevel(), efi_shim_set_variable(), efi_snp_hii_package_list(), efi_veto_dhcp6(), efi_veto_find(), efi_veto_hp_xhci(), efi_veto_ip4config(), efi_veto_vmware_uefipxebc(), eoib_create(), expand_settings(), fc_port_find(), fc_port_open(), fdt_alias(), fdt_cells(), fdt_child(), fdt_ensure_child(), fdt_match(), fdt_property(), fdt_set(), fdt_string(), fdt_strings(), fdt_u32(), fdt_u64(), FILE_LICENCE(), FILE_LICENCE(), FILE_SECBOOT(), FILE_SECBOOT(), find_child_settings(), find_dynui(), find_gdb_transport(), find_image(), find_netdev(), find_netdev_configurator(), find_parameters(), find_setting(), find_setting_type(), find_settings(), format_dnssl_setting(), gdbserial_configure(), gdbudp_configure(), http_authentication(), http_parse_header(), http_parse_www_authenticate(), hvm_map_xenstore(), ib_cmrc_open(), ib_create_mi(), ib_create_qp(), ib_create_service_madx(), image_extract(), image_memory(), image_set_name(), image_set_uri(), imgdecrypt(), imgextract(), imgmem(), imgverify(), item_exec(), keymap_apply(), keymap_find(), linux_find_setting(), memmap_update(), nslookup(), nslookup_exec(), numeric_resolv(), parse_eeprom(), parse_kv(), parse_setting_name(), parse_setting_tag(), parse_settings_name(), peerdist_discovery_reply_values(), png_type_name(), register_image(), register_settings(), resolv(), resolv_setting(), setting_name(), sis900_probe(), syslog_fix_name(), t515_reset(), testnet_set_okx(), tftp_process_option(), tftp_rx_oack(), tlan_probe(), tls_client_hello(), tls_session(), tulip_probe(), uart_find(), uart_register_fixed(), usbblk_find(), vt6103_read_mode(), vxgetlink(), vxsetlink(), x509_check_alt_name(), x509_check_dnsname(), x509_check_ipaddress(), x509_check_name(), x509_check_name_fail_okx(), x509_check_name_okx(), xfer_open_named_socket(), xhci_port_protocol(), xsmp_rx_xve_install(), and xve_create().

◆ [struct]

struct { ... } ath_mac_bb_names[]
Initial value:
= {
{ AR_SREV_VERSION_9100, "9100" },
{ AR_SREV_VERSION_9160, "9160" },
{ AR_SREV_VERSION_9280, "9280" },
{ AR_SREV_VERSION_9285, "9285" },
{ AR_SREV_VERSION_9287, "9287" },
{ AR_SREV_VERSION_9271, "9271" },
{ AR_SREV_VERSION_9300, "9300" },
{ AR_SREV_VERSION_9485, "9485" },
}

Referenced by ath9k_hw_mac_bb_name().

◆ [struct]

struct { ... } ath_rf_names[]
Initial value:
= {
{ 0, "5133" },
{ AR_RAD5133_SREV_MAJOR, "5133" },
{ AR_RAD5122_SREV_MAJOR, "5122" },
{ AR_RAD2133_SREV_MAJOR, "2133" },
}
#define AR_RAD5122_SREV_MAJOR
Definition reg.h:899
#define AR_RAD5133_SREV_MAJOR
Definition reg.h:897
#define AR_RAD2122_SREV_MAJOR
Definition reg.h:900
#define AR_RAD2133_SREV_MAJOR
Definition reg.h:898

Referenced by ath9k_hw_rf_name().