iPXE
Functions
ath5k_eeprom.c File Reference
#include <unistd.h>
#include <stdlib.h>
#include "ath5k.h"
#include "reg.h"
#include "base.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (MIT)
 
 FILE_SECBOOT (FORBIDDEN)
 
static int ath5k_hw_eeprom_read (struct ath5k_hw *ah, u32 offset, u16 *data)
 
static u16 ath5k_eeprom_bin2freq (struct ath5k_eeprom_info *ee, u16 bin, unsigned int mode)
 
static int ath5k_eeprom_init_header (struct ath5k_hw *ah)
 
static int ath5k_eeprom_read_ants (struct ath5k_hw *ah, u32 *offset, unsigned int mode)
 
static int ath5k_eeprom_read_modes (struct ath5k_hw *ah, u32 *offset, unsigned int mode)
 
static int ath5k_eeprom_read_turbo_modes (struct ath5k_hw *ah, u32 *offset, unsigned int mode)
 
static int ath5k_eeprom_init_modes (struct ath5k_hw *ah)
 
static int ath5k_eeprom_read_freq_list (struct ath5k_hw *ah, int *offset, int max, struct ath5k_chan_pcal_info *pc, unsigned int mode)
 
static int ath5k_eeprom_init_11a_pcal_freq (struct ath5k_hw *ah, int offset)
 
static int ath5k_eeprom_init_11bg_2413 (struct ath5k_hw *ah, unsigned int mode, int offset)
 
static void ath5k_get_pcdac_intercepts (struct ath5k_hw *ah, u8 min, u8 max, u8 *vp)
 
static int ath5k_eeprom_convert_pcal_info_5111 (struct ath5k_hw *ah, int mode, struct ath5k_chan_pcal_info *chinfo)
 
static int ath5k_eeprom_read_pcal_info_5111 (struct ath5k_hw *ah, int mode)
 
static int ath5k_eeprom_convert_pcal_info_5112 (struct ath5k_hw *ah, int mode, struct ath5k_chan_pcal_info *chinfo)
 
static int ath5k_eeprom_read_pcal_info_5112 (struct ath5k_hw *ah, int mode)
 
static unsigned int ath5k_pdgains_size_2413 (struct ath5k_eeprom_info *ee, unsigned int mode)
 
static unsigned int ath5k_cal_data_offset_2413 (struct ath5k_eeprom_info *ee, int mode)
 
static int ath5k_eeprom_convert_pcal_info_2413 (struct ath5k_hw *ah, int mode, struct ath5k_chan_pcal_info *chinfo)
 
static int ath5k_eeprom_read_pcal_info_2413 (struct ath5k_hw *ah, int mode)
 
static int ath5k_eeprom_read_target_rate_pwr_info (struct ath5k_hw *ah, unsigned int mode)
 
static int ath5k_eeprom_read_pcal_info (struct ath5k_hw *ah)
 
static int ath5k_eeprom_free_pcal_info (struct ath5k_hw *ah, int mode)
 
void ath5k_eeprom_detach (struct ath5k_hw *ah)
 
static int ath5k_eeprom_read_ctl_info (struct ath5k_hw *ah)
 
int ath5k_eeprom_init (struct ath5k_hw *ah)
 
int ath5k_eeprom_read_mac (struct ath5k_hw *ah, u8 *mac)
 
int ath5k_eeprom_is_hb63 (struct ath5k_hw *ah)
 

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( MIT  )

◆ FILE_SECBOOT()

FILE_SECBOOT ( FORBIDDEN  )

◆ ath5k_hw_eeprom_read()

static int ath5k_hw_eeprom_read ( struct ath5k_hw ah,
u32  offset,
u16 data 
)
static

Definition at line 39 of file ath5k_eeprom.c.

40 {
42 
43  /* Avoid returning uninitialised data on error */
44  *data = 0xffff;
45 
46  /*
47  * Initialize EEPROM access
48  */
49  if (ah->ah_version == AR5K_AR5210) {
52  } else {
56  }
57 
62  return -EIO;
64  0xffff);
65  return 0;
66  }
67  udelay(15);
68  }
69 
70  return -ETIMEDOUT;
71 }
#define u16
Definition: vga.h:20
#define AR5K_PCICFG
Definition: reg.h:882
#define AR5K_EEPROM_BASE
Definition: reg.h:1056
#define AR5K_EEPROM_CMD_READ
Definition: reg.h:1070
#define AR5K_EEPROM_STAT_RDDONE
Definition: reg.h:1082
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition: timer.c:61
#define AR5K_TUNE_REGISTER_TIMEOUT
Definition: ath5k.h:171
#define AR5K_EEPROM_STATUS
Definition: reg.h:1079
#define AR5K_EEPROM_STAT_RDERR
Definition: reg.h:1081
static void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
Definition: ath5k.h:1224
uint8_t status
Status.
Definition: ena.h:16
#define AR5K_PCICFG_EEAE
Definition: reg.h:883
#define EIO
Input/output error.
Definition: errno.h:434
uint8_t data[48]
Additional event data.
Definition: ena.h:22
#define AR5K_EEPROM_DATA
Definition: reg.h:1063
uint8_t ah
Definition: registers.h:85
void timeout(int)
static u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
Definition: ath5k.h:1216
uint16_t offset
Offset to command line.
Definition: bzimage.h:8
#define ETIMEDOUT
Connection timed out.
Definition: errno.h:670
uint32_t u32
Definition: stdint.h:24
#define AR5K_REG_ENABLE_BITS(ah, _reg, _flags)
Definition: ath5k.h:106
#define AR5K_EEPROM_CMD
Definition: reg.h:1069

References ah, AR5K_AR5210, AR5K_EEPROM_BASE, AR5K_EEPROM_CMD, AR5K_EEPROM_CMD_READ, AR5K_EEPROM_DATA, AR5K_EEPROM_STAT_RDDONE, AR5K_EEPROM_STAT_RDERR, AR5K_EEPROM_STATUS, AR5K_PCICFG, AR5K_PCICFG_EEAE, AR5K_REG_ENABLE_BITS, AR5K_TUNE_REGISTER_TIMEOUT, ath5k_hw_reg_read(), ath5k_hw_reg_write(), data, EIO, ETIMEDOUT, offset, status, timeout(), u16, and udelay().

Referenced by ath5k_eeprom_is_hb63(), and ath5k_eeprom_read_mac().

◆ ath5k_eeprom_bin2freq()

static u16 ath5k_eeprom_bin2freq ( struct ath5k_eeprom_info ee,
u16  bin,
unsigned int  mode 
)
static

Definition at line 76 of file ath5k_eeprom.c.

78 {
79  u16 val;
80 
81  if (bin == AR5K_EEPROM_CHANNEL_DIS)
82  return bin;
83 
84  if (mode == AR5K_EEPROM_MODE_11A) {
86  val = (5 * bin) + 4800;
87  else
88  val = bin > 62 ? (10 * 62) + (5 * (bin - 62)) + 5100 :
89  (bin * 10) + 5100;
90  } else {
92  val = bin + 2300;
93  else
94  val = bin + 2400;
95  }
96 
97  return val;
98 }
uint16_t u16
Definition: stdint.h:22
void __asmcall int val
Definition: setjmp.h:12
#define AR5K_EEPROM_MODE_11A
Definition: eeprom.h:64
uint16_t mode
Acceleration mode.
Definition: ena.h:26
#define AR5K_EEPROM_CHANNEL_DIS
Definition: eeprom.h:202
#define AR5K_EEPROM_VERSION_3_2
Definition: eeprom.h:48

References AR5K_EEPROM_CHANNEL_DIS, AR5K_EEPROM_MODE_11A, AR5K_EEPROM_VERSION_3_2, ath5k_eeprom_info::ee_version, mode, and val.

Referenced by ath5k_eeprom_init_11a_pcal_freq(), ath5k_eeprom_read_ctl_info(), ath5k_eeprom_read_freq_list(), ath5k_eeprom_read_modes(), and ath5k_eeprom_read_target_rate_pwr_info().

◆ ath5k_eeprom_init_header()

static int ath5k_eeprom_init_header ( struct ath5k_hw ah)
static

Definition at line 104 of file ath5k_eeprom.c.

105 {
106  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
107  int ret;
108  u16 val;
109 
110  /*
111  * Read values from EEPROM and store them in the capability structure
112  */
118 
119  /* Return if we have an old EEPROM */
120  if (ah->ah_ee_version < AR5K_EEPROM_VERSION_3_0)
121  return 0;
122 
124  ee_ant_gain);
125 
126  if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_0) {
129 
130  /* XXX: Don't know which versions include these two */
132 
135 
136  if (ee->ee_version >= AR5K_EEPROM_VERSION_5_0) {
140  }
141  }
142 
143  if (ah->ah_ee_version < AR5K_EEPROM_VERSION_3_3) {
145  ee->ee_ob[AR5K_EEPROM_MODE_11B][0] = val & 0x7;
146  ee->ee_db[AR5K_EEPROM_MODE_11B][0] = (val >> 3) & 0x7;
147 
149  ee->ee_ob[AR5K_EEPROM_MODE_11G][0] = val & 0x7;
150  ee->ee_db[AR5K_EEPROM_MODE_11G][0] = (val >> 3) & 0x7;
151  }
152 
154 
155  if ((ah->ah_mac_version == (AR5K_SREV_AR2425 >> 4)) && val)
156  ee->ee_is_hb63 = 1;
157  else
158  ee->ee_is_hb63 = 0;
159 
163 
164  return 0;
165 }
uint16_t u16
Definition: stdint.h:22
#define AR5K_EEPROM_MISC5
Definition: eeprom.h:116
#define AR5K_EEPROM_IS_HB63
Definition: eeprom.h:30
#define AR5K_EEPROM_MODE_11G
Definition: eeprom.h:66
void __asmcall int val
Definition: setjmp.h:12
#define AR5K_EEPROM_PROTECT
Definition: eeprom.h:160
#define AR5K_EEPROM_OBDB1_2GHZ
Definition: eeprom.h:158
#define AR5K_REG_MS(_val, _flags)
Definition: ath5k.h:90
#define AR5K_EEPROM_MISC6
Definition: eeprom.h:125
u16 ee_db[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_OBDB]
Definition: eeprom.h:405
#define AR5K_EEPROM_MAGIC
Definition: eeprom.h:24
#define AR5K_EEPROM_REG_DOMAIN
Definition: eeprom.h:38
#define AR5K_EEPROM_VERSION_3_3
Definition: eeprom.h:49
#define u8
Definition: igbvf_osdep.h:40
#define AR5K_EEPROM_ANT_GAIN(_v)
Definition: eeprom.h:87
#define AR5K_EEPROM_RFKILL_GPIO_SEL
Definition: eeprom.h:78
#define AR5K_EEPROM_MISC4
Definition: eeprom.h:111
#define AR5K_EEPROM_VERSION_5_0
Definition: eeprom.h:60
#define AR5K_EEPROM_HDR
Definition: eeprom.h:68
#define AR5K_EEPROM_VERSION_4_3
Definition: eeprom.h:54
#define AR5K_EEPROM_MODE_11B
Definition: eeprom.h:65
#define AR5K_SREV_AR2425
Definition: ath5k.h:306
#define AR5K_EEPROM_MISC3
Definition: eeprom.h:107
#define AR5K_EEPROM_VERSION
Definition: eeprom.h:45
#define AR5K_EEPROM_MISC2
Definition: eeprom.h:103
#define AR5K_EEPROM_MISC1
Definition: eeprom.h:98
#define AR5K_EEPROM_OBDB0_2GHZ
Definition: eeprom.h:157
#define AR5K_EEPROM_RFKILL
Definition: eeprom.h:32
uint8_t ah
Definition: registers.h:85
u16 ee_ob[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_OBDB]
Definition: eeprom.h:404
#define AR5K_EEPROM_VERSION_3_0
Definition: eeprom.h:46
#define AR5K_EEPROM_READ(_o, _v)
Definition: eeprom.h:224
#define AR5K_EEPROM_MISC0
Definition: eeprom.h:92
#define AR5K_EEPROM_RFKILL_POLARITY
Definition: eeprom.h:80
#define AR5K_EEPROM_READ_HDR(_o, _v)
Definition: eeprom.h:230
#define AR5K_EEPROM_VERSION_4_0
Definition: eeprom.h:51

References ah, AR5K_EEPROM_ANT_GAIN, AR5K_EEPROM_HDR, AR5K_EEPROM_IS_HB63, AR5K_EEPROM_MAGIC, AR5K_EEPROM_MISC0, AR5K_EEPROM_MISC1, AR5K_EEPROM_MISC2, AR5K_EEPROM_MISC3, AR5K_EEPROM_MISC4, AR5K_EEPROM_MISC5, AR5K_EEPROM_MISC6, AR5K_EEPROM_MODE_11B, AR5K_EEPROM_MODE_11G, AR5K_EEPROM_OBDB0_2GHZ, AR5K_EEPROM_OBDB1_2GHZ, AR5K_EEPROM_PROTECT, AR5K_EEPROM_READ, AR5K_EEPROM_READ_HDR, AR5K_EEPROM_REG_DOMAIN, AR5K_EEPROM_RFKILL, AR5K_EEPROM_RFKILL_GPIO_SEL, AR5K_EEPROM_RFKILL_POLARITY, AR5K_EEPROM_VERSION, AR5K_EEPROM_VERSION_3_0, AR5K_EEPROM_VERSION_3_3, AR5K_EEPROM_VERSION_4_0, AR5K_EEPROM_VERSION_4_3, AR5K_EEPROM_VERSION_5_0, AR5K_REG_MS, AR5K_SREV_AR2425, ath5k_eeprom_info::ee_ant_gain, ath5k_eeprom_info::ee_db, ath5k_eeprom_info::ee_header, ath5k_eeprom_info::ee_is_hb63, ath5k_eeprom_info::ee_magic, ath5k_eeprom_info::ee_misc0, ath5k_eeprom_info::ee_misc1, ath5k_eeprom_info::ee_misc2, ath5k_eeprom_info::ee_misc3, ath5k_eeprom_info::ee_misc4, ath5k_eeprom_info::ee_misc5, ath5k_eeprom_info::ee_misc6, ath5k_eeprom_info::ee_ob, ath5k_eeprom_info::ee_protect, ath5k_eeprom_info::ee_regdomain, ath5k_eeprom_info::ee_rfkill_pin, ath5k_eeprom_info::ee_rfkill_pol, ath5k_eeprom_info::ee_version, u8, and val.

Referenced by ath5k_eeprom_init().

◆ ath5k_eeprom_read_ants()

static int ath5k_eeprom_read_ants ( struct ath5k_hw ah,
u32 offset,
unsigned int  mode 
)
static

Definition at line 171 of file ath5k_eeprom.c.

173 {
174  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
175  u32 o = *offset;
176  u16 val;
177  int ret, i = 0;
178 
179  AR5K_EEPROM_READ(o++, val);
180  ee->ee_switch_settling[mode] = (val >> 8) & 0x7f;
181  ee->ee_atn_tx_rx[mode] = (val >> 2) & 0x3f;
182  ee->ee_ant_control[mode][i] = (val << 4) & 0x3f;
183 
184  AR5K_EEPROM_READ(o++, val);
185  ee->ee_ant_control[mode][i++] |= (val >> 12) & 0xf;
186  ee->ee_ant_control[mode][i++] = (val >> 6) & 0x3f;
187  ee->ee_ant_control[mode][i++] = val & 0x3f;
188 
189  AR5K_EEPROM_READ(o++, val);
190  ee->ee_ant_control[mode][i++] = (val >> 10) & 0x3f;
191  ee->ee_ant_control[mode][i++] = (val >> 4) & 0x3f;
192  ee->ee_ant_control[mode][i] = (val << 2) & 0x3f;
193 
194  AR5K_EEPROM_READ(o++, val);
195  ee->ee_ant_control[mode][i++] |= (val >> 14) & 0x3;
196  ee->ee_ant_control[mode][i++] = (val >> 8) & 0x3f;
197  ee->ee_ant_control[mode][i++] = (val >> 2) & 0x3f;
198  ee->ee_ant_control[mode][i] = (val << 4) & 0x3f;
199 
200  AR5K_EEPROM_READ(o++, val);
201  ee->ee_ant_control[mode][i++] |= (val >> 12) & 0xf;
202  ee->ee_ant_control[mode][i++] = (val >> 6) & 0x3f;
203  ee->ee_ant_control[mode][i++] = val & 0x3f;
204 
205  /* Get antenna modes */
206  ah->ah_antenna[mode][0] =
207  (ee->ee_ant_control[mode][0] << 4);
208  ah->ah_antenna[mode][AR5K_ANT_FIXED_A] =
209  ee->ee_ant_control[mode][1] |
210  (ee->ee_ant_control[mode][2] << 6) |
211  (ee->ee_ant_control[mode][3] << 12) |
212  (ee->ee_ant_control[mode][4] << 18) |
213  (ee->ee_ant_control[mode][5] << 24);
214  ah->ah_antenna[mode][AR5K_ANT_FIXED_B] =
215  ee->ee_ant_control[mode][6] |
216  (ee->ee_ant_control[mode][7] << 6) |
217  (ee->ee_ant_control[mode][8] << 12) |
218  (ee->ee_ant_control[mode][9] << 18) |
219  (ee->ee_ant_control[mode][10] << 24);
220 
221  /* return new offset */
222  *offset = o;
223 
224  return 0;
225 }
uint16_t u16
Definition: stdint.h:22
void __asmcall int val
Definition: setjmp.h:12
uint16_t mode
Acceleration mode.
Definition: ena.h:26
u16 ee_ant_control[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_PCDAC]
Definition: eeprom.h:403
u16 ee_atn_tx_rx[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:402
uint8_t ah
Definition: registers.h:85
uint16_t offset
Offset to command line.
Definition: bzimage.h:8
#define AR5K_EEPROM_READ(_o, _v)
Definition: eeprom.h:224
u16 ee_switch_settling[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:401
uint32_t u32
Definition: stdint.h:24

References ah, AR5K_ANT_FIXED_A, AR5K_ANT_FIXED_B, AR5K_EEPROM_READ, ath5k_eeprom_info::ee_ant_control, ath5k_eeprom_info::ee_atn_tx_rx, ath5k_eeprom_info::ee_switch_settling, mode, offset, and val.

Referenced by ath5k_eeprom_init_modes().

◆ ath5k_eeprom_read_modes()

static int ath5k_eeprom_read_modes ( struct ath5k_hw ah,
u32 offset,
unsigned int  mode 
)
static

Definition at line 231 of file ath5k_eeprom.c.

233 {
234  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
235  u32 o = *offset;
236  u16 val;
237  int ret;
238 
239  ee->ee_n_piers[mode] = 0;
240  AR5K_EEPROM_READ(o++, val);
241  ee->ee_adc_desired_size[mode] = (s8)((val >> 8) & 0xff);
242  switch(mode) {
244  ee->ee_ob[mode][3] = (val >> 5) & 0x7;
245  ee->ee_db[mode][3] = (val >> 2) & 0x7;
246  ee->ee_ob[mode][2] = (val << 1) & 0x7;
247 
248  AR5K_EEPROM_READ(o++, val);
249  ee->ee_ob[mode][2] |= (val >> 15) & 0x1;
250  ee->ee_db[mode][2] = (val >> 12) & 0x7;
251  ee->ee_ob[mode][1] = (val >> 9) & 0x7;
252  ee->ee_db[mode][1] = (val >> 6) & 0x7;
253  ee->ee_ob[mode][0] = (val >> 3) & 0x7;
254  ee->ee_db[mode][0] = val & 0x7;
255  break;
258  ee->ee_ob[mode][1] = (val >> 4) & 0x7;
259  ee->ee_db[mode][1] = val & 0x7;
260  break;
261  }
262 
263  AR5K_EEPROM_READ(o++, val);
264  ee->ee_tx_end2xlna_enable[mode] = (val >> 8) & 0xff;
265  ee->ee_thr_62[mode] = val & 0xff;
266 
267  if (ah->ah_ee_version <= AR5K_EEPROM_VERSION_3_2)
268  ee->ee_thr_62[mode] = mode == AR5K_EEPROM_MODE_11A ? 15 : 28;
269 
270  AR5K_EEPROM_READ(o++, val);
271  ee->ee_tx_end2xpa_disable[mode] = (val >> 8) & 0xff;
272  ee->ee_tx_frm2xpa_enable[mode] = val & 0xff;
273 
274  AR5K_EEPROM_READ(o++, val);
275  ee->ee_pga_desired_size[mode] = (val >> 8) & 0xff;
276 
277  if ((val & 0xff) & 0x80)
278  ee->ee_noise_floor_thr[mode] = -((((val & 0xff) ^ 0xff)) + 1);
279  else
280  ee->ee_noise_floor_thr[mode] = val & 0xff;
281 
282  if (ah->ah_ee_version <= AR5K_EEPROM_VERSION_3_2)
283  ee->ee_noise_floor_thr[mode] =
284  mode == AR5K_EEPROM_MODE_11A ? -54 : -1;
285 
286  AR5K_EEPROM_READ(o++, val);
287  ee->ee_xlna_gain[mode] = (val >> 5) & 0xff;
288  ee->ee_x_gain[mode] = (val >> 1) & 0xf;
289  ee->ee_xpd[mode] = val & 0x1;
290 
291  if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_0)
292  ee->ee_fixed_bias[mode] = (val >> 13) & 0x1;
293 
294  if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_3_3) {
295  AR5K_EEPROM_READ(o++, val);
296  ee->ee_false_detect[mode] = (val >> 6) & 0x7f;
297 
298  if (mode == AR5K_EEPROM_MODE_11A)
299  ee->ee_xr_power[mode] = val & 0x3f;
300  else {
301  ee->ee_ob[mode][0] = val & 0x7;
302  ee->ee_db[mode][0] = (val >> 3) & 0x7;
303  }
304  }
305 
306  if (ah->ah_ee_version < AR5K_EEPROM_VERSION_3_4) {
309  } else {
310  ee->ee_i_gain[mode] = (val >> 13) & 0x7;
311 
312  AR5K_EEPROM_READ(o++, val);
313  ee->ee_i_gain[mode] |= (val << 3) & 0x38;
314 
315  if (mode == AR5K_EEPROM_MODE_11G) {
316  ee->ee_cck_ofdm_power_delta = (val >> 3) & 0xff;
317  if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_6)
318  ee->ee_scaled_cck_delta = (val >> 11) & 0x1f;
319  }
320  }
321 
322  if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_0 &&
324  ee->ee_i_cal[mode] = (val >> 8) & 0x3f;
325  ee->ee_q_cal[mode] = (val >> 3) & 0x1f;
326  }
327 
328  if (ah->ah_ee_version < AR5K_EEPROM_VERSION_4_0)
329  goto done;
330 
331  /* Note: >= v5 have bg freq piers on another location
332  * so these freq piers are ignored for >= v5 (should be 0xff
333  * anyway) */
334  switch(mode) {
336  if (ah->ah_ee_version < AR5K_EEPROM_VERSION_4_1)
337  break;
338 
339  AR5K_EEPROM_READ(o++, val);
340  ee->ee_margin_tx_rx[mode] = val & 0x3f;
341  break;
343  AR5K_EEPROM_READ(o++, val);
344 
345  ee->ee_pwr_cal_b[0].freq =
346  ath5k_eeprom_bin2freq(ee, val & 0xff, mode);
348  ee->ee_n_piers[mode]++;
349 
350  ee->ee_pwr_cal_b[1].freq =
351  ath5k_eeprom_bin2freq(ee, (val >> 8) & 0xff, mode);
353  ee->ee_n_piers[mode]++;
354 
355  AR5K_EEPROM_READ(o++, val);
356  ee->ee_pwr_cal_b[2].freq =
357  ath5k_eeprom_bin2freq(ee, val & 0xff, mode);
359  ee->ee_n_piers[mode]++;
360 
361  if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_1)
362  ee->ee_margin_tx_rx[mode] = (val >> 8) & 0x3f;
363  break;
365  AR5K_EEPROM_READ(o++, val);
366 
367  ee->ee_pwr_cal_g[0].freq =
368  ath5k_eeprom_bin2freq(ee, val & 0xff, mode);
370  ee->ee_n_piers[mode]++;
371 
372  ee->ee_pwr_cal_g[1].freq =
373  ath5k_eeprom_bin2freq(ee, (val >> 8) & 0xff, mode);
375  ee->ee_n_piers[mode]++;
376 
377  AR5K_EEPROM_READ(o++, val);
378  ee->ee_turbo_max_power[mode] = val & 0x7f;
379  ee->ee_xr_power[mode] = (val >> 7) & 0x3f;
380 
381  AR5K_EEPROM_READ(o++, val);
382  ee->ee_pwr_cal_g[2].freq =
383  ath5k_eeprom_bin2freq(ee, val & 0xff, mode);
385  ee->ee_n_piers[mode]++;
386 
387  if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_1)
388  ee->ee_margin_tx_rx[mode] = (val >> 8) & 0x3f;
389 
390  AR5K_EEPROM_READ(o++, val);
391  ee->ee_i_cal[mode] = (val >> 8) & 0x3f;
392  ee->ee_q_cal[mode] = (val >> 3) & 0x1f;
393 
394  if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_2) {
395  AR5K_EEPROM_READ(o++, val);
396  ee->ee_cck_ofdm_gain_delta = val & 0xff;
397  }
398  break;
399  }
400 
401 done:
402  /* return new offset */
403  *offset = o;
404 
405  return 0;
406 }
u16 ee_xr_power[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:400
uint16_t u16
Definition: stdint.h:22
int8_t s8
Definition: stdint.h:19
#define AR5K_EEPROM_VERSION_4_2
Definition: eeprom.h:53
#define AR5K_EEPROM_MODE_11G
Definition: eeprom.h:66
void __asmcall int val
Definition: setjmp.h:12
u16 ee_thr_62[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:409
#define AR5K_EEPROM_MODE_11A
Definition: eeprom.h:64
uint16_t mode
Acceleration mode.
Definition: ena.h:26
u16 ee_false_detect[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:420
u16 ee_x_gain[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:412
s16 ee_noise_floor_thr[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:444
u16 ee_tx_end2xlna_enable[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:406
u16 ee_db[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_OBDB]
Definition: eeprom.h:405
struct ath5k_chan_pcal_info ee_pwr_cal_b[AR5K_EEPROM_N_2GHZ_CHAN_MAX]
Definition: eeprom.h:429
s8 ee_adc_desired_size[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:445
struct ath5k_chan_pcal_info ee_pwr_cal_g[AR5K_EEPROM_N_2GHZ_CHAN_MAX]
Definition: eeprom.h:430
#define AR5K_EEPROM_VERSION_3_3
Definition: eeprom.h:49
u16 ee_xlna_gain[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:410
u8 ee_n_piers[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:427
u16 ee_tx_end2xpa_disable[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:407
#define AR5K_EEPROM_VERSION_4_1
Definition: eeprom.h:52
u16 ee_scaled_cck_delta
Definition: eeprom.h:393
#define AR5K_EEPROM_MODE_11B
Definition: eeprom.h:65
u16 ee_i_gain[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:413
#define AR5K_EEPROM_CHANNEL_DIS
Definition: eeprom.h:202
u16 ee_i_cal[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:396
u16 ee_tx_frm2xpa_enable[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:408
s8 ee_pga_desired_size[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:446
u16 ee_xpd[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:411
#define AR5K_EEPROM_VERSION_3_2
Definition: eeprom.h:48
u16 ee_margin_tx_rx[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:414
u16 ee_cck_ofdm_power_delta
Definition: eeprom.h:392
uint8_t ah
Definition: registers.h:85
#define AR5K_EEPROM_VERSION_4_6
Definition: eeprom.h:57
u16 ee_ob[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_OBDB]
Definition: eeprom.h:404
uint16_t offset
Offset to command line.
Definition: bzimage.h:8
static u16 ath5k_eeprom_bin2freq(struct ath5k_eeprom_info *ee, u16 bin, unsigned int mode)
Definition: ath5k_eeprom.c:76
u16 ee_turbo_max_power[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:399
#define AR5K_EEPROM_READ(_o, _v)
Definition: eeprom.h:224
u16 ee_cck_ofdm_gain_delta
Definition: eeprom.h:391
u16 ee_fixed_bias[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:398
struct bofm_section_header done
Definition: bofm_test.c:46
#define AR5K_EEPROM_CCK_OFDM_DELTA
Definition: eeprom.h:221
uint32_t u32
Definition: stdint.h:24
u16 ee_q_cal[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:397
#define AR5K_EEPROM_I_GAIN
Definition: eeprom.h:220
#define AR5K_EEPROM_VERSION_3_4
Definition: eeprom.h:50
#define AR5K_EEPROM_VERSION_4_0
Definition: eeprom.h:51

References ah, AR5K_EEPROM_CCK_OFDM_DELTA, AR5K_EEPROM_CHANNEL_DIS, AR5K_EEPROM_I_GAIN, AR5K_EEPROM_MODE_11A, AR5K_EEPROM_MODE_11B, AR5K_EEPROM_MODE_11G, AR5K_EEPROM_READ, AR5K_EEPROM_VERSION_3_2, AR5K_EEPROM_VERSION_3_3, AR5K_EEPROM_VERSION_3_4, AR5K_EEPROM_VERSION_4_0, AR5K_EEPROM_VERSION_4_1, AR5K_EEPROM_VERSION_4_2, AR5K_EEPROM_VERSION_4_6, ath5k_eeprom_bin2freq(), done, ath5k_eeprom_info::ee_adc_desired_size, ath5k_eeprom_info::ee_cck_ofdm_gain_delta, ath5k_eeprom_info::ee_cck_ofdm_power_delta, ath5k_eeprom_info::ee_db, ath5k_eeprom_info::ee_false_detect, ath5k_eeprom_info::ee_fixed_bias, ath5k_eeprom_info::ee_i_cal, ath5k_eeprom_info::ee_i_gain, ath5k_eeprom_info::ee_margin_tx_rx, ath5k_eeprom_info::ee_n_piers, ath5k_eeprom_info::ee_noise_floor_thr, ath5k_eeprom_info::ee_ob, ath5k_eeprom_info::ee_pga_desired_size, ath5k_eeprom_info::ee_pwr_cal_b, ath5k_eeprom_info::ee_pwr_cal_g, ath5k_eeprom_info::ee_q_cal, ath5k_eeprom_info::ee_scaled_cck_delta, ath5k_eeprom_info::ee_thr_62, ath5k_eeprom_info::ee_turbo_max_power, ath5k_eeprom_info::ee_tx_end2xlna_enable, ath5k_eeprom_info::ee_tx_end2xpa_disable, ath5k_eeprom_info::ee_tx_frm2xpa_enable, ath5k_eeprom_info::ee_x_gain, ath5k_eeprom_info::ee_xlna_gain, ath5k_eeprom_info::ee_xpd, ath5k_eeprom_info::ee_xr_power, ath5k_chan_pcal_info::freq, mode, offset, and val.

Referenced by ath5k_eeprom_init_modes().

◆ ath5k_eeprom_read_turbo_modes()

static int ath5k_eeprom_read_turbo_modes ( struct ath5k_hw ah,
u32 offset,
unsigned int  mode 
)
static

Definition at line 412 of file ath5k_eeprom.c.

414 {
415  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
416  u32 o = *offset;
417  u16 val;
418  int ret;
419 
421  return 0;
422 
423  AR5K_EEPROM_READ(o++, val);
424  switch (mode){
426  ee->ee_switch_settling_turbo[mode] = (val >> 6) & 0x7f;
427 
428  ee->ee_atn_tx_rx_turbo[mode] = (val >> 13) & 0x7;
429  AR5K_EEPROM_READ(o++, val);
430  ee->ee_atn_tx_rx_turbo[mode] |= (val & 0x7) << 3;
431  ee->ee_margin_tx_rx_turbo[mode] = (val >> 3) & 0x3f;
432 
433  ee->ee_adc_desired_size_turbo[mode] = (val >> 9) & 0x7f;
434  AR5K_EEPROM_READ(o++, val);
435  ee->ee_adc_desired_size_turbo[mode] |= (val & 0x1) << 7;
436  ee->ee_pga_desired_size_turbo[mode] = (val >> 1) & 0xff;
437 
438  if (AR5K_EEPROM_EEMAP(ee->ee_misc0) >=2)
439  ee->ee_pd_gain_overlap = (val >> 9) & 0xf;
440  break;
442  ee->ee_switch_settling_turbo[mode] = (val >> 8) & 0x7f;
443 
444  ee->ee_atn_tx_rx_turbo[mode] = (val >> 15) & 0x7;
445  AR5K_EEPROM_READ(o++, val);
446  ee->ee_atn_tx_rx_turbo[mode] |= (val & 0x1f) << 1;
447  ee->ee_margin_tx_rx_turbo[mode] = (val >> 5) & 0x3f;
448 
449  ee->ee_adc_desired_size_turbo[mode] = (val >> 11) & 0x7f;
450  AR5K_EEPROM_READ(o++, val);
451  ee->ee_adc_desired_size_turbo[mode] |= (val & 0x7) << 5;
452  ee->ee_pga_desired_size_turbo[mode] = (val >> 3) & 0xff;
453  break;
454  }
455 
456  /* return new offset */
457  *offset = o;
458 
459  return 0;
460 }
uint16_t u16
Definition: stdint.h:22
#define AR5K_EEPROM_MODE_11G
Definition: eeprom.h:66
void __asmcall int val
Definition: setjmp.h:12
s8 ee_adc_desired_size_turbo[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:447
#define AR5K_EEPROM_MODE_11A
Definition: eeprom.h:64
uint16_t mode
Acceleration mode.
Definition: ena.h:26
s8 ee_pd_gain_overlap
Definition: eeprom.h:449
#define AR5K_EEPROM_VERSION_5_0
Definition: eeprom.h:60
#define AR5K_EEPROM_EEMAP(_v)
Definition: eeprom.h:96
u16 ee_margin_tx_rx_turbo[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:416
u16 ee_switch_settling_turbo[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:415
u16 ee_atn_tx_rx_turbo[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:417
uint8_t ah
Definition: registers.h:85
uint16_t offset
Offset to command line.
Definition: bzimage.h:8
#define AR5K_EEPROM_READ(_o, _v)
Definition: eeprom.h:224
uint32_t u32
Definition: stdint.h:24
s8 ee_pga_desired_size_turbo[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:448

References ah, AR5K_EEPROM_EEMAP, AR5K_EEPROM_MODE_11A, AR5K_EEPROM_MODE_11G, AR5K_EEPROM_READ, AR5K_EEPROM_VERSION_5_0, ath5k_eeprom_info::ee_adc_desired_size_turbo, ath5k_eeprom_info::ee_atn_tx_rx_turbo, ath5k_eeprom_info::ee_margin_tx_rx_turbo, ath5k_eeprom_info::ee_misc0, ath5k_eeprom_info::ee_pd_gain_overlap, ath5k_eeprom_info::ee_pga_desired_size_turbo, ath5k_eeprom_info::ee_switch_settling_turbo, ath5k_eeprom_info::ee_version, mode, offset, and val.

Referenced by ath5k_eeprom_init_modes().

◆ ath5k_eeprom_init_modes()

static int ath5k_eeprom_init_modes ( struct ath5k_hw ah)
static

Definition at line 464 of file ath5k_eeprom.c.

465 {
466  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
467  u32 mode_offset[3];
468  unsigned int mode;
469  u32 offset;
470  int ret;
471 
472  /*
473  * Get values for all modes
474  */
475  mode_offset[AR5K_EEPROM_MODE_11A] = AR5K_EEPROM_MODES_11A(ah->ah_ee_version);
476  mode_offset[AR5K_EEPROM_MODE_11B] = AR5K_EEPROM_MODES_11B(ah->ah_ee_version);
477  mode_offset[AR5K_EEPROM_MODE_11G] = AR5K_EEPROM_MODES_11G(ah->ah_ee_version);
478 
481 
483  offset = mode_offset[mode];
484 
486  if (ret)
487  return ret;
488 
490  if (ret)
491  return ret;
492 
494  if (ret)
495  return ret;
496  }
497 
498  /* override for older eeprom versions for better performance */
499  if (ah->ah_ee_version <= AR5K_EEPROM_VERSION_3_2) {
503  }
504 
505  return 0;
506 }
static int ath5k_eeprom_read_turbo_modes(struct ath5k_hw *ah, u32 *offset, unsigned int mode)
Definition: ath5k_eeprom.c:412
#define AR5K_EEPROM_MODE_11G
Definition: eeprom.h:66
u16 ee_thr_62[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:409
#define AR5K_EEPROM_MODE_11A
Definition: eeprom.h:64
uint16_t mode
Acceleration mode.
Definition: ena.h:26
#define AR5K_EEPROM_HDR_T_5GHZ_DBM(_v)
Definition: eeprom.h:73
#define AR5K_EEPROM_MODES_11G(_v)
Definition: eeprom.h:137
#define AR5K_EEPROM_MODE_11B
Definition: eeprom.h:65
#define AR5K_EEPROM_MODES_11B(_v)
Definition: eeprom.h:136
static int ath5k_eeprom_read_modes(struct ath5k_hw *ah, u32 *offset, unsigned int mode)
Definition: ath5k_eeprom.c:231
static int ath5k_eeprom_read_ants(struct ath5k_hw *ah, u32 *offset, unsigned int mode)
Definition: ath5k_eeprom.c:171
#define AR5K_EEPROM_VERSION_3_2
Definition: eeprom.h:48
uint8_t ah
Definition: registers.h:85
uint16_t offset
Offset to command line.
Definition: bzimage.h:8
#define AR5K_EEPROM_MODES_11A(_v)
Definition: eeprom.h:135
u16 ee_turbo_max_power[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:399
uint32_t u32
Definition: stdint.h:24

References ah, AR5K_EEPROM_HDR_T_5GHZ_DBM, AR5K_EEPROM_MODE_11A, AR5K_EEPROM_MODE_11B, AR5K_EEPROM_MODE_11G, AR5K_EEPROM_MODES_11A, AR5K_EEPROM_MODES_11B, AR5K_EEPROM_MODES_11G, AR5K_EEPROM_VERSION_3_2, ath5k_eeprom_read_ants(), ath5k_eeprom_read_modes(), ath5k_eeprom_read_turbo_modes(), ath5k_eeprom_info::ee_header, ath5k_eeprom_info::ee_thr_62, ath5k_eeprom_info::ee_turbo_max_power, mode, and offset.

Referenced by ath5k_eeprom_init().

◆ ath5k_eeprom_read_freq_list()

static int ath5k_eeprom_read_freq_list ( struct ath5k_hw ah,
int *  offset,
int  max,
struct ath5k_chan_pcal_info pc,
unsigned int  mode 
)
inlinestatic

Definition at line 511 of file ath5k_eeprom.c.

513 {
514  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
515  int o = *offset;
516  int i = 0;
517  u8 freq1, freq2;
518  int ret;
519  u16 val;
520 
521  ee->ee_n_piers[mode] = 0;
522  while(i < max) {
523  AR5K_EEPROM_READ(o++, val);
524 
525  freq1 = val & 0xff;
526  if (!freq1)
527  break;
528 
529  pc[i++].freq = ath5k_eeprom_bin2freq(ee,
530  freq1, mode);
531  ee->ee_n_piers[mode]++;
532 
533  freq2 = (val >> 8) & 0xff;
534  if (!freq2)
535  break;
536 
537  pc[i++].freq = ath5k_eeprom_bin2freq(ee,
538  freq2, mode);
539  ee->ee_n_piers[mode]++;
540  }
541 
542  /* return new offset */
543  *offset = o;
544 
545  return 0;
546 }
uint16_t u16
Definition: stdint.h:22
#define max(x, y)
Definition: ath.h:41
void __asmcall int val
Definition: setjmp.h:12
uint16_t mode
Acceleration mode.
Definition: ena.h:26
u8 ee_n_piers[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:427
uint8_t ah
Definition: registers.h:85
uint16_t offset
Offset to command line.
Definition: bzimage.h:8
static u16 ath5k_eeprom_bin2freq(struct ath5k_eeprom_info *ee, u16 bin, unsigned int mode)
Definition: ath5k_eeprom.c:76
#define AR5K_EEPROM_READ(_o, _v)
Definition: eeprom.h:224
uint8_t u8
Definition: stdint.h:20

References ah, AR5K_EEPROM_READ, ath5k_eeprom_bin2freq(), ath5k_eeprom_info::ee_n_piers, ath5k_chan_pcal_info::freq, max, mode, offset, and val.

Referenced by ath5k_eeprom_init_11a_pcal_freq(), and ath5k_eeprom_init_11bg_2413().

◆ ath5k_eeprom_init_11a_pcal_freq()

static int ath5k_eeprom_init_11a_pcal_freq ( struct ath5k_hw ah,
int  offset 
)
static

Definition at line 550 of file ath5k_eeprom.c.

551 {
552  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
553  struct ath5k_chan_pcal_info *pcal = ee->ee_pwr_cal_a;
554  int i, ret;
555  u16 val;
556  u8 mask;
557 
558  if (ee->ee_version >= AR5K_EEPROM_VERSION_3_3) {
562  } else {
563  mask = AR5K_EEPROM_FREQ_M(ah->ah_ee_version);
564 
566  pcal[0].freq = (val >> 9) & mask;
567  pcal[1].freq = (val >> 2) & mask;
568  pcal[2].freq = (val << 5) & mask;
569 
571  pcal[2].freq |= (val >> 11) & 0x1f;
572  pcal[3].freq = (val >> 4) & mask;
573  pcal[4].freq = (val << 3) & mask;
574 
576  pcal[4].freq |= (val >> 13) & 0x7;
577  pcal[5].freq = (val >> 6) & mask;
578  pcal[6].freq = (val << 1) & mask;
579 
581  pcal[6].freq |= (val >> 15) & 0x1;
582  pcal[7].freq = (val >> 8) & mask;
583  pcal[8].freq = (val >> 1) & mask;
584  pcal[9].freq = (val << 6) & mask;
585 
587  pcal[9].freq |= (val >> 10) & 0x3f;
588 
589  /* Fixed number of piers */
591 
592  for (i = 0; i < AR5K_EEPROM_N_5GHZ_CHAN; i++) {
593  pcal[i].freq = ath5k_eeprom_bin2freq(ee,
594  pcal[i].freq, AR5K_EEPROM_MODE_11A);
595  }
596  }
597 
598  return 0;
599 }
uint16_t u16
Definition: stdint.h:22
#define AR5K_EEPROM_N_5GHZ_CHAN
Definition: eeprom.h:182
void __asmcall int val
Definition: setjmp.h:12
#define AR5K_EEPROM_MODE_11A
Definition: eeprom.h:64
#define AR5K_EEPROM_VERSION_3_3
Definition: eeprom.h:49
static int ath5k_eeprom_read_freq_list(struct ath5k_hw *ah, int *offset, int max, struct ath5k_chan_pcal_info *pc, unsigned int mode)
Definition: ath5k_eeprom.c:511
u8 ee_n_piers[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:427
struct ath5k_chan_pcal_info ee_pwr_cal_a[AR5K_EEPROM_N_5GHZ_CHAN]
Definition: eeprom.h:428
uint8_t ah
Definition: registers.h:85
uint16_t offset
Offset to command line.
Definition: bzimage.h:8
static u16 ath5k_eeprom_bin2freq(struct ath5k_eeprom_info *ee, u16 bin, unsigned int mode)
Definition: ath5k_eeprom.c:76
#define AR5K_EEPROM_READ(_o, _v)
Definition: eeprom.h:224
#define AR5K_EEPROM_FREQ_M(_v)
Definition: eeprom.h:193
uint8_t u8
Definition: stdint.h:20

References ah, AR5K_EEPROM_FREQ_M, AR5K_EEPROM_MODE_11A, AR5K_EEPROM_N_5GHZ_CHAN, AR5K_EEPROM_READ, AR5K_EEPROM_VERSION_3_3, ath5k_eeprom_bin2freq(), ath5k_eeprom_read_freq_list(), ath5k_eeprom_info::ee_n_piers, ath5k_eeprom_info::ee_pwr_cal_a, ath5k_eeprom_info::ee_version, ath5k_chan_pcal_info::freq, offset, and val.

Referenced by ath5k_eeprom_read_pcal_info_2413(), ath5k_eeprom_read_pcal_info_5111(), and ath5k_eeprom_read_pcal_info_5112().

◆ ath5k_eeprom_init_11bg_2413()

static int ath5k_eeprom_init_11bg_2413 ( struct ath5k_hw ah,
unsigned int  mode,
int  offset 
)
inlinestatic

Definition at line 603 of file ath5k_eeprom.c.

604 {
605  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
606  struct ath5k_chan_pcal_info *pcal;
607 
608  switch(mode) {
610  pcal = ee->ee_pwr_cal_b;
611  break;
613  pcal = ee->ee_pwr_cal_g;
614  break;
615  default:
616  return -EINVAL;
617  }
618 
621  mode);
622 
623  return 0;
624 }
#define EINVAL
Invalid argument.
Definition: errno.h:429
#define AR5K_EEPROM_MODE_11G
Definition: eeprom.h:66
uint16_t mode
Acceleration mode.
Definition: ena.h:26
struct ath5k_chan_pcal_info ee_pwr_cal_b[AR5K_EEPROM_N_2GHZ_CHAN_MAX]
Definition: eeprom.h:429
struct ath5k_chan_pcal_info ee_pwr_cal_g[AR5K_EEPROM_N_2GHZ_CHAN_MAX]
Definition: eeprom.h:430
static int ath5k_eeprom_read_freq_list(struct ath5k_hw *ah, int *offset, int max, struct ath5k_chan_pcal_info *pc, unsigned int mode)
Definition: ath5k_eeprom.c:511
#define AR5K_EEPROM_MODE_11B
Definition: eeprom.h:65
#define AR5K_EEPROM_N_2GHZ_CHAN_2413
Definition: eeprom.h:184
uint8_t ah
Definition: registers.h:85
uint16_t offset
Offset to command line.
Definition: bzimage.h:8

References ah, AR5K_EEPROM_MODE_11B, AR5K_EEPROM_MODE_11G, AR5K_EEPROM_N_2GHZ_CHAN_2413, ath5k_eeprom_read_freq_list(), ath5k_eeprom_info::ee_pwr_cal_b, ath5k_eeprom_info::ee_pwr_cal_g, EINVAL, mode, and offset.

Referenced by ath5k_eeprom_read_pcal_info_2413().

◆ ath5k_get_pcdac_intercepts()

static void ath5k_get_pcdac_intercepts ( struct ath5k_hw ah,
u8  min,
u8  max,
u8 vp 
)
inlinestatic

Definition at line 647 of file ath5k_eeprom.c.

648 {
649  static const u16 intercepts3[] =
650  { 0, 5, 10, 20, 30, 50, 70, 85, 90, 95, 100 };
651  static const u16 intercepts3_2[] =
652  { 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
653  const u16 *ip;
654  unsigned i;
655 
656  if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_3_2)
657  ip = intercepts3_2;
658  else
659  ip = intercepts3;
660 
661  for (i = 0; i < ARRAY_SIZE(intercepts3); i++)
662  vp[i] = (ip[i] * max + (100 - ip[i]) * min) / 100;
663 }
uint16_t u16
Definition: stdint.h:22
#define max(x, y)
Definition: ath.h:41
#define min(x, y)
Definition: ath.h:36
#define vp
Definition: 3c515.c:239
IP4_t ip
Destination IP address.
Definition: pxe_api.h:58
#define ARRAY_SIZE(x)
Definition: efx_common.h:43
#define AR5K_EEPROM_VERSION_3_2
Definition: eeprom.h:48
uint8_t ah
Definition: registers.h:85

References ah, AR5K_EEPROM_VERSION_3_2, ARRAY_SIZE, ip, max, min, and vp.

Referenced by ath5k_eeprom_read_pcal_info_5111().

◆ ath5k_eeprom_convert_pcal_info_5111()

static int ath5k_eeprom_convert_pcal_info_5111 ( struct ath5k_hw ah,
int  mode,
struct ath5k_chan_pcal_info chinfo 
)
static

Definition at line 668 of file ath5k_eeprom.c.

670 {
671  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
672  struct ath5k_chan_pcal_info_rf5111 *pcinfo;
673  struct ath5k_pdgain_info *pd;
674  u8 pier, point, idx;
675  u8 *pdgain_idx = ee->ee_pdc_to_idx[mode];
676 
677  /* Fill raw data for each calibration pier */
678  for (pier = 0; pier < ee->ee_n_piers[mode]; pier++) {
679 
680  pcinfo = &chinfo[pier].rf5111_info;
681 
682  /* Allocate pd_curves for this cal pier */
683  chinfo[pier].pd_curves =
685  sizeof(struct ath5k_pdgain_info));
686 
687  if (!chinfo[pier].pd_curves)
688  return -ENOMEM;
689 
690  /* Only one curve for RF5111
691  * find out which one and place
692  * in in pd_curves.
693  * Note: ee_x_gain is reversed here */
694  for (idx = 0; idx < AR5K_EEPROM_N_PD_CURVES; idx++) {
695 
696  if (!((ee->ee_x_gain[mode] >> idx) & 0x1)) {
697  pdgain_idx[0] = idx;
698  break;
699  }
700  }
701 
702  ee->ee_pd_gains[mode] = 1;
703 
704  pd = &chinfo[pier].pd_curves[idx];
705 
707 
708  /* Allocate pd points for this curve */
710  if (!pd->pd_step)
711  return -ENOMEM;
712 
714  if (!pd->pd_pwr)
715  return -ENOMEM;
716 
717  /* Fill raw dataset
718  * (convert power to 0.25dB units
719  * for RF5112 combatibility) */
720  for (point = 0; point < pd->pd_points; point++) {
721 
722  /* Absolute values */
723  pd->pd_pwr[point] = 2 * pcinfo->pwr[point];
724 
725  /* Already sorted */
726  pd->pd_step[point] = pcinfo->pcdac[point];
727  }
728 
729  /* Set min/max pwr */
730  chinfo[pier].min_pwr = pd->pd_pwr[0];
731  chinfo[pier].max_pwr = pd->pd_pwr[10];
732 
733  }
734 
735  return 0;
736 }
u8 ee_pd_gains[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:423
int16_t s16
Definition: stdint.h:21
struct ath5k_pdgain_info * pd_curves
Definition: eeprom.h:342
#define AR5K_EEPROM_N_PD_CURVES
Definition: eeprom.h:206
u8 ee_pdc_to_idx[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_PD_GAINS]
Definition: eeprom.h:425
uint16_t mode
Acceleration mode.
Definition: ena.h:26
u16 ee_x_gain[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:412
#define AR5K_EEPROM_N_PWR_POINTS_5111
Definition: eeprom.h:187
u8 pwr[AR5K_EEPROM_N_PWR_POINTS_5111]
Definition: eeprom.h:280
#define ENOMEM
Not enough space.
Definition: errno.h:535
struct ath5k_chan_pcal_info_rf5111 rf5111_info
Definition: eeprom.h:335
static void *__malloc calloc(size_t nmemb, size_t size)
Allocate cleared memory.
Definition: stdlib.h:46
u8 ee_n_piers[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:427
uint8_t ah
Definition: registers.h:85
u8 pcdac[AR5K_EEPROM_N_PWR_POINTS_5111]
Definition: eeprom.h:283
uint8_t u8
Definition: stdint.h:20

References ah, AR5K_EEPROM_N_PD_CURVES, AR5K_EEPROM_N_PWR_POINTS_5111, calloc(), ath5k_eeprom_info::ee_n_piers, ath5k_eeprom_info::ee_pd_gains, ath5k_eeprom_info::ee_pdc_to_idx, ath5k_eeprom_info::ee_x_gain, ENOMEM, ath5k_chan_pcal_info::max_pwr, ath5k_chan_pcal_info::min_pwr, mode, ath5k_chan_pcal_info_rf5111::pcdac, ath5k_chan_pcal_info::pd_curves, ath5k_pdgain_info::pd_points, ath5k_pdgain_info::pd_pwr, ath5k_pdgain_info::pd_step, ath5k_chan_pcal_info_rf5111::pwr, and ath5k_chan_pcal_info::rf5111_info.

Referenced by ath5k_eeprom_read_pcal_info_5111().

◆ ath5k_eeprom_read_pcal_info_5111()

static int ath5k_eeprom_read_pcal_info_5111 ( struct ath5k_hw ah,
int  mode 
)
static

Definition at line 740 of file ath5k_eeprom.c.

741 {
742  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
743  struct ath5k_chan_pcal_info *pcal;
744  int offset, ret;
745  int i;
746  u16 val;
747 
749  switch(mode) {
751  if (!AR5K_EEPROM_HDR_11A(ee->ee_header))
752  return 0;
753 
756  if (ret < 0)
757  return ret;
758 
760  pcal = ee->ee_pwr_cal_a;
761  break;
763  if (!AR5K_EEPROM_HDR_11B(ee->ee_header) &&
765  return 0;
766 
767  pcal = ee->ee_pwr_cal_b;
769 
770  /* fixed piers */
771  pcal[0].freq = 2412;
772  pcal[1].freq = 2447;
773  pcal[2].freq = 2484;
774  ee->ee_n_piers[mode] = 3;
775  break;
777  if (!AR5K_EEPROM_HDR_11G(ee->ee_header))
778  return 0;
779 
780  pcal = ee->ee_pwr_cal_g;
782 
783  /* fixed piers */
784  pcal[0].freq = 2312;
785  pcal[1].freq = 2412;
786  pcal[2].freq = 2484;
787  ee->ee_n_piers[mode] = 3;
788  break;
789  default:
790  return -EINVAL;
791  }
792 
793  for (i = 0; i < ee->ee_n_piers[mode]; i++) {
794  struct ath5k_chan_pcal_info_rf5111 *cdata =
795  &pcal[i].rf5111_info;
796 
798  cdata->pcdac_max = ((val >> 10) & AR5K_EEPROM_PCDAC_M);
799  cdata->pcdac_min = ((val >> 4) & AR5K_EEPROM_PCDAC_M);
800  cdata->pwr[0] = ((val << 2) & AR5K_EEPROM_POWER_M);
801 
803  cdata->pwr[0] |= ((val >> 14) & 0x3);
804  cdata->pwr[1] = ((val >> 8) & AR5K_EEPROM_POWER_M);
805  cdata->pwr[2] = ((val >> 2) & AR5K_EEPROM_POWER_M);
806  cdata->pwr[3] = ((val << 4) & AR5K_EEPROM_POWER_M);
807 
809  cdata->pwr[3] |= ((val >> 12) & 0xf);
810  cdata->pwr[4] = ((val >> 6) & AR5K_EEPROM_POWER_M);
811  cdata->pwr[5] = (val & AR5K_EEPROM_POWER_M);
812 
814  cdata->pwr[6] = ((val >> 10) & AR5K_EEPROM_POWER_M);
815  cdata->pwr[7] = ((val >> 4) & AR5K_EEPROM_POWER_M);
816  cdata->pwr[8] = ((val << 2) & AR5K_EEPROM_POWER_M);
817 
819  cdata->pwr[8] |= ((val >> 14) & 0x3);
820  cdata->pwr[9] = ((val >> 8) & AR5K_EEPROM_POWER_M);
821  cdata->pwr[10] = ((val >> 2) & AR5K_EEPROM_POWER_M);
822 
824  cdata->pcdac_max, cdata->pcdac);
825  }
826 
828 }
uint16_t u16
Definition: stdint.h:22
#define EINVAL
Invalid argument.
Definition: errno.h:429
#define AR5K_EEPROM_HDR_11B(_v)
Definition: eeprom.h:70
#define AR5K_EEPROM_GROUP4_OFFSET
Definition: eeprom.h:143
#define AR5K_EEPROM_MODE_11G
Definition: eeprom.h:66
void __asmcall int val
Definition: setjmp.h:12
#define AR5K_EEPROM_MODE_11A
Definition: eeprom.h:64
uint16_t mode
Acceleration mode.
Definition: ena.h:26
#define AR5K_EEPROM_POWER_M
Definition: eeprom.h:213
u8 pwr[AR5K_EEPROM_N_PWR_POINTS_5111]
Definition: eeprom.h:280
struct ath5k_chan_pcal_info ee_pwr_cal_b[AR5K_EEPROM_N_2GHZ_CHAN_MAX]
Definition: eeprom.h:429
struct ath5k_chan_pcal_info_rf5111 rf5111_info
Definition: eeprom.h:335
struct ath5k_chan_pcal_info ee_pwr_cal_g[AR5K_EEPROM_N_2GHZ_CHAN_MAX]
Definition: eeprom.h:430
static int ath5k_eeprom_init_11a_pcal_freq(struct ath5k_hw *ah, int offset)
Definition: ath5k_eeprom.c:550
#define AR5K_EEPROM_GROUP1_OFFSET
Definition: eeprom.h:140
#define AR5K_EEPROM_HDR_11A(_v)
Definition: eeprom.h:69
#define AR5K_EEPROM_GROUPS_START(_v)
Definition: eeprom.h:139
u8 ee_n_piers[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:427
#define AR5K_EEPROM_MODE_11B
Definition: eeprom.h:65
static void ath5k_get_pcdac_intercepts(struct ath5k_hw *ah, u8 min, u8 max, u8 *vp)
Definition: ath5k_eeprom.c:647
#define AR5K_EEPROM_PCDAC_M
Definition: eeprom.h:194
struct ath5k_chan_pcal_info ee_pwr_cal_a[AR5K_EEPROM_N_5GHZ_CHAN]
Definition: eeprom.h:428
#define AR5K_EEPROM_GROUP2_OFFSET
Definition: eeprom.h:141
uint8_t ah
Definition: registers.h:85
u8 pcdac[AR5K_EEPROM_N_PWR_POINTS_5111]
Definition: eeprom.h:283
#define AR5K_EEPROM_GROUP3_OFFSET
Definition: eeprom.h:142
uint16_t offset
Offset to command line.
Definition: bzimage.h:8
#define AR5K_EEPROM_READ(_o, _v)
Definition: eeprom.h:224
#define AR5K_EEPROM_HDR_11G(_v)
Definition: eeprom.h:71
static int ath5k_eeprom_convert_pcal_info_5111(struct ath5k_hw *ah, int mode, struct ath5k_chan_pcal_info *chinfo)
Definition: ath5k_eeprom.c:668

References ah, AR5K_EEPROM_GROUP1_OFFSET, AR5K_EEPROM_GROUP2_OFFSET, AR5K_EEPROM_GROUP3_OFFSET, AR5K_EEPROM_GROUP4_OFFSET, AR5K_EEPROM_GROUPS_START, AR5K_EEPROM_HDR_11A, AR5K_EEPROM_HDR_11B, AR5K_EEPROM_HDR_11G, AR5K_EEPROM_MODE_11A, AR5K_EEPROM_MODE_11B, AR5K_EEPROM_MODE_11G, AR5K_EEPROM_PCDAC_M, AR5K_EEPROM_POWER_M, AR5K_EEPROM_READ, ath5k_eeprom_convert_pcal_info_5111(), ath5k_eeprom_init_11a_pcal_freq(), ath5k_get_pcdac_intercepts(), ath5k_eeprom_info::ee_header, ath5k_eeprom_info::ee_n_piers, ath5k_eeprom_info::ee_pwr_cal_a, ath5k_eeprom_info::ee_pwr_cal_b, ath5k_eeprom_info::ee_pwr_cal_g, ath5k_eeprom_info::ee_version, EINVAL, ath5k_chan_pcal_info::freq, mode, offset, ath5k_chan_pcal_info_rf5111::pcdac, ath5k_chan_pcal_info_rf5111::pcdac_max, ath5k_chan_pcal_info_rf5111::pcdac_min, ath5k_chan_pcal_info_rf5111::pwr, ath5k_chan_pcal_info::rf5111_info, and val.

Referenced by ath5k_eeprom_read_pcal_info().

◆ ath5k_eeprom_convert_pcal_info_5112()

static int ath5k_eeprom_convert_pcal_info_5112 ( struct ath5k_hw ah,
int  mode,
struct ath5k_chan_pcal_info chinfo 
)
static

Definition at line 849 of file ath5k_eeprom.c.

851 {
852  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
853  struct ath5k_chan_pcal_info_rf5112 *pcinfo;
854  u8 *pdgain_idx = ee->ee_pdc_to_idx[mode];
855  unsigned int pier, pdg, point;
856 
857  /* Fill raw data for each calibration pier */
858  for (pier = 0; pier < ee->ee_n_piers[mode]; pier++) {
859 
860  pcinfo = &chinfo[pier].rf5112_info;
861 
862  /* Allocate pd_curves for this cal pier */
863  chinfo[pier].pd_curves =
865  sizeof(struct ath5k_pdgain_info));
866 
867  if (!chinfo[pier].pd_curves)
868  return -ENOMEM;
869 
870  /* Fill pd_curves */
871  for (pdg = 0; pdg < ee->ee_pd_gains[mode]; pdg++) {
872 
873  u8 idx = pdgain_idx[pdg];
874  struct ath5k_pdgain_info *pd =
875  &chinfo[pier].pd_curves[idx];
876 
877  /* Lowest gain curve (max power) */
878  if (pdg == 0) {
879  /* One more point for better accuracy */
881 
882  /* Allocate pd points for this curve */
883  pd->pd_step = calloc(pd->pd_points, sizeof(u8));
884 
885  if (!pd->pd_step)
886  return -ENOMEM;
887 
888  pd->pd_pwr = calloc(pd->pd_points, sizeof(s16));
889 
890  if (!pd->pd_pwr)
891  return -ENOMEM;
892 
893 
894  /* Fill raw dataset
895  * (all power levels are in 0.25dB units) */
896  pd->pd_step[0] = pcinfo->pcdac_x0[0];
897  pd->pd_pwr[0] = pcinfo->pwr_x0[0];
898 
899  for (point = 1; point < pd->pd_points;
900  point++) {
901  /* Absolute values */
902  pd->pd_pwr[point] =
903  pcinfo->pwr_x0[point];
904 
905  /* Deltas */
906  pd->pd_step[point] =
907  pd->pd_step[point - 1] +
908  pcinfo->pcdac_x0[point];
909  }
910 
911  /* Set min power for this frequency */
912  chinfo[pier].min_pwr = pd->pd_pwr[0];
913 
914  /* Highest gain curve (min power) */
915  } else if (pdg == 1) {
916 
918 
919  /* Allocate pd points for this curve */
920  pd->pd_step = calloc(pd->pd_points, sizeof(u8));
921 
922  if (!pd->pd_step)
923  return -ENOMEM;
924 
925  pd->pd_pwr = calloc(pd->pd_points, sizeof(s16));
926 
927  if (!pd->pd_pwr)
928  return -ENOMEM;
929 
930  /* Fill raw dataset
931  * (all power levels are in 0.25dB units) */
932  for (point = 0; point < pd->pd_points;
933  point++) {
934  /* Absolute values */
935  pd->pd_pwr[point] =
936  pcinfo->pwr_x3[point];
937 
938  /* Fixed points */
939  pd->pd_step[point] =
940  pcinfo->pcdac_x3[point];
941  }
942 
943  /* Since we have a higher gain curve
944  * override min power */
945  chinfo[pier].min_pwr = pd->pd_pwr[0];
946  }
947  }
948  }
949 
950  return 0;
951 }
u8 ee_pd_gains[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:423
int16_t s16
Definition: stdint.h:21
struct ath5k_pdgain_info * pd_curves
Definition: eeprom.h:342
#define AR5K_EEPROM_N_PD_CURVES
Definition: eeprom.h:206
u8 ee_pdc_to_idx[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_PD_GAINS]
Definition: eeprom.h:425
uint16_t mode
Acceleration mode.
Definition: ena.h:26
s8 pwr_x0[AR5K_EEPROM_N_XPD0_POINTS]
Definition: eeprom.h:294
#define AR5K_EEPROM_N_XPD3_POINTS
Definition: eeprom.h:208
s8 pwr_x3[AR5K_EEPROM_N_XPD3_POINTS]
Definition: eeprom.h:295
#define ENOMEM
Not enough space.
Definition: errno.h:535
static void *__malloc calloc(size_t nmemb, size_t size)
Allocate cleared memory.
Definition: stdlib.h:46
u8 ee_n_piers[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:427
u8 pcdac_x3[AR5K_EEPROM_N_XPD3_POINTS]
Definition: eeprom.h:299
struct ath5k_chan_pcal_info_rf5112 rf5112_info
Definition: eeprom.h:336
#define AR5K_EEPROM_N_XPD0_POINTS
Definition: eeprom.h:207
u8 pcdac_x0[AR5K_EEPROM_N_XPD0_POINTS]
Definition: eeprom.h:298
uint8_t ah
Definition: registers.h:85
uint8_t u8
Definition: stdint.h:20

References ah, AR5K_EEPROM_N_PD_CURVES, AR5K_EEPROM_N_XPD0_POINTS, AR5K_EEPROM_N_XPD3_POINTS, calloc(), ath5k_eeprom_info::ee_n_piers, ath5k_eeprom_info::ee_pd_gains, ath5k_eeprom_info::ee_pdc_to_idx, ENOMEM, ath5k_chan_pcal_info::min_pwr, mode, ath5k_chan_pcal_info_rf5112::pcdac_x0, ath5k_chan_pcal_info_rf5112::pcdac_x3, ath5k_chan_pcal_info::pd_curves, ath5k_pdgain_info::pd_points, ath5k_pdgain_info::pd_pwr, ath5k_pdgain_info::pd_step, ath5k_chan_pcal_info_rf5112::pwr_x0, ath5k_chan_pcal_info_rf5112::pwr_x3, and ath5k_chan_pcal_info::rf5112_info.

Referenced by ath5k_eeprom_read_pcal_info_5112().

◆ ath5k_eeprom_read_pcal_info_5112()

static int ath5k_eeprom_read_pcal_info_5112 ( struct ath5k_hw ah,
int  mode 
)
static

Definition at line 955 of file ath5k_eeprom.c.

956 {
957  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
958  struct ath5k_chan_pcal_info_rf5112 *chan_pcal_info;
959  struct ath5k_chan_pcal_info *gen_chan_info;
960  u8 *pdgain_idx = ee->ee_pdc_to_idx[mode];
961  u32 offset;
962  u8 i, c;
963  u16 val;
964  int ret;
965  u8 pd_gains = 0;
966 
967  /* Count how many curves we have and
968  * identify them (which one of the 4
969  * available curves we have on each count).
970  * Curves are stored from lower (x0) to
971  * higher (x3) gain */
972  for (i = 0; i < AR5K_EEPROM_N_PD_CURVES; i++) {
973  /* ee_x_gain[mode] is x gain mask */
974  if ((ee->ee_x_gain[mode] >> i) & 0x1)
975  pdgain_idx[pd_gains++] = i;
976  }
977  ee->ee_pd_gains[mode] = pd_gains;
978 
979  if (pd_gains == 0 || pd_gains > 2)
980  return -EINVAL;
981 
982  switch (mode) {
984  /*
985  * Read 5GHz EEPROM channels
986  */
989 
991  gen_chan_info = ee->ee_pwr_cal_a;
992  break;
997 
998  /* NB: frequency piers parsed during mode init */
999  gen_chan_info = ee->ee_pwr_cal_b;
1000  break;
1001  case AR5K_EEPROM_MODE_11G:
1003  if (AR5K_EEPROM_HDR_11A(ee->ee_header))
1005  else if (AR5K_EEPROM_HDR_11B(ee->ee_header))
1007 
1008  /* NB: frequency piers parsed during mode init */
1009  gen_chan_info = ee->ee_pwr_cal_g;
1010  break;
1011  default:
1012  return -EINVAL;
1013  }
1014 
1015  for (i = 0; i < ee->ee_n_piers[mode]; i++) {
1016  chan_pcal_info = &gen_chan_info[i].rf5112_info;
1017 
1018  /* Power values in quarter dB
1019  * for the lower xpd gain curve
1020  * (0 dBm -> higher output power) */
1021  for (c = 0; c < AR5K_EEPROM_N_XPD0_POINTS; c++) {
1023  chan_pcal_info->pwr_x0[c] = (s8) (val & 0xff);
1024  chan_pcal_info->pwr_x0[++c] = (s8) ((val >> 8) & 0xff);
1025  }
1026 
1027  /* PCDAC steps
1028  * corresponding to the above power
1029  * measurements */
1031  chan_pcal_info->pcdac_x0[1] = (val & 0x1f);
1032  chan_pcal_info->pcdac_x0[2] = ((val >> 5) & 0x1f);
1033  chan_pcal_info->pcdac_x0[3] = ((val >> 10) & 0x1f);
1034 
1035  /* Power values in quarter dB
1036  * for the higher xpd gain curve
1037  * (18 dBm -> lower output power) */
1039  chan_pcal_info->pwr_x3[0] = (s8) (val & 0xff);
1040  chan_pcal_info->pwr_x3[1] = (s8) ((val >> 8) & 0xff);
1041 
1043  chan_pcal_info->pwr_x3[2] = (val & 0xff);
1044 
1045  /* PCDAC steps
1046  * corresponding to the above power
1047  * measurements (fixed) */
1048  chan_pcal_info->pcdac_x3[0] = 20;
1049  chan_pcal_info->pcdac_x3[1] = 35;
1050  chan_pcal_info->pcdac_x3[2] = 63;
1051 
1052  if (ee->ee_version >= AR5K_EEPROM_VERSION_4_3) {
1053  chan_pcal_info->pcdac_x0[0] = ((val >> 8) & 0x3f);
1054 
1055  /* Last xpd0 power level is also channel maximum */
1056  gen_chan_info[i].max_pwr = chan_pcal_info->pwr_x0[3];
1057  } else {
1058  chan_pcal_info->pcdac_x0[0] = 1;
1059  gen_chan_info[i].max_pwr = (s8) ((val >> 8) & 0xff);
1060  }
1061 
1062  }
1063 
1064  return ath5k_eeprom_convert_pcal_info_5112(ah, mode, gen_chan_info);
1065 }
uint16_t u16
Definition: stdint.h:22
int8_t s8
Definition: stdint.h:19
#define EINVAL
Invalid argument.
Definition: errno.h:429
u8 ee_pd_gains[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:423
#define AR5K_EEPROM_HDR_11B(_v)
Definition: eeprom.h:70
#define AR5K_EEPROM_GROUP4_OFFSET
Definition: eeprom.h:143
#define AR5K_EEPROM_MODE_11G
Definition: eeprom.h:66
void __asmcall int val
Definition: setjmp.h:12
#define AR5K_EEPROM_N_PD_CURVES
Definition: eeprom.h:206
#define AR5K_EEPROM_MODE_11A
Definition: eeprom.h:64
u8 ee_pdc_to_idx[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_PD_GAINS]
Definition: eeprom.h:425
uint16_t mode
Acceleration mode.
Definition: ena.h:26
s8 pwr_x0[AR5K_EEPROM_N_XPD0_POINTS]
Definition: eeprom.h:294
u16 ee_x_gain[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:412
s8 pwr_x3[AR5K_EEPROM_N_XPD3_POINTS]
Definition: eeprom.h:295
struct ath5k_chan_pcal_info ee_pwr_cal_b[AR5K_EEPROM_N_2GHZ_CHAN_MAX]
Definition: eeprom.h:429
struct ath5k_chan_pcal_info ee_pwr_cal_g[AR5K_EEPROM_N_2GHZ_CHAN_MAX]
Definition: eeprom.h:430
static int ath5k_eeprom_init_11a_pcal_freq(struct ath5k_hw *ah, int offset)
Definition: ath5k_eeprom.c:550
static int ath5k_eeprom_convert_pcal_info_5112(struct ath5k_hw *ah, int mode, struct ath5k_chan_pcal_info *chinfo)
Definition: ath5k_eeprom.c:849
#define AR5K_EEPROM_HDR_11A(_v)
Definition: eeprom.h:69
#define AR5K_EEPROM_GROUPS_START(_v)
Definition: eeprom.h:139
u8 ee_n_piers[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:427
#define AR5K_EEPROM_VERSION_4_3
Definition: eeprom.h:54
#define AR5K_EEPROM_MODE_11B
Definition: eeprom.h:65
u8 pcdac_x3[AR5K_EEPROM_N_XPD3_POINTS]
Definition: eeprom.h:299
struct ath5k_chan_pcal_info_rf5112 rf5112_info
Definition: eeprom.h:336
struct ath5k_chan_pcal_info ee_pwr_cal_a[AR5K_EEPROM_N_5GHZ_CHAN]
Definition: eeprom.h:428
#define AR5K_EEPROM_N_XPD0_POINTS
Definition: eeprom.h:207
u8 pcdac_x0[AR5K_EEPROM_N_XPD0_POINTS]
Definition: eeprom.h:298
#define AR5K_EEPROM_GROUP2_OFFSET
Definition: eeprom.h:141
uint8_t ah
Definition: registers.h:85
#define AR5K_EEPROM_GROUP3_OFFSET
Definition: eeprom.h:142
uint16_t offset
Offset to command line.
Definition: bzimage.h:8
#define AR5K_EEPROM_READ(_o, _v)
Definition: eeprom.h:224
uint8_t u8
Definition: stdint.h:20
uint32_t u32
Definition: stdint.h:24

References ah, AR5K_EEPROM_GROUP2_OFFSET, AR5K_EEPROM_GROUP3_OFFSET, AR5K_EEPROM_GROUP4_OFFSET, AR5K_EEPROM_GROUPS_START, AR5K_EEPROM_HDR_11A, AR5K_EEPROM_HDR_11B, AR5K_EEPROM_MODE_11A, AR5K_EEPROM_MODE_11B, AR5K_EEPROM_MODE_11G, AR5K_EEPROM_N_PD_CURVES, AR5K_EEPROM_N_XPD0_POINTS, AR5K_EEPROM_READ, AR5K_EEPROM_VERSION_4_3, ath5k_eeprom_convert_pcal_info_5112(), ath5k_eeprom_init_11a_pcal_freq(), ath5k_eeprom_info::ee_header, ath5k_eeprom_info::ee_n_piers, ath5k_eeprom_info::ee_pd_gains, ath5k_eeprom_info::ee_pdc_to_idx, ath5k_eeprom_info::ee_pwr_cal_a, ath5k_eeprom_info::ee_pwr_cal_b, ath5k_eeprom_info::ee_pwr_cal_g, ath5k_eeprom_info::ee_version, ath5k_eeprom_info::ee_x_gain, EINVAL, ath5k_chan_pcal_info::max_pwr, mode, offset, ath5k_chan_pcal_info_rf5112::pcdac_x0, ath5k_chan_pcal_info_rf5112::pcdac_x3, ath5k_chan_pcal_info_rf5112::pwr_x0, ath5k_chan_pcal_info_rf5112::pwr_x3, ath5k_chan_pcal_info::rf5112_info, and val.

Referenced by ath5k_eeprom_read_pcal_info().

◆ ath5k_pdgains_size_2413()

static unsigned int ath5k_pdgains_size_2413 ( struct ath5k_eeprom_info ee,
unsigned int  mode 
)
inlinestatic

Definition at line 1091 of file ath5k_eeprom.c.

1092 {
1093  static const unsigned int pdgains_size[] = { 4, 6, 9, 12 };
1094  unsigned int sz;
1095 
1096  sz = pdgains_size[ee->ee_pd_gains[mode] - 1];
1097  sz *= ee->ee_n_piers[mode];
1098 
1099  return sz;
1100 }
u8 ee_pd_gains[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:423
uint16_t mode
Acceleration mode.
Definition: ena.h:26
u8 ee_n_piers[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:427

References ath5k_eeprom_info::ee_n_piers, ath5k_eeprom_info::ee_pd_gains, and mode.

Referenced by ath5k_cal_data_offset_2413().

◆ ath5k_cal_data_offset_2413()

static unsigned int ath5k_cal_data_offset_2413 ( struct ath5k_eeprom_info ee,
int  mode 
)
static

Definition at line 1105 of file ath5k_eeprom.c.

1106 {
1108 
1109  switch(mode) {
1110  case AR5K_EEPROM_MODE_11G:
1111  if (AR5K_EEPROM_HDR_11B(ee->ee_header))
1115  /* fall through */
1116  case AR5K_EEPROM_MODE_11B:
1117  if (AR5K_EEPROM_HDR_11A(ee->ee_header))
1121  /* fall through */
1122  case AR5K_EEPROM_MODE_11A:
1123  break;
1124  default:
1125  break;
1126  }
1127 
1128  return offset;
1129 }
#define AR5K_EEPROM_HDR_11B(_v)
Definition: eeprom.h:70
#define AR5K_EEPROM_N_5GHZ_CHAN
Definition: eeprom.h:182
#define AR5K_EEPROM_MODE_11G
Definition: eeprom.h:66
#define AR5K_EEPROM_MODE_11A
Definition: eeprom.h:64
#define AR5K_EEPROM_CAL_DATA_START(_v)
Definition: eeprom.h:112
uint16_t mode
Acceleration mode.
Definition: ena.h:26
static unsigned int ath5k_pdgains_size_2413(struct ath5k_eeprom_info *ee, unsigned int mode)
#define AR5K_EEPROM_HDR_11A(_v)
Definition: eeprom.h:69
#define AR5K_EEPROM_MODE_11B
Definition: eeprom.h:65
#define AR5K_EEPROM_N_2GHZ_CHAN_2413
Definition: eeprom.h:184
uint16_t offset
Offset to command line.
Definition: bzimage.h:8
uint32_t u32
Definition: stdint.h:24

References AR5K_EEPROM_CAL_DATA_START, AR5K_EEPROM_HDR_11A, AR5K_EEPROM_HDR_11B, AR5K_EEPROM_MODE_11A, AR5K_EEPROM_MODE_11B, AR5K_EEPROM_MODE_11G, AR5K_EEPROM_N_2GHZ_CHAN_2413, AR5K_EEPROM_N_5GHZ_CHAN, ath5k_pdgains_size_2413(), ath5k_eeprom_info::ee_header, ath5k_eeprom_info::ee_misc4, mode, and offset.

Referenced by ath5k_eeprom_read_pcal_info_2413().

◆ ath5k_eeprom_convert_pcal_info_2413()

static int ath5k_eeprom_convert_pcal_info_2413 ( struct ath5k_hw ah,
int  mode,
struct ath5k_chan_pcal_info chinfo 
)
static

Definition at line 1134 of file ath5k_eeprom.c.

1136 {
1137  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
1138  struct ath5k_chan_pcal_info_rf2413 *pcinfo;
1139  u8 *pdgain_idx = ee->ee_pdc_to_idx[mode];
1140  unsigned int pier, point;
1141  int pdg;
1142 
1143  /* Fill raw data for each calibration pier */
1144  for (pier = 0; pier < ee->ee_n_piers[mode]; pier++) {
1145 
1146  pcinfo = &chinfo[pier].rf2413_info;
1147 
1148  /* Allocate pd_curves for this cal pier */
1149  chinfo[pier].pd_curves =
1151  sizeof(struct ath5k_pdgain_info));
1152 
1153  if (!chinfo[pier].pd_curves)
1154  return -ENOMEM;
1155 
1156  /* Fill pd_curves */
1157  for (pdg = 0; pdg < ee->ee_pd_gains[mode]; pdg++) {
1158 
1159  u8 idx = pdgain_idx[pdg];
1160  struct ath5k_pdgain_info *pd =
1161  &chinfo[pier].pd_curves[idx];
1162 
1163  /* One more point for the highest power
1164  * curve (lowest gain) */
1165  if (pdg == ee->ee_pd_gains[mode] - 1)
1167  else
1169 
1170  /* Allocate pd points for this curve */
1171  pd->pd_step = calloc(pd->pd_points, sizeof(u8));
1172 
1173  if (!pd->pd_step)
1174  return -ENOMEM;
1175 
1176  pd->pd_pwr = calloc(pd->pd_points, sizeof(s16));
1177 
1178  if (!pd->pd_pwr)
1179  return -ENOMEM;
1180 
1181  /* Fill raw dataset
1182  * convert all pwr levels to
1183  * quarter dB for RF5112 combatibility */
1184  pd->pd_step[0] = pcinfo->pddac_i[pdg];
1185  pd->pd_pwr[0] = 4 * pcinfo->pwr_i[pdg];
1186 
1187  for (point = 1; point < pd->pd_points; point++) {
1188 
1189  pd->pd_pwr[point] = pd->pd_pwr[point - 1] +
1190  2 * pcinfo->pwr[pdg][point - 1];
1191 
1192  pd->pd_step[point] = pd->pd_step[point - 1] +
1193  pcinfo->pddac[pdg][point - 1];
1194 
1195  }
1196 
1197  /* Highest gain curve -> min power */
1198  if (pdg == 0)
1199  chinfo[pier].min_pwr = pd->pd_pwr[0];
1200 
1201  /* Lowest gain curve -> max power */
1202  if (pdg == ee->ee_pd_gains[mode] - 1)
1203  chinfo[pier].max_pwr =
1204  pd->pd_pwr[pd->pd_points - 1];
1205  }
1206  }
1207 
1208  return 0;
1209 }
u8 ee_pd_gains[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:423
int16_t s16
Definition: stdint.h:21
struct ath5k_pdgain_info * pd_curves
Definition: eeprom.h:342
#define AR5K_EEPROM_N_PD_CURVES
Definition: eeprom.h:206
u8 ee_pdc_to_idx[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_PD_GAINS]
Definition: eeprom.h:425
uint16_t mode
Acceleration mode.
Definition: ena.h:26
#define ENOMEM
Not enough space.
Definition: errno.h:535
static void *__malloc calloc(size_t nmemb, size_t size)
Allocate cleared memory.
Definition: stdlib.h:46
s8 pwr[AR5K_EEPROM_N_PD_GAINS][AR5K_EEPROM_N_PD_POINTS]
Definition: eeprom.h:309
u8 ee_n_piers[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:427
#define AR5K_EEPROM_N_PD_POINTS
Definition: eeprom.h:210
u8 pddac_i[AR5K_EEPROM_N_PD_GAINS]
Definition: eeprom.h:305
uint8_t ah
Definition: registers.h:85
s8 pwr_i[AR5K_EEPROM_N_PD_GAINS]
Definition: eeprom.h:304
struct ath5k_chan_pcal_info_rf2413 rf2413_info
Definition: eeprom.h:337
u8 pddac[AR5K_EEPROM_N_PD_GAINS][AR5K_EEPROM_N_PD_POINTS]
Definition: eeprom.h:311
uint8_t u8
Definition: stdint.h:20

References ah, AR5K_EEPROM_N_PD_CURVES, AR5K_EEPROM_N_PD_POINTS, calloc(), ath5k_eeprom_info::ee_n_piers, ath5k_eeprom_info::ee_pd_gains, ath5k_eeprom_info::ee_pdc_to_idx, ENOMEM, ath5k_chan_pcal_info::max_pwr, ath5k_chan_pcal_info::min_pwr, mode, ath5k_chan_pcal_info::pd_curves, ath5k_pdgain_info::pd_points, ath5k_pdgain_info::pd_pwr, ath5k_pdgain_info::pd_step, ath5k_chan_pcal_info_rf2413::pddac, ath5k_chan_pcal_info_rf2413::pddac_i, ath5k_chan_pcal_info_rf2413::pwr, ath5k_chan_pcal_info_rf2413::pwr_i, and ath5k_chan_pcal_info::rf2413_info.

Referenced by ath5k_eeprom_read_pcal_info_2413().

◆ ath5k_eeprom_read_pcal_info_2413()

static int ath5k_eeprom_read_pcal_info_2413 ( struct ath5k_hw ah,
int  mode 
)
static

Definition at line 1213 of file ath5k_eeprom.c.

1214 {
1215  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
1216  struct ath5k_chan_pcal_info_rf2413 *pcinfo;
1217  struct ath5k_chan_pcal_info *chinfo;
1218  u8 *pdgain_idx = ee->ee_pdc_to_idx[mode];
1219  u32 offset;
1220  int idx, i, ret;
1221  u16 val;
1222  u8 pd_gains = 0;
1223 
1224  /* Count how many curves we have and
1225  * identify them (which one of the 4
1226  * available curves we have on each count).
1227  * Curves are stored from higher to
1228  * lower gain so we go backwards */
1229  for (idx = AR5K_EEPROM_N_PD_CURVES - 1; idx >= 0; idx--) {
1230  /* ee_x_gain[mode] is x gain mask */
1231  if ((ee->ee_x_gain[mode] >> idx) & 0x1)
1232  pdgain_idx[pd_gains++] = idx;
1233 
1234  }
1235  ee->ee_pd_gains[mode] = pd_gains;
1236 
1237  if (pd_gains == 0)
1238  return -EINVAL;
1239 
1241  switch (mode) {
1242  case AR5K_EEPROM_MODE_11A:
1243  if (!AR5K_EEPROM_HDR_11A(ee->ee_header))
1244  return 0;
1245 
1248  chinfo = ee->ee_pwr_cal_a;
1249  break;
1250  case AR5K_EEPROM_MODE_11B:
1251  if (!AR5K_EEPROM_HDR_11B(ee->ee_header))
1252  return 0;
1253 
1256  chinfo = ee->ee_pwr_cal_b;
1257  break;
1258  case AR5K_EEPROM_MODE_11G:
1259  if (!AR5K_EEPROM_HDR_11G(ee->ee_header))
1260  return 0;
1261 
1264  chinfo = ee->ee_pwr_cal_g;
1265  break;
1266  default:
1267  return -EINVAL;
1268  }
1269 
1270  for (i = 0; i < ee->ee_n_piers[mode]; i++) {
1271  pcinfo = &chinfo[i].rf2413_info;
1272 
1273  /*
1274  * Read pwr_i, pddac_i and the first
1275  * 2 pd points (pwr, pddac)
1276  */
1278  pcinfo->pwr_i[0] = val & 0x1f;
1279  pcinfo->pddac_i[0] = (val >> 5) & 0x7f;
1280  pcinfo->pwr[0][0] = (val >> 12) & 0xf;
1281 
1283  pcinfo->pddac[0][0] = val & 0x3f;
1284  pcinfo->pwr[0][1] = (val >> 6) & 0xf;
1285  pcinfo->pddac[0][1] = (val >> 10) & 0x3f;
1286 
1288  pcinfo->pwr[0][2] = val & 0xf;
1289  pcinfo->pddac[0][2] = (val >> 4) & 0x3f;
1290 
1291  pcinfo->pwr[0][3] = 0;
1292  pcinfo->pddac[0][3] = 0;
1293 
1294  if (pd_gains > 1) {
1295  /*
1296  * Pd gain 0 is not the last pd gain
1297  * so it only has 2 pd points.
1298  * Continue wih pd gain 1.
1299  */
1300  pcinfo->pwr_i[1] = (val >> 10) & 0x1f;
1301 
1302  pcinfo->pddac_i[1] = (val >> 15) & 0x1;
1304  pcinfo->pddac_i[1] |= (val & 0x3F) << 1;
1305 
1306  pcinfo->pwr[1][0] = (val >> 6) & 0xf;
1307  pcinfo->pddac[1][0] = (val >> 10) & 0x3f;
1308 
1310  pcinfo->pwr[1][1] = val & 0xf;
1311  pcinfo->pddac[1][1] = (val >> 4) & 0x3f;
1312  pcinfo->pwr[1][2] = (val >> 10) & 0xf;
1313 
1314  pcinfo->pddac[1][2] = (val >> 14) & 0x3;
1316  pcinfo->pddac[1][2] |= (val & 0xF) << 2;
1317 
1318  pcinfo->pwr[1][3] = 0;
1319  pcinfo->pddac[1][3] = 0;
1320  } else if (pd_gains == 1) {
1321  /*
1322  * Pd gain 0 is the last one so
1323  * read the extra point.
1324  */
1325  pcinfo->pwr[0][3] = (val >> 10) & 0xf;
1326 
1327  pcinfo->pddac[0][3] = (val >> 14) & 0x3;
1329  pcinfo->pddac[0][3] |= (val & 0xF) << 2;
1330  }
1331 
1332  /*
1333  * Proceed with the other pd_gains
1334  * as above.
1335  */
1336  if (pd_gains > 2) {
1337  pcinfo->pwr_i[2] = (val >> 4) & 0x1f;
1338  pcinfo->pddac_i[2] = (val >> 9) & 0x7f;
1339 
1341  pcinfo->pwr[2][0] = (val >> 0) & 0xf;
1342  pcinfo->pddac[2][0] = (val >> 4) & 0x3f;
1343  pcinfo->pwr[2][1] = (val >> 10) & 0xf;
1344 
1345  pcinfo->pddac[2][1] = (val >> 14) & 0x3;
1347  pcinfo->pddac[2][1] |= (val & 0xF) << 2;
1348 
1349  pcinfo->pwr[2][2] = (val >> 4) & 0xf;
1350  pcinfo->pddac[2][2] = (val >> 8) & 0x3f;
1351 
1352  pcinfo->pwr[2][3] = 0;
1353  pcinfo->pddac[2][3] = 0;
1354  } else if (pd_gains == 2) {
1355  pcinfo->pwr[1][3] = (val >> 4) & 0xf;
1356  pcinfo->pddac[1][3] = (val >> 8) & 0x3f;
1357  }
1358 
1359  if (pd_gains > 3) {
1360  pcinfo->pwr_i[3] = (val >> 14) & 0x3;
1362  pcinfo->pwr_i[3] |= ((val >> 0) & 0x7) << 2;
1363 
1364  pcinfo->pddac_i[3] = (val >> 3) & 0x7f;
1365  pcinfo->pwr[3][0] = (val >> 10) & 0xf;
1366  pcinfo->pddac[3][0] = (val >> 14) & 0x3;
1367 
1369  pcinfo->pddac[3][0] |= (val & 0xF) << 2;
1370  pcinfo->pwr[3][1] = (val >> 4) & 0xf;
1371  pcinfo->pddac[3][1] = (val >> 8) & 0x3f;
1372 
1373  pcinfo->pwr[3][2] = (val >> 14) & 0x3;
1375  pcinfo->pwr[3][2] |= ((val >> 0) & 0x3) << 2;
1376 
1377  pcinfo->pddac[3][2] = (val >> 2) & 0x3f;
1378  pcinfo->pwr[3][3] = (val >> 8) & 0xf;
1379 
1380  pcinfo->pddac[3][3] = (val >> 12) & 0xF;
1382  pcinfo->pddac[3][3] |= ((val >> 0) & 0x3) << 4;
1383  } else if (pd_gains == 3) {
1384  pcinfo->pwr[2][3] = (val >> 14) & 0x3;
1386  pcinfo->pwr[2][3] |= ((val >> 0) & 0x3) << 2;
1387 
1388  pcinfo->pddac[2][3] = (val >> 2) & 0x3f;
1389  }
1390  }
1391 
1392  return ath5k_eeprom_convert_pcal_info_2413(ah, mode, chinfo);
1393 }
uint16_t u16
Definition: stdint.h:22
#define EINVAL
Invalid argument.
Definition: errno.h:429
u8 ee_pd_gains[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:423
#define AR5K_EEPROM_HDR_11B(_v)
Definition: eeprom.h:70
#define AR5K_EEPROM_N_5GHZ_CHAN
Definition: eeprom.h:182
#define AR5K_EEPROM_MODE_11G
Definition: eeprom.h:66
void __asmcall int val
Definition: setjmp.h:12
#define AR5K_EEPROM_N_PD_CURVES
Definition: eeprom.h:206
#define AR5K_EEPROM_MODE_11A
Definition: eeprom.h:64
u8 ee_pdc_to_idx[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_PD_GAINS]
Definition: eeprom.h:425
uint16_t mode
Acceleration mode.
Definition: ena.h:26
u16 ee_x_gain[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:412
static unsigned int ath5k_cal_data_offset_2413(struct ath5k_eeprom_info *ee, int mode)
static int ath5k_eeprom_convert_pcal_info_2413(struct ath5k_hw *ah, int mode, struct ath5k_chan_pcal_info *chinfo)
struct ath5k_chan_pcal_info ee_pwr_cal_b[AR5K_EEPROM_N_2GHZ_CHAN_MAX]
Definition: eeprom.h:429
struct ath5k_chan_pcal_info ee_pwr_cal_g[AR5K_EEPROM_N_2GHZ_CHAN_MAX]
Definition: eeprom.h:430
static int ath5k_eeprom_init_11a_pcal_freq(struct ath5k_hw *ah, int offset)
Definition: ath5k_eeprom.c:550
s8 pwr[AR5K_EEPROM_N_PD_GAINS][AR5K_EEPROM_N_PD_POINTS]
Definition: eeprom.h:309
#define AR5K_EEPROM_HDR_11A(_v)
Definition: eeprom.h:69
u8 ee_n_piers[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:427
#define AR5K_EEPROM_MODE_11B
Definition: eeprom.h:65
u8 pddac_i[AR5K_EEPROM_N_PD_GAINS]
Definition: eeprom.h:305
struct ath5k_chan_pcal_info ee_pwr_cal_a[AR5K_EEPROM_N_5GHZ_CHAN]
Definition: eeprom.h:428
#define AR5K_EEPROM_N_2GHZ_CHAN_2413
Definition: eeprom.h:184
uint8_t ah
Definition: registers.h:85
s8 pwr_i[AR5K_EEPROM_N_PD_GAINS]
Definition: eeprom.h:304
struct ath5k_chan_pcal_info_rf2413 rf2413_info
Definition: eeprom.h:337
uint16_t offset
Offset to command line.
Definition: bzimage.h:8
static int ath5k_eeprom_init_11bg_2413(struct ath5k_hw *ah, unsigned int mode, int offset)
Definition: ath5k_eeprom.c:603
#define AR5K_EEPROM_READ(_o, _v)
Definition: eeprom.h:224
u8 pddac[AR5K_EEPROM_N_PD_GAINS][AR5K_EEPROM_N_PD_POINTS]
Definition: eeprom.h:311
#define AR5K_EEPROM_HDR_11G(_v)
Definition: eeprom.h:71
uint8_t u8
Definition: stdint.h:20
uint32_t u32
Definition: stdint.h:24

References ah, AR5K_EEPROM_HDR_11A, AR5K_EEPROM_HDR_11B, AR5K_EEPROM_HDR_11G, AR5K_EEPROM_MODE_11A, AR5K_EEPROM_MODE_11B, AR5K_EEPROM_MODE_11G, AR5K_EEPROM_N_2GHZ_CHAN_2413, AR5K_EEPROM_N_5GHZ_CHAN, AR5K_EEPROM_N_PD_CURVES, AR5K_EEPROM_READ, ath5k_cal_data_offset_2413(), ath5k_eeprom_convert_pcal_info_2413(), ath5k_eeprom_init_11a_pcal_freq(), ath5k_eeprom_init_11bg_2413(), ath5k_eeprom_info::ee_header, ath5k_eeprom_info::ee_n_piers, ath5k_eeprom_info::ee_pd_gains, ath5k_eeprom_info::ee_pdc_to_idx, ath5k_eeprom_info::ee_pwr_cal_a, ath5k_eeprom_info::ee_pwr_cal_b, ath5k_eeprom_info::ee_pwr_cal_g, ath5k_eeprom_info::ee_x_gain, EINVAL, mode, offset, ath5k_chan_pcal_info_rf2413::pddac, ath5k_chan_pcal_info_rf2413::pddac_i, ath5k_chan_pcal_info_rf2413::pwr, ath5k_chan_pcal_info_rf2413::pwr_i, ath5k_chan_pcal_info::rf2413_info, and val.

Referenced by ath5k_eeprom_read_pcal_info().

◆ ath5k_eeprom_read_target_rate_pwr_info()

static int ath5k_eeprom_read_target_rate_pwr_info ( struct ath5k_hw ah,
unsigned int  mode 
)
static

Definition at line 1404 of file ath5k_eeprom.c.

1405 {
1406  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
1407  struct ath5k_rate_pcal_info *rate_pcal_info;
1408  u8 *rate_target_pwr_num;
1409  u32 offset;
1410  u16 val;
1411  int ret, i;
1412 
1414  rate_target_pwr_num = &ee->ee_rate_target_pwr_num[mode];
1415  switch (mode) {
1416  case AR5K_EEPROM_MODE_11A:
1418  rate_pcal_info = ee->ee_rate_tpwr_a;
1420  break;
1421  case AR5K_EEPROM_MODE_11B:
1423  rate_pcal_info = ee->ee_rate_tpwr_b;
1424  ee->ee_rate_target_pwr_num[mode] = 2; /* 3rd is g mode's 1st */
1425  break;
1426  case AR5K_EEPROM_MODE_11G:
1428  rate_pcal_info = ee->ee_rate_tpwr_g;
1430  break;
1431  default:
1432  return -EINVAL;
1433  }
1434 
1435  /* Different freq mask for older eeproms (<= v3.2) */
1436  if (ee->ee_version <= AR5K_EEPROM_VERSION_3_2) {
1437  for (i = 0; i < (*rate_target_pwr_num); i++) {
1439  rate_pcal_info[i].freq =
1440  ath5k_eeprom_bin2freq(ee, (val >> 9) & 0x7f, mode);
1441 
1442  rate_pcal_info[i].target_power_6to24 = ((val >> 3) & 0x3f);
1443  rate_pcal_info[i].target_power_36 = (val << 3) & 0x3f;
1444 
1446 
1447  if (rate_pcal_info[i].freq == AR5K_EEPROM_CHANNEL_DIS ||
1448  val == 0) {
1449  (*rate_target_pwr_num) = i;
1450  break;
1451  }
1452 
1453  rate_pcal_info[i].target_power_36 |= ((val >> 13) & 0x7);
1454  rate_pcal_info[i].target_power_48 = ((val >> 7) & 0x3f);
1455  rate_pcal_info[i].target_power_54 = ((val >> 1) & 0x3f);
1456  }
1457  } else {
1458  for (i = 0; i < (*rate_target_pwr_num); i++) {
1460  rate_pcal_info[i].freq =
1461  ath5k_eeprom_bin2freq(ee, (val >> 8) & 0xff, mode);
1462 
1463  rate_pcal_info[i].target_power_6to24 = ((val >> 2) & 0x3f);
1464  rate_pcal_info[i].target_power_36 = (val << 4) & 0x3f;
1465 
1467 
1468  if (rate_pcal_info[i].freq == AR5K_EEPROM_CHANNEL_DIS ||
1469  val == 0) {
1470  (*rate_target_pwr_num) = i;
1471  break;
1472  }
1473 
1474  rate_pcal_info[i].target_power_36 |= (val >> 12) & 0xf;
1475  rate_pcal_info[i].target_power_48 = ((val >> 6) & 0x3f);
1476  rate_pcal_info[i].target_power_54 = (val & 0x3f);
1477  }
1478  }
1479 
1480  return 0;
1481 }
uint16_t u16
Definition: stdint.h:22
#define EINVAL
Invalid argument.
Definition: errno.h:429
#define AR5K_EEPROM_N_5GHZ_CHAN
Definition: eeprom.h:182
#define AR5K_EEPROM_MODE_11G
Definition: eeprom.h:66
void __asmcall int val
Definition: setjmp.h:12
#define AR5K_EEPROM_MODE_11A
Definition: eeprom.h:64
#define AR5K_EEPROM_TARGET_PWRSTART(_v)
Definition: eeprom.h:99
uint16_t mode
Acceleration mode.
Definition: ena.h:26
#define AR5K_EEPROM_N_2GHZ_CHAN
Definition: eeprom.h:183
u8 ee_rate_target_pwr_num[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:433
#define AR5K_EEPROM_TARGET_PWR_OFF_11G(_v)
Definition: eeprom.h:153
#define AR5K_EEPROM_TARGET_PWR_OFF_11B(_v)
Definition: eeprom.h:151
#define AR5K_EEPROM_MODE_11B
Definition: eeprom.h:65
struct ath5k_rate_pcal_info ee_rate_tpwr_b[AR5K_EEPROM_N_2GHZ_CHAN_MAX]
Definition: eeprom.h:435
#define AR5K_EEPROM_CHANNEL_DIS
Definition: eeprom.h:202
struct ath5k_rate_pcal_info ee_rate_tpwr_a[AR5K_EEPROM_N_5GHZ_CHAN]
Definition: eeprom.h:434
#define AR5K_EEPROM_VERSION_3_2
Definition: eeprom.h:48
struct ath5k_rate_pcal_info ee_rate_tpwr_g[AR5K_EEPROM_N_2GHZ_CHAN_MAX]
Definition: eeprom.h:436
uint8_t ah
Definition: registers.h:85
#define AR5K_EEPROM_TARGET_PWR_OFF_11A(_v)
Definition: eeprom.h:149
uint16_t offset
Offset to command line.
Definition: bzimage.h:8
static u16 ath5k_eeprom_bin2freq(struct ath5k_eeprom_info *ee, u16 bin, unsigned int mode)
Definition: ath5k_eeprom.c:76
#define AR5K_EEPROM_READ(_o, _v)
Definition: eeprom.h:224
uint8_t u8
Definition: stdint.h:20
uint32_t u32
Definition: stdint.h:24

References ah, AR5K_EEPROM_CHANNEL_DIS, AR5K_EEPROM_MODE_11A, AR5K_EEPROM_MODE_11B, AR5K_EEPROM_MODE_11G, AR5K_EEPROM_N_2GHZ_CHAN, AR5K_EEPROM_N_5GHZ_CHAN, AR5K_EEPROM_READ, AR5K_EEPROM_TARGET_PWR_OFF_11A, AR5K_EEPROM_TARGET_PWR_OFF_11B, AR5K_EEPROM_TARGET_PWR_OFF_11G, AR5K_EEPROM_TARGET_PWRSTART, AR5K_EEPROM_VERSION_3_2, ath5k_eeprom_bin2freq(), ath5k_eeprom_info::ee_misc1, ath5k_eeprom_info::ee_rate_target_pwr_num, ath5k_eeprom_info::ee_rate_tpwr_a, ath5k_eeprom_info::ee_rate_tpwr_b, ath5k_eeprom_info::ee_rate_tpwr_g, ath5k_eeprom_info::ee_version, EINVAL, ath5k_rate_pcal_info::freq, mode, offset, ath5k_rate_pcal_info::target_power_36, ath5k_rate_pcal_info::target_power_48, ath5k_rate_pcal_info::target_power_54, ath5k_rate_pcal_info::target_power_6to24, and val.

Referenced by ath5k_eeprom_read_pcal_info().

◆ ath5k_eeprom_read_pcal_info()

static int ath5k_eeprom_read_pcal_info ( struct ath5k_hw ah)
static

Definition at line 1498 of file ath5k_eeprom.c.

1499 {
1500  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
1501  int (*read_pcal)(struct ath5k_hw *hw, int mode);
1502  int mode;
1503  int err;
1504 
1505  if ((ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_0) &&
1506  (AR5K_EEPROM_EEMAP(ee->ee_misc0) == 1))
1508  else if ((ah->ah_ee_version >= AR5K_EEPROM_VERSION_5_0) &&
1509  (AR5K_EEPROM_EEMAP(ee->ee_misc0) == 2))
1511  else
1513 
1514 
1516  mode++) {
1517  err = read_pcal(ah, mode);
1518  if (err)
1519  return err;
1520 
1522  if (err < 0)
1523  return err;
1524  }
1525 
1526  return 0;
1527 }
#define AR5K_EEPROM_MODE_11G
Definition: eeprom.h:66
#define AR5K_EEPROM_MODE_11A
Definition: eeprom.h:64
uint16_t mode
Acceleration mode.
Definition: ena.h:26
static int ath5k_eeprom_read_target_rate_pwr_info(struct ath5k_hw *ah, unsigned int mode)
Definition: hw.c:16
ath5k_hw_get_isr - Get interrupt status
Definition: ath5k.h:955
#define AR5K_EEPROM_VERSION_5_0
Definition: eeprom.h:60
#define AR5K_EEPROM_EEMAP(_v)
Definition: eeprom.h:96
static int ath5k_eeprom_read_pcal_info_2413(struct ath5k_hw *ah, int mode)
static int ath5k_eeprom_read_pcal_info_5111(struct ath5k_hw *ah, int mode)
Definition: ath5k_eeprom.c:740
uint8_t ah
Definition: registers.h:85
static int ath5k_eeprom_read_pcal_info_5112(struct ath5k_hw *ah, int mode)
Definition: ath5k_eeprom.c:955
#define AR5K_EEPROM_VERSION_4_0
Definition: eeprom.h:51

References ah, AR5K_EEPROM_EEMAP, AR5K_EEPROM_MODE_11A, AR5K_EEPROM_MODE_11G, AR5K_EEPROM_VERSION_4_0, AR5K_EEPROM_VERSION_5_0, ath5k_eeprom_read_pcal_info_2413(), ath5k_eeprom_read_pcal_info_5111(), ath5k_eeprom_read_pcal_info_5112(), ath5k_eeprom_read_target_rate_pwr_info(), ath5k_eeprom_info::ee_misc0, and mode.

Referenced by ath5k_eeprom_init().

◆ ath5k_eeprom_free_pcal_info()

static int ath5k_eeprom_free_pcal_info ( struct ath5k_hw ah,
int  mode 
)
static

Definition at line 1530 of file ath5k_eeprom.c.

1531 {
1532  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
1533  struct ath5k_chan_pcal_info *chinfo;
1534  u8 pier, pdg;
1535 
1536  switch (mode) {
1537  case AR5K_EEPROM_MODE_11A:
1538  if (!AR5K_EEPROM_HDR_11A(ee->ee_header))
1539  return 0;
1540  chinfo = ee->ee_pwr_cal_a;
1541  break;
1542  case AR5K_EEPROM_MODE_11B:
1543  if (!AR5K_EEPROM_HDR_11B(ee->ee_header))
1544  return 0;
1545  chinfo = ee->ee_pwr_cal_b;
1546  break;
1547  case AR5K_EEPROM_MODE_11G:
1548  if (!AR5K_EEPROM_HDR_11G(ee->ee_header))
1549  return 0;
1550  chinfo = ee->ee_pwr_cal_g;
1551  break;
1552  default:
1553  return -EINVAL;
1554  }
1555 
1556  for (pier = 0; pier < ee->ee_n_piers[mode]; pier++) {
1557  if (!chinfo[pier].pd_curves)
1558  continue;
1559 
1560  for (pdg = 0; pdg < ee->ee_pd_gains[mode]; pdg++) {
1561  struct ath5k_pdgain_info *pd =
1562  &chinfo[pier].pd_curves[pdg];
1563 
1564  if (pd != NULL) {
1565  free(pd->pd_step);
1566  free(pd->pd_pwr);
1567  }
1568  }
1569 
1570  free(chinfo[pier].pd_curves);
1571  }
1572 
1573  return 0;
1574 }
#define EINVAL
Invalid argument.
Definition: errno.h:429
u8 ee_pd_gains[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:423
#define AR5K_EEPROM_HDR_11B(_v)
Definition: eeprom.h:70
struct ath5k_pdgain_info * pd_curves
Definition: eeprom.h:342
#define AR5K_EEPROM_MODE_11G
Definition: eeprom.h:66
#define AR5K_EEPROM_MODE_11A
Definition: eeprom.h:64
uint16_t mode
Acceleration mode.
Definition: ena.h:26
struct ath5k_chan_pcal_info ee_pwr_cal_b[AR5K_EEPROM_N_2GHZ_CHAN_MAX]
Definition: eeprom.h:429
struct ath5k_chan_pcal_info ee_pwr_cal_g[AR5K_EEPROM_N_2GHZ_CHAN_MAX]
Definition: eeprom.h:430
#define AR5K_EEPROM_HDR_11A(_v)
Definition: eeprom.h:69
u8 ee_n_piers[AR5K_EEPROM_N_MODES]
Definition: eeprom.h:427
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:55
#define AR5K_EEPROM_MODE_11B
Definition: eeprom.h:65
struct ath5k_chan_pcal_info ee_pwr_cal_a[AR5K_EEPROM_N_5GHZ_CHAN]
Definition: eeprom.h:428
uint8_t ah
Definition: registers.h:85
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
#define AR5K_EEPROM_HDR_11G(_v)
Definition: eeprom.h:71
uint8_t u8
Definition: stdint.h:20

References ah, AR5K_EEPROM_HDR_11A, AR5K_EEPROM_HDR_11B, AR5K_EEPROM_HDR_11G, AR5K_EEPROM_MODE_11A, AR5K_EEPROM_MODE_11B, AR5K_EEPROM_MODE_11G, ath5k_eeprom_info::ee_header, ath5k_eeprom_info::ee_n_piers, ath5k_eeprom_info::ee_pd_gains, ath5k_eeprom_info::ee_pwr_cal_a, ath5k_eeprom_info::ee_pwr_cal_b, ath5k_eeprom_info::ee_pwr_cal_g, EINVAL, free, mode, NULL, ath5k_chan_pcal_info::pd_curves, ath5k_pdgain_info::pd_pwr, and ath5k_pdgain_info::pd_step.

Referenced by ath5k_eeprom_detach().

◆ ath5k_eeprom_detach()

void ath5k_eeprom_detach ( struct ath5k_hw ah)

Definition at line 1577 of file ath5k_eeprom.c.

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

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

Referenced by ath5k_hw_detach().

◆ ath5k_eeprom_read_ctl_info()

static int ath5k_eeprom_read_ctl_info ( struct ath5k_hw ah)
static

Definition at line 1587 of file ath5k_eeprom.c.

1588 {
1589  struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
1590  struct ath5k_edge_power *rep;
1591  unsigned int fmask, pmask;
1592  unsigned int ctl_mode;
1593  int ret, i, j;
1594  u32 offset;
1595  u16 val;
1596 
1597  pmask = AR5K_EEPROM_POWER_M;
1598  fmask = AR5K_EEPROM_FREQ_M(ee->ee_version);
1601  for (i = 0; i < ee->ee_ctls; i += 2) {
1603  ee->ee_ctl[i] = (val >> 8) & 0xff;
1604  ee->ee_ctl[i + 1] = val & 0xff;
1605  }
1606 
1611  else
1613 
1614  rep = ee->ee_ctl_pwr;
1615  for(i = 0; i < ee->ee_ctls; i++) {
1616  switch(ee->ee_ctl[i] & AR5K_CTL_MODE_M) {
1617  case AR5K_CTL_11A:
1618  case AR5K_CTL_TURBO:
1619  ctl_mode = AR5K_EEPROM_MODE_11A;
1620  break;
1621  default:
1622  ctl_mode = AR5K_EEPROM_MODE_11G;
1623  break;
1624  }
1625  if (ee->ee_ctl[i] == 0) {
1627  offset += 8;
1628  else
1629  offset += 7;
1630  rep += AR5K_EEPROM_N_EDGES;
1631  continue;
1632  }
1633  if (ee->ee_version >= AR5K_EEPROM_VERSION_3_3) {
1634  for (j = 0; j < AR5K_EEPROM_N_EDGES; j += 2) {
1636  rep[j].freq = (val >> 8) & fmask;
1637  rep[j + 1].freq = val & fmask;
1638  }
1639  for (j = 0; j < AR5K_EEPROM_N_EDGES; j += 2) {
1641  rep[j].edge = (val >> 8) & pmask;
1642  rep[j].flag = (val >> 14) & 1;
1643  rep[j + 1].edge = val & pmask;
1644  rep[j + 1].flag = (val >> 6) & 1;
1645  }
1646  } else {
1648  rep[0].freq = (val >> 9) & fmask;
1649  rep[1].freq = (val >> 2) & fmask;
1650  rep[2].freq = (val << 5) & fmask;
1651 
1653  rep[2].freq |= (val >> 11) & 0x1f;
1654  rep[3].freq = (val >> 4) & fmask;
1655  rep[4].freq = (val << 3) & fmask;
1656 
1658  rep[4].freq |= (val >> 13) & 0x7;
1659  rep[5].freq = (val >> 6) & fmask;
1660  rep[6].freq = (val << 1) & fmask;
1661 
1663  rep[6].freq |= (val >> 15) & 0x1;
1664  rep[7].freq = (val >> 8) & fmask;
1665 
1666  rep[0].edge = (val >> 2) & pmask;
1667  rep[1].edge = (val << 4) & pmask;
1668 
1670  rep[1].edge |= (val >> 12) & 0xf;
1671  rep[2].edge = (val >> 6) & pmask;
1672  rep[3].edge = val & pmask;
1673 
1675  rep[4].edge = (val >> 10) & pmask;
1676  rep[5].edge = (val >> 4) & pmask;
1677  rep[6].edge = (val << 2) & pmask;
1678 
1680  rep[6].edge |= (val >> 14) & 0x3;
1681  rep[7].edge = (val >> 8) & pmask;
1682  }
1683  for (j = 0; j < AR5K_EEPROM_N_EDGES; j++) {
1684  rep[j].freq = ath5k_eeprom_bin2freq(ee,
1685  rep[j].freq, ctl_mode);
1686  }
1687  rep += AR5K_EEPROM_N_EDGES;
1688  }
1689 
1690  return 0;
1691 }
uint16_t u16
Definition: stdint.h:22
#define AR5K_EEPROM_MODE_11G
Definition: eeprom.h:66
void __asmcall int val
Definition: setjmp.h:12
u8 ee_ctl[AR5K_EEPROM_MAX_CTLS]
Definition: eeprom.h:440
#define AR5K_EEPROM_MODE_11A
Definition: eeprom.h:64
#define AR5K_EEPROM_TARGET_PWRSTART(_v)
Definition: eeprom.h:99
#define AR5K_EEPROM_POWER_M
Definition: eeprom.h:213
#define AR5K_EEPROM_GROUP5_OFFSET
Definition: eeprom.h:144
#define AR5K_EEPROM_VERSION_3_3
Definition: eeprom.h:49
#define AR5K_EEPROM_CTL(_v)
Definition: eeprom.h:138
#define AR5K_EEPROM_GROUPS_START(_v)
Definition: eeprom.h:139
#define AR5K_EEPROM_N_CTLS(_v)
Definition: eeprom.h:204
#define AR5K_EEPROM_N_EDGES
Definition: eeprom.h:191
#define AR5K_EEPROM_GROUP8_OFFSET
Definition: eeprom.h:147
uint8_t ah
Definition: registers.h:85
uint16_t offset
Offset to command line.
Definition: bzimage.h:8
struct ath5k_edge_power ee_ctl_pwr[AR5K_EEPROM_N_EDGES *AR5K_EEPROM_MAX_CTLS]
Definition: eeprom.h:441
static u16 ath5k_eeprom_bin2freq(struct ath5k_eeprom_info *ee, u16 bin, unsigned int mode)
Definition: ath5k_eeprom.c:76
#define AR5K_EEPROM_READ(_o, _v)
Definition: eeprom.h:224
#define AR5K_EEPROM_FREQ_M(_v)
Definition: eeprom.h:193
uint32_t u32
Definition: stdint.h:24
#define AR5K_EEPROM_VERSION_4_0
Definition: eeprom.h:51

References ah, AR5K_CTL_11A, AR5K_CTL_MODE_M, AR5K_CTL_TURBO, AR5K_EEPROM_CTL, AR5K_EEPROM_FREQ_M, AR5K_EEPROM_GROUP5_OFFSET, AR5K_EEPROM_GROUP8_OFFSET, AR5K_EEPROM_GROUPS_START, AR5K_EEPROM_MODE_11A, AR5K_EEPROM_MODE_11G, AR5K_EEPROM_N_CTLS, AR5K_EEPROM_N_EDGES, AR5K_EEPROM_POWER_M, AR5K_EEPROM_READ, AR5K_EEPROM_TARGET_PWRSTART, AR5K_EEPROM_VERSION_3_3, AR5K_EEPROM_VERSION_4_0, ath5k_eeprom_bin2freq(), ath5k_edge_power::edge, ath5k_eeprom_info::ee_ctl, ath5k_eeprom_info::ee_ctl_pwr, ath5k_eeprom_info::ee_ctls, ath5k_eeprom_info::ee_misc1, ath5k_eeprom_info::ee_version, ath5k_edge_power::flag, ath5k_edge_power::freq, offset, and val.

Referenced by ath5k_eeprom_init().

◆ ath5k_eeprom_init()

int ath5k_eeprom_init ( struct ath5k_hw ah)

Definition at line 1698 of file ath5k_eeprom.c.

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

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

Referenced by ath5k_hw_attach().

◆ ath5k_eeprom_read_mac()

int ath5k_eeprom_read_mac ( struct ath5k_hw ah,
u8 mac 
)

Definition at line 1724 of file ath5k_eeprom.c.

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

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

Referenced by ath5k_attach().

◆ ath5k_eeprom_is_hb63()

int ath5k_eeprom_is_hb63 ( struct ath5k_hw ah)

Definition at line 1754 of file ath5k_eeprom.c.

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

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

Referenced by ath5k_hw_tweak_initval_settings().