iPXE
Functions | Variables
ath9k_ar9002_hw.c File Reference
#include "hw.h"
#include "ar5008_initvals.h"
#include "ar9001_initvals.h"
#include "ar9002_initvals.h"
#include "ar9002_phy.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (BSD2)
 
 FILE_SECBOOT (FORBIDDEN)
 
static void ar9002_hw_init_mode_regs (struct ath_hw *ah)
 
void ar9002_hw_cck_chan14_spread (struct ath_hw *ah)
 
static void ar9280_20_hw_init_rxgain_ini (struct ath_hw *ah)
 
static void ar9280_20_hw_init_txgain_ini (struct ath_hw *ah)
 
static void ar9002_hw_init_mode_gain_regs (struct ath_hw *ah)
 
static void ar9002_hw_configpcipowersave (struct ath_hw *ah, int restore, int power_off)
 
static int ar9002_hw_get_radiorev (struct ath_hw *ah)
 
int ar9002_hw_rf_claim (struct ath_hw *ah)
 
void ar9002_hw_enable_async_fifo (struct ath_hw *ah)
 
void ar9002_hw_update_async_fifo (struct ath_hw *ah)
 
void ar9002_hw_enable_wep_aggregation (struct ath_hw *ah)
 
void ar9002_hw_attach_ops (struct ath_hw *ah)
 
void ar9002_hw_load_ani_reg (struct ath_hw *ah, struct ath9k_channel *chan)
 

Variables

int modparam_force_new_ani
 

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( BSD2  )

◆ FILE_SECBOOT()

FILE_SECBOOT ( FORBIDDEN  )

◆ ar9002_hw_init_mode_regs()

static void ar9002_hw_init_mode_regs ( struct ath_hw ah)
static

Definition at line 33 of file ath9k_ar9002_hw.c.

34 {
35  if (AR_SREV_9271(ah)) {
38  INIT_INI_ARRAY(&ah->iniCommon, ar9271Common_9271,
40  INIT_INI_ARRAY(&ah->iniCommon_normal_cck_fir_coeff_9271,
43  INIT_INI_ARRAY(&ah->iniCommon_japan_2484_cck_fir_coeff_9271,
46  INIT_INI_ARRAY(&ah->iniModes_9271_1_0_only,
49  INIT_INI_ARRAY(&ah->iniModes_9271_ANI_reg, ar9271Modes_9271_ANI_reg,
51  INIT_INI_ARRAY(&ah->iniModes_high_power_tx_gain_9271,
54  INIT_INI_ARRAY(&ah->iniModes_normal_power_tx_gain_9271,
57  return;
58  }
59 
65  if (ah->config.pcie_clock_req)
66  INIT_INI_ARRAY(&ah->iniPcieSerdes,
69  else
70  INIT_INI_ARRAY(&ah->iniPcieSerdes,
73  2);
74  } else if (AR_SREV_9285_12_OR_LATER(ah)) {
75 
76 
81 
82  if (ah->config.pcie_clock_req) {
83  INIT_INI_ARRAY(&ah->iniPcieSerdes,
86  } else {
87  INIT_INI_ARRAY(&ah->iniPcieSerdes,
90  2);
91  }
92  } else if (AR_SREV_9280_20_OR_LATER(ah)) {
97 
98  if (ah->config.pcie_clock_req) {
99  INIT_INI_ARRAY(&ah->iniPcieSerdes,
102  } else {
103  INIT_INI_ARRAY(&ah->iniPcieSerdes,
106  }
107  INIT_INI_ARRAY(&ah->iniModesAdditional,
110  } else if (AR_SREV_9160_10_OR_LATER(ah)) {
111  INIT_INI_ARRAY(&ah->iniModes, ar5416Modes_9160,
113  INIT_INI_ARRAY(&ah->iniCommon, ar5416Common_9160,
115  INIT_INI_ARRAY(&ah->iniBank0, ar5416Bank0_9160,
117  INIT_INI_ARRAY(&ah->iniBB_RfGain, ar5416BB_RfGain_9160,
119  INIT_INI_ARRAY(&ah->iniBank1, ar5416Bank1_9160,
121  INIT_INI_ARRAY(&ah->iniBank2, ar5416Bank2_9160,
123  INIT_INI_ARRAY(&ah->iniBank3, ar5416Bank3_9160,
125  INIT_INI_ARRAY(&ah->iniBank6, ar5416Bank6_9160,
127  INIT_INI_ARRAY(&ah->iniBank6TPC, ar5416Bank6TPC_9160,
129  INIT_INI_ARRAY(&ah->iniBank7, ar5416Bank7_9160,
131  if (AR_SREV_9160_11(ah)) {
132  INIT_INI_ARRAY(&ah->iniAddac,
135  } else {
136  INIT_INI_ARRAY(&ah->iniAddac, ar5416Addac_9160,
138  }
139  } else if (AR_SREV_9100_OR_LATER(ah)) {
140  INIT_INI_ARRAY(&ah->iniModes, ar5416Modes_9100,
142  INIT_INI_ARRAY(&ah->iniCommon, ar5416Common_9100,
144  INIT_INI_ARRAY(&ah->iniBank0, ar5416Bank0_9100,
146  INIT_INI_ARRAY(&ah->iniBB_RfGain, ar5416BB_RfGain_9100,
148  INIT_INI_ARRAY(&ah->iniBank1, ar5416Bank1_9100,
150  INIT_INI_ARRAY(&ah->iniBank2, ar5416Bank2_9100,
152  INIT_INI_ARRAY(&ah->iniBank3, ar5416Bank3_9100,
154  INIT_INI_ARRAY(&ah->iniBank6, ar5416Bank6_9100,
156  INIT_INI_ARRAY(&ah->iniBank6TPC, ar5416Bank6TPC_9100,
158  INIT_INI_ARRAY(&ah->iniBank7, ar5416Bank7_9100,
160  INIT_INI_ARRAY(&ah->iniAddac, ar5416Addac_9100,
162  } else {
163  INIT_INI_ARRAY(&ah->iniModes, ar5416Modes,
164  ARRAY_SIZE(ar5416Modes), 6);
165  INIT_INI_ARRAY(&ah->iniCommon, ar5416Common,
167  INIT_INI_ARRAY(&ah->iniBank0, ar5416Bank0,
168  ARRAY_SIZE(ar5416Bank0), 2);
169  INIT_INI_ARRAY(&ah->iniBB_RfGain, ar5416BB_RfGain,
171  INIT_INI_ARRAY(&ah->iniBank1, ar5416Bank1,
172  ARRAY_SIZE(ar5416Bank1), 2);
173  INIT_INI_ARRAY(&ah->iniBank2, ar5416Bank2,
174  ARRAY_SIZE(ar5416Bank2), 2);
175  INIT_INI_ARRAY(&ah->iniBank3, ar5416Bank3,
176  ARRAY_SIZE(ar5416Bank3), 3);
177  INIT_INI_ARRAY(&ah->iniBank6, ar5416Bank6,
178  ARRAY_SIZE(ar5416Bank6), 3);
179  INIT_INI_ARRAY(&ah->iniBank6TPC, ar5416Bank6TPC,
181  INIT_INI_ARRAY(&ah->iniBank7, ar5416Bank7,
182  ARRAY_SIZE(ar5416Bank7), 2);
183  INIT_INI_ARRAY(&ah->iniAddac, ar5416Addac,
184  ARRAY_SIZE(ar5416Addac), 2);
185  }
186 }
static const u32 ar5416Bank1[][2]
static __unused const u32 ar9287PciePhy_clkreq_always_on_L1_9287_1_1[][2]
#define AR_SREV_9287_11_OR_LATER(_ah)
Definition: reg.h:837
static const u32 ar5416Bank6TPC_9160[][3]
static const u32 ar5416BB_RfGain_9160[][3]
static __unused const u32 ar9280PciePhy_clkreq_always_on_L1_9280[][2]
static const u32 ar5416Bank7_9160[][2]
#define AR_SREV_9280_20_OR_LATER(_ah)
Definition: reg.h:825
static __unused const u32 ar9285PciePhy_clkreq_always_on_L1_9285_1_2[][2]
static const u32 ar5416Bank6TPC[][3]
static const u32 ar5416Bank3[][3]
static __unused const u32 ar9280Modes_9280_2[][6]
#define AR_SREV_9160_11(_ah)
Definition: reg.h:820
static __unused const u32 ar9271Modes_high_power_tx_gain_9271[][6]
#define AR_SREV_9100_OR_LATER(_ah)
Definition: reg.h:813
static const u32 ar5416Bank6_9100[][3]
static const u32 ar5416Addac_9160[][2]
static const u32 ar5416Bank1_9160[][2]
static __unused const u32 ar9287Modes_9287_1_1[][6]
static const u32 ar5416Common_9160[][2]
static const u32 ar5416Modes[][6]
static const u32 ar5416Bank2_9100[][2]
static const u32 ar5416BB_RfGain_9100[][3]
static __unused const u32 ar9271Modes_9271[][6]
static __unused const u32 ar9280PciePhy_clkreq_off_L1_9280[][2]
static const u32 ar5416Common[][2]
static const u32 ar5416Bank6[][3]
static const u32 ar5416Bank6_9160[][3]
static __unused const u32 ar9271Common_normal_cck_fir_coeff_9271[][2]
static const u32 ar5416Addac[][2]
static __unused const u32 ar9280Modes_fast_clock_9280_2[][3]
static __unused const u32 ar9287Common_9287_1_1[][2]
static const u32 ar5416BB_RfGain[][3]
static __unused const u32 ar9271Common_japan_2484_cck_fir_coeff_9271[][2]
static __unused const u32 ar9271Modes_9271_1_0_only[][6]
static const u32 ar5416Bank2[][2]
#define ARRAY_SIZE(x)
Definition: efx_common.h:43
static __unused const u32 ar9271Common_9271[][2]
#define AR_SREV_9285_12_OR_LATER(_ah)
Definition: reg.h:832
static __unused const u32 ar9280Common_9280_2[][2]
static __unused const u32 ar9287PciePhy_clkreq_off_L1_9287_1_1[][2]
static __unused const u32 ar9285PciePhy_clkreq_off_L1_9285_1_2[][2]
static __unused const u32 ar9271Modes_9271_ANI_reg[][6]
static __unused const u32 ar9285Common_9285_1_2[][2]
static const u32 ar5416Bank0[][2]
static const u32 ar5416Bank3_9100[][3]
static const u32 ar5416Modes_9160[][6]
static const u32 ar5416Bank2_9160[][2]
static const u32 ar5416Addac_9100[][2]
#define INIT_INI_ARRAY(iniarray, array, rows, columns)
Definition: calib.h:40
static const u32 ar5416Addac_9160_1_1[][2]
static const u32 ar5416Common_9100[][2]
static __unused const u32 ar9271Modes_normal_power_tx_gain_9271[][6]
static const u32 ar5416Bank6TPC_9100[][3]
#define AR_SREV_9271(_ah)
Definition: reg.h:854
static const u32 ar5416Bank0_9100[][2]
uint8_t ah
Definition: registers.h:85
#define AR_SREV_9160_10_OR_LATER(_ah)
Definition: reg.h:818
static const u32 ar5416Bank7_9100[][2]
static const u32 ar5416Bank0_9160[][2]
static const u32 ar5416Bank1_9100[][2]
static const u32 ar5416Modes_9100[][6]
static const u32 ar5416Bank7[][2]
static const u32 ar5416Bank3_9160[][3]
static __unused const u32 ar9285Modes_9285_1_2[][6]

References ah, ar5416Addac, ar5416Addac_9100, ar5416Addac_9160, ar5416Addac_9160_1_1, ar5416Bank0, ar5416Bank0_9100, ar5416Bank0_9160, ar5416Bank1, ar5416Bank1_9100, ar5416Bank1_9160, ar5416Bank2, ar5416Bank2_9100, ar5416Bank2_9160, ar5416Bank3, ar5416Bank3_9100, ar5416Bank3_9160, ar5416Bank6, ar5416Bank6_9100, ar5416Bank6_9160, ar5416Bank6TPC, ar5416Bank6TPC_9100, ar5416Bank6TPC_9160, ar5416Bank7, ar5416Bank7_9100, ar5416Bank7_9160, ar5416BB_RfGain, ar5416BB_RfGain_9100, ar5416BB_RfGain_9160, ar5416Common, ar5416Common_9100, ar5416Common_9160, ar5416Modes, ar5416Modes_9100, ar5416Modes_9160, ar9271Common_9271, ar9271Common_japan_2484_cck_fir_coeff_9271, ar9271Common_normal_cck_fir_coeff_9271, ar9271Modes_9271, ar9271Modes_9271_1_0_only, ar9271Modes_9271_ANI_reg, ar9271Modes_high_power_tx_gain_9271, ar9271Modes_normal_power_tx_gain_9271, ar9280Common_9280_2, ar9280Modes_9280_2, ar9280Modes_fast_clock_9280_2, ar9280PciePhy_clkreq_always_on_L1_9280, ar9280PciePhy_clkreq_off_L1_9280, ar9285Common_9285_1_2, ar9285Modes_9285_1_2, ar9285PciePhy_clkreq_always_on_L1_9285_1_2, ar9285PciePhy_clkreq_off_L1_9285_1_2, ar9287Common_9287_1_1, ar9287Modes_9287_1_1, ar9287PciePhy_clkreq_always_on_L1_9287_1_1, ar9287PciePhy_clkreq_off_L1_9287_1_1, AR_SREV_9100_OR_LATER, AR_SREV_9160_10_OR_LATER, AR_SREV_9160_11, AR_SREV_9271, AR_SREV_9280_20_OR_LATER, AR_SREV_9285_12_OR_LATER, AR_SREV_9287_11_OR_LATER, ARRAY_SIZE, and INIT_INI_ARRAY.

Referenced by ar9002_hw_attach_ops().

◆ ar9002_hw_cck_chan14_spread()

void ar9002_hw_cck_chan14_spread ( struct ath_hw ah)

Definition at line 189 of file ath9k_ar9002_hw.c.

190 {
192  INIT_INI_ARRAY(&ah->iniCckfirNormal,
195  2);
196  INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
199  2);
200  }
201 }
#define AR_SREV_9287_11_OR_LATER(_ah)
Definition: reg.h:837
#define ARRAY_SIZE(x)
Definition: efx_common.h:43
static __unused const u32 ar9287Common_normal_cck_fir_coeff_9287_1_1[][2]
#define INIT_INI_ARRAY(iniarray, array, rows, columns)
Definition: calib.h:40
uint8_t ah
Definition: registers.h:85
static __unused const u32 ar9287Common_japan_2484_cck_fir_coeff_9287_1_1[][2]

References ah, ar9287Common_japan_2484_cck_fir_coeff_9287_1_1, ar9287Common_normal_cck_fir_coeff_9287_1_1, AR_SREV_9287_11_OR_LATER, ARRAY_SIZE, and INIT_INI_ARRAY.

Referenced by __ath9k_hw_init().

◆ ar9280_20_hw_init_rxgain_ini()

static void ar9280_20_hw_init_rxgain_ini ( struct ath_hw ah)
static

Definition at line 203 of file ath9k_ar9002_hw.c.

204 {
205  u32 rxgain_type;
206 
207  if (ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV) >=
209  rxgain_type = ah->eep_ops->get_eeprom(ah, EEP_RXGAIN_TYPE);
210 
211  if (rxgain_type == AR5416_EEP_RXGAIN_13DB_BACKOFF)
212  INIT_INI_ARRAY(&ah->iniModesRxGain,
215  else if (rxgain_type == AR5416_EEP_RXGAIN_23DB_BACKOFF)
216  INIT_INI_ARRAY(&ah->iniModesRxGain,
219  else
220  INIT_INI_ARRAY(&ah->iniModesRxGain,
223  } else {
224  INIT_INI_ARRAY(&ah->iniModesRxGain,
227  }
228 }
#define AR5416_EEP_MINOR_VER_17
Definition: eeprom.h:139
#define AR5416_EEP_RXGAIN_23DB_BACKOFF
Definition: eeprom.h:165
static __unused const u32 ar9280Modes_original_rxgain_9280_2[][6]
static __unused const u32 ar9280Modes_backoff_13db_rxgain_9280_2[][6]
#define ARRAY_SIZE(x)
Definition: efx_common.h:43
#define INIT_INI_ARRAY(iniarray, array, rows, columns)
Definition: calib.h:40
#define AR5416_EEP_RXGAIN_13DB_BACKOFF
Definition: eeprom.h:166
uint8_t ah
Definition: registers.h:85
uint32_t u32
Definition: stdint.h:24
static __unused const u32 ar9280Modes_backoff_23db_rxgain_9280_2[][6]

References ah, AR5416_EEP_MINOR_VER_17, AR5416_EEP_RXGAIN_13DB_BACKOFF, AR5416_EEP_RXGAIN_23DB_BACKOFF, ar9280Modes_backoff_13db_rxgain_9280_2, ar9280Modes_backoff_23db_rxgain_9280_2, ar9280Modes_original_rxgain_9280_2, ARRAY_SIZE, EEP_MINOR_REV, EEP_RXGAIN_TYPE, and INIT_INI_ARRAY.

Referenced by ar9002_hw_init_mode_gain_regs().

◆ ar9280_20_hw_init_txgain_ini()

static void ar9280_20_hw_init_txgain_ini ( struct ath_hw ah)
static

Definition at line 230 of file ath9k_ar9002_hw.c.

231 {
232  u32 txgain_type;
233 
234  if (ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV) >=
236  txgain_type = ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE);
237 
238  if (txgain_type == AR5416_EEP_TXGAIN_HIGH_POWER)
239  INIT_INI_ARRAY(&ah->iniModesTxGain,
242  else
243  INIT_INI_ARRAY(&ah->iniModesTxGain,
246  } else {
247  INIT_INI_ARRAY(&ah->iniModesTxGain,
250  }
251 }
#define AR5416_EEP_TXGAIN_HIGH_POWER
Definition: eeprom.h:171
#define ARRAY_SIZE(x)
Definition: efx_common.h:43
static __unused const u32 ar9280Modes_original_tx_gain_9280_2[][6]
static __unused const u32 ar9280Modes_high_power_tx_gain_9280_2[][6]
#define INIT_INI_ARRAY(iniarray, array, rows, columns)
Definition: calib.h:40
uint8_t ah
Definition: registers.h:85
uint32_t u32
Definition: stdint.h:24
#define AR5416_EEP_MINOR_VER_19
Definition: eeprom.h:140

References ah, AR5416_EEP_MINOR_VER_19, AR5416_EEP_TXGAIN_HIGH_POWER, ar9280Modes_high_power_tx_gain_9280_2, ar9280Modes_original_tx_gain_9280_2, ARRAY_SIZE, EEP_MINOR_REV, EEP_TXGAIN_TYPE, and INIT_INI_ARRAY.

Referenced by ar9002_hw_init_mode_gain_regs().

◆ ar9002_hw_init_mode_gain_regs()

static void ar9002_hw_init_mode_gain_regs ( struct ath_hw ah)
static

Definition at line 253 of file ath9k_ar9002_hw.c.

254 {
256  INIT_INI_ARRAY(&ah->iniModesRxGain,
259  else if (AR_SREV_9280_20(ah))
261 
263  INIT_INI_ARRAY(&ah->iniModesTxGain,
266  } else if (AR_SREV_9280_20(ah)) {
268  } else if (AR_SREV_9285_12_OR_LATER(ah)) {
269  u32 txgain_type = ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE);
270 
271  /* txgain table */
272  if (txgain_type == AR5416_EEP_TXGAIN_HIGH_POWER) {
273  if (AR_SREV_9285E_20(ah)) {
274  INIT_INI_ARRAY(&ah->iniModesTxGain,
276  ARRAY_SIZE(
278  } else {
279  INIT_INI_ARRAY(&ah->iniModesTxGain,
281  ARRAY_SIZE(
283  }
284  } else {
285  if (AR_SREV_9285E_20(ah)) {
286  INIT_INI_ARRAY(&ah->iniModesTxGain,
288  ARRAY_SIZE(
290  } else {
291  INIT_INI_ARRAY(&ah->iniModesTxGain,
293  ARRAY_SIZE(
295  }
296  }
297  }
298 }
#define AR_SREV_9287_11_OR_LATER(_ah)
Definition: reg.h:837
static __unused const u32 ar9285Modes_XE2_0_normal_power[][6]
static __unused const u32 ar9285Modes_high_power_tx_gain_9285_1_2[][6]
#define AR5416_EEP_TXGAIN_HIGH_POWER
Definition: eeprom.h:171
#define AR_SREV_9280_20(_ah)
Definition: reg.h:827
static __unused const u32 ar9287Modes_tx_gain_9287_1_1[][6]
static __unused const u32 ar9285Modes_original_tx_gain_9285_1_2[][6]
static void ar9280_20_hw_init_txgain_ini(struct ath_hw *ah)
#define ARRAY_SIZE(x)
Definition: efx_common.h:43
#define AR_SREV_9285_12_OR_LATER(_ah)
Definition: reg.h:832
#define AR_SREV_9285E_20(_ah)
Definition: reg.h:882
#define INIT_INI_ARRAY(iniarray, array, rows, columns)
Definition: calib.h:40
static void ar9280_20_hw_init_rxgain_ini(struct ath_hw *ah)
static __unused const u32 ar9287Modes_rx_gain_9287_1_1[][6]
uint8_t ah
Definition: registers.h:85
uint32_t u32
Definition: stdint.h:24
static __unused const u32 ar9285Modes_XE2_0_high_power[][6]

References ah, AR5416_EEP_TXGAIN_HIGH_POWER, ar9280_20_hw_init_rxgain_ini(), ar9280_20_hw_init_txgain_ini(), ar9285Modes_high_power_tx_gain_9285_1_2, ar9285Modes_original_tx_gain_9285_1_2, ar9285Modes_XE2_0_high_power, ar9285Modes_XE2_0_normal_power, ar9287Modes_rx_gain_9287_1_1, ar9287Modes_tx_gain_9287_1_1, AR_SREV_9280_20, AR_SREV_9285_12_OR_LATER, AR_SREV_9285E_20, AR_SREV_9287_11_OR_LATER, ARRAY_SIZE, EEP_TXGAIN_TYPE, and INIT_INI_ARRAY.

Referenced by ar9002_hw_attach_ops().

◆ ar9002_hw_configpcipowersave()

static void ar9002_hw_configpcipowersave ( struct ath_hw ah,
int  restore,
int  power_off 
)
static

Definition at line 309 of file ath9k_ar9002_hw.c.

312 {
313  u8 i;
314  u32 val;
315 
316  if (ah->is_pciexpress != 1)
317  return;
318 
319  /* Do not touch SerDes registers */
320  if (ah->config.pcie_powersave_enable == 2)
321  return;
322 
323  /* Nothing to do on restore for 11N */
324  if (!restore) {
326  /*
327  * AR9280 2.0 or later chips use SerDes values from the
328  * initvals.h initialized depending on chipset during
329  * __ath9k_hw_init()
330  */
331  for (i = 0; i < ah->iniPcieSerdes.ia_rows; i++) {
332  REG_WRITE(ah, INI_RA(&ah->iniPcieSerdes, i, 0),
333  INI_RA(&ah->iniPcieSerdes, i, 1));
334  }
335  } else {
337 
338  REG_WRITE(ah, AR_PCIE_SERDES, 0x9248fc00);
339  REG_WRITE(ah, AR_PCIE_SERDES, 0x24924924);
340 
341  /* RX shut off when elecidle is asserted */
342  REG_WRITE(ah, AR_PCIE_SERDES, 0x28000039);
343  REG_WRITE(ah, AR_PCIE_SERDES, 0x53160824);
344  REG_WRITE(ah, AR_PCIE_SERDES, 0xe5980579);
345 
346  /*
347  * Ignore ah->ah_config.pcie_clock_req setting for
348  * pre-AR9280 11n
349  */
350  REG_WRITE(ah, AR_PCIE_SERDES, 0x001defff);
351 
352  REG_WRITE(ah, AR_PCIE_SERDES, 0x1aaabe40);
353  REG_WRITE(ah, AR_PCIE_SERDES, 0xbe105554);
354  REG_WRITE(ah, AR_PCIE_SERDES, 0x000e3007);
355 
356  /* Load the new settings */
357  REG_WRITE(ah, AR_PCIE_SERDES2, 0x00000000);
358 
360  }
361 
362  udelay(1000);
363  }
364 
365  if (power_off) {
366  /* clear bit 19 to disable L1 */
368 
369  val = REG_READ(ah, AR_WA);
370 
371  /*
372  * Set PCIe workaround bits
373  * In AR9280 and AR9285, bit 14 in WA register (disable L1)
374  * should only be set when device enters D3 and be
375  * cleared when device comes back to D0.
376  */
377  if (ah->config.pcie_waen) {
378  if (ah->config.pcie_waen & AR_WA_D3_L1_DISABLE)
380  } else {
381  if (((AR_SREV_9285(ah) ||
382  AR_SREV_9271(ah) ||
383  AR_SREV_9287(ah)) &&
385  (AR_SREV_9280(ah) &&
388  }
389  }
390 
391  if (AR_SREV_9280(ah) || AR_SREV_9285(ah) || AR_SREV_9287(ah)) {
392  /*
393  * Disable bit 6 and 7 before entering D3 to
394  * prevent system hang.
395  */
396  val &= ~(AR_WA_BIT6 | AR_WA_BIT7);
397  }
398 
399  if (AR_SREV_9280(ah))
400  val |= AR_WA_BIT22;
401 
402  if (AR_SREV_9285E_20(ah))
403  val |= AR_WA_BIT23;
404 
405  REG_WRITE(ah, AR_WA, val);
406  } else {
407  if (ah->config.pcie_waen) {
408  val = ah->config.pcie_waen;
409  if (!power_off)
410  val &= (~AR_WA_D3_L1_DISABLE);
411  } else {
412  if (AR_SREV_9285(ah) ||
413  AR_SREV_9271(ah) ||
414  AR_SREV_9287(ah)) {
416  if (!power_off)
417  val &= (~AR_WA_D3_L1_DISABLE);
418  }
419  else if (AR_SREV_9280(ah)) {
420  /*
421  * For AR9280 chips, bit 22 of 0x4004
422  * needs to be set.
423  */
425  if (!power_off)
426  val &= (~AR_WA_D3_L1_DISABLE);
427  } else {
428  val = AR_WA_DEFAULT;
429  }
430  }
431 
432  /* WAR for ASPM system hang */
433  if (AR_SREV_9285(ah) || AR_SREV_9287(ah))
434  val |= (AR_WA_BIT6 | AR_WA_BIT7);
435 
436  if (AR_SREV_9285E_20(ah))
437  val |= AR_WA_BIT23;
438 
439  REG_WRITE(ah, AR_WA, val);
440 
441  /* set bit 19 to allow forcing of pcie core into L1 state */
443  }
444 }
#define AR_PCIE_SERDES
Definition: reg.h:982
#define AR_SREV_9280_20_OR_LATER(_ah)
Definition: reg.h:825
void __asmcall int val
Definition: setjmp.h:12
#define INI_RA(iniarray, row, column)
Definition: calib.h:46
#define REG_CLR_BIT(_a, _r, _f)
Definition: hw.h:110
#define REGWRITE_BUFFER_FLUSH(_ah)
Definition: hw.h:96
#define AR_WA_BIT6
Definition: reg.h:700
#define AR_SREV_9285(_ah)
Definition: reg.h:830
#define AR_PCIE_SERDES2
Definition: reg.h:983
#define AR_SREV_9287(_ah)
Definition: reg.h:835
#define AR_WA_D3_L1_DISABLE
Definition: reg.h:703
#define AR9280_WA_DEFAULT
Definition: reg.h:711
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:61
#define AR_WA_BIT7
Definition: reg.h:701
#define AR_WA_BIT22
Definition: reg.h:709
#define AR9285_WA_DEFAULT
Definition: reg.h:710
#define AR_SREV_9280(_ah)
Definition: reg.h:823
#define AR_PCIE_PM_CTRL
Definition: reg.h:984
#define REG_READ(_ah, _reg)
Definition: hw.h:81
#define AR_SREV_9285E_20(_ah)
Definition: reg.h:882
#define REG_SET_BIT(_a, _r, _f)
Definition: hw.h:108
#define REG_WRITE(_ah, _reg, _val)
Definition: hw.h:78
#define AR_WA_BIT23
Definition: reg.h:702
#define AR_SREV_9271(_ah)
Definition: reg.h:854
#define AR_PCIE_PM_CTRL_ENA
Definition: reg.h:985
#define AR_WA
Definition: reg.h:699
uint8_t ah
Definition: registers.h:85
uint8_t u8
Definition: stdint.h:20
uint32_t u32
Definition: stdint.h:24
#define ENABLE_REGWRITE_BUFFER(_ah)
Definition: hw.h:90
#define AR_WA_DEFAULT
Definition: reg.h:712

References ah, AR9280_WA_DEFAULT, AR9285_WA_DEFAULT, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA, AR_PCIE_SERDES, AR_PCIE_SERDES2, AR_SREV_9271, AR_SREV_9280, AR_SREV_9280_20_OR_LATER, AR_SREV_9285, AR_SREV_9285E_20, AR_SREV_9287, AR_WA, AR_WA_BIT22, AR_WA_BIT23, AR_WA_BIT6, AR_WA_BIT7, AR_WA_D3_L1_DISABLE, AR_WA_DEFAULT, ENABLE_REGWRITE_BUFFER, INI_RA, REG_CLR_BIT, REG_READ, REG_SET_BIT, REG_WRITE, REGWRITE_BUFFER_FLUSH, udelay(), and val.

Referenced by ar9002_hw_attach_ops().

◆ ar9002_hw_get_radiorev()

static int ar9002_hw_get_radiorev ( struct ath_hw ah)
static

Definition at line 446 of file ath9k_ar9002_hw.c.

447 {
448  u32 val;
449  int i;
450 
452 
453  REG_WRITE(ah, AR_PHY(0x36), 0x00007058);
454  for (i = 0; i < 8; i++)
455  REG_WRITE(ah, AR_PHY(0x20), 0x00010000);
456 
458 
459  val = (REG_READ(ah, AR_PHY(256)) >> 24) & 0xff;
460  val = ((val & 0xf0) >> 4) | ((val & 0x0f) << 4);
461 
462  return ath9k_hw_reverse_bits(val, 8);
463 }
#define AR_PHY(_n)
Definition: phy.h:28
void __asmcall int val
Definition: setjmp.h:12
#define REGWRITE_BUFFER_FLUSH(_ah)
Definition: hw.h:96
#define REG_READ(_ah, _reg)
Definition: hw.h:81
#define REG_WRITE(_ah, _reg, _val)
Definition: hw.h:78
uint8_t ah
Definition: registers.h:85
uint32_t u32
Definition: stdint.h:24
#define ENABLE_REGWRITE_BUFFER(_ah)
Definition: hw.h:90
u32 ath9k_hw_reverse_bits(u32 val, u32 n)
Definition: ath9k_hw.c:127

References ah, AR_PHY, ath9k_hw_reverse_bits(), ENABLE_REGWRITE_BUFFER, REG_READ, REG_WRITE, REGWRITE_BUFFER_FLUSH, and val.

Referenced by ar9002_hw_rf_claim().

◆ ar9002_hw_rf_claim()

int ar9002_hw_rf_claim ( struct ath_hw ah)

Definition at line 465 of file ath9k_ar9002_hw.c.

466 {
467  u32 val;
468 
469  REG_WRITE(ah, AR_PHY(0), 0x00000007);
470 
472  switch (val & AR_RADIO_SREV_MAJOR) {
473  case 0:
475  break;
480  break;
481  default:
482  DBG("ath9k: "
483  "Radio Chip Rev 0x%02X not supported\n",
485  return -EOPNOTSUPP;
486  }
487 
488  ah->hw_version.analog5GhzRev = val;
489 
490  return 0;
491 }
#define AR_PHY(_n)
Definition: phy.h:28
#define AR_RAD5133_SREV_MAJOR
Definition: reg.h:897
#define AR_RAD5122_SREV_MAJOR
Definition: reg.h:899
void __asmcall int val
Definition: setjmp.h:12
static int ar9002_hw_get_radiorev(struct ath_hw *ah)
#define AR_RAD2122_SREV_MAJOR
Definition: reg.h:900
#define AR_RAD2133_SREV_MAJOR
Definition: reg.h:898
#define EOPNOTSUPP
Operation not supported on socket.
Definition: errno.h:605
#define REG_WRITE(_ah, _reg, _val)
Definition: hw.h:78
uint8_t ah
Definition: registers.h:85
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define AR_RADIO_SREV_MAJOR
Definition: reg.h:896
uint32_t u32
Definition: stdint.h:24

References ah, ar9002_hw_get_radiorev(), AR_PHY, AR_RAD2122_SREV_MAJOR, AR_RAD2133_SREV_MAJOR, AR_RAD5122_SREV_MAJOR, AR_RAD5133_SREV_MAJOR, AR_RADIO_SREV_MAJOR, DBG, EOPNOTSUPP, REG_WRITE, and val.

Referenced by ath9k_hw_post_init().

◆ ar9002_hw_enable_async_fifo()

void ar9002_hw_enable_async_fifo ( struct ath_hw ah)

Definition at line 493 of file ath9k_ar9002_hw.c.

494 {
503  }
504 }
#define REG_CLR_BIT(_a, _r, _f)
Definition: hw.h:110
#define AR_PHY_MODE_ASYNCFIFO
Definition: ar9002_phy.h:398
#define REG_SET_BIT(_a, _r, _f)
Definition: hw.h:108
#define AR_MAC_PCU_ASYNC_FIFO_REG3
Definition: reg.h:1846
#define AR_SREV_9287_13_OR_LATER(_ah)
Definition: reg.h:849
uint8_t ah
Definition: registers.h:85
#define AR_MAC_PCU_ASYNC_FIFO_REG3_DATAPATH_SEL
Definition: reg.h:1847
#define AR_PHY_MODE
Definition: ar9002_phy.h:397
#define AR_MAC_PCU_ASYNC_FIFO_REG3_SOFT_RESET
Definition: reg.h:1848

References ah, AR_MAC_PCU_ASYNC_FIFO_REG3, AR_MAC_PCU_ASYNC_FIFO_REG3_DATAPATH_SEL, AR_MAC_PCU_ASYNC_FIFO_REG3_SOFT_RESET, AR_PHY_MODE, AR_PHY_MODE_ASYNCFIFO, AR_SREV_9287_13_OR_LATER, REG_CLR_BIT, and REG_SET_BIT.

Referenced by ath9k_hw_reset().

◆ ar9002_hw_update_async_fifo()

void ar9002_hw_update_async_fifo ( struct ath_hw ah)

Definition at line 513 of file ath9k_ar9002_hw.c.

514 {
522 
525 
530  }
531 }
#define AR_D_GBL_IFS_EIFS_ASYNC_FIFO_DUR
Definition: reg.h:627
#define AR_TIME_OUT_ACK_CTS_ASYNC_FIFO_DUR
Definition: reg.h:1467
#define AR_D_GBL_IFS_SLOT_ASYNC_FIFO_DUR
Definition: reg.h:622
#define AR_D_GBL_IFS_SIFS
Definition: reg.h:604
#define AR_AHB_MODE
Definition: reg.h:902
#define AR_AHB_CUSTOM_BURST_EN
Definition: reg.h:911
#define REG_RMW_FIELD(_a, _r, _f, _v)
Definition: hw.h:104
#define AR_TIME_OUT
Definition: reg.h:1462
#define AR_D_GBL_IFS_SIFS_ASYNC_FIFO_DUR
Definition: reg.h:606
#define AR_USEC
Definition: reg.h:1477
#define AR_D_GBL_IFS_EIFS
Definition: reg.h:624
#define AR_MAC_PCU_LOGIC_ANALYZER
Definition: reg.h:1814
#define REG_SET_BIT(_a, _r, _f)
Definition: hw.h:108
#define AR_USEC_ASYNC_FIFO_DUR
Definition: reg.h:1483
#define REG_WRITE(_ah, _reg, _val)
Definition: hw.h:78
#define AR_SREV_9287_13_OR_LATER(_ah)
Definition: reg.h:849
uint8_t ah
Definition: registers.h:85
#define AR_MAC_PCU_LOGIC_ANALYZER_DISBUG20768
Definition: reg.h:1815
#define AR_AHB_CUSTOM_BURST_ASYNC_FIFO_VAL
Definition: reg.h:913
#define AR_D_GBL_IFS_SLOT
Definition: reg.h:619

References ah, AR_AHB_CUSTOM_BURST_ASYNC_FIFO_VAL, AR_AHB_CUSTOM_BURST_EN, AR_AHB_MODE, AR_D_GBL_IFS_EIFS, AR_D_GBL_IFS_EIFS_ASYNC_FIFO_DUR, AR_D_GBL_IFS_SIFS, AR_D_GBL_IFS_SIFS_ASYNC_FIFO_DUR, AR_D_GBL_IFS_SLOT, AR_D_GBL_IFS_SLOT_ASYNC_FIFO_DUR, AR_MAC_PCU_LOGIC_ANALYZER, AR_MAC_PCU_LOGIC_ANALYZER_DISBUG20768, AR_SREV_9287_13_OR_LATER, AR_TIME_OUT, AR_TIME_OUT_ACK_CTS_ASYNC_FIFO_DUR, AR_USEC, AR_USEC_ASYNC_FIFO_DUR, REG_RMW_FIELD, REG_SET_BIT, and REG_WRITE.

Referenced by ath9k_hw_reset().

◆ ar9002_hw_enable_wep_aggregation()

void ar9002_hw_enable_wep_aggregation ( struct ath_hw ah)

Definition at line 537 of file ath9k_ar9002_hw.c.

538 {
542  }
543 }
#define AR_PCU_MISC_MODE2_ENABLE_AGGWEP
Definition: reg.h:1841
#define AR_PCU_MISC_MODE2
Definition: reg.h:1831
#define REG_SET_BIT(_a, _r, _f)
Definition: hw.h:108
#define AR_SREV_9287_13_OR_LATER(_ah)
Definition: reg.h:849
uint8_t ah
Definition: registers.h:85

References ah, AR_PCU_MISC_MODE2, AR_PCU_MISC_MODE2_ENABLE_AGGWEP, AR_SREV_9287_13_OR_LATER, and REG_SET_BIT.

Referenced by ath9k_hw_reset().

◆ ar9002_hw_attach_ops()

void ar9002_hw_attach_ops ( struct ath_hw ah)

Definition at line 546 of file ath9k_ar9002_hw.c.

547 {
548  struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
549  struct ath_hw_ops *ops = ath9k_hw_ops(ah);
550 
553 
555 
559 
562 }
void ar5008_hw_attach_phy_ops(struct ath_hw *ah)
#define AR_SREV_9280_20_OR_LATER(_ah)
Definition: reg.h:825
struct ath_hw_private_ops - callbacks used internally by hardware code
Definition: hw.h:551
void ar9002_hw_attach_calib_ops(struct ath_hw *ah)
void ar9002_hw_attach_mac_ops(struct ath_hw *ah)
static void ar9002_hw_init_mode_regs(struct ath_hw *ah)
void(* init_mode_regs)(struct ath_hw *ah)
Definition: hw.h:556
static void ar9002_hw_init_mode_gain_regs(struct ath_hw *ah)
struct ath_hw_ops - callbacks used by hardware code and driver code
Definition: hw.h:604
void(* config_pci_powersave)(struct ath_hw *ah, int restore, int power_off)
Definition: hw.h:605
void(* init_mode_gain_regs)(struct ath_hw *ah)
Definition: hw.h:557
static struct ath_hw_ops * ath9k_hw_ops(struct ath_hw *ah)
Definition: hw.h:885
static void ar9002_hw_configpcipowersave(struct ath_hw *ah, int restore, int power_off)
uint8_t ah
Definition: registers.h:85
static struct ath_hw_private_ops * ath9k_hw_private_ops(struct ath_hw *ah)
Definition: hw.h:880
void ar9002_hw_attach_phy_ops(struct ath_hw *ah)

References ah, ar5008_hw_attach_phy_ops(), ar9002_hw_attach_calib_ops(), ar9002_hw_attach_mac_ops(), ar9002_hw_attach_phy_ops(), ar9002_hw_configpcipowersave(), ar9002_hw_init_mode_gain_regs(), ar9002_hw_init_mode_regs(), AR_SREV_9280_20_OR_LATER, ath9k_hw_ops(), ath9k_hw_private_ops(), ath_hw_ops::config_pci_powersave, ath_hw_private_ops::init_mode_gain_regs, and ath_hw_private_ops::init_mode_regs.

Referenced by ath9k_hw_attach_ops().

◆ ar9002_hw_load_ani_reg()

void ar9002_hw_load_ani_reg ( struct ath_hw ah,
struct ath9k_channel chan 
)

Definition at line 564 of file ath9k_ar9002_hw.c.

565 {
566  u32 modesIndex;
567  unsigned int i;
568 
569  switch (chan->chanmode) {
570  case CHANNEL_A:
571  case CHANNEL_A_HT20:
572  modesIndex = 1;
573  break;
574  case CHANNEL_A_HT40PLUS:
575  case CHANNEL_A_HT40MINUS:
576  modesIndex = 2;
577  break;
578  case CHANNEL_G:
579  case CHANNEL_G_HT20:
580  case CHANNEL_B:
581  modesIndex = 4;
582  break;
583  case CHANNEL_G_HT40PLUS:
584  case CHANNEL_G_HT40MINUS:
585  modesIndex = 3;
586  break;
587 
588  default:
589  return;
590  }
591 
593 
594  for (i = 0; i < ah->iniModes_9271_ANI_reg.ia_rows; i++) {
595  u32 reg = INI_RA(&ah->iniModes_9271_ANI_reg, i, 0);
596  u32 val = INI_RA(&ah->iniModes_9271_ANI_reg, i, modesIndex);
597  u32 val_orig;
598 
599  if (reg == AR_PHY_CCK_DETECT) {
600  val_orig = REG_READ(ah, reg);
603 
604  REG_WRITE(ah, reg, val|val_orig);
605  } else
606  REG_WRITE(ah, reg, val);
607  }
608 
610 }
u32 chanmode
Definition: hw.h:352
static unsigned int unsigned int reg
Definition: myson.h:162
void __asmcall int val
Definition: setjmp.h:12
#define INI_RA(iniarray, row, column)
Definition: calib.h:46
#define REGWRITE_BUFFER_FLUSH(_ah)
Definition: hw.h:96
#define CHANNEL_A_HT40MINUS
Definition: hw.h:323
#define CHANNEL_A
Definition: ath5k.h:640
#define CHANNEL_G
Definition: ath5k.h:642
#define AR_PHY_CCK_DETECT_WEAK_SIG_THR_CCK
Definition: ar9002_phy.h:415
#define CHANNEL_A_HT20
Definition: hw.h:319
#define AR_PHY_CCK_DETECT
Definition: ar9002_phy.h:414
#define REG_READ(_ah, _reg)
Definition: hw.h:81
#define REG_WRITE(_ah, _reg, _val)
Definition: hw.h:78
#define CHANNEL_A_HT40PLUS
Definition: hw.h:322
uint8_t ah
Definition: registers.h:85
#define CHANNEL_G_HT20
Definition: hw.h:318
#define CHANNEL_B
Definition: ath5k.h:641
#define CHANNEL_G_HT40PLUS
Definition: hw.h:320
#define CHANNEL_G_HT40MINUS
Definition: hw.h:321
uint32_t u32
Definition: stdint.h:24
#define ENABLE_REGWRITE_BUFFER(_ah)
Definition: hw.h:90

References ah, AR_PHY_CCK_DETECT, AR_PHY_CCK_DETECT_WEAK_SIG_THR_CCK, ath9k_channel::chanmode, CHANNEL_A, CHANNEL_A_HT20, CHANNEL_A_HT40MINUS, CHANNEL_A_HT40PLUS, CHANNEL_B, CHANNEL_G, CHANNEL_G_HT20, CHANNEL_G_HT40MINUS, CHANNEL_G_HT40PLUS, ENABLE_REGWRITE_BUFFER, INI_RA, reg, REG_READ, REG_WRITE, REGWRITE_BUFFER_FLUSH, and val.

Referenced by ath9k_hw_reset().

Variable Documentation

◆ modparam_force_new_ani

int modparam_force_new_ani

Definition at line 29 of file ath9k_ar9002_hw.c.

Referenced by ar5008_hw_attach_phy_ops(), and use_new_ani().