iPXE
Functions
ath9k_ar9003_hw.c File Reference
#include "hw.h"
#include "ar9003_mac.h"
#include "ar9003_2p2_initvals.h"
#include "ar9485_initvals.h"
#include "ar9340_initvals.h"

Go to the source code of this file.

Functions

static void ar9003_hw_init_mode_regs (struct ath_hw *ah)
 
static void ar9003_tx_gain_table_apply (struct ath_hw *ah)
 
static void ar9003_rx_gain_table_apply (struct ath_hw *ah)
 
static void ar9003_hw_init_mode_gain_regs (struct ath_hw *ah)
 
static void ar9003_hw_configpcipowersave (struct ath_hw *ah, int restore, int power_off)
 
void ar9003_hw_attach_ops (struct ath_hw *ah)
 

Function Documentation

◆ ar9003_hw_init_mode_regs()

static void ar9003_hw_init_mode_regs ( struct ath_hw ah)
static

Definition at line 33 of file ath9k_ar9003_hw.c.

34 {
35  if (AR_SREV_9340(ah)) {
36  /* mac */
37  INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
38  INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
41  INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
44 
45  /* bb */
46  INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
53 
54  /* radio */
55  INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
56  INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
59  INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
62 
63  /* soc */
64  INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
67  INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
68  INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
71 
72  /* rx/tx gain */
73  INIT_INI_ARRAY(&ah->iniModesRxGain,
76  5);
77  INIT_INI_ARRAY(&ah->iniModesTxGain,
80  5);
81 
82  INIT_INI_ARRAY(&ah->iniModesAdditional,
85  3);
86 
87  INIT_INI_ARRAY(&ah->iniModesAdditional_40M,
90  2);
91  } else if (AR_SREV_9485_11(ah)) {
92  /* mac */
93  INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
94  INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
97  INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
100 
101  /* bb */
103  ARRAY_SIZE(ar9485_1_1), 2);
104  INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
107  INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
110 
111  /* radio */
112  INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
113  INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
116  INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
119 
120  /* soc */
121  INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
124  INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
125  INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], NULL, 0, 0);
126 
127  /* rx/tx gain */
128  INIT_INI_ARRAY(&ah->iniModesRxGain,
131  INIT_INI_ARRAY(&ah->iniModesTxGain,
134  5);
135 
136  /* Load PCIE SERDES settings from INI */
137 
138  /* Awake Setting */
139 
140  INIT_INI_ARRAY(&ah->iniPcieSerdes,
143  2);
144 
145  /* Sleep Setting */
146 
147  INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
150  2);
151  } else {
152  /* mac */
153  INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
154  INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
157  INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
160 
161  /* bb */
162  INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
163  INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
166  INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
169 
170  /* radio */
171  INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
172  INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
175  INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
178 
179  /* soc */
180  INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
183  INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
184  INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
187 
188  /* rx/tx gain */
189  INIT_INI_ARRAY(&ah->iniModesRxGain,
192  INIT_INI_ARRAY(&ah->iniModesTxGain,
195  5);
196 
197  /* Load PCIE SERDES settings from INI */
198 
199  /* Awake Setting */
200 
201  INIT_INI_ARRAY(&ah->iniPcieSerdes,
204  2);
205 
206  /* Sleep Setting */
207 
208  INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
211  2);
212 
213  /* Fast clock modal settings */
214  INIT_INI_ARRAY(&ah->iniModesAdditional,
217  3);
218  }
219 }
static __unused const u32 ar9485Common_wo_xlna_rx_gain_1_1[][2]
static __unused const u32 ar9340_1p0_mac_postamble[][5]
static __unused const u32 ar9300_2p2_mac_postamble[][5]
static __unused const u32 ar9340_1p0_soc_postamble[][5]
static __unused const u32 ar9340_1p0_radio_core[][2]
static __unused const u32 ar9300_2p2_radio_core[][2]
static __unused const u32 ar9300_2p2_radio_postamble[][5]
static __unused const u32 ar9300_2p2_baseband_core[][2]
static __unused const u32 ar9300_2p2_soc_preamble[][2]
static __unused const u32 ar9300_2p2_soc_postamble[][5]
static __unused const u32 ar9485_1_1_baseband_core[][2]
static __unused const u32 ar9485_1_1_radio_postamble[][2]
static __unused const u32 ar9485_1_1_radio_core[][2]
static __unused const u32 ar9340Modes_fast_clock_1p0[][3]
static __unused const u32 ar9300Modes_lowest_ob_db_tx_gain_table_2p2[][5]
static __unused const u32 ar9340Common_wo_xlna_rx_gain_table_1p0[][2]
static __unused const u32 ar9485_1_1_pcie_phy_clkreq_disable_L1[][2]
static __unused const u32 ar9300_2p2_mac_core[][2]
#define AR_SREV_9485_11(_ah)
Definition: reg.h:872
#define AR_SREV_9340(_ah)
Definition: reg.h:878
static __unused const u32 ar9300PciePhy_pll_on_clkreq_disable_L1_2p2[][2]
static __unused const u32 ar9300_2p2_baseband_postamble[][5]
static __unused const u32 ar9485_1_1_mac_postamble[][5]
static __unused const u32 ar9485_1_1_soc_preamble[][2]
static __unused const u32 ar9485_1_1_baseband_postamble[][5]
static __unused const u32 ar9300Common_rx_gain_table_2p2[][2]
#define ARRAY_SIZE(x)
Definition: efx_common.h:43
static __unused const u32 ar9340_1p0_soc_preamble[][2]
static __unused const u32 ar9340_1p0_radio_postamble[][5]
static __unused const u32 ar9340_1p0_baseband_postamble[][5]
static __unused const u32 ar9485_modes_lowest_ob_db_tx_gain_1_1[][5]
#define INIT_INI_ARRAY(iniarray, array, rows, columns)
Definition: calib.h:39
static __unused const u32 ar9340_1p0_mac_core[][2]
static __unused const u32 ar9300Modes_fast_clock_2p2[][3]
static __unused const u32 ar9485_1_1[][2]
static __unused const u32 ar9340Modes_high_ob_db_tx_gain_table_1p0[][5]
static __unused const u32 ar9340_1p0_radio_core_40M[][2]
static __unused const u32 ar9485_1_1_mac_core[][2]
uint8_t ah
Definition: registers.h:85
static __unused const u32 ar9340_1p0_baseband_core[][2]
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References ah, ar9300_2p2_baseband_core, ar9300_2p2_baseband_postamble, ar9300_2p2_mac_core, ar9300_2p2_mac_postamble, ar9300_2p2_radio_core, ar9300_2p2_radio_postamble, ar9300_2p2_soc_postamble, ar9300_2p2_soc_preamble, ar9300Common_rx_gain_table_2p2, ar9300Modes_fast_clock_2p2, ar9300Modes_lowest_ob_db_tx_gain_table_2p2, ar9300PciePhy_pll_on_clkreq_disable_L1_2p2, ar9340_1p0_baseband_core, ar9340_1p0_baseband_postamble, ar9340_1p0_mac_core, ar9340_1p0_mac_postamble, ar9340_1p0_radio_core, ar9340_1p0_radio_core_40M, ar9340_1p0_radio_postamble, ar9340_1p0_soc_postamble, ar9340_1p0_soc_preamble, ar9340Common_wo_xlna_rx_gain_table_1p0, ar9340Modes_fast_clock_1p0, ar9340Modes_high_ob_db_tx_gain_table_1p0, ar9485_1_1, ar9485_1_1_baseband_core, ar9485_1_1_baseband_postamble, ar9485_1_1_mac_core, ar9485_1_1_mac_postamble, ar9485_1_1_pcie_phy_clkreq_disable_L1, ar9485_1_1_radio_core, ar9485_1_1_radio_postamble, ar9485_1_1_soc_preamble, ar9485_modes_lowest_ob_db_tx_gain_1_1, ar9485Common_wo_xlna_rx_gain_1_1, AR_SREV_9340, AR_SREV_9485_11, ARRAY_SIZE, ATH_INI_CORE, ATH_INI_POST, ATH_INI_PRE, INIT_INI_ARRAY, and NULL.

Referenced by ar9003_hw_attach_ops().

◆ ar9003_tx_gain_table_apply()

static void ar9003_tx_gain_table_apply ( struct ath_hw ah)
static

Definition at line 221 of file ath9k_ar9003_hw.c.

222 {
223  switch (ar9003_hw_get_tx_gain_idx(ah)) {
224  case 0:
225  default:
226  if (AR_SREV_9340(ah))
227  INIT_INI_ARRAY(&ah->iniModesTxGain,
230  5);
231  else if (AR_SREV_9485_11(ah))
232  INIT_INI_ARRAY(&ah->iniModesTxGain,
235  5);
236  else
237  INIT_INI_ARRAY(&ah->iniModesTxGain,
240  5);
241  break;
242  case 1:
243  if (AR_SREV_9340(ah))
244  INIT_INI_ARRAY(&ah->iniModesTxGain,
247  5);
248  else if (AR_SREV_9485_11(ah))
249  INIT_INI_ARRAY(&ah->iniModesTxGain,
252  5);
253  else
254  INIT_INI_ARRAY(&ah->iniModesTxGain,
257  5);
258  break;
259  case 2:
260  if (AR_SREV_9340(ah))
261  INIT_INI_ARRAY(&ah->iniModesTxGain,
264  5);
265  else if (AR_SREV_9485_11(ah))
266  INIT_INI_ARRAY(&ah->iniModesTxGain,
269  5);
270  else
271  INIT_INI_ARRAY(&ah->iniModesTxGain,
274  5);
275  break;
276  case 3:
277  if (AR_SREV_9340(ah))
278  INIT_INI_ARRAY(&ah->iniModesTxGain,
281  5);
282  else if (AR_SREV_9485_11(ah))
283  INIT_INI_ARRAY(&ah->iniModesTxGain,
286  5);
287  else
288  INIT_INI_ARRAY(&ah->iniModesTxGain,
291  5);
292  break;
293  }
294 }
static __unused const u32 ar9300Modes_high_ob_db_tx_gain_table_2p2[][5]
static __unused const u32 ar9485Modes_low_ob_db_tx_gain_1_1[][5]
static __unused const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5]
static __unused const u32 ar9340Modes_lowest_ob_db_tx_gain_table_1p0[][5]
static __unused const u32 ar9300Modes_lowest_ob_db_tx_gain_table_2p2[][5]
#define AR_SREV_9485_11(_ah)
Definition: reg.h:872
#define AR_SREV_9340(_ah)
Definition: reg.h:878
#define ARRAY_SIZE(x)
Definition: efx_common.h:43
s32 ar9003_hw_get_tx_gain_idx(struct ath_hw *ah)
static __unused const u32 ar9485_modes_lowest_ob_db_tx_gain_1_1[][5]
static __unused const u32 ar9485Modes_high_ob_db_tx_gain_1_1[][5]
#define INIT_INI_ARRAY(iniarray, array, rows, columns)
Definition: calib.h:39
static __unused const u32 ar9300Modes_low_ob_db_tx_gain_table_2p2[][5]
static __unused const u32 ar9485Modes_high_power_tx_gain_1_1[][5]
uint8_t ah
Definition: registers.h:85

References ah, ar9003_hw_get_tx_gain_idx(), ar9300Modes_high_ob_db_tx_gain_table_2p2, ar9300Modes_high_power_tx_gain_table_2p2, ar9300Modes_low_ob_db_tx_gain_table_2p2, ar9300Modes_lowest_ob_db_tx_gain_table_2p2, ar9340Modes_lowest_ob_db_tx_gain_table_1p0, ar9485_modes_lowest_ob_db_tx_gain_1_1, ar9485Modes_high_ob_db_tx_gain_1_1, ar9485Modes_high_power_tx_gain_1_1, ar9485Modes_low_ob_db_tx_gain_1_1, AR_SREV_9340, AR_SREV_9485_11, ARRAY_SIZE, and INIT_INI_ARRAY.

Referenced by ar9003_hw_init_mode_gain_regs().

◆ ar9003_rx_gain_table_apply()

static void ar9003_rx_gain_table_apply ( struct ath_hw ah)
static

Definition at line 296 of file ath9k_ar9003_hw.c.

297 {
298  switch (ar9003_hw_get_rx_gain_idx(ah)) {
299  case 0:
300  default:
301  if (AR_SREV_9340(ah))
302  INIT_INI_ARRAY(&ah->iniModesRxGain,
305  2);
306  else if (AR_SREV_9485_11(ah))
307  INIT_INI_ARRAY(&ah->iniModesRxGain,
310  2);
311  else
312  INIT_INI_ARRAY(&ah->iniModesRxGain,
315  2);
316  break;
317  case 1:
318  if (AR_SREV_9340(ah))
319  INIT_INI_ARRAY(&ah->iniModesRxGain,
322  2);
323  else if (AR_SREV_9485_11(ah))
324  INIT_INI_ARRAY(&ah->iniModesRxGain,
327  2);
328  else
329  INIT_INI_ARRAY(&ah->iniModesRxGain,
332  2);
333  break;
334  }
335 }
static __unused const u32 ar9485Common_wo_xlna_rx_gain_1_1[][2]
s32 ar9003_hw_get_rx_gain_idx(struct ath_hw *ah)
static __unused const u32 ar9340Common_rx_gain_table_1p0[][2]
static __unused const u32 ar9340Common_wo_xlna_rx_gain_table_1p0[][2]
#define AR_SREV_9485_11(_ah)
Definition: reg.h:872
#define AR_SREV_9340(_ah)
Definition: reg.h:878
static __unused const u32 ar9300Common_wo_xlna_rx_gain_table_2p2[][2]
static __unused const u32 ar9300Common_rx_gain_table_2p2[][2]
#define ARRAY_SIZE(x)
Definition: efx_common.h:43
#define INIT_INI_ARRAY(iniarray, array, rows, columns)
Definition: calib.h:39
uint8_t ah
Definition: registers.h:85

References ah, ar9003_hw_get_rx_gain_idx(), ar9300Common_rx_gain_table_2p2, ar9300Common_wo_xlna_rx_gain_table_2p2, ar9340Common_rx_gain_table_1p0, ar9340Common_wo_xlna_rx_gain_table_1p0, ar9485Common_wo_xlna_rx_gain_1_1, AR_SREV_9340, AR_SREV_9485_11, ARRAY_SIZE, and INIT_INI_ARRAY.

Referenced by ar9003_hw_init_mode_gain_regs().

◆ ar9003_hw_init_mode_gain_regs()

static void ar9003_hw_init_mode_gain_regs ( struct ath_hw ah)
static

Definition at line 338 of file ath9k_ar9003_hw.c.

339 {
342 }
static void ar9003_rx_gain_table_apply(struct ath_hw *ah)
uint8_t ah
Definition: registers.h:85
static void ar9003_tx_gain_table_apply(struct ath_hw *ah)

References ah, ar9003_rx_gain_table_apply(), and ar9003_tx_gain_table_apply().

Referenced by ar9003_hw_attach_ops().

◆ ar9003_hw_configpcipowersave()

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

Definition at line 353 of file ath9k_ar9003_hw.c.

356 {
357  if (ah->is_pciexpress != 1)
358  return;
359 
360  /* Do not touch SerDes registers */
361  if (ah->config.pcie_powersave_enable == 2)
362  return;
363 
364  /* Nothing to do on restore for 11N */
365  if (!restore) {
366  /* set bit 19 to allow forcing of pcie core into L1 state */
368 
369  /* Several PCIe massages to ensure proper behaviour */
370  if (ah->config.pcie_waen)
371  REG_WRITE(ah, AR_WA, ah->config.pcie_waen);
372  else
373  REG_WRITE(ah, AR_WA, ah->WARegVal);
374  }
375 
376  /*
377  * Configire PCIE after Ini init. SERDES values now come from ini file
378  * This enables PCIe low power mode.
379  */
380  if (ah->config.pcieSerDesWrite) {
381  unsigned int i;
382  struct ar5416IniArray *array;
383 
384  array = power_off ? &ah->iniPcieSerdes :
385  &ah->iniPcieSerdesLowPower;
386 
387  for (i = 0; i < array->ia_rows; i++) {
388  REG_WRITE(ah,
389  INI_RA(array, i, 0),
390  INI_RA(array, i, 1));
391  }
392  }
393 }
#define INI_RA(iniarray, row, column)
Definition: calib.h:45
uint32_t array
Array number.
Definition: edd.h:30
#define AR_PCIE_PM_CTRL
Definition: reg.h:983
#define REG_SET_BIT(_a, _r, _f)
Definition: hw.h:107
#define REG_WRITE(_ah, _reg, _val)
Definition: hw.h:77
#define AR_PCIE_PM_CTRL_ENA
Definition: reg.h:984
#define AR_WA
Definition: reg.h:698
uint8_t ah
Definition: registers.h:85

References ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA, AR_WA, array, INI_RA, REG_SET_BIT, and REG_WRITE.

Referenced by ar9003_hw_attach_ops().

◆ ar9003_hw_attach_ops()

void ar9003_hw_attach_ops ( struct ath_hw ah)

Definition at line 396 of file ath9k_ar9003_hw.c.

397 {
398  struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
399  struct ath_hw_ops *ops = ath9k_hw_ops(ah);
400 
403 
405 
409 }
static void ar9003_hw_init_mode_gain_regs(struct ath_hw *ah)
static void ar9003_hw_configpcipowersave(struct ath_hw *ah, int restore, int power_off)
void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
struct ath_hw_private_ops - callbacks used internally by hardware code
Definition: hw.h:550
void(* init_mode_regs)(struct ath_hw *ah)
Definition: hw.h:555
static void ar9003_hw_init_mode_regs(struct ath_hw *ah)
struct ath_hw_ops - callbacks used by hardware code and driver code
Definition: hw.h:603
void(* config_pci_powersave)(struct ath_hw *ah, int restore, int power_off)
Definition: hw.h:604
void(* init_mode_gain_regs)(struct ath_hw *ah)
Definition: hw.h:556
void ar9003_hw_attach_calib_ops(struct ath_hw *ah)
static struct ath_hw_ops * ath9k_hw_ops(struct ath_hw *ah)
Definition: hw.h:884
void ar9003_hw_attach_mac_ops(struct ath_hw *hw)
uint8_t ah
Definition: registers.h:85
static struct ath_hw_private_ops * ath9k_hw_private_ops(struct ath_hw *ah)
Definition: hw.h:879

References ah, ar9003_hw_attach_calib_ops(), ar9003_hw_attach_mac_ops(), ar9003_hw_attach_phy_ops(), ar9003_hw_configpcipowersave(), ar9003_hw_init_mode_gain_regs(), ar9003_hw_init_mode_regs(), 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().