2 * Copyright (c) 2010 Atheros Communications Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #include "ar9003_phy.h"
19 #include "ar9003_eeprom.h"
21 #define COMP_HDR_LEN 4
22 #define COMP_CKSUM_LEN 2
24 #define AR_CH0_TOP (0x00016288)
25 #define AR_CH0_TOP_XPABIASLVL (0x3)
26 #define AR_CH0_TOP_XPABIASLVL_S (8)
28 #define AR_CH0_THERM (0x00016290)
29 #define AR_CH0_THERM_SPARE (0x3f)
30 #define AR_CH0_THERM_SPARE_S (0)
32 #define AR_SWITCH_TABLE_COM_ALL (0xffff)
33 #define AR_SWITCH_TABLE_COM_ALL_S (0)
35 #define AR_SWITCH_TABLE_COM2_ALL (0xffffff)
36 #define AR_SWITCH_TABLE_COM2_ALL_S (0)
38 #define AR_SWITCH_TABLE_ALL (0xfff)
39 #define AR_SWITCH_TABLE_ALL_S (0)
41 #define LE16(x) __constant_cpu_to_le16(x)
42 #define LE32(x) __constant_cpu_to_le32(x)
44 /* Local defines to distinguish between extension and control CTL's */
45 #define EXT_ADDITIVE (0x8000)
46 #define CTL_11A_EXT (CTL_11A | EXT_ADDITIVE)
47 #define CTL_11G_EXT (CTL_11G | EXT_ADDITIVE)
48 #define CTL_11B_EXT (CTL_11B | EXT_ADDITIVE)
49 #define REDUCE_SCALED_POWER_BY_TWO_CHAIN 6 /* 10*log10(2)*2 */
50 #define REDUCE_SCALED_POWER_BY_THREE_CHAIN 9 /* 10*log10(3)*2 */
51 #define PWRINCR_3_TO_1_CHAIN 9 /* 10*log(3)*2 */
52 #define PWRINCR_3_TO_2_CHAIN 3 /* floor(10*log(3/2)*2) */
53 #define PWRINCR_2_TO_1_CHAIN 6 /* 10*log(2)*2 */
55 #define SUB_NUM_CTL_MODES_AT_5G_40 2 /* excluding HT40, EXT-OFDM */
56 #define SUB_NUM_CTL_MODES_AT_2G_40 3 /* excluding HT40, EXT-OFDM, EXT-CCK */
58 static const struct ar9300_eeprom ar9300_default
= {
61 .macAddr
= {1, 2, 3, 4, 5, 6},
62 .custData
= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
63 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
65 .regDmn
= { LE16(0), LE16(0x1f) },
66 .txrxMask
= 0x77, /* 4 bits tx and 4 bits rx */
68 .opFlags
= AR9300_OPFLAGS_11G
| AR9300_OPFLAGS_11A
,
72 .blueToothOptions
= 0,
74 .deviceType
= 5, /* takes lower byte in eeprom location */
75 .pwrTableOffset
= AR9300_PWR_TABLE_OFFSET
,
76 .params_for_tuning_caps
= {0, 0},
77 .featureEnable
= 0x0c,
79 * bit0 - enable tx temp comp - disabled
80 * bit1 - enable tx volt comp - disabled
81 * bit2 - enable fastClock - enabled
82 * bit3 - enable doubling - enabled
83 * bit4 - enable internal regulator - disabled
84 * bit5 - enable pa predistortion - disabled
86 .miscConfiguration
= 0, /* bit0 - turn down drivestrength */
87 .eepromWriteEnableGpio
= 3,
90 .rxBandSelectGpio
= 0xff,
95 /* ar9300_modal_eep_header 2g */
96 /* 4 idle,t1,t2,b(4 bits per setting) */
97 .antCtrlCommon
= LE32(0x110),
98 /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
99 .antCtrlCommon2
= LE32(0x22222),
102 * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
103 * rx1, rx12, b (2 bits each)
105 .antCtrlChain
= { LE16(0x150), LE16(0x150), LE16(0x150) },
108 * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
109 * for ar9280 (0xa20c/b20c 5:0)
111 .xatten1DB
= {0, 0, 0},
114 * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
115 * for ar9280 (0xa20c/b20c 16:12
117 .xatten1Margin
= {0, 0, 0},
122 * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur
123 * channels in usual fbin coding format
125 .spurChans
= {0, 0, 0, 0, 0},
128 * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check
129 * if the register is per chain
131 .noiseFloorThreshCh
= {-1, 0, 0},
132 .ob
= {1, 1, 1},/* 3 chain */
133 .db_stage2
= {1, 1, 1}, /* 3 chain */
134 .db_stage3
= {0, 0, 0},
135 .db_stage4
= {0, 0, 0},
137 .txFrameToDataStart
= 0x0e,
138 .txFrameToPaOn
= 0x0e,
139 .txClip
= 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
141 .switchSettling
= 0x2c,
142 .adcDesiredSize
= -30,
145 .txFrameToXpaOn
= 0xe,
147 .papdRateMaskHt20
= LE32(0x0cf0e0e0),
148 .papdRateMaskHt40
= LE32(0x6cf0e0e0),
150 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
154 .ant_div_control
= 0,
155 .future
= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
162 /* ar9300_cal_data_per_freq_op_loop 2g */
164 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
165 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
166 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
168 .calTarget_freqbin_Cck
= {
172 .calTarget_freqbin_2G
= {
177 .calTarget_freqbin_2GHT20
= {
182 .calTarget_freqbin_2GHT40
= {
187 .calTargetPowerCck
= {
188 /* 1L-5L,5S,11L,11S */
189 { {36, 36, 36, 36} },
190 { {36, 36, 36, 36} },
192 .calTargetPower2G
= {
194 { {32, 32, 28, 24} },
195 { {32, 32, 28, 24} },
196 { {32, 32, 28, 24} },
198 .calTargetPower2GHT20
= {
199 { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
200 { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
201 { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
203 .calTargetPower2GHT40
= {
204 { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
205 { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
206 { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
209 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
210 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
240 /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
241 /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
242 /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
243 /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1),
247 /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
248 /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
249 /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
254 /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
255 /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
261 /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
262 /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
263 /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
264 /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
268 /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
269 /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
270 /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
274 /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
275 /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
276 /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
281 /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
282 /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
283 /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
288 /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
289 /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
290 /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
291 /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
295 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
296 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
297 { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } },
299 { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } },
300 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
301 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
303 { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } },
304 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
305 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
307 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
308 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
309 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
312 /* 4 idle,t1,t2,b (4 bits per setting) */
313 .antCtrlCommon
= LE32(0x110),
314 /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
315 .antCtrlCommon2
= LE32(0x22222),
316 /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
318 LE16(0x000), LE16(0x000), LE16(0x000),
320 /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
321 .xatten1DB
= {0, 0, 0},
324 * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
325 * for merlin (0xa20c/b20c 16:12
327 .xatten1Margin
= {0, 0, 0},
330 /* spurChans spur channels in usual fbin coding format */
331 .spurChans
= {0, 0, 0, 0, 0},
332 /* noiseFloorThreshCh Check if the register is per chain */
333 .noiseFloorThreshCh
= {-1, 0, 0},
334 .ob
= {3, 3, 3}, /* 3 chain */
335 .db_stage2
= {3, 3, 3}, /* 3 chain */
336 .db_stage3
= {3, 3, 3}, /* doesn't exist for 2G */
337 .db_stage4
= {3, 3, 3}, /* don't exist for 2G */
339 .txFrameToDataStart
= 0x0e,
340 .txFrameToPaOn
= 0x0e,
341 .txClip
= 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
343 .switchSettling
= 0x2d,
344 .adcDesiredSize
= -30,
347 .txFrameToXpaOn
= 0xe,
349 .papdRateMaskHt20
= LE32(0x0c80c080),
350 .papdRateMaskHt40
= LE32(0x0080c080),
352 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
358 .xatten1DBLow
= {0, 0, 0},
359 .xatten1MarginLow
= {0, 0, 0},
360 .xatten1DBHigh
= {0, 0, 0},
361 .xatten1MarginHigh
= {0, 0, 0}
406 .calTarget_freqbin_5G
= {
416 .calTarget_freqbin_5GHT20
= {
426 .calTarget_freqbin_5GHT40
= {
436 .calTargetPower5G
= {
438 { {20, 20, 20, 10} },
439 { {20, 20, 20, 10} },
440 { {20, 20, 20, 10} },
441 { {20, 20, 20, 10} },
442 { {20, 20, 20, 10} },
443 { {20, 20, 20, 10} },
444 { {20, 20, 20, 10} },
445 { {20, 20, 20, 10} },
447 .calTargetPower5GHT20
= {
449 * 0_8_16,1-3_9-11_17-19,
450 * 4,5,6,7,12,13,14,15,20,21,22,23
452 { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
453 { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
454 { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
455 { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
456 { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
457 { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
458 { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
459 { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
461 .calTargetPower5GHT40
= {
463 * 0_8_16,1-3_9-11_17-19,
464 * 4,5,6,7,12,13,14,15,20,21,22,23
466 { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
467 { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
468 { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
469 { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
470 { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
471 { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
472 { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
473 { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
476 0x10, 0x16, 0x18, 0x40, 0x46,
477 0x48, 0x30, 0x36, 0x38
481 /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
482 /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
483 /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
484 /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
485 /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0),
486 /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
487 /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
488 /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
491 /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
492 /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
493 /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
494 /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
495 /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0),
496 /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
497 /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
498 /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
502 /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
503 /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
504 /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
505 /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0),
506 /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0),
507 /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0),
508 /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0),
509 /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0)
513 /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
514 /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
515 /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0),
516 /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0),
517 /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
518 /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
519 /* Data[3].ctlEdges[6].bChannel */ 0xFF,
520 /* Data[3].ctlEdges[7].bChannel */ 0xFF,
524 /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
525 /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
526 /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0),
527 /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0),
528 /* Data[4].ctlEdges[4].bChannel */ 0xFF,
529 /* Data[4].ctlEdges[5].bChannel */ 0xFF,
530 /* Data[4].ctlEdges[6].bChannel */ 0xFF,
531 /* Data[4].ctlEdges[7].bChannel */ 0xFF,
535 /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
536 /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0),
537 /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0),
538 /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
539 /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0),
540 /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
541 /* Data[5].ctlEdges[6].bChannel */ 0xFF,
542 /* Data[5].ctlEdges[7].bChannel */ 0xFF
546 /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
547 /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
548 /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0),
549 /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0),
550 /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
551 /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0),
552 /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0),
553 /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0)
557 /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
558 /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
559 /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0),
560 /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
561 /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0),
562 /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
563 /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
564 /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
568 /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
569 /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
570 /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
571 /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
572 /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0),
573 /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
574 /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0),
575 /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0)
581 {60, 1}, {60, 1}, {60, 1}, {60, 1},
582 {60, 1}, {60, 1}, {60, 1}, {60, 0},
587 {60, 1}, {60, 1}, {60, 1}, {60, 1},
588 {60, 1}, {60, 1}, {60, 1}, {60, 0},
593 {60, 0}, {60, 1}, {60, 0}, {60, 1},
594 {60, 1}, {60, 1}, {60, 1}, {60, 1},
599 {60, 0}, {60, 1}, {60, 1}, {60, 0},
600 {60, 1}, {60, 0}, {60, 0}, {60, 0},
605 {60, 1}, {60, 1}, {60, 1}, {60, 0},
606 {60, 0}, {60, 0}, {60, 0}, {60, 0},
611 {60, 1}, {60, 1}, {60, 1}, {60, 1},
612 {60, 1}, {60, 0}, {60, 0}, {60, 0},
617 {60, 1}, {60, 1}, {60, 1}, {60, 1},
618 {60, 1}, {60, 1}, {60, 1}, {60, 1},
623 {60, 1}, {60, 1}, {60, 0}, {60, 1},
624 {60, 1}, {60, 1}, {60, 1}, {60, 0},
629 {60, 1}, {60, 0}, {60, 1}, {60, 1},
630 {60, 1}, {60, 1}, {60, 0}, {60, 1},
636 static const struct ar9300_eeprom ar9300_x113
= {
638 .templateVersion
= 6,
639 .macAddr
= {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0},
640 .custData
= {"x113-023-f0000"},
642 .regDmn
= { LE16(0), LE16(0x1f) },
643 .txrxMask
= 0x77, /* 4 bits tx and 4 bits rx */
645 .opFlags
= AR9300_OPFLAGS_11G
| AR9300_OPFLAGS_11A
,
649 .blueToothOptions
= 0,
651 .deviceType
= 5, /* takes lower byte in eeprom location */
652 .pwrTableOffset
= AR9300_PWR_TABLE_OFFSET
,
653 .params_for_tuning_caps
= {0, 0},
654 .featureEnable
= 0x0d,
656 * bit0 - enable tx temp comp - disabled
657 * bit1 - enable tx volt comp - disabled
658 * bit2 - enable fastClock - enabled
659 * bit3 - enable doubling - enabled
660 * bit4 - enable internal regulator - disabled
661 * bit5 - enable pa predistortion - disabled
663 .miscConfiguration
= 0, /* bit0 - turn down drivestrength */
664 .eepromWriteEnableGpio
= 6,
665 .wlanDisableGpio
= 0,
667 .rxBandSelectGpio
= 0xff,
672 /* ar9300_modal_eep_header 2g */
673 /* 4 idle,t1,t2,b(4 bits per setting) */
674 .antCtrlCommon
= LE32(0x110),
675 /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
676 .antCtrlCommon2
= LE32(0x44444),
679 * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
680 * rx1, rx12, b (2 bits each)
682 .antCtrlChain
= { LE16(0x150), LE16(0x150), LE16(0x150) },
685 * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
686 * for ar9280 (0xa20c/b20c 5:0)
688 .xatten1DB
= {0, 0, 0},
691 * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
692 * for ar9280 (0xa20c/b20c 16:12
694 .xatten1Margin
= {0, 0, 0},
699 * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur
700 * channels in usual fbin coding format
702 .spurChans
= {FREQ2FBIN(2464, 1), 0, 0, 0, 0},
705 * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check
706 * if the register is per chain
708 .noiseFloorThreshCh
= {-1, 0, 0},
709 .ob
= {1, 1, 1},/* 3 chain */
710 .db_stage2
= {1, 1, 1}, /* 3 chain */
711 .db_stage3
= {0, 0, 0},
712 .db_stage4
= {0, 0, 0},
714 .txFrameToDataStart
= 0x0e,
715 .txFrameToPaOn
= 0x0e,
716 .txClip
= 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
718 .switchSettling
= 0x2c,
719 .adcDesiredSize
= -30,
722 .txFrameToXpaOn
= 0xe,
724 .papdRateMaskHt20
= LE32(0x0c80c080),
725 .papdRateMaskHt40
= LE32(0x0080c080),
727 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
731 .ant_div_control
= 0,
732 .future
= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
739 /* ar9300_cal_data_per_freq_op_loop 2g */
741 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
742 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
743 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
745 .calTarget_freqbin_Cck
= {
749 .calTarget_freqbin_2G
= {
754 .calTarget_freqbin_2GHT20
= {
759 .calTarget_freqbin_2GHT40
= {
764 .calTargetPowerCck
= {
765 /* 1L-5L,5S,11L,11S */
766 { {34, 34, 34, 34} },
767 { {34, 34, 34, 34} },
769 .calTargetPower2G
= {
771 { {34, 34, 32, 32} },
772 { {34, 34, 32, 32} },
773 { {34, 34, 32, 32} },
775 .calTargetPower2GHT20
= {
776 { {32, 32, 32, 32, 32, 28, 32, 32, 30, 28, 0, 0, 0, 0} },
777 { {32, 32, 32, 32, 32, 28, 32, 32, 30, 28, 0, 0, 0, 0} },
778 { {32, 32, 32, 32, 32, 28, 32, 32, 30, 28, 0, 0, 0, 0} },
780 .calTargetPower2GHT40
= {
781 { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
782 { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
783 { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
786 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
787 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
817 /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
818 /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
819 /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
820 /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1),
824 /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
825 /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
826 /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
831 /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
832 /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
838 /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
839 /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
840 /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
841 /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
845 /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
846 /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
847 /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
851 /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
852 /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
853 /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
858 /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
859 /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
860 /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
865 /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
866 /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
867 /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
868 /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
872 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
873 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
874 { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } },
876 { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } },
877 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
878 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
880 { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } },
881 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
882 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
884 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
885 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
886 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
889 /* 4 idle,t1,t2,b (4 bits per setting) */
890 .antCtrlCommon
= LE32(0x220),
891 /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
892 .antCtrlCommon2
= LE32(0x11111),
893 /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
895 LE16(0x150), LE16(0x150), LE16(0x150),
897 /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
898 .xatten1DB
= {0, 0, 0},
901 * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
902 * for merlin (0xa20c/b20c 16:12
904 .xatten1Margin
= {0, 0, 0},
907 /* spurChans spur channels in usual fbin coding format */
908 .spurChans
= {FREQ2FBIN(5500, 0), 0, 0, 0, 0},
909 /* noiseFloorThreshCh Check if the register is per chain */
910 .noiseFloorThreshCh
= {-1, 0, 0},
911 .ob
= {3, 3, 3}, /* 3 chain */
912 .db_stage2
= {3, 3, 3}, /* 3 chain */
913 .db_stage3
= {3, 3, 3}, /* doesn't exist for 2G */
914 .db_stage4
= {3, 3, 3}, /* don't exist for 2G */
916 .txFrameToDataStart
= 0x0e,
917 .txFrameToPaOn
= 0x0e,
918 .txClip
= 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
920 .switchSettling
= 0x2d,
921 .adcDesiredSize
= -30,
924 .txFrameToXpaOn
= 0xe,
926 .papdRateMaskHt20
= LE32(0x0cf0e0e0),
927 .papdRateMaskHt40
= LE32(0x6cf0e0e0),
929 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
934 .tempSlopeHigh
= 105,
935 .xatten1DBLow
= {0, 0, 0},
936 .xatten1MarginLow
= {0, 0, 0},
937 .xatten1DBHigh
= {0, 0, 0},
938 .xatten1MarginHigh
= {0, 0, 0}
983 .calTarget_freqbin_5G
= {
993 .calTarget_freqbin_5GHT20
= {
1003 .calTarget_freqbin_5GHT40
= {
1013 .calTargetPower5G
= {
1015 { {42, 40, 40, 34} },
1016 { {42, 40, 40, 34} },
1017 { {42, 40, 40, 34} },
1018 { {42, 40, 40, 34} },
1019 { {42, 40, 40, 34} },
1020 { {42, 40, 40, 34} },
1021 { {42, 40, 40, 34} },
1022 { {42, 40, 40, 34} },
1024 .calTargetPower5GHT20
= {
1026 * 0_8_16,1-3_9-11_17-19,
1027 * 4,5,6,7,12,13,14,15,20,21,22,23
1029 { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
1030 { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
1031 { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
1032 { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
1033 { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
1034 { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
1035 { {38, 38, 38, 38, 32, 28, 38, 38, 32, 28, 38, 38, 32, 26} },
1036 { {36, 36, 36, 36, 32, 28, 36, 36, 32, 28, 36, 36, 32, 26} },
1038 .calTargetPower5GHT40
= {
1040 * 0_8_16,1-3_9-11_17-19,
1041 * 4,5,6,7,12,13,14,15,20,21,22,23
1043 { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
1044 { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
1045 { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
1046 { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
1047 { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
1048 { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
1049 { {36, 36, 36, 36, 30, 26, 36, 36, 30, 26, 36, 36, 30, 24} },
1050 { {34, 34, 34, 34, 30, 26, 34, 34, 30, 26, 34, 34, 30, 24} },
1053 0x10, 0x16, 0x18, 0x40, 0x46,
1054 0x48, 0x30, 0x36, 0x38
1058 /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1059 /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
1060 /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
1061 /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
1062 /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0),
1063 /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
1064 /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
1065 /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
1068 /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1069 /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
1070 /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
1071 /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
1072 /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0),
1073 /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
1074 /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
1075 /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
1079 /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
1080 /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
1081 /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
1082 /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0),
1083 /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0),
1084 /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0),
1085 /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0),
1086 /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0)
1090 /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1091 /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
1092 /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0),
1093 /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0),
1094 /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
1095 /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
1096 /* Data[3].ctlEdges[6].bChannel */ 0xFF,
1097 /* Data[3].ctlEdges[7].bChannel */ 0xFF,
1101 /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1102 /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
1103 /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0),
1104 /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0),
1105 /* Data[4].ctlEdges[4].bChannel */ 0xFF,
1106 /* Data[4].ctlEdges[5].bChannel */ 0xFF,
1107 /* Data[4].ctlEdges[6].bChannel */ 0xFF,
1108 /* Data[4].ctlEdges[7].bChannel */ 0xFF,
1112 /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
1113 /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0),
1114 /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0),
1115 /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
1116 /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0),
1117 /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
1118 /* Data[5].ctlEdges[6].bChannel */ 0xFF,
1119 /* Data[5].ctlEdges[7].bChannel */ 0xFF
1123 /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1124 /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
1125 /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0),
1126 /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0),
1127 /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
1128 /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0),
1129 /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0),
1130 /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0)
1134 /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1135 /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
1136 /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0),
1137 /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
1138 /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0),
1139 /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
1140 /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
1141 /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
1145 /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
1146 /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
1147 /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
1148 /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
1149 /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0),
1150 /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
1151 /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0),
1152 /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0)
1155 .ctlPowerData_5G
= {
1158 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1159 {60, 1}, {60, 1}, {60, 1}, {60, 0},
1164 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1165 {60, 1}, {60, 1}, {60, 1}, {60, 0},
1170 {60, 0}, {60, 1}, {60, 0}, {60, 1},
1171 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1176 {60, 0}, {60, 1}, {60, 1}, {60, 0},
1177 {60, 1}, {60, 0}, {60, 0}, {60, 0},
1182 {60, 1}, {60, 1}, {60, 1}, {60, 0},
1183 {60, 0}, {60, 0}, {60, 0}, {60, 0},
1188 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1189 {60, 1}, {60, 0}, {60, 0}, {60, 0},
1194 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1195 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1200 {60, 1}, {60, 1}, {60, 0}, {60, 1},
1201 {60, 1}, {60, 1}, {60, 1}, {60, 0},
1206 {60, 1}, {60, 0}, {60, 1}, {60, 1},
1207 {60, 1}, {60, 1}, {60, 0}, {60, 1},
1214 static const struct ar9300_eeprom ar9300_h112
= {
1216 .templateVersion
= 3,
1217 .macAddr
= {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0},
1218 .custData
= {"h112-241-f0000"},
1220 .regDmn
= { LE16(0), LE16(0x1f) },
1221 .txrxMask
= 0x77, /* 4 bits tx and 4 bits rx */
1223 .opFlags
= AR9300_OPFLAGS_11G
| AR9300_OPFLAGS_11A
,
1227 .blueToothOptions
= 0,
1229 .deviceType
= 5, /* takes lower byte in eeprom location */
1230 .pwrTableOffset
= AR9300_PWR_TABLE_OFFSET
,
1231 .params_for_tuning_caps
= {0, 0},
1232 .featureEnable
= 0x0d,
1234 * bit0 - enable tx temp comp - disabled
1235 * bit1 - enable tx volt comp - disabled
1236 * bit2 - enable fastClock - enabled
1237 * bit3 - enable doubling - enabled
1238 * bit4 - enable internal regulator - disabled
1239 * bit5 - enable pa predistortion - disabled
1241 .miscConfiguration
= 0, /* bit0 - turn down drivestrength */
1242 .eepromWriteEnableGpio
= 6,
1243 .wlanDisableGpio
= 0,
1245 .rxBandSelectGpio
= 0xff,
1250 /* ar9300_modal_eep_header 2g */
1251 /* 4 idle,t1,t2,b(4 bits per setting) */
1252 .antCtrlCommon
= LE32(0x110),
1253 /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
1254 .antCtrlCommon2
= LE32(0x44444),
1257 * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
1258 * rx1, rx12, b (2 bits each)
1260 .antCtrlChain
= { LE16(0x150), LE16(0x150), LE16(0x150) },
1263 * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
1264 * for ar9280 (0xa20c/b20c 5:0)
1266 .xatten1DB
= {0, 0, 0},
1269 * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
1270 * for ar9280 (0xa20c/b20c 16:12
1272 .xatten1Margin
= {0, 0, 0},
1277 * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur
1278 * channels in usual fbin coding format
1280 .spurChans
= {FREQ2FBIN(2464, 1), 0, 0, 0, 0},
1283 * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check
1284 * if the register is per chain
1286 .noiseFloorThreshCh
= {-1, 0, 0},
1287 .ob
= {1, 1, 1},/* 3 chain */
1288 .db_stage2
= {1, 1, 1}, /* 3 chain */
1289 .db_stage3
= {0, 0, 0},
1290 .db_stage4
= {0, 0, 0},
1292 .txFrameToDataStart
= 0x0e,
1293 .txFrameToPaOn
= 0x0e,
1294 .txClip
= 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
1296 .switchSettling
= 0x2c,
1297 .adcDesiredSize
= -30,
1300 .txFrameToXpaOn
= 0xe,
1302 .papdRateMaskHt20
= LE32(0x80c080),
1303 .papdRateMaskHt40
= LE32(0x80c080),
1305 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1309 .ant_div_control
= 0,
1310 .future
= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
1317 /* ar9300_cal_data_per_freq_op_loop 2g */
1319 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
1320 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
1321 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
1323 .calTarget_freqbin_Cck
= {
1327 .calTarget_freqbin_2G
= {
1332 .calTarget_freqbin_2GHT20
= {
1337 .calTarget_freqbin_2GHT40
= {
1342 .calTargetPowerCck
= {
1343 /* 1L-5L,5S,11L,11S */
1344 { {34, 34, 34, 34} },
1345 { {34, 34, 34, 34} },
1347 .calTargetPower2G
= {
1349 { {34, 34, 32, 32} },
1350 { {34, 34, 32, 32} },
1351 { {34, 34, 32, 32} },
1353 .calTargetPower2GHT20
= {
1354 { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 28, 28, 28, 24} },
1355 { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 28, 28, 28, 24} },
1356 { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 28, 28, 28, 24} },
1358 .calTargetPower2GHT40
= {
1359 { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 26, 26, 26, 22} },
1360 { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 26, 26, 26, 22} },
1361 { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 26, 26, 26, 22} },
1364 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
1365 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
1395 /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
1396 /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
1397 /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
1398 /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1),
1402 /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
1403 /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
1404 /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
1409 /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
1410 /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
1416 /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
1417 /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
1418 /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
1419 /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
1423 /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
1424 /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
1425 /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
1429 /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
1430 /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
1431 /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
1436 /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
1437 /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
1438 /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
1443 /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
1444 /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
1445 /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
1446 /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
1449 .ctlPowerData_2G
= {
1450 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
1451 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
1452 { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } },
1454 { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } },
1455 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
1456 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
1458 { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } },
1459 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
1460 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
1462 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
1463 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
1464 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
1467 /* 4 idle,t1,t2,b (4 bits per setting) */
1468 .antCtrlCommon
= LE32(0x220),
1469 /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
1470 .antCtrlCommon2
= LE32(0x44444),
1471 /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
1473 LE16(0x150), LE16(0x150), LE16(0x150),
1475 /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
1476 .xatten1DB
= {0, 0, 0},
1479 * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
1480 * for merlin (0xa20c/b20c 16:12
1482 .xatten1Margin
= {0, 0, 0},
1485 /* spurChans spur channels in usual fbin coding format */
1486 .spurChans
= {0, 0, 0, 0, 0},
1487 /* noiseFloorThreshCh Check if the register is per chain */
1488 .noiseFloorThreshCh
= {-1, 0, 0},
1489 .ob
= {3, 3, 3}, /* 3 chain */
1490 .db_stage2
= {3, 3, 3}, /* 3 chain */
1491 .db_stage3
= {3, 3, 3}, /* doesn't exist for 2G */
1492 .db_stage4
= {3, 3, 3}, /* don't exist for 2G */
1494 .txFrameToDataStart
= 0x0e,
1495 .txFrameToPaOn
= 0x0e,
1496 .txClip
= 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
1498 .switchSettling
= 0x2d,
1499 .adcDesiredSize
= -30,
1502 .txFrameToXpaOn
= 0xe,
1504 .papdRateMaskHt20
= LE32(0x0cf0e0e0),
1505 .papdRateMaskHt40
= LE32(0x6cf0e0e0),
1507 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1512 .tempSlopeHigh
= 50,
1513 .xatten1DBLow
= {0, 0, 0},
1514 .xatten1MarginLow
= {0, 0, 0},
1515 .xatten1DBHigh
= {0, 0, 0},
1516 .xatten1MarginHigh
= {0, 0, 0}
1561 .calTarget_freqbin_5G
= {
1571 .calTarget_freqbin_5GHT20
= {
1581 .calTarget_freqbin_5GHT40
= {
1591 .calTargetPower5G
= {
1593 { {30, 30, 28, 24} },
1594 { {30, 30, 28, 24} },
1595 { {30, 30, 28, 24} },
1596 { {30, 30, 28, 24} },
1597 { {30, 30, 28, 24} },
1598 { {30, 30, 28, 24} },
1599 { {30, 30, 28, 24} },
1600 { {30, 30, 28, 24} },
1602 .calTargetPower5GHT20
= {
1604 * 0_8_16,1-3_9-11_17-19,
1605 * 4,5,6,7,12,13,14,15,20,21,22,23
1607 { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 20, 20, 20, 16} },
1608 { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 20, 20, 20, 16} },
1609 { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 18, 18, 18, 16} },
1610 { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 18, 18, 18, 16} },
1611 { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 16, 16, 16, 14} },
1612 { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 16, 16, 16, 14} },
1613 { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 14, 14, 14, 12} },
1614 { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 14, 14, 14, 12} },
1616 .calTargetPower5GHT40
= {
1618 * 0_8_16,1-3_9-11_17-19,
1619 * 4,5,6,7,12,13,14,15,20,21,22,23
1621 { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 18, 18, 18, 14} },
1622 { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 18, 18, 18, 14} },
1623 { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 16, 16, 16, 12} },
1624 { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 16, 16, 16, 12} },
1625 { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 14, 14, 14, 10} },
1626 { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 14, 14, 14, 10} },
1627 { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 12, 12, 12, 8} },
1628 { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 12, 12, 12, 8} },
1631 0x10, 0x16, 0x18, 0x40, 0x46,
1632 0x48, 0x30, 0x36, 0x38
1636 /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1637 /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
1638 /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
1639 /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
1640 /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0),
1641 /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
1642 /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
1643 /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
1646 /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1647 /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
1648 /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
1649 /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
1650 /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0),
1651 /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
1652 /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
1653 /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
1657 /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
1658 /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
1659 /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
1660 /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0),
1661 /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0),
1662 /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0),
1663 /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0),
1664 /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0)
1668 /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1669 /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
1670 /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0),
1671 /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0),
1672 /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
1673 /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
1674 /* Data[3].ctlEdges[6].bChannel */ 0xFF,
1675 /* Data[3].ctlEdges[7].bChannel */ 0xFF,
1679 /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1680 /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
1681 /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0),
1682 /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0),
1683 /* Data[4].ctlEdges[4].bChannel */ 0xFF,
1684 /* Data[4].ctlEdges[5].bChannel */ 0xFF,
1685 /* Data[4].ctlEdges[6].bChannel */ 0xFF,
1686 /* Data[4].ctlEdges[7].bChannel */ 0xFF,
1690 /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
1691 /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0),
1692 /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0),
1693 /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
1694 /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0),
1695 /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
1696 /* Data[5].ctlEdges[6].bChannel */ 0xFF,
1697 /* Data[5].ctlEdges[7].bChannel */ 0xFF
1701 /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1702 /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
1703 /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0),
1704 /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0),
1705 /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
1706 /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0),
1707 /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0),
1708 /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0)
1712 /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1713 /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
1714 /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0),
1715 /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
1716 /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0),
1717 /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
1718 /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
1719 /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
1723 /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
1724 /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
1725 /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
1726 /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
1727 /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0),
1728 /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
1729 /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0),
1730 /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0)
1733 .ctlPowerData_5G
= {
1736 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1737 {60, 1}, {60, 1}, {60, 1}, {60, 0},
1742 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1743 {60, 1}, {60, 1}, {60, 1}, {60, 0},
1748 {60, 0}, {60, 1}, {60, 0}, {60, 1},
1749 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1754 {60, 0}, {60, 1}, {60, 1}, {60, 0},
1755 {60, 1}, {60, 0}, {60, 0}, {60, 0},
1760 {60, 1}, {60, 1}, {60, 1}, {60, 0},
1761 {60, 0}, {60, 0}, {60, 0}, {60, 0},
1766 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1767 {60, 1}, {60, 0}, {60, 0}, {60, 0},
1772 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1773 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1778 {60, 1}, {60, 1}, {60, 0}, {60, 1},
1779 {60, 1}, {60, 1}, {60, 1}, {60, 0},
1784 {60, 1}, {60, 0}, {60, 1}, {60, 1},
1785 {60, 1}, {60, 1}, {60, 0}, {60, 1},
1792 static const struct ar9300_eeprom ar9300_x112
= {
1794 .templateVersion
= 5,
1795 .macAddr
= {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0},
1796 .custData
= {"x112-041-f0000"},
1798 .regDmn
= { LE16(0), LE16(0x1f) },
1799 .txrxMask
= 0x77, /* 4 bits tx and 4 bits rx */
1801 .opFlags
= AR9300_OPFLAGS_11G
| AR9300_OPFLAGS_11A
,
1805 .blueToothOptions
= 0,
1807 .deviceType
= 5, /* takes lower byte in eeprom location */
1808 .pwrTableOffset
= AR9300_PWR_TABLE_OFFSET
,
1809 .params_for_tuning_caps
= {0, 0},
1810 .featureEnable
= 0x0d,
1812 * bit0 - enable tx temp comp - disabled
1813 * bit1 - enable tx volt comp - disabled
1814 * bit2 - enable fastclock - enabled
1815 * bit3 - enable doubling - enabled
1816 * bit4 - enable internal regulator - disabled
1817 * bit5 - enable pa predistortion - disabled
1819 .miscConfiguration
= 0, /* bit0 - turn down drivestrength */
1820 .eepromWriteEnableGpio
= 6,
1821 .wlanDisableGpio
= 0,
1823 .rxBandSelectGpio
= 0xff,
1828 /* ar9300_modal_eep_header 2g */
1829 /* 4 idle,t1,t2,b(4 bits per setting) */
1830 .antCtrlCommon
= LE32(0x110),
1831 /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
1832 .antCtrlCommon2
= LE32(0x22222),
1835 * antCtrlChain[ar9300_max_chains]; 6 idle, t, r,
1836 * rx1, rx12, b (2 bits each)
1838 .antCtrlChain
= { LE16(0x10), LE16(0x10), LE16(0x10) },
1841 * xatten1DB[AR9300_max_chains]; 3 xatten1_db
1842 * for ar9280 (0xa20c/b20c 5:0)
1844 .xatten1DB
= {0x1b, 0x1b, 0x1b},
1847 * xatten1Margin[ar9300_max_chains]; 3 xatten1_margin
1848 * for ar9280 (0xa20c/b20c 16:12
1850 .xatten1Margin
= {0x15, 0x15, 0x15},
1855 * spurChans[OSPrey_eeprom_modal_sPURS]; spur
1856 * channels in usual fbin coding format
1858 .spurChans
= {FREQ2FBIN(2464, 1), 0, 0, 0, 0},
1861 * noiseFloorThreshch[ar9300_max_cHAINS]; 3 Check
1862 * if the register is per chain
1864 .noiseFloorThreshCh
= {-1, 0, 0},
1865 .ob
= {1, 1, 1},/* 3 chain */
1866 .db_stage2
= {1, 1, 1}, /* 3 chain */
1867 .db_stage3
= {0, 0, 0},
1868 .db_stage4
= {0, 0, 0},
1870 .txFrameToDataStart
= 0x0e,
1871 .txFrameToPaOn
= 0x0e,
1872 .txClip
= 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
1874 .switchSettling
= 0x2c,
1875 .adcDesiredSize
= -30,
1878 .txFrameToXpaOn
= 0xe,
1880 .papdRateMaskHt20
= LE32(0x0c80c080),
1881 .papdRateMaskHt40
= LE32(0x0080c080),
1883 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1887 .ant_div_control
= 0,
1888 .future
= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
1895 /* ar9300_cal_data_per_freq_op_loop 2g */
1897 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
1898 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
1899 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
1901 .calTarget_freqbin_Cck
= {
1905 .calTarget_freqbin_2G
= {
1910 .calTarget_freqbin_2GHT20
= {
1915 .calTarget_freqbin_2GHT40
= {
1920 .calTargetPowerCck
= {
1921 /* 1L-5L,5S,11L,11s */
1922 { {38, 38, 38, 38} },
1923 { {38, 38, 38, 38} },
1925 .calTargetPower2G
= {
1927 { {38, 38, 36, 34} },
1928 { {38, 38, 36, 34} },
1929 { {38, 38, 34, 32} },
1931 .calTargetPower2GHT20
= {
1932 { {36, 36, 36, 36, 36, 34, 34, 32, 30, 28, 28, 28, 28, 26} },
1933 { {36, 36, 36, 36, 36, 34, 36, 34, 32, 30, 30, 30, 28, 26} },
1934 { {36, 36, 36, 36, 36, 34, 34, 32, 30, 28, 28, 28, 28, 26} },
1936 .calTargetPower2GHT40
= {
1937 { {36, 36, 36, 36, 34, 32, 32, 30, 28, 26, 26, 26, 26, 24} },
1938 { {36, 36, 36, 36, 34, 32, 34, 32, 30, 28, 28, 28, 28, 24} },
1939 { {36, 36, 36, 36, 34, 32, 32, 30, 28, 26, 26, 26, 26, 24} },
1942 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
1943 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
1973 /* Data[4].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
1974 /* Data[4].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
1975 /* Data[4].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
1976 /* Data[4].ctledges[3].bchannel */ FREQ2FBIN(2484, 1),
1980 /* Data[5].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
1981 /* Data[5].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
1982 /* Data[5].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
1987 /* Data[6].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
1988 /* Data[6].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
1994 /* Data[7].ctledges[0].bchannel */ FREQ2FBIN(2422, 1),
1995 /* Data[7].ctledges[1].bchannel */ FREQ2FBIN(2427, 1),
1996 /* Data[7].ctledges[2].bchannel */ FREQ2FBIN(2447, 1),
1997 /* Data[7].ctledges[3].bchannel */ FREQ2FBIN(2462, 1),
2001 /* Data[8].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
2002 /* Data[8].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
2003 /* Data[8].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
2007 /* Data[9].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
2008 /* Data[9].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
2009 /* Data[9].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
2014 /* Data[10].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
2015 /* Data[10].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
2016 /* Data[10].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
2021 /* Data[11].ctledges[0].bchannel */ FREQ2FBIN(2422, 1),
2022 /* Data[11].ctledges[1].bchannel */ FREQ2FBIN(2427, 1),
2023 /* Data[11].ctledges[2].bchannel */ FREQ2FBIN(2447, 1),
2024 /* Data[11].ctledges[3].bchannel */ FREQ2FBIN(2462, 1),
2027 .ctlPowerData_2G
= {
2028 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2029 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2030 { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } },
2032 { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } },
2033 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2034 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2036 { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } },
2037 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2038 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2040 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2041 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
2042 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
2045 /* 4 idle,t1,t2,b (4 bits per setting) */
2046 .antCtrlCommon
= LE32(0x110),
2047 /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
2048 .antCtrlCommon2
= LE32(0x22222),
2049 /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
2051 LE16(0x0), LE16(0x0), LE16(0x0),
2053 /* xatten1DB 3 xatten1_db for ar9280 (0xa20c/b20c 5:0) */
2054 .xatten1DB
= {0x13, 0x19, 0x17},
2057 * xatten1Margin[ar9300_max_chains]; 3 xatten1_margin
2058 * for merlin (0xa20c/b20c 16:12
2060 .xatten1Margin
= {0x19, 0x19, 0x19},
2063 /* spurChans spur channels in usual fbin coding format */
2064 .spurChans
= {0, 0, 0, 0, 0},
2065 /* noiseFloorThreshch check if the register is per chain */
2066 .noiseFloorThreshCh
= {-1, 0, 0},
2067 .ob
= {3, 3, 3}, /* 3 chain */
2068 .db_stage2
= {3, 3, 3}, /* 3 chain */
2069 .db_stage3
= {3, 3, 3}, /* doesn't exist for 2G */
2070 .db_stage4
= {3, 3, 3}, /* don't exist for 2G */
2072 .txFrameToDataStart
= 0x0e,
2073 .txFrameToPaOn
= 0x0e,
2074 .txClip
= 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
2076 .switchSettling
= 0x2d,
2077 .adcDesiredSize
= -30,
2080 .txFrameToXpaOn
= 0xe,
2082 .papdRateMaskHt20
= LE32(0x0cf0e0e0),
2083 .papdRateMaskHt40
= LE32(0x6cf0e0e0),
2085 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2090 .tempSlopeHigh
= 105,
2091 .xatten1DBLow
= {0x10, 0x14, 0x10},
2092 .xatten1MarginLow
= {0x19, 0x19 , 0x19},
2093 .xatten1DBHigh
= {0x1d, 0x20, 0x24},
2094 .xatten1MarginHigh
= {0x10, 0x10, 0x10}
2139 .calTarget_freqbin_5G
= {
2149 .calTarget_freqbin_5GHT20
= {
2159 .calTarget_freqbin_5GHT40
= {
2169 .calTargetPower5G
= {
2171 { {32, 32, 28, 26} },
2172 { {32, 32, 28, 26} },
2173 { {32, 32, 28, 26} },
2174 { {32, 32, 26, 24} },
2175 { {32, 32, 26, 24} },
2176 { {32, 32, 24, 22} },
2177 { {30, 30, 24, 22} },
2178 { {30, 30, 24, 22} },
2180 .calTargetPower5GHT20
= {
2182 * 0_8_16,1-3_9-11_17-19,
2183 * 4,5,6,7,12,13,14,15,20,21,22,23
2185 { {32, 32, 32, 32, 28, 26, 32, 28, 26, 24, 24, 24, 22, 22} },
2186 { {32, 32, 32, 32, 28, 26, 32, 28, 26, 24, 24, 24, 22, 22} },
2187 { {32, 32, 32, 32, 28, 26, 32, 28, 26, 24, 24, 24, 22, 22} },
2188 { {32, 32, 32, 32, 28, 26, 32, 26, 24, 22, 22, 22, 20, 20} },
2189 { {32, 32, 32, 32, 28, 26, 32, 26, 24, 22, 20, 18, 16, 16} },
2190 { {32, 32, 32, 32, 28, 26, 32, 24, 20, 16, 18, 16, 14, 14} },
2191 { {30, 30, 30, 30, 28, 26, 30, 24, 20, 16, 18, 16, 14, 14} },
2192 { {30, 30, 30, 30, 28, 26, 30, 24, 20, 16, 18, 16, 14, 14} },
2194 .calTargetPower5GHT40
= {
2196 * 0_8_16,1-3_9-11_17-19,
2197 * 4,5,6,7,12,13,14,15,20,21,22,23
2199 { {32, 32, 32, 30, 28, 26, 30, 28, 26, 24, 24, 24, 22, 22} },
2200 { {32, 32, 32, 30, 28, 26, 30, 28, 26, 24, 24, 24, 22, 22} },
2201 { {32, 32, 32, 30, 28, 26, 30, 28, 26, 24, 24, 24, 22, 22} },
2202 { {32, 32, 32, 30, 28, 26, 30, 26, 24, 22, 22, 22, 20, 20} },
2203 { {32, 32, 32, 30, 28, 26, 30, 26, 24, 22, 20, 18, 16, 16} },
2204 { {32, 32, 32, 30, 28, 26, 30, 22, 20, 16, 18, 16, 14, 14} },
2205 { {30, 30, 30, 30, 28, 26, 30, 22, 20, 16, 18, 16, 14, 14} },
2206 { {30, 30, 30, 30, 28, 26, 30, 22, 20, 16, 18, 16, 14, 14} },
2209 0x10, 0x16, 0x18, 0x40, 0x46,
2210 0x48, 0x30, 0x36, 0x38
2214 /* Data[0].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
2215 /* Data[0].ctledges[1].bchannel */ FREQ2FBIN(5260, 0),
2216 /* Data[0].ctledges[2].bchannel */ FREQ2FBIN(5280, 0),
2217 /* Data[0].ctledges[3].bchannel */ FREQ2FBIN(5500, 0),
2218 /* Data[0].ctledges[4].bchannel */ FREQ2FBIN(5600, 0),
2219 /* Data[0].ctledges[5].bchannel */ FREQ2FBIN(5700, 0),
2220 /* Data[0].ctledges[6].bchannel */ FREQ2FBIN(5745, 0),
2221 /* Data[0].ctledges[7].bchannel */ FREQ2FBIN(5825, 0)
2224 /* Data[1].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
2225 /* Data[1].ctledges[1].bchannel */ FREQ2FBIN(5260, 0),
2226 /* Data[1].ctledges[2].bchannel */ FREQ2FBIN(5280, 0),
2227 /* Data[1].ctledges[3].bchannel */ FREQ2FBIN(5500, 0),
2228 /* Data[1].ctledges[4].bchannel */ FREQ2FBIN(5520, 0),
2229 /* Data[1].ctledges[5].bchannel */ FREQ2FBIN(5700, 0),
2230 /* Data[1].ctledges[6].bchannel */ FREQ2FBIN(5745, 0),
2231 /* Data[1].ctledges[7].bchannel */ FREQ2FBIN(5825, 0)
2235 /* Data[2].ctledges[0].bchannel */ FREQ2FBIN(5190, 0),
2236 /* Data[2].ctledges[1].bchannel */ FREQ2FBIN(5230, 0),
2237 /* Data[2].ctledges[2].bchannel */ FREQ2FBIN(5270, 0),
2238 /* Data[2].ctledges[3].bchannel */ FREQ2FBIN(5310, 0),
2239 /* Data[2].ctledges[4].bchannel */ FREQ2FBIN(5510, 0),
2240 /* Data[2].ctledges[5].bchannel */ FREQ2FBIN(5550, 0),
2241 /* Data[2].ctledges[6].bchannel */ FREQ2FBIN(5670, 0),
2242 /* Data[2].ctledges[7].bchannel */ FREQ2FBIN(5755, 0)
2246 /* Data[3].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
2247 /* Data[3].ctledges[1].bchannel */ FREQ2FBIN(5200, 0),
2248 /* Data[3].ctledges[2].bchannel */ FREQ2FBIN(5260, 0),
2249 /* Data[3].ctledges[3].bchannel */ FREQ2FBIN(5320, 0),
2250 /* Data[3].ctledges[4].bchannel */ FREQ2FBIN(5500, 0),
2251 /* Data[3].ctledges[5].bchannel */ FREQ2FBIN(5700, 0),
2252 /* Data[3].ctledges[6].bchannel */ 0xFF,
2253 /* Data[3].ctledges[7].bchannel */ 0xFF,
2257 /* Data[4].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
2258 /* Data[4].ctledges[1].bchannel */ FREQ2FBIN(5260, 0),
2259 /* Data[4].ctledges[2].bchannel */ FREQ2FBIN(5500, 0),
2260 /* Data[4].ctledges[3].bchannel */ FREQ2FBIN(5700, 0),
2261 /* Data[4].ctledges[4].bchannel */ 0xFF,
2262 /* Data[4].ctledges[5].bchannel */ 0xFF,
2263 /* Data[4].ctledges[6].bchannel */ 0xFF,
2264 /* Data[4].ctledges[7].bchannel */ 0xFF,
2268 /* Data[5].ctledges[0].bchannel */ FREQ2FBIN(5190, 0),
2269 /* Data[5].ctledges[1].bchannel */ FREQ2FBIN(5270, 0),
2270 /* Data[5].ctledges[2].bchannel */ FREQ2FBIN(5310, 0),
2271 /* Data[5].ctledges[3].bchannel */ FREQ2FBIN(5510, 0),
2272 /* Data[5].ctledges[4].bchannel */ FREQ2FBIN(5590, 0),
2273 /* Data[5].ctledges[5].bchannel */ FREQ2FBIN(5670, 0),
2274 /* Data[5].ctledges[6].bchannel */ 0xFF,
2275 /* Data[5].ctledges[7].bchannel */ 0xFF
2279 /* Data[6].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
2280 /* Data[6].ctledges[1].bchannel */ FREQ2FBIN(5200, 0),
2281 /* Data[6].ctledges[2].bchannel */ FREQ2FBIN(5220, 0),
2282 /* Data[6].ctledges[3].bchannel */ FREQ2FBIN(5260, 0),
2283 /* Data[6].ctledges[4].bchannel */ FREQ2FBIN(5500, 0),
2284 /* Data[6].ctledges[5].bchannel */ FREQ2FBIN(5600, 0),
2285 /* Data[6].ctledges[6].bchannel */ FREQ2FBIN(5700, 0),
2286 /* Data[6].ctledges[7].bchannel */ FREQ2FBIN(5745, 0)
2290 /* Data[7].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
2291 /* Data[7].ctledges[1].bchannel */ FREQ2FBIN(5260, 0),
2292 /* Data[7].ctledges[2].bchannel */ FREQ2FBIN(5320, 0),
2293 /* Data[7].ctledges[3].bchannel */ FREQ2FBIN(5500, 0),
2294 /* Data[7].ctledges[4].bchannel */ FREQ2FBIN(5560, 0),
2295 /* Data[7].ctledges[5].bchannel */ FREQ2FBIN(5700, 0),
2296 /* Data[7].ctledges[6].bchannel */ FREQ2FBIN(5745, 0),
2297 /* Data[7].ctledges[7].bchannel */ FREQ2FBIN(5825, 0)
2301 /* Data[8].ctledges[0].bchannel */ FREQ2FBIN(5190, 0),
2302 /* Data[8].ctledges[1].bchannel */ FREQ2FBIN(5230, 0),
2303 /* Data[8].ctledges[2].bchannel */ FREQ2FBIN(5270, 0),
2304 /* Data[8].ctledges[3].bchannel */ FREQ2FBIN(5510, 0),
2305 /* Data[8].ctledges[4].bchannel */ FREQ2FBIN(5550, 0),
2306 /* Data[8].ctledges[5].bchannel */ FREQ2FBIN(5670, 0),
2307 /* Data[8].ctledges[6].bchannel */ FREQ2FBIN(5755, 0),
2308 /* Data[8].ctledges[7].bchannel */ FREQ2FBIN(5795, 0)
2311 .ctlPowerData_5G
= {
2314 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2315 {60, 1}, {60, 1}, {60, 1}, {60, 0},
2320 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2321 {60, 1}, {60, 1}, {60, 1}, {60, 0},
2326 {60, 0}, {60, 1}, {60, 0}, {60, 1},
2327 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2332 {60, 0}, {60, 1}, {60, 1}, {60, 0},
2333 {60, 1}, {60, 0}, {60, 0}, {60, 0},
2338 {60, 1}, {60, 1}, {60, 1}, {60, 0},
2339 {60, 0}, {60, 0}, {60, 0}, {60, 0},
2344 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2345 {60, 1}, {60, 0}, {60, 0}, {60, 0},
2350 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2351 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2356 {60, 1}, {60, 1}, {60, 0}, {60, 1},
2357 {60, 1}, {60, 1}, {60, 1}, {60, 0},
2362 {60, 1}, {60, 0}, {60, 1}, {60, 1},
2363 {60, 1}, {60, 1}, {60, 0}, {60, 1},
2369 static const struct ar9300_eeprom ar9300_h116
= {
2371 .templateVersion
= 4,
2372 .macAddr
= {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0},
2373 .custData
= {"h116-041-f0000"},
2375 .regDmn
= { LE16(0), LE16(0x1f) },
2376 .txrxMask
= 0x33, /* 4 bits tx and 4 bits rx */
2378 .opFlags
= AR9300_OPFLAGS_11G
| AR9300_OPFLAGS_11A
,
2382 .blueToothOptions
= 0,
2384 .deviceType
= 5, /* takes lower byte in eeprom location */
2385 .pwrTableOffset
= AR9300_PWR_TABLE_OFFSET
,
2386 .params_for_tuning_caps
= {0, 0},
2387 .featureEnable
= 0x0d,
2389 * bit0 - enable tx temp comp - disabled
2390 * bit1 - enable tx volt comp - disabled
2391 * bit2 - enable fastClock - enabled
2392 * bit3 - enable doubling - enabled
2393 * bit4 - enable internal regulator - disabled
2394 * bit5 - enable pa predistortion - disabled
2396 .miscConfiguration
= 0, /* bit0 - turn down drivestrength */
2397 .eepromWriteEnableGpio
= 6,
2398 .wlanDisableGpio
= 0,
2400 .rxBandSelectGpio
= 0xff,
2405 /* ar9300_modal_eep_header 2g */
2406 /* 4 idle,t1,t2,b(4 bits per setting) */
2407 .antCtrlCommon
= LE32(0x110),
2408 /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
2409 .antCtrlCommon2
= LE32(0x44444),
2412 * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
2413 * rx1, rx12, b (2 bits each)
2415 .antCtrlChain
= { LE16(0x10), LE16(0x10), LE16(0x10) },
2418 * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
2419 * for ar9280 (0xa20c/b20c 5:0)
2421 .xatten1DB
= {0x1f, 0x1f, 0x1f},
2424 * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
2425 * for ar9280 (0xa20c/b20c 16:12
2427 .xatten1Margin
= {0x12, 0x12, 0x12},
2432 * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur
2433 * channels in usual fbin coding format
2435 .spurChans
= {FREQ2FBIN(2464, 1), 0, 0, 0, 0},
2438 * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check
2439 * if the register is per chain
2441 .noiseFloorThreshCh
= {-1, 0, 0},
2442 .ob
= {1, 1, 1},/* 3 chain */
2443 .db_stage2
= {1, 1, 1}, /* 3 chain */
2444 .db_stage3
= {0, 0, 0},
2445 .db_stage4
= {0, 0, 0},
2447 .txFrameToDataStart
= 0x0e,
2448 .txFrameToPaOn
= 0x0e,
2449 .txClip
= 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
2451 .switchSettling
= 0x2c,
2452 .adcDesiredSize
= -30,
2455 .txFrameToXpaOn
= 0xe,
2457 .papdRateMaskHt20
= LE32(0x0c80C080),
2458 .papdRateMaskHt40
= LE32(0x0080C080),
2460 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2464 .ant_div_control
= 0,
2465 .future
= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
2472 /* ar9300_cal_data_per_freq_op_loop 2g */
2474 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
2475 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
2476 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
2478 .calTarget_freqbin_Cck
= {
2482 .calTarget_freqbin_2G
= {
2487 .calTarget_freqbin_2GHT20
= {
2492 .calTarget_freqbin_2GHT40
= {
2497 .calTargetPowerCck
= {
2498 /* 1L-5L,5S,11L,11S */
2499 { {34, 34, 34, 34} },
2500 { {34, 34, 34, 34} },
2502 .calTargetPower2G
= {
2504 { {34, 34, 32, 32} },
2505 { {34, 34, 32, 32} },
2506 { {34, 34, 32, 32} },
2508 .calTargetPower2GHT20
= {
2509 { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 0, 0, 0, 0} },
2510 { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 0, 0, 0, 0} },
2511 { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 0, 0, 0, 0} },
2513 .calTargetPower2GHT40
= {
2514 { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
2515 { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
2516 { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
2519 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
2520 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
2550 /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
2551 /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
2552 /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
2553 /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1),
2557 /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
2558 /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
2559 /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
2564 /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
2565 /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
2571 /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
2572 /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
2573 /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
2574 /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
2578 /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
2579 /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
2580 /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
2584 /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
2585 /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
2586 /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
2591 /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
2592 /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
2593 /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
2598 /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
2599 /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
2600 /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
2601 /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
2604 .ctlPowerData_2G
= {
2605 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2606 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2607 { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } },
2609 { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } },
2610 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2611 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2613 { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } },
2614 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2615 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2617 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2618 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
2619 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
2622 /* 4 idle,t1,t2,b (4 bits per setting) */
2623 .antCtrlCommon
= LE32(0x220),
2624 /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
2625 .antCtrlCommon2
= LE32(0x44444),
2626 /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
2628 LE16(0x150), LE16(0x150), LE16(0x150),
2630 /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
2631 .xatten1DB
= {0x19, 0x19, 0x19},
2634 * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
2635 * for merlin (0xa20c/b20c 16:12
2637 .xatten1Margin
= {0x14, 0x14, 0x14},
2640 /* spurChans spur channels in usual fbin coding format */
2641 .spurChans
= {0, 0, 0, 0, 0},
2642 /* noiseFloorThreshCh Check if the register is per chain */
2643 .noiseFloorThreshCh
= {-1, 0, 0},
2644 .ob
= {3, 3, 3}, /* 3 chain */
2645 .db_stage2
= {3, 3, 3}, /* 3 chain */
2646 .db_stage3
= {3, 3, 3}, /* doesn't exist for 2G */
2647 .db_stage4
= {3, 3, 3}, /* don't exist for 2G */
2649 .txFrameToDataStart
= 0x0e,
2650 .txFrameToPaOn
= 0x0e,
2651 .txClip
= 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
2653 .switchSettling
= 0x2d,
2654 .adcDesiredSize
= -30,
2657 .txFrameToXpaOn
= 0xe,
2659 .papdRateMaskHt20
= LE32(0x0cf0e0e0),
2660 .papdRateMaskHt40
= LE32(0x6cf0e0e0),
2662 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2667 .tempSlopeHigh
= 50,
2668 .xatten1DBLow
= {0, 0, 0},
2669 .xatten1MarginLow
= {0, 0, 0},
2670 .xatten1DBHigh
= {0, 0, 0},
2671 .xatten1MarginHigh
= {0, 0, 0}
2716 .calTarget_freqbin_5G
= {
2726 .calTarget_freqbin_5GHT20
= {
2736 .calTarget_freqbin_5GHT40
= {
2746 .calTargetPower5G
= {
2748 { {30, 30, 28, 24} },
2749 { {30, 30, 28, 24} },
2750 { {30, 30, 28, 24} },
2751 { {30, 30, 28, 24} },
2752 { {30, 30, 28, 24} },
2753 { {30, 30, 28, 24} },
2754 { {30, 30, 28, 24} },
2755 { {30, 30, 28, 24} },
2757 .calTargetPower5GHT20
= {
2759 * 0_8_16,1-3_9-11_17-19,
2760 * 4,5,6,7,12,13,14,15,20,21,22,23
2762 { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 0, 0, 0, 0} },
2763 { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 0, 0, 0, 0} },
2764 { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 0, 0, 0, 0} },
2765 { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 0, 0, 0, 0} },
2766 { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 0, 0, 0, 0} },
2767 { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 0, 0, 0, 0} },
2768 { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 0, 0, 0, 0} },
2769 { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 0, 0, 0, 0} },
2771 .calTargetPower5GHT40
= {
2773 * 0_8_16,1-3_9-11_17-19,
2774 * 4,5,6,7,12,13,14,15,20,21,22,23
2776 { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 0, 0, 0, 0} },
2777 { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 0, 0, 0, 0} },
2778 { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 0, 0, 0, 0} },
2779 { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 0, 0, 0, 0} },
2780 { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 0, 0, 0, 0} },
2781 { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 0, 0, 0, 0} },
2782 { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 0, 0, 0, 0} },
2783 { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 0, 0, 0, 0} },
2786 0x10, 0x16, 0x18, 0x40, 0x46,
2787 0x48, 0x30, 0x36, 0x38
2791 /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
2792 /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
2793 /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
2794 /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
2795 /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0),
2796 /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
2797 /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
2798 /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
2801 /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
2802 /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
2803 /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
2804 /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
2805 /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0),
2806 /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
2807 /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
2808 /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
2812 /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
2813 /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
2814 /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
2815 /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0),
2816 /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0),
2817 /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0),
2818 /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0),
2819 /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0)
2823 /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
2824 /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
2825 /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0),
2826 /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0),
2827 /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
2828 /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
2829 /* Data[3].ctlEdges[6].bChannel */ 0xFF,
2830 /* Data[3].ctlEdges[7].bChannel */ 0xFF,
2834 /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
2835 /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
2836 /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0),
2837 /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0),
2838 /* Data[4].ctlEdges[4].bChannel */ 0xFF,
2839 /* Data[4].ctlEdges[5].bChannel */ 0xFF,
2840 /* Data[4].ctlEdges[6].bChannel */ 0xFF,
2841 /* Data[4].ctlEdges[7].bChannel */ 0xFF,
2845 /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
2846 /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0),
2847 /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0),
2848 /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
2849 /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0),
2850 /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
2851 /* Data[5].ctlEdges[6].bChannel */ 0xFF,
2852 /* Data[5].ctlEdges[7].bChannel */ 0xFF
2856 /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
2857 /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
2858 /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0),
2859 /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0),
2860 /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
2861 /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0),
2862 /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0),
2863 /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0)
2867 /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
2868 /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
2869 /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0),
2870 /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
2871 /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0),
2872 /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
2873 /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
2874 /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
2878 /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
2879 /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
2880 /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
2881 /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
2882 /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0),
2883 /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
2884 /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0),
2885 /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0)
2888 .ctlPowerData_5G
= {
2891 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2892 {60, 1}, {60, 1}, {60, 1}, {60, 0},
2897 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2898 {60, 1}, {60, 1}, {60, 1}, {60, 0},
2903 {60, 0}, {60, 1}, {60, 0}, {60, 1},
2904 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2909 {60, 0}, {60, 1}, {60, 1}, {60, 0},
2910 {60, 1}, {60, 0}, {60, 0}, {60, 0},
2915 {60, 1}, {60, 1}, {60, 1}, {60, 0},
2916 {60, 0}, {60, 0}, {60, 0}, {60, 0},
2921 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2922 {60, 1}, {60, 0}, {60, 0}, {60, 0},
2927 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2928 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2933 {60, 1}, {60, 1}, {60, 0}, {60, 1},
2934 {60, 1}, {60, 1}, {60, 1}, {60, 0},
2939 {60, 1}, {60, 0}, {60, 1}, {60, 1},
2940 {60, 1}, {60, 1}, {60, 0}, {60, 1},
2947 static const struct ar9300_eeprom
*ar9300_eep_templates
[] = {
2955 static const struct ar9300_eeprom
*ar9003_eeprom_struct_find_by_id(int id
)
2957 #define N_LOOP (sizeof(ar9300_eep_templates) / sizeof(ar9300_eep_templates[0]))
2960 for (it
= 0; it
< N_LOOP
; it
++)
2961 if (ar9300_eep_templates
[it
]->templateVersion
== id
)
2962 return ar9300_eep_templates
[it
];
2968 static u16
ath9k_hw_fbin2freq(u8 fbin
, bool is2GHz
)
2970 if (fbin
== AR9300_BCHAN_UNUSED
)
2973 return (u16
) ((is2GHz
) ? (2300 + fbin
) : (4800 + 5 * fbin
));
2976 static int ath9k_hw_ar9300_check_eeprom(struct ath_hw
*ah
)
2981 static u32
ath9k_hw_ar9300_get_eeprom(struct ath_hw
*ah
,
2982 enum eeprom_param param
)
2984 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
2985 struct ar9300_base_eep_hdr
*pBase
= &eep
->baseEepHeader
;
2989 return eep
->macAddr
[0] << 8 | eep
->macAddr
[1];
2991 return eep
->macAddr
[2] << 8 | eep
->macAddr
[3];
2993 return eep
->macAddr
[4] << 8 | eep
->macAddr
[5];
2995 return le16_to_cpu(pBase
->regDmn
[0]);
2997 return le16_to_cpu(pBase
->regDmn
[1]);
2999 return pBase
->deviceCap
;
3001 return pBase
->opCapFlags
.opFlags
;
3003 return pBase
->rfSilent
;
3005 return (pBase
->txrxMask
>> 4) & 0xf;
3007 return pBase
->txrxMask
& 0xf;
3008 case EEP_DRIVE_STRENGTH
:
3009 #define AR9300_EEP_BASE_DRIV_STRENGTH 0x1
3010 return pBase
->miscConfiguration
& AR9300_EEP_BASE_DRIV_STRENGTH
;
3011 case EEP_INTERNAL_REGULATOR
:
3012 /* Bit 4 is internal regulator flag */
3013 return (pBase
->featureEnable
& 0x10) >> 4;
3015 return le32_to_cpu(pBase
->swreg
);
3017 return !!(pBase
->featureEnable
& BIT(5));
3023 static bool ar9300_eeprom_read_byte(struct ath_common
*common
, int address
,
3028 if (unlikely(!ath9k_hw_nvram_read(common
, address
/ 2, &val
)))
3031 *buffer
= (val
>> (8 * (address
% 2))) & 0xff;
3035 static bool ar9300_eeprom_read_word(struct ath_common
*common
, int address
,
3040 if (unlikely(!ath9k_hw_nvram_read(common
, address
/ 2, &val
)))
3043 buffer
[0] = val
>> 8;
3044 buffer
[1] = val
& 0xff;
3049 static bool ar9300_read_eeprom(struct ath_hw
*ah
, int address
, u8
*buffer
,
3052 struct ath_common
*common
= ath9k_hw_common(ah
);
3055 if ((address
< 0) || ((address
+ count
) / 2 > AR9300_EEPROM_SIZE
- 1)) {
3056 ath_print(common
, ATH_DBG_EEPROM
,
3057 "eeprom address not in range\n");
3062 * Since we're reading the bytes in reverse order from a little-endian
3063 * word stream, an even address means we only use the lower half of
3064 * the 16-bit word at that address
3066 if (address
% 2 == 0) {
3067 if (!ar9300_eeprom_read_byte(common
, address
--, buffer
++))
3073 for (i
= 0; i
< count
/ 2; i
++) {
3074 if (!ar9300_eeprom_read_word(common
, address
, buffer
))
3082 if (!ar9300_eeprom_read_byte(common
, address
, buffer
))
3088 ath_print(common
, ATH_DBG_EEPROM
,
3089 "unable to read eeprom region at offset %d\n", address
);
3093 static void ar9300_comp_hdr_unpack(u8
*best
, int *code
, int *reference
,
3094 int *length
, int *major
, int *minor
)
3096 unsigned long value
[4];
3102 *code
= ((value
[0] >> 5) & 0x0007);
3103 *reference
= (value
[0] & 0x001f) | ((value
[1] >> 2) & 0x0020);
3104 *length
= ((value
[1] << 4) & 0x07f0) | ((value
[2] >> 4) & 0x000f);
3105 *major
= (value
[2] & 0x000f);
3106 *minor
= (value
[3] & 0x00ff);
3109 static u16
ar9300_comp_cksum(u8
*data
, int dsize
)
3111 int it
, checksum
= 0;
3113 for (it
= 0; it
< dsize
; it
++) {
3114 checksum
+= data
[it
];
3121 static bool ar9300_uncompress_block(struct ath_hw
*ah
,
3131 struct ath_common
*common
= ath9k_hw_common(ah
);
3135 for (it
= 0; it
< size
; it
+= (length
+2)) {
3139 length
= block
[it
+1];
3142 if (length
> 0 && spot
>= 0 && spot
+length
<= mdataSize
) {
3143 ath_print(common
, ATH_DBG_EEPROM
,
3144 "Restore at %d: spot=%d "
3145 "offset=%d length=%d\n",
3146 it
, spot
, offset
, length
);
3147 memcpy(&mptr
[spot
], &block
[it
+2], length
);
3149 } else if (length
> 0) {
3150 ath_print(common
, ATH_DBG_EEPROM
,
3151 "Bad restore at %d: spot=%d "
3152 "offset=%d length=%d\n",
3153 it
, spot
, offset
, length
);
3160 static int ar9300_compress_decision(struct ath_hw
*ah
,
3165 u8
*word
, int length
, int mdata_size
)
3167 struct ath_common
*common
= ath9k_hw_common(ah
);
3169 const struct ar9300_eeprom
*eep
= NULL
;
3173 if (length
!= mdata_size
) {
3174 ath_print(common
, ATH_DBG_EEPROM
,
3175 "EEPROM structure size mismatch"
3176 "memory=%d eeprom=%d\n", mdata_size
, length
);
3179 memcpy(mptr
, (u8
*) (word
+ COMP_HDR_LEN
), length
);
3180 ath_print(common
, ATH_DBG_EEPROM
, "restored eeprom %d:"
3181 " uncompressed, length %d\n", it
, length
);
3183 case _CompressBlock
:
3184 if (reference
== 0) {
3187 eep
= ar9003_eeprom_struct_find_by_id(reference
);
3189 ath_print(common
, ATH_DBG_EEPROM
,
3190 "cant find reference eeprom"
3191 "struct %d\n", reference
);
3194 memcpy(mptr
, eep
, mdata_size
);
3196 ath_print(common
, ATH_DBG_EEPROM
,
3197 "restore eeprom %d: block, reference %d,"
3198 " length %d\n", it
, reference
, length
);
3199 ar9300_uncompress_block(ah
, mptr
, mdata_size
,
3200 (u8
*) (word
+ COMP_HDR_LEN
), length
);
3203 ath_print(common
, ATH_DBG_EEPROM
, "unknown compression"
3204 " code %d\n", code
);
3211 * Read the configuration data from the eeprom.
3212 * The data can be put in any specified memory buffer.
3214 * Returns -1 on error.
3215 * Returns address of next memory location on success.
3217 static int ar9300_eeprom_restore_internal(struct ath_hw
*ah
,
3218 u8
*mptr
, int mdata_size
)
3225 int reference
, length
, major
, minor
;
3228 u16 checksum
, mchecksum
;
3229 struct ath_common
*common
= ath9k_hw_common(ah
);
3231 word
= kzalloc(2048, GFP_KERNEL
);
3235 memcpy(mptr
, &ar9300_default
, mdata_size
);
3237 cptr
= AR9300_BASE_ADDR
;
3238 for (it
= 0; it
< MSTATE
; it
++) {
3239 if (!ar9300_read_eeprom(ah
, cptr
, word
, COMP_HDR_LEN
))
3242 if ((word
[0] == 0 && word
[1] == 0 && word
[2] == 0 &&
3243 word
[3] == 0) || (word
[0] == 0xff && word
[1] == 0xff
3244 && word
[2] == 0xff && word
[3] == 0xff))
3247 ar9300_comp_hdr_unpack(word
, &code
, &reference
,
3248 &length
, &major
, &minor
);
3249 ath_print(common
, ATH_DBG_EEPROM
,
3250 "Found block at %x: code=%d ref=%d"
3251 "length=%d major=%d minor=%d\n", cptr
, code
,
3252 reference
, length
, major
, minor
);
3253 if (length
>= 1024) {
3254 ath_print(common
, ATH_DBG_EEPROM
,
3255 "Skipping bad header\n");
3256 cptr
-= COMP_HDR_LEN
;
3261 ar9300_read_eeprom(ah
, cptr
, word
,
3262 COMP_HDR_LEN
+ osize
+ COMP_CKSUM_LEN
);
3263 checksum
= ar9300_comp_cksum(&word
[COMP_HDR_LEN
], length
);
3264 mchecksum
= word
[COMP_HDR_LEN
+ osize
] |
3265 (word
[COMP_HDR_LEN
+ osize
+ 1] << 8);
3266 ath_print(common
, ATH_DBG_EEPROM
,
3267 "checksum %x %x\n", checksum
, mchecksum
);
3268 if (checksum
== mchecksum
) {
3269 ar9300_compress_decision(ah
, it
, code
, reference
, mptr
,
3270 word
, length
, mdata_size
);
3272 ath_print(common
, ATH_DBG_EEPROM
,
3273 "skipping block with bad checksum\n");
3275 cptr
-= (COMP_HDR_LEN
+ osize
+ COMP_CKSUM_LEN
);
3287 * Restore the configuration structure by reading the eeprom.
3288 * This function destroys any existing in-memory structure
3291 static bool ath9k_hw_ar9300_fill_eeprom(struct ath_hw
*ah
)
3293 u8
*mptr
= (u8
*) &ah
->eeprom
.ar9300_eep
;
3295 if (ar9300_eeprom_restore_internal(ah
, mptr
,
3296 sizeof(struct ar9300_eeprom
)) < 0)
3302 /* XXX: review hardware docs */
3303 static int ath9k_hw_ar9300_get_eeprom_ver(struct ath_hw
*ah
)
3305 return ah
->eeprom
.ar9300_eep
.eepromVersion
;
3308 /* XXX: could be read from the eepromVersion, not sure yet */
3309 static int ath9k_hw_ar9300_get_eeprom_rev(struct ath_hw
*ah
)
3314 static u8
ath9k_hw_ar9300_get_num_ant_config(struct ath_hw
*ah
,
3315 enum ath9k_hal_freq_band freq_band
)
3320 static u32
ath9k_hw_ar9300_get_eeprom_antenna_cfg(struct ath_hw
*ah
,
3321 struct ath9k_channel
*chan
)
3326 static s32
ar9003_hw_xpa_bias_level_get(struct ath_hw
*ah
, bool is2ghz
)
3328 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
3331 return eep
->modalHeader2G
.xpaBiasLvl
;
3333 return eep
->modalHeader5G
.xpaBiasLvl
;
3336 static void ar9003_hw_xpa_bias_level_apply(struct ath_hw
*ah
, bool is2ghz
)
3338 int bias
= ar9003_hw_xpa_bias_level_get(ah
, is2ghz
);
3339 REG_RMW_FIELD(ah
, AR_CH0_TOP
, AR_CH0_TOP_XPABIASLVL
, (bias
& 0x3));
3340 REG_RMW_FIELD(ah
, AR_CH0_THERM
, AR_CH0_THERM_SPARE
,
3341 ((bias
>> 2) & 0x3));
3344 static u32
ar9003_hw_ant_ctrl_common_get(struct ath_hw
*ah
, bool is2ghz
)
3346 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
3350 val
= eep
->modalHeader2G
.antCtrlCommon
;
3352 val
= eep
->modalHeader5G
.antCtrlCommon
;
3353 return le32_to_cpu(val
);
3356 static u32
ar9003_hw_ant_ctrl_common_2_get(struct ath_hw
*ah
, bool is2ghz
)
3358 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
3362 val
= eep
->modalHeader2G
.antCtrlCommon2
;
3364 val
= eep
->modalHeader5G
.antCtrlCommon2
;
3365 return le32_to_cpu(val
);
3368 static u16
ar9003_hw_ant_ctrl_chain_get(struct ath_hw
*ah
,
3372 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
3375 if (chain
>= 0 && chain
< AR9300_MAX_CHAINS
) {
3377 val
= eep
->modalHeader2G
.antCtrlChain
[chain
];
3379 val
= eep
->modalHeader5G
.antCtrlChain
[chain
];
3382 return le16_to_cpu(val
);
3385 static void ar9003_hw_ant_ctrl_apply(struct ath_hw
*ah
, bool is2ghz
)
3387 u32 value
= ar9003_hw_ant_ctrl_common_get(ah
, is2ghz
);
3388 REG_RMW_FIELD(ah
, AR_PHY_SWITCH_COM
, AR_SWITCH_TABLE_COM_ALL
, value
);
3390 value
= ar9003_hw_ant_ctrl_common_2_get(ah
, is2ghz
);
3391 REG_RMW_FIELD(ah
, AR_PHY_SWITCH_COM_2
, AR_SWITCH_TABLE_COM2_ALL
, value
);
3393 value
= ar9003_hw_ant_ctrl_chain_get(ah
, 0, is2ghz
);
3394 REG_RMW_FIELD(ah
, AR_PHY_SWITCH_CHAIN_0
, AR_SWITCH_TABLE_ALL
, value
);
3396 value
= ar9003_hw_ant_ctrl_chain_get(ah
, 1, is2ghz
);
3397 REG_RMW_FIELD(ah
, AR_PHY_SWITCH_CHAIN_1
, AR_SWITCH_TABLE_ALL
, value
);
3399 value
= ar9003_hw_ant_ctrl_chain_get(ah
, 2, is2ghz
);
3400 REG_RMW_FIELD(ah
, AR_PHY_SWITCH_CHAIN_2
, AR_SWITCH_TABLE_ALL
, value
);
3403 static void ar9003_hw_drive_strength_apply(struct ath_hw
*ah
)
3408 drive_strength
= ath9k_hw_ar9300_get_eeprom(ah
, EEP_DRIVE_STRENGTH
);
3410 if (!drive_strength
)
3413 reg
= REG_READ(ah
, AR_PHY_65NM_CH0_BIAS1
);
3421 REG_WRITE(ah
, AR_PHY_65NM_CH0_BIAS1
, reg
);
3423 reg
= REG_READ(ah
, AR_PHY_65NM_CH0_BIAS2
);
3434 REG_WRITE(ah
, AR_PHY_65NM_CH0_BIAS2
, reg
);
3436 reg
= REG_READ(ah
, AR_PHY_65NM_CH0_BIAS4
);
3441 REG_WRITE(ah
, AR_PHY_65NM_CH0_BIAS4
, reg
);
3444 static void ar9003_hw_internal_regulator_apply(struct ath_hw
*ah
)
3446 int internal_regulator
=
3447 ath9k_hw_ar9300_get_eeprom(ah
, EEP_INTERNAL_REGULATOR
);
3449 if (internal_regulator
) {
3450 /* Internal regulator is ON. Write swreg register. */
3451 int swreg
= ath9k_hw_ar9300_get_eeprom(ah
, EEP_SWREG
);
3452 REG_WRITE(ah
, AR_RTC_REG_CONTROL1
,
3453 REG_READ(ah
, AR_RTC_REG_CONTROL1
) &
3454 (~AR_RTC_REG_CONTROL1_SWREG_PROGRAM
));
3455 REG_WRITE(ah
, AR_RTC_REG_CONTROL0
, swreg
);
3456 /* Set REG_CONTROL1.SWREG_PROGRAM */
3457 REG_WRITE(ah
, AR_RTC_REG_CONTROL1
,
3459 AR_RTC_REG_CONTROL1
) |
3460 AR_RTC_REG_CONTROL1_SWREG_PROGRAM
);
3462 REG_WRITE(ah
, AR_RTC_SLEEP_CLK
,
3465 AR_RTC_FORCE_SWREG_PRD
));
3469 static void ath9k_hw_ar9300_set_board_values(struct ath_hw
*ah
,
3470 struct ath9k_channel
*chan
)
3472 ar9003_hw_xpa_bias_level_apply(ah
, IS_CHAN_2GHZ(chan
));
3473 ar9003_hw_ant_ctrl_apply(ah
, IS_CHAN_2GHZ(chan
));
3474 ar9003_hw_drive_strength_apply(ah
);
3475 ar9003_hw_internal_regulator_apply(ah
);
3478 static void ath9k_hw_ar9300_set_addac(struct ath_hw
*ah
,
3479 struct ath9k_channel
*chan
)
3484 * Returns the interpolated y value corresponding to the specified x value
3485 * from the np ordered pairs of data (px,py).
3486 * The pairs do not have to be in any order.
3487 * If the specified x value is less than any of the px,
3488 * the returned y value is equal to the py for the lowest px.
3489 * If the specified x value is greater than any of the px,
3490 * the returned y value is equal to the py for the highest px.
3492 static int ar9003_hw_power_interpolate(int32_t x
,
3493 int32_t *px
, int32_t *py
, u_int16_t np
)
3496 int lx
= 0, ly
= 0, lhave
= 0;
3497 int hx
= 0, hy
= 0, hhave
= 0;
3504 /* identify best lower and higher x calibration measurement */
3505 for (ip
= 0; ip
< np
; ip
++) {
3508 /* this measurement is higher than our desired x */
3510 if (!hhave
|| dx
> (x
- hx
)) {
3511 /* new best higher x measurement */
3517 /* this measurement is lower than our desired x */
3519 if (!lhave
|| dx
< (x
- lx
)) {
3520 /* new best lower x measurement */
3528 /* the low x is good */
3530 /* so is the high x */
3532 /* they're the same, so just pick one */
3535 else /* interpolate */
3536 y
= ly
+ (((x
- lx
) * (hy
- ly
)) / (hx
- lx
));
3537 } else /* only low is good, use it */
3539 } else if (hhave
) /* only high is good, use it */
3541 else /* nothing is good,this should never happen unless np=0, ???? */
3546 static u8
ar9003_hw_eeprom_get_tgt_pwr(struct ath_hw
*ah
,
3547 u16 rateIndex
, u16 freq
, bool is2GHz
)
3550 s32 targetPowerArray
[AR9300_NUM_5G_20_TARGET_POWERS
];
3551 s32 freqArray
[AR9300_NUM_5G_20_TARGET_POWERS
];
3552 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
3553 struct cal_tgt_pow_legacy
*pEepromTargetPwr
;
3557 numPiers
= AR9300_NUM_2G_20_TARGET_POWERS
;
3558 pEepromTargetPwr
= eep
->calTargetPower2G
;
3559 pFreqBin
= eep
->calTarget_freqbin_2G
;
3561 numPiers
= AR9300_NUM_5G_20_TARGET_POWERS
;
3562 pEepromTargetPwr
= eep
->calTargetPower5G
;
3563 pFreqBin
= eep
->calTarget_freqbin_5G
;
3567 * create array of channels and targetpower from
3568 * targetpower piers stored on eeprom
3570 for (i
= 0; i
< numPiers
; i
++) {
3571 freqArray
[i
] = FBIN2FREQ(pFreqBin
[i
], is2GHz
);
3572 targetPowerArray
[i
] = pEepromTargetPwr
[i
].tPow2x
[rateIndex
];
3575 /* interpolate to get target power for given frequency */
3576 return (u8
) ar9003_hw_power_interpolate((s32
) freq
,
3578 targetPowerArray
, numPiers
);
3581 static u8
ar9003_hw_eeprom_get_ht20_tgt_pwr(struct ath_hw
*ah
,
3583 u16 freq
, bool is2GHz
)
3586 s32 targetPowerArray
[AR9300_NUM_5G_20_TARGET_POWERS
];
3587 s32 freqArray
[AR9300_NUM_5G_20_TARGET_POWERS
];
3588 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
3589 struct cal_tgt_pow_ht
*pEepromTargetPwr
;
3593 numPiers
= AR9300_NUM_2G_20_TARGET_POWERS
;
3594 pEepromTargetPwr
= eep
->calTargetPower2GHT20
;
3595 pFreqBin
= eep
->calTarget_freqbin_2GHT20
;
3597 numPiers
= AR9300_NUM_5G_20_TARGET_POWERS
;
3598 pEepromTargetPwr
= eep
->calTargetPower5GHT20
;
3599 pFreqBin
= eep
->calTarget_freqbin_5GHT20
;
3603 * create array of channels and targetpower
3604 * from targetpower piers stored on eeprom
3606 for (i
= 0; i
< numPiers
; i
++) {
3607 freqArray
[i
] = FBIN2FREQ(pFreqBin
[i
], is2GHz
);
3608 targetPowerArray
[i
] = pEepromTargetPwr
[i
].tPow2x
[rateIndex
];
3611 /* interpolate to get target power for given frequency */
3612 return (u8
) ar9003_hw_power_interpolate((s32
) freq
,
3614 targetPowerArray
, numPiers
);
3617 static u8
ar9003_hw_eeprom_get_ht40_tgt_pwr(struct ath_hw
*ah
,
3619 u16 freq
, bool is2GHz
)
3622 s32 targetPowerArray
[AR9300_NUM_5G_40_TARGET_POWERS
];
3623 s32 freqArray
[AR9300_NUM_5G_40_TARGET_POWERS
];
3624 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
3625 struct cal_tgt_pow_ht
*pEepromTargetPwr
;
3629 numPiers
= AR9300_NUM_2G_40_TARGET_POWERS
;
3630 pEepromTargetPwr
= eep
->calTargetPower2GHT40
;
3631 pFreqBin
= eep
->calTarget_freqbin_2GHT40
;
3633 numPiers
= AR9300_NUM_5G_40_TARGET_POWERS
;
3634 pEepromTargetPwr
= eep
->calTargetPower5GHT40
;
3635 pFreqBin
= eep
->calTarget_freqbin_5GHT40
;
3639 * create array of channels and targetpower from
3640 * targetpower piers stored on eeprom
3642 for (i
= 0; i
< numPiers
; i
++) {
3643 freqArray
[i
] = FBIN2FREQ(pFreqBin
[i
], is2GHz
);
3644 targetPowerArray
[i
] = pEepromTargetPwr
[i
].tPow2x
[rateIndex
];
3647 /* interpolate to get target power for given frequency */
3648 return (u8
) ar9003_hw_power_interpolate((s32
) freq
,
3650 targetPowerArray
, numPiers
);
3653 static u8
ar9003_hw_eeprom_get_cck_tgt_pwr(struct ath_hw
*ah
,
3654 u16 rateIndex
, u16 freq
)
3656 u16 numPiers
= AR9300_NUM_2G_CCK_TARGET_POWERS
, i
;
3657 s32 targetPowerArray
[AR9300_NUM_2G_CCK_TARGET_POWERS
];
3658 s32 freqArray
[AR9300_NUM_2G_CCK_TARGET_POWERS
];
3659 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
3660 struct cal_tgt_pow_legacy
*pEepromTargetPwr
= eep
->calTargetPowerCck
;
3661 u8
*pFreqBin
= eep
->calTarget_freqbin_Cck
;
3664 * create array of channels and targetpower from
3665 * targetpower piers stored on eeprom
3667 for (i
= 0; i
< numPiers
; i
++) {
3668 freqArray
[i
] = FBIN2FREQ(pFreqBin
[i
], 1);
3669 targetPowerArray
[i
] = pEepromTargetPwr
[i
].tPow2x
[rateIndex
];
3672 /* interpolate to get target power for given frequency */
3673 return (u8
) ar9003_hw_power_interpolate((s32
) freq
,
3675 targetPowerArray
, numPiers
);
3678 /* Set tx power registers to array of values passed in */
3679 static int ar9003_hw_tx_power_regwrite(struct ath_hw
*ah
, u8
* pPwrArray
)
3681 #define POW_SM(_r, _s) (((_r) & 0x3f) << (_s))
3682 /* make sure forced gain is not set */
3683 REG_WRITE(ah
, 0xa458, 0);
3685 /* Write the OFDM power per rate set */
3687 /* 6 (LSB), 9, 12, 18 (MSB) */
3688 REG_WRITE(ah
, 0xa3c0,
3689 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_6_24
], 24) |
3690 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_6_24
], 16) |
3691 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_6_24
], 8) |
3692 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_6_24
], 0));
3694 /* 24 (LSB), 36, 48, 54 (MSB) */
3695 REG_WRITE(ah
, 0xa3c4,
3696 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_54
], 24) |
3697 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_48
], 16) |
3698 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_36
], 8) |
3699 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_6_24
], 0));
3701 /* Write the CCK power per rate set */
3703 /* 1L (LSB), reserved, 2L, 2S (MSB) */
3704 REG_WRITE(ah
, 0xa3c8,
3705 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_1L_5L
], 24) |
3706 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_1L_5L
], 16) |
3707 /* POW_SM(txPowerTimes2, 8) | this is reserved for AR9003 */
3708 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_1L_5L
], 0));
3710 /* 5.5L (LSB), 5.5S, 11L, 11S (MSB) */
3711 REG_WRITE(ah
, 0xa3cc,
3712 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_11S
], 24) |
3713 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_11L
], 16) |
3714 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_5S
], 8) |
3715 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_1L_5L
], 0)
3718 /* Write the HT20 power per rate set */
3720 /* 0/8/16 (LSB), 1-3/9-11/17-19, 4, 5 (MSB) */
3721 REG_WRITE(ah
, 0xa3d0,
3722 POW_SM(pPwrArray
[ALL_TARGET_HT20_5
], 24) |
3723 POW_SM(pPwrArray
[ALL_TARGET_HT20_4
], 16) |
3724 POW_SM(pPwrArray
[ALL_TARGET_HT20_1_3_9_11_17_19
], 8) |
3725 POW_SM(pPwrArray
[ALL_TARGET_HT20_0_8_16
], 0)
3728 /* 6 (LSB), 7, 12, 13 (MSB) */
3729 REG_WRITE(ah
, 0xa3d4,
3730 POW_SM(pPwrArray
[ALL_TARGET_HT20_13
], 24) |
3731 POW_SM(pPwrArray
[ALL_TARGET_HT20_12
], 16) |
3732 POW_SM(pPwrArray
[ALL_TARGET_HT20_7
], 8) |
3733 POW_SM(pPwrArray
[ALL_TARGET_HT20_6
], 0)
3736 /* 14 (LSB), 15, 20, 21 */
3737 REG_WRITE(ah
, 0xa3e4,
3738 POW_SM(pPwrArray
[ALL_TARGET_HT20_21
], 24) |
3739 POW_SM(pPwrArray
[ALL_TARGET_HT20_20
], 16) |
3740 POW_SM(pPwrArray
[ALL_TARGET_HT20_15
], 8) |
3741 POW_SM(pPwrArray
[ALL_TARGET_HT20_14
], 0)
3744 /* Mixed HT20 and HT40 rates */
3746 /* HT20 22 (LSB), HT20 23, HT40 22, HT40 23 (MSB) */
3747 REG_WRITE(ah
, 0xa3e8,
3748 POW_SM(pPwrArray
[ALL_TARGET_HT40_23
], 24) |
3749 POW_SM(pPwrArray
[ALL_TARGET_HT40_22
], 16) |
3750 POW_SM(pPwrArray
[ALL_TARGET_HT20_23
], 8) |
3751 POW_SM(pPwrArray
[ALL_TARGET_HT20_22
], 0)
3755 * Write the HT40 power per rate set
3756 * correct PAR difference between HT40 and HT20/LEGACY
3757 * 0/8/16 (LSB), 1-3/9-11/17-19, 4, 5 (MSB)
3759 REG_WRITE(ah
, 0xa3d8,
3760 POW_SM(pPwrArray
[ALL_TARGET_HT40_5
], 24) |
3761 POW_SM(pPwrArray
[ALL_TARGET_HT40_4
], 16) |
3762 POW_SM(pPwrArray
[ALL_TARGET_HT40_1_3_9_11_17_19
], 8) |
3763 POW_SM(pPwrArray
[ALL_TARGET_HT40_0_8_16
], 0)
3766 /* 6 (LSB), 7, 12, 13 (MSB) */
3767 REG_WRITE(ah
, 0xa3dc,
3768 POW_SM(pPwrArray
[ALL_TARGET_HT40_13
], 24) |
3769 POW_SM(pPwrArray
[ALL_TARGET_HT40_12
], 16) |
3770 POW_SM(pPwrArray
[ALL_TARGET_HT40_7
], 8) |
3771 POW_SM(pPwrArray
[ALL_TARGET_HT40_6
], 0)
3774 /* 14 (LSB), 15, 20, 21 */
3775 REG_WRITE(ah
, 0xa3ec,
3776 POW_SM(pPwrArray
[ALL_TARGET_HT40_21
], 24) |
3777 POW_SM(pPwrArray
[ALL_TARGET_HT40_20
], 16) |
3778 POW_SM(pPwrArray
[ALL_TARGET_HT40_15
], 8) |
3779 POW_SM(pPwrArray
[ALL_TARGET_HT40_14
], 0)
3786 static void ar9003_hw_set_target_power_eeprom(struct ath_hw
*ah
, u16 freq
,
3787 u8
*targetPowerValT2
)
3789 /* XXX: hard code for now, need to get from eeprom struct */
3790 u8 ht40PowerIncForPdadc
= 0;
3791 bool is2GHz
= false;
3793 struct ath_common
*common
= ath9k_hw_common(ah
);
3798 targetPowerValT2
[ALL_TARGET_LEGACY_6_24
] =
3799 ar9003_hw_eeprom_get_tgt_pwr(ah
, LEGACY_TARGET_RATE_6_24
, freq
,
3801 targetPowerValT2
[ALL_TARGET_LEGACY_36
] =
3802 ar9003_hw_eeprom_get_tgt_pwr(ah
, LEGACY_TARGET_RATE_36
, freq
,
3804 targetPowerValT2
[ALL_TARGET_LEGACY_48
] =
3805 ar9003_hw_eeprom_get_tgt_pwr(ah
, LEGACY_TARGET_RATE_48
, freq
,
3807 targetPowerValT2
[ALL_TARGET_LEGACY_54
] =
3808 ar9003_hw_eeprom_get_tgt_pwr(ah
, LEGACY_TARGET_RATE_54
, freq
,
3810 targetPowerValT2
[ALL_TARGET_LEGACY_1L_5L
] =
3811 ar9003_hw_eeprom_get_cck_tgt_pwr(ah
, LEGACY_TARGET_RATE_1L_5L
,
3813 targetPowerValT2
[ALL_TARGET_LEGACY_5S
] =
3814 ar9003_hw_eeprom_get_cck_tgt_pwr(ah
, LEGACY_TARGET_RATE_5S
, freq
);
3815 targetPowerValT2
[ALL_TARGET_LEGACY_11L
] =
3816 ar9003_hw_eeprom_get_cck_tgt_pwr(ah
, LEGACY_TARGET_RATE_11L
, freq
);
3817 targetPowerValT2
[ALL_TARGET_LEGACY_11S
] =
3818 ar9003_hw_eeprom_get_cck_tgt_pwr(ah
, LEGACY_TARGET_RATE_11S
, freq
);
3819 targetPowerValT2
[ALL_TARGET_HT20_0_8_16
] =
3820 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_0_8_16
, freq
,
3822 targetPowerValT2
[ALL_TARGET_HT20_1_3_9_11_17_19
] =
3823 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_1_3_9_11_17_19
,
3825 targetPowerValT2
[ALL_TARGET_HT20_4
] =
3826 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_4
, freq
,
3828 targetPowerValT2
[ALL_TARGET_HT20_5
] =
3829 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_5
, freq
,
3831 targetPowerValT2
[ALL_TARGET_HT20_6
] =
3832 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_6
, freq
,
3834 targetPowerValT2
[ALL_TARGET_HT20_7
] =
3835 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_7
, freq
,
3837 targetPowerValT2
[ALL_TARGET_HT20_12
] =
3838 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_12
, freq
,
3840 targetPowerValT2
[ALL_TARGET_HT20_13
] =
3841 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_13
, freq
,
3843 targetPowerValT2
[ALL_TARGET_HT20_14
] =
3844 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_14
, freq
,
3846 targetPowerValT2
[ALL_TARGET_HT20_15
] =
3847 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_15
, freq
,
3849 targetPowerValT2
[ALL_TARGET_HT20_20
] =
3850 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_20
, freq
,
3852 targetPowerValT2
[ALL_TARGET_HT20_21
] =
3853 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_21
, freq
,
3855 targetPowerValT2
[ALL_TARGET_HT20_22
] =
3856 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_22
, freq
,
3858 targetPowerValT2
[ALL_TARGET_HT20_23
] =
3859 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_23
, freq
,
3861 targetPowerValT2
[ALL_TARGET_HT40_0_8_16
] =
3862 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_0_8_16
, freq
,
3863 is2GHz
) + ht40PowerIncForPdadc
;
3864 targetPowerValT2
[ALL_TARGET_HT40_1_3_9_11_17_19
] =
3865 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_1_3_9_11_17_19
,
3867 is2GHz
) + ht40PowerIncForPdadc
;
3868 targetPowerValT2
[ALL_TARGET_HT40_4
] =
3869 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_4
, freq
,
3870 is2GHz
) + ht40PowerIncForPdadc
;
3871 targetPowerValT2
[ALL_TARGET_HT40_5
] =
3872 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_5
, freq
,
3873 is2GHz
) + ht40PowerIncForPdadc
;
3874 targetPowerValT2
[ALL_TARGET_HT40_6
] =
3875 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_6
, freq
,
3876 is2GHz
) + ht40PowerIncForPdadc
;
3877 targetPowerValT2
[ALL_TARGET_HT40_7
] =
3878 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_7
, freq
,
3879 is2GHz
) + ht40PowerIncForPdadc
;
3880 targetPowerValT2
[ALL_TARGET_HT40_12
] =
3881 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_12
, freq
,
3882 is2GHz
) + ht40PowerIncForPdadc
;
3883 targetPowerValT2
[ALL_TARGET_HT40_13
] =
3884 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_13
, freq
,
3885 is2GHz
) + ht40PowerIncForPdadc
;
3886 targetPowerValT2
[ALL_TARGET_HT40_14
] =
3887 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_14
, freq
,
3888 is2GHz
) + ht40PowerIncForPdadc
;
3889 targetPowerValT2
[ALL_TARGET_HT40_15
] =
3890 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_15
, freq
,
3891 is2GHz
) + ht40PowerIncForPdadc
;
3892 targetPowerValT2
[ALL_TARGET_HT40_20
] =
3893 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_20
, freq
,
3894 is2GHz
) + ht40PowerIncForPdadc
;
3895 targetPowerValT2
[ALL_TARGET_HT40_21
] =
3896 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_21
, freq
,
3897 is2GHz
) + ht40PowerIncForPdadc
;
3898 targetPowerValT2
[ALL_TARGET_HT40_22
] =
3899 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_22
, freq
,
3900 is2GHz
) + ht40PowerIncForPdadc
;
3901 targetPowerValT2
[ALL_TARGET_HT40_23
] =
3902 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_23
, freq
,
3903 is2GHz
) + ht40PowerIncForPdadc
;
3905 while (i
< ar9300RateSize
) {
3906 ath_print(common
, ATH_DBG_EEPROM
,
3907 "TPC[%02d] 0x%08x ", i
, targetPowerValT2
[i
]);
3910 ath_print(common
, ATH_DBG_EEPROM
,
3911 "TPC[%02d] 0x%08x ", i
, targetPowerValT2
[i
]);
3914 ath_print(common
, ATH_DBG_EEPROM
,
3915 "TPC[%02d] 0x%08x ", i
, targetPowerValT2
[i
]);
3918 ath_print(common
, ATH_DBG_EEPROM
,
3919 "TPC[%02d] 0x%08x\n", i
, targetPowerValT2
[i
]);
3924 static int ar9003_hw_cal_pier_get(struct ath_hw
*ah
,
3930 int *ptemperature
, int *pvoltage
)
3933 struct ar9300_cal_data_per_freq_op_loop
*pCalPierStruct
;
3935 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
3936 struct ath_common
*common
= ath9k_hw_common(ah
);
3938 if (ichain
>= AR9300_MAX_CHAINS
) {
3939 ath_print(common
, ATH_DBG_EEPROM
,
3940 "Invalid chain index, must be less than %d\n",
3945 if (mode
) { /* 5GHz */
3946 if (ipier
>= AR9300_NUM_5G_CAL_PIERS
) {
3947 ath_print(common
, ATH_DBG_EEPROM
,
3948 "Invalid 5GHz cal pier index, must "
3949 "be less than %d\n",
3950 AR9300_NUM_5G_CAL_PIERS
);
3953 pCalPier
= &(eep
->calFreqPier5G
[ipier
]);
3954 pCalPierStruct
= &(eep
->calPierData5G
[ichain
][ipier
]);
3957 if (ipier
>= AR9300_NUM_2G_CAL_PIERS
) {
3958 ath_print(common
, ATH_DBG_EEPROM
,
3959 "Invalid 2GHz cal pier index, must "
3960 "be less than %d\n", AR9300_NUM_2G_CAL_PIERS
);
3964 pCalPier
= &(eep
->calFreqPier2G
[ipier
]);
3965 pCalPierStruct
= &(eep
->calPierData2G
[ichain
][ipier
]);
3969 *pfrequency
= FBIN2FREQ(*pCalPier
, is2GHz
);
3970 *pcorrection
= pCalPierStruct
->refPower
;
3971 *ptemperature
= pCalPierStruct
->tempMeas
;
3972 *pvoltage
= pCalPierStruct
->voltMeas
;
3977 static int ar9003_hw_power_control_override(struct ath_hw
*ah
,
3980 int *voltage
, int *temperature
)
3983 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
3985 REG_RMW(ah
, AR_PHY_TPC_11_B0
,
3986 (correction
[0] << AR_PHY_TPC_OLPC_GAIN_DELTA_S
),
3987 AR_PHY_TPC_OLPC_GAIN_DELTA
);
3988 REG_RMW(ah
, AR_PHY_TPC_11_B1
,
3989 (correction
[1] << AR_PHY_TPC_OLPC_GAIN_DELTA_S
),
3990 AR_PHY_TPC_OLPC_GAIN_DELTA
);
3991 REG_RMW(ah
, AR_PHY_TPC_11_B2
,
3992 (correction
[2] << AR_PHY_TPC_OLPC_GAIN_DELTA_S
),
3993 AR_PHY_TPC_OLPC_GAIN_DELTA
);
3995 /* enable open loop power control on chip */
3996 REG_RMW(ah
, AR_PHY_TPC_6_B0
,
3997 (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S
),
3998 AR_PHY_TPC_6_ERROR_EST_MODE
);
3999 REG_RMW(ah
, AR_PHY_TPC_6_B1
,
4000 (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S
),
4001 AR_PHY_TPC_6_ERROR_EST_MODE
);
4002 REG_RMW(ah
, AR_PHY_TPC_6_B2
,
4003 (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S
),
4004 AR_PHY_TPC_6_ERROR_EST_MODE
);
4007 * enable temperature compensation
4008 * Need to use register names
4010 if (frequency
< 4000)
4011 tempSlope
= eep
->modalHeader2G
.tempSlope
;
4013 tempSlope
= eep
->modalHeader5G
.tempSlope
;
4015 REG_RMW_FIELD(ah
, AR_PHY_TPC_19
, AR_PHY_TPC_19_ALPHA_THERM
, tempSlope
);
4016 REG_RMW_FIELD(ah
, AR_PHY_TPC_18
, AR_PHY_TPC_18_THERM_CAL_VALUE
,
4022 /* Apply the recorded correction values. */
4023 static int ar9003_hw_calibration_apply(struct ath_hw
*ah
, int frequency
)
4025 int ichain
, ipier
, npier
;
4027 int lfrequency
[AR9300_MAX_CHAINS
],
4028 lcorrection
[AR9300_MAX_CHAINS
],
4029 ltemperature
[AR9300_MAX_CHAINS
], lvoltage
[AR9300_MAX_CHAINS
];
4030 int hfrequency
[AR9300_MAX_CHAINS
],
4031 hcorrection
[AR9300_MAX_CHAINS
],
4032 htemperature
[AR9300_MAX_CHAINS
], hvoltage
[AR9300_MAX_CHAINS
];
4034 int correction
[AR9300_MAX_CHAINS
],
4035 voltage
[AR9300_MAX_CHAINS
], temperature
[AR9300_MAX_CHAINS
];
4036 int pfrequency
, pcorrection
, ptemperature
, pvoltage
;
4037 struct ath_common
*common
= ath9k_hw_common(ah
);
4039 mode
= (frequency
>= 4000);
4041 npier
= AR9300_NUM_5G_CAL_PIERS
;
4043 npier
= AR9300_NUM_2G_CAL_PIERS
;
4045 for (ichain
= 0; ichain
< AR9300_MAX_CHAINS
; ichain
++) {
4046 lfrequency
[ichain
] = 0;
4047 hfrequency
[ichain
] = 100000;
4049 /* identify best lower and higher frequency calibration measurement */
4050 for (ichain
= 0; ichain
< AR9300_MAX_CHAINS
; ichain
++) {
4051 for (ipier
= 0; ipier
< npier
; ipier
++) {
4052 if (!ar9003_hw_cal_pier_get(ah
, mode
, ipier
, ichain
,
4053 &pfrequency
, &pcorrection
,
4054 &ptemperature
, &pvoltage
)) {
4055 fdiff
= frequency
- pfrequency
;
4058 * this measurement is higher than
4059 * our desired frequency
4062 if (hfrequency
[ichain
] <= 0 ||
4063 hfrequency
[ichain
] >= 100000 ||
4065 (frequency
- hfrequency
[ichain
])) {
4068 * frequency measurement
4070 hfrequency
[ichain
] = pfrequency
;
4071 hcorrection
[ichain
] =
4073 htemperature
[ichain
] =
4075 hvoltage
[ichain
] = pvoltage
;
4079 if (lfrequency
[ichain
] <= 0
4081 (frequency
- lfrequency
[ichain
])) {
4084 * frequency measurement
4086 lfrequency
[ichain
] = pfrequency
;
4087 lcorrection
[ichain
] =
4089 ltemperature
[ichain
] =
4091 lvoltage
[ichain
] = pvoltage
;
4099 for (ichain
= 0; ichain
< AR9300_MAX_CHAINS
; ichain
++) {
4100 ath_print(common
, ATH_DBG_EEPROM
,
4101 "ch=%d f=%d low=%d %d h=%d %d\n",
4102 ichain
, frequency
, lfrequency
[ichain
],
4103 lcorrection
[ichain
], hfrequency
[ichain
],
4104 hcorrection
[ichain
]);
4105 /* they're the same, so just pick one */
4106 if (hfrequency
[ichain
] == lfrequency
[ichain
]) {
4107 correction
[ichain
] = lcorrection
[ichain
];
4108 voltage
[ichain
] = lvoltage
[ichain
];
4109 temperature
[ichain
] = ltemperature
[ichain
];
4111 /* the low frequency is good */
4112 else if (frequency
- lfrequency
[ichain
] < 1000) {
4113 /* so is the high frequency, interpolate */
4114 if (hfrequency
[ichain
] - frequency
< 1000) {
4116 correction
[ichain
] = lcorrection
[ichain
] +
4117 (((frequency
- lfrequency
[ichain
]) *
4118 (hcorrection
[ichain
] -
4119 lcorrection
[ichain
])) /
4120 (hfrequency
[ichain
] - lfrequency
[ichain
]));
4122 temperature
[ichain
] = ltemperature
[ichain
] +
4123 (((frequency
- lfrequency
[ichain
]) *
4124 (htemperature
[ichain
] -
4125 ltemperature
[ichain
])) /
4126 (hfrequency
[ichain
] - lfrequency
[ichain
]));
4131 lfrequency
[ichain
]) * (hvoltage
[ichain
] -
4133 / (hfrequency
[ichain
] -
4134 lfrequency
[ichain
]));
4136 /* only low is good, use it */
4138 correction
[ichain
] = lcorrection
[ichain
];
4139 temperature
[ichain
] = ltemperature
[ichain
];
4140 voltage
[ichain
] = lvoltage
[ichain
];
4143 /* only high is good, use it */
4144 else if (hfrequency
[ichain
] - frequency
< 1000) {
4145 correction
[ichain
] = hcorrection
[ichain
];
4146 temperature
[ichain
] = htemperature
[ichain
];
4147 voltage
[ichain
] = hvoltage
[ichain
];
4148 } else { /* nothing is good, presume 0???? */
4149 correction
[ichain
] = 0;
4150 temperature
[ichain
] = 0;
4151 voltage
[ichain
] = 0;
4155 ar9003_hw_power_control_override(ah
, frequency
, correction
, voltage
,
4158 ath_print(common
, ATH_DBG_EEPROM
,
4159 "for frequency=%d, calibration correction = %d %d %d\n",
4160 frequency
, correction
[0], correction
[1], correction
[2]);
4165 static u16
ar9003_hw_get_direct_edge_power(struct ar9300_eeprom
*eep
,
4170 struct cal_ctl_data_2g
*ctl_2g
= eep
->ctlPowerData_2G
;
4171 struct cal_ctl_data_5g
*ctl_5g
= eep
->ctlPowerData_5G
;
4174 return ctl_2g
[idx
].ctlEdges
[edge
].tPower
;
4176 return ctl_5g
[idx
].ctlEdges
[edge
].tPower
;
4179 static u16
ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom
*eep
,
4185 struct cal_ctl_data_2g
*ctl_2g
= eep
->ctlPowerData_2G
;
4186 struct cal_ctl_data_5g
*ctl_5g
= eep
->ctlPowerData_5G
;
4188 u8
*ctl_freqbin
= is2GHz
?
4189 &eep
->ctl_freqbin_2G
[idx
][0] :
4190 &eep
->ctl_freqbin_5G
[idx
][0];
4193 if (ath9k_hw_fbin2freq(ctl_freqbin
[edge
- 1], 1) < freq
&&
4194 ctl_2g
[idx
].ctlEdges
[edge
- 1].flag
)
4195 return ctl_2g
[idx
].ctlEdges
[edge
- 1].tPower
;
4197 if (ath9k_hw_fbin2freq(ctl_freqbin
[edge
- 1], 0) < freq
&&
4198 ctl_5g
[idx
].ctlEdges
[edge
- 1].flag
)
4199 return ctl_5g
[idx
].ctlEdges
[edge
- 1].tPower
;
4202 return AR9300_MAX_RATE_POWER
;
4206 * Find the maximum conformance test limit for the given channel and CTL info
4208 static u16
ar9003_hw_get_max_edge_power(struct ar9300_eeprom
*eep
,
4209 u16 freq
, int idx
, bool is2GHz
)
4211 u16 twiceMaxEdgePower
= AR9300_MAX_RATE_POWER
;
4212 u8
*ctl_freqbin
= is2GHz
?
4213 &eep
->ctl_freqbin_2G
[idx
][0] :
4214 &eep
->ctl_freqbin_5G
[idx
][0];
4215 u16 num_edges
= is2GHz
?
4216 AR9300_NUM_BAND_EDGES_2G
: AR9300_NUM_BAND_EDGES_5G
;
4219 /* Get the edge power */
4221 (edge
< num_edges
) && (ctl_freqbin
[edge
] != AR9300_BCHAN_UNUSED
);
4224 * If there's an exact channel match or an inband flag set
4225 * on the lower channel use the given rdEdgePower
4227 if (freq
== ath9k_hw_fbin2freq(ctl_freqbin
[edge
], is2GHz
)) {
4229 ar9003_hw_get_direct_edge_power(eep
, idx
,
4232 } else if ((edge
> 0) &&
4233 (freq
< ath9k_hw_fbin2freq(ctl_freqbin
[edge
],
4236 ar9003_hw_get_indirect_edge_power(eep
, idx
,
4240 * Leave loop - no more affecting edges possible in
4241 * this monotonic increasing list
4246 return twiceMaxEdgePower
;
4249 static void ar9003_hw_set_power_per_rate_table(struct ath_hw
*ah
,
4250 struct ath9k_channel
*chan
,
4251 u8
*pPwrArray
, u16 cfgCtl
,
4252 u8 twiceAntennaReduction
,
4253 u8 twiceMaxRegulatoryPower
,
4256 struct ath_regulatory
*regulatory
= ath9k_hw_regulatory(ah
);
4257 struct ath_common
*common
= ath9k_hw_common(ah
);
4258 struct ar9300_eeprom
*pEepData
= &ah
->eeprom
.ar9300_eep
;
4259 u16 twiceMaxEdgePower
= AR9300_MAX_RATE_POWER
;
4260 static const u16 tpScaleReductionTable
[5] = {
4261 0, 3, 6, 9, AR9300_MAX_RATE_POWER
4264 int16_t twiceLargestAntenna
;
4265 u16 scaledPower
= 0, minCtlPower
, maxRegAllowedPower
;
4266 u16 ctlModesFor11a
[] = {
4267 CTL_11A
, CTL_5GHT20
, CTL_11A_EXT
, CTL_5GHT40
4269 u16 ctlModesFor11g
[] = {
4270 CTL_11B
, CTL_11G
, CTL_2GHT20
, CTL_11B_EXT
,
4271 CTL_11G_EXT
, CTL_2GHT40
4273 u16 numCtlModes
, *pCtlMode
, ctlMode
, freq
;
4274 struct chan_centers centers
;
4277 u16 twiceMinEdgePower
;
4278 bool is2ghz
= IS_CHAN_2GHZ(chan
);
4280 ath9k_hw_get_channel_centers(ah
, chan
, ¢ers
);
4282 /* Compute TxPower reduction due to Antenna Gain */
4284 twiceLargestAntenna
= pEepData
->modalHeader2G
.antennaGain
;
4286 twiceLargestAntenna
= pEepData
->modalHeader5G
.antennaGain
;
4288 twiceLargestAntenna
= (int16_t)min((twiceAntennaReduction
) -
4289 twiceLargestAntenna
, 0);
4292 * scaledPower is the minimum of the user input power level
4293 * and the regulatory allowed power level
4295 maxRegAllowedPower
= twiceMaxRegulatoryPower
+ twiceLargestAntenna
;
4297 if (regulatory
->tp_scale
!= ATH9K_TP_SCALE_MAX
) {
4298 maxRegAllowedPower
-=
4299 (tpScaleReductionTable
[(regulatory
->tp_scale
)] * 2);
4302 scaledPower
= min(powerLimit
, maxRegAllowedPower
);
4305 * Reduce scaled Power by number of chains active to get
4306 * to per chain tx power level
4308 switch (ar5416_get_ntxchains(ah
->txchainmask
)) {
4312 scaledPower
-= REDUCE_SCALED_POWER_BY_TWO_CHAIN
;
4315 scaledPower
-= REDUCE_SCALED_POWER_BY_THREE_CHAIN
;
4319 scaledPower
= max((u16
)0, scaledPower
);
4322 * Get target powers from EEPROM - our baseline for TX Power
4325 /* Setup for CTL modes */
4326 /* CTL_11B, CTL_11G, CTL_2GHT20 */
4328 ARRAY_SIZE(ctlModesFor11g
) -
4329 SUB_NUM_CTL_MODES_AT_2G_40
;
4330 pCtlMode
= ctlModesFor11g
;
4331 if (IS_CHAN_HT40(chan
))
4333 numCtlModes
= ARRAY_SIZE(ctlModesFor11g
);
4335 /* Setup for CTL modes */
4336 /* CTL_11A, CTL_5GHT20 */
4337 numCtlModes
= ARRAY_SIZE(ctlModesFor11a
) -
4338 SUB_NUM_CTL_MODES_AT_5G_40
;
4339 pCtlMode
= ctlModesFor11a
;
4340 if (IS_CHAN_HT40(chan
))
4342 numCtlModes
= ARRAY_SIZE(ctlModesFor11a
);
4346 * For MIMO, need to apply regulatory caps individually across
4347 * dynamically running modes: CCK, OFDM, HT20, HT40
4349 * The outer loop walks through each possible applicable runtime mode.
4350 * The inner loop walks through each ctlIndex entry in EEPROM.
4351 * The ctl value is encoded as [7:4] == test group, [3:0] == test mode.
4353 for (ctlMode
= 0; ctlMode
< numCtlModes
; ctlMode
++) {
4354 bool isHt40CtlMode
= (pCtlMode
[ctlMode
] == CTL_5GHT40
) ||
4355 (pCtlMode
[ctlMode
] == CTL_2GHT40
);
4357 freq
= centers
.synth_center
;
4358 else if (pCtlMode
[ctlMode
] & EXT_ADDITIVE
)
4359 freq
= centers
.ext_center
;
4361 freq
= centers
.ctl_center
;
4363 ath_print(common
, ATH_DBG_REGULATORY
,
4364 "LOOP-Mode ctlMode %d < %d, isHt40CtlMode %d, "
4365 "EXT_ADDITIVE %d\n",
4366 ctlMode
, numCtlModes
, isHt40CtlMode
,
4367 (pCtlMode
[ctlMode
] & EXT_ADDITIVE
));
4369 /* walk through each CTL index stored in EEPROM */
4371 ctlIndex
= pEepData
->ctlIndex_2G
;
4372 ctlNum
= AR9300_NUM_CTLS_2G
;
4374 ctlIndex
= pEepData
->ctlIndex_5G
;
4375 ctlNum
= AR9300_NUM_CTLS_5G
;
4378 for (i
= 0; (i
< ctlNum
) && ctlIndex
[i
]; i
++) {
4379 ath_print(common
, ATH_DBG_REGULATORY
,
4380 "LOOP-Ctlidx %d: cfgCtl 0x%2.2x "
4381 "pCtlMode 0x%2.2x ctlIndex 0x%2.2x "
4383 i
, cfgCtl
, pCtlMode
[ctlMode
], ctlIndex
[i
],
4387 * compare test group from regulatory
4388 * channel list with test mode from pCtlMode
4391 if ((((cfgCtl
& ~CTL_MODE_M
) |
4392 (pCtlMode
[ctlMode
] & CTL_MODE_M
)) ==
4394 (((cfgCtl
& ~CTL_MODE_M
) |
4395 (pCtlMode
[ctlMode
] & CTL_MODE_M
)) ==
4396 ((ctlIndex
[i
] & CTL_MODE_M
) |
4399 ar9003_hw_get_max_edge_power(pEepData
,
4403 if ((cfgCtl
& ~CTL_MODE_M
) == SD_NO_CTL
)
4405 * Find the minimum of all CTL
4406 * edge powers that apply to
4410 min(twiceMaxEdgePower
,
4421 minCtlPower
= (u8
)min(twiceMaxEdgePower
, scaledPower
);
4423 ath_print(common
, ATH_DBG_REGULATORY
,
4424 "SEL-Min ctlMode %d pCtlMode %d 2xMaxEdge %d "
4425 "sP %d minCtlPwr %d\n",
4426 ctlMode
, pCtlMode
[ctlMode
], twiceMaxEdgePower
,
4427 scaledPower
, minCtlPower
);
4429 /* Apply ctl mode to correct target power set */
4430 switch (pCtlMode
[ctlMode
]) {
4432 for (i
= ALL_TARGET_LEGACY_1L_5L
;
4433 i
<= ALL_TARGET_LEGACY_11S
; i
++)
4435 (u8
)min((u16
)pPwrArray
[i
],
4440 for (i
= ALL_TARGET_LEGACY_6_24
;
4441 i
<= ALL_TARGET_LEGACY_54
; i
++)
4443 (u8
)min((u16
)pPwrArray
[i
],
4448 for (i
= ALL_TARGET_HT20_0_8_16
;
4449 i
<= ALL_TARGET_HT20_21
; i
++)
4451 (u8
)min((u16
)pPwrArray
[i
],
4453 pPwrArray
[ALL_TARGET_HT20_22
] =
4454 (u8
)min((u16
)pPwrArray
[ALL_TARGET_HT20_22
],
4456 pPwrArray
[ALL_TARGET_HT20_23
] =
4457 (u8
)min((u16
)pPwrArray
[ALL_TARGET_HT20_23
],
4462 for (i
= ALL_TARGET_HT40_0_8_16
;
4463 i
<= ALL_TARGET_HT40_23
; i
++)
4465 (u8
)min((u16
)pPwrArray
[i
],
4471 } /* end ctl mode checking */
4474 static void ath9k_hw_ar9300_set_txpower(struct ath_hw
*ah
,
4475 struct ath9k_channel
*chan
, u16 cfgCtl
,
4476 u8 twiceAntennaReduction
,
4477 u8 twiceMaxRegulatoryPower
,
4478 u8 powerLimit
, bool test
)
4480 struct ath_regulatory
*regulatory
= ath9k_hw_regulatory(ah
);
4481 struct ath_common
*common
= ath9k_hw_common(ah
);
4482 u8 targetPowerValT2
[ar9300RateSize
];
4485 ar9003_hw_set_target_power_eeprom(ah
, chan
->channel
, targetPowerValT2
);
4486 ar9003_hw_set_power_per_rate_table(ah
, chan
,
4487 targetPowerValT2
, cfgCtl
,
4488 twiceAntennaReduction
,
4489 twiceMaxRegulatoryPower
,
4492 regulatory
->max_power_level
= 0;
4493 for (i
= 0; i
< ar9300RateSize
; i
++) {
4494 if (targetPowerValT2
[i
] > regulatory
->max_power_level
)
4495 regulatory
->max_power_level
= targetPowerValT2
[i
];
4501 for (i
= 0; i
< ar9300RateSize
; i
++) {
4502 ath_print(common
, ATH_DBG_EEPROM
,
4503 "TPC[%02d] 0x%08x ", i
, targetPowerValT2
[i
]);
4505 ath_print(common
, ATH_DBG_EEPROM
,
4506 "TPC[%02d] 0x%08x ", i
, targetPowerValT2
[i
]);
4508 ath_print(common
, ATH_DBG_EEPROM
,
4509 "TPC[%02d] 0x%08x ", i
, targetPowerValT2
[i
]);
4511 ath_print(common
, ATH_DBG_EEPROM
,
4512 "TPC[%02d] 0x%08x\n\n", i
, targetPowerValT2
[i
]);
4517 * This is the TX power we send back to driver core,
4518 * and it can use to pass to userspace to display our
4519 * currently configured TX power setting.
4521 * Since power is rate dependent, use one of the indices
4522 * from the AR9300_Rates enum to select an entry from
4523 * targetPowerValT2[] to report. Currently returns the
4524 * power for HT40 MCS 0, HT20 MCS 0, or OFDM 6 Mbps
4525 * as CCK power is less interesting (?).
4527 i
= ALL_TARGET_LEGACY_6_24
; /* legacy */
4528 if (IS_CHAN_HT40(chan
))
4529 i
= ALL_TARGET_HT40_0_8_16
; /* ht40 */
4530 else if (IS_CHAN_HT20(chan
))
4531 i
= ALL_TARGET_HT20_0_8_16
; /* ht20 */
4533 ah
->txpower_limit
= targetPowerValT2
[i
];
4534 regulatory
->max_power_level
= targetPowerValT2
[i
];
4536 /* Write target power array to registers */
4537 ar9003_hw_tx_power_regwrite(ah
, targetPowerValT2
);
4538 ar9003_hw_calibration_apply(ah
, chan
->channel
);
4541 static u16
ath9k_hw_ar9300_get_spur_channel(struct ath_hw
*ah
,
4547 s32
ar9003_hw_get_tx_gain_idx(struct ath_hw
*ah
)
4549 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
4551 return (eep
->baseEepHeader
.txrxgain
>> 4) & 0xf; /* bits 7:4 */
4554 s32
ar9003_hw_get_rx_gain_idx(struct ath_hw
*ah
)
4556 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
4558 return (eep
->baseEepHeader
.txrxgain
) & 0xf; /* bits 3:0 */
4561 const struct eeprom_ops eep_ar9300_ops
= {
4562 .check_eeprom
= ath9k_hw_ar9300_check_eeprom
,
4563 .get_eeprom
= ath9k_hw_ar9300_get_eeprom
,
4564 .fill_eeprom
= ath9k_hw_ar9300_fill_eeprom
,
4565 .get_eeprom_ver
= ath9k_hw_ar9300_get_eeprom_ver
,
4566 .get_eeprom_rev
= ath9k_hw_ar9300_get_eeprom_rev
,
4567 .get_num_ant_config
= ath9k_hw_ar9300_get_num_ant_config
,
4568 .get_eeprom_antenna_cfg
= ath9k_hw_ar9300_get_eeprom_antenna_cfg
,
4569 .set_board_values
= ath9k_hw_ar9300_set_board_values
,
4570 .set_addac
= ath9k_hw_ar9300_set_addac
,
4571 .set_txpower
= ath9k_hw_ar9300_set_txpower
,
4572 .get_spur_channel
= ath9k_hw_ar9300_get_spur_channel