iPXE
ath9k_ar9002_phy.c File Reference
#include <ipxe/io.h>
#include "hw.h"
#include "ar9002_phy.h"

Go to the source code of this file.

Functions

 FILE_SECBOOT (FORBIDDEN)
static int ar9002_hw_set_channel (struct ath_hw *ah, struct ath9k_channel *chan)
 DOC: Programming Atheros 802.11n analog front end radios.
static void ar9002_hw_spur_mitigate (struct ath_hw *ah, struct ath9k_channel *chan)
 ar9002_hw_spur_mitigate - convert baseband spur frequency @ah: atheros hardware structure @chan:
static void ar9002_olc_init (struct ath_hw *ah)
static u32 ar9002_hw_compute_pll_control (struct ath_hw *ah, struct ath9k_channel *chan)
static void ar9002_hw_do_getnf (struct ath_hw *ah, int16_t nfarray[NUM_NF_READINGS])
static void ar9002_hw_set_nf_limits (struct ath_hw *ah)
static void ar9002_hw_antdiv_comb_conf_get (struct ath_hw *ah, struct ath_hw_antcomb_conf *antconf)
static void ar9002_hw_antdiv_comb_conf_set (struct ath_hw *ah, struct ath_hw_antcomb_conf *antconf)
void ar9002_hw_attach_phy_ops (struct ath_hw *ah)

Function Documentation

◆ FILE_SECBOOT()

FILE_SECBOOT ( FORBIDDEN )

◆ ar9002_hw_set_channel()

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

DOC: Programming Atheros 802.11n analog front end radios.

AR5416 MAC based PCI devices and AR518 MAC based PCI-Express devices have either an external AR2133 analog front end radio for single band 2.4 GHz communication or an AR5133 analog front end radio for dual band 2.4 GHz / 5 GHz communication.

All devices after the AR5416 and AR5418 family starting with the AR9280 have their analog front radios, MAC/BB and host PCIe/USB interface embedded into a single-chip and require less programming.

The following single-chips exist with a respective embedded radio:

AR9280 - 11n dual-band 2x2 MIMO for PCIe AR9281 - 11n single-band 1x2 MIMO for PCIe AR9285 - 11n single-band 1x1 for PCIe AR9287 - 11n single-band 2x2 MIMO for PCIe

AR9220 - 11n dual-band 2x2 MIMO for PCI AR9223 - 11n single-band 2x2 MIMO for PCI

AR9287 - 11n single-band 1x1 MIMO for USB ar9002_hw_set_channel - set channel on single-chip device @ah: atheros hardware structure @chan:

This is the function to change channel on single-chip devices, that is all devices after ar9280.

This function takes the channel value in MHz and sets hardware channel value. Assumes writes have been enabled to analog bus.

Actual Expression,

For 2GHz channel, Channel Frequency = (3/4) * freq_ref * (chansel[8:0] + chanfrac[16:0]/2^17) (freq_ref = 40MHz)

For 5GHz channel, Channel Frequency = (3/2) * freq_ref * (chansel[8:0] + chanfrac[16:0]/2^10) (freq_ref = 40MHz/(24>>amodeRefSel))

Definition at line 73 of file ath9k_ar9002_phy.c.

74{
75 u16 bMode, fracMode, aModeRefSel = 0;
76 u32 freq, ndiv, channelSel = 0, channelFrac = 0, reg32 = 0;
77 struct chan_centers centers;
78 u32 refDivA = 24;
79
80 ath9k_hw_get_channel_centers(ah, chan, &centers);
81 freq = centers.synth_center;
82
84 reg32 &= 0xc0000000;
85
86 if (freq < 4800) { /* 2 GHz, fractional mode */
87 u32 txctl;
88 unsigned int regWrites = 0;
89
90 bMode = 1;
91 fracMode = 1;
92 aModeRefSel = 0;
93 channelSel = CHANSEL_2G(freq);
94
96 if (freq == 2484) {
97 /* Enable channel spreading for channel 14 */
98 REG_WRITE_ARRAY(&ah->iniCckfirJapan2484,
99 1, regWrites);
100 } else {
101 REG_WRITE_ARRAY(&ah->iniCckfirNormal,
102 1, regWrites);
103 }
104 } else {
106 if (freq == 2484) {
107 /* Enable channel spreading for channel 14 */
110 } else {
112 txctl & ~AR_PHY_CCK_TX_CTRL_JAPAN);
113 }
114 }
115 } else {
116 bMode = 0;
117 fracMode = 0;
118
119 switch (ah->eep_ops->get_eeprom(ah, EEP_FRAC_N_5G)) {
120 case 0:
121 if ((freq % 20) == 0)
122 aModeRefSel = 3;
123 else if ((freq % 10) == 0)
124 aModeRefSel = 2;
125 if (aModeRefSel)
126 break;
127 /* Fall through */
128 case 1:
129 default:
130 aModeRefSel = 0;
131 /*
132 * Enable 2G (fractional) mode for channels
133 * which are 5MHz spaced.
134 */
135 fracMode = 1;
136 refDivA = 1;
137 channelSel = CHANSEL_5G(freq);
138
139 /* RefDivA setting */
141 AR_AN_SYNTH9_REFDIVA, refDivA);
142
143 }
144
145 if (!fracMode) {
146 ndiv = (freq * (refDivA >> aModeRefSel)) / 60;
147 channelSel = ndiv & 0x1ff;
148 channelFrac = (ndiv & 0xfffffe00) * 2;
149 channelSel = (channelSel << 17) | channelFrac;
150 }
151 }
152
153 reg32 = reg32 |
154 (bMode << 29) |
155 (fracMode << 28) | (aModeRefSel << 26) | (channelSel);
156
158
159 ah->curchan = chan;
160 ah->curchan_rad_index = -1;
161
162 return 0;
163}
#define AR_PHY_CCK_TX_CTRL_JAPAN
Definition ar9002_phy.h:410
#define AR_PHY_SYNTH_CONTROL
Definition ar9002_phy.h:159
#define AR_PHY_CCK_TX_CTRL
Definition ar9002_phy.h:409
@ EEP_FRAC_N_5G
Definition eeprom.h:250
#define AR_AN_SYNTH9_REFDIVA
Definition reg.h:1279
#define AR_SREV_9287_11_OR_LATER(_ah)
Definition reg.h:837
#define AR_AN_SYNTH9
Definition reg.h:1278
void ath9k_hw_get_channel_centers(struct ath_hw *ah __unused, struct ath9k_channel *chan, struct chan_centers *centers)
Definition ath9k_hw.c:191
#define REG_WRITE(_ah, _reg, _val)
Definition hw.h:78
#define REG_READ(_ah, _reg)
Definition hw.h:81
#define REG_RMW_FIELD(_a, _r, _f, _v)
Definition hw.h:104
#define REG_WRITE_ARRAY(iniarray, column, regWr)
Definition hw.h:120
#define CHANSEL_5G(_freq)
Definition phy.h:25
#define CHANSEL_2G(_freq)
Definition phy.h:24
uint8_t ah
Definition registers.h:1
#define u16
Definition vga.h:20
#define u32
Definition vga.h:21

References ah, AR_AN_SYNTH9, AR_AN_SYNTH9_REFDIVA, AR_PHY_CCK_TX_CTRL, AR_PHY_CCK_TX_CTRL_JAPAN, AR_PHY_SYNTH_CONTROL, AR_SREV_9287_11_OR_LATER, ath9k_hw_get_channel_centers(), CHANSEL_2G, CHANSEL_5G, EEP_FRAC_N_5G, REG_READ, REG_RMW_FIELD, REG_WRITE, REG_WRITE_ARRAY, chan_centers::synth_center, u16, and u32.

Referenced by ar9002_hw_attach_phy_ops().

◆ ar9002_hw_spur_mitigate()

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

ar9002_hw_spur_mitigate - convert baseband spur frequency @ah: atheros hardware structure @chan:

For single-chip solutions. Converts to baseband spur frequency given the input channel frequency and compute register settings below.

Definition at line 173 of file ath9k_ar9002_phy.c.

175{
176 int bb_spur = AR_NO_SPUR;
177 int freq;
178 int bin, cur_bin;
179 int bb_spur_off, spur_subchannel_sd;
180 int spur_freq_sd;
181 int spur_delta_phase;
182 int denominator;
183 int upper, lower, cur_vit_mask;
184 int tmp, newVal;
185 int i;
186 static const int pilot_mask_reg[4] = {
189 };
190 static const int chan_mask_reg[4] = {
193 };
194 static const int inc[4] = { 0, 100, 0, 0 };
195 struct chan_centers centers;
196
197 int8_t mask_m[123];
198 int8_t mask_p[123];
199 int8_t mask_amt;
200 int tmp_mask;
201 int cur_bb_spur;
202 int is2GHz = IS_CHAN_2GHZ(chan);
203
204 memset(&mask_m, 0, sizeof(int8_t) * 123);
205 memset(&mask_p, 0, sizeof(int8_t) * 123);
206
207 ath9k_hw_get_channel_centers(ah, chan, &centers);
208 freq = centers.synth_center;
209
210 ah->config.spurmode = SPUR_ENABLE_EEPROM;
211 for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
212 cur_bb_spur = ah->eep_ops->get_spur_channel(ah, i, is2GHz);
213
214 if (AR_NO_SPUR == cur_bb_spur)
215 break;
216
217 if (is2GHz)
218 cur_bb_spur = (cur_bb_spur / 10) + AR_BASE_FREQ_2GHZ;
219 else
220 cur_bb_spur = (cur_bb_spur / 10) + AR_BASE_FREQ_5GHZ;
221
222 cur_bb_spur = cur_bb_spur - freq;
223
224 if (IS_CHAN_HT40(chan)) {
225 if ((cur_bb_spur > -AR_SPUR_FEEQ_BOUND_HT40) &&
226 (cur_bb_spur < AR_SPUR_FEEQ_BOUND_HT40)) {
227 bb_spur = cur_bb_spur;
228 break;
229 }
230 } else if ((cur_bb_spur > -AR_SPUR_FEEQ_BOUND_HT20) &&
231 (cur_bb_spur < AR_SPUR_FEEQ_BOUND_HT20)) {
232 bb_spur = cur_bb_spur;
233 break;
234 }
235 }
236
237 if (AR_NO_SPUR == bb_spur) {
240 return;
241 } else {
244 }
245
246 bin = bb_spur * 320;
247
249
251
256 REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0), newVal);
257
263 REG_WRITE(ah, AR_PHY_SPUR_REG, newVal);
264
265 if (IS_CHAN_HT40(chan)) {
266 if (bb_spur < 0) {
267 spur_subchannel_sd = 1;
268 bb_spur_off = bb_spur + 10;
269 } else {
270 spur_subchannel_sd = 0;
271 bb_spur_off = bb_spur - 10;
272 }
273 } else {
274 spur_subchannel_sd = 0;
275 bb_spur_off = bb_spur;
276 }
277
278 if (IS_CHAN_HT40(chan))
279 spur_delta_phase =
280 ((bb_spur * 262144) /
282 else
283 spur_delta_phase =
284 ((bb_spur * 524288) /
286
287 denominator = IS_CHAN_2GHZ(chan) ? 44 : 40;
288 spur_freq_sd = ((bb_spur_off * 2048) / denominator) & 0x3ff;
289
291 SM(spur_freq_sd, AR_PHY_TIMING11_SPUR_FREQ_SD) |
292 SM(spur_delta_phase, AR_PHY_TIMING11_SPUR_DELTA_PHASE));
293 REG_WRITE(ah, AR_PHY_TIMING11, newVal);
294
295 newVal = spur_subchannel_sd << AR_PHY_SFCORR_SPUR_SUBCHNL_SD_S;
297
298 cur_bin = -6000;
299 upper = bin + 100;
300 lower = bin - 100;
301
302 for (i = 0; i < 4; i++) {
303 int pilot_mask = 0;
304 int chan_mask = 0;
305 int bp = 0;
306 for (bp = 0; bp < 30; bp++) {
307 if ((cur_bin > lower) && (cur_bin < upper)) {
308 pilot_mask = pilot_mask | 0x1 << bp;
309 chan_mask = chan_mask | 0x1 << bp;
310 }
311 cur_bin += 100;
312 }
313 cur_bin += inc[i];
314 REG_WRITE(ah, pilot_mask_reg[i], pilot_mask);
315 REG_WRITE(ah, chan_mask_reg[i], chan_mask);
316 }
317
318 cur_vit_mask = 6100;
319 upper = bin + 120;
320 lower = bin - 120;
321
322 for (i = 0; i < 123; i++) {
323 if ((cur_vit_mask > lower) && (cur_vit_mask < upper)) {
324
325 /* workaround for gcc bug #37014 */
326 volatile int tmp_v = abs(cur_vit_mask - bin);
327
328 if (tmp_v < 75)
329 mask_amt = 1;
330 else
331 mask_amt = 0;
332 if (cur_vit_mask < 0)
333 mask_m[abs(cur_vit_mask / 100)] = mask_amt;
334 else
335 mask_p[cur_vit_mask / 100] = mask_amt;
336 }
337 cur_vit_mask -= 100;
338 }
339
340 tmp_mask = (mask_m[46] << 30) | (mask_m[47] << 28)
341 | (mask_m[48] << 26) | (mask_m[49] << 24)
342 | (mask_m[50] << 22) | (mask_m[51] << 20)
343 | (mask_m[52] << 18) | (mask_m[53] << 16)
344 | (mask_m[54] << 14) | (mask_m[55] << 12)
345 | (mask_m[56] << 10) | (mask_m[57] << 8)
346 | (mask_m[58] << 6) | (mask_m[59] << 4)
347 | (mask_m[60] << 2) | (mask_m[61] << 0);
348 REG_WRITE(ah, AR_PHY_BIN_MASK_1, tmp_mask);
350
351 tmp_mask = (mask_m[31] << 28)
352 | (mask_m[32] << 26) | (mask_m[33] << 24)
353 | (mask_m[34] << 22) | (mask_m[35] << 20)
354 | (mask_m[36] << 18) | (mask_m[37] << 16)
355 | (mask_m[48] << 14) | (mask_m[39] << 12)
356 | (mask_m[40] << 10) | (mask_m[41] << 8)
357 | (mask_m[42] << 6) | (mask_m[43] << 4)
358 | (mask_m[44] << 2) | (mask_m[45] << 0);
359 REG_WRITE(ah, AR_PHY_BIN_MASK_2, tmp_mask);
361
362 tmp_mask = (mask_m[16] << 30) | (mask_m[16] << 28)
363 | (mask_m[18] << 26) | (mask_m[18] << 24)
364 | (mask_m[20] << 22) | (mask_m[20] << 20)
365 | (mask_m[22] << 18) | (mask_m[22] << 16)
366 | (mask_m[24] << 14) | (mask_m[24] << 12)
367 | (mask_m[25] << 10) | (mask_m[26] << 8)
368 | (mask_m[27] << 6) | (mask_m[28] << 4)
369 | (mask_m[29] << 2) | (mask_m[30] << 0);
370 REG_WRITE(ah, AR_PHY_BIN_MASK_3, tmp_mask);
372
373 tmp_mask = (mask_m[0] << 30) | (mask_m[1] << 28)
374 | (mask_m[2] << 26) | (mask_m[3] << 24)
375 | (mask_m[4] << 22) | (mask_m[5] << 20)
376 | (mask_m[6] << 18) | (mask_m[7] << 16)
377 | (mask_m[8] << 14) | (mask_m[9] << 12)
378 | (mask_m[10] << 10) | (mask_m[11] << 8)
379 | (mask_m[12] << 6) | (mask_m[13] << 4)
380 | (mask_m[14] << 2) | (mask_m[15] << 0);
381 REG_WRITE(ah, AR_PHY_MASK_CTL, tmp_mask);
383
384 tmp_mask = (mask_p[15] << 28)
385 | (mask_p[14] << 26) | (mask_p[13] << 24)
386 | (mask_p[12] << 22) | (mask_p[11] << 20)
387 | (mask_p[10] << 18) | (mask_p[9] << 16)
388 | (mask_p[8] << 14) | (mask_p[7] << 12)
389 | (mask_p[6] << 10) | (mask_p[5] << 8)
390 | (mask_p[4] << 6) | (mask_p[3] << 4)
391 | (mask_p[2] << 2) | (mask_p[1] << 0);
392 REG_WRITE(ah, AR_PHY_BIN_MASK2_1, tmp_mask);
394
395 tmp_mask = (mask_p[30] << 28)
396 | (mask_p[29] << 26) | (mask_p[28] << 24)
397 | (mask_p[27] << 22) | (mask_p[26] << 20)
398 | (mask_p[25] << 18) | (mask_p[24] << 16)
399 | (mask_p[23] << 14) | (mask_p[22] << 12)
400 | (mask_p[21] << 10) | (mask_p[20] << 8)
401 | (mask_p[19] << 6) | (mask_p[18] << 4)
402 | (mask_p[17] << 2) | (mask_p[16] << 0);
403 REG_WRITE(ah, AR_PHY_BIN_MASK2_2, tmp_mask);
405
406 tmp_mask = (mask_p[45] << 28)
407 | (mask_p[44] << 26) | (mask_p[43] << 24)
408 | (mask_p[42] << 22) | (mask_p[41] << 20)
409 | (mask_p[40] << 18) | (mask_p[39] << 16)
410 | (mask_p[38] << 14) | (mask_p[37] << 12)
411 | (mask_p[36] << 10) | (mask_p[35] << 8)
412 | (mask_p[34] << 6) | (mask_p[33] << 4)
413 | (mask_p[32] << 2) | (mask_p[31] << 0);
414 REG_WRITE(ah, AR_PHY_BIN_MASK2_3, tmp_mask);
416
417 tmp_mask = (mask_p[61] << 30) | (mask_p[60] << 28)
418 | (mask_p[59] << 26) | (mask_p[58] << 24)
419 | (mask_p[57] << 22) | (mask_p[56] << 20)
420 | (mask_p[55] << 18) | (mask_p[54] << 16)
421 | (mask_p[53] << 14) | (mask_p[52] << 12)
422 | (mask_p[51] << 10) | (mask_p[50] << 8)
423 | (mask_p[49] << 6) | (mask_p[48] << 4)
424 | (mask_p[47] << 2) | (mask_p[46] << 0);
425 REG_WRITE(ah, AR_PHY_BIN_MASK2_4, tmp_mask);
427
429}
#define AR_PHY_MASK2_M_16_30
Definition ar9002_phy.h:512
#define AR_PHY_TIMING11
Definition ar9002_phy.h:296
#define AR_PHY_MASK_CTL
Definition ar9002_phy.h:286
#define AR_PHY_SPUR_REG
Definition ar9002_phy.h:518
#define AR_PHY_MASK2_P_30_16
Definition ar9002_phy.h:515
#define AR_PHY_TIMING_CTRL4_ENABLE_CHAN_MASK
Definition ar9002_phy.h:200
#define AR_PHY_BIN_MASK2_2
Definition ar9002_phy.h:278
#define AR_PHY_TIMING_CTRL4_ENABLE_SPUR_FILTER
Definition ar9002_phy.h:199
#define AR_PHY_SFCORR_EXT
Definition ar9002_phy.h:345
#define AR_PHY_SPUR_REG_MASK_RATE_CNTL
Definition ar9002_phy.h:520
#define AR_PHY_TIMING8
Definition ar9002_phy.h:273
#define AR_PHY_MASK2_M_00_15
Definition ar9002_phy.h:513
#define AR_PHY_BIN_MASK2_3
Definition ar9002_phy.h:279
#define AR_PHY_MASK2_M_31_45
Definition ar9002_phy.h:511
#define AR_PHY_BIN_MASK_1
Definition ar9002_phy.h:282
#define AR_PHY_PILOT_MASK_31_60
Definition ar9002_phy.h:531
#define AR_PHY_BIN_MASK2_4
Definition ar9002_phy.h:280
#define AR_PHY_TIMING11_USE_SPUR_IN_AGC
Definition ar9002_phy.h:299
#define AR_PHY_SPUR_REG_MASK_RATE_SELECT
Definition ar9002_phy.h:524
#define AR_PHY_BIN_MASK2_1
Definition ar9002_phy.h:277
#define AR_PHY_MASK2_P_15_01
Definition ar9002_phy.h:514
#define AR_PHY_SPUR_REG_SPUR_RSSI_THRESH
Definition ar9002_phy.h:527
#define AR_PHY_TIMING_CTRL4_ENABLE_SPUR_RSSI
Definition ar9002_phy.h:198
#define AR_PHY_FORCE_CLKEN_CCK_MRC_MUX
Definition ar9002_phy.h:450
#define AR_PHY_CHANNEL_MASK_31_60
Definition ar9002_phy.h:534
#define AR_PHY_FORCE_CLKEN_CCK
Definition ar9002_phy.h:449
#define AR_PHY_TIMING_CTRL4(_i)
Definition ar9002_phy.h:188
#define AR_PHY_PILOT_MASK_01_30
Definition ar9002_phy.h:530
#define AR_PHY_MASK2_P_45_31
Definition ar9002_phy.h:516
#define AR_PHY_CHANNEL_MASK_01_30
Definition ar9002_phy.h:533
#define AR_PHY_TIMING9
Definition ar9002_phy.h:291
#define AR_PHY_VIT_MASK2_M_46_61
Definition ar9002_phy.h:510
#define AR_PHY_BIN_MASK_3
Definition ar9002_phy.h:284
#define AR_PHY_TIMING_CTRL4_ENABLE_PILOT_MASK
Definition ar9002_phy.h:201
#define AR_PHY_TIMING7
Definition ar9002_phy.h:272
#define AR_PHY_SPUR_REG_ENABLE_MASK_PPM
Definition ar9002_phy.h:523
#define AR_PHY_TIMING10
Definition ar9002_phy.h:292
#define AR_PHY_BIN_MASK_2
Definition ar9002_phy.h:283
#define AR_PHY_SFCORR_SPUR_SUBCHNL_SD_S
Definition ar9002_phy.h:354
#define AR_PHY_SPUR_REG_ENABLE_VIT_SPUR_RSSI
Definition ar9002_phy.h:526
#define AR_PHY_TIMING11_SPUR_DELTA_PHASE
Definition ar9002_phy.h:297
#define AR_PHY_MASK2_P_61_45
Definition ar9002_phy.h:517
#define AR_PHY_TIMING11_SPUR_FREQ_SD
Definition ar9003_phy.h:38
signed char int8_t
Definition stdint.h:15
#define AR_EEPROM_MODAL_SPURS
Definition eeprom.h:26
#define abs(x)
Definition ath.h:46
#define REGWRITE_BUFFER_FLUSH(_ah)
Definition hw.h:96
#define AR_SPUR_FEEQ_BOUND_HT40
Definition hw.h:244
#define SM(_v, _f)
Definition hw.h:102
#define AR_SPUR_FEEQ_BOUND_HT20
Definition hw.h:245
#define IS_CHAN_HT40(_c)
Definition hw.h:373
#define SPUR_ENABLE_EEPROM
Definition hw.h:238
#define ENABLE_REGWRITE_BUFFER(_ah)
Definition hw.h:90
#define SPUR_RSSI_THRESH
Definition hw.h:151
#define AR_NO_SPUR
Definition hw.h:241
#define REG_CLR_BIT(_a, _r, _f)
Definition hw.h:110
#define IS_CHAN_2GHZ(_c)
Definition hw.h:362
#define AR_BASE_FREQ_2GHZ
Definition hw.h:242
#define AR_BASE_FREQ_5GHZ
Definition hw.h:243
void * memset(void *dest, int character, size_t len) __nonnull
unsigned long tmp
Definition linux_pci.h:65
uint16_t bp
Definition registers.h:9

References abs, ah, AR_BASE_FREQ_2GHZ, AR_BASE_FREQ_5GHZ, AR_EEPROM_MODAL_SPURS, AR_NO_SPUR, AR_PHY_BIN_MASK2_1, AR_PHY_BIN_MASK2_2, AR_PHY_BIN_MASK2_3, AR_PHY_BIN_MASK2_4, AR_PHY_BIN_MASK_1, AR_PHY_BIN_MASK_2, AR_PHY_BIN_MASK_3, AR_PHY_CHANNEL_MASK_01_30, AR_PHY_CHANNEL_MASK_31_60, AR_PHY_FORCE_CLKEN_CCK, AR_PHY_FORCE_CLKEN_CCK_MRC_MUX, AR_PHY_MASK2_M_00_15, AR_PHY_MASK2_M_16_30, AR_PHY_MASK2_M_31_45, AR_PHY_MASK2_P_15_01, AR_PHY_MASK2_P_30_16, AR_PHY_MASK2_P_45_31, AR_PHY_MASK2_P_61_45, AR_PHY_MASK_CTL, AR_PHY_PILOT_MASK_01_30, AR_PHY_PILOT_MASK_31_60, AR_PHY_SFCORR_EXT, AR_PHY_SFCORR_SPUR_SUBCHNL_SD_S, AR_PHY_SPUR_REG, AR_PHY_SPUR_REG_ENABLE_MASK_PPM, AR_PHY_SPUR_REG_ENABLE_VIT_SPUR_RSSI, AR_PHY_SPUR_REG_MASK_RATE_CNTL, AR_PHY_SPUR_REG_MASK_RATE_SELECT, AR_PHY_SPUR_REG_SPUR_RSSI_THRESH, AR_PHY_TIMING10, AR_PHY_TIMING11, AR_PHY_TIMING11_SPUR_DELTA_PHASE, AR_PHY_TIMING11_SPUR_FREQ_SD, AR_PHY_TIMING11_USE_SPUR_IN_AGC, AR_PHY_TIMING7, AR_PHY_TIMING8, AR_PHY_TIMING9, AR_PHY_TIMING_CTRL4, AR_PHY_TIMING_CTRL4_ENABLE_CHAN_MASK, AR_PHY_TIMING_CTRL4_ENABLE_PILOT_MASK, AR_PHY_TIMING_CTRL4_ENABLE_SPUR_FILTER, AR_PHY_TIMING_CTRL4_ENABLE_SPUR_RSSI, AR_PHY_VIT_MASK2_M_46_61, AR_SPUR_FEEQ_BOUND_HT20, AR_SPUR_FEEQ_BOUND_HT40, ath9k_hw_get_channel_centers(), bp, ENABLE_REGWRITE_BUFFER, IS_CHAN_2GHZ, IS_CHAN_HT40, memset(), REG_CLR_BIT, REG_READ, REG_WRITE, REGWRITE_BUFFER_FLUSH, SM, SPUR_ENABLE_EEPROM, SPUR_RSSI_THRESH, chan_centers::synth_center, and tmp.

Referenced by ar9002_hw_attach_phy_ops().

◆ ar9002_olc_init()

void ar9002_olc_init ( struct ath_hw * ah)
static

Definition at line 431 of file ath9k_ar9002_phy.c.

432{
433 u32 i;
434
436 return;
437
445 udelay(100);
446 } else {
447 for (i = 0; i < AR9280_TX_GAIN_TABLE_SIZE; i++)
448 ah->originalGain[i] =
451 ah->PDADCdelta = 0;
452 }
453}
#define AR_PHY_TX_PWRCTRL9_RES_DC_REMOVAL
Definition ar9002_phy.h:496
#define AR_PHY_TX_PWRCTRL9
Definition ar9002_phy.h:491
#define AR_PHY_TX_GAIN_TBL1
Definition ar9002_phy.h:499
#define AR_PHY_TX_GAIN
Definition ar9002_phy.h:500
#define OLC_FOR_AR9280_20_LATER
Definition eeprom.h:107
#define AR9280_TX_GAIN_TABLE_SIZE
Definition eeprom.h:183
#define OLC_FOR_AR9287_10_LATER
Definition eeprom.h:109
#define AR9287_AN_TXPC0_TXPCMODE_TEMPSENSE
Definition reg.h:1420
#define AR9287_AN_TXPC0_TXPCMODE
Definition reg.h:1416
#define AR9287_AN_TXPC0_TXPCMODE_S
Definition reg.h:1417
#define AR9287_AN_TXPC0
Definition reg.h:1415
void ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask, u32 shift, u32 val)
#define MS(_v, _f)
Definition hw.h:103
#define REG_SET_BIT(_a, _r, _f)
Definition hw.h:108
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition timer.c:61

References ah, AR9280_TX_GAIN_TABLE_SIZE, AR9287_AN_TXPC0, AR9287_AN_TXPC0_TXPCMODE, AR9287_AN_TXPC0_TXPCMODE_S, AR9287_AN_TXPC0_TXPCMODE_TEMPSENSE, AR_PHY_TX_GAIN, AR_PHY_TX_GAIN_TBL1, AR_PHY_TX_PWRCTRL9, AR_PHY_TX_PWRCTRL9_RES_DC_REMOVAL, ath9k_hw_analog_shift_rmw(), MS, OLC_FOR_AR9280_20_LATER, OLC_FOR_AR9287_10_LATER, REG_READ, REG_SET_BIT, u32, and udelay().

Referenced by ar9002_hw_attach_phy_ops().

◆ ar9002_hw_compute_pll_control()

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

Definition at line 455 of file ath9k_ar9002_phy.c.

457{
458 u32 pll;
459
460 pll = SM(0x5, AR_RTC_9160_PLL_REFDIV);
461
462 if (chan && IS_CHAN_HALF_RATE(chan))
463 pll |= SM(0x1, AR_RTC_9160_PLL_CLKSEL);
464 else if (chan && IS_CHAN_QUARTER_RATE(chan))
465 pll |= SM(0x2, AR_RTC_9160_PLL_CLKSEL);
466
467 if (chan && IS_CHAN_5GHZ(chan)) {
468 if (IS_CHAN_A_FAST_CLOCK(ah, chan))
469 pll = 0x142c;
470 else if (AR_SREV_9280_20(ah))
471 pll = 0x2850;
472 else
473 pll |= SM(0x28, AR_RTC_9160_PLL_DIV);
474 } else {
475 pll |= SM(0x2c, AR_RTC_9160_PLL_DIV);
476 }
477
478 return pll;
479}
#define AR_RTC_9160_PLL_CLKSEL
Definition reg.h:1155
#define AR_SREV_9280_20(_ah)
Definition reg.h:827
#define AR_RTC_9160_PLL_REFDIV
Definition reg.h:1153
#define AR_RTC_9160_PLL_DIV
Definition reg.h:1151
#define IS_CHAN_QUARTER_RATE(_c)
Definition hw.h:364
#define IS_CHAN_A_FAST_CLOCK(_ah, _c)
Definition hw.h:365
#define IS_CHAN_HALF_RATE(_c)
Definition hw.h:363
#define IS_CHAN_5GHZ(_c)
Definition hw.h:361

References ah, AR_RTC_9160_PLL_CLKSEL, AR_RTC_9160_PLL_DIV, AR_RTC_9160_PLL_REFDIV, AR_SREV_9280_20, IS_CHAN_5GHZ, IS_CHAN_A_FAST_CLOCK, IS_CHAN_HALF_RATE, IS_CHAN_QUARTER_RATE, SM, and u32.

Referenced by ar9002_hw_attach_phy_ops().

◆ ar9002_hw_do_getnf()

void ar9002_hw_do_getnf ( struct ath_hw * ah,
int16_t nfarray[NUM_NF_READINGS] )
static

Definition at line 481 of file ath9k_ar9002_phy.c.

483{
484 int16_t nf;
485
487 nfarray[0] = sign_extend32(nf, 8);
488
490 if (IS_CHAN_HT40(ah->curchan))
491 nfarray[3] = sign_extend32(nf, 8);
492
494 return;
495
497 nfarray[1] = sign_extend32(nf, 8);
498
500 if (IS_CHAN_HT40(ah->curchan))
501 nfarray[4] = sign_extend32(nf, 8);
502}
#define AR9280_PHY_CH1_EXT_MINCCA_PWR
Definition ar9002_phy.h:583
#define AR_PHY_EXT_CCA
Definition ar9002_phy.h:332
#define AR9280_PHY_CH1_MINCCA_PWR
Definition ar9002_phy.h:573
#define AR_PHY_CH1_EXT_CCA
Definition ar9002_phy.h:580
#define AR_PHY_CH1_CCA
Definition ar9002_phy.h:570
#define AR9280_PHY_EXT_MINCCA_PWR
Definition ar9002_phy.h:342
#define AR_PHY_CCA
Definition ar9002_phy.h:130
#define AR9280_PHY_MINCCA_PWR
Definition ar9002_phy.h:135
signed short int16_t
Definition stdint.h:16
#define AR_SREV_9285(_ah)
Definition reg.h:830
#define AR_SREV_9271(_ah)
Definition reg.h:854
static int32_t sign_extend32(uint32_t value, int index)
Definition ath.h:71

References ah, AR9280_PHY_CH1_EXT_MINCCA_PWR, AR9280_PHY_CH1_MINCCA_PWR, AR9280_PHY_EXT_MINCCA_PWR, AR9280_PHY_MINCCA_PWR, AR_PHY_CCA, AR_PHY_CH1_CCA, AR_PHY_CH1_EXT_CCA, AR_PHY_EXT_CCA, AR_SREV_9271, AR_SREV_9285, IS_CHAN_HT40, MS, NUM_NF_READINGS, REG_READ, and sign_extend32().

Referenced by ar9002_hw_attach_phy_ops().

◆ ar9002_hw_set_nf_limits()

void ar9002_hw_set_nf_limits ( struct ath_hw * ah)
static

Definition at line 504 of file ath9k_ar9002_phy.c.

505{
506 if (AR_SREV_9285(ah)) {
509 ah->nf_2g.nominal = AR_PHY_CCA_NOM_VAL_9285_2GHZ;
510 } else if (AR_SREV_9287(ah)) {
513 ah->nf_2g.nominal = AR_PHY_CCA_NOM_VAL_9287_2GHZ;
514 } else if (AR_SREV_9271(ah)) {
517 ah->nf_2g.nominal = AR_PHY_CCA_NOM_VAL_9271_2GHZ;
518 } else {
521 ah->nf_2g.nominal = AR_PHY_CCA_NOM_VAL_9280_2GHZ;
524 ah->nf_5g.nominal = AR_PHY_CCA_NOM_VAL_9280_5GHZ;
525 }
526}
#define AR_PHY_CCA_MAX_GOOD_VAL_9285_2GHZ
Definition ar9002_phy.h:606
#define AR_PHY_CCA_MAX_GOOD_VAL_9280_5GHZ
Definition ar9002_phy.h:602
#define AR_PHY_CCA_MIN_GOOD_VAL_9271_2GHZ
Definition ar9002_phy.h:609
#define AR_PHY_CCA_MAX_GOOD_VAL_9280_2GHZ
Definition ar9002_phy.h:601
#define AR_PHY_CCA_NOM_VAL_9280_5GHZ
Definition ar9002_phy.h:598
#define AR_PHY_CCA_MIN_GOOD_VAL_9285_2GHZ
Definition ar9002_phy.h:605
#define AR_PHY_CCA_MAX_GOOD_VAL_9287_2GHZ
Definition ar9002_phy.h:614
#define AR_PHY_CCA_NOM_VAL_9285_2GHZ
Definition ar9002_phy.h:604
#define AR_PHY_CCA_NOM_VAL_9287_2GHZ
Definition ar9002_phy.h:612
#define AR_PHY_CCA_MIN_GOOD_VAL_9280_5GHZ
Definition ar9002_phy.h:600
#define AR_PHY_CCA_NOM_VAL_9280_2GHZ
Definition ar9002_phy.h:597
#define AR_PHY_CCA_MAX_GOOD_VAL_9271_2GHZ
Definition ar9002_phy.h:610
#define AR_PHY_CCA_NOM_VAL_9271_2GHZ
Definition ar9002_phy.h:608
#define AR_PHY_CCA_MIN_GOOD_VAL_9280_2GHZ
Definition ar9002_phy.h:599
#define AR_PHY_CCA_MIN_GOOD_VAL_9287_2GHZ
Definition ar9002_phy.h:613
#define AR_SREV_9287(_ah)
Definition reg.h:835

References ah, AR_PHY_CCA_MAX_GOOD_VAL_9271_2GHZ, AR_PHY_CCA_MAX_GOOD_VAL_9280_2GHZ, AR_PHY_CCA_MAX_GOOD_VAL_9280_5GHZ, AR_PHY_CCA_MAX_GOOD_VAL_9285_2GHZ, AR_PHY_CCA_MAX_GOOD_VAL_9287_2GHZ, AR_PHY_CCA_MIN_GOOD_VAL_9271_2GHZ, AR_PHY_CCA_MIN_GOOD_VAL_9280_2GHZ, AR_PHY_CCA_MIN_GOOD_VAL_9280_5GHZ, AR_PHY_CCA_MIN_GOOD_VAL_9285_2GHZ, AR_PHY_CCA_MIN_GOOD_VAL_9287_2GHZ, AR_PHY_CCA_NOM_VAL_9271_2GHZ, AR_PHY_CCA_NOM_VAL_9280_2GHZ, AR_PHY_CCA_NOM_VAL_9280_5GHZ, AR_PHY_CCA_NOM_VAL_9285_2GHZ, AR_PHY_CCA_NOM_VAL_9287_2GHZ, AR_SREV_9271, AR_SREV_9285, and AR_SREV_9287.

Referenced by ar9002_hw_attach_phy_ops().

◆ ar9002_hw_antdiv_comb_conf_get()

void ar9002_hw_antdiv_comb_conf_get ( struct ath_hw * ah,
struct ath_hw_antcomb_conf * antconf )
static

Definition at line 528 of file ath9k_ar9002_phy.c.

530{
531 u32 regval;
532
534 antconf->main_lna_conf = (regval & AR_PHY_9285_ANT_DIV_MAIN_LNACONF) >>
536 antconf->alt_lna_conf = (regval & AR_PHY_9285_ANT_DIV_ALT_LNACONF) >>
538 antconf->fast_div_bias = (regval & AR_PHY_9285_FAST_DIV_BIAS) >>
540 antconf->lna1_lna2_delta = -3;
541 antconf->div_group = 0;
542}
#define AR_PHY_MULTICHAIN_GAIN_CTL
Definition ar9002_phy.h:307
#define AR_PHY_9285_ANT_DIV_MAIN_LNACONF_S
Definition ar9002_phy.h:316
#define AR_PHY_9285_ANT_DIV_ALT_LNACONF_S
Definition ar9002_phy.h:314
#define AR_PHY_9285_FAST_DIV_BIAS_S
Definition ar9002_phy.h:309
#define AR_PHY_9285_ANT_DIV_MAIN_LNACONF
Definition ar9002_phy.h:315
#define AR_PHY_9285_FAST_DIV_BIAS
Definition ar9002_phy.h:308
#define AR_PHY_9285_ANT_DIV_ALT_LNACONF
Definition ar9002_phy.h:313
int lna1_lna2_delta
Definition hw.h:488

References ah, ath_hw_antcomb_conf::alt_lna_conf, AR_PHY_9285_ANT_DIV_ALT_LNACONF, AR_PHY_9285_ANT_DIV_ALT_LNACONF_S, AR_PHY_9285_ANT_DIV_MAIN_LNACONF, AR_PHY_9285_ANT_DIV_MAIN_LNACONF_S, AR_PHY_9285_FAST_DIV_BIAS, AR_PHY_9285_FAST_DIV_BIAS_S, AR_PHY_MULTICHAIN_GAIN_CTL, ath_hw_antcomb_conf::div_group, ath_hw_antcomb_conf::fast_div_bias, ath_hw_antcomb_conf::lna1_lna2_delta, ath_hw_antcomb_conf::main_lna_conf, REG_READ, and u32.

Referenced by ar9002_hw_attach_phy_ops().

◆ ar9002_hw_antdiv_comb_conf_set()

◆ ar9002_hw_attach_phy_ops()

void ar9002_hw_attach_phy_ops ( struct ath_hw * ah)

Definition at line 563 of file ath9k_ar9002_phy.c.

564{
565 struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
566 struct ath_hw_ops *ops = ath9k_hw_ops(ah);
567
568 priv_ops->set_rf_regs = NULL;
569 priv_ops->rf_alloc_ext_banks = NULL;
570 priv_ops->rf_free_ext_banks = NULL;
573 priv_ops->olc_init = ar9002_olc_init;
575 priv_ops->do_getnf = ar9002_hw_do_getnf;
576
579
581}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
static void ar9002_hw_antdiv_comb_conf_get(struct ath_hw *ah, struct ath_hw_antcomb_conf *antconf)
static void ar9002_hw_spur_mitigate(struct ath_hw *ah, struct ath9k_channel *chan)
ar9002_hw_spur_mitigate - convert baseband spur frequency @ah: atheros hardware structure @chan:
static u32 ar9002_hw_compute_pll_control(struct ath_hw *ah, struct ath9k_channel *chan)
static int ar9002_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan)
DOC: Programming Atheros 802.11n analog front end radios.
static void ar9002_hw_set_nf_limits(struct ath_hw *ah)
static void ar9002_olc_init(struct ath_hw *ah)
static void ar9002_hw_antdiv_comb_conf_set(struct ath_hw *ah, struct ath_hw_antcomb_conf *antconf)
static void ar9002_hw_do_getnf(struct ath_hw *ah, int16_t nfarray[NUM_NF_READINGS])
static struct ath_hw_private_ops * ath9k_hw_private_ops(struct ath_hw *ah)
Definition hw.h:880
static struct ath_hw_ops * ath9k_hw_ops(struct ath_hw *ah)
Definition hw.h:885
struct ath_hw_ops - callbacks used by hardware code and driver code
Definition hw.h:604
void(* antdiv_comb_conf_set)(struct ath_hw *ah, struct ath_hw_antcomb_conf *antconf)
Definition hw.h:642
void(* antdiv_comb_conf_get)(struct ath_hw *ah, struct ath_hw_antcomb_conf *antconf)
Definition hw.h:640
struct ath_hw_private_ops - callbacks used internally by hardware code
Definition hw.h:551
void(* rf_free_ext_banks)(struct ath_hw *ah)
Definition hw.h:567
void(* olc_init)(struct ath_hw *ah)
Definition hw.h:575
int(* rf_set_freq)(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw.h:562
u32(* compute_pll_control)(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw.h:583
void(* spur_mitigate_freq)(struct ath_hw *ah, struct ath9k_channel *chan)
Definition hw.h:564
int(* set_rf_regs)(struct ath_hw *ah, struct ath9k_channel *chan, u16 modesIndex)
Definition hw.h:568
int(* rf_alloc_ext_banks)(struct ath_hw *ah)
Definition hw.h:566
void(* do_getnf)(struct ath_hw *ah, int16_t nfarray[NUM_NF_READINGS])
Definition hw.h:587

References ah, ath_hw_ops::antdiv_comb_conf_get, ath_hw_ops::antdiv_comb_conf_set, ar9002_hw_antdiv_comb_conf_get(), ar9002_hw_antdiv_comb_conf_set(), ar9002_hw_compute_pll_control(), ar9002_hw_do_getnf(), ar9002_hw_set_channel(), ar9002_hw_set_nf_limits(), ar9002_hw_spur_mitigate(), ar9002_olc_init(), ath9k_hw_ops(), ath9k_hw_private_ops(), ath_hw_private_ops::compute_pll_control, ath_hw_private_ops::do_getnf, NULL, ath_hw_private_ops::olc_init, ath_hw_private_ops::rf_alloc_ext_banks, ath_hw_private_ops::rf_free_ext_banks, ath_hw_private_ops::rf_set_freq, ath_hw_private_ops::set_rf_regs, and ath_hw_private_ops::spur_mitigate_freq.

Referenced by ar9002_hw_attach_ops().