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 (0x300)
26 #define AR_CH0_TOP_XPABIASLVL_S (8)
28 #define AR_CH0_THERM (0x00016290)
29 #define AR_CH0_THERM_XPABIASLVL_MSB 0x3
30 #define AR_CH0_THERM_XPABIASLVL_MSB_S 0
31 #define AR_CH0_THERM_XPASHORT2GND 0x4
32 #define AR_CH0_THERM_XPASHORT2GND_S 2
34 #define AR_SWITCH_TABLE_COM_ALL (0xffff)
35 #define AR_SWITCH_TABLE_COM_ALL_S (0)
37 #define AR_SWITCH_TABLE_COM2_ALL (0xffffff)
38 #define AR_SWITCH_TABLE_COM2_ALL_S (0)
40 #define AR_SWITCH_TABLE_ALL (0xfff)
41 #define AR_SWITCH_TABLE_ALL_S (0)
43 #define LE16(x) __constant_cpu_to_le16(x)
44 #define LE32(x) __constant_cpu_to_le32(x)
46 /* Local defines to distinguish between extension and control CTL's */
47 #define EXT_ADDITIVE (0x8000)
48 #define CTL_11A_EXT (CTL_11A | EXT_ADDITIVE)
49 #define CTL_11G_EXT (CTL_11G | EXT_ADDITIVE)
50 #define CTL_11B_EXT (CTL_11B | EXT_ADDITIVE)
51 #define REDUCE_SCALED_POWER_BY_TWO_CHAIN 6 /* 10*log10(2)*2 */
52 #define REDUCE_SCALED_POWER_BY_THREE_CHAIN 9 /* 10*log10(3)*2 */
53 #define PWRINCR_3_TO_1_CHAIN 9 /* 10*log(3)*2 */
54 #define PWRINCR_3_TO_2_CHAIN 3 /* floor(10*log(3/2)*2) */
55 #define PWRINCR_2_TO_1_CHAIN 6 /* 10*log(2)*2 */
57 #define SUB_NUM_CTL_MODES_AT_5G_40 2 /* excluding HT40, EXT-OFDM */
58 #define SUB_NUM_CTL_MODES_AT_2G_40 3 /* excluding HT40, EXT-OFDM, EXT-CCK */
60 static const struct ar9300_eeprom ar9300_default
= {
63 .macAddr
= {1, 2, 3, 4, 5, 6},
64 .custData
= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
65 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
67 .regDmn
= { LE16(0), LE16(0x1f) },
68 .txrxMask
= 0x77, /* 4 bits tx and 4 bits rx */
70 .opFlags
= AR9300_OPFLAGS_11G
| AR9300_OPFLAGS_11A
,
74 .blueToothOptions
= 0,
76 .deviceType
= 5, /* takes lower byte in eeprom location */
77 .pwrTableOffset
= AR9300_PWR_TABLE_OFFSET
,
78 .params_for_tuning_caps
= {0, 0},
79 .featureEnable
= 0x0c,
81 * bit0 - enable tx temp comp - disabled
82 * bit1 - enable tx volt comp - disabled
83 * bit2 - enable fastClock - enabled
84 * bit3 - enable doubling - enabled
85 * bit4 - enable internal regulator - disabled
86 * bit5 - enable pa predistortion - disabled
88 .miscConfiguration
= 0, /* bit0 - turn down drivestrength */
89 .eepromWriteEnableGpio
= 3,
92 .rxBandSelectGpio
= 0xff,
97 /* ar9300_modal_eep_header 2g */
98 /* 4 idle,t1,t2,b(4 bits per setting) */
99 .antCtrlCommon
= LE32(0x110),
100 /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
101 .antCtrlCommon2
= LE32(0x22222),
104 * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
105 * rx1, rx12, b (2 bits each)
107 .antCtrlChain
= { LE16(0x150), LE16(0x150), LE16(0x150) },
110 * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
111 * for ar9280 (0xa20c/b20c 5:0)
113 .xatten1DB
= {0, 0, 0},
116 * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
117 * for ar9280 (0xa20c/b20c 16:12
119 .xatten1Margin
= {0, 0, 0},
124 * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur
125 * channels in usual fbin coding format
127 .spurChans
= {0, 0, 0, 0, 0},
130 * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check
131 * if the register is per chain
133 .noiseFloorThreshCh
= {-1, 0, 0},
134 .ob
= {1, 1, 1},/* 3 chain */
135 .db_stage2
= {1, 1, 1}, /* 3 chain */
136 .db_stage3
= {0, 0, 0},
137 .db_stage4
= {0, 0, 0},
139 .txFrameToDataStart
= 0x0e,
140 .txFrameToPaOn
= 0x0e,
141 .txClip
= 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
143 .switchSettling
= 0x2c,
144 .adcDesiredSize
= -30,
147 .txFrameToXpaOn
= 0xe,
149 .papdRateMaskHt20
= LE32(0x0cf0e0e0),
150 .papdRateMaskHt40
= LE32(0x6cf0e0e0),
152 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
156 .ant_div_control
= 0,
157 .future
= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
164 /* ar9300_cal_data_per_freq_op_loop 2g */
166 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
167 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
168 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
170 .calTarget_freqbin_Cck
= {
174 .calTarget_freqbin_2G
= {
179 .calTarget_freqbin_2GHT20
= {
184 .calTarget_freqbin_2GHT40
= {
189 .calTargetPowerCck
= {
190 /* 1L-5L,5S,11L,11S */
191 { {36, 36, 36, 36} },
192 { {36, 36, 36, 36} },
194 .calTargetPower2G
= {
196 { {32, 32, 28, 24} },
197 { {32, 32, 28, 24} },
198 { {32, 32, 28, 24} },
200 .calTargetPower2GHT20
= {
201 { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
202 { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
203 { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
205 .calTargetPower2GHT40
= {
206 { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
207 { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
208 { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
211 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
212 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
242 /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
243 /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
244 /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
245 /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1),
249 /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
250 /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
251 /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
256 /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
257 /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
263 /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
264 /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
265 /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
266 /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
270 /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
271 /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
272 /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
276 /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
277 /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
278 /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
283 /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
284 /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
285 /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
290 /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
291 /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
292 /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
293 /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
297 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
298 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
299 { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } },
301 { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } },
302 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
303 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
305 { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } },
306 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
307 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
309 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
310 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
311 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
314 /* 4 idle,t1,t2,b (4 bits per setting) */
315 .antCtrlCommon
= LE32(0x110),
316 /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
317 .antCtrlCommon2
= LE32(0x22222),
318 /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
320 LE16(0x000), LE16(0x000), LE16(0x000),
322 /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
323 .xatten1DB
= {0, 0, 0},
326 * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
327 * for merlin (0xa20c/b20c 16:12
329 .xatten1Margin
= {0, 0, 0},
332 /* spurChans spur channels in usual fbin coding format */
333 .spurChans
= {0, 0, 0, 0, 0},
334 /* noiseFloorThreshCh Check if the register is per chain */
335 .noiseFloorThreshCh
= {-1, 0, 0},
336 .ob
= {3, 3, 3}, /* 3 chain */
337 .db_stage2
= {3, 3, 3}, /* 3 chain */
338 .db_stage3
= {3, 3, 3}, /* doesn't exist for 2G */
339 .db_stage4
= {3, 3, 3}, /* don't exist for 2G */
341 .txFrameToDataStart
= 0x0e,
342 .txFrameToPaOn
= 0x0e,
343 .txClip
= 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
345 .switchSettling
= 0x2d,
346 .adcDesiredSize
= -30,
349 .txFrameToXpaOn
= 0xe,
351 .papdRateMaskHt20
= LE32(0x0c80c080),
352 .papdRateMaskHt40
= LE32(0x0080c080),
354 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
360 .xatten1DBLow
= {0, 0, 0},
361 .xatten1MarginLow
= {0, 0, 0},
362 .xatten1DBHigh
= {0, 0, 0},
363 .xatten1MarginHigh
= {0, 0, 0}
408 .calTarget_freqbin_5G
= {
418 .calTarget_freqbin_5GHT20
= {
428 .calTarget_freqbin_5GHT40
= {
438 .calTargetPower5G
= {
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} },
446 { {20, 20, 20, 10} },
447 { {20, 20, 20, 10} },
449 .calTargetPower5GHT20
= {
451 * 0_8_16,1-3_9-11_17-19,
452 * 4,5,6,7,12,13,14,15,20,21,22,23
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} },
460 { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
461 { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
463 .calTargetPower5GHT40
= {
465 * 0_8_16,1-3_9-11_17-19,
466 * 4,5,6,7,12,13,14,15,20,21,22,23
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} },
474 { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
475 { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
478 0x10, 0x16, 0x18, 0x40, 0x46,
479 0x48, 0x30, 0x36, 0x38
483 /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
484 /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
485 /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
486 /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
487 /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0),
488 /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
489 /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
490 /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
493 /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
494 /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
495 /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
496 /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
497 /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0),
498 /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
499 /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
500 /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
504 /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
505 /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
506 /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
507 /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0),
508 /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0),
509 /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0),
510 /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0),
511 /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0)
515 /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
516 /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
517 /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0),
518 /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0),
519 /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
520 /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
521 /* Data[3].ctlEdges[6].bChannel */ 0xFF,
522 /* Data[3].ctlEdges[7].bChannel */ 0xFF,
526 /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
527 /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
528 /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0),
529 /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0),
530 /* Data[4].ctlEdges[4].bChannel */ 0xFF,
531 /* Data[4].ctlEdges[5].bChannel */ 0xFF,
532 /* Data[4].ctlEdges[6].bChannel */ 0xFF,
533 /* Data[4].ctlEdges[7].bChannel */ 0xFF,
537 /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
538 /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0),
539 /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0),
540 /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
541 /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0),
542 /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
543 /* Data[5].ctlEdges[6].bChannel */ 0xFF,
544 /* Data[5].ctlEdges[7].bChannel */ 0xFF
548 /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
549 /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
550 /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0),
551 /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0),
552 /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
553 /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0),
554 /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0),
555 /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0)
559 /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
560 /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
561 /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0),
562 /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
563 /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0),
564 /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
565 /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
566 /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
570 /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
571 /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
572 /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
573 /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
574 /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0),
575 /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
576 /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0),
577 /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0)
583 {60, 1}, {60, 1}, {60, 1}, {60, 1},
584 {60, 1}, {60, 1}, {60, 1}, {60, 0},
589 {60, 1}, {60, 1}, {60, 1}, {60, 1},
590 {60, 1}, {60, 1}, {60, 1}, {60, 0},
595 {60, 0}, {60, 1}, {60, 0}, {60, 1},
596 {60, 1}, {60, 1}, {60, 1}, {60, 1},
601 {60, 0}, {60, 1}, {60, 1}, {60, 0},
602 {60, 1}, {60, 0}, {60, 0}, {60, 0},
607 {60, 1}, {60, 1}, {60, 1}, {60, 0},
608 {60, 0}, {60, 0}, {60, 0}, {60, 0},
613 {60, 1}, {60, 1}, {60, 1}, {60, 1},
614 {60, 1}, {60, 0}, {60, 0}, {60, 0},
619 {60, 1}, {60, 1}, {60, 1}, {60, 1},
620 {60, 1}, {60, 1}, {60, 1}, {60, 1},
625 {60, 1}, {60, 1}, {60, 0}, {60, 1},
626 {60, 1}, {60, 1}, {60, 1}, {60, 0},
631 {60, 1}, {60, 0}, {60, 1}, {60, 1},
632 {60, 1}, {60, 1}, {60, 0}, {60, 1},
638 static const struct ar9300_eeprom ar9300_x113
= {
640 .templateVersion
= 6,
641 .macAddr
= {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0},
642 .custData
= {"x113-023-f0000"},
644 .regDmn
= { LE16(0), LE16(0x1f) },
645 .txrxMask
= 0x77, /* 4 bits tx and 4 bits rx */
647 .opFlags
= AR9300_OPFLAGS_11G
| AR9300_OPFLAGS_11A
,
651 .blueToothOptions
= 0,
653 .deviceType
= 5, /* takes lower byte in eeprom location */
654 .pwrTableOffset
= AR9300_PWR_TABLE_OFFSET
,
655 .params_for_tuning_caps
= {0, 0},
656 .featureEnable
= 0x0d,
658 * bit0 - enable tx temp comp - disabled
659 * bit1 - enable tx volt comp - disabled
660 * bit2 - enable fastClock - enabled
661 * bit3 - enable doubling - enabled
662 * bit4 - enable internal regulator - disabled
663 * bit5 - enable pa predistortion - disabled
665 .miscConfiguration
= 0, /* bit0 - turn down drivestrength */
666 .eepromWriteEnableGpio
= 6,
667 .wlanDisableGpio
= 0,
669 .rxBandSelectGpio
= 0xff,
674 /* ar9300_modal_eep_header 2g */
675 /* 4 idle,t1,t2,b(4 bits per setting) */
676 .antCtrlCommon
= LE32(0x110),
677 /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
678 .antCtrlCommon2
= LE32(0x44444),
681 * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
682 * rx1, rx12, b (2 bits each)
684 .antCtrlChain
= { LE16(0x150), LE16(0x150), LE16(0x150) },
687 * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
688 * for ar9280 (0xa20c/b20c 5:0)
690 .xatten1DB
= {0, 0, 0},
693 * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
694 * for ar9280 (0xa20c/b20c 16:12
696 .xatten1Margin
= {0, 0, 0},
701 * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur
702 * channels in usual fbin coding format
704 .spurChans
= {FREQ2FBIN(2464, 1), 0, 0, 0, 0},
707 * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check
708 * if the register is per chain
710 .noiseFloorThreshCh
= {-1, 0, 0},
711 .ob
= {1, 1, 1},/* 3 chain */
712 .db_stage2
= {1, 1, 1}, /* 3 chain */
713 .db_stage3
= {0, 0, 0},
714 .db_stage4
= {0, 0, 0},
716 .txFrameToDataStart
= 0x0e,
717 .txFrameToPaOn
= 0x0e,
718 .txClip
= 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
720 .switchSettling
= 0x2c,
721 .adcDesiredSize
= -30,
724 .txFrameToXpaOn
= 0xe,
726 .papdRateMaskHt20
= LE32(0x0c80c080),
727 .papdRateMaskHt40
= LE32(0x0080c080),
729 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
733 .ant_div_control
= 0,
734 .future
= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
741 /* ar9300_cal_data_per_freq_op_loop 2g */
743 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
744 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
745 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
747 .calTarget_freqbin_Cck
= {
751 .calTarget_freqbin_2G
= {
756 .calTarget_freqbin_2GHT20
= {
761 .calTarget_freqbin_2GHT40
= {
766 .calTargetPowerCck
= {
767 /* 1L-5L,5S,11L,11S */
768 { {34, 34, 34, 34} },
769 { {34, 34, 34, 34} },
771 .calTargetPower2G
= {
773 { {34, 34, 32, 32} },
774 { {34, 34, 32, 32} },
775 { {34, 34, 32, 32} },
777 .calTargetPower2GHT20
= {
778 { {32, 32, 32, 32, 32, 28, 32, 32, 30, 28, 0, 0, 0, 0} },
779 { {32, 32, 32, 32, 32, 28, 32, 32, 30, 28, 0, 0, 0, 0} },
780 { {32, 32, 32, 32, 32, 28, 32, 32, 30, 28, 0, 0, 0, 0} },
782 .calTargetPower2GHT40
= {
783 { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
784 { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
785 { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
788 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
789 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
819 /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
820 /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
821 /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
822 /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1),
826 /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
827 /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
828 /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
833 /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
834 /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
840 /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
841 /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
842 /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
843 /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
847 /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
848 /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
849 /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
853 /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
854 /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
855 /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
860 /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
861 /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
862 /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
867 /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
868 /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
869 /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
870 /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
874 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
875 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
876 { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } },
878 { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } },
879 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
880 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
882 { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } },
883 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
884 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
886 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
887 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
888 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
891 /* 4 idle,t1,t2,b (4 bits per setting) */
892 .antCtrlCommon
= LE32(0x220),
893 /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
894 .antCtrlCommon2
= LE32(0x11111),
895 /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
897 LE16(0x150), LE16(0x150), LE16(0x150),
899 /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
900 .xatten1DB
= {0, 0, 0},
903 * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
904 * for merlin (0xa20c/b20c 16:12
906 .xatten1Margin
= {0, 0, 0},
909 /* spurChans spur channels in usual fbin coding format */
910 .spurChans
= {FREQ2FBIN(5500, 0), 0, 0, 0, 0},
911 /* noiseFloorThreshCh Check if the register is per chain */
912 .noiseFloorThreshCh
= {-1, 0, 0},
913 .ob
= {3, 3, 3}, /* 3 chain */
914 .db_stage2
= {3, 3, 3}, /* 3 chain */
915 .db_stage3
= {3, 3, 3}, /* doesn't exist for 2G */
916 .db_stage4
= {3, 3, 3}, /* don't exist for 2G */
918 .txFrameToDataStart
= 0x0e,
919 .txFrameToPaOn
= 0x0e,
920 .txClip
= 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
922 .switchSettling
= 0x2d,
923 .adcDesiredSize
= -30,
926 .txFrameToXpaOn
= 0xe,
928 .papdRateMaskHt20
= LE32(0x0cf0e0e0),
929 .papdRateMaskHt40
= LE32(0x6cf0e0e0),
931 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
936 .tempSlopeHigh
= 105,
937 .xatten1DBLow
= {0, 0, 0},
938 .xatten1MarginLow
= {0, 0, 0},
939 .xatten1DBHigh
= {0, 0, 0},
940 .xatten1MarginHigh
= {0, 0, 0}
985 .calTarget_freqbin_5G
= {
995 .calTarget_freqbin_5GHT20
= {
1005 .calTarget_freqbin_5GHT40
= {
1015 .calTargetPower5G
= {
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} },
1023 { {42, 40, 40, 34} },
1024 { {42, 40, 40, 34} },
1026 .calTargetPower5GHT20
= {
1028 * 0_8_16,1-3_9-11_17-19,
1029 * 4,5,6,7,12,13,14,15,20,21,22,23
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 { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
1036 { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
1037 { {38, 38, 38, 38, 32, 28, 38, 38, 32, 28, 38, 38, 32, 26} },
1038 { {36, 36, 36, 36, 32, 28, 36, 36, 32, 28, 36, 36, 32, 26} },
1040 .calTargetPower5GHT40
= {
1042 * 0_8_16,1-3_9-11_17-19,
1043 * 4,5,6,7,12,13,14,15,20,21,22,23
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 { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
1050 { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
1051 { {36, 36, 36, 36, 30, 26, 36, 36, 30, 26, 36, 36, 30, 24} },
1052 { {34, 34, 34, 34, 30, 26, 34, 34, 30, 26, 34, 34, 30, 24} },
1055 0x10, 0x16, 0x18, 0x40, 0x46,
1056 0x48, 0x30, 0x36, 0x38
1060 /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1061 /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
1062 /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
1063 /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
1064 /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0),
1065 /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
1066 /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
1067 /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
1070 /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1071 /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
1072 /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
1073 /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
1074 /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0),
1075 /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
1076 /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
1077 /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
1081 /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
1082 /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
1083 /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
1084 /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0),
1085 /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0),
1086 /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0),
1087 /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0),
1088 /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0)
1092 /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1093 /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
1094 /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0),
1095 /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0),
1096 /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
1097 /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
1098 /* Data[3].ctlEdges[6].bChannel */ 0xFF,
1099 /* Data[3].ctlEdges[7].bChannel */ 0xFF,
1103 /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1104 /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
1105 /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0),
1106 /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0),
1107 /* Data[4].ctlEdges[4].bChannel */ 0xFF,
1108 /* Data[4].ctlEdges[5].bChannel */ 0xFF,
1109 /* Data[4].ctlEdges[6].bChannel */ 0xFF,
1110 /* Data[4].ctlEdges[7].bChannel */ 0xFF,
1114 /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
1115 /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0),
1116 /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0),
1117 /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
1118 /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0),
1119 /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
1120 /* Data[5].ctlEdges[6].bChannel */ 0xFF,
1121 /* Data[5].ctlEdges[7].bChannel */ 0xFF
1125 /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1126 /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
1127 /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0),
1128 /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0),
1129 /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
1130 /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0),
1131 /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0),
1132 /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0)
1136 /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1137 /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
1138 /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0),
1139 /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
1140 /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0),
1141 /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
1142 /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
1143 /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
1147 /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
1148 /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
1149 /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
1150 /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
1151 /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0),
1152 /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
1153 /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0),
1154 /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0)
1157 .ctlPowerData_5G
= {
1160 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1161 {60, 1}, {60, 1}, {60, 1}, {60, 0},
1166 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1167 {60, 1}, {60, 1}, {60, 1}, {60, 0},
1172 {60, 0}, {60, 1}, {60, 0}, {60, 1},
1173 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1178 {60, 0}, {60, 1}, {60, 1}, {60, 0},
1179 {60, 1}, {60, 0}, {60, 0}, {60, 0},
1184 {60, 1}, {60, 1}, {60, 1}, {60, 0},
1185 {60, 0}, {60, 0}, {60, 0}, {60, 0},
1190 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1191 {60, 1}, {60, 0}, {60, 0}, {60, 0},
1196 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1197 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1202 {60, 1}, {60, 1}, {60, 0}, {60, 1},
1203 {60, 1}, {60, 1}, {60, 1}, {60, 0},
1208 {60, 1}, {60, 0}, {60, 1}, {60, 1},
1209 {60, 1}, {60, 1}, {60, 0}, {60, 1},
1216 static const struct ar9300_eeprom ar9300_h112
= {
1218 .templateVersion
= 3,
1219 .macAddr
= {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0},
1220 .custData
= {"h112-241-f0000"},
1222 .regDmn
= { LE16(0), LE16(0x1f) },
1223 .txrxMask
= 0x77, /* 4 bits tx and 4 bits rx */
1225 .opFlags
= AR9300_OPFLAGS_11G
| AR9300_OPFLAGS_11A
,
1229 .blueToothOptions
= 0,
1231 .deviceType
= 5, /* takes lower byte in eeprom location */
1232 .pwrTableOffset
= AR9300_PWR_TABLE_OFFSET
,
1233 .params_for_tuning_caps
= {0, 0},
1234 .featureEnable
= 0x0d,
1236 * bit0 - enable tx temp comp - disabled
1237 * bit1 - enable tx volt comp - disabled
1238 * bit2 - enable fastClock - enabled
1239 * bit3 - enable doubling - enabled
1240 * bit4 - enable internal regulator - disabled
1241 * bit5 - enable pa predistortion - disabled
1243 .miscConfiguration
= 0, /* bit0 - turn down drivestrength */
1244 .eepromWriteEnableGpio
= 6,
1245 .wlanDisableGpio
= 0,
1247 .rxBandSelectGpio
= 0xff,
1252 /* ar9300_modal_eep_header 2g */
1253 /* 4 idle,t1,t2,b(4 bits per setting) */
1254 .antCtrlCommon
= LE32(0x110),
1255 /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
1256 .antCtrlCommon2
= LE32(0x44444),
1259 * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
1260 * rx1, rx12, b (2 bits each)
1262 .antCtrlChain
= { LE16(0x150), LE16(0x150), LE16(0x150) },
1265 * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
1266 * for ar9280 (0xa20c/b20c 5:0)
1268 .xatten1DB
= {0, 0, 0},
1271 * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
1272 * for ar9280 (0xa20c/b20c 16:12
1274 .xatten1Margin
= {0, 0, 0},
1279 * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur
1280 * channels in usual fbin coding format
1282 .spurChans
= {FREQ2FBIN(2464, 1), 0, 0, 0, 0},
1285 * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check
1286 * if the register is per chain
1288 .noiseFloorThreshCh
= {-1, 0, 0},
1289 .ob
= {1, 1, 1},/* 3 chain */
1290 .db_stage2
= {1, 1, 1}, /* 3 chain */
1291 .db_stage3
= {0, 0, 0},
1292 .db_stage4
= {0, 0, 0},
1294 .txFrameToDataStart
= 0x0e,
1295 .txFrameToPaOn
= 0x0e,
1296 .txClip
= 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
1298 .switchSettling
= 0x2c,
1299 .adcDesiredSize
= -30,
1302 .txFrameToXpaOn
= 0xe,
1304 .papdRateMaskHt20
= LE32(0x80c080),
1305 .papdRateMaskHt40
= LE32(0x80c080),
1307 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1311 .ant_div_control
= 0,
1312 .future
= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
1319 /* ar9300_cal_data_per_freq_op_loop 2g */
1321 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
1322 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
1323 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
1325 .calTarget_freqbin_Cck
= {
1329 .calTarget_freqbin_2G
= {
1334 .calTarget_freqbin_2GHT20
= {
1339 .calTarget_freqbin_2GHT40
= {
1344 .calTargetPowerCck
= {
1345 /* 1L-5L,5S,11L,11S */
1346 { {34, 34, 34, 34} },
1347 { {34, 34, 34, 34} },
1349 .calTargetPower2G
= {
1351 { {34, 34, 32, 32} },
1352 { {34, 34, 32, 32} },
1353 { {34, 34, 32, 32} },
1355 .calTargetPower2GHT20
= {
1356 { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 28, 28, 28, 24} },
1357 { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 28, 28, 28, 24} },
1358 { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 28, 28, 28, 24} },
1360 .calTargetPower2GHT40
= {
1361 { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 26, 26, 26, 22} },
1362 { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 26, 26, 26, 22} },
1363 { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 26, 26, 26, 22} },
1366 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
1367 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
1397 /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
1398 /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
1399 /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
1400 /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1),
1404 /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
1405 /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
1406 /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
1411 /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
1412 /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
1418 /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
1419 /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
1420 /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
1421 /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
1425 /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
1426 /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
1427 /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
1431 /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
1432 /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
1433 /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
1438 /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
1439 /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
1440 /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
1445 /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
1446 /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
1447 /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
1448 /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
1451 .ctlPowerData_2G
= {
1452 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
1453 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
1454 { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } },
1456 { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } },
1457 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
1458 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
1460 { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } },
1461 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
1462 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
1464 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
1465 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
1466 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
1469 /* 4 idle,t1,t2,b (4 bits per setting) */
1470 .antCtrlCommon
= LE32(0x220),
1471 /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
1472 .antCtrlCommon2
= LE32(0x44444),
1473 /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
1475 LE16(0x150), LE16(0x150), LE16(0x150),
1477 /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
1478 .xatten1DB
= {0, 0, 0},
1481 * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
1482 * for merlin (0xa20c/b20c 16:12
1484 .xatten1Margin
= {0, 0, 0},
1487 /* spurChans spur channels in usual fbin coding format */
1488 .spurChans
= {0, 0, 0, 0, 0},
1489 /* noiseFloorThreshCh Check if the register is per chain */
1490 .noiseFloorThreshCh
= {-1, 0, 0},
1491 .ob
= {3, 3, 3}, /* 3 chain */
1492 .db_stage2
= {3, 3, 3}, /* 3 chain */
1493 .db_stage3
= {3, 3, 3}, /* doesn't exist for 2G */
1494 .db_stage4
= {3, 3, 3}, /* don't exist for 2G */
1496 .txFrameToDataStart
= 0x0e,
1497 .txFrameToPaOn
= 0x0e,
1498 .txClip
= 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
1500 .switchSettling
= 0x2d,
1501 .adcDesiredSize
= -30,
1504 .txFrameToXpaOn
= 0xe,
1506 .papdRateMaskHt20
= LE32(0x0cf0e0e0),
1507 .papdRateMaskHt40
= LE32(0x6cf0e0e0),
1509 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1514 .tempSlopeHigh
= 50,
1515 .xatten1DBLow
= {0, 0, 0},
1516 .xatten1MarginLow
= {0, 0, 0},
1517 .xatten1DBHigh
= {0, 0, 0},
1518 .xatten1MarginHigh
= {0, 0, 0}
1563 .calTarget_freqbin_5G
= {
1573 .calTarget_freqbin_5GHT20
= {
1583 .calTarget_freqbin_5GHT40
= {
1593 .calTargetPower5G
= {
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} },
1601 { {30, 30, 28, 24} },
1602 { {30, 30, 28, 24} },
1604 .calTargetPower5GHT20
= {
1606 * 0_8_16,1-3_9-11_17-19,
1607 * 4,5,6,7,12,13,14,15,20,21,22,23
1609 { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 20, 20, 20, 16} },
1610 { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 20, 20, 20, 16} },
1611 { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 18, 18, 18, 16} },
1612 { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 18, 18, 18, 16} },
1613 { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 16, 16, 16, 14} },
1614 { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 16, 16, 16, 14} },
1615 { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 14, 14, 14, 12} },
1616 { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 14, 14, 14, 12} },
1618 .calTargetPower5GHT40
= {
1620 * 0_8_16,1-3_9-11_17-19,
1621 * 4,5,6,7,12,13,14,15,20,21,22,23
1623 { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 18, 18, 18, 14} },
1624 { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 18, 18, 18, 14} },
1625 { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 16, 16, 16, 12} },
1626 { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 16, 16, 16, 12} },
1627 { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 14, 14, 14, 10} },
1628 { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 14, 14, 14, 10} },
1629 { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 12, 12, 12, 8} },
1630 { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 12, 12, 12, 8} },
1633 0x10, 0x16, 0x18, 0x40, 0x46,
1634 0x48, 0x30, 0x36, 0x38
1638 /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1639 /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
1640 /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
1641 /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
1642 /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0),
1643 /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
1644 /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
1645 /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
1648 /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1649 /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
1650 /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
1651 /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
1652 /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0),
1653 /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
1654 /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
1655 /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
1659 /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
1660 /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
1661 /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
1662 /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0),
1663 /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0),
1664 /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0),
1665 /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0),
1666 /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0)
1670 /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1671 /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
1672 /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0),
1673 /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0),
1674 /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
1675 /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
1676 /* Data[3].ctlEdges[6].bChannel */ 0xFF,
1677 /* Data[3].ctlEdges[7].bChannel */ 0xFF,
1681 /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1682 /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
1683 /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0),
1684 /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0),
1685 /* Data[4].ctlEdges[4].bChannel */ 0xFF,
1686 /* Data[4].ctlEdges[5].bChannel */ 0xFF,
1687 /* Data[4].ctlEdges[6].bChannel */ 0xFF,
1688 /* Data[4].ctlEdges[7].bChannel */ 0xFF,
1692 /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
1693 /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0),
1694 /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0),
1695 /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
1696 /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0),
1697 /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
1698 /* Data[5].ctlEdges[6].bChannel */ 0xFF,
1699 /* Data[5].ctlEdges[7].bChannel */ 0xFF
1703 /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1704 /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
1705 /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0),
1706 /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0),
1707 /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
1708 /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0),
1709 /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0),
1710 /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0)
1714 /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
1715 /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
1716 /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0),
1717 /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
1718 /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0),
1719 /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
1720 /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
1721 /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
1725 /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
1726 /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
1727 /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
1728 /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
1729 /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0),
1730 /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
1731 /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0),
1732 /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0)
1735 .ctlPowerData_5G
= {
1738 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1739 {60, 1}, {60, 1}, {60, 1}, {60, 0},
1744 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1745 {60, 1}, {60, 1}, {60, 1}, {60, 0},
1750 {60, 0}, {60, 1}, {60, 0}, {60, 1},
1751 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1756 {60, 0}, {60, 1}, {60, 1}, {60, 0},
1757 {60, 1}, {60, 0}, {60, 0}, {60, 0},
1762 {60, 1}, {60, 1}, {60, 1}, {60, 0},
1763 {60, 0}, {60, 0}, {60, 0}, {60, 0},
1768 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1769 {60, 1}, {60, 0}, {60, 0}, {60, 0},
1774 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1775 {60, 1}, {60, 1}, {60, 1}, {60, 1},
1780 {60, 1}, {60, 1}, {60, 0}, {60, 1},
1781 {60, 1}, {60, 1}, {60, 1}, {60, 0},
1786 {60, 1}, {60, 0}, {60, 1}, {60, 1},
1787 {60, 1}, {60, 1}, {60, 0}, {60, 1},
1794 static const struct ar9300_eeprom ar9300_x112
= {
1796 .templateVersion
= 5,
1797 .macAddr
= {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0},
1798 .custData
= {"x112-041-f0000"},
1800 .regDmn
= { LE16(0), LE16(0x1f) },
1801 .txrxMask
= 0x77, /* 4 bits tx and 4 bits rx */
1803 .opFlags
= AR9300_OPFLAGS_11G
| AR9300_OPFLAGS_11A
,
1807 .blueToothOptions
= 0,
1809 .deviceType
= 5, /* takes lower byte in eeprom location */
1810 .pwrTableOffset
= AR9300_PWR_TABLE_OFFSET
,
1811 .params_for_tuning_caps
= {0, 0},
1812 .featureEnable
= 0x0d,
1814 * bit0 - enable tx temp comp - disabled
1815 * bit1 - enable tx volt comp - disabled
1816 * bit2 - enable fastclock - enabled
1817 * bit3 - enable doubling - enabled
1818 * bit4 - enable internal regulator - disabled
1819 * bit5 - enable pa predistortion - disabled
1821 .miscConfiguration
= 0, /* bit0 - turn down drivestrength */
1822 .eepromWriteEnableGpio
= 6,
1823 .wlanDisableGpio
= 0,
1825 .rxBandSelectGpio
= 0xff,
1830 /* ar9300_modal_eep_header 2g */
1831 /* 4 idle,t1,t2,b(4 bits per setting) */
1832 .antCtrlCommon
= LE32(0x110),
1833 /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
1834 .antCtrlCommon2
= LE32(0x22222),
1837 * antCtrlChain[ar9300_max_chains]; 6 idle, t, r,
1838 * rx1, rx12, b (2 bits each)
1840 .antCtrlChain
= { LE16(0x10), LE16(0x10), LE16(0x10) },
1843 * xatten1DB[AR9300_max_chains]; 3 xatten1_db
1844 * for ar9280 (0xa20c/b20c 5:0)
1846 .xatten1DB
= {0x1b, 0x1b, 0x1b},
1849 * xatten1Margin[ar9300_max_chains]; 3 xatten1_margin
1850 * for ar9280 (0xa20c/b20c 16:12
1852 .xatten1Margin
= {0x15, 0x15, 0x15},
1857 * spurChans[OSPrey_eeprom_modal_sPURS]; spur
1858 * channels in usual fbin coding format
1860 .spurChans
= {FREQ2FBIN(2464, 1), 0, 0, 0, 0},
1863 * noiseFloorThreshch[ar9300_max_cHAINS]; 3 Check
1864 * if the register is per chain
1866 .noiseFloorThreshCh
= {-1, 0, 0},
1867 .ob
= {1, 1, 1},/* 3 chain */
1868 .db_stage2
= {1, 1, 1}, /* 3 chain */
1869 .db_stage3
= {0, 0, 0},
1870 .db_stage4
= {0, 0, 0},
1872 .txFrameToDataStart
= 0x0e,
1873 .txFrameToPaOn
= 0x0e,
1874 .txClip
= 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
1876 .switchSettling
= 0x2c,
1877 .adcDesiredSize
= -30,
1880 .txFrameToXpaOn
= 0xe,
1882 .papdRateMaskHt20
= LE32(0x0c80c080),
1883 .papdRateMaskHt40
= LE32(0x0080c080),
1885 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1889 .ant_div_control
= 0,
1890 .future
= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
1897 /* ar9300_cal_data_per_freq_op_loop 2g */
1899 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
1900 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
1901 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
1903 .calTarget_freqbin_Cck
= {
1907 .calTarget_freqbin_2G
= {
1912 .calTarget_freqbin_2GHT20
= {
1917 .calTarget_freqbin_2GHT40
= {
1922 .calTargetPowerCck
= {
1923 /* 1L-5L,5S,11L,11s */
1924 { {38, 38, 38, 38} },
1925 { {38, 38, 38, 38} },
1927 .calTargetPower2G
= {
1929 { {38, 38, 36, 34} },
1930 { {38, 38, 36, 34} },
1931 { {38, 38, 34, 32} },
1933 .calTargetPower2GHT20
= {
1934 { {36, 36, 36, 36, 36, 34, 34, 32, 30, 28, 28, 28, 28, 26} },
1935 { {36, 36, 36, 36, 36, 34, 36, 34, 32, 30, 30, 30, 28, 26} },
1936 { {36, 36, 36, 36, 36, 34, 34, 32, 30, 28, 28, 28, 28, 26} },
1938 .calTargetPower2GHT40
= {
1939 { {36, 36, 36, 36, 34, 32, 32, 30, 28, 26, 26, 26, 26, 24} },
1940 { {36, 36, 36, 36, 34, 32, 34, 32, 30, 28, 28, 28, 28, 24} },
1941 { {36, 36, 36, 36, 34, 32, 32, 30, 28, 26, 26, 26, 26, 24} },
1944 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
1945 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
1975 /* Data[4].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
1976 /* Data[4].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
1977 /* Data[4].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
1978 /* Data[4].ctledges[3].bchannel */ FREQ2FBIN(2484, 1),
1982 /* Data[5].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
1983 /* Data[5].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
1984 /* Data[5].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
1989 /* Data[6].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
1990 /* Data[6].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
1996 /* Data[7].ctledges[0].bchannel */ FREQ2FBIN(2422, 1),
1997 /* Data[7].ctledges[1].bchannel */ FREQ2FBIN(2427, 1),
1998 /* Data[7].ctledges[2].bchannel */ FREQ2FBIN(2447, 1),
1999 /* Data[7].ctledges[3].bchannel */ FREQ2FBIN(2462, 1),
2003 /* Data[8].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
2004 /* Data[8].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
2005 /* Data[8].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
2009 /* Data[9].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
2010 /* Data[9].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
2011 /* Data[9].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
2016 /* Data[10].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
2017 /* Data[10].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
2018 /* Data[10].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
2023 /* Data[11].ctledges[0].bchannel */ FREQ2FBIN(2422, 1),
2024 /* Data[11].ctledges[1].bchannel */ FREQ2FBIN(2427, 1),
2025 /* Data[11].ctledges[2].bchannel */ FREQ2FBIN(2447, 1),
2026 /* Data[11].ctledges[3].bchannel */ FREQ2FBIN(2462, 1),
2029 .ctlPowerData_2G
= {
2030 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2031 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2032 { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } },
2034 { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } },
2035 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2036 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2038 { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } },
2039 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2040 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2042 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2043 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
2044 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
2047 /* 4 idle,t1,t2,b (4 bits per setting) */
2048 .antCtrlCommon
= LE32(0x110),
2049 /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
2050 .antCtrlCommon2
= LE32(0x22222),
2051 /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
2053 LE16(0x0), LE16(0x0), LE16(0x0),
2055 /* xatten1DB 3 xatten1_db for ar9280 (0xa20c/b20c 5:0) */
2056 .xatten1DB
= {0x13, 0x19, 0x17},
2059 * xatten1Margin[ar9300_max_chains]; 3 xatten1_margin
2060 * for merlin (0xa20c/b20c 16:12
2062 .xatten1Margin
= {0x19, 0x19, 0x19},
2065 /* spurChans spur channels in usual fbin coding format */
2066 .spurChans
= {0, 0, 0, 0, 0},
2067 /* noiseFloorThreshch check if the register is per chain */
2068 .noiseFloorThreshCh
= {-1, 0, 0},
2069 .ob
= {3, 3, 3}, /* 3 chain */
2070 .db_stage2
= {3, 3, 3}, /* 3 chain */
2071 .db_stage3
= {3, 3, 3}, /* doesn't exist for 2G */
2072 .db_stage4
= {3, 3, 3}, /* don't exist for 2G */
2074 .txFrameToDataStart
= 0x0e,
2075 .txFrameToPaOn
= 0x0e,
2076 .txClip
= 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
2078 .switchSettling
= 0x2d,
2079 .adcDesiredSize
= -30,
2082 .txFrameToXpaOn
= 0xe,
2084 .papdRateMaskHt20
= LE32(0x0cf0e0e0),
2085 .papdRateMaskHt40
= LE32(0x6cf0e0e0),
2087 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2092 .tempSlopeHigh
= 105,
2093 .xatten1DBLow
= {0x10, 0x14, 0x10},
2094 .xatten1MarginLow
= {0x19, 0x19 , 0x19},
2095 .xatten1DBHigh
= {0x1d, 0x20, 0x24},
2096 .xatten1MarginHigh
= {0x10, 0x10, 0x10}
2141 .calTarget_freqbin_5G
= {
2151 .calTarget_freqbin_5GHT20
= {
2161 .calTarget_freqbin_5GHT40
= {
2171 .calTargetPower5G
= {
2173 { {32, 32, 28, 26} },
2174 { {32, 32, 28, 26} },
2175 { {32, 32, 28, 26} },
2176 { {32, 32, 26, 24} },
2177 { {32, 32, 26, 24} },
2178 { {32, 32, 24, 22} },
2179 { {30, 30, 24, 22} },
2180 { {30, 30, 24, 22} },
2182 .calTargetPower5GHT20
= {
2184 * 0_8_16,1-3_9-11_17-19,
2185 * 4,5,6,7,12,13,14,15,20,21,22,23
2187 { {32, 32, 32, 32, 28, 26, 32, 28, 26, 24, 24, 24, 22, 22} },
2188 { {32, 32, 32, 32, 28, 26, 32, 28, 26, 24, 24, 24, 22, 22} },
2189 { {32, 32, 32, 32, 28, 26, 32, 28, 26, 24, 24, 24, 22, 22} },
2190 { {32, 32, 32, 32, 28, 26, 32, 26, 24, 22, 22, 22, 20, 20} },
2191 { {32, 32, 32, 32, 28, 26, 32, 26, 24, 22, 20, 18, 16, 16} },
2192 { {32, 32, 32, 32, 28, 26, 32, 24, 20, 16, 18, 16, 14, 14} },
2193 { {30, 30, 30, 30, 28, 26, 30, 24, 20, 16, 18, 16, 14, 14} },
2194 { {30, 30, 30, 30, 28, 26, 30, 24, 20, 16, 18, 16, 14, 14} },
2196 .calTargetPower5GHT40
= {
2198 * 0_8_16,1-3_9-11_17-19,
2199 * 4,5,6,7,12,13,14,15,20,21,22,23
2201 { {32, 32, 32, 30, 28, 26, 30, 28, 26, 24, 24, 24, 22, 22} },
2202 { {32, 32, 32, 30, 28, 26, 30, 28, 26, 24, 24, 24, 22, 22} },
2203 { {32, 32, 32, 30, 28, 26, 30, 28, 26, 24, 24, 24, 22, 22} },
2204 { {32, 32, 32, 30, 28, 26, 30, 26, 24, 22, 22, 22, 20, 20} },
2205 { {32, 32, 32, 30, 28, 26, 30, 26, 24, 22, 20, 18, 16, 16} },
2206 { {32, 32, 32, 30, 28, 26, 30, 22, 20, 16, 18, 16, 14, 14} },
2207 { {30, 30, 30, 30, 28, 26, 30, 22, 20, 16, 18, 16, 14, 14} },
2208 { {30, 30, 30, 30, 28, 26, 30, 22, 20, 16, 18, 16, 14, 14} },
2211 0x10, 0x16, 0x18, 0x40, 0x46,
2212 0x48, 0x30, 0x36, 0x38
2216 /* Data[0].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
2217 /* Data[0].ctledges[1].bchannel */ FREQ2FBIN(5260, 0),
2218 /* Data[0].ctledges[2].bchannel */ FREQ2FBIN(5280, 0),
2219 /* Data[0].ctledges[3].bchannel */ FREQ2FBIN(5500, 0),
2220 /* Data[0].ctledges[4].bchannel */ FREQ2FBIN(5600, 0),
2221 /* Data[0].ctledges[5].bchannel */ FREQ2FBIN(5700, 0),
2222 /* Data[0].ctledges[6].bchannel */ FREQ2FBIN(5745, 0),
2223 /* Data[0].ctledges[7].bchannel */ FREQ2FBIN(5825, 0)
2226 /* Data[1].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
2227 /* Data[1].ctledges[1].bchannel */ FREQ2FBIN(5260, 0),
2228 /* Data[1].ctledges[2].bchannel */ FREQ2FBIN(5280, 0),
2229 /* Data[1].ctledges[3].bchannel */ FREQ2FBIN(5500, 0),
2230 /* Data[1].ctledges[4].bchannel */ FREQ2FBIN(5520, 0),
2231 /* Data[1].ctledges[5].bchannel */ FREQ2FBIN(5700, 0),
2232 /* Data[1].ctledges[6].bchannel */ FREQ2FBIN(5745, 0),
2233 /* Data[1].ctledges[7].bchannel */ FREQ2FBIN(5825, 0)
2237 /* Data[2].ctledges[0].bchannel */ FREQ2FBIN(5190, 0),
2238 /* Data[2].ctledges[1].bchannel */ FREQ2FBIN(5230, 0),
2239 /* Data[2].ctledges[2].bchannel */ FREQ2FBIN(5270, 0),
2240 /* Data[2].ctledges[3].bchannel */ FREQ2FBIN(5310, 0),
2241 /* Data[2].ctledges[4].bchannel */ FREQ2FBIN(5510, 0),
2242 /* Data[2].ctledges[5].bchannel */ FREQ2FBIN(5550, 0),
2243 /* Data[2].ctledges[6].bchannel */ FREQ2FBIN(5670, 0),
2244 /* Data[2].ctledges[7].bchannel */ FREQ2FBIN(5755, 0)
2248 /* Data[3].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
2249 /* Data[3].ctledges[1].bchannel */ FREQ2FBIN(5200, 0),
2250 /* Data[3].ctledges[2].bchannel */ FREQ2FBIN(5260, 0),
2251 /* Data[3].ctledges[3].bchannel */ FREQ2FBIN(5320, 0),
2252 /* Data[3].ctledges[4].bchannel */ FREQ2FBIN(5500, 0),
2253 /* Data[3].ctledges[5].bchannel */ FREQ2FBIN(5700, 0),
2254 /* Data[3].ctledges[6].bchannel */ 0xFF,
2255 /* Data[3].ctledges[7].bchannel */ 0xFF,
2259 /* Data[4].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
2260 /* Data[4].ctledges[1].bchannel */ FREQ2FBIN(5260, 0),
2261 /* Data[4].ctledges[2].bchannel */ FREQ2FBIN(5500, 0),
2262 /* Data[4].ctledges[3].bchannel */ FREQ2FBIN(5700, 0),
2263 /* Data[4].ctledges[4].bchannel */ 0xFF,
2264 /* Data[4].ctledges[5].bchannel */ 0xFF,
2265 /* Data[4].ctledges[6].bchannel */ 0xFF,
2266 /* Data[4].ctledges[7].bchannel */ 0xFF,
2270 /* Data[5].ctledges[0].bchannel */ FREQ2FBIN(5190, 0),
2271 /* Data[5].ctledges[1].bchannel */ FREQ2FBIN(5270, 0),
2272 /* Data[5].ctledges[2].bchannel */ FREQ2FBIN(5310, 0),
2273 /* Data[5].ctledges[3].bchannel */ FREQ2FBIN(5510, 0),
2274 /* Data[5].ctledges[4].bchannel */ FREQ2FBIN(5590, 0),
2275 /* Data[5].ctledges[5].bchannel */ FREQ2FBIN(5670, 0),
2276 /* Data[5].ctledges[6].bchannel */ 0xFF,
2277 /* Data[5].ctledges[7].bchannel */ 0xFF
2281 /* Data[6].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
2282 /* Data[6].ctledges[1].bchannel */ FREQ2FBIN(5200, 0),
2283 /* Data[6].ctledges[2].bchannel */ FREQ2FBIN(5220, 0),
2284 /* Data[6].ctledges[3].bchannel */ FREQ2FBIN(5260, 0),
2285 /* Data[6].ctledges[4].bchannel */ FREQ2FBIN(5500, 0),
2286 /* Data[6].ctledges[5].bchannel */ FREQ2FBIN(5600, 0),
2287 /* Data[6].ctledges[6].bchannel */ FREQ2FBIN(5700, 0),
2288 /* Data[6].ctledges[7].bchannel */ FREQ2FBIN(5745, 0)
2292 /* Data[7].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
2293 /* Data[7].ctledges[1].bchannel */ FREQ2FBIN(5260, 0),
2294 /* Data[7].ctledges[2].bchannel */ FREQ2FBIN(5320, 0),
2295 /* Data[7].ctledges[3].bchannel */ FREQ2FBIN(5500, 0),
2296 /* Data[7].ctledges[4].bchannel */ FREQ2FBIN(5560, 0),
2297 /* Data[7].ctledges[5].bchannel */ FREQ2FBIN(5700, 0),
2298 /* Data[7].ctledges[6].bchannel */ FREQ2FBIN(5745, 0),
2299 /* Data[7].ctledges[7].bchannel */ FREQ2FBIN(5825, 0)
2303 /* Data[8].ctledges[0].bchannel */ FREQ2FBIN(5190, 0),
2304 /* Data[8].ctledges[1].bchannel */ FREQ2FBIN(5230, 0),
2305 /* Data[8].ctledges[2].bchannel */ FREQ2FBIN(5270, 0),
2306 /* Data[8].ctledges[3].bchannel */ FREQ2FBIN(5510, 0),
2307 /* Data[8].ctledges[4].bchannel */ FREQ2FBIN(5550, 0),
2308 /* Data[8].ctledges[5].bchannel */ FREQ2FBIN(5670, 0),
2309 /* Data[8].ctledges[6].bchannel */ FREQ2FBIN(5755, 0),
2310 /* Data[8].ctledges[7].bchannel */ FREQ2FBIN(5795, 0)
2313 .ctlPowerData_5G
= {
2316 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2317 {60, 1}, {60, 1}, {60, 1}, {60, 0},
2322 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2323 {60, 1}, {60, 1}, {60, 1}, {60, 0},
2328 {60, 0}, {60, 1}, {60, 0}, {60, 1},
2329 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2334 {60, 0}, {60, 1}, {60, 1}, {60, 0},
2335 {60, 1}, {60, 0}, {60, 0}, {60, 0},
2340 {60, 1}, {60, 1}, {60, 1}, {60, 0},
2341 {60, 0}, {60, 0}, {60, 0}, {60, 0},
2346 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2347 {60, 1}, {60, 0}, {60, 0}, {60, 0},
2352 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2353 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2358 {60, 1}, {60, 1}, {60, 0}, {60, 1},
2359 {60, 1}, {60, 1}, {60, 1}, {60, 0},
2364 {60, 1}, {60, 0}, {60, 1}, {60, 1},
2365 {60, 1}, {60, 1}, {60, 0}, {60, 1},
2371 static const struct ar9300_eeprom ar9300_h116
= {
2373 .templateVersion
= 4,
2374 .macAddr
= {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0},
2375 .custData
= {"h116-041-f0000"},
2377 .regDmn
= { LE16(0), LE16(0x1f) },
2378 .txrxMask
= 0x33, /* 4 bits tx and 4 bits rx */
2380 .opFlags
= AR9300_OPFLAGS_11G
| AR9300_OPFLAGS_11A
,
2384 .blueToothOptions
= 0,
2386 .deviceType
= 5, /* takes lower byte in eeprom location */
2387 .pwrTableOffset
= AR9300_PWR_TABLE_OFFSET
,
2388 .params_for_tuning_caps
= {0, 0},
2389 .featureEnable
= 0x0d,
2391 * bit0 - enable tx temp comp - disabled
2392 * bit1 - enable tx volt comp - disabled
2393 * bit2 - enable fastClock - enabled
2394 * bit3 - enable doubling - enabled
2395 * bit4 - enable internal regulator - disabled
2396 * bit5 - enable pa predistortion - disabled
2398 .miscConfiguration
= 0, /* bit0 - turn down drivestrength */
2399 .eepromWriteEnableGpio
= 6,
2400 .wlanDisableGpio
= 0,
2402 .rxBandSelectGpio
= 0xff,
2407 /* ar9300_modal_eep_header 2g */
2408 /* 4 idle,t1,t2,b(4 bits per setting) */
2409 .antCtrlCommon
= LE32(0x110),
2410 /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
2411 .antCtrlCommon2
= LE32(0x44444),
2414 * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
2415 * rx1, rx12, b (2 bits each)
2417 .antCtrlChain
= { LE16(0x10), LE16(0x10), LE16(0x10) },
2420 * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
2421 * for ar9280 (0xa20c/b20c 5:0)
2423 .xatten1DB
= {0x1f, 0x1f, 0x1f},
2426 * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
2427 * for ar9280 (0xa20c/b20c 16:12
2429 .xatten1Margin
= {0x12, 0x12, 0x12},
2434 * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur
2435 * channels in usual fbin coding format
2437 .spurChans
= {FREQ2FBIN(2464, 1), 0, 0, 0, 0},
2440 * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check
2441 * if the register is per chain
2443 .noiseFloorThreshCh
= {-1, 0, 0},
2444 .ob
= {1, 1, 1},/* 3 chain */
2445 .db_stage2
= {1, 1, 1}, /* 3 chain */
2446 .db_stage3
= {0, 0, 0},
2447 .db_stage4
= {0, 0, 0},
2449 .txFrameToDataStart
= 0x0e,
2450 .txFrameToPaOn
= 0x0e,
2451 .txClip
= 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
2453 .switchSettling
= 0x2c,
2454 .adcDesiredSize
= -30,
2457 .txFrameToXpaOn
= 0xe,
2459 .papdRateMaskHt20
= LE32(0x0c80C080),
2460 .papdRateMaskHt40
= LE32(0x0080C080),
2462 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2466 .ant_div_control
= 0,
2467 .future
= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
2474 /* ar9300_cal_data_per_freq_op_loop 2g */
2476 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
2477 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
2478 { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
2480 .calTarget_freqbin_Cck
= {
2484 .calTarget_freqbin_2G
= {
2489 .calTarget_freqbin_2GHT20
= {
2494 .calTarget_freqbin_2GHT40
= {
2499 .calTargetPowerCck
= {
2500 /* 1L-5L,5S,11L,11S */
2501 { {34, 34, 34, 34} },
2502 { {34, 34, 34, 34} },
2504 .calTargetPower2G
= {
2506 { {34, 34, 32, 32} },
2507 { {34, 34, 32, 32} },
2508 { {34, 34, 32, 32} },
2510 .calTargetPower2GHT20
= {
2511 { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 0, 0, 0, 0} },
2512 { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 0, 0, 0, 0} },
2513 { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 0, 0, 0, 0} },
2515 .calTargetPower2GHT40
= {
2516 { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
2517 { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
2518 { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
2521 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
2522 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
2552 /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
2553 /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
2554 /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
2555 /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1),
2559 /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
2560 /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
2561 /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
2566 /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
2567 /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
2573 /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
2574 /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
2575 /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
2576 /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
2580 /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
2581 /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
2582 /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
2586 /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
2587 /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
2588 /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
2593 /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
2594 /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
2595 /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
2600 /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
2601 /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
2602 /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
2603 /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
2606 .ctlPowerData_2G
= {
2607 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2608 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2609 { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } },
2611 { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } },
2612 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2613 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2615 { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } },
2616 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2617 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2619 { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
2620 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
2621 { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
2624 /* 4 idle,t1,t2,b (4 bits per setting) */
2625 .antCtrlCommon
= LE32(0x220),
2626 /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
2627 .antCtrlCommon2
= LE32(0x44444),
2628 /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
2630 LE16(0x150), LE16(0x150), LE16(0x150),
2632 /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
2633 .xatten1DB
= {0x19, 0x19, 0x19},
2636 * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
2637 * for merlin (0xa20c/b20c 16:12
2639 .xatten1Margin
= {0x14, 0x14, 0x14},
2642 /* spurChans spur channels in usual fbin coding format */
2643 .spurChans
= {0, 0, 0, 0, 0},
2644 /* noiseFloorThreshCh Check if the register is per chain */
2645 .noiseFloorThreshCh
= {-1, 0, 0},
2646 .ob
= {3, 3, 3}, /* 3 chain */
2647 .db_stage2
= {3, 3, 3}, /* 3 chain */
2648 .db_stage3
= {3, 3, 3}, /* doesn't exist for 2G */
2649 .db_stage4
= {3, 3, 3}, /* don't exist for 2G */
2651 .txFrameToDataStart
= 0x0e,
2652 .txFrameToPaOn
= 0x0e,
2653 .txClip
= 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
2655 .switchSettling
= 0x2d,
2656 .adcDesiredSize
= -30,
2659 .txFrameToXpaOn
= 0xe,
2661 .papdRateMaskHt20
= LE32(0x0cf0e0e0),
2662 .papdRateMaskHt40
= LE32(0x6cf0e0e0),
2664 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2669 .tempSlopeHigh
= 50,
2670 .xatten1DBLow
= {0, 0, 0},
2671 .xatten1MarginLow
= {0, 0, 0},
2672 .xatten1DBHigh
= {0, 0, 0},
2673 .xatten1MarginHigh
= {0, 0, 0}
2718 .calTarget_freqbin_5G
= {
2728 .calTarget_freqbin_5GHT20
= {
2738 .calTarget_freqbin_5GHT40
= {
2748 .calTargetPower5G
= {
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} },
2756 { {30, 30, 28, 24} },
2757 { {30, 30, 28, 24} },
2759 .calTargetPower5GHT20
= {
2761 * 0_8_16,1-3_9-11_17-19,
2762 * 4,5,6,7,12,13,14,15,20,21,22,23
2764 { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 0, 0, 0, 0} },
2765 { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 0, 0, 0, 0} },
2766 { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 0, 0, 0, 0} },
2767 { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 0, 0, 0, 0} },
2768 { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 0, 0, 0, 0} },
2769 { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 0, 0, 0, 0} },
2770 { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 0, 0, 0, 0} },
2771 { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 0, 0, 0, 0} },
2773 .calTargetPower5GHT40
= {
2775 * 0_8_16,1-3_9-11_17-19,
2776 * 4,5,6,7,12,13,14,15,20,21,22,23
2778 { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 0, 0, 0, 0} },
2779 { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 0, 0, 0, 0} },
2780 { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 0, 0, 0, 0} },
2781 { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 0, 0, 0, 0} },
2782 { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 0, 0, 0, 0} },
2783 { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 0, 0, 0, 0} },
2784 { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 0, 0, 0, 0} },
2785 { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 0, 0, 0, 0} },
2788 0x10, 0x16, 0x18, 0x40, 0x46,
2789 0x48, 0x30, 0x36, 0x38
2793 /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
2794 /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
2795 /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
2796 /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
2797 /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0),
2798 /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
2799 /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
2800 /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
2803 /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
2804 /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
2805 /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
2806 /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
2807 /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0),
2808 /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
2809 /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
2810 /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
2814 /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
2815 /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
2816 /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
2817 /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0),
2818 /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0),
2819 /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0),
2820 /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0),
2821 /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0)
2825 /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
2826 /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
2827 /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0),
2828 /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0),
2829 /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
2830 /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
2831 /* Data[3].ctlEdges[6].bChannel */ 0xFF,
2832 /* Data[3].ctlEdges[7].bChannel */ 0xFF,
2836 /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
2837 /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
2838 /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0),
2839 /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0),
2840 /* Data[4].ctlEdges[4].bChannel */ 0xFF,
2841 /* Data[4].ctlEdges[5].bChannel */ 0xFF,
2842 /* Data[4].ctlEdges[6].bChannel */ 0xFF,
2843 /* Data[4].ctlEdges[7].bChannel */ 0xFF,
2847 /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
2848 /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0),
2849 /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0),
2850 /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
2851 /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0),
2852 /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
2853 /* Data[5].ctlEdges[6].bChannel */ 0xFF,
2854 /* Data[5].ctlEdges[7].bChannel */ 0xFF
2858 /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
2859 /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
2860 /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0),
2861 /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0),
2862 /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
2863 /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0),
2864 /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0),
2865 /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0)
2869 /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
2870 /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
2871 /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0),
2872 /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
2873 /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0),
2874 /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
2875 /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
2876 /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
2880 /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
2881 /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
2882 /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
2883 /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
2884 /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0),
2885 /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
2886 /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0),
2887 /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0)
2890 .ctlPowerData_5G
= {
2893 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2894 {60, 1}, {60, 1}, {60, 1}, {60, 0},
2899 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2900 {60, 1}, {60, 1}, {60, 1}, {60, 0},
2905 {60, 0}, {60, 1}, {60, 0}, {60, 1},
2906 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2911 {60, 0}, {60, 1}, {60, 1}, {60, 0},
2912 {60, 1}, {60, 0}, {60, 0}, {60, 0},
2917 {60, 1}, {60, 1}, {60, 1}, {60, 0},
2918 {60, 0}, {60, 0}, {60, 0}, {60, 0},
2923 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2924 {60, 1}, {60, 0}, {60, 0}, {60, 0},
2929 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2930 {60, 1}, {60, 1}, {60, 1}, {60, 1},
2935 {60, 1}, {60, 1}, {60, 0}, {60, 1},
2936 {60, 1}, {60, 1}, {60, 1}, {60, 0},
2941 {60, 1}, {60, 0}, {60, 1}, {60, 1},
2942 {60, 1}, {60, 1}, {60, 0}, {60, 1},
2949 static const struct ar9300_eeprom
*ar9300_eep_templates
[] = {
2957 static const struct ar9300_eeprom
*ar9003_eeprom_struct_find_by_id(int id
)
2959 #define N_LOOP (sizeof(ar9300_eep_templates) / sizeof(ar9300_eep_templates[0]))
2962 for (it
= 0; it
< N_LOOP
; it
++)
2963 if (ar9300_eep_templates
[it
]->templateVersion
== id
)
2964 return ar9300_eep_templates
[it
];
2970 static u16
ath9k_hw_fbin2freq(u8 fbin
, bool is2GHz
)
2972 if (fbin
== AR9300_BCHAN_UNUSED
)
2975 return (u16
) ((is2GHz
) ? (2300 + fbin
) : (4800 + 5 * fbin
));
2978 static int ath9k_hw_ar9300_check_eeprom(struct ath_hw
*ah
)
2983 static u32
ath9k_hw_ar9300_get_eeprom(struct ath_hw
*ah
,
2984 enum eeprom_param param
)
2986 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
2987 struct ar9300_base_eep_hdr
*pBase
= &eep
->baseEepHeader
;
2991 return eep
->macAddr
[0] << 8 | eep
->macAddr
[1];
2993 return eep
->macAddr
[2] << 8 | eep
->macAddr
[3];
2995 return eep
->macAddr
[4] << 8 | eep
->macAddr
[5];
2997 return le16_to_cpu(pBase
->regDmn
[0]);
2999 return le16_to_cpu(pBase
->regDmn
[1]);
3001 return pBase
->deviceCap
;
3003 return pBase
->opCapFlags
.opFlags
;
3005 return pBase
->rfSilent
;
3007 return (pBase
->txrxMask
>> 4) & 0xf;
3009 return pBase
->txrxMask
& 0xf;
3010 case EEP_DRIVE_STRENGTH
:
3011 #define AR9300_EEP_BASE_DRIV_STRENGTH 0x1
3012 return pBase
->miscConfiguration
& AR9300_EEP_BASE_DRIV_STRENGTH
;
3013 case EEP_INTERNAL_REGULATOR
:
3014 /* Bit 4 is internal regulator flag */
3015 return (pBase
->featureEnable
& 0x10) >> 4;
3017 return le32_to_cpu(pBase
->swreg
);
3019 return !!(pBase
->featureEnable
& BIT(5));
3025 static bool ar9300_eeprom_read_byte(struct ath_common
*common
, int address
,
3030 if (unlikely(!ath9k_hw_nvram_read(common
, address
/ 2, &val
)))
3033 *buffer
= (val
>> (8 * (address
% 2))) & 0xff;
3037 static bool ar9300_eeprom_read_word(struct ath_common
*common
, int address
,
3042 if (unlikely(!ath9k_hw_nvram_read(common
, address
/ 2, &val
)))
3045 buffer
[0] = val
>> 8;
3046 buffer
[1] = val
& 0xff;
3051 static bool ar9300_read_eeprom(struct ath_hw
*ah
, int address
, u8
*buffer
,
3054 struct ath_common
*common
= ath9k_hw_common(ah
);
3057 if ((address
< 0) || ((address
+ count
) / 2 > AR9300_EEPROM_SIZE
- 1)) {
3058 ath_print(common
, ATH_DBG_EEPROM
,
3059 "eeprom address not in range\n");
3064 * Since we're reading the bytes in reverse order from a little-endian
3065 * word stream, an even address means we only use the lower half of
3066 * the 16-bit word at that address
3068 if (address
% 2 == 0) {
3069 if (!ar9300_eeprom_read_byte(common
, address
--, buffer
++))
3075 for (i
= 0; i
< count
/ 2; i
++) {
3076 if (!ar9300_eeprom_read_word(common
, address
, buffer
))
3084 if (!ar9300_eeprom_read_byte(common
, address
, buffer
))
3090 ath_print(common
, ATH_DBG_EEPROM
,
3091 "unable to read eeprom region at offset %d\n", address
);
3095 static void ar9300_comp_hdr_unpack(u8
*best
, int *code
, int *reference
,
3096 int *length
, int *major
, int *minor
)
3098 unsigned long value
[4];
3104 *code
= ((value
[0] >> 5) & 0x0007);
3105 *reference
= (value
[0] & 0x001f) | ((value
[1] >> 2) & 0x0020);
3106 *length
= ((value
[1] << 4) & 0x07f0) | ((value
[2] >> 4) & 0x000f);
3107 *major
= (value
[2] & 0x000f);
3108 *minor
= (value
[3] & 0x00ff);
3111 static u16
ar9300_comp_cksum(u8
*data
, int dsize
)
3113 int it
, checksum
= 0;
3115 for (it
= 0; it
< dsize
; it
++) {
3116 checksum
+= data
[it
];
3123 static bool ar9300_uncompress_block(struct ath_hw
*ah
,
3133 struct ath_common
*common
= ath9k_hw_common(ah
);
3137 for (it
= 0; it
< size
; it
+= (length
+2)) {
3141 length
= block
[it
+1];
3144 if (length
> 0 && spot
>= 0 && spot
+length
<= mdataSize
) {
3145 ath_print(common
, ATH_DBG_EEPROM
,
3146 "Restore at %d: spot=%d "
3147 "offset=%d length=%d\n",
3148 it
, spot
, offset
, length
);
3149 memcpy(&mptr
[spot
], &block
[it
+2], length
);
3151 } else if (length
> 0) {
3152 ath_print(common
, ATH_DBG_EEPROM
,
3153 "Bad restore at %d: spot=%d "
3154 "offset=%d length=%d\n",
3155 it
, spot
, offset
, length
);
3162 static int ar9300_compress_decision(struct ath_hw
*ah
,
3167 u8
*word
, int length
, int mdata_size
)
3169 struct ath_common
*common
= ath9k_hw_common(ah
);
3171 const struct ar9300_eeprom
*eep
= NULL
;
3175 if (length
!= mdata_size
) {
3176 ath_print(common
, ATH_DBG_EEPROM
,
3177 "EEPROM structure size mismatch"
3178 "memory=%d eeprom=%d\n", mdata_size
, length
);
3181 memcpy(mptr
, (u8
*) (word
+ COMP_HDR_LEN
), length
);
3182 ath_print(common
, ATH_DBG_EEPROM
, "restored eeprom %d:"
3183 " uncompressed, length %d\n", it
, length
);
3185 case _CompressBlock
:
3186 if (reference
== 0) {
3189 eep
= ar9003_eeprom_struct_find_by_id(reference
);
3191 ath_print(common
, ATH_DBG_EEPROM
,
3192 "cant find reference eeprom"
3193 "struct %d\n", reference
);
3196 memcpy(mptr
, eep
, mdata_size
);
3198 ath_print(common
, ATH_DBG_EEPROM
,
3199 "restore eeprom %d: block, reference %d,"
3200 " length %d\n", it
, reference
, length
);
3201 ar9300_uncompress_block(ah
, mptr
, mdata_size
,
3202 (u8
*) (word
+ COMP_HDR_LEN
), length
);
3205 ath_print(common
, ATH_DBG_EEPROM
, "unknown compression"
3206 " code %d\n", code
);
3213 * Read the configuration data from the eeprom.
3214 * The data can be put in any specified memory buffer.
3216 * Returns -1 on error.
3217 * Returns address of next memory location on success.
3219 static int ar9300_eeprom_restore_internal(struct ath_hw
*ah
,
3220 u8
*mptr
, int mdata_size
)
3227 int reference
, length
, major
, minor
;
3230 u16 checksum
, mchecksum
;
3231 struct ath_common
*common
= ath9k_hw_common(ah
);
3233 word
= kzalloc(2048, GFP_KERNEL
);
3237 memcpy(mptr
, &ar9300_default
, mdata_size
);
3239 cptr
= AR9300_BASE_ADDR
;
3240 for (it
= 0; it
< MSTATE
; it
++) {
3241 if (!ar9300_read_eeprom(ah
, cptr
, word
, COMP_HDR_LEN
))
3244 if ((word
[0] == 0 && word
[1] == 0 && word
[2] == 0 &&
3245 word
[3] == 0) || (word
[0] == 0xff && word
[1] == 0xff
3246 && word
[2] == 0xff && word
[3] == 0xff))
3249 ar9300_comp_hdr_unpack(word
, &code
, &reference
,
3250 &length
, &major
, &minor
);
3251 ath_print(common
, ATH_DBG_EEPROM
,
3252 "Found block at %x: code=%d ref=%d"
3253 "length=%d major=%d minor=%d\n", cptr
, code
,
3254 reference
, length
, major
, minor
);
3255 if (length
>= 1024) {
3256 ath_print(common
, ATH_DBG_EEPROM
,
3257 "Skipping bad header\n");
3258 cptr
-= COMP_HDR_LEN
;
3263 ar9300_read_eeprom(ah
, cptr
, word
,
3264 COMP_HDR_LEN
+ osize
+ COMP_CKSUM_LEN
);
3265 checksum
= ar9300_comp_cksum(&word
[COMP_HDR_LEN
], length
);
3266 mchecksum
= word
[COMP_HDR_LEN
+ osize
] |
3267 (word
[COMP_HDR_LEN
+ osize
+ 1] << 8);
3268 ath_print(common
, ATH_DBG_EEPROM
,
3269 "checksum %x %x\n", checksum
, mchecksum
);
3270 if (checksum
== mchecksum
) {
3271 ar9300_compress_decision(ah
, it
, code
, reference
, mptr
,
3272 word
, length
, mdata_size
);
3274 ath_print(common
, ATH_DBG_EEPROM
,
3275 "skipping block with bad checksum\n");
3277 cptr
-= (COMP_HDR_LEN
+ osize
+ COMP_CKSUM_LEN
);
3289 * Restore the configuration structure by reading the eeprom.
3290 * This function destroys any existing in-memory structure
3293 static bool ath9k_hw_ar9300_fill_eeprom(struct ath_hw
*ah
)
3295 u8
*mptr
= (u8
*) &ah
->eeprom
.ar9300_eep
;
3297 if (ar9300_eeprom_restore_internal(ah
, mptr
,
3298 sizeof(struct ar9300_eeprom
)) < 0)
3304 /* XXX: review hardware docs */
3305 static int ath9k_hw_ar9300_get_eeprom_ver(struct ath_hw
*ah
)
3307 return ah
->eeprom
.ar9300_eep
.eepromVersion
;
3310 /* XXX: could be read from the eepromVersion, not sure yet */
3311 static int ath9k_hw_ar9300_get_eeprom_rev(struct ath_hw
*ah
)
3316 static u8
ath9k_hw_ar9300_get_num_ant_config(struct ath_hw
*ah
,
3317 enum ath9k_hal_freq_band freq_band
)
3322 static u32
ath9k_hw_ar9300_get_eeprom_antenna_cfg(struct ath_hw
*ah
,
3323 struct ath9k_channel
*chan
)
3328 static s32
ar9003_hw_xpa_bias_level_get(struct ath_hw
*ah
, bool is2ghz
)
3330 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
3333 return eep
->modalHeader2G
.xpaBiasLvl
;
3335 return eep
->modalHeader5G
.xpaBiasLvl
;
3338 static void ar9003_hw_xpa_bias_level_apply(struct ath_hw
*ah
, bool is2ghz
)
3340 int bias
= ar9003_hw_xpa_bias_level_get(ah
, is2ghz
);
3341 REG_RMW_FIELD(ah
, AR_CH0_TOP
, AR_CH0_TOP_XPABIASLVL
, bias
);
3342 REG_RMW_FIELD(ah
, AR_CH0_THERM
, AR_CH0_THERM_XPABIASLVL_MSB
, bias
>> 2);
3343 REG_RMW_FIELD(ah
, AR_CH0_THERM
, AR_CH0_THERM_XPASHORT2GND
, 1);
3346 static u32
ar9003_hw_ant_ctrl_common_get(struct ath_hw
*ah
, bool is2ghz
)
3348 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
3352 val
= eep
->modalHeader2G
.antCtrlCommon
;
3354 val
= eep
->modalHeader5G
.antCtrlCommon
;
3355 return le32_to_cpu(val
);
3358 static u32
ar9003_hw_ant_ctrl_common_2_get(struct ath_hw
*ah
, bool is2ghz
)
3360 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
3364 val
= eep
->modalHeader2G
.antCtrlCommon2
;
3366 val
= eep
->modalHeader5G
.antCtrlCommon2
;
3367 return le32_to_cpu(val
);
3370 static u16
ar9003_hw_ant_ctrl_chain_get(struct ath_hw
*ah
,
3374 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
3377 if (chain
>= 0 && chain
< AR9300_MAX_CHAINS
) {
3379 val
= eep
->modalHeader2G
.antCtrlChain
[chain
];
3381 val
= eep
->modalHeader5G
.antCtrlChain
[chain
];
3384 return le16_to_cpu(val
);
3387 static void ar9003_hw_ant_ctrl_apply(struct ath_hw
*ah
, bool is2ghz
)
3389 u32 value
= ar9003_hw_ant_ctrl_common_get(ah
, is2ghz
);
3390 REG_RMW_FIELD(ah
, AR_PHY_SWITCH_COM
, AR_SWITCH_TABLE_COM_ALL
, value
);
3392 value
= ar9003_hw_ant_ctrl_common_2_get(ah
, is2ghz
);
3393 REG_RMW_FIELD(ah
, AR_PHY_SWITCH_COM_2
, AR_SWITCH_TABLE_COM2_ALL
, value
);
3395 value
= ar9003_hw_ant_ctrl_chain_get(ah
, 0, is2ghz
);
3396 REG_RMW_FIELD(ah
, AR_PHY_SWITCH_CHAIN_0
, AR_SWITCH_TABLE_ALL
, value
);
3398 value
= ar9003_hw_ant_ctrl_chain_get(ah
, 1, is2ghz
);
3399 REG_RMW_FIELD(ah
, AR_PHY_SWITCH_CHAIN_1
, AR_SWITCH_TABLE_ALL
, value
);
3401 value
= ar9003_hw_ant_ctrl_chain_get(ah
, 2, is2ghz
);
3402 REG_RMW_FIELD(ah
, AR_PHY_SWITCH_CHAIN_2
, AR_SWITCH_TABLE_ALL
, value
);
3405 static void ar9003_hw_drive_strength_apply(struct ath_hw
*ah
)
3410 drive_strength
= ath9k_hw_ar9300_get_eeprom(ah
, EEP_DRIVE_STRENGTH
);
3412 if (!drive_strength
)
3415 reg
= REG_READ(ah
, AR_PHY_65NM_CH0_BIAS1
);
3423 REG_WRITE(ah
, AR_PHY_65NM_CH0_BIAS1
, reg
);
3425 reg
= REG_READ(ah
, AR_PHY_65NM_CH0_BIAS2
);
3436 REG_WRITE(ah
, AR_PHY_65NM_CH0_BIAS2
, reg
);
3438 reg
= REG_READ(ah
, AR_PHY_65NM_CH0_BIAS4
);
3443 REG_WRITE(ah
, AR_PHY_65NM_CH0_BIAS4
, reg
);
3446 static void ar9003_hw_internal_regulator_apply(struct ath_hw
*ah
)
3448 int internal_regulator
=
3449 ath9k_hw_ar9300_get_eeprom(ah
, EEP_INTERNAL_REGULATOR
);
3451 if (internal_regulator
) {
3452 /* Internal regulator is ON. Write swreg register. */
3453 int swreg
= ath9k_hw_ar9300_get_eeprom(ah
, EEP_SWREG
);
3454 REG_WRITE(ah
, AR_RTC_REG_CONTROL1
,
3455 REG_READ(ah
, AR_RTC_REG_CONTROL1
) &
3456 (~AR_RTC_REG_CONTROL1_SWREG_PROGRAM
));
3457 REG_WRITE(ah
, AR_RTC_REG_CONTROL0
, swreg
);
3458 /* Set REG_CONTROL1.SWREG_PROGRAM */
3459 REG_WRITE(ah
, AR_RTC_REG_CONTROL1
,
3461 AR_RTC_REG_CONTROL1
) |
3462 AR_RTC_REG_CONTROL1_SWREG_PROGRAM
);
3464 REG_WRITE(ah
, AR_RTC_SLEEP_CLK
,
3467 AR_RTC_FORCE_SWREG_PRD
));
3471 static void ath9k_hw_ar9300_set_board_values(struct ath_hw
*ah
,
3472 struct ath9k_channel
*chan
)
3474 ar9003_hw_xpa_bias_level_apply(ah
, IS_CHAN_2GHZ(chan
));
3475 ar9003_hw_ant_ctrl_apply(ah
, IS_CHAN_2GHZ(chan
));
3476 ar9003_hw_drive_strength_apply(ah
);
3477 ar9003_hw_internal_regulator_apply(ah
);
3480 static void ath9k_hw_ar9300_set_addac(struct ath_hw
*ah
,
3481 struct ath9k_channel
*chan
)
3486 * Returns the interpolated y value corresponding to the specified x value
3487 * from the np ordered pairs of data (px,py).
3488 * The pairs do not have to be in any order.
3489 * If the specified x value is less than any of the px,
3490 * the returned y value is equal to the py for the lowest px.
3491 * If the specified x value is greater than any of the px,
3492 * the returned y value is equal to the py for the highest px.
3494 static int ar9003_hw_power_interpolate(int32_t x
,
3495 int32_t *px
, int32_t *py
, u_int16_t np
)
3498 int lx
= 0, ly
= 0, lhave
= 0;
3499 int hx
= 0, hy
= 0, hhave
= 0;
3506 /* identify best lower and higher x calibration measurement */
3507 for (ip
= 0; ip
< np
; ip
++) {
3510 /* this measurement is higher than our desired x */
3512 if (!hhave
|| dx
> (x
- hx
)) {
3513 /* new best higher x measurement */
3519 /* this measurement is lower than our desired x */
3521 if (!lhave
|| dx
< (x
- lx
)) {
3522 /* new best lower x measurement */
3530 /* the low x is good */
3532 /* so is the high x */
3534 /* they're the same, so just pick one */
3537 else /* interpolate */
3538 y
= ly
+ (((x
- lx
) * (hy
- ly
)) / (hx
- lx
));
3539 } else /* only low is good, use it */
3541 } else if (hhave
) /* only high is good, use it */
3543 else /* nothing is good,this should never happen unless np=0, ???? */
3548 static u8
ar9003_hw_eeprom_get_tgt_pwr(struct ath_hw
*ah
,
3549 u16 rateIndex
, u16 freq
, bool is2GHz
)
3552 s32 targetPowerArray
[AR9300_NUM_5G_20_TARGET_POWERS
];
3553 s32 freqArray
[AR9300_NUM_5G_20_TARGET_POWERS
];
3554 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
3555 struct cal_tgt_pow_legacy
*pEepromTargetPwr
;
3559 numPiers
= AR9300_NUM_2G_20_TARGET_POWERS
;
3560 pEepromTargetPwr
= eep
->calTargetPower2G
;
3561 pFreqBin
= eep
->calTarget_freqbin_2G
;
3563 numPiers
= AR9300_NUM_5G_20_TARGET_POWERS
;
3564 pEepromTargetPwr
= eep
->calTargetPower5G
;
3565 pFreqBin
= eep
->calTarget_freqbin_5G
;
3569 * create array of channels and targetpower from
3570 * targetpower piers stored on eeprom
3572 for (i
= 0; i
< numPiers
; i
++) {
3573 freqArray
[i
] = FBIN2FREQ(pFreqBin
[i
], is2GHz
);
3574 targetPowerArray
[i
] = pEepromTargetPwr
[i
].tPow2x
[rateIndex
];
3577 /* interpolate to get target power for given frequency */
3578 return (u8
) ar9003_hw_power_interpolate((s32
) freq
,
3580 targetPowerArray
, numPiers
);
3583 static u8
ar9003_hw_eeprom_get_ht20_tgt_pwr(struct ath_hw
*ah
,
3585 u16 freq
, bool is2GHz
)
3588 s32 targetPowerArray
[AR9300_NUM_5G_20_TARGET_POWERS
];
3589 s32 freqArray
[AR9300_NUM_5G_20_TARGET_POWERS
];
3590 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
3591 struct cal_tgt_pow_ht
*pEepromTargetPwr
;
3595 numPiers
= AR9300_NUM_2G_20_TARGET_POWERS
;
3596 pEepromTargetPwr
= eep
->calTargetPower2GHT20
;
3597 pFreqBin
= eep
->calTarget_freqbin_2GHT20
;
3599 numPiers
= AR9300_NUM_5G_20_TARGET_POWERS
;
3600 pEepromTargetPwr
= eep
->calTargetPower5GHT20
;
3601 pFreqBin
= eep
->calTarget_freqbin_5GHT20
;
3605 * create array of channels and targetpower
3606 * from targetpower piers stored on eeprom
3608 for (i
= 0; i
< numPiers
; i
++) {
3609 freqArray
[i
] = FBIN2FREQ(pFreqBin
[i
], is2GHz
);
3610 targetPowerArray
[i
] = pEepromTargetPwr
[i
].tPow2x
[rateIndex
];
3613 /* interpolate to get target power for given frequency */
3614 return (u8
) ar9003_hw_power_interpolate((s32
) freq
,
3616 targetPowerArray
, numPiers
);
3619 static u8
ar9003_hw_eeprom_get_ht40_tgt_pwr(struct ath_hw
*ah
,
3621 u16 freq
, bool is2GHz
)
3624 s32 targetPowerArray
[AR9300_NUM_5G_40_TARGET_POWERS
];
3625 s32 freqArray
[AR9300_NUM_5G_40_TARGET_POWERS
];
3626 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
3627 struct cal_tgt_pow_ht
*pEepromTargetPwr
;
3631 numPiers
= AR9300_NUM_2G_40_TARGET_POWERS
;
3632 pEepromTargetPwr
= eep
->calTargetPower2GHT40
;
3633 pFreqBin
= eep
->calTarget_freqbin_2GHT40
;
3635 numPiers
= AR9300_NUM_5G_40_TARGET_POWERS
;
3636 pEepromTargetPwr
= eep
->calTargetPower5GHT40
;
3637 pFreqBin
= eep
->calTarget_freqbin_5GHT40
;
3641 * create array of channels and targetpower from
3642 * targetpower piers stored on eeprom
3644 for (i
= 0; i
< numPiers
; i
++) {
3645 freqArray
[i
] = FBIN2FREQ(pFreqBin
[i
], is2GHz
);
3646 targetPowerArray
[i
] = pEepromTargetPwr
[i
].tPow2x
[rateIndex
];
3649 /* interpolate to get target power for given frequency */
3650 return (u8
) ar9003_hw_power_interpolate((s32
) freq
,
3652 targetPowerArray
, numPiers
);
3655 static u8
ar9003_hw_eeprom_get_cck_tgt_pwr(struct ath_hw
*ah
,
3656 u16 rateIndex
, u16 freq
)
3658 u16 numPiers
= AR9300_NUM_2G_CCK_TARGET_POWERS
, i
;
3659 s32 targetPowerArray
[AR9300_NUM_2G_CCK_TARGET_POWERS
];
3660 s32 freqArray
[AR9300_NUM_2G_CCK_TARGET_POWERS
];
3661 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
3662 struct cal_tgt_pow_legacy
*pEepromTargetPwr
= eep
->calTargetPowerCck
;
3663 u8
*pFreqBin
= eep
->calTarget_freqbin_Cck
;
3666 * create array of channels and targetpower from
3667 * targetpower piers stored on eeprom
3669 for (i
= 0; i
< numPiers
; i
++) {
3670 freqArray
[i
] = FBIN2FREQ(pFreqBin
[i
], 1);
3671 targetPowerArray
[i
] = pEepromTargetPwr
[i
].tPow2x
[rateIndex
];
3674 /* interpolate to get target power for given frequency */
3675 return (u8
) ar9003_hw_power_interpolate((s32
) freq
,
3677 targetPowerArray
, numPiers
);
3680 /* Set tx power registers to array of values passed in */
3681 static int ar9003_hw_tx_power_regwrite(struct ath_hw
*ah
, u8
* pPwrArray
)
3683 #define POW_SM(_r, _s) (((_r) & 0x3f) << (_s))
3684 /* make sure forced gain is not set */
3685 REG_WRITE(ah
, 0xa458, 0);
3687 /* Write the OFDM power per rate set */
3689 /* 6 (LSB), 9, 12, 18 (MSB) */
3690 REG_WRITE(ah
, 0xa3c0,
3691 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_6_24
], 24) |
3692 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_6_24
], 16) |
3693 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_6_24
], 8) |
3694 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_6_24
], 0));
3696 /* 24 (LSB), 36, 48, 54 (MSB) */
3697 REG_WRITE(ah
, 0xa3c4,
3698 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_54
], 24) |
3699 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_48
], 16) |
3700 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_36
], 8) |
3701 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_6_24
], 0));
3703 /* Write the CCK power per rate set */
3705 /* 1L (LSB), reserved, 2L, 2S (MSB) */
3706 REG_WRITE(ah
, 0xa3c8,
3707 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_1L_5L
], 24) |
3708 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_1L_5L
], 16) |
3709 /* POW_SM(txPowerTimes2, 8) | this is reserved for AR9003 */
3710 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_1L_5L
], 0));
3712 /* 5.5L (LSB), 5.5S, 11L, 11S (MSB) */
3713 REG_WRITE(ah
, 0xa3cc,
3714 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_11S
], 24) |
3715 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_11L
], 16) |
3716 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_5S
], 8) |
3717 POW_SM(pPwrArray
[ALL_TARGET_LEGACY_1L_5L
], 0)
3720 /* Write the HT20 power per rate set */
3722 /* 0/8/16 (LSB), 1-3/9-11/17-19, 4, 5 (MSB) */
3723 REG_WRITE(ah
, 0xa3d0,
3724 POW_SM(pPwrArray
[ALL_TARGET_HT20_5
], 24) |
3725 POW_SM(pPwrArray
[ALL_TARGET_HT20_4
], 16) |
3726 POW_SM(pPwrArray
[ALL_TARGET_HT20_1_3_9_11_17_19
], 8) |
3727 POW_SM(pPwrArray
[ALL_TARGET_HT20_0_8_16
], 0)
3730 /* 6 (LSB), 7, 12, 13 (MSB) */
3731 REG_WRITE(ah
, 0xa3d4,
3732 POW_SM(pPwrArray
[ALL_TARGET_HT20_13
], 24) |
3733 POW_SM(pPwrArray
[ALL_TARGET_HT20_12
], 16) |
3734 POW_SM(pPwrArray
[ALL_TARGET_HT20_7
], 8) |
3735 POW_SM(pPwrArray
[ALL_TARGET_HT20_6
], 0)
3738 /* 14 (LSB), 15, 20, 21 */
3739 REG_WRITE(ah
, 0xa3e4,
3740 POW_SM(pPwrArray
[ALL_TARGET_HT20_21
], 24) |
3741 POW_SM(pPwrArray
[ALL_TARGET_HT20_20
], 16) |
3742 POW_SM(pPwrArray
[ALL_TARGET_HT20_15
], 8) |
3743 POW_SM(pPwrArray
[ALL_TARGET_HT20_14
], 0)
3746 /* Mixed HT20 and HT40 rates */
3748 /* HT20 22 (LSB), HT20 23, HT40 22, HT40 23 (MSB) */
3749 REG_WRITE(ah
, 0xa3e8,
3750 POW_SM(pPwrArray
[ALL_TARGET_HT40_23
], 24) |
3751 POW_SM(pPwrArray
[ALL_TARGET_HT40_22
], 16) |
3752 POW_SM(pPwrArray
[ALL_TARGET_HT20_23
], 8) |
3753 POW_SM(pPwrArray
[ALL_TARGET_HT20_22
], 0)
3757 * Write the HT40 power per rate set
3758 * correct PAR difference between HT40 and HT20/LEGACY
3759 * 0/8/16 (LSB), 1-3/9-11/17-19, 4, 5 (MSB)
3761 REG_WRITE(ah
, 0xa3d8,
3762 POW_SM(pPwrArray
[ALL_TARGET_HT40_5
], 24) |
3763 POW_SM(pPwrArray
[ALL_TARGET_HT40_4
], 16) |
3764 POW_SM(pPwrArray
[ALL_TARGET_HT40_1_3_9_11_17_19
], 8) |
3765 POW_SM(pPwrArray
[ALL_TARGET_HT40_0_8_16
], 0)
3768 /* 6 (LSB), 7, 12, 13 (MSB) */
3769 REG_WRITE(ah
, 0xa3dc,
3770 POW_SM(pPwrArray
[ALL_TARGET_HT40_13
], 24) |
3771 POW_SM(pPwrArray
[ALL_TARGET_HT40_12
], 16) |
3772 POW_SM(pPwrArray
[ALL_TARGET_HT40_7
], 8) |
3773 POW_SM(pPwrArray
[ALL_TARGET_HT40_6
], 0)
3776 /* 14 (LSB), 15, 20, 21 */
3777 REG_WRITE(ah
, 0xa3ec,
3778 POW_SM(pPwrArray
[ALL_TARGET_HT40_21
], 24) |
3779 POW_SM(pPwrArray
[ALL_TARGET_HT40_20
], 16) |
3780 POW_SM(pPwrArray
[ALL_TARGET_HT40_15
], 8) |
3781 POW_SM(pPwrArray
[ALL_TARGET_HT40_14
], 0)
3788 static void ar9003_hw_set_target_power_eeprom(struct ath_hw
*ah
, u16 freq
,
3789 u8
*targetPowerValT2
)
3791 /* XXX: hard code for now, need to get from eeprom struct */
3792 u8 ht40PowerIncForPdadc
= 0;
3793 bool is2GHz
= false;
3795 struct ath_common
*common
= ath9k_hw_common(ah
);
3800 targetPowerValT2
[ALL_TARGET_LEGACY_6_24
] =
3801 ar9003_hw_eeprom_get_tgt_pwr(ah
, LEGACY_TARGET_RATE_6_24
, freq
,
3803 targetPowerValT2
[ALL_TARGET_LEGACY_36
] =
3804 ar9003_hw_eeprom_get_tgt_pwr(ah
, LEGACY_TARGET_RATE_36
, freq
,
3806 targetPowerValT2
[ALL_TARGET_LEGACY_48
] =
3807 ar9003_hw_eeprom_get_tgt_pwr(ah
, LEGACY_TARGET_RATE_48
, freq
,
3809 targetPowerValT2
[ALL_TARGET_LEGACY_54
] =
3810 ar9003_hw_eeprom_get_tgt_pwr(ah
, LEGACY_TARGET_RATE_54
, freq
,
3812 targetPowerValT2
[ALL_TARGET_LEGACY_1L_5L
] =
3813 ar9003_hw_eeprom_get_cck_tgt_pwr(ah
, LEGACY_TARGET_RATE_1L_5L
,
3815 targetPowerValT2
[ALL_TARGET_LEGACY_5S
] =
3816 ar9003_hw_eeprom_get_cck_tgt_pwr(ah
, LEGACY_TARGET_RATE_5S
, freq
);
3817 targetPowerValT2
[ALL_TARGET_LEGACY_11L
] =
3818 ar9003_hw_eeprom_get_cck_tgt_pwr(ah
, LEGACY_TARGET_RATE_11L
, freq
);
3819 targetPowerValT2
[ALL_TARGET_LEGACY_11S
] =
3820 ar9003_hw_eeprom_get_cck_tgt_pwr(ah
, LEGACY_TARGET_RATE_11S
, freq
);
3821 targetPowerValT2
[ALL_TARGET_HT20_0_8_16
] =
3822 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_0_8_16
, freq
,
3824 targetPowerValT2
[ALL_TARGET_HT20_1_3_9_11_17_19
] =
3825 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_1_3_9_11_17_19
,
3827 targetPowerValT2
[ALL_TARGET_HT20_4
] =
3828 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_4
, freq
,
3830 targetPowerValT2
[ALL_TARGET_HT20_5
] =
3831 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_5
, freq
,
3833 targetPowerValT2
[ALL_TARGET_HT20_6
] =
3834 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_6
, freq
,
3836 targetPowerValT2
[ALL_TARGET_HT20_7
] =
3837 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_7
, freq
,
3839 targetPowerValT2
[ALL_TARGET_HT20_12
] =
3840 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_12
, freq
,
3842 targetPowerValT2
[ALL_TARGET_HT20_13
] =
3843 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_13
, freq
,
3845 targetPowerValT2
[ALL_TARGET_HT20_14
] =
3846 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_14
, freq
,
3848 targetPowerValT2
[ALL_TARGET_HT20_15
] =
3849 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_15
, freq
,
3851 targetPowerValT2
[ALL_TARGET_HT20_20
] =
3852 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_20
, freq
,
3854 targetPowerValT2
[ALL_TARGET_HT20_21
] =
3855 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_21
, freq
,
3857 targetPowerValT2
[ALL_TARGET_HT20_22
] =
3858 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_22
, freq
,
3860 targetPowerValT2
[ALL_TARGET_HT20_23
] =
3861 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah
, HT_TARGET_RATE_23
, freq
,
3863 targetPowerValT2
[ALL_TARGET_HT40_0_8_16
] =
3864 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_0_8_16
, freq
,
3865 is2GHz
) + ht40PowerIncForPdadc
;
3866 targetPowerValT2
[ALL_TARGET_HT40_1_3_9_11_17_19
] =
3867 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_1_3_9_11_17_19
,
3869 is2GHz
) + ht40PowerIncForPdadc
;
3870 targetPowerValT2
[ALL_TARGET_HT40_4
] =
3871 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_4
, freq
,
3872 is2GHz
) + ht40PowerIncForPdadc
;
3873 targetPowerValT2
[ALL_TARGET_HT40_5
] =
3874 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_5
, freq
,
3875 is2GHz
) + ht40PowerIncForPdadc
;
3876 targetPowerValT2
[ALL_TARGET_HT40_6
] =
3877 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_6
, freq
,
3878 is2GHz
) + ht40PowerIncForPdadc
;
3879 targetPowerValT2
[ALL_TARGET_HT40_7
] =
3880 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_7
, freq
,
3881 is2GHz
) + ht40PowerIncForPdadc
;
3882 targetPowerValT2
[ALL_TARGET_HT40_12
] =
3883 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_12
, freq
,
3884 is2GHz
) + ht40PowerIncForPdadc
;
3885 targetPowerValT2
[ALL_TARGET_HT40_13
] =
3886 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_13
, freq
,
3887 is2GHz
) + ht40PowerIncForPdadc
;
3888 targetPowerValT2
[ALL_TARGET_HT40_14
] =
3889 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_14
, freq
,
3890 is2GHz
) + ht40PowerIncForPdadc
;
3891 targetPowerValT2
[ALL_TARGET_HT40_15
] =
3892 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_15
, freq
,
3893 is2GHz
) + ht40PowerIncForPdadc
;
3894 targetPowerValT2
[ALL_TARGET_HT40_20
] =
3895 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_20
, freq
,
3896 is2GHz
) + ht40PowerIncForPdadc
;
3897 targetPowerValT2
[ALL_TARGET_HT40_21
] =
3898 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_21
, freq
,
3899 is2GHz
) + ht40PowerIncForPdadc
;
3900 targetPowerValT2
[ALL_TARGET_HT40_22
] =
3901 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_22
, freq
,
3902 is2GHz
) + ht40PowerIncForPdadc
;
3903 targetPowerValT2
[ALL_TARGET_HT40_23
] =
3904 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah
, HT_TARGET_RATE_23
, freq
,
3905 is2GHz
) + ht40PowerIncForPdadc
;
3907 while (i
< ar9300RateSize
) {
3908 ath_print(common
, ATH_DBG_EEPROM
,
3909 "TPC[%02d] 0x%08x ", i
, targetPowerValT2
[i
]);
3912 ath_print(common
, ATH_DBG_EEPROM
,
3913 "TPC[%02d] 0x%08x ", i
, targetPowerValT2
[i
]);
3916 ath_print(common
, ATH_DBG_EEPROM
,
3917 "TPC[%02d] 0x%08x ", i
, targetPowerValT2
[i
]);
3920 ath_print(common
, ATH_DBG_EEPROM
,
3921 "TPC[%02d] 0x%08x\n", i
, targetPowerValT2
[i
]);
3926 static int ar9003_hw_cal_pier_get(struct ath_hw
*ah
,
3932 int *ptemperature
, int *pvoltage
)
3935 struct ar9300_cal_data_per_freq_op_loop
*pCalPierStruct
;
3937 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
3938 struct ath_common
*common
= ath9k_hw_common(ah
);
3940 if (ichain
>= AR9300_MAX_CHAINS
) {
3941 ath_print(common
, ATH_DBG_EEPROM
,
3942 "Invalid chain index, must be less than %d\n",
3947 if (mode
) { /* 5GHz */
3948 if (ipier
>= AR9300_NUM_5G_CAL_PIERS
) {
3949 ath_print(common
, ATH_DBG_EEPROM
,
3950 "Invalid 5GHz cal pier index, must "
3951 "be less than %d\n",
3952 AR9300_NUM_5G_CAL_PIERS
);
3955 pCalPier
= &(eep
->calFreqPier5G
[ipier
]);
3956 pCalPierStruct
= &(eep
->calPierData5G
[ichain
][ipier
]);
3959 if (ipier
>= AR9300_NUM_2G_CAL_PIERS
) {
3960 ath_print(common
, ATH_DBG_EEPROM
,
3961 "Invalid 2GHz cal pier index, must "
3962 "be less than %d\n", AR9300_NUM_2G_CAL_PIERS
);
3966 pCalPier
= &(eep
->calFreqPier2G
[ipier
]);
3967 pCalPierStruct
= &(eep
->calPierData2G
[ichain
][ipier
]);
3971 *pfrequency
= FBIN2FREQ(*pCalPier
, is2GHz
);
3972 *pcorrection
= pCalPierStruct
->refPower
;
3973 *ptemperature
= pCalPierStruct
->tempMeas
;
3974 *pvoltage
= pCalPierStruct
->voltMeas
;
3979 static int ar9003_hw_power_control_override(struct ath_hw
*ah
,
3982 int *voltage
, int *temperature
)
3985 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
3987 REG_RMW(ah
, AR_PHY_TPC_11_B0
,
3988 (correction
[0] << AR_PHY_TPC_OLPC_GAIN_DELTA_S
),
3989 AR_PHY_TPC_OLPC_GAIN_DELTA
);
3990 REG_RMW(ah
, AR_PHY_TPC_11_B1
,
3991 (correction
[1] << AR_PHY_TPC_OLPC_GAIN_DELTA_S
),
3992 AR_PHY_TPC_OLPC_GAIN_DELTA
);
3993 REG_RMW(ah
, AR_PHY_TPC_11_B2
,
3994 (correction
[2] << AR_PHY_TPC_OLPC_GAIN_DELTA_S
),
3995 AR_PHY_TPC_OLPC_GAIN_DELTA
);
3997 /* enable open loop power control on chip */
3998 REG_RMW(ah
, AR_PHY_TPC_6_B0
,
3999 (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S
),
4000 AR_PHY_TPC_6_ERROR_EST_MODE
);
4001 REG_RMW(ah
, AR_PHY_TPC_6_B1
,
4002 (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S
),
4003 AR_PHY_TPC_6_ERROR_EST_MODE
);
4004 REG_RMW(ah
, AR_PHY_TPC_6_B2
,
4005 (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S
),
4006 AR_PHY_TPC_6_ERROR_EST_MODE
);
4009 * enable temperature compensation
4010 * Need to use register names
4012 if (frequency
< 4000)
4013 tempSlope
= eep
->modalHeader2G
.tempSlope
;
4015 tempSlope
= eep
->modalHeader5G
.tempSlope
;
4017 REG_RMW_FIELD(ah
, AR_PHY_TPC_19
, AR_PHY_TPC_19_ALPHA_THERM
, tempSlope
);
4018 REG_RMW_FIELD(ah
, AR_PHY_TPC_18
, AR_PHY_TPC_18_THERM_CAL_VALUE
,
4024 /* Apply the recorded correction values. */
4025 static int ar9003_hw_calibration_apply(struct ath_hw
*ah
, int frequency
)
4027 int ichain
, ipier
, npier
;
4029 int lfrequency
[AR9300_MAX_CHAINS
],
4030 lcorrection
[AR9300_MAX_CHAINS
],
4031 ltemperature
[AR9300_MAX_CHAINS
], lvoltage
[AR9300_MAX_CHAINS
];
4032 int hfrequency
[AR9300_MAX_CHAINS
],
4033 hcorrection
[AR9300_MAX_CHAINS
],
4034 htemperature
[AR9300_MAX_CHAINS
], hvoltage
[AR9300_MAX_CHAINS
];
4036 int correction
[AR9300_MAX_CHAINS
],
4037 voltage
[AR9300_MAX_CHAINS
], temperature
[AR9300_MAX_CHAINS
];
4038 int pfrequency
, pcorrection
, ptemperature
, pvoltage
;
4039 struct ath_common
*common
= ath9k_hw_common(ah
);
4041 mode
= (frequency
>= 4000);
4043 npier
= AR9300_NUM_5G_CAL_PIERS
;
4045 npier
= AR9300_NUM_2G_CAL_PIERS
;
4047 for (ichain
= 0; ichain
< AR9300_MAX_CHAINS
; ichain
++) {
4048 lfrequency
[ichain
] = 0;
4049 hfrequency
[ichain
] = 100000;
4051 /* identify best lower and higher frequency calibration measurement */
4052 for (ichain
= 0; ichain
< AR9300_MAX_CHAINS
; ichain
++) {
4053 for (ipier
= 0; ipier
< npier
; ipier
++) {
4054 if (!ar9003_hw_cal_pier_get(ah
, mode
, ipier
, ichain
,
4055 &pfrequency
, &pcorrection
,
4056 &ptemperature
, &pvoltage
)) {
4057 fdiff
= frequency
- pfrequency
;
4060 * this measurement is higher than
4061 * our desired frequency
4064 if (hfrequency
[ichain
] <= 0 ||
4065 hfrequency
[ichain
] >= 100000 ||
4067 (frequency
- hfrequency
[ichain
])) {
4070 * frequency measurement
4072 hfrequency
[ichain
] = pfrequency
;
4073 hcorrection
[ichain
] =
4075 htemperature
[ichain
] =
4077 hvoltage
[ichain
] = pvoltage
;
4081 if (lfrequency
[ichain
] <= 0
4083 (frequency
- lfrequency
[ichain
])) {
4086 * frequency measurement
4088 lfrequency
[ichain
] = pfrequency
;
4089 lcorrection
[ichain
] =
4091 ltemperature
[ichain
] =
4093 lvoltage
[ichain
] = pvoltage
;
4101 for (ichain
= 0; ichain
< AR9300_MAX_CHAINS
; ichain
++) {
4102 ath_print(common
, ATH_DBG_EEPROM
,
4103 "ch=%d f=%d low=%d %d h=%d %d\n",
4104 ichain
, frequency
, lfrequency
[ichain
],
4105 lcorrection
[ichain
], hfrequency
[ichain
],
4106 hcorrection
[ichain
]);
4107 /* they're the same, so just pick one */
4108 if (hfrequency
[ichain
] == lfrequency
[ichain
]) {
4109 correction
[ichain
] = lcorrection
[ichain
];
4110 voltage
[ichain
] = lvoltage
[ichain
];
4111 temperature
[ichain
] = ltemperature
[ichain
];
4113 /* the low frequency is good */
4114 else if (frequency
- lfrequency
[ichain
] < 1000) {
4115 /* so is the high frequency, interpolate */
4116 if (hfrequency
[ichain
] - frequency
< 1000) {
4118 correction
[ichain
] = lcorrection
[ichain
] +
4119 (((frequency
- lfrequency
[ichain
]) *
4120 (hcorrection
[ichain
] -
4121 lcorrection
[ichain
])) /
4122 (hfrequency
[ichain
] - lfrequency
[ichain
]));
4124 temperature
[ichain
] = ltemperature
[ichain
] +
4125 (((frequency
- lfrequency
[ichain
]) *
4126 (htemperature
[ichain
] -
4127 ltemperature
[ichain
])) /
4128 (hfrequency
[ichain
] - lfrequency
[ichain
]));
4133 lfrequency
[ichain
]) * (hvoltage
[ichain
] -
4135 / (hfrequency
[ichain
] -
4136 lfrequency
[ichain
]));
4138 /* only low is good, use it */
4140 correction
[ichain
] = lcorrection
[ichain
];
4141 temperature
[ichain
] = ltemperature
[ichain
];
4142 voltage
[ichain
] = lvoltage
[ichain
];
4145 /* only high is good, use it */
4146 else if (hfrequency
[ichain
] - frequency
< 1000) {
4147 correction
[ichain
] = hcorrection
[ichain
];
4148 temperature
[ichain
] = htemperature
[ichain
];
4149 voltage
[ichain
] = hvoltage
[ichain
];
4150 } else { /* nothing is good, presume 0???? */
4151 correction
[ichain
] = 0;
4152 temperature
[ichain
] = 0;
4153 voltage
[ichain
] = 0;
4157 ar9003_hw_power_control_override(ah
, frequency
, correction
, voltage
,
4160 ath_print(common
, ATH_DBG_EEPROM
,
4161 "for frequency=%d, calibration correction = %d %d %d\n",
4162 frequency
, correction
[0], correction
[1], correction
[2]);
4167 static u16
ar9003_hw_get_direct_edge_power(struct ar9300_eeprom
*eep
,
4172 struct cal_ctl_data_2g
*ctl_2g
= eep
->ctlPowerData_2G
;
4173 struct cal_ctl_data_5g
*ctl_5g
= eep
->ctlPowerData_5G
;
4176 return ctl_2g
[idx
].ctlEdges
[edge
].tPower
;
4178 return ctl_5g
[idx
].ctlEdges
[edge
].tPower
;
4181 static u16
ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom
*eep
,
4187 struct cal_ctl_data_2g
*ctl_2g
= eep
->ctlPowerData_2G
;
4188 struct cal_ctl_data_5g
*ctl_5g
= eep
->ctlPowerData_5G
;
4190 u8
*ctl_freqbin
= is2GHz
?
4191 &eep
->ctl_freqbin_2G
[idx
][0] :
4192 &eep
->ctl_freqbin_5G
[idx
][0];
4195 if (ath9k_hw_fbin2freq(ctl_freqbin
[edge
- 1], 1) < freq
&&
4196 ctl_2g
[idx
].ctlEdges
[edge
- 1].flag
)
4197 return ctl_2g
[idx
].ctlEdges
[edge
- 1].tPower
;
4199 if (ath9k_hw_fbin2freq(ctl_freqbin
[edge
- 1], 0) < freq
&&
4200 ctl_5g
[idx
].ctlEdges
[edge
- 1].flag
)
4201 return ctl_5g
[idx
].ctlEdges
[edge
- 1].tPower
;
4204 return AR9300_MAX_RATE_POWER
;
4208 * Find the maximum conformance test limit for the given channel and CTL info
4210 static u16
ar9003_hw_get_max_edge_power(struct ar9300_eeprom
*eep
,
4211 u16 freq
, int idx
, bool is2GHz
)
4213 u16 twiceMaxEdgePower
= AR9300_MAX_RATE_POWER
;
4214 u8
*ctl_freqbin
= is2GHz
?
4215 &eep
->ctl_freqbin_2G
[idx
][0] :
4216 &eep
->ctl_freqbin_5G
[idx
][0];
4217 u16 num_edges
= is2GHz
?
4218 AR9300_NUM_BAND_EDGES_2G
: AR9300_NUM_BAND_EDGES_5G
;
4221 /* Get the edge power */
4223 (edge
< num_edges
) && (ctl_freqbin
[edge
] != AR9300_BCHAN_UNUSED
);
4226 * If there's an exact channel match or an inband flag set
4227 * on the lower channel use the given rdEdgePower
4229 if (freq
== ath9k_hw_fbin2freq(ctl_freqbin
[edge
], is2GHz
)) {
4231 ar9003_hw_get_direct_edge_power(eep
, idx
,
4234 } else if ((edge
> 0) &&
4235 (freq
< ath9k_hw_fbin2freq(ctl_freqbin
[edge
],
4238 ar9003_hw_get_indirect_edge_power(eep
, idx
,
4242 * Leave loop - no more affecting edges possible in
4243 * this monotonic increasing list
4248 return twiceMaxEdgePower
;
4251 static void ar9003_hw_set_power_per_rate_table(struct ath_hw
*ah
,
4252 struct ath9k_channel
*chan
,
4253 u8
*pPwrArray
, u16 cfgCtl
,
4254 u8 twiceAntennaReduction
,
4255 u8 twiceMaxRegulatoryPower
,
4258 struct ath_regulatory
*regulatory
= ath9k_hw_regulatory(ah
);
4259 struct ath_common
*common
= ath9k_hw_common(ah
);
4260 struct ar9300_eeprom
*pEepData
= &ah
->eeprom
.ar9300_eep
;
4261 u16 twiceMaxEdgePower
= AR9300_MAX_RATE_POWER
;
4262 static const u16 tpScaleReductionTable
[5] = {
4263 0, 3, 6, 9, AR9300_MAX_RATE_POWER
4266 int16_t twiceLargestAntenna
;
4267 u16 scaledPower
= 0, minCtlPower
, maxRegAllowedPower
;
4268 u16 ctlModesFor11a
[] = {
4269 CTL_11A
, CTL_5GHT20
, CTL_11A_EXT
, CTL_5GHT40
4271 u16 ctlModesFor11g
[] = {
4272 CTL_11B
, CTL_11G
, CTL_2GHT20
, CTL_11B_EXT
,
4273 CTL_11G_EXT
, CTL_2GHT40
4275 u16 numCtlModes
, *pCtlMode
, ctlMode
, freq
;
4276 struct chan_centers centers
;
4279 u16 twiceMinEdgePower
;
4280 bool is2ghz
= IS_CHAN_2GHZ(chan
);
4282 ath9k_hw_get_channel_centers(ah
, chan
, ¢ers
);
4284 /* Compute TxPower reduction due to Antenna Gain */
4286 twiceLargestAntenna
= pEepData
->modalHeader2G
.antennaGain
;
4288 twiceLargestAntenna
= pEepData
->modalHeader5G
.antennaGain
;
4290 twiceLargestAntenna
= (int16_t)min((twiceAntennaReduction
) -
4291 twiceLargestAntenna
, 0);
4294 * scaledPower is the minimum of the user input power level
4295 * and the regulatory allowed power level
4297 maxRegAllowedPower
= twiceMaxRegulatoryPower
+ twiceLargestAntenna
;
4299 if (regulatory
->tp_scale
!= ATH9K_TP_SCALE_MAX
) {
4300 maxRegAllowedPower
-=
4301 (tpScaleReductionTable
[(regulatory
->tp_scale
)] * 2);
4304 scaledPower
= min(powerLimit
, maxRegAllowedPower
);
4307 * Reduce scaled Power by number of chains active to get
4308 * to per chain tx power level
4310 switch (ar5416_get_ntxchains(ah
->txchainmask
)) {
4314 scaledPower
-= REDUCE_SCALED_POWER_BY_TWO_CHAIN
;
4317 scaledPower
-= REDUCE_SCALED_POWER_BY_THREE_CHAIN
;
4321 scaledPower
= max((u16
)0, scaledPower
);
4324 * Get target powers from EEPROM - our baseline for TX Power
4327 /* Setup for CTL modes */
4328 /* CTL_11B, CTL_11G, CTL_2GHT20 */
4330 ARRAY_SIZE(ctlModesFor11g
) -
4331 SUB_NUM_CTL_MODES_AT_2G_40
;
4332 pCtlMode
= ctlModesFor11g
;
4333 if (IS_CHAN_HT40(chan
))
4335 numCtlModes
= ARRAY_SIZE(ctlModesFor11g
);
4337 /* Setup for CTL modes */
4338 /* CTL_11A, CTL_5GHT20 */
4339 numCtlModes
= ARRAY_SIZE(ctlModesFor11a
) -
4340 SUB_NUM_CTL_MODES_AT_5G_40
;
4341 pCtlMode
= ctlModesFor11a
;
4342 if (IS_CHAN_HT40(chan
))
4344 numCtlModes
= ARRAY_SIZE(ctlModesFor11a
);
4348 * For MIMO, need to apply regulatory caps individually across
4349 * dynamically running modes: CCK, OFDM, HT20, HT40
4351 * The outer loop walks through each possible applicable runtime mode.
4352 * The inner loop walks through each ctlIndex entry in EEPROM.
4353 * The ctl value is encoded as [7:4] == test group, [3:0] == test mode.
4355 for (ctlMode
= 0; ctlMode
< numCtlModes
; ctlMode
++) {
4356 bool isHt40CtlMode
= (pCtlMode
[ctlMode
] == CTL_5GHT40
) ||
4357 (pCtlMode
[ctlMode
] == CTL_2GHT40
);
4359 freq
= centers
.synth_center
;
4360 else if (pCtlMode
[ctlMode
] & EXT_ADDITIVE
)
4361 freq
= centers
.ext_center
;
4363 freq
= centers
.ctl_center
;
4365 ath_print(common
, ATH_DBG_REGULATORY
,
4366 "LOOP-Mode ctlMode %d < %d, isHt40CtlMode %d, "
4367 "EXT_ADDITIVE %d\n",
4368 ctlMode
, numCtlModes
, isHt40CtlMode
,
4369 (pCtlMode
[ctlMode
] & EXT_ADDITIVE
));
4371 /* walk through each CTL index stored in EEPROM */
4373 ctlIndex
= pEepData
->ctlIndex_2G
;
4374 ctlNum
= AR9300_NUM_CTLS_2G
;
4376 ctlIndex
= pEepData
->ctlIndex_5G
;
4377 ctlNum
= AR9300_NUM_CTLS_5G
;
4380 for (i
= 0; (i
< ctlNum
) && ctlIndex
[i
]; i
++) {
4381 ath_print(common
, ATH_DBG_REGULATORY
,
4382 "LOOP-Ctlidx %d: cfgCtl 0x%2.2x "
4383 "pCtlMode 0x%2.2x ctlIndex 0x%2.2x "
4385 i
, cfgCtl
, pCtlMode
[ctlMode
], ctlIndex
[i
],
4389 * compare test group from regulatory
4390 * channel list with test mode from pCtlMode
4393 if ((((cfgCtl
& ~CTL_MODE_M
) |
4394 (pCtlMode
[ctlMode
] & CTL_MODE_M
)) ==
4396 (((cfgCtl
& ~CTL_MODE_M
) |
4397 (pCtlMode
[ctlMode
] & CTL_MODE_M
)) ==
4398 ((ctlIndex
[i
] & CTL_MODE_M
) |
4401 ar9003_hw_get_max_edge_power(pEepData
,
4405 if ((cfgCtl
& ~CTL_MODE_M
) == SD_NO_CTL
)
4407 * Find the minimum of all CTL
4408 * edge powers that apply to
4412 min(twiceMaxEdgePower
,
4423 minCtlPower
= (u8
)min(twiceMaxEdgePower
, scaledPower
);
4425 ath_print(common
, ATH_DBG_REGULATORY
,
4426 "SEL-Min ctlMode %d pCtlMode %d 2xMaxEdge %d "
4427 "sP %d minCtlPwr %d\n",
4428 ctlMode
, pCtlMode
[ctlMode
], twiceMaxEdgePower
,
4429 scaledPower
, minCtlPower
);
4431 /* Apply ctl mode to correct target power set */
4432 switch (pCtlMode
[ctlMode
]) {
4434 for (i
= ALL_TARGET_LEGACY_1L_5L
;
4435 i
<= ALL_TARGET_LEGACY_11S
; i
++)
4437 (u8
)min((u16
)pPwrArray
[i
],
4442 for (i
= ALL_TARGET_LEGACY_6_24
;
4443 i
<= ALL_TARGET_LEGACY_54
; i
++)
4445 (u8
)min((u16
)pPwrArray
[i
],
4450 for (i
= ALL_TARGET_HT20_0_8_16
;
4451 i
<= ALL_TARGET_HT20_21
; i
++)
4453 (u8
)min((u16
)pPwrArray
[i
],
4455 pPwrArray
[ALL_TARGET_HT20_22
] =
4456 (u8
)min((u16
)pPwrArray
[ALL_TARGET_HT20_22
],
4458 pPwrArray
[ALL_TARGET_HT20_23
] =
4459 (u8
)min((u16
)pPwrArray
[ALL_TARGET_HT20_23
],
4464 for (i
= ALL_TARGET_HT40_0_8_16
;
4465 i
<= ALL_TARGET_HT40_23
; i
++)
4467 (u8
)min((u16
)pPwrArray
[i
],
4473 } /* end ctl mode checking */
4476 static void ath9k_hw_ar9300_set_txpower(struct ath_hw
*ah
,
4477 struct ath9k_channel
*chan
, u16 cfgCtl
,
4478 u8 twiceAntennaReduction
,
4479 u8 twiceMaxRegulatoryPower
,
4480 u8 powerLimit
, bool test
)
4482 struct ath_regulatory
*regulatory
= ath9k_hw_regulatory(ah
);
4483 struct ath_common
*common
= ath9k_hw_common(ah
);
4484 u8 targetPowerValT2
[ar9300RateSize
];
4487 ar9003_hw_set_target_power_eeprom(ah
, chan
->channel
, targetPowerValT2
);
4488 ar9003_hw_set_power_per_rate_table(ah
, chan
,
4489 targetPowerValT2
, cfgCtl
,
4490 twiceAntennaReduction
,
4491 twiceMaxRegulatoryPower
,
4494 regulatory
->max_power_level
= 0;
4495 for (i
= 0; i
< ar9300RateSize
; i
++) {
4496 if (targetPowerValT2
[i
] > regulatory
->max_power_level
)
4497 regulatory
->max_power_level
= targetPowerValT2
[i
];
4503 for (i
= 0; i
< ar9300RateSize
; i
++) {
4504 ath_print(common
, ATH_DBG_EEPROM
,
4505 "TPC[%02d] 0x%08x ", i
, targetPowerValT2
[i
]);
4507 ath_print(common
, ATH_DBG_EEPROM
,
4508 "TPC[%02d] 0x%08x ", i
, targetPowerValT2
[i
]);
4510 ath_print(common
, ATH_DBG_EEPROM
,
4511 "TPC[%02d] 0x%08x ", i
, targetPowerValT2
[i
]);
4513 ath_print(common
, ATH_DBG_EEPROM
,
4514 "TPC[%02d] 0x%08x\n\n", i
, targetPowerValT2
[i
]);
4519 * This is the TX power we send back to driver core,
4520 * and it can use to pass to userspace to display our
4521 * currently configured TX power setting.
4523 * Since power is rate dependent, use one of the indices
4524 * from the AR9300_Rates enum to select an entry from
4525 * targetPowerValT2[] to report. Currently returns the
4526 * power for HT40 MCS 0, HT20 MCS 0, or OFDM 6 Mbps
4527 * as CCK power is less interesting (?).
4529 i
= ALL_TARGET_LEGACY_6_24
; /* legacy */
4530 if (IS_CHAN_HT40(chan
))
4531 i
= ALL_TARGET_HT40_0_8_16
; /* ht40 */
4532 else if (IS_CHAN_HT20(chan
))
4533 i
= ALL_TARGET_HT20_0_8_16
; /* ht20 */
4535 ah
->txpower_limit
= targetPowerValT2
[i
];
4536 regulatory
->max_power_level
= targetPowerValT2
[i
];
4538 /* Write target power array to registers */
4539 ar9003_hw_tx_power_regwrite(ah
, targetPowerValT2
);
4540 ar9003_hw_calibration_apply(ah
, chan
->channel
);
4543 static u16
ath9k_hw_ar9300_get_spur_channel(struct ath_hw
*ah
,
4549 s32
ar9003_hw_get_tx_gain_idx(struct ath_hw
*ah
)
4551 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
4553 return (eep
->baseEepHeader
.txrxgain
>> 4) & 0xf; /* bits 7:4 */
4556 s32
ar9003_hw_get_rx_gain_idx(struct ath_hw
*ah
)
4558 struct ar9300_eeprom
*eep
= &ah
->eeprom
.ar9300_eep
;
4560 return (eep
->baseEepHeader
.txrxgain
) & 0xf; /* bits 3:0 */
4563 const struct eeprom_ops eep_ar9300_ops
= {
4564 .check_eeprom
= ath9k_hw_ar9300_check_eeprom
,
4565 .get_eeprom
= ath9k_hw_ar9300_get_eeprom
,
4566 .fill_eeprom
= ath9k_hw_ar9300_fill_eeprom
,
4567 .get_eeprom_ver
= ath9k_hw_ar9300_get_eeprom_ver
,
4568 .get_eeprom_rev
= ath9k_hw_ar9300_get_eeprom_rev
,
4569 .get_num_ant_config
= ath9k_hw_ar9300_get_num_ant_config
,
4570 .get_eeprom_antenna_cfg
= ath9k_hw_ar9300_get_eeprom_antenna_cfg
,
4571 .set_board_values
= ath9k_hw_ar9300_set_board_values
,
4572 .set_addac
= ath9k_hw_ar9300_set_addac
,
4573 .set_txpower
= ath9k_hw_ar9300_set_txpower
,
4574 .get_spur_channel
= ath9k_hw_ar9300_get_spur_channel