115c9ee7aSSenthil Balasubramanian /*
25b68138eSSujith Manoharan * Copyright (c) 2010-2011 Atheros Communications Inc.
315c9ee7aSSenthil Balasubramanian *
415c9ee7aSSenthil Balasubramanian * Permission to use, copy, modify, and/or distribute this software for any
515c9ee7aSSenthil Balasubramanian * purpose with or without fee is hereby granted, provided that the above
615c9ee7aSSenthil Balasubramanian * copyright notice and this permission notice appear in all copies.
715c9ee7aSSenthil Balasubramanian *
815c9ee7aSSenthil Balasubramanian * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
915c9ee7aSSenthil Balasubramanian * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1015c9ee7aSSenthil Balasubramanian * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1115c9ee7aSSenthil Balasubramanian * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1215c9ee7aSSenthil Balasubramanian * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1315c9ee7aSSenthil Balasubramanian * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1415c9ee7aSSenthil Balasubramanian * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1515c9ee7aSSenthil Balasubramanian */
1615c9ee7aSSenthil Balasubramanian
1778fa99abSPavel Roskin #include <asm/unaligned.h>
18896cbefaSThomas Meyer #include <linux/kernel.h>
1915c9ee7aSSenthil Balasubramanian #include "hw.h"
2015c9ee7aSSenthil Balasubramanian #include "ar9003_phy.h"
2115c9ee7aSSenthil Balasubramanian #include "ar9003_eeprom.h"
22e82cb03fSRajkumar Manoharan #include "ar9003_mci.h"
2315c9ee7aSSenthil Balasubramanian
2415c9ee7aSSenthil Balasubramanian #define COMP_HDR_LEN 4
2515c9ee7aSSenthil Balasubramanian #define COMP_CKSUM_LEN 2
2615c9ee7aSSenthil Balasubramanian
271b5c8d60SJoe Perches #define LE16(x) cpu_to_le16(x)
281b5c8d60SJoe Perches #define LE32(x) cpu_to_le32(x)
29ffdc4cbeSFelix Fietkau
30824b185aSLuis R. Rodriguez /* Local defines to distinguish between extension and control CTL's */
31824b185aSLuis R. Rodriguez #define EXT_ADDITIVE (0x8000)
32824b185aSLuis R. Rodriguez #define CTL_11A_EXT (CTL_11A | EXT_ADDITIVE)
33824b185aSLuis R. Rodriguez #define CTL_11G_EXT (CTL_11G | EXT_ADDITIVE)
34824b185aSLuis R. Rodriguez #define CTL_11B_EXT (CTL_11B | EXT_ADDITIVE)
35824b185aSLuis R. Rodriguez
36824b185aSLuis R. Rodriguez #define SUB_NUM_CTL_MODES_AT_5G_40 2 /* excluding HT40, EXT-OFDM */
37824b185aSLuis R. Rodriguez #define SUB_NUM_CTL_MODES_AT_2G_40 3 /* excluding HT40, EXT-OFDM, EXT-CCK */
38824b185aSLuis R. Rodriguez
39e702ba18SFelix Fietkau #define CTL(_tpower, _flag) ((_tpower) | ((_flag) << 6))
40e702ba18SFelix Fietkau
41d0ce2d17SVasanthakumar Thiagarajan #define EEPROM_DATA_LEN_9485 1088
42d0ce2d17SVasanthakumar Thiagarajan
43f4475a6eSVasanthakumar Thiagarajan static int ar9003_hw_power_interpolate(int32_t x,
44f4475a6eSVasanthakumar Thiagarajan int32_t *px, int32_t *py, u_int16_t np);
45fe6c7915SDavid S. Miller
4615c9ee7aSSenthil Balasubramanian static const struct ar9300_eeprom ar9300_default = {
4715c9ee7aSSenthil Balasubramanian .eepromVersion = 2,
4815c9ee7aSSenthil Balasubramanian .templateVersion = 2,
49b503c7a2SSenthil Balasubramanian .macAddr = {0, 2, 3, 4, 5, 6},
5015c9ee7aSSenthil Balasubramanian .custData = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5115c9ee7aSSenthil Balasubramanian 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
5215c9ee7aSSenthil Balasubramanian .baseEepHeader = {
53ffdc4cbeSFelix Fietkau .regDmn = { LE16(0), LE16(0x1f) },
5415c9ee7aSSenthil Balasubramanian .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */
5515c9ee7aSSenthil Balasubramanian .opCapFlags = {
564ddfcd7dSFelix Fietkau .opFlags = AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A,
57291478b7SMartin Blumenstingl .eepMisc = AR9300_EEPMISC_LITTLE_ENDIAN,
5815c9ee7aSSenthil Balasubramanian },
5915c9ee7aSSenthil Balasubramanian .rfSilent = 0,
6015c9ee7aSSenthil Balasubramanian .blueToothOptions = 0,
6115c9ee7aSSenthil Balasubramanian .deviceCap = 0,
6215c9ee7aSSenthil Balasubramanian .deviceType = 5, /* takes lower byte in eeprom location */
6315c9ee7aSSenthil Balasubramanian .pwrTableOffset = AR9300_PWR_TABLE_OFFSET,
6415c9ee7aSSenthil Balasubramanian .params_for_tuning_caps = {0, 0},
6515c9ee7aSSenthil Balasubramanian .featureEnable = 0x0c,
6615c9ee7aSSenthil Balasubramanian /*
6715c9ee7aSSenthil Balasubramanian * bit0 - enable tx temp comp - disabled
6815c9ee7aSSenthil Balasubramanian * bit1 - enable tx volt comp - disabled
6915c9ee7aSSenthil Balasubramanian * bit2 - enable fastClock - enabled
7015c9ee7aSSenthil Balasubramanian * bit3 - enable doubling - enabled
7115c9ee7aSSenthil Balasubramanian * bit4 - enable internal regulator - disabled
724935250aSFelix Fietkau * bit5 - enable pa predistortion - disabled
7315c9ee7aSSenthil Balasubramanian */
7415c9ee7aSSenthil Balasubramanian .miscConfiguration = 0, /* bit0 - turn down drivestrength */
7515c9ee7aSSenthil Balasubramanian .eepromWriteEnableGpio = 3,
7615c9ee7aSSenthil Balasubramanian .wlanDisableGpio = 0,
7715c9ee7aSSenthil Balasubramanian .wlanLedGpio = 8,
7815c9ee7aSSenthil Balasubramanian .rxBandSelectGpio = 0xff,
7915c9ee7aSSenthil Balasubramanian .txrxgain = 0,
8015c9ee7aSSenthil Balasubramanian .swreg = 0,
8115c9ee7aSSenthil Balasubramanian },
8215c9ee7aSSenthil Balasubramanian .modalHeader2G = {
8315c9ee7aSSenthil Balasubramanian /* ar9300_modal_eep_header 2g */
8415c9ee7aSSenthil Balasubramanian /* 4 idle,t1,t2,b(4 bits per setting) */
85ffdc4cbeSFelix Fietkau .antCtrlCommon = LE32(0x110),
8615c9ee7aSSenthil Balasubramanian /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
87ffdc4cbeSFelix Fietkau .antCtrlCommon2 = LE32(0x22222),
8815c9ee7aSSenthil Balasubramanian
8915c9ee7aSSenthil Balasubramanian /*
9015c9ee7aSSenthil Balasubramanian * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
9115c9ee7aSSenthil Balasubramanian * rx1, rx12, b (2 bits each)
9215c9ee7aSSenthil Balasubramanian */
93ffdc4cbeSFelix Fietkau .antCtrlChain = { LE16(0x150), LE16(0x150), LE16(0x150) },
9415c9ee7aSSenthil Balasubramanian
9515c9ee7aSSenthil Balasubramanian /*
9615c9ee7aSSenthil Balasubramanian * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
9715c9ee7aSSenthil Balasubramanian * for ar9280 (0xa20c/b20c 5:0)
9815c9ee7aSSenthil Balasubramanian */
9915c9ee7aSSenthil Balasubramanian .xatten1DB = {0, 0, 0},
10015c9ee7aSSenthil Balasubramanian
10115c9ee7aSSenthil Balasubramanian /*
10215c9ee7aSSenthil Balasubramanian * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
10315c9ee7aSSenthil Balasubramanian * for ar9280 (0xa20c/b20c 16:12
10415c9ee7aSSenthil Balasubramanian */
10515c9ee7aSSenthil Balasubramanian .xatten1Margin = {0, 0, 0},
10615c9ee7aSSenthil Balasubramanian .tempSlope = 36,
10715c9ee7aSSenthil Balasubramanian .voltSlope = 0,
10815c9ee7aSSenthil Balasubramanian
10915c9ee7aSSenthil Balasubramanian /*
11015c9ee7aSSenthil Balasubramanian * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur
11115c9ee7aSSenthil Balasubramanian * channels in usual fbin coding format
11215c9ee7aSSenthil Balasubramanian */
11315c9ee7aSSenthil Balasubramanian .spurChans = {0, 0, 0, 0, 0},
11415c9ee7aSSenthil Balasubramanian
11515c9ee7aSSenthil Balasubramanian /*
11615c9ee7aSSenthil Balasubramanian * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check
11715c9ee7aSSenthil Balasubramanian * if the register is per chain
11815c9ee7aSSenthil Balasubramanian */
11915c9ee7aSSenthil Balasubramanian .noiseFloorThreshCh = {-1, 0, 0},
120df222edcSRajkumar Manoharan .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
121df222edcSRajkumar Manoharan .quick_drop = 0,
12215c9ee7aSSenthil Balasubramanian .xpaBiasLvl = 0,
12315c9ee7aSSenthil Balasubramanian .txFrameToDataStart = 0x0e,
12415c9ee7aSSenthil Balasubramanian .txFrameToPaOn = 0x0e,
12515c9ee7aSSenthil Balasubramanian .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
12615c9ee7aSSenthil Balasubramanian .antennaGain = 0,
12715c9ee7aSSenthil Balasubramanian .switchSettling = 0x2c,
12815c9ee7aSSenthil Balasubramanian .adcDesiredSize = -30,
12915c9ee7aSSenthil Balasubramanian .txEndToXpaOff = 0,
13015c9ee7aSSenthil Balasubramanian .txEndToRxOn = 0x2,
13115c9ee7aSSenthil Balasubramanian .txFrameToXpaOn = 0xe,
13215c9ee7aSSenthil Balasubramanian .thresh62 = 28,
1333ceb801bSSenthil Balasubramanian .papdRateMaskHt20 = LE32(0x0cf0e0e0),
1343ceb801bSSenthil Balasubramanian .papdRateMaskHt40 = LE32(0x6cf0e0e0),
13566a80a3aSSujith Manoharan .switchcomspdt = 0,
1363e2ea543SFelix Fietkau .xlna_bias_strength = 0,
1374935250aSFelix Fietkau .futureModal = {
1383e2ea543SFelix Fietkau 0, 0, 0, 0, 0, 0, 0,
13915c9ee7aSSenthil Balasubramanian },
14015c9ee7aSSenthil Balasubramanian },
141b3dd6bc1SSenthil Balasubramanian .base_ext1 = {
142b3dd6bc1SSenthil Balasubramanian .ant_div_control = 0,
143ee65b388SSujith Manoharan .future = {0, 0},
144420e2b1bSRajkumar Manoharan .tempslopextension = {0, 0, 0, 0, 0, 0, 0, 0}
145b3dd6bc1SSenthil Balasubramanian },
14615c9ee7aSSenthil Balasubramanian .calFreqPier2G = {
14715c9ee7aSSenthil Balasubramanian FREQ2FBIN(2412, 1),
14815c9ee7aSSenthil Balasubramanian FREQ2FBIN(2437, 1),
14915c9ee7aSSenthil Balasubramanian FREQ2FBIN(2472, 1),
15015c9ee7aSSenthil Balasubramanian },
15115c9ee7aSSenthil Balasubramanian /* ar9300_cal_data_per_freq_op_loop 2g */
15215c9ee7aSSenthil Balasubramanian .calPierData2G = {
15315c9ee7aSSenthil Balasubramanian { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
15415c9ee7aSSenthil Balasubramanian { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
15515c9ee7aSSenthil Balasubramanian { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
15615c9ee7aSSenthil Balasubramanian },
15715c9ee7aSSenthil Balasubramanian .calTarget_freqbin_Cck = {
15815c9ee7aSSenthil Balasubramanian FREQ2FBIN(2412, 1),
15915c9ee7aSSenthil Balasubramanian FREQ2FBIN(2484, 1),
16015c9ee7aSSenthil Balasubramanian },
16115c9ee7aSSenthil Balasubramanian .calTarget_freqbin_2G = {
16215c9ee7aSSenthil Balasubramanian FREQ2FBIN(2412, 1),
16315c9ee7aSSenthil Balasubramanian FREQ2FBIN(2437, 1),
16415c9ee7aSSenthil Balasubramanian FREQ2FBIN(2472, 1)
16515c9ee7aSSenthil Balasubramanian },
16615c9ee7aSSenthil Balasubramanian .calTarget_freqbin_2GHT20 = {
16715c9ee7aSSenthil Balasubramanian FREQ2FBIN(2412, 1),
16815c9ee7aSSenthil Balasubramanian FREQ2FBIN(2437, 1),
16915c9ee7aSSenthil Balasubramanian FREQ2FBIN(2472, 1)
17015c9ee7aSSenthil Balasubramanian },
17115c9ee7aSSenthil Balasubramanian .calTarget_freqbin_2GHT40 = {
17215c9ee7aSSenthil Balasubramanian FREQ2FBIN(2412, 1),
17315c9ee7aSSenthil Balasubramanian FREQ2FBIN(2437, 1),
17415c9ee7aSSenthil Balasubramanian FREQ2FBIN(2472, 1)
17515c9ee7aSSenthil Balasubramanian },
17615c9ee7aSSenthil Balasubramanian .calTargetPowerCck = {
17715c9ee7aSSenthil Balasubramanian /* 1L-5L,5S,11L,11S */
17815c9ee7aSSenthil Balasubramanian { {36, 36, 36, 36} },
17915c9ee7aSSenthil Balasubramanian { {36, 36, 36, 36} },
18015c9ee7aSSenthil Balasubramanian },
18115c9ee7aSSenthil Balasubramanian .calTargetPower2G = {
18215c9ee7aSSenthil Balasubramanian /* 6-24,36,48,54 */
18315c9ee7aSSenthil Balasubramanian { {32, 32, 28, 24} },
18415c9ee7aSSenthil Balasubramanian { {32, 32, 28, 24} },
18515c9ee7aSSenthil Balasubramanian { {32, 32, 28, 24} },
18615c9ee7aSSenthil Balasubramanian },
18715c9ee7aSSenthil Balasubramanian .calTargetPower2GHT20 = {
18815c9ee7aSSenthil Balasubramanian { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
18915c9ee7aSSenthil Balasubramanian { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
19015c9ee7aSSenthil Balasubramanian { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
19115c9ee7aSSenthil Balasubramanian },
19215c9ee7aSSenthil Balasubramanian .calTargetPower2GHT40 = {
19315c9ee7aSSenthil Balasubramanian { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
19415c9ee7aSSenthil Balasubramanian { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
19515c9ee7aSSenthil Balasubramanian { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
19615c9ee7aSSenthil Balasubramanian },
19715c9ee7aSSenthil Balasubramanian .ctlIndex_2G = {
19815c9ee7aSSenthil Balasubramanian 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
19915c9ee7aSSenthil Balasubramanian 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
20015c9ee7aSSenthil Balasubramanian },
20115c9ee7aSSenthil Balasubramanian .ctl_freqbin_2G = {
20215c9ee7aSSenthil Balasubramanian {
20315c9ee7aSSenthil Balasubramanian FREQ2FBIN(2412, 1),
20415c9ee7aSSenthil Balasubramanian FREQ2FBIN(2417, 1),
20515c9ee7aSSenthil Balasubramanian FREQ2FBIN(2457, 1),
20615c9ee7aSSenthil Balasubramanian FREQ2FBIN(2462, 1)
20715c9ee7aSSenthil Balasubramanian },
20815c9ee7aSSenthil Balasubramanian {
20915c9ee7aSSenthil Balasubramanian FREQ2FBIN(2412, 1),
21015c9ee7aSSenthil Balasubramanian FREQ2FBIN(2417, 1),
21115c9ee7aSSenthil Balasubramanian FREQ2FBIN(2462, 1),
21215c9ee7aSSenthil Balasubramanian 0xFF,
21315c9ee7aSSenthil Balasubramanian },
21415c9ee7aSSenthil Balasubramanian
21515c9ee7aSSenthil Balasubramanian {
21615c9ee7aSSenthil Balasubramanian FREQ2FBIN(2412, 1),
21715c9ee7aSSenthil Balasubramanian FREQ2FBIN(2417, 1),
21815c9ee7aSSenthil Balasubramanian FREQ2FBIN(2462, 1),
21915c9ee7aSSenthil Balasubramanian 0xFF,
22015c9ee7aSSenthil Balasubramanian },
22115c9ee7aSSenthil Balasubramanian {
22215c9ee7aSSenthil Balasubramanian FREQ2FBIN(2422, 1),
22315c9ee7aSSenthil Balasubramanian FREQ2FBIN(2427, 1),
22415c9ee7aSSenthil Balasubramanian FREQ2FBIN(2447, 1),
22515c9ee7aSSenthil Balasubramanian FREQ2FBIN(2452, 1)
22615c9ee7aSSenthil Balasubramanian },
22715c9ee7aSSenthil Balasubramanian
22815c9ee7aSSenthil Balasubramanian {
22915c9ee7aSSenthil Balasubramanian /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
23015c9ee7aSSenthil Balasubramanian /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
23115c9ee7aSSenthil Balasubramanian /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
23215c9ee7aSSenthil Balasubramanian /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1),
23315c9ee7aSSenthil Balasubramanian },
23415c9ee7aSSenthil Balasubramanian
23515c9ee7aSSenthil Balasubramanian {
23615c9ee7aSSenthil Balasubramanian /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
23715c9ee7aSSenthil Balasubramanian /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
23815c9ee7aSSenthil Balasubramanian /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
23915c9ee7aSSenthil Balasubramanian 0,
24015c9ee7aSSenthil Balasubramanian },
24115c9ee7aSSenthil Balasubramanian
24215c9ee7aSSenthil Balasubramanian {
24315c9ee7aSSenthil Balasubramanian /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
24415c9ee7aSSenthil Balasubramanian /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
24515c9ee7aSSenthil Balasubramanian FREQ2FBIN(2472, 1),
24615c9ee7aSSenthil Balasubramanian 0,
24715c9ee7aSSenthil Balasubramanian },
24815c9ee7aSSenthil Balasubramanian
24915c9ee7aSSenthil Balasubramanian {
25015c9ee7aSSenthil Balasubramanian /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
25115c9ee7aSSenthil Balasubramanian /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
25215c9ee7aSSenthil Balasubramanian /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
25315c9ee7aSSenthil Balasubramanian /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
25415c9ee7aSSenthil Balasubramanian },
25515c9ee7aSSenthil Balasubramanian
25615c9ee7aSSenthil Balasubramanian {
25715c9ee7aSSenthil Balasubramanian /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
25815c9ee7aSSenthil Balasubramanian /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
25915c9ee7aSSenthil Balasubramanian /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
26015c9ee7aSSenthil Balasubramanian },
26115c9ee7aSSenthil Balasubramanian
26215c9ee7aSSenthil Balasubramanian {
26315c9ee7aSSenthil Balasubramanian /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
26415c9ee7aSSenthil Balasubramanian /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
26515c9ee7aSSenthil Balasubramanian /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
26615c9ee7aSSenthil Balasubramanian 0
26715c9ee7aSSenthil Balasubramanian },
26815c9ee7aSSenthil Balasubramanian
26915c9ee7aSSenthil Balasubramanian {
27015c9ee7aSSenthil Balasubramanian /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
27115c9ee7aSSenthil Balasubramanian /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
27215c9ee7aSSenthil Balasubramanian /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
27315c9ee7aSSenthil Balasubramanian 0
27415c9ee7aSSenthil Balasubramanian },
27515c9ee7aSSenthil Balasubramanian
27615c9ee7aSSenthil Balasubramanian {
27715c9ee7aSSenthil Balasubramanian /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
27815c9ee7aSSenthil Balasubramanian /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
27915c9ee7aSSenthil Balasubramanian /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
280b3dd6bc1SSenthil Balasubramanian /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
28115c9ee7aSSenthil Balasubramanian }
28215c9ee7aSSenthil Balasubramanian },
28315c9ee7aSSenthil Balasubramanian .ctlPowerData_2G = {
284e702ba18SFelix Fietkau { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
285e702ba18SFelix Fietkau { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
286e702ba18SFelix Fietkau { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
28715c9ee7aSSenthil Balasubramanian
28815052f81SRajkumar Manoharan { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0) } },
289e702ba18SFelix Fietkau { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
290e702ba18SFelix Fietkau { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
29115c9ee7aSSenthil Balasubramanian
292e702ba18SFelix Fietkau { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
293e702ba18SFelix Fietkau { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
294e702ba18SFelix Fietkau { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
29515c9ee7aSSenthil Balasubramanian
296e702ba18SFelix Fietkau { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
297e702ba18SFelix Fietkau { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
298e702ba18SFelix Fietkau { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
29915c9ee7aSSenthil Balasubramanian },
30015c9ee7aSSenthil Balasubramanian .modalHeader5G = {
30115c9ee7aSSenthil Balasubramanian /* 4 idle,t1,t2,b (4 bits per setting) */
302ffdc4cbeSFelix Fietkau .antCtrlCommon = LE32(0x110),
30315c9ee7aSSenthil Balasubramanian /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
304ffdc4cbeSFelix Fietkau .antCtrlCommon2 = LE32(0x22222),
30515c9ee7aSSenthil Balasubramanian /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
30615c9ee7aSSenthil Balasubramanian .antCtrlChain = {
307ffdc4cbeSFelix Fietkau LE16(0x000), LE16(0x000), LE16(0x000),
30815c9ee7aSSenthil Balasubramanian },
30915c9ee7aSSenthil Balasubramanian /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
31015c9ee7aSSenthil Balasubramanian .xatten1DB = {0, 0, 0},
31115c9ee7aSSenthil Balasubramanian
31215c9ee7aSSenthil Balasubramanian /*
31315c9ee7aSSenthil Balasubramanian * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
31415c9ee7aSSenthil Balasubramanian * for merlin (0xa20c/b20c 16:12
31515c9ee7aSSenthil Balasubramanian */
31615c9ee7aSSenthil Balasubramanian .xatten1Margin = {0, 0, 0},
31715c9ee7aSSenthil Balasubramanian .tempSlope = 68,
31815c9ee7aSSenthil Balasubramanian .voltSlope = 0,
31915c9ee7aSSenthil Balasubramanian /* spurChans spur channels in usual fbin coding format */
32015c9ee7aSSenthil Balasubramanian .spurChans = {0, 0, 0, 0, 0},
32115c9ee7aSSenthil Balasubramanian /* noiseFloorThreshCh Check if the register is per chain */
32215c9ee7aSSenthil Balasubramanian .noiseFloorThreshCh = {-1, 0, 0},
323df222edcSRajkumar Manoharan .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
324df222edcSRajkumar Manoharan .quick_drop = 0,
32515c9ee7aSSenthil Balasubramanian .xpaBiasLvl = 0,
32615c9ee7aSSenthil Balasubramanian .txFrameToDataStart = 0x0e,
32715c9ee7aSSenthil Balasubramanian .txFrameToPaOn = 0x0e,
32815c9ee7aSSenthil Balasubramanian .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
32915c9ee7aSSenthil Balasubramanian .antennaGain = 0,
33015c9ee7aSSenthil Balasubramanian .switchSettling = 0x2d,
33115c9ee7aSSenthil Balasubramanian .adcDesiredSize = -30,
33215c9ee7aSSenthil Balasubramanian .txEndToXpaOff = 0,
33315c9ee7aSSenthil Balasubramanian .txEndToRxOn = 0x2,
33415c9ee7aSSenthil Balasubramanian .txFrameToXpaOn = 0xe,
33515c9ee7aSSenthil Balasubramanian .thresh62 = 28,
3363ceb801bSSenthil Balasubramanian .papdRateMaskHt20 = LE32(0x0c80c080),
3373ceb801bSSenthil Balasubramanian .papdRateMaskHt40 = LE32(0x0080c080),
33866a80a3aSSujith Manoharan .switchcomspdt = 0,
3393e2ea543SFelix Fietkau .xlna_bias_strength = 0,
34015c9ee7aSSenthil Balasubramanian .futureModal = {
3413e2ea543SFelix Fietkau 0, 0, 0, 0, 0, 0, 0,
34215c9ee7aSSenthil Balasubramanian },
34315c9ee7aSSenthil Balasubramanian },
344b3dd6bc1SSenthil Balasubramanian .base_ext2 = {
345b3dd6bc1SSenthil Balasubramanian .tempSlopeLow = 0,
346b3dd6bc1SSenthil Balasubramanian .tempSlopeHigh = 0,
347b3dd6bc1SSenthil Balasubramanian .xatten1DBLow = {0, 0, 0},
348b3dd6bc1SSenthil Balasubramanian .xatten1MarginLow = {0, 0, 0},
349b3dd6bc1SSenthil Balasubramanian .xatten1DBHigh = {0, 0, 0},
350b3dd6bc1SSenthil Balasubramanian .xatten1MarginHigh = {0, 0, 0}
351b3dd6bc1SSenthil Balasubramanian },
35215c9ee7aSSenthil Balasubramanian .calFreqPier5G = {
35315c9ee7aSSenthil Balasubramanian FREQ2FBIN(5180, 0),
35415c9ee7aSSenthil Balasubramanian FREQ2FBIN(5220, 0),
35515c9ee7aSSenthil Balasubramanian FREQ2FBIN(5320, 0),
35615c9ee7aSSenthil Balasubramanian FREQ2FBIN(5400, 0),
35715c9ee7aSSenthil Balasubramanian FREQ2FBIN(5500, 0),
35815c9ee7aSSenthil Balasubramanian FREQ2FBIN(5600, 0),
35915c9ee7aSSenthil Balasubramanian FREQ2FBIN(5725, 0),
36015c9ee7aSSenthil Balasubramanian FREQ2FBIN(5825, 0)
36115c9ee7aSSenthil Balasubramanian },
36215c9ee7aSSenthil Balasubramanian .calPierData5G = {
36315c9ee7aSSenthil Balasubramanian {
36415c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
36515c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
36615c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
36715c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
36815c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
36915c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
37015c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
37115c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
37215c9ee7aSSenthil Balasubramanian },
37315c9ee7aSSenthil Balasubramanian {
37415c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
37515c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
37615c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
37715c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
37815c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
37915c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
38015c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
38115c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
38215c9ee7aSSenthil Balasubramanian },
38315c9ee7aSSenthil Balasubramanian {
38415c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
38515c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
38615c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
38715c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
38815c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
38915c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
39015c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
39115c9ee7aSSenthil Balasubramanian {0, 0, 0, 0, 0},
39215c9ee7aSSenthil Balasubramanian },
39315c9ee7aSSenthil Balasubramanian
39415c9ee7aSSenthil Balasubramanian },
39515c9ee7aSSenthil Balasubramanian .calTarget_freqbin_5G = {
39615c9ee7aSSenthil Balasubramanian FREQ2FBIN(5180, 0),
39715c9ee7aSSenthil Balasubramanian FREQ2FBIN(5220, 0),
39815c9ee7aSSenthil Balasubramanian FREQ2FBIN(5320, 0),
39915c9ee7aSSenthil Balasubramanian FREQ2FBIN(5400, 0),
40015c9ee7aSSenthil Balasubramanian FREQ2FBIN(5500, 0),
40115c9ee7aSSenthil Balasubramanian FREQ2FBIN(5600, 0),
40215c9ee7aSSenthil Balasubramanian FREQ2FBIN(5725, 0),
40315c9ee7aSSenthil Balasubramanian FREQ2FBIN(5825, 0)
40415c9ee7aSSenthil Balasubramanian },
40515c9ee7aSSenthil Balasubramanian .calTarget_freqbin_5GHT20 = {
40615c9ee7aSSenthil Balasubramanian FREQ2FBIN(5180, 0),
40715c9ee7aSSenthil Balasubramanian FREQ2FBIN(5240, 0),
40815c9ee7aSSenthil Balasubramanian FREQ2FBIN(5320, 0),
40915c9ee7aSSenthil Balasubramanian FREQ2FBIN(5500, 0),
41015c9ee7aSSenthil Balasubramanian FREQ2FBIN(5700, 0),
41115c9ee7aSSenthil Balasubramanian FREQ2FBIN(5745, 0),
41215c9ee7aSSenthil Balasubramanian FREQ2FBIN(5725, 0),
41315c9ee7aSSenthil Balasubramanian FREQ2FBIN(5825, 0)
41415c9ee7aSSenthil Balasubramanian },
41515c9ee7aSSenthil Balasubramanian .calTarget_freqbin_5GHT40 = {
41615c9ee7aSSenthil Balasubramanian FREQ2FBIN(5180, 0),
41715c9ee7aSSenthil Balasubramanian FREQ2FBIN(5240, 0),
41815c9ee7aSSenthil Balasubramanian FREQ2FBIN(5320, 0),
41915c9ee7aSSenthil Balasubramanian FREQ2FBIN(5500, 0),
42015c9ee7aSSenthil Balasubramanian FREQ2FBIN(5700, 0),
42115c9ee7aSSenthil Balasubramanian FREQ2FBIN(5745, 0),
42215c9ee7aSSenthil Balasubramanian FREQ2FBIN(5725, 0),
42315c9ee7aSSenthil Balasubramanian FREQ2FBIN(5825, 0)
42415c9ee7aSSenthil Balasubramanian },
42515c9ee7aSSenthil Balasubramanian .calTargetPower5G = {
42615c9ee7aSSenthil Balasubramanian /* 6-24,36,48,54 */
42715c9ee7aSSenthil Balasubramanian { {20, 20, 20, 10} },
42815c9ee7aSSenthil Balasubramanian { {20, 20, 20, 10} },
42915c9ee7aSSenthil Balasubramanian { {20, 20, 20, 10} },
43015c9ee7aSSenthil Balasubramanian { {20, 20, 20, 10} },
43115c9ee7aSSenthil Balasubramanian { {20, 20, 20, 10} },
43215c9ee7aSSenthil Balasubramanian { {20, 20, 20, 10} },
43315c9ee7aSSenthil Balasubramanian { {20, 20, 20, 10} },
43415c9ee7aSSenthil Balasubramanian { {20, 20, 20, 10} },
43515c9ee7aSSenthil Balasubramanian },
43615c9ee7aSSenthil Balasubramanian .calTargetPower5GHT20 = {
43715c9ee7aSSenthil Balasubramanian /*
43815c9ee7aSSenthil Balasubramanian * 0_8_16,1-3_9-11_17-19,
43915c9ee7aSSenthil Balasubramanian * 4,5,6,7,12,13,14,15,20,21,22,23
44015c9ee7aSSenthil Balasubramanian */
44115c9ee7aSSenthil Balasubramanian { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
44215c9ee7aSSenthil Balasubramanian { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
44315c9ee7aSSenthil Balasubramanian { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
44415c9ee7aSSenthil Balasubramanian { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
44515c9ee7aSSenthil Balasubramanian { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
44615c9ee7aSSenthil Balasubramanian { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
44715c9ee7aSSenthil Balasubramanian { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
44815c9ee7aSSenthil Balasubramanian { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
44915c9ee7aSSenthil Balasubramanian },
45015c9ee7aSSenthil Balasubramanian .calTargetPower5GHT40 = {
45115c9ee7aSSenthil Balasubramanian /*
45215c9ee7aSSenthil Balasubramanian * 0_8_16,1-3_9-11_17-19,
45315c9ee7aSSenthil Balasubramanian * 4,5,6,7,12,13,14,15,20,21,22,23
45415c9ee7aSSenthil Balasubramanian */
45515c9ee7aSSenthil Balasubramanian { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
45615c9ee7aSSenthil Balasubramanian { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
45715c9ee7aSSenthil Balasubramanian { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
45815c9ee7aSSenthil Balasubramanian { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
45915c9ee7aSSenthil Balasubramanian { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
46015c9ee7aSSenthil Balasubramanian { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
46115c9ee7aSSenthil Balasubramanian { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
46215c9ee7aSSenthil Balasubramanian { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
46315c9ee7aSSenthil Balasubramanian },
46415c9ee7aSSenthil Balasubramanian .ctlIndex_5G = {
46515c9ee7aSSenthil Balasubramanian 0x10, 0x16, 0x18, 0x40, 0x46,
46615c9ee7aSSenthil Balasubramanian 0x48, 0x30, 0x36, 0x38
46715c9ee7aSSenthil Balasubramanian },
46815c9ee7aSSenthil Balasubramanian .ctl_freqbin_5G = {
46915c9ee7aSSenthil Balasubramanian {
47015c9ee7aSSenthil Balasubramanian /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
47115c9ee7aSSenthil Balasubramanian /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
47215c9ee7aSSenthil Balasubramanian /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
47315c9ee7aSSenthil Balasubramanian /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
47415c9ee7aSSenthil Balasubramanian /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0),
47515c9ee7aSSenthil Balasubramanian /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
47615c9ee7aSSenthil Balasubramanian /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
47715c9ee7aSSenthil Balasubramanian /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
47815c9ee7aSSenthil Balasubramanian },
47915c9ee7aSSenthil Balasubramanian {
48015c9ee7aSSenthil Balasubramanian /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
48115c9ee7aSSenthil Balasubramanian /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
48215c9ee7aSSenthil Balasubramanian /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
48315c9ee7aSSenthil Balasubramanian /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
48415c9ee7aSSenthil Balasubramanian /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0),
48515c9ee7aSSenthil Balasubramanian /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
48615c9ee7aSSenthil Balasubramanian /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
48715c9ee7aSSenthil Balasubramanian /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
48815c9ee7aSSenthil Balasubramanian },
48915c9ee7aSSenthil Balasubramanian
49015c9ee7aSSenthil Balasubramanian {
49115c9ee7aSSenthil Balasubramanian /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
49215c9ee7aSSenthil Balasubramanian /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
49315c9ee7aSSenthil Balasubramanian /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
49415c9ee7aSSenthil Balasubramanian /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0),
49515c9ee7aSSenthil Balasubramanian /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0),
49615c9ee7aSSenthil Balasubramanian /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0),
49715c9ee7aSSenthil Balasubramanian /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0),
49815c9ee7aSSenthil Balasubramanian /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0)
49915c9ee7aSSenthil Balasubramanian },
50015c9ee7aSSenthil Balasubramanian
50115c9ee7aSSenthil Balasubramanian {
50215c9ee7aSSenthil Balasubramanian /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
50315c9ee7aSSenthil Balasubramanian /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
50415c9ee7aSSenthil Balasubramanian /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0),
50515c9ee7aSSenthil Balasubramanian /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0),
50615c9ee7aSSenthil Balasubramanian /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
50715c9ee7aSSenthil Balasubramanian /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
50815c9ee7aSSenthil Balasubramanian /* Data[3].ctlEdges[6].bChannel */ 0xFF,
50915c9ee7aSSenthil Balasubramanian /* Data[3].ctlEdges[7].bChannel */ 0xFF,
51015c9ee7aSSenthil Balasubramanian },
51115c9ee7aSSenthil Balasubramanian
51215c9ee7aSSenthil Balasubramanian {
51315c9ee7aSSenthil Balasubramanian /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
51415c9ee7aSSenthil Balasubramanian /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
51515c9ee7aSSenthil Balasubramanian /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0),
51615c9ee7aSSenthil Balasubramanian /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0),
51715c9ee7aSSenthil Balasubramanian /* Data[4].ctlEdges[4].bChannel */ 0xFF,
51815c9ee7aSSenthil Balasubramanian /* Data[4].ctlEdges[5].bChannel */ 0xFF,
51915c9ee7aSSenthil Balasubramanian /* Data[4].ctlEdges[6].bChannel */ 0xFF,
52015c9ee7aSSenthil Balasubramanian /* Data[4].ctlEdges[7].bChannel */ 0xFF,
52115c9ee7aSSenthil Balasubramanian },
52215c9ee7aSSenthil Balasubramanian
52315c9ee7aSSenthil Balasubramanian {
52415c9ee7aSSenthil Balasubramanian /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
52515c9ee7aSSenthil Balasubramanian /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0),
52615c9ee7aSSenthil Balasubramanian /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0),
52715c9ee7aSSenthil Balasubramanian /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
52815c9ee7aSSenthil Balasubramanian /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0),
52915c9ee7aSSenthil Balasubramanian /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
53015c9ee7aSSenthil Balasubramanian /* Data[5].ctlEdges[6].bChannel */ 0xFF,
53115c9ee7aSSenthil Balasubramanian /* Data[5].ctlEdges[7].bChannel */ 0xFF
53215c9ee7aSSenthil Balasubramanian },
53315c9ee7aSSenthil Balasubramanian
53415c9ee7aSSenthil Balasubramanian {
53515c9ee7aSSenthil Balasubramanian /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
53615c9ee7aSSenthil Balasubramanian /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
53715c9ee7aSSenthil Balasubramanian /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0),
53815c9ee7aSSenthil Balasubramanian /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0),
53915c9ee7aSSenthil Balasubramanian /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
54015c9ee7aSSenthil Balasubramanian /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0),
54115c9ee7aSSenthil Balasubramanian /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0),
54215c9ee7aSSenthil Balasubramanian /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0)
54315c9ee7aSSenthil Balasubramanian },
54415c9ee7aSSenthil Balasubramanian
54515c9ee7aSSenthil Balasubramanian {
54615c9ee7aSSenthil Balasubramanian /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
54715c9ee7aSSenthil Balasubramanian /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
54815c9ee7aSSenthil Balasubramanian /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0),
54915c9ee7aSSenthil Balasubramanian /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
55015c9ee7aSSenthil Balasubramanian /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0),
55115c9ee7aSSenthil Balasubramanian /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
55215c9ee7aSSenthil Balasubramanian /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
55315c9ee7aSSenthil Balasubramanian /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
55415c9ee7aSSenthil Balasubramanian },
55515c9ee7aSSenthil Balasubramanian
55615c9ee7aSSenthil Balasubramanian {
55715c9ee7aSSenthil Balasubramanian /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
55815c9ee7aSSenthil Balasubramanian /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
55915c9ee7aSSenthil Balasubramanian /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
56015c9ee7aSSenthil Balasubramanian /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
56115c9ee7aSSenthil Balasubramanian /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0),
56215c9ee7aSSenthil Balasubramanian /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
56315c9ee7aSSenthil Balasubramanian /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0),
56415c9ee7aSSenthil Balasubramanian /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0)
56515c9ee7aSSenthil Balasubramanian }
56615c9ee7aSSenthil Balasubramanian },
56715c9ee7aSSenthil Balasubramanian .ctlPowerData_5G = {
56815c9ee7aSSenthil Balasubramanian {
56915c9ee7aSSenthil Balasubramanian {
570e702ba18SFelix Fietkau CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
571e702ba18SFelix Fietkau CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
57215c9ee7aSSenthil Balasubramanian }
57315c9ee7aSSenthil Balasubramanian },
57415c9ee7aSSenthil Balasubramanian {
57515c9ee7aSSenthil Balasubramanian {
576e702ba18SFelix Fietkau CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
577e702ba18SFelix Fietkau CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
57815c9ee7aSSenthil Balasubramanian }
57915c9ee7aSSenthil Balasubramanian },
58015c9ee7aSSenthil Balasubramanian {
58115c9ee7aSSenthil Balasubramanian {
582e702ba18SFelix Fietkau CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
583e702ba18SFelix Fietkau CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
58415c9ee7aSSenthil Balasubramanian }
58515c9ee7aSSenthil Balasubramanian },
58615c9ee7aSSenthil Balasubramanian {
58715c9ee7aSSenthil Balasubramanian {
588e702ba18SFelix Fietkau CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
589e702ba18SFelix Fietkau CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
59015c9ee7aSSenthil Balasubramanian }
59115c9ee7aSSenthil Balasubramanian },
59215c9ee7aSSenthil Balasubramanian {
59315c9ee7aSSenthil Balasubramanian {
594e702ba18SFelix Fietkau CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
595e702ba18SFelix Fietkau CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
59615c9ee7aSSenthil Balasubramanian }
59715c9ee7aSSenthil Balasubramanian },
59815c9ee7aSSenthil Balasubramanian {
59915c9ee7aSSenthil Balasubramanian {
600e702ba18SFelix Fietkau CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
601e702ba18SFelix Fietkau CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
60215c9ee7aSSenthil Balasubramanian }
60315c9ee7aSSenthil Balasubramanian },
60415c9ee7aSSenthil Balasubramanian {
60515c9ee7aSSenthil Balasubramanian {
606e702ba18SFelix Fietkau CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
607e702ba18SFelix Fietkau CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
60815c9ee7aSSenthil Balasubramanian }
60915c9ee7aSSenthil Balasubramanian },
61015c9ee7aSSenthil Balasubramanian {
61115c9ee7aSSenthil Balasubramanian {
612e702ba18SFelix Fietkau CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
613e702ba18SFelix Fietkau CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
61415c9ee7aSSenthil Balasubramanian }
61515c9ee7aSSenthil Balasubramanian },
61615c9ee7aSSenthil Balasubramanian {
61715c9ee7aSSenthil Balasubramanian {
618e702ba18SFelix Fietkau CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
619e702ba18SFelix Fietkau CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
62015c9ee7aSSenthil Balasubramanian }
62115c9ee7aSSenthil Balasubramanian },
62215c9ee7aSSenthil Balasubramanian }
62315c9ee7aSSenthil Balasubramanian };
62415c9ee7aSSenthil Balasubramanian
62530923549SSenthil Balasubramanian static const struct ar9300_eeprom ar9300_x113 = {
62630923549SSenthil Balasubramanian .eepromVersion = 2,
62730923549SSenthil Balasubramanian .templateVersion = 6,
62830923549SSenthil Balasubramanian .macAddr = {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0},
62930923549SSenthil Balasubramanian .custData = {"x113-023-f0000"},
63030923549SSenthil Balasubramanian .baseEepHeader = {
63130923549SSenthil Balasubramanian .regDmn = { LE16(0), LE16(0x1f) },
63230923549SSenthil Balasubramanian .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */
63330923549SSenthil Balasubramanian .opCapFlags = {
6349ba7f4f5SLuis R. Rodriguez .opFlags = AR5416_OPFLAGS_11A,
635291478b7SMartin Blumenstingl .eepMisc = AR9300_EEPMISC_LITTLE_ENDIAN,
63630923549SSenthil Balasubramanian },
63730923549SSenthil Balasubramanian .rfSilent = 0,
63830923549SSenthil Balasubramanian .blueToothOptions = 0,
63930923549SSenthil Balasubramanian .deviceCap = 0,
64030923549SSenthil Balasubramanian .deviceType = 5, /* takes lower byte in eeprom location */
64130923549SSenthil Balasubramanian .pwrTableOffset = AR9300_PWR_TABLE_OFFSET,
64230923549SSenthil Balasubramanian .params_for_tuning_caps = {0, 0},
64330923549SSenthil Balasubramanian .featureEnable = 0x0d,
64430923549SSenthil Balasubramanian /*
64530923549SSenthil Balasubramanian * bit0 - enable tx temp comp - disabled
64630923549SSenthil Balasubramanian * bit1 - enable tx volt comp - disabled
64730923549SSenthil Balasubramanian * bit2 - enable fastClock - enabled
64830923549SSenthil Balasubramanian * bit3 - enable doubling - enabled
64930923549SSenthil Balasubramanian * bit4 - enable internal regulator - disabled
65030923549SSenthil Balasubramanian * bit5 - enable pa predistortion - disabled
65130923549SSenthil Balasubramanian */
65230923549SSenthil Balasubramanian .miscConfiguration = 0, /* bit0 - turn down drivestrength */
65330923549SSenthil Balasubramanian .eepromWriteEnableGpio = 6,
65430923549SSenthil Balasubramanian .wlanDisableGpio = 0,
65530923549SSenthil Balasubramanian .wlanLedGpio = 8,
65630923549SSenthil Balasubramanian .rxBandSelectGpio = 0xff,
65730923549SSenthil Balasubramanian .txrxgain = 0x21,
65830923549SSenthil Balasubramanian .swreg = 0,
65930923549SSenthil Balasubramanian },
66030923549SSenthil Balasubramanian .modalHeader2G = {
66130923549SSenthil Balasubramanian /* ar9300_modal_eep_header 2g */
66230923549SSenthil Balasubramanian /* 4 idle,t1,t2,b(4 bits per setting) */
66330923549SSenthil Balasubramanian .antCtrlCommon = LE32(0x110),
66430923549SSenthil Balasubramanian /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
66530923549SSenthil Balasubramanian .antCtrlCommon2 = LE32(0x44444),
66630923549SSenthil Balasubramanian
66730923549SSenthil Balasubramanian /*
66830923549SSenthil Balasubramanian * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
66930923549SSenthil Balasubramanian * rx1, rx12, b (2 bits each)
67030923549SSenthil Balasubramanian */
67130923549SSenthil Balasubramanian .antCtrlChain = { LE16(0x150), LE16(0x150), LE16(0x150) },
67230923549SSenthil Balasubramanian
67330923549SSenthil Balasubramanian /*
67430923549SSenthil Balasubramanian * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
67530923549SSenthil Balasubramanian * for ar9280 (0xa20c/b20c 5:0)
67630923549SSenthil Balasubramanian */
67730923549SSenthil Balasubramanian .xatten1DB = {0, 0, 0},
67830923549SSenthil Balasubramanian
67930923549SSenthil Balasubramanian /*
68030923549SSenthil Balasubramanian * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
68130923549SSenthil Balasubramanian * for ar9280 (0xa20c/b20c 16:12
68230923549SSenthil Balasubramanian */
68330923549SSenthil Balasubramanian .xatten1Margin = {0, 0, 0},
68430923549SSenthil Balasubramanian .tempSlope = 25,
68530923549SSenthil Balasubramanian .voltSlope = 0,
68630923549SSenthil Balasubramanian
68730923549SSenthil Balasubramanian /*
68830923549SSenthil Balasubramanian * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur
68930923549SSenthil Balasubramanian * channels in usual fbin coding format
69030923549SSenthil Balasubramanian */
69130923549SSenthil Balasubramanian .spurChans = {FREQ2FBIN(2464, 1), 0, 0, 0, 0},
69230923549SSenthil Balasubramanian
69330923549SSenthil Balasubramanian /*
69430923549SSenthil Balasubramanian * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check
69530923549SSenthil Balasubramanian * if the register is per chain
69630923549SSenthil Balasubramanian */
69730923549SSenthil Balasubramanian .noiseFloorThreshCh = {-1, 0, 0},
698df222edcSRajkumar Manoharan .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
699df222edcSRajkumar Manoharan .quick_drop = 0,
70030923549SSenthil Balasubramanian .xpaBiasLvl = 0,
70130923549SSenthil Balasubramanian .txFrameToDataStart = 0x0e,
70230923549SSenthil Balasubramanian .txFrameToPaOn = 0x0e,
70330923549SSenthil Balasubramanian .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
70430923549SSenthil Balasubramanian .antennaGain = 0,
70530923549SSenthil Balasubramanian .switchSettling = 0x2c,
70630923549SSenthil Balasubramanian .adcDesiredSize = -30,
70730923549SSenthil Balasubramanian .txEndToXpaOff = 0,
70830923549SSenthil Balasubramanian .txEndToRxOn = 0x2,
70930923549SSenthil Balasubramanian .txFrameToXpaOn = 0xe,
71030923549SSenthil Balasubramanian .thresh62 = 28,
71130923549SSenthil Balasubramanian .papdRateMaskHt20 = LE32(0x0c80c080),
71230923549SSenthil Balasubramanian .papdRateMaskHt40 = LE32(0x0080c080),
71366a80a3aSSujith Manoharan .switchcomspdt = 0,
7143e2ea543SFelix Fietkau .xlna_bias_strength = 0,
71530923549SSenthil Balasubramanian .futureModal = {
7163e2ea543SFelix Fietkau 0, 0, 0, 0, 0, 0, 0,
71730923549SSenthil Balasubramanian },
71830923549SSenthil Balasubramanian },
71930923549SSenthil Balasubramanian .base_ext1 = {
72030923549SSenthil Balasubramanian .ant_div_control = 0,
721ee65b388SSujith Manoharan .future = {0, 0},
722420e2b1bSRajkumar Manoharan .tempslopextension = {0, 0, 0, 0, 0, 0, 0, 0}
72330923549SSenthil Balasubramanian },
72430923549SSenthil Balasubramanian .calFreqPier2G = {
72530923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
72630923549SSenthil Balasubramanian FREQ2FBIN(2437, 1),
72730923549SSenthil Balasubramanian FREQ2FBIN(2472, 1),
72830923549SSenthil Balasubramanian },
72930923549SSenthil Balasubramanian /* ar9300_cal_data_per_freq_op_loop 2g */
73030923549SSenthil Balasubramanian .calPierData2G = {
73130923549SSenthil Balasubramanian { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
73230923549SSenthil Balasubramanian { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
73330923549SSenthil Balasubramanian { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
73430923549SSenthil Balasubramanian },
73530923549SSenthil Balasubramanian .calTarget_freqbin_Cck = {
73630923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
73730923549SSenthil Balasubramanian FREQ2FBIN(2472, 1),
73830923549SSenthil Balasubramanian },
73930923549SSenthil Balasubramanian .calTarget_freqbin_2G = {
74030923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
74130923549SSenthil Balasubramanian FREQ2FBIN(2437, 1),
74230923549SSenthil Balasubramanian FREQ2FBIN(2472, 1)
74330923549SSenthil Balasubramanian },
74430923549SSenthil Balasubramanian .calTarget_freqbin_2GHT20 = {
74530923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
74630923549SSenthil Balasubramanian FREQ2FBIN(2437, 1),
74730923549SSenthil Balasubramanian FREQ2FBIN(2472, 1)
74830923549SSenthil Balasubramanian },
74930923549SSenthil Balasubramanian .calTarget_freqbin_2GHT40 = {
75030923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
75130923549SSenthil Balasubramanian FREQ2FBIN(2437, 1),
75230923549SSenthil Balasubramanian FREQ2FBIN(2472, 1)
75330923549SSenthil Balasubramanian },
75430923549SSenthil Balasubramanian .calTargetPowerCck = {
75530923549SSenthil Balasubramanian /* 1L-5L,5S,11L,11S */
75630923549SSenthil Balasubramanian { {34, 34, 34, 34} },
75730923549SSenthil Balasubramanian { {34, 34, 34, 34} },
75830923549SSenthil Balasubramanian },
75930923549SSenthil Balasubramanian .calTargetPower2G = {
76030923549SSenthil Balasubramanian /* 6-24,36,48,54 */
76130923549SSenthil Balasubramanian { {34, 34, 32, 32} },
76230923549SSenthil Balasubramanian { {34, 34, 32, 32} },
76330923549SSenthil Balasubramanian { {34, 34, 32, 32} },
76430923549SSenthil Balasubramanian },
76530923549SSenthil Balasubramanian .calTargetPower2GHT20 = {
76630923549SSenthil Balasubramanian { {32, 32, 32, 32, 32, 28, 32, 32, 30, 28, 0, 0, 0, 0} },
76730923549SSenthil Balasubramanian { {32, 32, 32, 32, 32, 28, 32, 32, 30, 28, 0, 0, 0, 0} },
76830923549SSenthil Balasubramanian { {32, 32, 32, 32, 32, 28, 32, 32, 30, 28, 0, 0, 0, 0} },
76930923549SSenthil Balasubramanian },
77030923549SSenthil Balasubramanian .calTargetPower2GHT40 = {
77130923549SSenthil Balasubramanian { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
77230923549SSenthil Balasubramanian { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
77330923549SSenthil Balasubramanian { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
77430923549SSenthil Balasubramanian },
77530923549SSenthil Balasubramanian .ctlIndex_2G = {
77630923549SSenthil Balasubramanian 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
77730923549SSenthil Balasubramanian 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
77830923549SSenthil Balasubramanian },
77930923549SSenthil Balasubramanian .ctl_freqbin_2G = {
78030923549SSenthil Balasubramanian {
78130923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
78230923549SSenthil Balasubramanian FREQ2FBIN(2417, 1),
78330923549SSenthil Balasubramanian FREQ2FBIN(2457, 1),
78430923549SSenthil Balasubramanian FREQ2FBIN(2462, 1)
78530923549SSenthil Balasubramanian },
78630923549SSenthil Balasubramanian {
78730923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
78830923549SSenthil Balasubramanian FREQ2FBIN(2417, 1),
78930923549SSenthil Balasubramanian FREQ2FBIN(2462, 1),
79030923549SSenthil Balasubramanian 0xFF,
79130923549SSenthil Balasubramanian },
79230923549SSenthil Balasubramanian
79330923549SSenthil Balasubramanian {
79430923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
79530923549SSenthil Balasubramanian FREQ2FBIN(2417, 1),
79630923549SSenthil Balasubramanian FREQ2FBIN(2462, 1),
79730923549SSenthil Balasubramanian 0xFF,
79830923549SSenthil Balasubramanian },
79930923549SSenthil Balasubramanian {
80030923549SSenthil Balasubramanian FREQ2FBIN(2422, 1),
80130923549SSenthil Balasubramanian FREQ2FBIN(2427, 1),
80230923549SSenthil Balasubramanian FREQ2FBIN(2447, 1),
80330923549SSenthil Balasubramanian FREQ2FBIN(2452, 1)
80430923549SSenthil Balasubramanian },
80530923549SSenthil Balasubramanian
80630923549SSenthil Balasubramanian {
80730923549SSenthil Balasubramanian /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
80830923549SSenthil Balasubramanian /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
80930923549SSenthil Balasubramanian /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
81030923549SSenthil Balasubramanian /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1),
81130923549SSenthil Balasubramanian },
81230923549SSenthil Balasubramanian
81330923549SSenthil Balasubramanian {
81430923549SSenthil Balasubramanian /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
81530923549SSenthil Balasubramanian /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
81630923549SSenthil Balasubramanian /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
81730923549SSenthil Balasubramanian 0,
81830923549SSenthil Balasubramanian },
81930923549SSenthil Balasubramanian
82030923549SSenthil Balasubramanian {
82130923549SSenthil Balasubramanian /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
82230923549SSenthil Balasubramanian /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
82330923549SSenthil Balasubramanian FREQ2FBIN(2472, 1),
82430923549SSenthil Balasubramanian 0,
82530923549SSenthil Balasubramanian },
82630923549SSenthil Balasubramanian
82730923549SSenthil Balasubramanian {
82830923549SSenthil Balasubramanian /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
82930923549SSenthil Balasubramanian /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
83030923549SSenthil Balasubramanian /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
83130923549SSenthil Balasubramanian /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
83230923549SSenthil Balasubramanian },
83330923549SSenthil Balasubramanian
83430923549SSenthil Balasubramanian {
83530923549SSenthil Balasubramanian /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
83630923549SSenthil Balasubramanian /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
83730923549SSenthil Balasubramanian /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
83830923549SSenthil Balasubramanian },
83930923549SSenthil Balasubramanian
84030923549SSenthil Balasubramanian {
84130923549SSenthil Balasubramanian /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
84230923549SSenthil Balasubramanian /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
84330923549SSenthil Balasubramanian /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
84430923549SSenthil Balasubramanian 0
84530923549SSenthil Balasubramanian },
84630923549SSenthil Balasubramanian
84730923549SSenthil Balasubramanian {
84830923549SSenthil Balasubramanian /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
84930923549SSenthil Balasubramanian /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
85030923549SSenthil Balasubramanian /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
85130923549SSenthil Balasubramanian 0
85230923549SSenthil Balasubramanian },
85330923549SSenthil Balasubramanian
85430923549SSenthil Balasubramanian {
85530923549SSenthil Balasubramanian /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
85630923549SSenthil Balasubramanian /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
85730923549SSenthil Balasubramanian /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
85830923549SSenthil Balasubramanian /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
85930923549SSenthil Balasubramanian }
86030923549SSenthil Balasubramanian },
86130923549SSenthil Balasubramanian .ctlPowerData_2G = {
862fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
863fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
864fe6c7915SDavid S. Miller { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
86530923549SSenthil Balasubramanian
86615052f81SRajkumar Manoharan { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0) } },
867fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
868fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
86930923549SSenthil Balasubramanian
870fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
871fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
872fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
87330923549SSenthil Balasubramanian
874fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
875fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
876fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
87730923549SSenthil Balasubramanian },
87830923549SSenthil Balasubramanian .modalHeader5G = {
87930923549SSenthil Balasubramanian /* 4 idle,t1,t2,b (4 bits per setting) */
88030923549SSenthil Balasubramanian .antCtrlCommon = LE32(0x220),
88130923549SSenthil Balasubramanian /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
88230923549SSenthil Balasubramanian .antCtrlCommon2 = LE32(0x11111),
88330923549SSenthil Balasubramanian /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
88430923549SSenthil Balasubramanian .antCtrlChain = {
88530923549SSenthil Balasubramanian LE16(0x150), LE16(0x150), LE16(0x150),
88630923549SSenthil Balasubramanian },
88730923549SSenthil Balasubramanian /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
88830923549SSenthil Balasubramanian .xatten1DB = {0, 0, 0},
88930923549SSenthil Balasubramanian
89030923549SSenthil Balasubramanian /*
89130923549SSenthil Balasubramanian * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
89230923549SSenthil Balasubramanian * for merlin (0xa20c/b20c 16:12
89330923549SSenthil Balasubramanian */
89430923549SSenthil Balasubramanian .xatten1Margin = {0, 0, 0},
89530923549SSenthil Balasubramanian .tempSlope = 68,
89630923549SSenthil Balasubramanian .voltSlope = 0,
89730923549SSenthil Balasubramanian /* spurChans spur channels in usual fbin coding format */
89830923549SSenthil Balasubramanian .spurChans = {FREQ2FBIN(5500, 0), 0, 0, 0, 0},
89930923549SSenthil Balasubramanian /* noiseFloorThreshCh Check if the register is per chain */
90030923549SSenthil Balasubramanian .noiseFloorThreshCh = {-1, 0, 0},
901df222edcSRajkumar Manoharan .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
902df222edcSRajkumar Manoharan .quick_drop = 0,
903be0e6aa5SSenthil Balasubramanian .xpaBiasLvl = 0xf,
90430923549SSenthil Balasubramanian .txFrameToDataStart = 0x0e,
90530923549SSenthil Balasubramanian .txFrameToPaOn = 0x0e,
90630923549SSenthil Balasubramanian .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
90730923549SSenthil Balasubramanian .antennaGain = 0,
90830923549SSenthil Balasubramanian .switchSettling = 0x2d,
90930923549SSenthil Balasubramanian .adcDesiredSize = -30,
91030923549SSenthil Balasubramanian .txEndToXpaOff = 0,
91130923549SSenthil Balasubramanian .txEndToRxOn = 0x2,
91230923549SSenthil Balasubramanian .txFrameToXpaOn = 0xe,
91330923549SSenthil Balasubramanian .thresh62 = 28,
91430923549SSenthil Balasubramanian .papdRateMaskHt20 = LE32(0x0cf0e0e0),
91530923549SSenthil Balasubramanian .papdRateMaskHt40 = LE32(0x6cf0e0e0),
91666a80a3aSSujith Manoharan .switchcomspdt = 0,
9173e2ea543SFelix Fietkau .xlna_bias_strength = 0,
91830923549SSenthil Balasubramanian .futureModal = {
9193e2ea543SFelix Fietkau 0, 0, 0, 0, 0, 0, 0,
92030923549SSenthil Balasubramanian },
92130923549SSenthil Balasubramanian },
92230923549SSenthil Balasubramanian .base_ext2 = {
92330923549SSenthil Balasubramanian .tempSlopeLow = 72,
92430923549SSenthil Balasubramanian .tempSlopeHigh = 105,
92530923549SSenthil Balasubramanian .xatten1DBLow = {0, 0, 0},
92630923549SSenthil Balasubramanian .xatten1MarginLow = {0, 0, 0},
92730923549SSenthil Balasubramanian .xatten1DBHigh = {0, 0, 0},
92830923549SSenthil Balasubramanian .xatten1MarginHigh = {0, 0, 0}
92930923549SSenthil Balasubramanian },
93030923549SSenthil Balasubramanian .calFreqPier5G = {
93130923549SSenthil Balasubramanian FREQ2FBIN(5180, 0),
93230923549SSenthil Balasubramanian FREQ2FBIN(5240, 0),
93330923549SSenthil Balasubramanian FREQ2FBIN(5320, 0),
93430923549SSenthil Balasubramanian FREQ2FBIN(5400, 0),
93530923549SSenthil Balasubramanian FREQ2FBIN(5500, 0),
93630923549SSenthil Balasubramanian FREQ2FBIN(5600, 0),
93730923549SSenthil Balasubramanian FREQ2FBIN(5745, 0),
93830923549SSenthil Balasubramanian FREQ2FBIN(5785, 0)
93930923549SSenthil Balasubramanian },
94030923549SSenthil Balasubramanian .calPierData5G = {
94130923549SSenthil Balasubramanian {
94230923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
94330923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
94430923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
94530923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
94630923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
94730923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
94830923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
94930923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
95030923549SSenthil Balasubramanian },
95130923549SSenthil Balasubramanian {
95230923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
95330923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
95430923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
95530923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
95630923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
95730923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
95830923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
95930923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
96030923549SSenthil Balasubramanian },
96130923549SSenthil Balasubramanian {
96230923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
96330923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
96430923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
96530923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
96630923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
96730923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
96830923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
96930923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
97030923549SSenthil Balasubramanian },
97130923549SSenthil Balasubramanian
97230923549SSenthil Balasubramanian },
97330923549SSenthil Balasubramanian .calTarget_freqbin_5G = {
97430923549SSenthil Balasubramanian FREQ2FBIN(5180, 0),
97530923549SSenthil Balasubramanian FREQ2FBIN(5220, 0),
97630923549SSenthil Balasubramanian FREQ2FBIN(5320, 0),
97730923549SSenthil Balasubramanian FREQ2FBIN(5400, 0),
97830923549SSenthil Balasubramanian FREQ2FBIN(5500, 0),
97930923549SSenthil Balasubramanian FREQ2FBIN(5600, 0),
98030923549SSenthil Balasubramanian FREQ2FBIN(5745, 0),
98130923549SSenthil Balasubramanian FREQ2FBIN(5785, 0)
98230923549SSenthil Balasubramanian },
98330923549SSenthil Balasubramanian .calTarget_freqbin_5GHT20 = {
98430923549SSenthil Balasubramanian FREQ2FBIN(5180, 0),
98530923549SSenthil Balasubramanian FREQ2FBIN(5240, 0),
98630923549SSenthil Balasubramanian FREQ2FBIN(5320, 0),
98730923549SSenthil Balasubramanian FREQ2FBIN(5400, 0),
98830923549SSenthil Balasubramanian FREQ2FBIN(5500, 0),
98930923549SSenthil Balasubramanian FREQ2FBIN(5700, 0),
99030923549SSenthil Balasubramanian FREQ2FBIN(5745, 0),
99130923549SSenthil Balasubramanian FREQ2FBIN(5825, 0)
99230923549SSenthil Balasubramanian },
99330923549SSenthil Balasubramanian .calTarget_freqbin_5GHT40 = {
99430923549SSenthil Balasubramanian FREQ2FBIN(5190, 0),
99530923549SSenthil Balasubramanian FREQ2FBIN(5230, 0),
99630923549SSenthil Balasubramanian FREQ2FBIN(5320, 0),
99730923549SSenthil Balasubramanian FREQ2FBIN(5410, 0),
99830923549SSenthil Balasubramanian FREQ2FBIN(5510, 0),
99930923549SSenthil Balasubramanian FREQ2FBIN(5670, 0),
100030923549SSenthil Balasubramanian FREQ2FBIN(5755, 0),
100130923549SSenthil Balasubramanian FREQ2FBIN(5825, 0)
100230923549SSenthil Balasubramanian },
100330923549SSenthil Balasubramanian .calTargetPower5G = {
100430923549SSenthil Balasubramanian /* 6-24,36,48,54 */
100530923549SSenthil Balasubramanian { {42, 40, 40, 34} },
100630923549SSenthil Balasubramanian { {42, 40, 40, 34} },
100730923549SSenthil Balasubramanian { {42, 40, 40, 34} },
100830923549SSenthil Balasubramanian { {42, 40, 40, 34} },
100930923549SSenthil Balasubramanian { {42, 40, 40, 34} },
101030923549SSenthil Balasubramanian { {42, 40, 40, 34} },
101130923549SSenthil Balasubramanian { {42, 40, 40, 34} },
101230923549SSenthil Balasubramanian { {42, 40, 40, 34} },
101330923549SSenthil Balasubramanian },
101430923549SSenthil Balasubramanian .calTargetPower5GHT20 = {
101530923549SSenthil Balasubramanian /*
101630923549SSenthil Balasubramanian * 0_8_16,1-3_9-11_17-19,
101730923549SSenthil Balasubramanian * 4,5,6,7,12,13,14,15,20,21,22,23
101830923549SSenthil Balasubramanian */
101930923549SSenthil Balasubramanian { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
102030923549SSenthil Balasubramanian { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
102130923549SSenthil Balasubramanian { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
102230923549SSenthil Balasubramanian { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
102330923549SSenthil Balasubramanian { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
102430923549SSenthil Balasubramanian { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
102530923549SSenthil Balasubramanian { {38, 38, 38, 38, 32, 28, 38, 38, 32, 28, 38, 38, 32, 26} },
102630923549SSenthil Balasubramanian { {36, 36, 36, 36, 32, 28, 36, 36, 32, 28, 36, 36, 32, 26} },
102730923549SSenthil Balasubramanian },
102830923549SSenthil Balasubramanian .calTargetPower5GHT40 = {
102930923549SSenthil Balasubramanian /*
103030923549SSenthil Balasubramanian * 0_8_16,1-3_9-11_17-19,
103130923549SSenthil Balasubramanian * 4,5,6,7,12,13,14,15,20,21,22,23
103230923549SSenthil Balasubramanian */
103330923549SSenthil Balasubramanian { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
103430923549SSenthil Balasubramanian { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
103530923549SSenthil Balasubramanian { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
103630923549SSenthil Balasubramanian { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
103730923549SSenthil Balasubramanian { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
103830923549SSenthil Balasubramanian { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
103930923549SSenthil Balasubramanian { {36, 36, 36, 36, 30, 26, 36, 36, 30, 26, 36, 36, 30, 24} },
104030923549SSenthil Balasubramanian { {34, 34, 34, 34, 30, 26, 34, 34, 30, 26, 34, 34, 30, 24} },
104130923549SSenthil Balasubramanian },
104230923549SSenthil Balasubramanian .ctlIndex_5G = {
104330923549SSenthil Balasubramanian 0x10, 0x16, 0x18, 0x40, 0x46,
104430923549SSenthil Balasubramanian 0x48, 0x30, 0x36, 0x38
104530923549SSenthil Balasubramanian },
104630923549SSenthil Balasubramanian .ctl_freqbin_5G = {
104730923549SSenthil Balasubramanian {
104830923549SSenthil Balasubramanian /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
104930923549SSenthil Balasubramanian /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
105030923549SSenthil Balasubramanian /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
105130923549SSenthil Balasubramanian /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
105230923549SSenthil Balasubramanian /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0),
105330923549SSenthil Balasubramanian /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
105430923549SSenthil Balasubramanian /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
105530923549SSenthil Balasubramanian /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
105630923549SSenthil Balasubramanian },
105730923549SSenthil Balasubramanian {
105830923549SSenthil Balasubramanian /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
105930923549SSenthil Balasubramanian /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
106030923549SSenthil Balasubramanian /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
106130923549SSenthil Balasubramanian /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
106230923549SSenthil Balasubramanian /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0),
106330923549SSenthil Balasubramanian /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
106430923549SSenthil Balasubramanian /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
106530923549SSenthil Balasubramanian /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
106630923549SSenthil Balasubramanian },
106730923549SSenthil Balasubramanian
106830923549SSenthil Balasubramanian {
106930923549SSenthil Balasubramanian /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
107030923549SSenthil Balasubramanian /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
107130923549SSenthil Balasubramanian /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
107230923549SSenthil Balasubramanian /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0),
107330923549SSenthil Balasubramanian /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0),
107430923549SSenthil Balasubramanian /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0),
107530923549SSenthil Balasubramanian /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0),
107630923549SSenthil Balasubramanian /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0)
107730923549SSenthil Balasubramanian },
107830923549SSenthil Balasubramanian
107930923549SSenthil Balasubramanian {
108030923549SSenthil Balasubramanian /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
108130923549SSenthil Balasubramanian /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
108230923549SSenthil Balasubramanian /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0),
108330923549SSenthil Balasubramanian /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0),
108430923549SSenthil Balasubramanian /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
108530923549SSenthil Balasubramanian /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
108630923549SSenthil Balasubramanian /* Data[3].ctlEdges[6].bChannel */ 0xFF,
108730923549SSenthil Balasubramanian /* Data[3].ctlEdges[7].bChannel */ 0xFF,
108830923549SSenthil Balasubramanian },
108930923549SSenthil Balasubramanian
109030923549SSenthil Balasubramanian {
109130923549SSenthil Balasubramanian /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
109230923549SSenthil Balasubramanian /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
109330923549SSenthil Balasubramanian /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0),
109430923549SSenthil Balasubramanian /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0),
109530923549SSenthil Balasubramanian /* Data[4].ctlEdges[4].bChannel */ 0xFF,
109630923549SSenthil Balasubramanian /* Data[4].ctlEdges[5].bChannel */ 0xFF,
109730923549SSenthil Balasubramanian /* Data[4].ctlEdges[6].bChannel */ 0xFF,
109830923549SSenthil Balasubramanian /* Data[4].ctlEdges[7].bChannel */ 0xFF,
109930923549SSenthil Balasubramanian },
110030923549SSenthil Balasubramanian
110130923549SSenthil Balasubramanian {
110230923549SSenthil Balasubramanian /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
110330923549SSenthil Balasubramanian /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0),
110430923549SSenthil Balasubramanian /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0),
110530923549SSenthil Balasubramanian /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
110630923549SSenthil Balasubramanian /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0),
110730923549SSenthil Balasubramanian /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
110830923549SSenthil Balasubramanian /* Data[5].ctlEdges[6].bChannel */ 0xFF,
110930923549SSenthil Balasubramanian /* Data[5].ctlEdges[7].bChannel */ 0xFF
111030923549SSenthil Balasubramanian },
111130923549SSenthil Balasubramanian
111230923549SSenthil Balasubramanian {
111330923549SSenthil Balasubramanian /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
111430923549SSenthil Balasubramanian /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
111530923549SSenthil Balasubramanian /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0),
111630923549SSenthil Balasubramanian /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0),
111730923549SSenthil Balasubramanian /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
111830923549SSenthil Balasubramanian /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0),
111930923549SSenthil Balasubramanian /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0),
112030923549SSenthil Balasubramanian /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0)
112130923549SSenthil Balasubramanian },
112230923549SSenthil Balasubramanian
112330923549SSenthil Balasubramanian {
112430923549SSenthil Balasubramanian /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
112530923549SSenthil Balasubramanian /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
112630923549SSenthil Balasubramanian /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0),
112730923549SSenthil Balasubramanian /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
112830923549SSenthil Balasubramanian /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0),
112930923549SSenthil Balasubramanian /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
113030923549SSenthil Balasubramanian /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
113130923549SSenthil Balasubramanian /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
113230923549SSenthil Balasubramanian },
113330923549SSenthil Balasubramanian
113430923549SSenthil Balasubramanian {
113530923549SSenthil Balasubramanian /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
113630923549SSenthil Balasubramanian /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
113730923549SSenthil Balasubramanian /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
113830923549SSenthil Balasubramanian /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
113930923549SSenthil Balasubramanian /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0),
114030923549SSenthil Balasubramanian /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
114130923549SSenthil Balasubramanian /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0),
114230923549SSenthil Balasubramanian /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0)
114330923549SSenthil Balasubramanian }
114430923549SSenthil Balasubramanian },
114530923549SSenthil Balasubramanian .ctlPowerData_5G = {
114630923549SSenthil Balasubramanian {
114730923549SSenthil Balasubramanian {
1148fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
1149fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
115030923549SSenthil Balasubramanian }
115130923549SSenthil Balasubramanian },
115230923549SSenthil Balasubramanian {
115330923549SSenthil Balasubramanian {
1154fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
1155fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
115630923549SSenthil Balasubramanian }
115730923549SSenthil Balasubramanian },
115830923549SSenthil Balasubramanian {
115930923549SSenthil Balasubramanian {
1160fe6c7915SDavid S. Miller CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
1161fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
116230923549SSenthil Balasubramanian }
116330923549SSenthil Balasubramanian },
116430923549SSenthil Balasubramanian {
116530923549SSenthil Balasubramanian {
1166fe6c7915SDavid S. Miller CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
1167fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
116830923549SSenthil Balasubramanian }
116930923549SSenthil Balasubramanian },
117030923549SSenthil Balasubramanian {
117130923549SSenthil Balasubramanian {
1172fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
1173fe6c7915SDavid S. Miller CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
117430923549SSenthil Balasubramanian }
117530923549SSenthil Balasubramanian },
117630923549SSenthil Balasubramanian {
117730923549SSenthil Balasubramanian {
1178fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
1179fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
118030923549SSenthil Balasubramanian }
118130923549SSenthil Balasubramanian },
118230923549SSenthil Balasubramanian {
118330923549SSenthil Balasubramanian {
1184fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
1185fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
118630923549SSenthil Balasubramanian }
118730923549SSenthil Balasubramanian },
118830923549SSenthil Balasubramanian {
118930923549SSenthil Balasubramanian {
1190fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
1191fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
119230923549SSenthil Balasubramanian }
119330923549SSenthil Balasubramanian },
119430923549SSenthil Balasubramanian {
119530923549SSenthil Balasubramanian {
1196fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
1197fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
119830923549SSenthil Balasubramanian }
119930923549SSenthil Balasubramanian },
120030923549SSenthil Balasubramanian }
120130923549SSenthil Balasubramanian };
120230923549SSenthil Balasubramanian
120330923549SSenthil Balasubramanian
120430923549SSenthil Balasubramanian static const struct ar9300_eeprom ar9300_h112 = {
120530923549SSenthil Balasubramanian .eepromVersion = 2,
120630923549SSenthil Balasubramanian .templateVersion = 3,
120730923549SSenthil Balasubramanian .macAddr = {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0},
120830923549SSenthil Balasubramanian .custData = {"h112-241-f0000"},
120930923549SSenthil Balasubramanian .baseEepHeader = {
121030923549SSenthil Balasubramanian .regDmn = { LE16(0), LE16(0x1f) },
121130923549SSenthil Balasubramanian .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */
121230923549SSenthil Balasubramanian .opCapFlags = {
12134ddfcd7dSFelix Fietkau .opFlags = AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A,
1214291478b7SMartin Blumenstingl .eepMisc = AR9300_EEPMISC_LITTLE_ENDIAN,
121530923549SSenthil Balasubramanian },
121630923549SSenthil Balasubramanian .rfSilent = 0,
121730923549SSenthil Balasubramanian .blueToothOptions = 0,
121830923549SSenthil Balasubramanian .deviceCap = 0,
121930923549SSenthil Balasubramanian .deviceType = 5, /* takes lower byte in eeprom location */
122030923549SSenthil Balasubramanian .pwrTableOffset = AR9300_PWR_TABLE_OFFSET,
122130923549SSenthil Balasubramanian .params_for_tuning_caps = {0, 0},
122230923549SSenthil Balasubramanian .featureEnable = 0x0d,
122330923549SSenthil Balasubramanian /*
122430923549SSenthil Balasubramanian * bit0 - enable tx temp comp - disabled
122530923549SSenthil Balasubramanian * bit1 - enable tx volt comp - disabled
122630923549SSenthil Balasubramanian * bit2 - enable fastClock - enabled
122730923549SSenthil Balasubramanian * bit3 - enable doubling - enabled
122830923549SSenthil Balasubramanian * bit4 - enable internal regulator - disabled
122930923549SSenthil Balasubramanian * bit5 - enable pa predistortion - disabled
123030923549SSenthil Balasubramanian */
123130923549SSenthil Balasubramanian .miscConfiguration = 0, /* bit0 - turn down drivestrength */
123230923549SSenthil Balasubramanian .eepromWriteEnableGpio = 6,
123330923549SSenthil Balasubramanian .wlanDisableGpio = 0,
123430923549SSenthil Balasubramanian .wlanLedGpio = 8,
123530923549SSenthil Balasubramanian .rxBandSelectGpio = 0xff,
123630923549SSenthil Balasubramanian .txrxgain = 0x10,
123730923549SSenthil Balasubramanian .swreg = 0,
123830923549SSenthil Balasubramanian },
123930923549SSenthil Balasubramanian .modalHeader2G = {
124030923549SSenthil Balasubramanian /* ar9300_modal_eep_header 2g */
124130923549SSenthil Balasubramanian /* 4 idle,t1,t2,b(4 bits per setting) */
124230923549SSenthil Balasubramanian .antCtrlCommon = LE32(0x110),
124330923549SSenthil Balasubramanian /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
124430923549SSenthil Balasubramanian .antCtrlCommon2 = LE32(0x44444),
124530923549SSenthil Balasubramanian
124630923549SSenthil Balasubramanian /*
124730923549SSenthil Balasubramanian * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
124830923549SSenthil Balasubramanian * rx1, rx12, b (2 bits each)
124930923549SSenthil Balasubramanian */
125030923549SSenthil Balasubramanian .antCtrlChain = { LE16(0x150), LE16(0x150), LE16(0x150) },
125130923549SSenthil Balasubramanian
125230923549SSenthil Balasubramanian /*
125330923549SSenthil Balasubramanian * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
125430923549SSenthil Balasubramanian * for ar9280 (0xa20c/b20c 5:0)
125530923549SSenthil Balasubramanian */
125630923549SSenthil Balasubramanian .xatten1DB = {0, 0, 0},
125730923549SSenthil Balasubramanian
125830923549SSenthil Balasubramanian /*
125930923549SSenthil Balasubramanian * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
126030923549SSenthil Balasubramanian * for ar9280 (0xa20c/b20c 16:12
126130923549SSenthil Balasubramanian */
126230923549SSenthil Balasubramanian .xatten1Margin = {0, 0, 0},
126330923549SSenthil Balasubramanian .tempSlope = 25,
126430923549SSenthil Balasubramanian .voltSlope = 0,
126530923549SSenthil Balasubramanian
126630923549SSenthil Balasubramanian /*
126730923549SSenthil Balasubramanian * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur
126830923549SSenthil Balasubramanian * channels in usual fbin coding format
126930923549SSenthil Balasubramanian */
127030923549SSenthil Balasubramanian .spurChans = {FREQ2FBIN(2464, 1), 0, 0, 0, 0},
127130923549SSenthil Balasubramanian
127230923549SSenthil Balasubramanian /*
127330923549SSenthil Balasubramanian * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check
127430923549SSenthil Balasubramanian * if the register is per chain
127530923549SSenthil Balasubramanian */
127630923549SSenthil Balasubramanian .noiseFloorThreshCh = {-1, 0, 0},
1277df222edcSRajkumar Manoharan .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
1278df222edcSRajkumar Manoharan .quick_drop = 0,
127930923549SSenthil Balasubramanian .xpaBiasLvl = 0,
128030923549SSenthil Balasubramanian .txFrameToDataStart = 0x0e,
128130923549SSenthil Balasubramanian .txFrameToPaOn = 0x0e,
128230923549SSenthil Balasubramanian .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
128330923549SSenthil Balasubramanian .antennaGain = 0,
128430923549SSenthil Balasubramanian .switchSettling = 0x2c,
128530923549SSenthil Balasubramanian .adcDesiredSize = -30,
128630923549SSenthil Balasubramanian .txEndToXpaOff = 0,
128730923549SSenthil Balasubramanian .txEndToRxOn = 0x2,
128830923549SSenthil Balasubramanian .txFrameToXpaOn = 0xe,
128930923549SSenthil Balasubramanian .thresh62 = 28,
129094e2ad9eSRajkumar Manoharan .papdRateMaskHt20 = LE32(0x0c80c080),
129194e2ad9eSRajkumar Manoharan .papdRateMaskHt40 = LE32(0x0080c080),
129266a80a3aSSujith Manoharan .switchcomspdt = 0,
12933e2ea543SFelix Fietkau .xlna_bias_strength = 0,
129430923549SSenthil Balasubramanian .futureModal = {
12953e2ea543SFelix Fietkau 0, 0, 0, 0, 0, 0, 0,
129630923549SSenthil Balasubramanian },
129730923549SSenthil Balasubramanian },
129830923549SSenthil Balasubramanian .base_ext1 = {
129930923549SSenthil Balasubramanian .ant_div_control = 0,
1300ee65b388SSujith Manoharan .future = {0, 0},
1301420e2b1bSRajkumar Manoharan .tempslopextension = {0, 0, 0, 0, 0, 0, 0, 0}
130230923549SSenthil Balasubramanian },
130330923549SSenthil Balasubramanian .calFreqPier2G = {
130430923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
130530923549SSenthil Balasubramanian FREQ2FBIN(2437, 1),
130694e2ad9eSRajkumar Manoharan FREQ2FBIN(2462, 1),
130730923549SSenthil Balasubramanian },
130830923549SSenthil Balasubramanian /* ar9300_cal_data_per_freq_op_loop 2g */
130930923549SSenthil Balasubramanian .calPierData2G = {
131030923549SSenthil Balasubramanian { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
131130923549SSenthil Balasubramanian { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
131230923549SSenthil Balasubramanian { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
131330923549SSenthil Balasubramanian },
131430923549SSenthil Balasubramanian .calTarget_freqbin_Cck = {
131530923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
131694e2ad9eSRajkumar Manoharan FREQ2FBIN(2472, 1),
131730923549SSenthil Balasubramanian },
131830923549SSenthil Balasubramanian .calTarget_freqbin_2G = {
131930923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
132030923549SSenthil Balasubramanian FREQ2FBIN(2437, 1),
132130923549SSenthil Balasubramanian FREQ2FBIN(2472, 1)
132230923549SSenthil Balasubramanian },
132330923549SSenthil Balasubramanian .calTarget_freqbin_2GHT20 = {
132430923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
132530923549SSenthil Balasubramanian FREQ2FBIN(2437, 1),
132630923549SSenthil Balasubramanian FREQ2FBIN(2472, 1)
132730923549SSenthil Balasubramanian },
132830923549SSenthil Balasubramanian .calTarget_freqbin_2GHT40 = {
132930923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
133030923549SSenthil Balasubramanian FREQ2FBIN(2437, 1),
133130923549SSenthil Balasubramanian FREQ2FBIN(2472, 1)
133230923549SSenthil Balasubramanian },
133330923549SSenthil Balasubramanian .calTargetPowerCck = {
133430923549SSenthil Balasubramanian /* 1L-5L,5S,11L,11S */
133530923549SSenthil Balasubramanian { {34, 34, 34, 34} },
133630923549SSenthil Balasubramanian { {34, 34, 34, 34} },
133730923549SSenthil Balasubramanian },
133830923549SSenthil Balasubramanian .calTargetPower2G = {
133930923549SSenthil Balasubramanian /* 6-24,36,48,54 */
134030923549SSenthil Balasubramanian { {34, 34, 32, 32} },
134130923549SSenthil Balasubramanian { {34, 34, 32, 32} },
134230923549SSenthil Balasubramanian { {34, 34, 32, 32} },
134330923549SSenthil Balasubramanian },
134430923549SSenthil Balasubramanian .calTargetPower2GHT20 = {
134530923549SSenthil Balasubramanian { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 28, 28, 28, 24} },
134630923549SSenthil Balasubramanian { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 28, 28, 28, 24} },
134730923549SSenthil Balasubramanian { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 28, 28, 28, 24} },
134830923549SSenthil Balasubramanian },
134930923549SSenthil Balasubramanian .calTargetPower2GHT40 = {
135030923549SSenthil Balasubramanian { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 26, 26, 26, 22} },
135130923549SSenthil Balasubramanian { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 26, 26, 26, 22} },
135230923549SSenthil Balasubramanian { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 26, 26, 26, 22} },
135330923549SSenthil Balasubramanian },
135430923549SSenthil Balasubramanian .ctlIndex_2G = {
135530923549SSenthil Balasubramanian 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
135630923549SSenthil Balasubramanian 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
135730923549SSenthil Balasubramanian },
135830923549SSenthil Balasubramanian .ctl_freqbin_2G = {
135930923549SSenthil Balasubramanian {
136030923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
136130923549SSenthil Balasubramanian FREQ2FBIN(2417, 1),
136230923549SSenthil Balasubramanian FREQ2FBIN(2457, 1),
136330923549SSenthil Balasubramanian FREQ2FBIN(2462, 1)
136430923549SSenthil Balasubramanian },
136530923549SSenthil Balasubramanian {
136630923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
136730923549SSenthil Balasubramanian FREQ2FBIN(2417, 1),
136830923549SSenthil Balasubramanian FREQ2FBIN(2462, 1),
136930923549SSenthil Balasubramanian 0xFF,
137030923549SSenthil Balasubramanian },
137130923549SSenthil Balasubramanian
137230923549SSenthil Balasubramanian {
137330923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
137430923549SSenthil Balasubramanian FREQ2FBIN(2417, 1),
137530923549SSenthil Balasubramanian FREQ2FBIN(2462, 1),
137630923549SSenthil Balasubramanian 0xFF,
137730923549SSenthil Balasubramanian },
137830923549SSenthil Balasubramanian {
137930923549SSenthil Balasubramanian FREQ2FBIN(2422, 1),
138030923549SSenthil Balasubramanian FREQ2FBIN(2427, 1),
138130923549SSenthil Balasubramanian FREQ2FBIN(2447, 1),
138230923549SSenthil Balasubramanian FREQ2FBIN(2452, 1)
138330923549SSenthil Balasubramanian },
138430923549SSenthil Balasubramanian
138530923549SSenthil Balasubramanian {
138630923549SSenthil Balasubramanian /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
138730923549SSenthil Balasubramanian /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
138830923549SSenthil Balasubramanian /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
138930923549SSenthil Balasubramanian /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1),
139030923549SSenthil Balasubramanian },
139130923549SSenthil Balasubramanian
139230923549SSenthil Balasubramanian {
139330923549SSenthil Balasubramanian /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
139430923549SSenthil Balasubramanian /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
139530923549SSenthil Balasubramanian /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
139630923549SSenthil Balasubramanian 0,
139730923549SSenthil Balasubramanian },
139830923549SSenthil Balasubramanian
139930923549SSenthil Balasubramanian {
140030923549SSenthil Balasubramanian /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
140130923549SSenthil Balasubramanian /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
140230923549SSenthil Balasubramanian FREQ2FBIN(2472, 1),
140330923549SSenthil Balasubramanian 0,
140430923549SSenthil Balasubramanian },
140530923549SSenthil Balasubramanian
140630923549SSenthil Balasubramanian {
140730923549SSenthil Balasubramanian /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
140830923549SSenthil Balasubramanian /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
140930923549SSenthil Balasubramanian /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
141030923549SSenthil Balasubramanian /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
141130923549SSenthil Balasubramanian },
141230923549SSenthil Balasubramanian
141330923549SSenthil Balasubramanian {
141430923549SSenthil Balasubramanian /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
141530923549SSenthil Balasubramanian /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
141630923549SSenthil Balasubramanian /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
141730923549SSenthil Balasubramanian },
141830923549SSenthil Balasubramanian
141930923549SSenthil Balasubramanian {
142030923549SSenthil Balasubramanian /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
142130923549SSenthil Balasubramanian /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
142230923549SSenthil Balasubramanian /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
142330923549SSenthil Balasubramanian 0
142430923549SSenthil Balasubramanian },
142530923549SSenthil Balasubramanian
142630923549SSenthil Balasubramanian {
142730923549SSenthil Balasubramanian /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
142830923549SSenthil Balasubramanian /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
142930923549SSenthil Balasubramanian /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
143030923549SSenthil Balasubramanian 0
143130923549SSenthil Balasubramanian },
143230923549SSenthil Balasubramanian
143330923549SSenthil Balasubramanian {
143430923549SSenthil Balasubramanian /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
143530923549SSenthil Balasubramanian /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
143630923549SSenthil Balasubramanian /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
143730923549SSenthil Balasubramanian /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
143830923549SSenthil Balasubramanian }
143930923549SSenthil Balasubramanian },
144030923549SSenthil Balasubramanian .ctlPowerData_2G = {
1441fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
1442fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
1443fe6c7915SDavid S. Miller { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
144430923549SSenthil Balasubramanian
144581dc6760SMohammed Shafi Shajakhan { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0) } },
1446fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
1447fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
144830923549SSenthil Balasubramanian
1449fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
1450fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
1451fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
145230923549SSenthil Balasubramanian
1453fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
1454fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
1455fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
145630923549SSenthil Balasubramanian },
145730923549SSenthil Balasubramanian .modalHeader5G = {
145830923549SSenthil Balasubramanian /* 4 idle,t1,t2,b (4 bits per setting) */
145930923549SSenthil Balasubramanian .antCtrlCommon = LE32(0x220),
146030923549SSenthil Balasubramanian /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
146130923549SSenthil Balasubramanian .antCtrlCommon2 = LE32(0x44444),
146230923549SSenthil Balasubramanian /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
146330923549SSenthil Balasubramanian .antCtrlChain = {
146430923549SSenthil Balasubramanian LE16(0x150), LE16(0x150), LE16(0x150),
146530923549SSenthil Balasubramanian },
146630923549SSenthil Balasubramanian /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
146730923549SSenthil Balasubramanian .xatten1DB = {0, 0, 0},
146830923549SSenthil Balasubramanian
146930923549SSenthil Balasubramanian /*
147030923549SSenthil Balasubramanian * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
147130923549SSenthil Balasubramanian * for merlin (0xa20c/b20c 16:12
147230923549SSenthil Balasubramanian */
147330923549SSenthil Balasubramanian .xatten1Margin = {0, 0, 0},
147430923549SSenthil Balasubramanian .tempSlope = 45,
147530923549SSenthil Balasubramanian .voltSlope = 0,
147630923549SSenthil Balasubramanian /* spurChans spur channels in usual fbin coding format */
147730923549SSenthil Balasubramanian .spurChans = {0, 0, 0, 0, 0},
147830923549SSenthil Balasubramanian /* noiseFloorThreshCh Check if the register is per chain */
147930923549SSenthil Balasubramanian .noiseFloorThreshCh = {-1, 0, 0},
1480df222edcSRajkumar Manoharan .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
1481df222edcSRajkumar Manoharan .quick_drop = 0,
148230923549SSenthil Balasubramanian .xpaBiasLvl = 0,
148330923549SSenthil Balasubramanian .txFrameToDataStart = 0x0e,
148430923549SSenthil Balasubramanian .txFrameToPaOn = 0x0e,
148530923549SSenthil Balasubramanian .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
148630923549SSenthil Balasubramanian .antennaGain = 0,
148730923549SSenthil Balasubramanian .switchSettling = 0x2d,
148830923549SSenthil Balasubramanian .adcDesiredSize = -30,
148930923549SSenthil Balasubramanian .txEndToXpaOff = 0,
149030923549SSenthil Balasubramanian .txEndToRxOn = 0x2,
149130923549SSenthil Balasubramanian .txFrameToXpaOn = 0xe,
149230923549SSenthil Balasubramanian .thresh62 = 28,
149330923549SSenthil Balasubramanian .papdRateMaskHt20 = LE32(0x0cf0e0e0),
149430923549SSenthil Balasubramanian .papdRateMaskHt40 = LE32(0x6cf0e0e0),
149566a80a3aSSujith Manoharan .switchcomspdt = 0,
14963e2ea543SFelix Fietkau .xlna_bias_strength = 0,
149730923549SSenthil Balasubramanian .futureModal = {
14983e2ea543SFelix Fietkau 0, 0, 0, 0, 0, 0, 0,
149930923549SSenthil Balasubramanian },
150030923549SSenthil Balasubramanian },
150130923549SSenthil Balasubramanian .base_ext2 = {
150230923549SSenthil Balasubramanian .tempSlopeLow = 40,
150330923549SSenthil Balasubramanian .tempSlopeHigh = 50,
150430923549SSenthil Balasubramanian .xatten1DBLow = {0, 0, 0},
150530923549SSenthil Balasubramanian .xatten1MarginLow = {0, 0, 0},
150630923549SSenthil Balasubramanian .xatten1DBHigh = {0, 0, 0},
150730923549SSenthil Balasubramanian .xatten1MarginHigh = {0, 0, 0}
150830923549SSenthil Balasubramanian },
150930923549SSenthil Balasubramanian .calFreqPier5G = {
151030923549SSenthil Balasubramanian FREQ2FBIN(5180, 0),
151130923549SSenthil Balasubramanian FREQ2FBIN(5220, 0),
151230923549SSenthil Balasubramanian FREQ2FBIN(5320, 0),
151330923549SSenthil Balasubramanian FREQ2FBIN(5400, 0),
151430923549SSenthil Balasubramanian FREQ2FBIN(5500, 0),
151530923549SSenthil Balasubramanian FREQ2FBIN(5600, 0),
151630923549SSenthil Balasubramanian FREQ2FBIN(5700, 0),
151794e2ad9eSRajkumar Manoharan FREQ2FBIN(5785, 0)
151830923549SSenthil Balasubramanian },
151930923549SSenthil Balasubramanian .calPierData5G = {
152030923549SSenthil Balasubramanian {
152130923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
152230923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
152330923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
152430923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
152530923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
152630923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
152730923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
152830923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
152930923549SSenthil Balasubramanian },
153030923549SSenthil Balasubramanian {
153130923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
153230923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
153330923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
153430923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
153530923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
153630923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
153730923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
153830923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
153930923549SSenthil Balasubramanian },
154030923549SSenthil Balasubramanian {
154130923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
154230923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
154330923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
154430923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
154530923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
154630923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
154730923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
154830923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
154930923549SSenthil Balasubramanian },
155030923549SSenthil Balasubramanian
155130923549SSenthil Balasubramanian },
155230923549SSenthil Balasubramanian .calTarget_freqbin_5G = {
155330923549SSenthil Balasubramanian FREQ2FBIN(5180, 0),
155430923549SSenthil Balasubramanian FREQ2FBIN(5240, 0),
155530923549SSenthil Balasubramanian FREQ2FBIN(5320, 0),
155630923549SSenthil Balasubramanian FREQ2FBIN(5400, 0),
155730923549SSenthil Balasubramanian FREQ2FBIN(5500, 0),
155830923549SSenthil Balasubramanian FREQ2FBIN(5600, 0),
155930923549SSenthil Balasubramanian FREQ2FBIN(5700, 0),
156030923549SSenthil Balasubramanian FREQ2FBIN(5825, 0)
156130923549SSenthil Balasubramanian },
156230923549SSenthil Balasubramanian .calTarget_freqbin_5GHT20 = {
156330923549SSenthil Balasubramanian FREQ2FBIN(5180, 0),
156430923549SSenthil Balasubramanian FREQ2FBIN(5240, 0),
156530923549SSenthil Balasubramanian FREQ2FBIN(5320, 0),
156630923549SSenthil Balasubramanian FREQ2FBIN(5400, 0),
156730923549SSenthil Balasubramanian FREQ2FBIN(5500, 0),
156830923549SSenthil Balasubramanian FREQ2FBIN(5700, 0),
156930923549SSenthil Balasubramanian FREQ2FBIN(5745, 0),
157030923549SSenthil Balasubramanian FREQ2FBIN(5825, 0)
157130923549SSenthil Balasubramanian },
157230923549SSenthil Balasubramanian .calTarget_freqbin_5GHT40 = {
157330923549SSenthil Balasubramanian FREQ2FBIN(5180, 0),
157430923549SSenthil Balasubramanian FREQ2FBIN(5240, 0),
157530923549SSenthil Balasubramanian FREQ2FBIN(5320, 0),
157630923549SSenthil Balasubramanian FREQ2FBIN(5400, 0),
157730923549SSenthil Balasubramanian FREQ2FBIN(5500, 0),
157830923549SSenthil Balasubramanian FREQ2FBIN(5700, 0),
157930923549SSenthil Balasubramanian FREQ2FBIN(5745, 0),
158030923549SSenthil Balasubramanian FREQ2FBIN(5825, 0)
158130923549SSenthil Balasubramanian },
158230923549SSenthil Balasubramanian .calTargetPower5G = {
158330923549SSenthil Balasubramanian /* 6-24,36,48,54 */
158430923549SSenthil Balasubramanian { {30, 30, 28, 24} },
158530923549SSenthil Balasubramanian { {30, 30, 28, 24} },
158630923549SSenthil Balasubramanian { {30, 30, 28, 24} },
158730923549SSenthil Balasubramanian { {30, 30, 28, 24} },
158830923549SSenthil Balasubramanian { {30, 30, 28, 24} },
158930923549SSenthil Balasubramanian { {30, 30, 28, 24} },
159030923549SSenthil Balasubramanian { {30, 30, 28, 24} },
159130923549SSenthil Balasubramanian { {30, 30, 28, 24} },
159230923549SSenthil Balasubramanian },
159330923549SSenthil Balasubramanian .calTargetPower5GHT20 = {
159430923549SSenthil Balasubramanian /*
159530923549SSenthil Balasubramanian * 0_8_16,1-3_9-11_17-19,
159630923549SSenthil Balasubramanian * 4,5,6,7,12,13,14,15,20,21,22,23
159730923549SSenthil Balasubramanian */
159830923549SSenthil Balasubramanian { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 20, 20, 20, 16} },
159930923549SSenthil Balasubramanian { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 20, 20, 20, 16} },
160030923549SSenthil Balasubramanian { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 18, 18, 18, 16} },
160130923549SSenthil Balasubramanian { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 18, 18, 18, 16} },
160230923549SSenthil Balasubramanian { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 16, 16, 16, 14} },
160330923549SSenthil Balasubramanian { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 16, 16, 16, 14} },
160430923549SSenthil Balasubramanian { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 14, 14, 14, 12} },
160530923549SSenthil Balasubramanian { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 14, 14, 14, 12} },
160630923549SSenthil Balasubramanian },
160730923549SSenthil Balasubramanian .calTargetPower5GHT40 = {
160830923549SSenthil Balasubramanian /*
160930923549SSenthil Balasubramanian * 0_8_16,1-3_9-11_17-19,
161030923549SSenthil Balasubramanian * 4,5,6,7,12,13,14,15,20,21,22,23
161130923549SSenthil Balasubramanian */
161230923549SSenthil Balasubramanian { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 18, 18, 18, 14} },
161330923549SSenthil Balasubramanian { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 18, 18, 18, 14} },
161430923549SSenthil Balasubramanian { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 16, 16, 16, 12} },
161530923549SSenthil Balasubramanian { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 16, 16, 16, 12} },
161630923549SSenthil Balasubramanian { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 14, 14, 14, 10} },
161730923549SSenthil Balasubramanian { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 14, 14, 14, 10} },
161830923549SSenthil Balasubramanian { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 12, 12, 12, 8} },
161930923549SSenthil Balasubramanian { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 12, 12, 12, 8} },
162030923549SSenthil Balasubramanian },
162130923549SSenthil Balasubramanian .ctlIndex_5G = {
162230923549SSenthil Balasubramanian 0x10, 0x16, 0x18, 0x40, 0x46,
162330923549SSenthil Balasubramanian 0x48, 0x30, 0x36, 0x38
162430923549SSenthil Balasubramanian },
162530923549SSenthil Balasubramanian .ctl_freqbin_5G = {
162630923549SSenthil Balasubramanian {
162730923549SSenthil Balasubramanian /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
162830923549SSenthil Balasubramanian /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
162930923549SSenthil Balasubramanian /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
163030923549SSenthil Balasubramanian /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
163130923549SSenthil Balasubramanian /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0),
163230923549SSenthil Balasubramanian /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
163330923549SSenthil Balasubramanian /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
163430923549SSenthil Balasubramanian /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
163530923549SSenthil Balasubramanian },
163630923549SSenthil Balasubramanian {
163730923549SSenthil Balasubramanian /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
163830923549SSenthil Balasubramanian /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
163930923549SSenthil Balasubramanian /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
164030923549SSenthil Balasubramanian /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
164130923549SSenthil Balasubramanian /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0),
164230923549SSenthil Balasubramanian /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
164330923549SSenthil Balasubramanian /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
164430923549SSenthil Balasubramanian /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
164530923549SSenthil Balasubramanian },
164630923549SSenthil Balasubramanian
164730923549SSenthil Balasubramanian {
164830923549SSenthil Balasubramanian /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
164930923549SSenthil Balasubramanian /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
165030923549SSenthil Balasubramanian /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
165130923549SSenthil Balasubramanian /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0),
165230923549SSenthil Balasubramanian /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0),
165330923549SSenthil Balasubramanian /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0),
165430923549SSenthil Balasubramanian /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0),
165530923549SSenthil Balasubramanian /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0)
165630923549SSenthil Balasubramanian },
165730923549SSenthil Balasubramanian
165830923549SSenthil Balasubramanian {
165930923549SSenthil Balasubramanian /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
166030923549SSenthil Balasubramanian /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
166130923549SSenthil Balasubramanian /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0),
166230923549SSenthil Balasubramanian /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0),
166330923549SSenthil Balasubramanian /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
166430923549SSenthil Balasubramanian /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
166530923549SSenthil Balasubramanian /* Data[3].ctlEdges[6].bChannel */ 0xFF,
166630923549SSenthil Balasubramanian /* Data[3].ctlEdges[7].bChannel */ 0xFF,
166730923549SSenthil Balasubramanian },
166830923549SSenthil Balasubramanian
166930923549SSenthil Balasubramanian {
167030923549SSenthil Balasubramanian /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
167130923549SSenthil Balasubramanian /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
167230923549SSenthil Balasubramanian /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0),
167330923549SSenthil Balasubramanian /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0),
167430923549SSenthil Balasubramanian /* Data[4].ctlEdges[4].bChannel */ 0xFF,
167530923549SSenthil Balasubramanian /* Data[4].ctlEdges[5].bChannel */ 0xFF,
167630923549SSenthil Balasubramanian /* Data[4].ctlEdges[6].bChannel */ 0xFF,
167730923549SSenthil Balasubramanian /* Data[4].ctlEdges[7].bChannel */ 0xFF,
167830923549SSenthil Balasubramanian },
167930923549SSenthil Balasubramanian
168030923549SSenthil Balasubramanian {
168130923549SSenthil Balasubramanian /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
168230923549SSenthil Balasubramanian /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0),
168330923549SSenthil Balasubramanian /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0),
168430923549SSenthil Balasubramanian /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
168530923549SSenthil Balasubramanian /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0),
168630923549SSenthil Balasubramanian /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
168730923549SSenthil Balasubramanian /* Data[5].ctlEdges[6].bChannel */ 0xFF,
168830923549SSenthil Balasubramanian /* Data[5].ctlEdges[7].bChannel */ 0xFF
168930923549SSenthil Balasubramanian },
169030923549SSenthil Balasubramanian
169130923549SSenthil Balasubramanian {
169230923549SSenthil Balasubramanian /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
169330923549SSenthil Balasubramanian /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
169430923549SSenthil Balasubramanian /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0),
169530923549SSenthil Balasubramanian /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0),
169630923549SSenthil Balasubramanian /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
169730923549SSenthil Balasubramanian /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0),
169830923549SSenthil Balasubramanian /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0),
169930923549SSenthil Balasubramanian /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0)
170030923549SSenthil Balasubramanian },
170130923549SSenthil Balasubramanian
170230923549SSenthil Balasubramanian {
170330923549SSenthil Balasubramanian /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
170430923549SSenthil Balasubramanian /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
170530923549SSenthil Balasubramanian /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0),
170630923549SSenthil Balasubramanian /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
170730923549SSenthil Balasubramanian /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0),
170830923549SSenthil Balasubramanian /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
170930923549SSenthil Balasubramanian /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
171030923549SSenthil Balasubramanian /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
171130923549SSenthil Balasubramanian },
171230923549SSenthil Balasubramanian
171330923549SSenthil Balasubramanian {
171430923549SSenthil Balasubramanian /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
171530923549SSenthil Balasubramanian /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
171630923549SSenthil Balasubramanian /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
171730923549SSenthil Balasubramanian /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
171830923549SSenthil Balasubramanian /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0),
171930923549SSenthil Balasubramanian /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
172030923549SSenthil Balasubramanian /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0),
172130923549SSenthil Balasubramanian /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0)
172230923549SSenthil Balasubramanian }
172330923549SSenthil Balasubramanian },
172430923549SSenthil Balasubramanian .ctlPowerData_5G = {
172530923549SSenthil Balasubramanian {
172630923549SSenthil Balasubramanian {
1727fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
1728fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
172930923549SSenthil Balasubramanian }
173030923549SSenthil Balasubramanian },
173130923549SSenthil Balasubramanian {
173230923549SSenthil Balasubramanian {
1733fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
1734fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
173530923549SSenthil Balasubramanian }
173630923549SSenthil Balasubramanian },
173730923549SSenthil Balasubramanian {
173830923549SSenthil Balasubramanian {
1739fe6c7915SDavid S. Miller CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
1740fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
174130923549SSenthil Balasubramanian }
174230923549SSenthil Balasubramanian },
174330923549SSenthil Balasubramanian {
174430923549SSenthil Balasubramanian {
1745fe6c7915SDavid S. Miller CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
1746fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
174730923549SSenthil Balasubramanian }
174830923549SSenthil Balasubramanian },
174930923549SSenthil Balasubramanian {
175030923549SSenthil Balasubramanian {
1751fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
1752fe6c7915SDavid S. Miller CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
175330923549SSenthil Balasubramanian }
175430923549SSenthil Balasubramanian },
175530923549SSenthil Balasubramanian {
175630923549SSenthil Balasubramanian {
1757fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
1758fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
175930923549SSenthil Balasubramanian }
176030923549SSenthil Balasubramanian },
176130923549SSenthil Balasubramanian {
176230923549SSenthil Balasubramanian {
1763fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
1764fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
176530923549SSenthil Balasubramanian }
176630923549SSenthil Balasubramanian },
176730923549SSenthil Balasubramanian {
176830923549SSenthil Balasubramanian {
1769fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
1770fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
177130923549SSenthil Balasubramanian }
177230923549SSenthil Balasubramanian },
177330923549SSenthil Balasubramanian {
177430923549SSenthil Balasubramanian {
1775fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
1776fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
177730923549SSenthil Balasubramanian }
177830923549SSenthil Balasubramanian },
177930923549SSenthil Balasubramanian }
178030923549SSenthil Balasubramanian };
178130923549SSenthil Balasubramanian
178230923549SSenthil Balasubramanian
178330923549SSenthil Balasubramanian static const struct ar9300_eeprom ar9300_x112 = {
178430923549SSenthil Balasubramanian .eepromVersion = 2,
178530923549SSenthil Balasubramanian .templateVersion = 5,
178630923549SSenthil Balasubramanian .macAddr = {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0},
178730923549SSenthil Balasubramanian .custData = {"x112-041-f0000"},
178830923549SSenthil Balasubramanian .baseEepHeader = {
178930923549SSenthil Balasubramanian .regDmn = { LE16(0), LE16(0x1f) },
179030923549SSenthil Balasubramanian .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */
179130923549SSenthil Balasubramanian .opCapFlags = {
17924ddfcd7dSFelix Fietkau .opFlags = AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A,
1793291478b7SMartin Blumenstingl .eepMisc = AR9300_EEPMISC_LITTLE_ENDIAN,
179430923549SSenthil Balasubramanian },
179530923549SSenthil Balasubramanian .rfSilent = 0,
179630923549SSenthil Balasubramanian .blueToothOptions = 0,
179730923549SSenthil Balasubramanian .deviceCap = 0,
179830923549SSenthil Balasubramanian .deviceType = 5, /* takes lower byte in eeprom location */
179930923549SSenthil Balasubramanian .pwrTableOffset = AR9300_PWR_TABLE_OFFSET,
180030923549SSenthil Balasubramanian .params_for_tuning_caps = {0, 0},
180130923549SSenthil Balasubramanian .featureEnable = 0x0d,
180230923549SSenthil Balasubramanian /*
180330923549SSenthil Balasubramanian * bit0 - enable tx temp comp - disabled
180430923549SSenthil Balasubramanian * bit1 - enable tx volt comp - disabled
180530923549SSenthil Balasubramanian * bit2 - enable fastclock - enabled
180630923549SSenthil Balasubramanian * bit3 - enable doubling - enabled
180730923549SSenthil Balasubramanian * bit4 - enable internal regulator - disabled
180830923549SSenthil Balasubramanian * bit5 - enable pa predistortion - disabled
180930923549SSenthil Balasubramanian */
181030923549SSenthil Balasubramanian .miscConfiguration = 0, /* bit0 - turn down drivestrength */
181130923549SSenthil Balasubramanian .eepromWriteEnableGpio = 6,
181230923549SSenthil Balasubramanian .wlanDisableGpio = 0,
181330923549SSenthil Balasubramanian .wlanLedGpio = 8,
181430923549SSenthil Balasubramanian .rxBandSelectGpio = 0xff,
181530923549SSenthil Balasubramanian .txrxgain = 0x0,
181630923549SSenthil Balasubramanian .swreg = 0,
181730923549SSenthil Balasubramanian },
181830923549SSenthil Balasubramanian .modalHeader2G = {
181930923549SSenthil Balasubramanian /* ar9300_modal_eep_header 2g */
182030923549SSenthil Balasubramanian /* 4 idle,t1,t2,b(4 bits per setting) */
182130923549SSenthil Balasubramanian .antCtrlCommon = LE32(0x110),
182230923549SSenthil Balasubramanian /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
182330923549SSenthil Balasubramanian .antCtrlCommon2 = LE32(0x22222),
182430923549SSenthil Balasubramanian
182530923549SSenthil Balasubramanian /*
182630923549SSenthil Balasubramanian * antCtrlChain[ar9300_max_chains]; 6 idle, t, r,
182730923549SSenthil Balasubramanian * rx1, rx12, b (2 bits each)
182830923549SSenthil Balasubramanian */
182930923549SSenthil Balasubramanian .antCtrlChain = { LE16(0x10), LE16(0x10), LE16(0x10) },
183030923549SSenthil Balasubramanian
183130923549SSenthil Balasubramanian /*
183230923549SSenthil Balasubramanian * xatten1DB[AR9300_max_chains]; 3 xatten1_db
183330923549SSenthil Balasubramanian * for ar9280 (0xa20c/b20c 5:0)
183430923549SSenthil Balasubramanian */
183530923549SSenthil Balasubramanian .xatten1DB = {0x1b, 0x1b, 0x1b},
183630923549SSenthil Balasubramanian
183730923549SSenthil Balasubramanian /*
183830923549SSenthil Balasubramanian * xatten1Margin[ar9300_max_chains]; 3 xatten1_margin
183930923549SSenthil Balasubramanian * for ar9280 (0xa20c/b20c 16:12
184030923549SSenthil Balasubramanian */
184130923549SSenthil Balasubramanian .xatten1Margin = {0x15, 0x15, 0x15},
184230923549SSenthil Balasubramanian .tempSlope = 50,
184330923549SSenthil Balasubramanian .voltSlope = 0,
184430923549SSenthil Balasubramanian
184530923549SSenthil Balasubramanian /*
184630923549SSenthil Balasubramanian * spurChans[OSPrey_eeprom_modal_sPURS]; spur
184730923549SSenthil Balasubramanian * channels in usual fbin coding format
184830923549SSenthil Balasubramanian */
184930923549SSenthil Balasubramanian .spurChans = {FREQ2FBIN(2464, 1), 0, 0, 0, 0},
185030923549SSenthil Balasubramanian
185130923549SSenthil Balasubramanian /*
185230923549SSenthil Balasubramanian * noiseFloorThreshch[ar9300_max_cHAINS]; 3 Check
185330923549SSenthil Balasubramanian * if the register is per chain
185430923549SSenthil Balasubramanian */
185530923549SSenthil Balasubramanian .noiseFloorThreshCh = {-1, 0, 0},
1856df222edcSRajkumar Manoharan .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
1857df222edcSRajkumar Manoharan .quick_drop = 0,
185830923549SSenthil Balasubramanian .xpaBiasLvl = 0,
185930923549SSenthil Balasubramanian .txFrameToDataStart = 0x0e,
186030923549SSenthil Balasubramanian .txFrameToPaOn = 0x0e,
186130923549SSenthil Balasubramanian .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
186230923549SSenthil Balasubramanian .antennaGain = 0,
186330923549SSenthil Balasubramanian .switchSettling = 0x2c,
186430923549SSenthil Balasubramanian .adcDesiredSize = -30,
186530923549SSenthil Balasubramanian .txEndToXpaOff = 0,
186630923549SSenthil Balasubramanian .txEndToRxOn = 0x2,
186730923549SSenthil Balasubramanian .txFrameToXpaOn = 0xe,
186830923549SSenthil Balasubramanian .thresh62 = 28,
186930923549SSenthil Balasubramanian .papdRateMaskHt20 = LE32(0x0c80c080),
187030923549SSenthil Balasubramanian .papdRateMaskHt40 = LE32(0x0080c080),
187166a80a3aSSujith Manoharan .switchcomspdt = 0,
18723e2ea543SFelix Fietkau .xlna_bias_strength = 0,
187330923549SSenthil Balasubramanian .futureModal = {
18743e2ea543SFelix Fietkau 0, 0, 0, 0, 0, 0, 0,
187530923549SSenthil Balasubramanian },
187630923549SSenthil Balasubramanian },
187730923549SSenthil Balasubramanian .base_ext1 = {
187830923549SSenthil Balasubramanian .ant_div_control = 0,
1879ee65b388SSujith Manoharan .future = {0, 0},
1880420e2b1bSRajkumar Manoharan .tempslopextension = {0, 0, 0, 0, 0, 0, 0, 0}
188130923549SSenthil Balasubramanian },
188230923549SSenthil Balasubramanian .calFreqPier2G = {
188330923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
188430923549SSenthil Balasubramanian FREQ2FBIN(2437, 1),
188530923549SSenthil Balasubramanian FREQ2FBIN(2472, 1),
188630923549SSenthil Balasubramanian },
188730923549SSenthil Balasubramanian /* ar9300_cal_data_per_freq_op_loop 2g */
188830923549SSenthil Balasubramanian .calPierData2G = {
188930923549SSenthil Balasubramanian { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
189030923549SSenthil Balasubramanian { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
189130923549SSenthil Balasubramanian { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
189230923549SSenthil Balasubramanian },
189330923549SSenthil Balasubramanian .calTarget_freqbin_Cck = {
189430923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
189530923549SSenthil Balasubramanian FREQ2FBIN(2472, 1),
189630923549SSenthil Balasubramanian },
189730923549SSenthil Balasubramanian .calTarget_freqbin_2G = {
189830923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
189930923549SSenthil Balasubramanian FREQ2FBIN(2437, 1),
190030923549SSenthil Balasubramanian FREQ2FBIN(2472, 1)
190130923549SSenthil Balasubramanian },
190230923549SSenthil Balasubramanian .calTarget_freqbin_2GHT20 = {
190330923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
190430923549SSenthil Balasubramanian FREQ2FBIN(2437, 1),
190530923549SSenthil Balasubramanian FREQ2FBIN(2472, 1)
190630923549SSenthil Balasubramanian },
190730923549SSenthil Balasubramanian .calTarget_freqbin_2GHT40 = {
190830923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
190930923549SSenthil Balasubramanian FREQ2FBIN(2437, 1),
191030923549SSenthil Balasubramanian FREQ2FBIN(2472, 1)
191130923549SSenthil Balasubramanian },
191230923549SSenthil Balasubramanian .calTargetPowerCck = {
191330923549SSenthil Balasubramanian /* 1L-5L,5S,11L,11s */
191430923549SSenthil Balasubramanian { {38, 38, 38, 38} },
191530923549SSenthil Balasubramanian { {38, 38, 38, 38} },
191630923549SSenthil Balasubramanian },
191730923549SSenthil Balasubramanian .calTargetPower2G = {
191830923549SSenthil Balasubramanian /* 6-24,36,48,54 */
191930923549SSenthil Balasubramanian { {38, 38, 36, 34} },
192030923549SSenthil Balasubramanian { {38, 38, 36, 34} },
192130923549SSenthil Balasubramanian { {38, 38, 34, 32} },
192230923549SSenthil Balasubramanian },
192330923549SSenthil Balasubramanian .calTargetPower2GHT20 = {
192430923549SSenthil Balasubramanian { {36, 36, 36, 36, 36, 34, 34, 32, 30, 28, 28, 28, 28, 26} },
192530923549SSenthil Balasubramanian { {36, 36, 36, 36, 36, 34, 36, 34, 32, 30, 30, 30, 28, 26} },
192630923549SSenthil Balasubramanian { {36, 36, 36, 36, 36, 34, 34, 32, 30, 28, 28, 28, 28, 26} },
192730923549SSenthil Balasubramanian },
192830923549SSenthil Balasubramanian .calTargetPower2GHT40 = {
192930923549SSenthil Balasubramanian { {36, 36, 36, 36, 34, 32, 32, 30, 28, 26, 26, 26, 26, 24} },
193030923549SSenthil Balasubramanian { {36, 36, 36, 36, 34, 32, 34, 32, 30, 28, 28, 28, 28, 24} },
193130923549SSenthil Balasubramanian { {36, 36, 36, 36, 34, 32, 32, 30, 28, 26, 26, 26, 26, 24} },
193230923549SSenthil Balasubramanian },
193330923549SSenthil Balasubramanian .ctlIndex_2G = {
193430923549SSenthil Balasubramanian 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
193530923549SSenthil Balasubramanian 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
193630923549SSenthil Balasubramanian },
193730923549SSenthil Balasubramanian .ctl_freqbin_2G = {
193830923549SSenthil Balasubramanian {
193930923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
194030923549SSenthil Balasubramanian FREQ2FBIN(2417, 1),
194130923549SSenthil Balasubramanian FREQ2FBIN(2457, 1),
194230923549SSenthil Balasubramanian FREQ2FBIN(2462, 1)
194330923549SSenthil Balasubramanian },
194430923549SSenthil Balasubramanian {
194530923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
194630923549SSenthil Balasubramanian FREQ2FBIN(2417, 1),
194730923549SSenthil Balasubramanian FREQ2FBIN(2462, 1),
194830923549SSenthil Balasubramanian 0xFF,
194930923549SSenthil Balasubramanian },
195030923549SSenthil Balasubramanian
195130923549SSenthil Balasubramanian {
195230923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
195330923549SSenthil Balasubramanian FREQ2FBIN(2417, 1),
195430923549SSenthil Balasubramanian FREQ2FBIN(2462, 1),
195530923549SSenthil Balasubramanian 0xFF,
195630923549SSenthil Balasubramanian },
195730923549SSenthil Balasubramanian {
195830923549SSenthil Balasubramanian FREQ2FBIN(2422, 1),
195930923549SSenthil Balasubramanian FREQ2FBIN(2427, 1),
196030923549SSenthil Balasubramanian FREQ2FBIN(2447, 1),
196130923549SSenthil Balasubramanian FREQ2FBIN(2452, 1)
196230923549SSenthil Balasubramanian },
196330923549SSenthil Balasubramanian
196430923549SSenthil Balasubramanian {
196530923549SSenthil Balasubramanian /* Data[4].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
196630923549SSenthil Balasubramanian /* Data[4].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
196730923549SSenthil Balasubramanian /* Data[4].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
196830923549SSenthil Balasubramanian /* Data[4].ctledges[3].bchannel */ FREQ2FBIN(2484, 1),
196930923549SSenthil Balasubramanian },
197030923549SSenthil Balasubramanian
197130923549SSenthil Balasubramanian {
197230923549SSenthil Balasubramanian /* Data[5].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
197330923549SSenthil Balasubramanian /* Data[5].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
197430923549SSenthil Balasubramanian /* Data[5].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
197530923549SSenthil Balasubramanian 0,
197630923549SSenthil Balasubramanian },
197730923549SSenthil Balasubramanian
197830923549SSenthil Balasubramanian {
197930923549SSenthil Balasubramanian /* Data[6].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
198030923549SSenthil Balasubramanian /* Data[6].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
198130923549SSenthil Balasubramanian FREQ2FBIN(2472, 1),
198230923549SSenthil Balasubramanian 0,
198330923549SSenthil Balasubramanian },
198430923549SSenthil Balasubramanian
198530923549SSenthil Balasubramanian {
198630923549SSenthil Balasubramanian /* Data[7].ctledges[0].bchannel */ FREQ2FBIN(2422, 1),
198730923549SSenthil Balasubramanian /* Data[7].ctledges[1].bchannel */ FREQ2FBIN(2427, 1),
198830923549SSenthil Balasubramanian /* Data[7].ctledges[2].bchannel */ FREQ2FBIN(2447, 1),
198930923549SSenthil Balasubramanian /* Data[7].ctledges[3].bchannel */ FREQ2FBIN(2462, 1),
199030923549SSenthil Balasubramanian },
199130923549SSenthil Balasubramanian
199230923549SSenthil Balasubramanian {
199330923549SSenthil Balasubramanian /* Data[8].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
199430923549SSenthil Balasubramanian /* Data[8].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
199530923549SSenthil Balasubramanian /* Data[8].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
199630923549SSenthil Balasubramanian },
199730923549SSenthil Balasubramanian
199830923549SSenthil Balasubramanian {
199930923549SSenthil Balasubramanian /* Data[9].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
200030923549SSenthil Balasubramanian /* Data[9].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
200130923549SSenthil Balasubramanian /* Data[9].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
200230923549SSenthil Balasubramanian 0
200330923549SSenthil Balasubramanian },
200430923549SSenthil Balasubramanian
200530923549SSenthil Balasubramanian {
200630923549SSenthil Balasubramanian /* Data[10].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
200730923549SSenthil Balasubramanian /* Data[10].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
200830923549SSenthil Balasubramanian /* Data[10].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
200930923549SSenthil Balasubramanian 0
201030923549SSenthil Balasubramanian },
201130923549SSenthil Balasubramanian
201230923549SSenthil Balasubramanian {
201330923549SSenthil Balasubramanian /* Data[11].ctledges[0].bchannel */ FREQ2FBIN(2422, 1),
201430923549SSenthil Balasubramanian /* Data[11].ctledges[1].bchannel */ FREQ2FBIN(2427, 1),
201530923549SSenthil Balasubramanian /* Data[11].ctledges[2].bchannel */ FREQ2FBIN(2447, 1),
201630923549SSenthil Balasubramanian /* Data[11].ctledges[3].bchannel */ FREQ2FBIN(2462, 1),
201730923549SSenthil Balasubramanian }
201830923549SSenthil Balasubramanian },
201930923549SSenthil Balasubramanian .ctlPowerData_2G = {
2020fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2021fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2022fe6c7915SDavid S. Miller { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
202330923549SSenthil Balasubramanian
202415052f81SRajkumar Manoharan { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0) } },
2025fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2026fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
202730923549SSenthil Balasubramanian
2028fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
2029fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2030fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
203130923549SSenthil Balasubramanian
2032fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2033fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
2034fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
203530923549SSenthil Balasubramanian },
203630923549SSenthil Balasubramanian .modalHeader5G = {
203730923549SSenthil Balasubramanian /* 4 idle,t1,t2,b (4 bits per setting) */
203830923549SSenthil Balasubramanian .antCtrlCommon = LE32(0x110),
203930923549SSenthil Balasubramanian /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
204030923549SSenthil Balasubramanian .antCtrlCommon2 = LE32(0x22222),
204130923549SSenthil Balasubramanian /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
204230923549SSenthil Balasubramanian .antCtrlChain = {
204330923549SSenthil Balasubramanian LE16(0x0), LE16(0x0), LE16(0x0),
204430923549SSenthil Balasubramanian },
204530923549SSenthil Balasubramanian /* xatten1DB 3 xatten1_db for ar9280 (0xa20c/b20c 5:0) */
204630923549SSenthil Balasubramanian .xatten1DB = {0x13, 0x19, 0x17},
204730923549SSenthil Balasubramanian
204830923549SSenthil Balasubramanian /*
204930923549SSenthil Balasubramanian * xatten1Margin[ar9300_max_chains]; 3 xatten1_margin
205030923549SSenthil Balasubramanian * for merlin (0xa20c/b20c 16:12
205130923549SSenthil Balasubramanian */
205230923549SSenthil Balasubramanian .xatten1Margin = {0x19, 0x19, 0x19},
205330923549SSenthil Balasubramanian .tempSlope = 70,
205430923549SSenthil Balasubramanian .voltSlope = 15,
205530923549SSenthil Balasubramanian /* spurChans spur channels in usual fbin coding format */
205630923549SSenthil Balasubramanian .spurChans = {0, 0, 0, 0, 0},
205730923549SSenthil Balasubramanian /* noiseFloorThreshch check if the register is per chain */
205830923549SSenthil Balasubramanian .noiseFloorThreshCh = {-1, 0, 0},
2059df222edcSRajkumar Manoharan .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2060df222edcSRajkumar Manoharan .quick_drop = 0,
206130923549SSenthil Balasubramanian .xpaBiasLvl = 0,
206230923549SSenthil Balasubramanian .txFrameToDataStart = 0x0e,
206330923549SSenthil Balasubramanian .txFrameToPaOn = 0x0e,
206430923549SSenthil Balasubramanian .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
206530923549SSenthil Balasubramanian .antennaGain = 0,
206630923549SSenthil Balasubramanian .switchSettling = 0x2d,
206730923549SSenthil Balasubramanian .adcDesiredSize = -30,
206830923549SSenthil Balasubramanian .txEndToXpaOff = 0,
206930923549SSenthil Balasubramanian .txEndToRxOn = 0x2,
207030923549SSenthil Balasubramanian .txFrameToXpaOn = 0xe,
207130923549SSenthil Balasubramanian .thresh62 = 28,
207230923549SSenthil Balasubramanian .papdRateMaskHt20 = LE32(0x0cf0e0e0),
207330923549SSenthil Balasubramanian .papdRateMaskHt40 = LE32(0x6cf0e0e0),
207466a80a3aSSujith Manoharan .switchcomspdt = 0,
20753e2ea543SFelix Fietkau .xlna_bias_strength = 0,
207630923549SSenthil Balasubramanian .futureModal = {
20773e2ea543SFelix Fietkau 0, 0, 0, 0, 0, 0, 0,
207830923549SSenthil Balasubramanian },
207930923549SSenthil Balasubramanian },
208030923549SSenthil Balasubramanian .base_ext2 = {
208130923549SSenthil Balasubramanian .tempSlopeLow = 72,
208230923549SSenthil Balasubramanian .tempSlopeHigh = 105,
208330923549SSenthil Balasubramanian .xatten1DBLow = {0x10, 0x14, 0x10},
208430923549SSenthil Balasubramanian .xatten1MarginLow = {0x19, 0x19 , 0x19},
208530923549SSenthil Balasubramanian .xatten1DBHigh = {0x1d, 0x20, 0x24},
208630923549SSenthil Balasubramanian .xatten1MarginHigh = {0x10, 0x10, 0x10}
208730923549SSenthil Balasubramanian },
208830923549SSenthil Balasubramanian .calFreqPier5G = {
208930923549SSenthil Balasubramanian FREQ2FBIN(5180, 0),
209030923549SSenthil Balasubramanian FREQ2FBIN(5220, 0),
209130923549SSenthil Balasubramanian FREQ2FBIN(5320, 0),
209230923549SSenthil Balasubramanian FREQ2FBIN(5400, 0),
209330923549SSenthil Balasubramanian FREQ2FBIN(5500, 0),
209430923549SSenthil Balasubramanian FREQ2FBIN(5600, 0),
209530923549SSenthil Balasubramanian FREQ2FBIN(5700, 0),
209630923549SSenthil Balasubramanian FREQ2FBIN(5785, 0)
209730923549SSenthil Balasubramanian },
209830923549SSenthil Balasubramanian .calPierData5G = {
209930923549SSenthil Balasubramanian {
210030923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
210130923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
210230923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
210330923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
210430923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
210530923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
210630923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
210730923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
210830923549SSenthil Balasubramanian },
210930923549SSenthil Balasubramanian {
211030923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
211130923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
211230923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
211330923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
211430923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
211530923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
211630923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
211730923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
211830923549SSenthil Balasubramanian },
211930923549SSenthil Balasubramanian {
212030923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
212130923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
212230923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
212330923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
212430923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
212530923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
212630923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
212730923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
212830923549SSenthil Balasubramanian },
212930923549SSenthil Balasubramanian
213030923549SSenthil Balasubramanian },
213130923549SSenthil Balasubramanian .calTarget_freqbin_5G = {
213230923549SSenthil Balasubramanian FREQ2FBIN(5180, 0),
213330923549SSenthil Balasubramanian FREQ2FBIN(5220, 0),
213430923549SSenthil Balasubramanian FREQ2FBIN(5320, 0),
213530923549SSenthil Balasubramanian FREQ2FBIN(5400, 0),
213630923549SSenthil Balasubramanian FREQ2FBIN(5500, 0),
213730923549SSenthil Balasubramanian FREQ2FBIN(5600, 0),
213830923549SSenthil Balasubramanian FREQ2FBIN(5725, 0),
213930923549SSenthil Balasubramanian FREQ2FBIN(5825, 0)
214030923549SSenthil Balasubramanian },
214130923549SSenthil Balasubramanian .calTarget_freqbin_5GHT20 = {
214230923549SSenthil Balasubramanian FREQ2FBIN(5180, 0),
214330923549SSenthil Balasubramanian FREQ2FBIN(5220, 0),
214430923549SSenthil Balasubramanian FREQ2FBIN(5320, 0),
214530923549SSenthil Balasubramanian FREQ2FBIN(5400, 0),
214630923549SSenthil Balasubramanian FREQ2FBIN(5500, 0),
214730923549SSenthil Balasubramanian FREQ2FBIN(5600, 0),
214830923549SSenthil Balasubramanian FREQ2FBIN(5725, 0),
214930923549SSenthil Balasubramanian FREQ2FBIN(5825, 0)
215030923549SSenthil Balasubramanian },
215130923549SSenthil Balasubramanian .calTarget_freqbin_5GHT40 = {
215230923549SSenthil Balasubramanian FREQ2FBIN(5180, 0),
215330923549SSenthil Balasubramanian FREQ2FBIN(5220, 0),
215430923549SSenthil Balasubramanian FREQ2FBIN(5320, 0),
215530923549SSenthil Balasubramanian FREQ2FBIN(5400, 0),
215630923549SSenthil Balasubramanian FREQ2FBIN(5500, 0),
215730923549SSenthil Balasubramanian FREQ2FBIN(5600, 0),
215830923549SSenthil Balasubramanian FREQ2FBIN(5725, 0),
215930923549SSenthil Balasubramanian FREQ2FBIN(5825, 0)
216030923549SSenthil Balasubramanian },
216130923549SSenthil Balasubramanian .calTargetPower5G = {
216230923549SSenthil Balasubramanian /* 6-24,36,48,54 */
216330923549SSenthil Balasubramanian { {32, 32, 28, 26} },
216430923549SSenthil Balasubramanian { {32, 32, 28, 26} },
216530923549SSenthil Balasubramanian { {32, 32, 28, 26} },
216630923549SSenthil Balasubramanian { {32, 32, 26, 24} },
216730923549SSenthil Balasubramanian { {32, 32, 26, 24} },
216830923549SSenthil Balasubramanian { {32, 32, 24, 22} },
216930923549SSenthil Balasubramanian { {30, 30, 24, 22} },
217030923549SSenthil Balasubramanian { {30, 30, 24, 22} },
217130923549SSenthil Balasubramanian },
217230923549SSenthil Balasubramanian .calTargetPower5GHT20 = {
217330923549SSenthil Balasubramanian /*
217430923549SSenthil Balasubramanian * 0_8_16,1-3_9-11_17-19,
217530923549SSenthil Balasubramanian * 4,5,6,7,12,13,14,15,20,21,22,23
217630923549SSenthil Balasubramanian */
217730923549SSenthil Balasubramanian { {32, 32, 32, 32, 28, 26, 32, 28, 26, 24, 24, 24, 22, 22} },
217830923549SSenthil Balasubramanian { {32, 32, 32, 32, 28, 26, 32, 28, 26, 24, 24, 24, 22, 22} },
217930923549SSenthil Balasubramanian { {32, 32, 32, 32, 28, 26, 32, 28, 26, 24, 24, 24, 22, 22} },
218030923549SSenthil Balasubramanian { {32, 32, 32, 32, 28, 26, 32, 26, 24, 22, 22, 22, 20, 20} },
218130923549SSenthil Balasubramanian { {32, 32, 32, 32, 28, 26, 32, 26, 24, 22, 20, 18, 16, 16} },
218230923549SSenthil Balasubramanian { {32, 32, 32, 32, 28, 26, 32, 24, 20, 16, 18, 16, 14, 14} },
218330923549SSenthil Balasubramanian { {30, 30, 30, 30, 28, 26, 30, 24, 20, 16, 18, 16, 14, 14} },
218430923549SSenthil Balasubramanian { {30, 30, 30, 30, 28, 26, 30, 24, 20, 16, 18, 16, 14, 14} },
218530923549SSenthil Balasubramanian },
218630923549SSenthil Balasubramanian .calTargetPower5GHT40 = {
218730923549SSenthil Balasubramanian /*
218830923549SSenthil Balasubramanian * 0_8_16,1-3_9-11_17-19,
218930923549SSenthil Balasubramanian * 4,5,6,7,12,13,14,15,20,21,22,23
219030923549SSenthil Balasubramanian */
219130923549SSenthil Balasubramanian { {32, 32, 32, 30, 28, 26, 30, 28, 26, 24, 24, 24, 22, 22} },
219230923549SSenthil Balasubramanian { {32, 32, 32, 30, 28, 26, 30, 28, 26, 24, 24, 24, 22, 22} },
219330923549SSenthil Balasubramanian { {32, 32, 32, 30, 28, 26, 30, 28, 26, 24, 24, 24, 22, 22} },
219430923549SSenthil Balasubramanian { {32, 32, 32, 30, 28, 26, 30, 26, 24, 22, 22, 22, 20, 20} },
219530923549SSenthil Balasubramanian { {32, 32, 32, 30, 28, 26, 30, 26, 24, 22, 20, 18, 16, 16} },
219630923549SSenthil Balasubramanian { {32, 32, 32, 30, 28, 26, 30, 22, 20, 16, 18, 16, 14, 14} },
219730923549SSenthil Balasubramanian { {30, 30, 30, 30, 28, 26, 30, 22, 20, 16, 18, 16, 14, 14} },
219830923549SSenthil Balasubramanian { {30, 30, 30, 30, 28, 26, 30, 22, 20, 16, 18, 16, 14, 14} },
219930923549SSenthil Balasubramanian },
220030923549SSenthil Balasubramanian .ctlIndex_5G = {
220130923549SSenthil Balasubramanian 0x10, 0x16, 0x18, 0x40, 0x46,
220230923549SSenthil Balasubramanian 0x48, 0x30, 0x36, 0x38
220330923549SSenthil Balasubramanian },
220430923549SSenthil Balasubramanian .ctl_freqbin_5G = {
220530923549SSenthil Balasubramanian {
220630923549SSenthil Balasubramanian /* Data[0].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
220730923549SSenthil Balasubramanian /* Data[0].ctledges[1].bchannel */ FREQ2FBIN(5260, 0),
220830923549SSenthil Balasubramanian /* Data[0].ctledges[2].bchannel */ FREQ2FBIN(5280, 0),
220930923549SSenthil Balasubramanian /* Data[0].ctledges[3].bchannel */ FREQ2FBIN(5500, 0),
221030923549SSenthil Balasubramanian /* Data[0].ctledges[4].bchannel */ FREQ2FBIN(5600, 0),
221130923549SSenthil Balasubramanian /* Data[0].ctledges[5].bchannel */ FREQ2FBIN(5700, 0),
221230923549SSenthil Balasubramanian /* Data[0].ctledges[6].bchannel */ FREQ2FBIN(5745, 0),
221330923549SSenthil Balasubramanian /* Data[0].ctledges[7].bchannel */ FREQ2FBIN(5825, 0)
221430923549SSenthil Balasubramanian },
221530923549SSenthil Balasubramanian {
221630923549SSenthil Balasubramanian /* Data[1].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
221730923549SSenthil Balasubramanian /* Data[1].ctledges[1].bchannel */ FREQ2FBIN(5260, 0),
221830923549SSenthil Balasubramanian /* Data[1].ctledges[2].bchannel */ FREQ2FBIN(5280, 0),
221930923549SSenthil Balasubramanian /* Data[1].ctledges[3].bchannel */ FREQ2FBIN(5500, 0),
222030923549SSenthil Balasubramanian /* Data[1].ctledges[4].bchannel */ FREQ2FBIN(5520, 0),
222130923549SSenthil Balasubramanian /* Data[1].ctledges[5].bchannel */ FREQ2FBIN(5700, 0),
222230923549SSenthil Balasubramanian /* Data[1].ctledges[6].bchannel */ FREQ2FBIN(5745, 0),
222330923549SSenthil Balasubramanian /* Data[1].ctledges[7].bchannel */ FREQ2FBIN(5825, 0)
222430923549SSenthil Balasubramanian },
222530923549SSenthil Balasubramanian
222630923549SSenthil Balasubramanian {
222730923549SSenthil Balasubramanian /* Data[2].ctledges[0].bchannel */ FREQ2FBIN(5190, 0),
222830923549SSenthil Balasubramanian /* Data[2].ctledges[1].bchannel */ FREQ2FBIN(5230, 0),
222930923549SSenthil Balasubramanian /* Data[2].ctledges[2].bchannel */ FREQ2FBIN(5270, 0),
223030923549SSenthil Balasubramanian /* Data[2].ctledges[3].bchannel */ FREQ2FBIN(5310, 0),
223130923549SSenthil Balasubramanian /* Data[2].ctledges[4].bchannel */ FREQ2FBIN(5510, 0),
223230923549SSenthil Balasubramanian /* Data[2].ctledges[5].bchannel */ FREQ2FBIN(5550, 0),
223330923549SSenthil Balasubramanian /* Data[2].ctledges[6].bchannel */ FREQ2FBIN(5670, 0),
223430923549SSenthil Balasubramanian /* Data[2].ctledges[7].bchannel */ FREQ2FBIN(5755, 0)
223530923549SSenthil Balasubramanian },
223630923549SSenthil Balasubramanian
223730923549SSenthil Balasubramanian {
223830923549SSenthil Balasubramanian /* Data[3].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
223930923549SSenthil Balasubramanian /* Data[3].ctledges[1].bchannel */ FREQ2FBIN(5200, 0),
224030923549SSenthil Balasubramanian /* Data[3].ctledges[2].bchannel */ FREQ2FBIN(5260, 0),
224130923549SSenthil Balasubramanian /* Data[3].ctledges[3].bchannel */ FREQ2FBIN(5320, 0),
224230923549SSenthil Balasubramanian /* Data[3].ctledges[4].bchannel */ FREQ2FBIN(5500, 0),
224330923549SSenthil Balasubramanian /* Data[3].ctledges[5].bchannel */ FREQ2FBIN(5700, 0),
224430923549SSenthil Balasubramanian /* Data[3].ctledges[6].bchannel */ 0xFF,
224530923549SSenthil Balasubramanian /* Data[3].ctledges[7].bchannel */ 0xFF,
224630923549SSenthil Balasubramanian },
224730923549SSenthil Balasubramanian
224830923549SSenthil Balasubramanian {
224930923549SSenthil Balasubramanian /* Data[4].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
225030923549SSenthil Balasubramanian /* Data[4].ctledges[1].bchannel */ FREQ2FBIN(5260, 0),
225130923549SSenthil Balasubramanian /* Data[4].ctledges[2].bchannel */ FREQ2FBIN(5500, 0),
225230923549SSenthil Balasubramanian /* Data[4].ctledges[3].bchannel */ FREQ2FBIN(5700, 0),
225330923549SSenthil Balasubramanian /* Data[4].ctledges[4].bchannel */ 0xFF,
225430923549SSenthil Balasubramanian /* Data[4].ctledges[5].bchannel */ 0xFF,
225530923549SSenthil Balasubramanian /* Data[4].ctledges[6].bchannel */ 0xFF,
225630923549SSenthil Balasubramanian /* Data[4].ctledges[7].bchannel */ 0xFF,
225730923549SSenthil Balasubramanian },
225830923549SSenthil Balasubramanian
225930923549SSenthil Balasubramanian {
226030923549SSenthil Balasubramanian /* Data[5].ctledges[0].bchannel */ FREQ2FBIN(5190, 0),
226130923549SSenthil Balasubramanian /* Data[5].ctledges[1].bchannel */ FREQ2FBIN(5270, 0),
226230923549SSenthil Balasubramanian /* Data[5].ctledges[2].bchannel */ FREQ2FBIN(5310, 0),
226330923549SSenthil Balasubramanian /* Data[5].ctledges[3].bchannel */ FREQ2FBIN(5510, 0),
226430923549SSenthil Balasubramanian /* Data[5].ctledges[4].bchannel */ FREQ2FBIN(5590, 0),
226530923549SSenthil Balasubramanian /* Data[5].ctledges[5].bchannel */ FREQ2FBIN(5670, 0),
226630923549SSenthil Balasubramanian /* Data[5].ctledges[6].bchannel */ 0xFF,
226730923549SSenthil Balasubramanian /* Data[5].ctledges[7].bchannel */ 0xFF
226830923549SSenthil Balasubramanian },
226930923549SSenthil Balasubramanian
227030923549SSenthil Balasubramanian {
227130923549SSenthil Balasubramanian /* Data[6].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
227230923549SSenthil Balasubramanian /* Data[6].ctledges[1].bchannel */ FREQ2FBIN(5200, 0),
227330923549SSenthil Balasubramanian /* Data[6].ctledges[2].bchannel */ FREQ2FBIN(5220, 0),
227430923549SSenthil Balasubramanian /* Data[6].ctledges[3].bchannel */ FREQ2FBIN(5260, 0),
227530923549SSenthil Balasubramanian /* Data[6].ctledges[4].bchannel */ FREQ2FBIN(5500, 0),
227630923549SSenthil Balasubramanian /* Data[6].ctledges[5].bchannel */ FREQ2FBIN(5600, 0),
227730923549SSenthil Balasubramanian /* Data[6].ctledges[6].bchannel */ FREQ2FBIN(5700, 0),
227830923549SSenthil Balasubramanian /* Data[6].ctledges[7].bchannel */ FREQ2FBIN(5745, 0)
227930923549SSenthil Balasubramanian },
228030923549SSenthil Balasubramanian
228130923549SSenthil Balasubramanian {
228230923549SSenthil Balasubramanian /* Data[7].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
228330923549SSenthil Balasubramanian /* Data[7].ctledges[1].bchannel */ FREQ2FBIN(5260, 0),
228430923549SSenthil Balasubramanian /* Data[7].ctledges[2].bchannel */ FREQ2FBIN(5320, 0),
228530923549SSenthil Balasubramanian /* Data[7].ctledges[3].bchannel */ FREQ2FBIN(5500, 0),
228630923549SSenthil Balasubramanian /* Data[7].ctledges[4].bchannel */ FREQ2FBIN(5560, 0),
228730923549SSenthil Balasubramanian /* Data[7].ctledges[5].bchannel */ FREQ2FBIN(5700, 0),
228830923549SSenthil Balasubramanian /* Data[7].ctledges[6].bchannel */ FREQ2FBIN(5745, 0),
228930923549SSenthil Balasubramanian /* Data[7].ctledges[7].bchannel */ FREQ2FBIN(5825, 0)
229030923549SSenthil Balasubramanian },
229130923549SSenthil Balasubramanian
229230923549SSenthil Balasubramanian {
229330923549SSenthil Balasubramanian /* Data[8].ctledges[0].bchannel */ FREQ2FBIN(5190, 0),
229430923549SSenthil Balasubramanian /* Data[8].ctledges[1].bchannel */ FREQ2FBIN(5230, 0),
229530923549SSenthil Balasubramanian /* Data[8].ctledges[2].bchannel */ FREQ2FBIN(5270, 0),
229630923549SSenthil Balasubramanian /* Data[8].ctledges[3].bchannel */ FREQ2FBIN(5510, 0),
229730923549SSenthil Balasubramanian /* Data[8].ctledges[4].bchannel */ FREQ2FBIN(5550, 0),
229830923549SSenthil Balasubramanian /* Data[8].ctledges[5].bchannel */ FREQ2FBIN(5670, 0),
229930923549SSenthil Balasubramanian /* Data[8].ctledges[6].bchannel */ FREQ2FBIN(5755, 0),
230030923549SSenthil Balasubramanian /* Data[8].ctledges[7].bchannel */ FREQ2FBIN(5795, 0)
230130923549SSenthil Balasubramanian }
230230923549SSenthil Balasubramanian },
230330923549SSenthil Balasubramanian .ctlPowerData_5G = {
230430923549SSenthil Balasubramanian {
230530923549SSenthil Balasubramanian {
2306fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
2307fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
230830923549SSenthil Balasubramanian }
230930923549SSenthil Balasubramanian },
231030923549SSenthil Balasubramanian {
231130923549SSenthil Balasubramanian {
2312fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
2313fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
231430923549SSenthil Balasubramanian }
231530923549SSenthil Balasubramanian },
231630923549SSenthil Balasubramanian {
231730923549SSenthil Balasubramanian {
2318fe6c7915SDavid S. Miller CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
2319fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
232030923549SSenthil Balasubramanian }
232130923549SSenthil Balasubramanian },
232230923549SSenthil Balasubramanian {
232330923549SSenthil Balasubramanian {
2324fe6c7915SDavid S. Miller CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
2325fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
232630923549SSenthil Balasubramanian }
232730923549SSenthil Balasubramanian },
232830923549SSenthil Balasubramanian {
232930923549SSenthil Balasubramanian {
2330fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
2331fe6c7915SDavid S. Miller CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
233230923549SSenthil Balasubramanian }
233330923549SSenthil Balasubramanian },
233430923549SSenthil Balasubramanian {
233530923549SSenthil Balasubramanian {
2336fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
2337fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
233830923549SSenthil Balasubramanian }
233930923549SSenthil Balasubramanian },
234030923549SSenthil Balasubramanian {
234130923549SSenthil Balasubramanian {
2342fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
2343fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
234430923549SSenthil Balasubramanian }
234530923549SSenthil Balasubramanian },
234630923549SSenthil Balasubramanian {
234730923549SSenthil Balasubramanian {
2348fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
2349fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
235030923549SSenthil Balasubramanian }
235130923549SSenthil Balasubramanian },
235230923549SSenthil Balasubramanian {
235330923549SSenthil Balasubramanian {
2354fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
2355fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
235630923549SSenthil Balasubramanian }
235730923549SSenthil Balasubramanian },
235830923549SSenthil Balasubramanian }
235930923549SSenthil Balasubramanian };
236030923549SSenthil Balasubramanian
236130923549SSenthil Balasubramanian static const struct ar9300_eeprom ar9300_h116 = {
236230923549SSenthil Balasubramanian .eepromVersion = 2,
236330923549SSenthil Balasubramanian .templateVersion = 4,
236430923549SSenthil Balasubramanian .macAddr = {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0},
236530923549SSenthil Balasubramanian .custData = {"h116-041-f0000"},
236630923549SSenthil Balasubramanian .baseEepHeader = {
236730923549SSenthil Balasubramanian .regDmn = { LE16(0), LE16(0x1f) },
236830923549SSenthil Balasubramanian .txrxMask = 0x33, /* 4 bits tx and 4 bits rx */
236930923549SSenthil Balasubramanian .opCapFlags = {
23704ddfcd7dSFelix Fietkau .opFlags = AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A,
2371291478b7SMartin Blumenstingl .eepMisc = AR9300_EEPMISC_LITTLE_ENDIAN,
237230923549SSenthil Balasubramanian },
237330923549SSenthil Balasubramanian .rfSilent = 0,
237430923549SSenthil Balasubramanian .blueToothOptions = 0,
237530923549SSenthil Balasubramanian .deviceCap = 0,
237630923549SSenthil Balasubramanian .deviceType = 5, /* takes lower byte in eeprom location */
237730923549SSenthil Balasubramanian .pwrTableOffset = AR9300_PWR_TABLE_OFFSET,
237830923549SSenthil Balasubramanian .params_for_tuning_caps = {0, 0},
237930923549SSenthil Balasubramanian .featureEnable = 0x0d,
238030923549SSenthil Balasubramanian /*
238130923549SSenthil Balasubramanian * bit0 - enable tx temp comp - disabled
238230923549SSenthil Balasubramanian * bit1 - enable tx volt comp - disabled
238330923549SSenthil Balasubramanian * bit2 - enable fastClock - enabled
238430923549SSenthil Balasubramanian * bit3 - enable doubling - enabled
238530923549SSenthil Balasubramanian * bit4 - enable internal regulator - disabled
238630923549SSenthil Balasubramanian * bit5 - enable pa predistortion - disabled
238730923549SSenthil Balasubramanian */
238830923549SSenthil Balasubramanian .miscConfiguration = 0, /* bit0 - turn down drivestrength */
238930923549SSenthil Balasubramanian .eepromWriteEnableGpio = 6,
239030923549SSenthil Balasubramanian .wlanDisableGpio = 0,
239130923549SSenthil Balasubramanian .wlanLedGpio = 8,
239230923549SSenthil Balasubramanian .rxBandSelectGpio = 0xff,
239330923549SSenthil Balasubramanian .txrxgain = 0x10,
239430923549SSenthil Balasubramanian .swreg = 0,
239530923549SSenthil Balasubramanian },
239630923549SSenthil Balasubramanian .modalHeader2G = {
239730923549SSenthil Balasubramanian /* ar9300_modal_eep_header 2g */
239830923549SSenthil Balasubramanian /* 4 idle,t1,t2,b(4 bits per setting) */
239930923549SSenthil Balasubramanian .antCtrlCommon = LE32(0x110),
240030923549SSenthil Balasubramanian /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
240130923549SSenthil Balasubramanian .antCtrlCommon2 = LE32(0x44444),
240230923549SSenthil Balasubramanian
240330923549SSenthil Balasubramanian /*
240430923549SSenthil Balasubramanian * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
240530923549SSenthil Balasubramanian * rx1, rx12, b (2 bits each)
240630923549SSenthil Balasubramanian */
240730923549SSenthil Balasubramanian .antCtrlChain = { LE16(0x10), LE16(0x10), LE16(0x10) },
240830923549SSenthil Balasubramanian
240930923549SSenthil Balasubramanian /*
241030923549SSenthil Balasubramanian * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
241130923549SSenthil Balasubramanian * for ar9280 (0xa20c/b20c 5:0)
241230923549SSenthil Balasubramanian */
241330923549SSenthil Balasubramanian .xatten1DB = {0x1f, 0x1f, 0x1f},
241430923549SSenthil Balasubramanian
241530923549SSenthil Balasubramanian /*
241630923549SSenthil Balasubramanian * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
241730923549SSenthil Balasubramanian * for ar9280 (0xa20c/b20c 16:12
241830923549SSenthil Balasubramanian */
241930923549SSenthil Balasubramanian .xatten1Margin = {0x12, 0x12, 0x12},
242030923549SSenthil Balasubramanian .tempSlope = 25,
242130923549SSenthil Balasubramanian .voltSlope = 0,
242230923549SSenthil Balasubramanian
242330923549SSenthil Balasubramanian /*
242430923549SSenthil Balasubramanian * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur
242530923549SSenthil Balasubramanian * channels in usual fbin coding format
242630923549SSenthil Balasubramanian */
242730923549SSenthil Balasubramanian .spurChans = {FREQ2FBIN(2464, 1), 0, 0, 0, 0},
242830923549SSenthil Balasubramanian
242930923549SSenthil Balasubramanian /*
243030923549SSenthil Balasubramanian * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check
243130923549SSenthil Balasubramanian * if the register is per chain
243230923549SSenthil Balasubramanian */
243330923549SSenthil Balasubramanian .noiseFloorThreshCh = {-1, 0, 0},
2434df222edcSRajkumar Manoharan .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2435df222edcSRajkumar Manoharan .quick_drop = 0,
243630923549SSenthil Balasubramanian .xpaBiasLvl = 0,
243730923549SSenthil Balasubramanian .txFrameToDataStart = 0x0e,
243830923549SSenthil Balasubramanian .txFrameToPaOn = 0x0e,
243930923549SSenthil Balasubramanian .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
244030923549SSenthil Balasubramanian .antennaGain = 0,
244130923549SSenthil Balasubramanian .switchSettling = 0x2c,
244230923549SSenthil Balasubramanian .adcDesiredSize = -30,
244330923549SSenthil Balasubramanian .txEndToXpaOff = 0,
244430923549SSenthil Balasubramanian .txEndToRxOn = 0x2,
244530923549SSenthil Balasubramanian .txFrameToXpaOn = 0xe,
244630923549SSenthil Balasubramanian .thresh62 = 28,
244730923549SSenthil Balasubramanian .papdRateMaskHt20 = LE32(0x0c80C080),
244830923549SSenthil Balasubramanian .papdRateMaskHt40 = LE32(0x0080C080),
244966a80a3aSSujith Manoharan .switchcomspdt = 0,
24503e2ea543SFelix Fietkau .xlna_bias_strength = 0,
245130923549SSenthil Balasubramanian .futureModal = {
24523e2ea543SFelix Fietkau 0, 0, 0, 0, 0, 0, 0,
245330923549SSenthil Balasubramanian },
245430923549SSenthil Balasubramanian },
245530923549SSenthil Balasubramanian .base_ext1 = {
245630923549SSenthil Balasubramanian .ant_div_control = 0,
2457ee65b388SSujith Manoharan .future = {0, 0},
2458420e2b1bSRajkumar Manoharan .tempslopextension = {0, 0, 0, 0, 0, 0, 0, 0}
245930923549SSenthil Balasubramanian },
246030923549SSenthil Balasubramanian .calFreqPier2G = {
246130923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
246230923549SSenthil Balasubramanian FREQ2FBIN(2437, 1),
246394e2ad9eSRajkumar Manoharan FREQ2FBIN(2462, 1),
246430923549SSenthil Balasubramanian },
246530923549SSenthil Balasubramanian /* ar9300_cal_data_per_freq_op_loop 2g */
246630923549SSenthil Balasubramanian .calPierData2G = {
246730923549SSenthil Balasubramanian { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
246830923549SSenthil Balasubramanian { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
246930923549SSenthil Balasubramanian { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
247030923549SSenthil Balasubramanian },
247130923549SSenthil Balasubramanian .calTarget_freqbin_Cck = {
247230923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
247330923549SSenthil Balasubramanian FREQ2FBIN(2472, 1),
247430923549SSenthil Balasubramanian },
247530923549SSenthil Balasubramanian .calTarget_freqbin_2G = {
247630923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
247730923549SSenthil Balasubramanian FREQ2FBIN(2437, 1),
247830923549SSenthil Balasubramanian FREQ2FBIN(2472, 1)
247930923549SSenthil Balasubramanian },
248030923549SSenthil Balasubramanian .calTarget_freqbin_2GHT20 = {
248130923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
248230923549SSenthil Balasubramanian FREQ2FBIN(2437, 1),
248330923549SSenthil Balasubramanian FREQ2FBIN(2472, 1)
248430923549SSenthil Balasubramanian },
248530923549SSenthil Balasubramanian .calTarget_freqbin_2GHT40 = {
248630923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
248730923549SSenthil Balasubramanian FREQ2FBIN(2437, 1),
248830923549SSenthil Balasubramanian FREQ2FBIN(2472, 1)
248930923549SSenthil Balasubramanian },
249030923549SSenthil Balasubramanian .calTargetPowerCck = {
249130923549SSenthil Balasubramanian /* 1L-5L,5S,11L,11S */
249230923549SSenthil Balasubramanian { {34, 34, 34, 34} },
249330923549SSenthil Balasubramanian { {34, 34, 34, 34} },
249430923549SSenthil Balasubramanian },
249530923549SSenthil Balasubramanian .calTargetPower2G = {
249630923549SSenthil Balasubramanian /* 6-24,36,48,54 */
249730923549SSenthil Balasubramanian { {34, 34, 32, 32} },
249830923549SSenthil Balasubramanian { {34, 34, 32, 32} },
249930923549SSenthil Balasubramanian { {34, 34, 32, 32} },
250030923549SSenthil Balasubramanian },
250130923549SSenthil Balasubramanian .calTargetPower2GHT20 = {
250230923549SSenthil Balasubramanian { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 0, 0, 0, 0} },
250330923549SSenthil Balasubramanian { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 0, 0, 0, 0} },
250430923549SSenthil Balasubramanian { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 0, 0, 0, 0} },
250530923549SSenthil Balasubramanian },
250630923549SSenthil Balasubramanian .calTargetPower2GHT40 = {
250730923549SSenthil Balasubramanian { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
250830923549SSenthil Balasubramanian { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
250930923549SSenthil Balasubramanian { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
251030923549SSenthil Balasubramanian },
251130923549SSenthil Balasubramanian .ctlIndex_2G = {
251230923549SSenthil Balasubramanian 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
251330923549SSenthil Balasubramanian 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
251430923549SSenthil Balasubramanian },
251530923549SSenthil Balasubramanian .ctl_freqbin_2G = {
251630923549SSenthil Balasubramanian {
251730923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
251830923549SSenthil Balasubramanian FREQ2FBIN(2417, 1),
251930923549SSenthil Balasubramanian FREQ2FBIN(2457, 1),
252030923549SSenthil Balasubramanian FREQ2FBIN(2462, 1)
252130923549SSenthil Balasubramanian },
252230923549SSenthil Balasubramanian {
252330923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
252430923549SSenthil Balasubramanian FREQ2FBIN(2417, 1),
252530923549SSenthil Balasubramanian FREQ2FBIN(2462, 1),
252630923549SSenthil Balasubramanian 0xFF,
252730923549SSenthil Balasubramanian },
252830923549SSenthil Balasubramanian
252930923549SSenthil Balasubramanian {
253030923549SSenthil Balasubramanian FREQ2FBIN(2412, 1),
253130923549SSenthil Balasubramanian FREQ2FBIN(2417, 1),
253230923549SSenthil Balasubramanian FREQ2FBIN(2462, 1),
253330923549SSenthil Balasubramanian 0xFF,
253430923549SSenthil Balasubramanian },
253530923549SSenthil Balasubramanian {
253630923549SSenthil Balasubramanian FREQ2FBIN(2422, 1),
253730923549SSenthil Balasubramanian FREQ2FBIN(2427, 1),
253830923549SSenthil Balasubramanian FREQ2FBIN(2447, 1),
253930923549SSenthil Balasubramanian FREQ2FBIN(2452, 1)
254030923549SSenthil Balasubramanian },
254130923549SSenthil Balasubramanian
254230923549SSenthil Balasubramanian {
254330923549SSenthil Balasubramanian /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
254430923549SSenthil Balasubramanian /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
254530923549SSenthil Balasubramanian /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
254630923549SSenthil Balasubramanian /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1),
254730923549SSenthil Balasubramanian },
254830923549SSenthil Balasubramanian
254930923549SSenthil Balasubramanian {
255030923549SSenthil Balasubramanian /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
255130923549SSenthil Balasubramanian /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
255230923549SSenthil Balasubramanian /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
255330923549SSenthil Balasubramanian 0,
255430923549SSenthil Balasubramanian },
255530923549SSenthil Balasubramanian
255630923549SSenthil Balasubramanian {
255730923549SSenthil Balasubramanian /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
255830923549SSenthil Balasubramanian /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
255930923549SSenthil Balasubramanian FREQ2FBIN(2472, 1),
256030923549SSenthil Balasubramanian 0,
256130923549SSenthil Balasubramanian },
256230923549SSenthil Balasubramanian
256330923549SSenthil Balasubramanian {
256430923549SSenthil Balasubramanian /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
256530923549SSenthil Balasubramanian /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
256630923549SSenthil Balasubramanian /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
256730923549SSenthil Balasubramanian /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
256830923549SSenthil Balasubramanian },
256930923549SSenthil Balasubramanian
257030923549SSenthil Balasubramanian {
257130923549SSenthil Balasubramanian /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
257230923549SSenthil Balasubramanian /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
257330923549SSenthil Balasubramanian /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
257430923549SSenthil Balasubramanian },
257530923549SSenthil Balasubramanian
257630923549SSenthil Balasubramanian {
257730923549SSenthil Balasubramanian /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
257830923549SSenthil Balasubramanian /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
257930923549SSenthil Balasubramanian /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
258030923549SSenthil Balasubramanian 0
258130923549SSenthil Balasubramanian },
258230923549SSenthil Balasubramanian
258330923549SSenthil Balasubramanian {
258430923549SSenthil Balasubramanian /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
258530923549SSenthil Balasubramanian /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
258630923549SSenthil Balasubramanian /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
258730923549SSenthil Balasubramanian 0
258830923549SSenthil Balasubramanian },
258930923549SSenthil Balasubramanian
259030923549SSenthil Balasubramanian {
259130923549SSenthil Balasubramanian /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
259230923549SSenthil Balasubramanian /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
259330923549SSenthil Balasubramanian /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
259430923549SSenthil Balasubramanian /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
259530923549SSenthil Balasubramanian }
259630923549SSenthil Balasubramanian },
259730923549SSenthil Balasubramanian .ctlPowerData_2G = {
2598fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2599fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2600fe6c7915SDavid S. Miller { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
260130923549SSenthil Balasubramanian
260281dc6760SMohammed Shafi Shajakhan { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0) } },
2603fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2604fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
260530923549SSenthil Balasubramanian
2606fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
2607fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2608fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
260930923549SSenthil Balasubramanian
2610fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
2611fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
2612fe6c7915SDavid S. Miller { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
261330923549SSenthil Balasubramanian },
261430923549SSenthil Balasubramanian .modalHeader5G = {
261530923549SSenthil Balasubramanian /* 4 idle,t1,t2,b (4 bits per setting) */
261630923549SSenthil Balasubramanian .antCtrlCommon = LE32(0x220),
261730923549SSenthil Balasubramanian /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
261830923549SSenthil Balasubramanian .antCtrlCommon2 = LE32(0x44444),
261930923549SSenthil Balasubramanian /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
262030923549SSenthil Balasubramanian .antCtrlChain = {
262130923549SSenthil Balasubramanian LE16(0x150), LE16(0x150), LE16(0x150),
262230923549SSenthil Balasubramanian },
262330923549SSenthil Balasubramanian /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
262430923549SSenthil Balasubramanian .xatten1DB = {0x19, 0x19, 0x19},
262530923549SSenthil Balasubramanian
262630923549SSenthil Balasubramanian /*
262730923549SSenthil Balasubramanian * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
262830923549SSenthil Balasubramanian * for merlin (0xa20c/b20c 16:12
262930923549SSenthil Balasubramanian */
263030923549SSenthil Balasubramanian .xatten1Margin = {0x14, 0x14, 0x14},
263130923549SSenthil Balasubramanian .tempSlope = 70,
263230923549SSenthil Balasubramanian .voltSlope = 0,
263330923549SSenthil Balasubramanian /* spurChans spur channels in usual fbin coding format */
263430923549SSenthil Balasubramanian .spurChans = {0, 0, 0, 0, 0},
263530923549SSenthil Balasubramanian /* noiseFloorThreshCh Check if the register is per chain */
263630923549SSenthil Balasubramanian .noiseFloorThreshCh = {-1, 0, 0},
2637df222edcSRajkumar Manoharan .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2638df222edcSRajkumar Manoharan .quick_drop = 0,
263930923549SSenthil Balasubramanian .xpaBiasLvl = 0,
264030923549SSenthil Balasubramanian .txFrameToDataStart = 0x0e,
264130923549SSenthil Balasubramanian .txFrameToPaOn = 0x0e,
264230923549SSenthil Balasubramanian .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
264330923549SSenthil Balasubramanian .antennaGain = 0,
264430923549SSenthil Balasubramanian .switchSettling = 0x2d,
264530923549SSenthil Balasubramanian .adcDesiredSize = -30,
264630923549SSenthil Balasubramanian .txEndToXpaOff = 0,
264730923549SSenthil Balasubramanian .txEndToRxOn = 0x2,
264830923549SSenthil Balasubramanian .txFrameToXpaOn = 0xe,
264930923549SSenthil Balasubramanian .thresh62 = 28,
265030923549SSenthil Balasubramanian .papdRateMaskHt20 = LE32(0x0cf0e0e0),
265130923549SSenthil Balasubramanian .papdRateMaskHt40 = LE32(0x6cf0e0e0),
265266a80a3aSSujith Manoharan .switchcomspdt = 0,
26533e2ea543SFelix Fietkau .xlna_bias_strength = 0,
265430923549SSenthil Balasubramanian .futureModal = {
26553e2ea543SFelix Fietkau 0, 0, 0, 0, 0, 0, 0,
265630923549SSenthil Balasubramanian },
265730923549SSenthil Balasubramanian },
265830923549SSenthil Balasubramanian .base_ext2 = {
265930923549SSenthil Balasubramanian .tempSlopeLow = 35,
266030923549SSenthil Balasubramanian .tempSlopeHigh = 50,
266130923549SSenthil Balasubramanian .xatten1DBLow = {0, 0, 0},
266230923549SSenthil Balasubramanian .xatten1MarginLow = {0, 0, 0},
266330923549SSenthil Balasubramanian .xatten1DBHigh = {0, 0, 0},
266430923549SSenthil Balasubramanian .xatten1MarginHigh = {0, 0, 0}
266530923549SSenthil Balasubramanian },
266630923549SSenthil Balasubramanian .calFreqPier5G = {
266794e2ad9eSRajkumar Manoharan FREQ2FBIN(5160, 0),
266830923549SSenthil Balasubramanian FREQ2FBIN(5220, 0),
266930923549SSenthil Balasubramanian FREQ2FBIN(5320, 0),
267030923549SSenthil Balasubramanian FREQ2FBIN(5400, 0),
267130923549SSenthil Balasubramanian FREQ2FBIN(5500, 0),
267230923549SSenthil Balasubramanian FREQ2FBIN(5600, 0),
267330923549SSenthil Balasubramanian FREQ2FBIN(5700, 0),
267430923549SSenthil Balasubramanian FREQ2FBIN(5785, 0)
267530923549SSenthil Balasubramanian },
267630923549SSenthil Balasubramanian .calPierData5G = {
267730923549SSenthil Balasubramanian {
267830923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
267930923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
268030923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
268130923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
268230923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
268330923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
268430923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
268530923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
268630923549SSenthil Balasubramanian },
268730923549SSenthil Balasubramanian {
268830923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
268930923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
269030923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
269130923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
269230923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
269330923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
269430923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
269530923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
269630923549SSenthil Balasubramanian },
269730923549SSenthil Balasubramanian {
269830923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
269930923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
270030923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
270130923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
270230923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
270330923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
270430923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
270530923549SSenthil Balasubramanian {0, 0, 0, 0, 0},
270630923549SSenthil Balasubramanian },
270730923549SSenthil Balasubramanian
270830923549SSenthil Balasubramanian },
270930923549SSenthil Balasubramanian .calTarget_freqbin_5G = {
271030923549SSenthil Balasubramanian FREQ2FBIN(5180, 0),
271130923549SSenthil Balasubramanian FREQ2FBIN(5240, 0),
271230923549SSenthil Balasubramanian FREQ2FBIN(5320, 0),
271330923549SSenthil Balasubramanian FREQ2FBIN(5400, 0),
271430923549SSenthil Balasubramanian FREQ2FBIN(5500, 0),
271530923549SSenthil Balasubramanian FREQ2FBIN(5600, 0),
271630923549SSenthil Balasubramanian FREQ2FBIN(5700, 0),
271730923549SSenthil Balasubramanian FREQ2FBIN(5825, 0)
271830923549SSenthil Balasubramanian },
271930923549SSenthil Balasubramanian .calTarget_freqbin_5GHT20 = {
272030923549SSenthil Balasubramanian FREQ2FBIN(5180, 0),
272130923549SSenthil Balasubramanian FREQ2FBIN(5240, 0),
272230923549SSenthil Balasubramanian FREQ2FBIN(5320, 0),
272330923549SSenthil Balasubramanian FREQ2FBIN(5400, 0),
272430923549SSenthil Balasubramanian FREQ2FBIN(5500, 0),
272530923549SSenthil Balasubramanian FREQ2FBIN(5700, 0),
272630923549SSenthil Balasubramanian FREQ2FBIN(5745, 0),
272730923549SSenthil Balasubramanian FREQ2FBIN(5825, 0)
272830923549SSenthil Balasubramanian },
272930923549SSenthil Balasubramanian .calTarget_freqbin_5GHT40 = {
273030923549SSenthil Balasubramanian FREQ2FBIN(5180, 0),
273130923549SSenthil Balasubramanian FREQ2FBIN(5240, 0),
273230923549SSenthil Balasubramanian FREQ2FBIN(5320, 0),
273330923549SSenthil Balasubramanian FREQ2FBIN(5400, 0),
273430923549SSenthil Balasubramanian FREQ2FBIN(5500, 0),
273530923549SSenthil Balasubramanian FREQ2FBIN(5700, 0),
273630923549SSenthil Balasubramanian FREQ2FBIN(5745, 0),
273730923549SSenthil Balasubramanian FREQ2FBIN(5825, 0)
273830923549SSenthil Balasubramanian },
273930923549SSenthil Balasubramanian .calTargetPower5G = {
274030923549SSenthil Balasubramanian /* 6-24,36,48,54 */
274130923549SSenthil Balasubramanian { {30, 30, 28, 24} },
274230923549SSenthil Balasubramanian { {30, 30, 28, 24} },
274330923549SSenthil Balasubramanian { {30, 30, 28, 24} },
274430923549SSenthil Balasubramanian { {30, 30, 28, 24} },
274530923549SSenthil Balasubramanian { {30, 30, 28, 24} },
274630923549SSenthil Balasubramanian { {30, 30, 28, 24} },
274730923549SSenthil Balasubramanian { {30, 30, 28, 24} },
274830923549SSenthil Balasubramanian { {30, 30, 28, 24} },
274930923549SSenthil Balasubramanian },
275030923549SSenthil Balasubramanian .calTargetPower5GHT20 = {
275130923549SSenthil Balasubramanian /*
275230923549SSenthil Balasubramanian * 0_8_16,1-3_9-11_17-19,
275330923549SSenthil Balasubramanian * 4,5,6,7,12,13,14,15,20,21,22,23
275430923549SSenthil Balasubramanian */
275530923549SSenthil Balasubramanian { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 0, 0, 0, 0} },
275630923549SSenthil Balasubramanian { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 0, 0, 0, 0} },
275730923549SSenthil Balasubramanian { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 0, 0, 0, 0} },
275830923549SSenthil Balasubramanian { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 0, 0, 0, 0} },
275930923549SSenthil Balasubramanian { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 0, 0, 0, 0} },
276030923549SSenthil Balasubramanian { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 0, 0, 0, 0} },
276130923549SSenthil Balasubramanian { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 0, 0, 0, 0} },
276230923549SSenthil Balasubramanian { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 0, 0, 0, 0} },
276330923549SSenthil Balasubramanian },
276430923549SSenthil Balasubramanian .calTargetPower5GHT40 = {
276530923549SSenthil Balasubramanian /*
276630923549SSenthil Balasubramanian * 0_8_16,1-3_9-11_17-19,
276730923549SSenthil Balasubramanian * 4,5,6,7,12,13,14,15,20,21,22,23
276830923549SSenthil Balasubramanian */
276930923549SSenthil Balasubramanian { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 0, 0, 0, 0} },
277030923549SSenthil Balasubramanian { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 0, 0, 0, 0} },
277130923549SSenthil Balasubramanian { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 0, 0, 0, 0} },
277230923549SSenthil Balasubramanian { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 0, 0, 0, 0} },
277330923549SSenthil Balasubramanian { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 0, 0, 0, 0} },
277430923549SSenthil Balasubramanian { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 0, 0, 0, 0} },
277530923549SSenthil Balasubramanian { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 0, 0, 0, 0} },
277630923549SSenthil Balasubramanian { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 0, 0, 0, 0} },
277730923549SSenthil Balasubramanian },
277830923549SSenthil Balasubramanian .ctlIndex_5G = {
277930923549SSenthil Balasubramanian 0x10, 0x16, 0x18, 0x40, 0x46,
278030923549SSenthil Balasubramanian 0x48, 0x30, 0x36, 0x38
278130923549SSenthil Balasubramanian },
278230923549SSenthil Balasubramanian .ctl_freqbin_5G = {
278330923549SSenthil Balasubramanian {
278430923549SSenthil Balasubramanian /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
278530923549SSenthil Balasubramanian /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
278630923549SSenthil Balasubramanian /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
278730923549SSenthil Balasubramanian /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
278830923549SSenthil Balasubramanian /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0),
278930923549SSenthil Balasubramanian /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
279030923549SSenthil Balasubramanian /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
279130923549SSenthil Balasubramanian /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
279230923549SSenthil Balasubramanian },
279330923549SSenthil Balasubramanian {
279430923549SSenthil Balasubramanian /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
279530923549SSenthil Balasubramanian /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
279630923549SSenthil Balasubramanian /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
279730923549SSenthil Balasubramanian /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
279830923549SSenthil Balasubramanian /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0),
279930923549SSenthil Balasubramanian /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
280030923549SSenthil Balasubramanian /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
280130923549SSenthil Balasubramanian /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
280230923549SSenthil Balasubramanian },
280330923549SSenthil Balasubramanian
280430923549SSenthil Balasubramanian {
280530923549SSenthil Balasubramanian /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
280630923549SSenthil Balasubramanian /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
280730923549SSenthil Balasubramanian /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
280830923549SSenthil Balasubramanian /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0),
280930923549SSenthil Balasubramanian /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0),
281030923549SSenthil Balasubramanian /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0),
281130923549SSenthil Balasubramanian /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0),
281230923549SSenthil Balasubramanian /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0)
281330923549SSenthil Balasubramanian },
281430923549SSenthil Balasubramanian
281530923549SSenthil Balasubramanian {
281630923549SSenthil Balasubramanian /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
281730923549SSenthil Balasubramanian /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
281830923549SSenthil Balasubramanian /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0),
281930923549SSenthil Balasubramanian /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0),
282030923549SSenthil Balasubramanian /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
282130923549SSenthil Balasubramanian /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
282230923549SSenthil Balasubramanian /* Data[3].ctlEdges[6].bChannel */ 0xFF,
282330923549SSenthil Balasubramanian /* Data[3].ctlEdges[7].bChannel */ 0xFF,
282430923549SSenthil Balasubramanian },
282530923549SSenthil Balasubramanian
282630923549SSenthil Balasubramanian {
282730923549SSenthil Balasubramanian /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
282830923549SSenthil Balasubramanian /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
282930923549SSenthil Balasubramanian /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0),
283030923549SSenthil Balasubramanian /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0),
283130923549SSenthil Balasubramanian /* Data[4].ctlEdges[4].bChannel */ 0xFF,
283230923549SSenthil Balasubramanian /* Data[4].ctlEdges[5].bChannel */ 0xFF,
283330923549SSenthil Balasubramanian /* Data[4].ctlEdges[6].bChannel */ 0xFF,
283430923549SSenthil Balasubramanian /* Data[4].ctlEdges[7].bChannel */ 0xFF,
283530923549SSenthil Balasubramanian },
283630923549SSenthil Balasubramanian
283730923549SSenthil Balasubramanian {
283830923549SSenthil Balasubramanian /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
283930923549SSenthil Balasubramanian /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0),
284030923549SSenthil Balasubramanian /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0),
284130923549SSenthil Balasubramanian /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
284230923549SSenthil Balasubramanian /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0),
284330923549SSenthil Balasubramanian /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
284430923549SSenthil Balasubramanian /* Data[5].ctlEdges[6].bChannel */ 0xFF,
284530923549SSenthil Balasubramanian /* Data[5].ctlEdges[7].bChannel */ 0xFF
284630923549SSenthil Balasubramanian },
284730923549SSenthil Balasubramanian
284830923549SSenthil Balasubramanian {
284930923549SSenthil Balasubramanian /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
285030923549SSenthil Balasubramanian /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
285130923549SSenthil Balasubramanian /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0),
285230923549SSenthil Balasubramanian /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0),
285330923549SSenthil Balasubramanian /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
285430923549SSenthil Balasubramanian /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0),
285530923549SSenthil Balasubramanian /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0),
285630923549SSenthil Balasubramanian /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0)
285730923549SSenthil Balasubramanian },
285830923549SSenthil Balasubramanian
285930923549SSenthil Balasubramanian {
286030923549SSenthil Balasubramanian /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
286130923549SSenthil Balasubramanian /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
286230923549SSenthil Balasubramanian /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0),
286330923549SSenthil Balasubramanian /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
286430923549SSenthil Balasubramanian /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0),
286530923549SSenthil Balasubramanian /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
286630923549SSenthil Balasubramanian /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
286730923549SSenthil Balasubramanian /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
286830923549SSenthil Balasubramanian },
286930923549SSenthil Balasubramanian
287030923549SSenthil Balasubramanian {
287130923549SSenthil Balasubramanian /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
287230923549SSenthil Balasubramanian /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
287330923549SSenthil Balasubramanian /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
287430923549SSenthil Balasubramanian /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
287530923549SSenthil Balasubramanian /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0),
287630923549SSenthil Balasubramanian /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
287730923549SSenthil Balasubramanian /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0),
287830923549SSenthil Balasubramanian /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0)
287930923549SSenthil Balasubramanian }
288030923549SSenthil Balasubramanian },
288130923549SSenthil Balasubramanian .ctlPowerData_5G = {
288230923549SSenthil Balasubramanian {
288330923549SSenthil Balasubramanian {
2884fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
2885fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
288630923549SSenthil Balasubramanian }
288730923549SSenthil Balasubramanian },
288830923549SSenthil Balasubramanian {
288930923549SSenthil Balasubramanian {
2890fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
2891fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
289230923549SSenthil Balasubramanian }
289330923549SSenthil Balasubramanian },
289430923549SSenthil Balasubramanian {
289530923549SSenthil Balasubramanian {
2896fe6c7915SDavid S. Miller CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
2897fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
289830923549SSenthil Balasubramanian }
289930923549SSenthil Balasubramanian },
290030923549SSenthil Balasubramanian {
290130923549SSenthil Balasubramanian {
2902fe6c7915SDavid S. Miller CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
2903fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
290430923549SSenthil Balasubramanian }
290530923549SSenthil Balasubramanian },
290630923549SSenthil Balasubramanian {
290730923549SSenthil Balasubramanian {
2908fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
2909fe6c7915SDavid S. Miller CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
291030923549SSenthil Balasubramanian }
291130923549SSenthil Balasubramanian },
291230923549SSenthil Balasubramanian {
291330923549SSenthil Balasubramanian {
2914fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
2915fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
291630923549SSenthil Balasubramanian }
291730923549SSenthil Balasubramanian },
291830923549SSenthil Balasubramanian {
291930923549SSenthil Balasubramanian {
2920fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
2921fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
292230923549SSenthil Balasubramanian }
292330923549SSenthil Balasubramanian },
292430923549SSenthil Balasubramanian {
292530923549SSenthil Balasubramanian {
2926fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
2927fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
292830923549SSenthil Balasubramanian }
292930923549SSenthil Balasubramanian },
293030923549SSenthil Balasubramanian {
293130923549SSenthil Balasubramanian {
2932fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
2933fe6c7915SDavid S. Miller CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
293430923549SSenthil Balasubramanian }
293530923549SSenthil Balasubramanian },
293630923549SSenthil Balasubramanian }
293730923549SSenthil Balasubramanian };
293830923549SSenthil Balasubramanian
293930923549SSenthil Balasubramanian
294030923549SSenthil Balasubramanian static const struct ar9300_eeprom *ar9300_eep_templates[] = {
294130923549SSenthil Balasubramanian &ar9300_default,
294230923549SSenthil Balasubramanian &ar9300_x112,
294330923549SSenthil Balasubramanian &ar9300_h116,
294430923549SSenthil Balasubramanian &ar9300_h112,
294530923549SSenthil Balasubramanian &ar9300_x113,
294630923549SSenthil Balasubramanian };
294730923549SSenthil Balasubramanian
ar9003_eeprom_struct_find_by_id(int id)294830923549SSenthil Balasubramanian static const struct ar9300_eeprom *ar9003_eeprom_struct_find_by_id(int id)
294930923549SSenthil Balasubramanian {
295030923549SSenthil Balasubramanian int it;
295130923549SSenthil Balasubramanian
2952896cbefaSThomas Meyer for (it = 0; it < ARRAY_SIZE(ar9300_eep_templates); it++)
295330923549SSenthil Balasubramanian if (ar9300_eep_templates[it]->templateVersion == id)
295430923549SSenthil Balasubramanian return ar9300_eep_templates[it];
295530923549SSenthil Balasubramanian return NULL;
295630923549SSenthil Balasubramanian }
295730923549SSenthil Balasubramanian
ath9k_hw_ar9300_check_eeprom(struct ath_hw * ah)295815c9ee7aSSenthil Balasubramanian static int ath9k_hw_ar9300_check_eeprom(struct ath_hw *ah)
295915c9ee7aSSenthil Balasubramanian {
296015c9ee7aSSenthil Balasubramanian return 0;
296115c9ee7aSSenthil Balasubramanian }
296215c9ee7aSSenthil Balasubramanian
interpolate(int x,int xa,int xb,int ya,int yb)2963bc206802SVasanthakumar Thiagarajan static int interpolate(int x, int xa, int xb, int ya, int yb)
2964bc206802SVasanthakumar Thiagarajan {
2965bc206802SVasanthakumar Thiagarajan int bf, factor, plus;
2966bc206802SVasanthakumar Thiagarajan
2967bc206802SVasanthakumar Thiagarajan bf = 2 * (yb - ya) * (x - xa) / (xb - xa);
2968bc206802SVasanthakumar Thiagarajan factor = bf / 2;
2969bc206802SVasanthakumar Thiagarajan plus = bf % 2;
2970bc206802SVasanthakumar Thiagarajan return ya + factor + plus;
2971bc206802SVasanthakumar Thiagarajan }
2972bc206802SVasanthakumar Thiagarajan
ath9k_hw_ar9300_get_eeprom(struct ath_hw * ah,enum eeprom_param param)297315c9ee7aSSenthil Balasubramanian static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah,
297415c9ee7aSSenthil Balasubramanian enum eeprom_param param)
297515c9ee7aSSenthil Balasubramanian {
297615c9ee7aSSenthil Balasubramanian struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
297715c9ee7aSSenthil Balasubramanian struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader;
297815c9ee7aSSenthil Balasubramanian
297915c9ee7aSSenthil Balasubramanian switch (param) {
298015c9ee7aSSenthil Balasubramanian case EEP_MAC_LSW:
298178fa99abSPavel Roskin return get_unaligned_be16(eep->macAddr);
298215c9ee7aSSenthil Balasubramanian case EEP_MAC_MID:
298378fa99abSPavel Roskin return get_unaligned_be16(eep->macAddr + 2);
298415c9ee7aSSenthil Balasubramanian case EEP_MAC_MSW:
298578fa99abSPavel Roskin return get_unaligned_be16(eep->macAddr + 4);
298615c9ee7aSSenthil Balasubramanian case EEP_REG_0:
2987ffdc4cbeSFelix Fietkau return le16_to_cpu(pBase->regDmn[0]);
298815c9ee7aSSenthil Balasubramanian case EEP_OP_CAP:
298915c9ee7aSSenthil Balasubramanian return pBase->deviceCap;
299015c9ee7aSSenthil Balasubramanian case EEP_OP_MODE:
299115c9ee7aSSenthil Balasubramanian return pBase->opCapFlags.opFlags;
299215c9ee7aSSenthil Balasubramanian case EEP_RF_SILENT:
299315c9ee7aSSenthil Balasubramanian return pBase->rfSilent;
299415c9ee7aSSenthil Balasubramanian case EEP_TX_MASK:
299515c9ee7aSSenthil Balasubramanian return (pBase->txrxMask >> 4) & 0xf;
299615c9ee7aSSenthil Balasubramanian case EEP_RX_MASK:
299715c9ee7aSSenthil Balasubramanian return pBase->txrxMask & 0xf;
29984935250aSFelix Fietkau case EEP_PAPRD:
29994935250aSFelix Fietkau return !!(pBase->featureEnable & BIT(5));
3000ea066d5aSMohammed Shafi Shajakhan case EEP_CHAIN_MASK_REDUCE:
3001ea066d5aSMohammed Shafi Shajakhan return (pBase->miscConfiguration >> 0x3) & 0x1;
300247e84dfbSVasanthakumar Thiagarajan case EEP_ANT_DIV_CTL1:
30037e12d6a4SSujith Manoharan if (AR_SREV_9565(ah))
30047e12d6a4SSujith Manoharan return AR9300_EEP_ANTDIV_CONTROL_DEFAULT_VALUE;
30057e12d6a4SSujith Manoharan else
30065479de6eSRajkumar Manoharan return eep->base_ext1.ant_div_control;
3007ca2c68ccSFelix Fietkau case EEP_ANTENNA_GAIN_5G:
3008ca2c68ccSFelix Fietkau return eep->modalHeader5G.antennaGain;
3009ca2c68ccSFelix Fietkau case EEP_ANTENNA_GAIN_2G:
3010ca2c68ccSFelix Fietkau return eep->modalHeader2G.antennaGain;
301115c9ee7aSSenthil Balasubramanian default:
301215c9ee7aSSenthil Balasubramanian return 0;
301315c9ee7aSSenthil Balasubramanian }
301415c9ee7aSSenthil Balasubramanian }
301515c9ee7aSSenthil Balasubramanian
ar9300_eeprom_read_byte(struct ath_hw * ah,int address,u8 * buffer)30160e4b9f2fSGabor Juhos static bool ar9300_eeprom_read_byte(struct ath_hw *ah, int address,
3017ffdc4cbeSFelix Fietkau u8 *buffer)
301815c9ee7aSSenthil Balasubramanian {
3019ffdc4cbeSFelix Fietkau u16 val;
302015c9ee7aSSenthil Balasubramanian
30210e4b9f2fSGabor Juhos if (unlikely(!ath9k_hw_nvram_read(ah, address / 2, &val)))
3022ffdc4cbeSFelix Fietkau return false;
302315c9ee7aSSenthil Balasubramanian
3024ffdc4cbeSFelix Fietkau *buffer = (val >> (8 * (address % 2))) & 0xff;
3025ffdc4cbeSFelix Fietkau return true;
302615c9ee7aSSenthil Balasubramanian }
302715c9ee7aSSenthil Balasubramanian
ar9300_eeprom_read_word(struct ath_hw * ah,int address,u8 * buffer)30280e4b9f2fSGabor Juhos static bool ar9300_eeprom_read_word(struct ath_hw *ah, int address,
3029ffdc4cbeSFelix Fietkau u8 *buffer)
303015c9ee7aSSenthil Balasubramanian {
3031ffdc4cbeSFelix Fietkau u16 val;
3032ffdc4cbeSFelix Fietkau
30330e4b9f2fSGabor Juhos if (unlikely(!ath9k_hw_nvram_read(ah, address / 2, &val)))
3034ffdc4cbeSFelix Fietkau return false;
3035ffdc4cbeSFelix Fietkau
3036ffdc4cbeSFelix Fietkau buffer[0] = val >> 8;
3037ffdc4cbeSFelix Fietkau buffer[1] = val & 0xff;
3038ffdc4cbeSFelix Fietkau
3039ffdc4cbeSFelix Fietkau return true;
3040ffdc4cbeSFelix Fietkau }
3041ffdc4cbeSFelix Fietkau
ar9300_read_eeprom(struct ath_hw * ah,int address,u8 * buffer,int count)3042ffdc4cbeSFelix Fietkau static bool ar9300_read_eeprom(struct ath_hw *ah, int address, u8 *buffer,
3043ffdc4cbeSFelix Fietkau int count)
3044ffdc4cbeSFelix Fietkau {
304515c9ee7aSSenthil Balasubramanian struct ath_common *common = ath9k_hw_common(ah);
3046ffdc4cbeSFelix Fietkau int i;
304715c9ee7aSSenthil Balasubramanian
3048ffdc4cbeSFelix Fietkau if ((address < 0) || ((address + count) / 2 > AR9300_EEPROM_SIZE - 1)) {
3049d2182b69SJoe Perches ath_dbg(common, EEPROM, "eeprom address not in range\n");
305015c9ee7aSSenthil Balasubramanian return false;
305115c9ee7aSSenthil Balasubramanian }
305215c9ee7aSSenthil Balasubramanian
3053ffdc4cbeSFelix Fietkau /*
3054ffdc4cbeSFelix Fietkau * Since we're reading the bytes in reverse order from a little-endian
3055ffdc4cbeSFelix Fietkau * word stream, an even address means we only use the lower half of
3056ffdc4cbeSFelix Fietkau * the 16-bit word at that address
3057ffdc4cbeSFelix Fietkau */
3058ffdc4cbeSFelix Fietkau if (address % 2 == 0) {
30590e4b9f2fSGabor Juhos if (!ar9300_eeprom_read_byte(ah, address--, buffer++))
3060ffdc4cbeSFelix Fietkau goto error;
3061ffdc4cbeSFelix Fietkau
3062ffdc4cbeSFelix Fietkau count--;
3063ffdc4cbeSFelix Fietkau }
3064ffdc4cbeSFelix Fietkau
3065ffdc4cbeSFelix Fietkau for (i = 0; i < count / 2; i++) {
30660e4b9f2fSGabor Juhos if (!ar9300_eeprom_read_word(ah, address, buffer))
3067ffdc4cbeSFelix Fietkau goto error;
3068ffdc4cbeSFelix Fietkau
3069ffdc4cbeSFelix Fietkau address -= 2;
3070ffdc4cbeSFelix Fietkau buffer += 2;
3071ffdc4cbeSFelix Fietkau }
3072ffdc4cbeSFelix Fietkau
3073ffdc4cbeSFelix Fietkau if (count % 2)
30740e4b9f2fSGabor Juhos if (!ar9300_eeprom_read_byte(ah, address, buffer))
3075ffdc4cbeSFelix Fietkau goto error;
3076ffdc4cbeSFelix Fietkau
3077ffdc4cbeSFelix Fietkau return true;
3078ffdc4cbeSFelix Fietkau
3079ffdc4cbeSFelix Fietkau error:
3080d2182b69SJoe Perches ath_dbg(common, EEPROM, "unable to read eeprom region at offset %d\n",
3081d2182b69SJoe Perches address);
308215c9ee7aSSenthil Balasubramanian return false;
308315c9ee7aSSenthil Balasubramanian }
308415c9ee7aSSenthil Balasubramanian
ar9300_otp_read_word(struct ath_hw * ah,int addr,u32 * data)3085488f6ba7SFelix Fietkau static bool ar9300_otp_read_word(struct ath_hw *ah, int addr, u32 *data)
3086488f6ba7SFelix Fietkau {
3087*b3a663f0SWenli Looi REG_READ(ah, AR9300_OTP_BASE(ah) + (4 * addr));
3088488f6ba7SFelix Fietkau
3089*b3a663f0SWenli Looi if (!ath9k_hw_wait(ah, AR9300_OTP_STATUS(ah), AR9300_OTP_STATUS_TYPE,
3090488f6ba7SFelix Fietkau AR9300_OTP_STATUS_VALID, 1000))
3091488f6ba7SFelix Fietkau return false;
3092488f6ba7SFelix Fietkau
3093*b3a663f0SWenli Looi *data = REG_READ(ah, AR9300_OTP_READ_DATA(ah));
3094488f6ba7SFelix Fietkau return true;
3095488f6ba7SFelix Fietkau }
3096488f6ba7SFelix Fietkau
ar9300_read_otp(struct ath_hw * ah,int address,u8 * buffer,int count)3097488f6ba7SFelix Fietkau static bool ar9300_read_otp(struct ath_hw *ah, int address, u8 *buffer,
3098488f6ba7SFelix Fietkau int count)
3099488f6ba7SFelix Fietkau {
3100488f6ba7SFelix Fietkau u32 data;
3101488f6ba7SFelix Fietkau int i;
3102488f6ba7SFelix Fietkau
3103488f6ba7SFelix Fietkau for (i = 0; i < count; i++) {
3104488f6ba7SFelix Fietkau int offset = 8 * ((address - i) % 4);
3105488f6ba7SFelix Fietkau if (!ar9300_otp_read_word(ah, (address - i) / 4, &data))
3106488f6ba7SFelix Fietkau return false;
3107488f6ba7SFelix Fietkau
3108488f6ba7SFelix Fietkau buffer[i] = (data >> offset) & 0xff;
3109488f6ba7SFelix Fietkau }
3110488f6ba7SFelix Fietkau
3111488f6ba7SFelix Fietkau return true;
3112488f6ba7SFelix Fietkau }
3113488f6ba7SFelix Fietkau
3114488f6ba7SFelix Fietkau
ar9300_comp_hdr_unpack(u8 * best,int * code,int * reference,int * length,int * major,int * minor)311515c9ee7aSSenthil Balasubramanian static void ar9300_comp_hdr_unpack(u8 *best, int *code, int *reference,
311615c9ee7aSSenthil Balasubramanian int *length, int *major, int *minor)
311715c9ee7aSSenthil Balasubramanian {
311815c9ee7aSSenthil Balasubramanian unsigned long value[4];
311915c9ee7aSSenthil Balasubramanian
312015c9ee7aSSenthil Balasubramanian value[0] = best[0];
312115c9ee7aSSenthil Balasubramanian value[1] = best[1];
312215c9ee7aSSenthil Balasubramanian value[2] = best[2];
312315c9ee7aSSenthil Balasubramanian value[3] = best[3];
312415c9ee7aSSenthil Balasubramanian *code = ((value[0] >> 5) & 0x0007);
312515c9ee7aSSenthil Balasubramanian *reference = (value[0] & 0x001f) | ((value[1] >> 2) & 0x0020);
312615c9ee7aSSenthil Balasubramanian *length = ((value[1] << 4) & 0x07f0) | ((value[2] >> 4) & 0x000f);
312715c9ee7aSSenthil Balasubramanian *major = (value[2] & 0x000f);
312815c9ee7aSSenthil Balasubramanian *minor = (value[3] & 0x00ff);
312915c9ee7aSSenthil Balasubramanian }
313015c9ee7aSSenthil Balasubramanian
ar9300_comp_cksum(u8 * data,int dsize)313115c9ee7aSSenthil Balasubramanian static u16 ar9300_comp_cksum(u8 *data, int dsize)
313215c9ee7aSSenthil Balasubramanian {
313315c9ee7aSSenthil Balasubramanian int it, checksum = 0;
313415c9ee7aSSenthil Balasubramanian
313515c9ee7aSSenthil Balasubramanian for (it = 0; it < dsize; it++) {
313615c9ee7aSSenthil Balasubramanian checksum += data[it];
313715c9ee7aSSenthil Balasubramanian checksum &= 0xffff;
313815c9ee7aSSenthil Balasubramanian }
313915c9ee7aSSenthil Balasubramanian
314015c9ee7aSSenthil Balasubramanian return checksum;
314115c9ee7aSSenthil Balasubramanian }
314215c9ee7aSSenthil Balasubramanian
ar9300_uncompress_block(struct ath_hw * ah,u8 * mptr,int mdataSize,u8 * block,int size)314315c9ee7aSSenthil Balasubramanian static bool ar9300_uncompress_block(struct ath_hw *ah,
314415c9ee7aSSenthil Balasubramanian u8 *mptr,
314515c9ee7aSSenthil Balasubramanian int mdataSize,
314615c9ee7aSSenthil Balasubramanian u8 *block,
314715c9ee7aSSenthil Balasubramanian int size)
314815c9ee7aSSenthil Balasubramanian {
314915c9ee7aSSenthil Balasubramanian int it;
315015c9ee7aSSenthil Balasubramanian int spot;
315115c9ee7aSSenthil Balasubramanian int offset;
315215c9ee7aSSenthil Balasubramanian int length;
315315c9ee7aSSenthil Balasubramanian struct ath_common *common = ath9k_hw_common(ah);
315415c9ee7aSSenthil Balasubramanian
315515c9ee7aSSenthil Balasubramanian spot = 0;
315615c9ee7aSSenthil Balasubramanian
315715c9ee7aSSenthil Balasubramanian for (it = 0; it < size; it += (length+2)) {
315815c9ee7aSSenthil Balasubramanian offset = block[it];
315915c9ee7aSSenthil Balasubramanian offset &= 0xff;
316015c9ee7aSSenthil Balasubramanian spot += offset;
316115c9ee7aSSenthil Balasubramanian length = block[it+1];
316215c9ee7aSSenthil Balasubramanian length &= 0xff;
316315c9ee7aSSenthil Balasubramanian
3164803288e6SLuis R. Rodriguez if (length > 0 && spot >= 0 && spot+length <= mdataSize) {
3165d2182b69SJoe Perches ath_dbg(common, EEPROM,
3166226afe68SJoe Perches "Restore at %d: spot=%d offset=%d length=%d\n",
316715c9ee7aSSenthil Balasubramanian it, spot, offset, length);
316815c9ee7aSSenthil Balasubramanian memcpy(&mptr[spot], &block[it+2], length);
316915c9ee7aSSenthil Balasubramanian spot += length;
317015c9ee7aSSenthil Balasubramanian } else if (length > 0) {
3171d2182b69SJoe Perches ath_dbg(common, EEPROM,
3172226afe68SJoe Perches "Bad restore at %d: spot=%d offset=%d length=%d\n",
317315c9ee7aSSenthil Balasubramanian it, spot, offset, length);
317415c9ee7aSSenthil Balasubramanian return false;
317515c9ee7aSSenthil Balasubramanian }
317615c9ee7aSSenthil Balasubramanian }
317715c9ee7aSSenthil Balasubramanian return true;
317815c9ee7aSSenthil Balasubramanian }
317915c9ee7aSSenthil Balasubramanian
ar9300_compress_decision(struct ath_hw * ah,int it,int code,int reference,u8 * mptr,u8 * word,int length,int mdata_size)318015c9ee7aSSenthil Balasubramanian static int ar9300_compress_decision(struct ath_hw *ah,
318115c9ee7aSSenthil Balasubramanian int it,
318215c9ee7aSSenthil Balasubramanian int code,
318315c9ee7aSSenthil Balasubramanian int reference,
318415c9ee7aSSenthil Balasubramanian u8 *mptr,
318515c9ee7aSSenthil Balasubramanian u8 *word, int length, int mdata_size)
318615c9ee7aSSenthil Balasubramanian {
318715c9ee7aSSenthil Balasubramanian struct ath_common *common = ath9k_hw_common(ah);
318830923549SSenthil Balasubramanian const struct ar9300_eeprom *eep = NULL;
318915c9ee7aSSenthil Balasubramanian
319015c9ee7aSSenthil Balasubramanian switch (code) {
319115c9ee7aSSenthil Balasubramanian case _CompressNone:
319215c9ee7aSSenthil Balasubramanian if (length != mdata_size) {
3193d2182b69SJoe Perches ath_dbg(common, EEPROM,
3194226afe68SJoe Perches "EEPROM structure size mismatch memory=%d eeprom=%d\n",
3195226afe68SJoe Perches mdata_size, length);
319615c9ee7aSSenthil Balasubramanian return -1;
319715c9ee7aSSenthil Balasubramanian }
31982c208890SJoe Perches memcpy(mptr, word + COMP_HDR_LEN, length);
3199d2182b69SJoe Perches ath_dbg(common, EEPROM,
3200226afe68SJoe Perches "restored eeprom %d: uncompressed, length %d\n",
3201226afe68SJoe Perches it, length);
320215c9ee7aSSenthil Balasubramanian break;
320315c9ee7aSSenthil Balasubramanian case _CompressBlock:
3204ceda5153SEduardo Abinader if (reference != 0) {
320530923549SSenthil Balasubramanian eep = ar9003_eeprom_struct_find_by_id(reference);
320630923549SSenthil Balasubramanian if (eep == NULL) {
3207d2182b69SJoe Perches ath_dbg(common, EEPROM,
320825985edcSLucas De Marchi "can't find reference eeprom struct %d\n",
3209226afe68SJoe Perches reference);
321015c9ee7aSSenthil Balasubramanian return -1;
321115c9ee7aSSenthil Balasubramanian }
321230923549SSenthil Balasubramanian memcpy(mptr, eep, mdata_size);
321315c9ee7aSSenthil Balasubramanian }
3214d2182b69SJoe Perches ath_dbg(common, EEPROM,
3215226afe68SJoe Perches "restore eeprom %d: block, reference %d, length %d\n",
3216226afe68SJoe Perches it, reference, length);
321715c9ee7aSSenthil Balasubramanian ar9300_uncompress_block(ah, mptr, mdata_size,
32182c208890SJoe Perches (word + COMP_HDR_LEN), length);
321915c9ee7aSSenthil Balasubramanian break;
322015c9ee7aSSenthil Balasubramanian default:
3221d2182b69SJoe Perches ath_dbg(common, EEPROM, "unknown compression code %d\n", code);
322215c9ee7aSSenthil Balasubramanian return -1;
322315c9ee7aSSenthil Balasubramanian }
322415c9ee7aSSenthil Balasubramanian return 0;
322515c9ee7aSSenthil Balasubramanian }
322615c9ee7aSSenthil Balasubramanian
3227488f6ba7SFelix Fietkau typedef bool (*eeprom_read_op)(struct ath_hw *ah, int address, u8 *buffer,
3228488f6ba7SFelix Fietkau int count);
3229488f6ba7SFelix Fietkau
ar9300_check_header(void * data)3230488f6ba7SFelix Fietkau static bool ar9300_check_header(void *data)
3231488f6ba7SFelix Fietkau {
3232488f6ba7SFelix Fietkau u32 *word = data;
3233488f6ba7SFelix Fietkau return !(*word == 0 || *word == ~0);
3234488f6ba7SFelix Fietkau }
3235488f6ba7SFelix Fietkau
ar9300_check_eeprom_header(struct ath_hw * ah,eeprom_read_op read,int base_addr)3236488f6ba7SFelix Fietkau static bool ar9300_check_eeprom_header(struct ath_hw *ah, eeprom_read_op read,
3237488f6ba7SFelix Fietkau int base_addr)
3238488f6ba7SFelix Fietkau {
3239488f6ba7SFelix Fietkau u8 header[4];
3240488f6ba7SFelix Fietkau
3241488f6ba7SFelix Fietkau if (!read(ah, base_addr, header, 4))
3242488f6ba7SFelix Fietkau return false;
3243488f6ba7SFelix Fietkau
3244488f6ba7SFelix Fietkau return ar9300_check_header(header);
3245488f6ba7SFelix Fietkau }
3246488f6ba7SFelix Fietkau
ar9300_eeprom_restore_flash(struct ath_hw * ah,u8 * mptr,int mdata_size)3247aaa13ca2SFelix Fietkau static int ar9300_eeprom_restore_flash(struct ath_hw *ah, u8 *mptr,
3248aaa13ca2SFelix Fietkau int mdata_size)
3249aaa13ca2SFelix Fietkau {
3250aaa13ca2SFelix Fietkau u16 *data = (u16 *) mptr;
3251aaa13ca2SFelix Fietkau int i;
3252aaa13ca2SFelix Fietkau
3253aaa13ca2SFelix Fietkau for (i = 0; i < mdata_size / 2; i++, data++)
3254a5d26827SEduardo Abinader if (!ath9k_hw_nvram_read(ah, i, data))
3255a5d26827SEduardo Abinader return -EIO;
3256aaa13ca2SFelix Fietkau
3257aaa13ca2SFelix Fietkau return 0;
3258aaa13ca2SFelix Fietkau }
325915c9ee7aSSenthil Balasubramanian /*
326015c9ee7aSSenthil Balasubramanian * Read the configuration data from the eeprom.
326115c9ee7aSSenthil Balasubramanian * The data can be put in any specified memory buffer.
326215c9ee7aSSenthil Balasubramanian *
326315c9ee7aSSenthil Balasubramanian * Returns -1 on error.
326415c9ee7aSSenthil Balasubramanian * Returns address of next memory location on success.
326515c9ee7aSSenthil Balasubramanian */
ar9300_eeprom_restore_internal(struct ath_hw * ah,u8 * mptr,int mdata_size)326615c9ee7aSSenthil Balasubramanian static int ar9300_eeprom_restore_internal(struct ath_hw *ah,
326715c9ee7aSSenthil Balasubramanian u8 *mptr, int mdata_size)
326815c9ee7aSSenthil Balasubramanian {
326915c9ee7aSSenthil Balasubramanian #define MDEFAULT 15
327015c9ee7aSSenthil Balasubramanian #define MSTATE 100
327115c9ee7aSSenthil Balasubramanian int cptr;
327215c9ee7aSSenthil Balasubramanian u8 *word;
327315c9ee7aSSenthil Balasubramanian int code;
327415c9ee7aSSenthil Balasubramanian int reference, length, major, minor;
327515c9ee7aSSenthil Balasubramanian int osize;
327615c9ee7aSSenthil Balasubramanian int it;
327715c9ee7aSSenthil Balasubramanian u16 checksum, mchecksum;
327815c9ee7aSSenthil Balasubramanian struct ath_common *common = ath9k_hw_common(ah);
327901967360SFelix Fietkau struct ar9300_eeprom *eep;
3280488f6ba7SFelix Fietkau eeprom_read_op read;
328115c9ee7aSSenthil Balasubramanian
328201967360SFelix Fietkau if (ath9k_hw_use_flash(ah)) {
328301967360SFelix Fietkau u8 txrx;
328401967360SFelix Fietkau
3285a5d26827SEduardo Abinader if (ar9300_eeprom_restore_flash(ah, mptr, mdata_size))
3286a5d26827SEduardo Abinader return -EIO;
328701967360SFelix Fietkau
328801967360SFelix Fietkau /* check if eeprom contains valid data */
328901967360SFelix Fietkau eep = (struct ar9300_eeprom *) mptr;
329001967360SFelix Fietkau txrx = eep->baseEepHeader.txrxMask;
329101967360SFelix Fietkau if (txrx != 0 && txrx != 0xff)
329201967360SFelix Fietkau return 0;
329301967360SFelix Fietkau }
3294aaa13ca2SFelix Fietkau
329515c9ee7aSSenthil Balasubramanian word = kzalloc(2048, GFP_KERNEL);
329615c9ee7aSSenthil Balasubramanian if (!word)
32971ba45b9eSLarry Finger return -ENOMEM;
329815c9ee7aSSenthil Balasubramanian
329915c9ee7aSSenthil Balasubramanian memcpy(mptr, &ar9300_default, mdata_size);
330015c9ee7aSSenthil Balasubramanian
3301488f6ba7SFelix Fietkau read = ar9300_read_eeprom;
330260e0c3a7SVasanthakumar Thiagarajan if (AR_SREV_9485(ah))
330360e0c3a7SVasanthakumar Thiagarajan cptr = AR9300_BASE_ADDR_4K;
33045b5c033bSGabor Juhos else if (AR_SREV_9330(ah))
33055b5c033bSGabor Juhos cptr = AR9300_BASE_ADDR_512;
330660e0c3a7SVasanthakumar Thiagarajan else
330715c9ee7aSSenthil Balasubramanian cptr = AR9300_BASE_ADDR;
3308d2182b69SJoe Perches ath_dbg(common, EEPROM, "Trying EEPROM access at Address 0x%04x\n",
3309d2182b69SJoe Perches cptr);
3310488f6ba7SFelix Fietkau if (ar9300_check_eeprom_header(ah, read, cptr))
3311488f6ba7SFelix Fietkau goto found;
3312488f6ba7SFelix Fietkau
3313528782ecSWojciech Dubowik cptr = AR9300_BASE_ADDR_4K;
3314528782ecSWojciech Dubowik ath_dbg(common, EEPROM, "Trying EEPROM access at Address 0x%04x\n",
3315528782ecSWojciech Dubowik cptr);
3316528782ecSWojciech Dubowik if (ar9300_check_eeprom_header(ah, read, cptr))
3317528782ecSWojciech Dubowik goto found;
3318528782ecSWojciech Dubowik
3319488f6ba7SFelix Fietkau cptr = AR9300_BASE_ADDR_512;
3320d2182b69SJoe Perches ath_dbg(common, EEPROM, "Trying EEPROM access at Address 0x%04x\n",
3321d2182b69SJoe Perches cptr);
3322488f6ba7SFelix Fietkau if (ar9300_check_eeprom_header(ah, read, cptr))
3323488f6ba7SFelix Fietkau goto found;
3324488f6ba7SFelix Fietkau
3325488f6ba7SFelix Fietkau read = ar9300_read_otp;
3326488f6ba7SFelix Fietkau cptr = AR9300_BASE_ADDR;
3327d2182b69SJoe Perches ath_dbg(common, EEPROM, "Trying OTP access at Address 0x%04x\n", cptr);
3328488f6ba7SFelix Fietkau if (ar9300_check_eeprom_header(ah, read, cptr))
3329488f6ba7SFelix Fietkau goto found;
3330488f6ba7SFelix Fietkau
3331488f6ba7SFelix Fietkau cptr = AR9300_BASE_ADDR_512;
3332d2182b69SJoe Perches ath_dbg(common, EEPROM, "Trying OTP access at Address 0x%04x\n", cptr);
3333488f6ba7SFelix Fietkau if (ar9300_check_eeprom_header(ah, read, cptr))
3334488f6ba7SFelix Fietkau goto found;
3335488f6ba7SFelix Fietkau
333615c9ee7aSSenthil Balasubramanian goto fail;
333715c9ee7aSSenthil Balasubramanian
3338488f6ba7SFelix Fietkau found:
3339d2182b69SJoe Perches ath_dbg(common, EEPROM, "Found valid EEPROM data\n");
3340488f6ba7SFelix Fietkau
3341488f6ba7SFelix Fietkau for (it = 0; it < MSTATE; it++) {
3342488f6ba7SFelix Fietkau if (!read(ah, cptr, word, COMP_HDR_LEN))
3343488f6ba7SFelix Fietkau goto fail;
3344488f6ba7SFelix Fietkau
3345488f6ba7SFelix Fietkau if (!ar9300_check_header(word))
334615c9ee7aSSenthil Balasubramanian break;
334715c9ee7aSSenthil Balasubramanian
334815c9ee7aSSenthil Balasubramanian ar9300_comp_hdr_unpack(word, &code, &reference,
334915c9ee7aSSenthil Balasubramanian &length, &major, &minor);
3350d2182b69SJoe Perches ath_dbg(common, EEPROM,
3351226afe68SJoe Perches "Found block at %x: code=%d ref=%d length=%d major=%d minor=%d\n",
3352226afe68SJoe Perches cptr, code, reference, length, major, minor);
335360e0c3a7SVasanthakumar Thiagarajan if ((!AR_SREV_9485(ah) && length >= 1024) ||
335423151b9aSZekun Shen (AR_SREV_9485(ah) && length > EEPROM_DATA_LEN_9485) ||
335523151b9aSZekun Shen (length > cptr)) {
3356d2182b69SJoe Perches ath_dbg(common, EEPROM, "Skipping bad header\n");
335715c9ee7aSSenthil Balasubramanian cptr -= COMP_HDR_LEN;
335815c9ee7aSSenthil Balasubramanian continue;
335915c9ee7aSSenthil Balasubramanian }
336015c9ee7aSSenthil Balasubramanian
336115c9ee7aSSenthil Balasubramanian osize = length;
3362488f6ba7SFelix Fietkau read(ah, cptr, word, COMP_HDR_LEN + osize + COMP_CKSUM_LEN);
336315c9ee7aSSenthil Balasubramanian checksum = ar9300_comp_cksum(&word[COMP_HDR_LEN], length);
336478fa99abSPavel Roskin mchecksum = get_unaligned_le16(&word[COMP_HDR_LEN + osize]);
3365d2182b69SJoe Perches ath_dbg(common, EEPROM, "checksum %x %x\n",
3366d2182b69SJoe Perches checksum, mchecksum);
336715c9ee7aSSenthil Balasubramanian if (checksum == mchecksum) {
336815c9ee7aSSenthil Balasubramanian ar9300_compress_decision(ah, it, code, reference, mptr,
336915c9ee7aSSenthil Balasubramanian word, length, mdata_size);
337015c9ee7aSSenthil Balasubramanian } else {
3371d2182b69SJoe Perches ath_dbg(common, EEPROM,
337215c9ee7aSSenthil Balasubramanian "skipping block with bad checksum\n");
337315c9ee7aSSenthil Balasubramanian }
337415c9ee7aSSenthil Balasubramanian cptr -= (COMP_HDR_LEN + osize + COMP_CKSUM_LEN);
337515c9ee7aSSenthil Balasubramanian }
337615c9ee7aSSenthil Balasubramanian
337715c9ee7aSSenthil Balasubramanian kfree(word);
337815c9ee7aSSenthil Balasubramanian return cptr;
337915c9ee7aSSenthil Balasubramanian
338015c9ee7aSSenthil Balasubramanian fail:
338115c9ee7aSSenthil Balasubramanian kfree(word);
338215c9ee7aSSenthil Balasubramanian return -1;
338315c9ee7aSSenthil Balasubramanian }
338415c9ee7aSSenthil Balasubramanian
338515c9ee7aSSenthil Balasubramanian /*
338615c9ee7aSSenthil Balasubramanian * Restore the configuration structure by reading the eeprom.
338715c9ee7aSSenthil Balasubramanian * This function destroys any existing in-memory structure
338815c9ee7aSSenthil Balasubramanian * content.
338915c9ee7aSSenthil Balasubramanian */
ath9k_hw_ar9300_fill_eeprom(struct ath_hw * ah)339015c9ee7aSSenthil Balasubramanian static bool ath9k_hw_ar9300_fill_eeprom(struct ath_hw *ah)
339115c9ee7aSSenthil Balasubramanian {
3392ffdc4cbeSFelix Fietkau u8 *mptr = (u8 *) &ah->eeprom.ar9300_eep;
339315c9ee7aSSenthil Balasubramanian
3394ffdc4cbeSFelix Fietkau if (ar9300_eeprom_restore_internal(ah, mptr,
3395ffdc4cbeSFelix Fietkau sizeof(struct ar9300_eeprom)) < 0)
339615c9ee7aSSenthil Balasubramanian return false;
3397ffdc4cbeSFelix Fietkau
3398ffdc4cbeSFelix Fietkau return true;
339915c9ee7aSSenthil Balasubramanian }
340015c9ee7aSSenthil Balasubramanian
340126526202SRajkumar Manoharan #if defined(CONFIG_ATH9K_DEBUGFS) || defined(CONFIG_ATH9K_HTC_DEBUGFS)
ar9003_dump_modal_eeprom(char * buf,u32 len,u32 size,struct ar9300_modal_eep_header * modal_hdr)340226526202SRajkumar Manoharan static u32 ar9003_dump_modal_eeprom(char *buf, u32 len, u32 size,
340326526202SRajkumar Manoharan struct ar9300_modal_eep_header *modal_hdr)
340426526202SRajkumar Manoharan {
340526526202SRajkumar Manoharan PR_EEP("Chain0 Ant. Control", le16_to_cpu(modal_hdr->antCtrlChain[0]));
340626526202SRajkumar Manoharan PR_EEP("Chain1 Ant. Control", le16_to_cpu(modal_hdr->antCtrlChain[1]));
340726526202SRajkumar Manoharan PR_EEP("Chain2 Ant. Control", le16_to_cpu(modal_hdr->antCtrlChain[2]));
340826526202SRajkumar Manoharan PR_EEP("Ant. Common Control", le32_to_cpu(modal_hdr->antCtrlCommon));
340926526202SRajkumar Manoharan PR_EEP("Ant. Common Control2", le32_to_cpu(modal_hdr->antCtrlCommon2));
341026526202SRajkumar Manoharan PR_EEP("Ant. Gain", modal_hdr->antennaGain);
341126526202SRajkumar Manoharan PR_EEP("Switch Settle", modal_hdr->switchSettling);
341226526202SRajkumar Manoharan PR_EEP("Chain0 xatten1DB", modal_hdr->xatten1DB[0]);
341326526202SRajkumar Manoharan PR_EEP("Chain1 xatten1DB", modal_hdr->xatten1DB[1]);
341426526202SRajkumar Manoharan PR_EEP("Chain2 xatten1DB", modal_hdr->xatten1DB[2]);
341526526202SRajkumar Manoharan PR_EEP("Chain0 xatten1Margin", modal_hdr->xatten1Margin[0]);
341626526202SRajkumar Manoharan PR_EEP("Chain1 xatten1Margin", modal_hdr->xatten1Margin[1]);
341726526202SRajkumar Manoharan PR_EEP("Chain2 xatten1Margin", modal_hdr->xatten1Margin[2]);
341826526202SRajkumar Manoharan PR_EEP("Temp Slope", modal_hdr->tempSlope);
341926526202SRajkumar Manoharan PR_EEP("Volt Slope", modal_hdr->voltSlope);
342026526202SRajkumar Manoharan PR_EEP("spur Channels0", modal_hdr->spurChans[0]);
342126526202SRajkumar Manoharan PR_EEP("spur Channels1", modal_hdr->spurChans[1]);
342226526202SRajkumar Manoharan PR_EEP("spur Channels2", modal_hdr->spurChans[2]);
342326526202SRajkumar Manoharan PR_EEP("spur Channels3", modal_hdr->spurChans[3]);
342426526202SRajkumar Manoharan PR_EEP("spur Channels4", modal_hdr->spurChans[4]);
342526526202SRajkumar Manoharan PR_EEP("Chain0 NF Threshold", modal_hdr->noiseFloorThreshCh[0]);
342626526202SRajkumar Manoharan PR_EEP("Chain1 NF Threshold", modal_hdr->noiseFloorThreshCh[1]);
342726526202SRajkumar Manoharan PR_EEP("Chain2 NF Threshold", modal_hdr->noiseFloorThreshCh[2]);
3428df222edcSRajkumar Manoharan PR_EEP("Quick Drop", modal_hdr->quick_drop);
3429202bff08SRajkumar Manoharan PR_EEP("txEndToXpaOff", modal_hdr->txEndToXpaOff);
343026526202SRajkumar Manoharan PR_EEP("xPA Bias Level", modal_hdr->xpaBiasLvl);
343126526202SRajkumar Manoharan PR_EEP("txFrameToDataStart", modal_hdr->txFrameToDataStart);
343226526202SRajkumar Manoharan PR_EEP("txFrameToPaOn", modal_hdr->txFrameToPaOn);
343326526202SRajkumar Manoharan PR_EEP("txFrameToXpaOn", modal_hdr->txFrameToXpaOn);
343426526202SRajkumar Manoharan PR_EEP("txClip", modal_hdr->txClip);
343526526202SRajkumar Manoharan PR_EEP("ADC Desired size", modal_hdr->adcDesiredSize);
343626526202SRajkumar Manoharan
343726526202SRajkumar Manoharan return len;
343826526202SRajkumar Manoharan }
343926526202SRajkumar Manoharan
ar9003_dump_cal_data(struct ath_hw * ah,char * buf,u32 len,u32 size,bool is_2g)34403717957cSWojciech Dubowik static u32 ar9003_dump_cal_data(struct ath_hw *ah, char *buf, u32 len, u32 size,
34413717957cSWojciech Dubowik bool is_2g)
34423717957cSWojciech Dubowik {
34433717957cSWojciech Dubowik struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
34443717957cSWojciech Dubowik struct ar9300_base_eep_hdr *pBase;
34453717957cSWojciech Dubowik struct ar9300_cal_data_per_freq_op_loop *cal_pier;
34463717957cSWojciech Dubowik int cal_pier_nr;
34473717957cSWojciech Dubowik int freq;
34483717957cSWojciech Dubowik int i, j;
34493717957cSWojciech Dubowik
34503717957cSWojciech Dubowik pBase = &eep->baseEepHeader;
34513717957cSWojciech Dubowik
34523717957cSWojciech Dubowik if (is_2g)
34533717957cSWojciech Dubowik cal_pier_nr = AR9300_NUM_2G_CAL_PIERS;
34543717957cSWojciech Dubowik else
34553717957cSWojciech Dubowik cal_pier_nr = AR9300_NUM_5G_CAL_PIERS;
34563717957cSWojciech Dubowik
34573717957cSWojciech Dubowik for (i = 0; i < AR9300_MAX_CHAINS; i++) {
34583717957cSWojciech Dubowik if (!((pBase->txrxMask >> i) & 1))
34593717957cSWojciech Dubowik continue;
34603717957cSWojciech Dubowik
34614b6e9f3fSKees Cook len += scnprintf(buf + len, size - len, "Chain %d\n", i);
34623717957cSWojciech Dubowik
34634b6e9f3fSKees Cook len += scnprintf(buf + len, size - len,
34643717957cSWojciech Dubowik "Freq\t ref\tvolt\ttemp\tnf_cal\tnf_pow\trx_temp\n");
34653717957cSWojciech Dubowik
34663717957cSWojciech Dubowik for (j = 0; j < cal_pier_nr; j++) {
34673717957cSWojciech Dubowik if (is_2g) {
34683717957cSWojciech Dubowik cal_pier = &eep->calPierData2G[i][j];
34693717957cSWojciech Dubowik freq = 2300 + eep->calFreqPier2G[j];
34703717957cSWojciech Dubowik } else {
34713717957cSWojciech Dubowik cal_pier = &eep->calPierData5G[i][j];
34723717957cSWojciech Dubowik freq = 4800 + eep->calFreqPier5G[j] * 5;
34733717957cSWojciech Dubowik }
34743717957cSWojciech Dubowik
34754b6e9f3fSKees Cook len += scnprintf(buf + len, size - len,
34763717957cSWojciech Dubowik "%d\t", freq);
34773717957cSWojciech Dubowik
34784b6e9f3fSKees Cook len += scnprintf(buf + len, size - len,
34793717957cSWojciech Dubowik "%d\t%d\t%d\t%d\t%d\t%d\n",
34803717957cSWojciech Dubowik cal_pier->refPower,
34813717957cSWojciech Dubowik cal_pier->voltMeas,
34823717957cSWojciech Dubowik cal_pier->tempMeas,
34833717957cSWojciech Dubowik cal_pier->rxTempMeas ?
34843717957cSWojciech Dubowik N2DBM(cal_pier->rxNoisefloorCal) : 0,
34853717957cSWojciech Dubowik cal_pier->rxTempMeas ?
34863717957cSWojciech Dubowik N2DBM(cal_pier->rxNoisefloorPower) : 0,
34873717957cSWojciech Dubowik cal_pier->rxTempMeas);
34883717957cSWojciech Dubowik }
34893717957cSWojciech Dubowik }
34903717957cSWojciech Dubowik
34913717957cSWojciech Dubowik return len;
34923717957cSWojciech Dubowik }
34933717957cSWojciech Dubowik
ath9k_hw_ar9003_dump_eeprom(struct ath_hw * ah,bool dump_base_hdr,u8 * buf,u32 len,u32 size)349426526202SRajkumar Manoharan static u32 ath9k_hw_ar9003_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr,
349526526202SRajkumar Manoharan u8 *buf, u32 len, u32 size)
349626526202SRajkumar Manoharan {
349726526202SRajkumar Manoharan struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
349826526202SRajkumar Manoharan struct ar9300_base_eep_hdr *pBase;
349926526202SRajkumar Manoharan
350026526202SRajkumar Manoharan if (!dump_base_hdr) {
35015e88ba62SZefir Kurtisi len += scnprintf(buf + len, size - len,
350226526202SRajkumar Manoharan "%20s :\n", "2GHz modal Header");
3503d25360b1SMohammed Shafi Shajakhan len = ar9003_dump_modal_eeprom(buf, len, size,
350426526202SRajkumar Manoharan &eep->modalHeader2G);
35053717957cSWojciech Dubowik
35063717957cSWojciech Dubowik len += scnprintf(buf + len, size - len, "Calibration data\n");
35073717957cSWojciech Dubowik len = ar9003_dump_cal_data(ah, buf, len, size, true);
35083717957cSWojciech Dubowik
35094b6e9f3fSKees Cook len += scnprintf(buf + len, size - len,
351026526202SRajkumar Manoharan "%20s :\n", "5GHz modal Header");
3511d25360b1SMohammed Shafi Shajakhan len = ar9003_dump_modal_eeprom(buf, len, size,
351226526202SRajkumar Manoharan &eep->modalHeader5G);
35133717957cSWojciech Dubowik
35144b6e9f3fSKees Cook len += scnprintf(buf + len, size - len, "Calibration data\n");
35153717957cSWojciech Dubowik len = ar9003_dump_cal_data(ah, buf, len, size, false);
35163717957cSWojciech Dubowik
351726526202SRajkumar Manoharan goto out;
351826526202SRajkumar Manoharan }
351926526202SRajkumar Manoharan
352026526202SRajkumar Manoharan pBase = &eep->baseEepHeader;
352126526202SRajkumar Manoharan
352226526202SRajkumar Manoharan PR_EEP("EEPROM Version", ah->eeprom.ar9300_eep.eepromVersion);
352326526202SRajkumar Manoharan PR_EEP("RegDomain1", le16_to_cpu(pBase->regDmn[0]));
352426526202SRajkumar Manoharan PR_EEP("RegDomain2", le16_to_cpu(pBase->regDmn[1]));
352526526202SRajkumar Manoharan PR_EEP("TX Mask", (pBase->txrxMask >> 4));
352626526202SRajkumar Manoharan PR_EEP("RX Mask", (pBase->txrxMask & 0x0f));
352726526202SRajkumar Manoharan PR_EEP("Allow 5GHz", !!(pBase->opCapFlags.opFlags &
352826526202SRajkumar Manoharan AR5416_OPFLAGS_11A));
352926526202SRajkumar Manoharan PR_EEP("Allow 2GHz", !!(pBase->opCapFlags.opFlags &
353026526202SRajkumar Manoharan AR5416_OPFLAGS_11G));
353126526202SRajkumar Manoharan PR_EEP("Disable 2GHz HT20", !!(pBase->opCapFlags.opFlags &
353226526202SRajkumar Manoharan AR5416_OPFLAGS_N_2G_HT20));
353326526202SRajkumar Manoharan PR_EEP("Disable 2GHz HT40", !!(pBase->opCapFlags.opFlags &
353426526202SRajkumar Manoharan AR5416_OPFLAGS_N_2G_HT40));
353526526202SRajkumar Manoharan PR_EEP("Disable 5Ghz HT20", !!(pBase->opCapFlags.opFlags &
353626526202SRajkumar Manoharan AR5416_OPFLAGS_N_5G_HT20));
353726526202SRajkumar Manoharan PR_EEP("Disable 5Ghz HT40", !!(pBase->opCapFlags.opFlags &
353826526202SRajkumar Manoharan AR5416_OPFLAGS_N_5G_HT40));
353981a834e3SMartin Blumenstingl PR_EEP("Big Endian", !!(pBase->opCapFlags.eepMisc &
354081a834e3SMartin Blumenstingl AR5416_EEPMISC_BIG_ENDIAN));
354126526202SRajkumar Manoharan PR_EEP("RF Silent", pBase->rfSilent);
354226526202SRajkumar Manoharan PR_EEP("BT option", pBase->blueToothOptions);
354326526202SRajkumar Manoharan PR_EEP("Device Cap", pBase->deviceCap);
354426526202SRajkumar Manoharan PR_EEP("Device Type", pBase->deviceType);
354526526202SRajkumar Manoharan PR_EEP("Power Table Offset", pBase->pwrTableOffset);
354626526202SRajkumar Manoharan PR_EEP("Tuning Caps1", pBase->params_for_tuning_caps[0]);
354726526202SRajkumar Manoharan PR_EEP("Tuning Caps2", pBase->params_for_tuning_caps[1]);
354826526202SRajkumar Manoharan PR_EEP("Enable Tx Temp Comp", !!(pBase->featureEnable & BIT(0)));
354926526202SRajkumar Manoharan PR_EEP("Enable Tx Volt Comp", !!(pBase->featureEnable & BIT(1)));
355026526202SRajkumar Manoharan PR_EEP("Enable fast clock", !!(pBase->featureEnable & BIT(2)));
355126526202SRajkumar Manoharan PR_EEP("Enable doubling", !!(pBase->featureEnable & BIT(3)));
355226526202SRajkumar Manoharan PR_EEP("Internal regulator", !!(pBase->featureEnable & BIT(4)));
355326526202SRajkumar Manoharan PR_EEP("Enable Paprd", !!(pBase->featureEnable & BIT(5)));
355426526202SRajkumar Manoharan PR_EEP("Driver Strength", !!(pBase->miscConfiguration & BIT(0)));
3555df222edcSRajkumar Manoharan PR_EEP("Quick Drop", !!(pBase->miscConfiguration & BIT(1)));
355626526202SRajkumar Manoharan PR_EEP("Chain mask Reduce", (pBase->miscConfiguration >> 0x3) & 0x1);
355726526202SRajkumar Manoharan PR_EEP("Write enable Gpio", pBase->eepromWriteEnableGpio);
355826526202SRajkumar Manoharan PR_EEP("WLAN Disable Gpio", pBase->wlanDisableGpio);
355926526202SRajkumar Manoharan PR_EEP("WLAN LED Gpio", pBase->wlanLedGpio);
356026526202SRajkumar Manoharan PR_EEP("Rx Band Select Gpio", pBase->rxBandSelectGpio);
356126526202SRajkumar Manoharan PR_EEP("Tx Gain", pBase->txrxgain >> 4);
356226526202SRajkumar Manoharan PR_EEP("Rx Gain", pBase->txrxgain & 0xf);
356326526202SRajkumar Manoharan PR_EEP("SW Reg", le32_to_cpu(pBase->swreg));
356426526202SRajkumar Manoharan
35655e88ba62SZefir Kurtisi len += scnprintf(buf + len, size - len, "%20s : %pM\n", "MacAddress",
356626526202SRajkumar Manoharan ah->eeprom.ar9300_eep.macAddr);
356726526202SRajkumar Manoharan out:
356826526202SRajkumar Manoharan if (len > size)
356926526202SRajkumar Manoharan len = size;
357026526202SRajkumar Manoharan
357126526202SRajkumar Manoharan return len;
357226526202SRajkumar Manoharan }
357326526202SRajkumar Manoharan #else
ath9k_hw_ar9003_dump_eeprom(struct ath_hw * ah,bool dump_base_hdr,u8 * buf,u32 len,u32 size)357426526202SRajkumar Manoharan static u32 ath9k_hw_ar9003_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr,
357526526202SRajkumar Manoharan u8 *buf, u32 len, u32 size)
357626526202SRajkumar Manoharan {
357726526202SRajkumar Manoharan return 0;
357826526202SRajkumar Manoharan }
357926526202SRajkumar Manoharan #endif
358026526202SRajkumar Manoharan
358115c9ee7aSSenthil Balasubramanian /* XXX: review hardware docs */
ath9k_hw_ar9300_get_eeprom_ver(struct ath_hw * ah)358215c9ee7aSSenthil Balasubramanian static int ath9k_hw_ar9300_get_eeprom_ver(struct ath_hw *ah)
358315c9ee7aSSenthil Balasubramanian {
358415c9ee7aSSenthil Balasubramanian return ah->eeprom.ar9300_eep.eepromVersion;
358515c9ee7aSSenthil Balasubramanian }
358615c9ee7aSSenthil Balasubramanian
358715c9ee7aSSenthil Balasubramanian /* XXX: could be read from the eepromVersion, not sure yet */
ath9k_hw_ar9300_get_eeprom_rev(struct ath_hw * ah)358815c9ee7aSSenthil Balasubramanian static int ath9k_hw_ar9300_get_eeprom_rev(struct ath_hw *ah)
358915c9ee7aSSenthil Balasubramanian {
359015c9ee7aSSenthil Balasubramanian return 0;
359115c9ee7aSSenthil Balasubramanian }
359215c9ee7aSSenthil Balasubramanian
ar9003_modal_header(struct ath_hw * ah,bool is2ghz)35930aefc591SFelix Fietkau static struct ar9300_modal_eep_header *ar9003_modal_header(struct ath_hw *ah,
35940aefc591SFelix Fietkau bool is2ghz)
359515c9ee7aSSenthil Balasubramanian {
359615c9ee7aSSenthil Balasubramanian struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
359715c9ee7aSSenthil Balasubramanian
359815c9ee7aSSenthil Balasubramanian if (is2ghz)
35990aefc591SFelix Fietkau return &eep->modalHeader2G;
360015c9ee7aSSenthil Balasubramanian else
36010aefc591SFelix Fietkau return &eep->modalHeader5G;
360215c9ee7aSSenthil Balasubramanian }
360315c9ee7aSSenthil Balasubramanian
ar9003_hw_xpa_bias_level_apply(struct ath_hw * ah,bool is2ghz)360415c9ee7aSSenthil Balasubramanian static void ar9003_hw_xpa_bias_level_apply(struct ath_hw *ah, bool is2ghz)
360515c9ee7aSSenthil Balasubramanian {
36060aefc591SFelix Fietkau int bias = ar9003_modal_header(ah, is2ghz)->xpaBiasLvl;
36079936e65fSVasanthakumar Thiagarajan
3608ddbbd9e8SRajkumar Manoharan if (AR_SREV_9485(ah) || AR_SREV_9330(ah) || AR_SREV_9340(ah) ||
3609ede6a5e7SMiaoqing Pan AR_SREV_9531(ah) || AR_SREV_9561(ah))
3610*b3a663f0SWenli Looi REG_RMW_FIELD(ah, AR_CH0_TOP2(ah), AR_CH0_TOP2_XPABIASLVL, bias);
3611a4a2954fSSujith Manoharan else if (AR_SREV_9462(ah) || AR_SREV_9550(ah) || AR_SREV_9565(ah))
3612*b3a663f0SWenli Looi REG_RMW_FIELD(ah, AR_CH0_TOP(ah), AR_CH0_TOP_XPABIASLVL, bias);
36139936e65fSVasanthakumar Thiagarajan else {
3614*b3a663f0SWenli Looi REG_RMW_FIELD(ah, AR_CH0_TOP(ah), AR_CH0_TOP_XPABIASLVL, bias);
3615*b3a663f0SWenli Looi REG_RMW_FIELD(ah, AR_CH0_THERM(ah),
3616160b7fb4SVasanthakumar Thiagarajan AR_CH0_THERM_XPABIASLVL_MSB,
36179936e65fSVasanthakumar Thiagarajan bias >> 2);
3618*b3a663f0SWenli Looi REG_RMW_FIELD(ah, AR_CH0_THERM(ah),
3619160b7fb4SVasanthakumar Thiagarajan AR_CH0_THERM_XPASHORT2GND, 1);
3620160b7fb4SVasanthakumar Thiagarajan }
362115c9ee7aSSenthil Balasubramanian }
362215c9ee7aSSenthil Balasubramanian
ar9003_switch_com_spdt_get(struct ath_hw * ah,bool is2ghz)36230aefc591SFelix Fietkau static u16 ar9003_switch_com_spdt_get(struct ath_hw *ah, bool is2ghz)
36242577c6e8SSenthil Balasubramanian {
36250aefc591SFelix Fietkau return le16_to_cpu(ar9003_modal_header(ah, is2ghz)->switchcomspdt);
36262577c6e8SSenthil Balasubramanian }
36272577c6e8SSenthil Balasubramanian
ar9003_hw_ant_ctrl_common_get(struct ath_hw * ah,bool is2ghz)362884893817SSujith Manoharan u32 ar9003_hw_ant_ctrl_common_get(struct ath_hw *ah, bool is2ghz)
362915c9ee7aSSenthil Balasubramanian {
36300aefc591SFelix Fietkau return le32_to_cpu(ar9003_modal_header(ah, is2ghz)->antCtrlCommon);
363115c9ee7aSSenthil Balasubramanian }
363215c9ee7aSSenthil Balasubramanian
ar9003_hw_ant_ctrl_common_2_get(struct ath_hw * ah,bool is2ghz)363384893817SSujith Manoharan u32 ar9003_hw_ant_ctrl_common_2_get(struct ath_hw *ah, bool is2ghz)
363415c9ee7aSSenthil Balasubramanian {
36350aefc591SFelix Fietkau return le32_to_cpu(ar9003_modal_header(ah, is2ghz)->antCtrlCommon2);
363615c9ee7aSSenthil Balasubramanian }
363715c9ee7aSSenthil Balasubramanian
ar9003_hw_ant_ctrl_chain_get(struct ath_hw * ah,int chain,bool is2ghz)36380aefc591SFelix Fietkau static u16 ar9003_hw_ant_ctrl_chain_get(struct ath_hw *ah, int chain,
363915c9ee7aSSenthil Balasubramanian bool is2ghz)
364015c9ee7aSSenthil Balasubramanian {
36410aefc591SFelix Fietkau __le16 val = ar9003_modal_header(ah, is2ghz)->antCtrlChain[chain];
3642ffdc4cbeSFelix Fietkau return le16_to_cpu(val);
364315c9ee7aSSenthil Balasubramanian }
364415c9ee7aSSenthil Balasubramanian
ar9003_hw_ant_ctrl_apply(struct ath_hw * ah,bool is2ghz)364515c9ee7aSSenthil Balasubramanian static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz)
364615c9ee7aSSenthil Balasubramanian {
36477bdea96aSSujith Manoharan struct ath_common *common = ath9k_hw_common(ah);
3648915154b6SSujith Manoharan struct ath9k_hw_capabilities *pCap = &ah->caps;
36492976bc5eSVasanthakumar Thiagarajan int chain;
36509b60b64bSSujith Manoharan u32 regval, value, gpio;
36512976bc5eSVasanthakumar Thiagarajan static const u32 switch_chain_reg[AR9300_MAX_CHAINS] = {
36522976bc5eSVasanthakumar Thiagarajan AR_PHY_SWITCH_CHAIN_0,
36532976bc5eSVasanthakumar Thiagarajan AR_PHY_SWITCH_CHAIN_1,
36542976bc5eSVasanthakumar Thiagarajan AR_PHY_SWITCH_CHAIN_2,
36552976bc5eSVasanthakumar Thiagarajan };
36562976bc5eSVasanthakumar Thiagarajan
36579b60b64bSSujith Manoharan if (AR_SREV_9485(ah) && (ar9003_hw_get_rx_gain_idx(ah) == 0)) {
36589b60b64bSSujith Manoharan if (ah->config.xlna_gpio)
36599b60b64bSSujith Manoharan gpio = ah->config.xlna_gpio;
36609b60b64bSSujith Manoharan else
36619b60b64bSSujith Manoharan gpio = AR9300_EXT_LNA_CTL_GPIO_AR9485;
36629b60b64bSSujith Manoharan
3663b2d70d49SMiaoqing Pan ath9k_hw_gpio_request_out(ah, gpio, NULL,
366430d5b709SSujith Manoharan AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED);
36659b60b64bSSujith Manoharan }
366630d5b709SSujith Manoharan
366730d5b709SSujith Manoharan value = ar9003_hw_ant_ctrl_common_get(ah, is2ghz);
36682976bc5eSVasanthakumar Thiagarajan
3669a4a2954fSSujith Manoharan if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) {
36702577c6e8SSenthil Balasubramanian REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM,
3671423e38e8SRajkumar Manoharan AR_SWITCH_TABLE_COM_AR9462_ALL, value);
3672ede6a5e7SMiaoqing Pan } else if (AR_SREV_9550(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah)) {
36732d00de48SGabor Juhos REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM,
36742d00de48SGabor Juhos AR_SWITCH_TABLE_COM_AR9550_ALL, value);
36752577c6e8SSenthil Balasubramanian } else
36762577c6e8SSenthil Balasubramanian REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM,
36772577c6e8SSenthil Balasubramanian AR_SWITCH_TABLE_COM_ALL, value);
36782577c6e8SSenthil Balasubramanian
36792577c6e8SSenthil Balasubramanian
36802577c6e8SSenthil Balasubramanian /*
3681423e38e8SRajkumar Manoharan * AR9462 defines new switch table for BT/WLAN,
36822577c6e8SSenthil Balasubramanian * here's new field name in XXX.ref for both 2G and 5G.
36832577c6e8SSenthil Balasubramanian * Register: [GLB_CONTROL] GLB_CONTROL (@0x20044)
36842577c6e8SSenthil Balasubramanian * 15:12 R/W SWITCH_TABLE_COM_SPDT_WLAN_RX
36852577c6e8SSenthil Balasubramanian * SWITCH_TABLE_COM_SPDT_WLAN_RX
36862577c6e8SSenthil Balasubramanian *
36872577c6e8SSenthil Balasubramanian * 11:8 R/W SWITCH_TABLE_COM_SPDT_WLAN_TX
36882577c6e8SSenthil Balasubramanian * SWITCH_TABLE_COM_SPDT_WLAN_TX
36892577c6e8SSenthil Balasubramanian *
36902577c6e8SSenthil Balasubramanian * 7:4 R/W SWITCH_TABLE_COM_SPDT_WLAN_IDLE
36912577c6e8SSenthil Balasubramanian * SWITCH_TABLE_COM_SPDT_WLAN_IDLE
36922577c6e8SSenthil Balasubramanian */
36932b5e54e2SSujith Manoharan if (AR_SREV_9462_20_OR_LATER(ah) || AR_SREV_9565(ah)) {
36942577c6e8SSenthil Balasubramanian value = ar9003_switch_com_spdt_get(ah, is2ghz);
36952577c6e8SSenthil Balasubramanian REG_RMW_FIELD(ah, AR_PHY_GLB_CONTROL,
36962577c6e8SSenthil Balasubramanian AR_SWITCH_TABLE_COM_SPDT_ALL, value);
36979dc08eceSRajkumar Manoharan REG_SET_BIT(ah, AR_PHY_GLB_CONTROL, AR_BTCOEX_CTRL_SPDT_ENABLE);
36982577c6e8SSenthil Balasubramanian }
369915c9ee7aSSenthil Balasubramanian
370015c9ee7aSSenthil Balasubramanian value = ar9003_hw_ant_ctrl_common_2_get(ah, is2ghz);
3701b21e3e14SSujith Manoharan if (AR_SREV_9485(ah) && common->bt_ant_diversity) {
370253b2f828SJohn W. Linville value &= ~AR_SWITCH_TABLE_COM2_ALL;
370353b2f828SJohn W. Linville value |= ah->config.ant_ctrl_comm2g_switch_enable;
3704b21e3e14SSujith Manoharan
3705b21e3e14SSujith Manoharan }
370615c9ee7aSSenthil Balasubramanian REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM_2, AR_SWITCH_TABLE_COM2_ALL, value);
370715c9ee7aSSenthil Balasubramanian
3708ef95e58dSSujith Manoharan if ((AR_SREV_9462(ah)) && (ah->rxchainmask == 0x2)) {
3709ef95e58dSSujith Manoharan value = ar9003_hw_ant_ctrl_chain_get(ah, 1, is2ghz);
3710ef95e58dSSujith Manoharan REG_RMW_FIELD(ah, switch_chain_reg[0],
3711ef95e58dSSujith Manoharan AR_SWITCH_TABLE_ALL, value);
3712ef95e58dSSujith Manoharan }
3713ef95e58dSSujith Manoharan
37142976bc5eSVasanthakumar Thiagarajan for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) {
37152976bc5eSVasanthakumar Thiagarajan if ((ah->rxchainmask & BIT(chain)) ||
37162976bc5eSVasanthakumar Thiagarajan (ah->txchainmask & BIT(chain))) {
37172976bc5eSVasanthakumar Thiagarajan value = ar9003_hw_ant_ctrl_chain_get(ah, chain,
37182976bc5eSVasanthakumar Thiagarajan is2ghz);
37192976bc5eSVasanthakumar Thiagarajan REG_RMW_FIELD(ah, switch_chain_reg[chain],
37202976bc5eSVasanthakumar Thiagarajan AR_SWITCH_TABLE_ALL, value);
37212976bc5eSVasanthakumar Thiagarajan }
372247e84dfbSVasanthakumar Thiagarajan }
372347e84dfbSVasanthakumar Thiagarajan
3724a4a2954fSSujith Manoharan if (AR_SREV_9330(ah) || AR_SREV_9485(ah) || AR_SREV_9565(ah)) {
372547e84dfbSVasanthakumar Thiagarajan value = ath9k_hw_ar9300_get_eeprom(ah, EEP_ANT_DIV_CTL1);
3726842ca780SMohammed Shafi Shajakhan /*
3727842ca780SMohammed Shafi Shajakhan * main_lnaconf, alt_lnaconf, main_tb, alt_tb
3728842ca780SMohammed Shafi Shajakhan * are the fields present
3729842ca780SMohammed Shafi Shajakhan */
3730842ca780SMohammed Shafi Shajakhan regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL);
3731842ca780SMohammed Shafi Shajakhan regval &= (~AR_ANT_DIV_CTRL_ALL);
3732842ca780SMohammed Shafi Shajakhan regval |= (value & 0x3f) << AR_ANT_DIV_CTRL_ALL_S;
3733842ca780SMohammed Shafi Shajakhan /* enable_lnadiv */
37349aa49ea3SSujith Manoharan regval &= (~AR_PHY_ANT_DIV_LNADIV);
37359aa49ea3SSujith Manoharan regval |= ((value >> 6) & 0x1) << AR_PHY_ANT_DIV_LNADIV_S;
3736362cd03fSSujith Manoharan
3737b21e3e14SSujith Manoharan if (AR_SREV_9485(ah) && common->bt_ant_diversity)
3738b21e3e14SSujith Manoharan regval |= AR_ANT_DIV_ENABLE;
3739b21e3e14SSujith Manoharan
3740362cd03fSSujith Manoharan if (AR_SREV_9565(ah)) {
37417bdea96aSSujith Manoharan if (common->bt_ant_diversity) {
3742362cd03fSSujith Manoharan regval |= (1 << AR_PHY_ANT_SW_RX_PROT_S);
3743c9468682SSujith Manoharan
3744c9468682SSujith Manoharan REG_SET_BIT(ah, AR_PHY_RESTART,
3745c9468682SSujith Manoharan AR_PHY_RESTART_ENABLE_DIV_M2FLAG);
3746c9468682SSujith Manoharan
3747c9468682SSujith Manoharan /* Force WLAN LNA diversity ON */
3748c9468682SSujith Manoharan REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV,
3749c9468682SSujith Manoharan AR_BTCOEX_WL_LNADIV_FORCE_ON);
3750362cd03fSSujith Manoharan } else {
3751362cd03fSSujith Manoharan regval &= ~(1 << AR_PHY_ANT_DIV_LNADIV_S);
3752362cd03fSSujith Manoharan regval &= ~(1 << AR_PHY_ANT_SW_RX_PROT_S);
3753c9468682SSujith Manoharan
3754c9468682SSujith Manoharan REG_CLR_BIT(ah, AR_PHY_MC_GAIN_CTRL,
3755c9468682SSujith Manoharan (1 << AR_PHY_ANT_SW_RX_PROT_S));
3756c9468682SSujith Manoharan
3757c9468682SSujith Manoharan /* Force WLAN LNA diversity OFF */
3758c9468682SSujith Manoharan REG_CLR_BIT(ah, AR_BTCOEX_WL_LNADIV,
3759c9468682SSujith Manoharan AR_BTCOEX_WL_LNADIV_FORCE_ON);
3760362cd03fSSujith Manoharan }
3761362cd03fSSujith Manoharan }
3762362cd03fSSujith Manoharan
3763842ca780SMohammed Shafi Shajakhan REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval);
3764842ca780SMohammed Shafi Shajakhan
3765842ca780SMohammed Shafi Shajakhan /* enable fast_div */
3766842ca780SMohammed Shafi Shajakhan regval = REG_READ(ah, AR_PHY_CCK_DETECT);
3767842ca780SMohammed Shafi Shajakhan regval &= (~AR_FAST_DIV_ENABLE);
37689aa49ea3SSujith Manoharan regval |= ((value >> 7) & 0x1) << AR_FAST_DIV_ENABLE_S;
3769b21e3e14SSujith Manoharan
3770c9468682SSujith Manoharan if ((AR_SREV_9485(ah) || AR_SREV_9565(ah))
3771c9468682SSujith Manoharan && common->bt_ant_diversity)
3772b21e3e14SSujith Manoharan regval |= AR_FAST_DIV_ENABLE;
3773b21e3e14SSujith Manoharan
3774842ca780SMohammed Shafi Shajakhan REG_WRITE(ah, AR_PHY_CCK_DETECT, regval);
3775915154b6SSujith Manoharan
3776915154b6SSujith Manoharan if (pCap->hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB) {
3777842ca780SMohammed Shafi Shajakhan regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL);
3778842ca780SMohammed Shafi Shajakhan /*
3779842ca780SMohammed Shafi Shajakhan * clear bits 25-30 main_lnaconf, alt_lnaconf,
3780842ca780SMohammed Shafi Shajakhan * main_tb, alt_tb
3781842ca780SMohammed Shafi Shajakhan */
37829aa49ea3SSujith Manoharan regval &= (~(AR_PHY_ANT_DIV_MAIN_LNACONF |
37839aa49ea3SSujith Manoharan AR_PHY_ANT_DIV_ALT_LNACONF |
37849aa49ea3SSujith Manoharan AR_PHY_ANT_DIV_ALT_GAINTB |
37859aa49ea3SSujith Manoharan AR_PHY_ANT_DIV_MAIN_GAINTB));
3786842ca780SMohammed Shafi Shajakhan /* by default use LNA1 for the main antenna */
3787c2b8359dSSujith Manoharan regval |= (ATH_ANT_DIV_COMB_LNA1 <<
37889aa49ea3SSujith Manoharan AR_PHY_ANT_DIV_MAIN_LNACONF_S);
3789c2b8359dSSujith Manoharan regval |= (ATH_ANT_DIV_COMB_LNA2 <<
37909aa49ea3SSujith Manoharan AR_PHY_ANT_DIV_ALT_LNACONF_S);
3791842ca780SMohammed Shafi Shajakhan REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval);
379247e84dfbSVasanthakumar Thiagarajan }
3793842ca780SMohammed Shafi Shajakhan }
379415c9ee7aSSenthil Balasubramanian }
379515c9ee7aSSenthil Balasubramanian
ar9003_hw_drive_strength_apply(struct ath_hw * ah)379615c9ee7aSSenthil Balasubramanian static void ar9003_hw_drive_strength_apply(struct ath_hw *ah)
379715c9ee7aSSenthil Balasubramanian {
37980aefc591SFelix Fietkau struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
37990aefc591SFelix Fietkau struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader;
380015c9ee7aSSenthil Balasubramanian int drive_strength;
380115c9ee7aSSenthil Balasubramanian unsigned long reg;
380215c9ee7aSSenthil Balasubramanian
38030aefc591SFelix Fietkau drive_strength = pBase->miscConfiguration & BIT(0);
380415c9ee7aSSenthil Balasubramanian if (!drive_strength)
380515c9ee7aSSenthil Balasubramanian return;
380615c9ee7aSSenthil Balasubramanian
380715c9ee7aSSenthil Balasubramanian reg = REG_READ(ah, AR_PHY_65NM_CH0_BIAS1);
380815c9ee7aSSenthil Balasubramanian reg &= ~0x00ffffc0;
380915c9ee7aSSenthil Balasubramanian reg |= 0x5 << 21;
381015c9ee7aSSenthil Balasubramanian reg |= 0x5 << 18;
381115c9ee7aSSenthil Balasubramanian reg |= 0x5 << 15;
381215c9ee7aSSenthil Balasubramanian reg |= 0x5 << 12;
381315c9ee7aSSenthil Balasubramanian reg |= 0x5 << 9;
381415c9ee7aSSenthil Balasubramanian reg |= 0x5 << 6;
381515c9ee7aSSenthil Balasubramanian REG_WRITE(ah, AR_PHY_65NM_CH0_BIAS1, reg);
381615c9ee7aSSenthil Balasubramanian
381715c9ee7aSSenthil Balasubramanian reg = REG_READ(ah, AR_PHY_65NM_CH0_BIAS2);
381815c9ee7aSSenthil Balasubramanian reg &= ~0xffffffe0;
381915c9ee7aSSenthil Balasubramanian reg |= 0x5 << 29;
382015c9ee7aSSenthil Balasubramanian reg |= 0x5 << 26;
382115c9ee7aSSenthil Balasubramanian reg |= 0x5 << 23;
382215c9ee7aSSenthil Balasubramanian reg |= 0x5 << 20;
382315c9ee7aSSenthil Balasubramanian reg |= 0x5 << 17;
382415c9ee7aSSenthil Balasubramanian reg |= 0x5 << 14;
382515c9ee7aSSenthil Balasubramanian reg |= 0x5 << 11;
382615c9ee7aSSenthil Balasubramanian reg |= 0x5 << 8;
382715c9ee7aSSenthil Balasubramanian reg |= 0x5 << 5;
382815c9ee7aSSenthil Balasubramanian REG_WRITE(ah, AR_PHY_65NM_CH0_BIAS2, reg);
382915c9ee7aSSenthil Balasubramanian
383015c9ee7aSSenthil Balasubramanian reg = REG_READ(ah, AR_PHY_65NM_CH0_BIAS4);
383115c9ee7aSSenthil Balasubramanian reg &= ~0xff800000;
383215c9ee7aSSenthil Balasubramanian reg |= 0x5 << 29;
383315c9ee7aSSenthil Balasubramanian reg |= 0x5 << 26;
383415c9ee7aSSenthil Balasubramanian reg |= 0x5 << 23;
383515c9ee7aSSenthil Balasubramanian REG_WRITE(ah, AR_PHY_65NM_CH0_BIAS4, reg);
383615c9ee7aSSenthil Balasubramanian }
383715c9ee7aSSenthil Balasubramanian
ar9003_hw_atten_chain_get(struct ath_hw * ah,int chain,struct ath9k_channel * chan)3838f4475a6eSVasanthakumar Thiagarajan static u16 ar9003_hw_atten_chain_get(struct ath_hw *ah, int chain,
3839f4475a6eSVasanthakumar Thiagarajan struct ath9k_channel *chan)
3840f4475a6eSVasanthakumar Thiagarajan {
3841f4475a6eSVasanthakumar Thiagarajan int f[3], t[3];
3842f4475a6eSVasanthakumar Thiagarajan u16 value;
3843f4475a6eSVasanthakumar Thiagarajan struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
3844f4475a6eSVasanthakumar Thiagarajan
3845f4475a6eSVasanthakumar Thiagarajan if (chain >= 0 && chain < 3) {
3846f4475a6eSVasanthakumar Thiagarajan if (IS_CHAN_2GHZ(chan))
3847f4475a6eSVasanthakumar Thiagarajan return eep->modalHeader2G.xatten1DB[chain];
3848f4475a6eSVasanthakumar Thiagarajan else if (eep->base_ext2.xatten1DBLow[chain] != 0) {
3849f4475a6eSVasanthakumar Thiagarajan t[0] = eep->base_ext2.xatten1DBLow[chain];
3850f4475a6eSVasanthakumar Thiagarajan f[0] = 5180;
3851f4475a6eSVasanthakumar Thiagarajan t[1] = eep->modalHeader5G.xatten1DB[chain];
3852f4475a6eSVasanthakumar Thiagarajan f[1] = 5500;
3853f4475a6eSVasanthakumar Thiagarajan t[2] = eep->base_ext2.xatten1DBHigh[chain];
3854f4475a6eSVasanthakumar Thiagarajan f[2] = 5785;
3855f4475a6eSVasanthakumar Thiagarajan value = ar9003_hw_power_interpolate((s32) chan->channel,
3856f4475a6eSVasanthakumar Thiagarajan f, t, 3);
3857f4475a6eSVasanthakumar Thiagarajan return value;
3858f4475a6eSVasanthakumar Thiagarajan } else
3859f4475a6eSVasanthakumar Thiagarajan return eep->modalHeader5G.xatten1DB[chain];
3860f4475a6eSVasanthakumar Thiagarajan }
3861f4475a6eSVasanthakumar Thiagarajan
3862f4475a6eSVasanthakumar Thiagarajan return 0;
3863f4475a6eSVasanthakumar Thiagarajan }
3864f4475a6eSVasanthakumar Thiagarajan
3865f4475a6eSVasanthakumar Thiagarajan
ar9003_hw_atten_chain_get_margin(struct ath_hw * ah,int chain,struct ath9k_channel * chan)3866f4475a6eSVasanthakumar Thiagarajan static u16 ar9003_hw_atten_chain_get_margin(struct ath_hw *ah, int chain,
3867f4475a6eSVasanthakumar Thiagarajan struct ath9k_channel *chan)
3868f4475a6eSVasanthakumar Thiagarajan {
3869f4475a6eSVasanthakumar Thiagarajan int f[3], t[3];
3870f4475a6eSVasanthakumar Thiagarajan u16 value;
3871f4475a6eSVasanthakumar Thiagarajan struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
3872f4475a6eSVasanthakumar Thiagarajan
3873f4475a6eSVasanthakumar Thiagarajan if (chain >= 0 && chain < 3) {
3874f4475a6eSVasanthakumar Thiagarajan if (IS_CHAN_2GHZ(chan))
3875f4475a6eSVasanthakumar Thiagarajan return eep->modalHeader2G.xatten1Margin[chain];
3876f4475a6eSVasanthakumar Thiagarajan else if (eep->base_ext2.xatten1MarginLow[chain] != 0) {
3877f4475a6eSVasanthakumar Thiagarajan t[0] = eep->base_ext2.xatten1MarginLow[chain];
3878f4475a6eSVasanthakumar Thiagarajan f[0] = 5180;
3879f4475a6eSVasanthakumar Thiagarajan t[1] = eep->modalHeader5G.xatten1Margin[chain];
3880f4475a6eSVasanthakumar Thiagarajan f[1] = 5500;
3881f4475a6eSVasanthakumar Thiagarajan t[2] = eep->base_ext2.xatten1MarginHigh[chain];
3882f4475a6eSVasanthakumar Thiagarajan f[2] = 5785;
3883f4475a6eSVasanthakumar Thiagarajan value = ar9003_hw_power_interpolate((s32) chan->channel,
3884f4475a6eSVasanthakumar Thiagarajan f, t, 3);
3885f4475a6eSVasanthakumar Thiagarajan return value;
3886f4475a6eSVasanthakumar Thiagarajan } else
3887f4475a6eSVasanthakumar Thiagarajan return eep->modalHeader5G.xatten1Margin[chain];
3888f4475a6eSVasanthakumar Thiagarajan }
3889f4475a6eSVasanthakumar Thiagarajan
3890f4475a6eSVasanthakumar Thiagarajan return 0;
3891f4475a6eSVasanthakumar Thiagarajan }
3892f4475a6eSVasanthakumar Thiagarajan
ar9003_hw_atten_apply(struct ath_hw * ah,struct ath9k_channel * chan)3893f4475a6eSVasanthakumar Thiagarajan static void ar9003_hw_atten_apply(struct ath_hw *ah, struct ath9k_channel *chan)
3894f4475a6eSVasanthakumar Thiagarajan {
3895f4475a6eSVasanthakumar Thiagarajan int i;
3896f4475a6eSVasanthakumar Thiagarajan u16 value;
3897f4475a6eSVasanthakumar Thiagarajan unsigned long ext_atten_reg[3] = {AR_PHY_EXT_ATTEN_CTL_0,
3898f4475a6eSVasanthakumar Thiagarajan AR_PHY_EXT_ATTEN_CTL_1,
3899f4475a6eSVasanthakumar Thiagarajan AR_PHY_EXT_ATTEN_CTL_2,
3900f4475a6eSVasanthakumar Thiagarajan };
3901f4475a6eSVasanthakumar Thiagarajan
3902ef95e58dSSujith Manoharan if ((AR_SREV_9462(ah)) && (ah->rxchainmask == 0x2)) {
3903ef95e58dSSujith Manoharan value = ar9003_hw_atten_chain_get(ah, 1, chan);
3904ef95e58dSSujith Manoharan REG_RMW_FIELD(ah, ext_atten_reg[0],
3905ef95e58dSSujith Manoharan AR_PHY_EXT_ATTEN_CTL_XATTEN1_DB, value);
3906ef95e58dSSujith Manoharan
3907ef95e58dSSujith Manoharan value = ar9003_hw_atten_chain_get_margin(ah, 1, chan);
3908ef95e58dSSujith Manoharan REG_RMW_FIELD(ah, ext_atten_reg[0],
3909ef95e58dSSujith Manoharan AR_PHY_EXT_ATTEN_CTL_XATTEN1_MARGIN,
3910ef95e58dSSujith Manoharan value);
3911ef95e58dSSujith Manoharan }
3912ef95e58dSSujith Manoharan
3913f4475a6eSVasanthakumar Thiagarajan /* Test value. if 0 then attenuation is unused. Don't load anything. */
39143096a4d9SWenli Looi for (i = 0; i < AR9300_MAX_CHAINS; i++) {
39152976bc5eSVasanthakumar Thiagarajan if (ah->txchainmask & BIT(i)) {
3916f4475a6eSVasanthakumar Thiagarajan value = ar9003_hw_atten_chain_get(ah, i, chan);
3917f4475a6eSVasanthakumar Thiagarajan REG_RMW_FIELD(ah, ext_atten_reg[i],
3918f4475a6eSVasanthakumar Thiagarajan AR_PHY_EXT_ATTEN_CTL_XATTEN1_DB, value);
3919f4475a6eSVasanthakumar Thiagarajan
39209b60b64bSSujith Manoharan if (AR_SREV_9485(ah) &&
39219b60b64bSSujith Manoharan (ar9003_hw_get_rx_gain_idx(ah) == 0) &&
39229b60b64bSSujith Manoharan ah->config.xatten_margin_cfg)
39239b60b64bSSujith Manoharan value = 5;
39249b60b64bSSujith Manoharan else
3925f4475a6eSVasanthakumar Thiagarajan value = ar9003_hw_atten_chain_get_margin(ah, i, chan);
39269b60b64bSSujith Manoharan
3927e083a42eSSujith Manoharan if (ah->config.alt_mingainidx)
3928e083a42eSSujith Manoharan REG_RMW_FIELD(ah, AR_PHY_EXT_ATTEN_CTL_0,
3929e083a42eSSujith Manoharan AR_PHY_EXT_ATTEN_CTL_XATTEN1_MARGIN,
3930e083a42eSSujith Manoharan value);
3931e083a42eSSujith Manoharan
3932f4475a6eSVasanthakumar Thiagarajan REG_RMW_FIELD(ah, ext_atten_reg[i],
39332976bc5eSVasanthakumar Thiagarajan AR_PHY_EXT_ATTEN_CTL_XATTEN1_MARGIN,
39342976bc5eSVasanthakumar Thiagarajan value);
39352976bc5eSVasanthakumar Thiagarajan }
3936f4475a6eSVasanthakumar Thiagarajan }
3937f4475a6eSVasanthakumar Thiagarajan }
3938f4475a6eSVasanthakumar Thiagarajan
is_pmu_set(struct ath_hw * ah,u32 pmu_reg,int pmu_set)3939ab09b5b4SVasanthakumar Thiagarajan static bool is_pmu_set(struct ath_hw *ah, u32 pmu_reg, int pmu_set)
3940ab09b5b4SVasanthakumar Thiagarajan {
3941ab09b5b4SVasanthakumar Thiagarajan int timeout = 100;
3942ab09b5b4SVasanthakumar Thiagarajan
3943ab09b5b4SVasanthakumar Thiagarajan while (pmu_set != REG_READ(ah, pmu_reg)) {
3944ab09b5b4SVasanthakumar Thiagarajan if (timeout-- == 0)
3945ab09b5b4SVasanthakumar Thiagarajan return false;
3946ab09b5b4SVasanthakumar Thiagarajan REG_WRITE(ah, pmu_reg, pmu_set);
3947ab09b5b4SVasanthakumar Thiagarajan udelay(10);
3948ab09b5b4SVasanthakumar Thiagarajan }
3949ab09b5b4SVasanthakumar Thiagarajan
3950ab09b5b4SVasanthakumar Thiagarajan return true;
3951ab09b5b4SVasanthakumar Thiagarajan }
3952ab09b5b4SVasanthakumar Thiagarajan
ar9003_hw_internal_regulator_apply(struct ath_hw * ah)3953bfc441a4SFelix Fietkau void ar9003_hw_internal_regulator_apply(struct ath_hw *ah)
395415c9ee7aSSenthil Balasubramanian {
39550aefc591SFelix Fietkau struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
39560aefc591SFelix Fietkau struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader;
39572577c6e8SSenthil Balasubramanian u32 reg_val;
395815c9ee7aSSenthil Balasubramanian
39590aefc591SFelix Fietkau if (pBase->featureEnable & BIT(4)) {
39604187afa2SGabor Juhos if (AR_SREV_9330(ah) || AR_SREV_9485(ah)) {
3961ab09b5b4SVasanthakumar Thiagarajan int reg_pmu_set;
3962ab09b5b4SVasanthakumar Thiagarajan
3963*b3a663f0SWenli Looi reg_pmu_set = REG_READ(ah, AR_PHY_PMU2(ah)) & ~AR_PHY_PMU2_PGM;
3964*b3a663f0SWenli Looi REG_WRITE(ah, AR_PHY_PMU2(ah), reg_pmu_set);
3965*b3a663f0SWenli Looi if (!is_pmu_set(ah, AR_PHY_PMU2(ah), reg_pmu_set))
3966ab09b5b4SVasanthakumar Thiagarajan return;
3967ab09b5b4SVasanthakumar Thiagarajan
39684187afa2SGabor Juhos if (AR_SREV_9330(ah)) {
39694187afa2SGabor Juhos if (ah->is_clk_25mhz) {
39704187afa2SGabor Juhos reg_pmu_set = (3 << 1) | (8 << 4) |
39714187afa2SGabor Juhos (3 << 8) | (1 << 14) |
39724187afa2SGabor Juhos (6 << 17) | (1 << 20) |
39734187afa2SGabor Juhos (3 << 24);
39744187afa2SGabor Juhos } else {
39754187afa2SGabor Juhos reg_pmu_set = (4 << 1) | (7 << 4) |
39764187afa2SGabor Juhos (3 << 8) | (1 << 14) |
39774187afa2SGabor Juhos (6 << 17) | (1 << 20) |
39784187afa2SGabor Juhos (3 << 24);
39794187afa2SGabor Juhos }
39804187afa2SGabor Juhos } else {
39814187afa2SGabor Juhos reg_pmu_set = (5 << 1) | (7 << 4) |
39821fa707aaSRajkumar Manoharan (2 << 8) | (2 << 14) |
39834187afa2SGabor Juhos (6 << 17) | (1 << 20) |
3984ab09b5b4SVasanthakumar Thiagarajan (3 << 24) | (1 << 28);
39854187afa2SGabor Juhos }
3986ab09b5b4SVasanthakumar Thiagarajan
3987*b3a663f0SWenli Looi REG_WRITE(ah, AR_PHY_PMU1(ah), reg_pmu_set);
3988*b3a663f0SWenli Looi if (!is_pmu_set(ah, AR_PHY_PMU1(ah), reg_pmu_set))
3989ab09b5b4SVasanthakumar Thiagarajan return;
3990ab09b5b4SVasanthakumar Thiagarajan
3991*b3a663f0SWenli Looi reg_pmu_set = (REG_READ(ah, AR_PHY_PMU2(ah)) & ~0xFFC00000)
3992ab09b5b4SVasanthakumar Thiagarajan | (4 << 26);
3993*b3a663f0SWenli Looi REG_WRITE(ah, AR_PHY_PMU2(ah), reg_pmu_set);
3994*b3a663f0SWenli Looi if (!is_pmu_set(ah, AR_PHY_PMU2(ah), reg_pmu_set))
3995ab09b5b4SVasanthakumar Thiagarajan return;
3996ab09b5b4SVasanthakumar Thiagarajan
3997*b3a663f0SWenli Looi reg_pmu_set = (REG_READ(ah, AR_PHY_PMU2(ah)) & ~0x00200000)
3998ab09b5b4SVasanthakumar Thiagarajan | (1 << 21);
3999*b3a663f0SWenli Looi REG_WRITE(ah, AR_PHY_PMU2(ah), reg_pmu_set);
4000*b3a663f0SWenli Looi if (!is_pmu_set(ah, AR_PHY_PMU2(ah), reg_pmu_set))
4001ab09b5b4SVasanthakumar Thiagarajan return;
4002ede6a5e7SMiaoqing Pan } else if (AR_SREV_9462(ah) || AR_SREV_9565(ah) ||
4003ede6a5e7SMiaoqing Pan AR_SREV_9561(ah)) {
40040aefc591SFelix Fietkau reg_val = le32_to_cpu(pBase->swreg);
4005*b3a663f0SWenli Looi REG_WRITE(ah, AR_PHY_PMU1(ah), reg_val);
4006ede6a5e7SMiaoqing Pan
4007ede6a5e7SMiaoqing Pan if (AR_SREV_9561(ah))
4008*b3a663f0SWenli Looi REG_WRITE(ah, AR_PHY_PMU2(ah), 0x10200000);
4009ab09b5b4SVasanthakumar Thiagarajan } else {
401015c9ee7aSSenthil Balasubramanian /* Internal regulator is ON. Write swreg register. */
40110aefc591SFelix Fietkau reg_val = le32_to_cpu(pBase->swreg);
401215c9ee7aSSenthil Balasubramanian REG_WRITE(ah, AR_RTC_REG_CONTROL1,
401315c9ee7aSSenthil Balasubramanian REG_READ(ah, AR_RTC_REG_CONTROL1) &
401415c9ee7aSSenthil Balasubramanian (~AR_RTC_REG_CONTROL1_SWREG_PROGRAM));
40152577c6e8SSenthil Balasubramanian REG_WRITE(ah, AR_RTC_REG_CONTROL0, reg_val);
401615c9ee7aSSenthil Balasubramanian /* Set REG_CONTROL1.SWREG_PROGRAM */
401715c9ee7aSSenthil Balasubramanian REG_WRITE(ah, AR_RTC_REG_CONTROL1,
401815c9ee7aSSenthil Balasubramanian REG_READ(ah,
401915c9ee7aSSenthil Balasubramanian AR_RTC_REG_CONTROL1) |
402015c9ee7aSSenthil Balasubramanian AR_RTC_REG_CONTROL1_SWREG_PROGRAM);
4021ab09b5b4SVasanthakumar Thiagarajan }
402215c9ee7aSSenthil Balasubramanian } else {
40234187afa2SGabor Juhos if (AR_SREV_9330(ah) || AR_SREV_9485(ah)) {
4024*b3a663f0SWenli Looi REG_RMW_FIELD(ah, AR_PHY_PMU2(ah), AR_PHY_PMU2_PGM, 0);
4025*b3a663f0SWenli Looi while (REG_READ_FIELD(ah, AR_PHY_PMU2(ah),
4026ab09b5b4SVasanthakumar Thiagarajan AR_PHY_PMU2_PGM))
4027ab09b5b4SVasanthakumar Thiagarajan udelay(10);
4028ab09b5b4SVasanthakumar Thiagarajan
4029*b3a663f0SWenli Looi REG_RMW_FIELD(ah, AR_PHY_PMU1(ah), AR_PHY_PMU1_PWD, 0x1);
4030*b3a663f0SWenli Looi while (!REG_READ_FIELD(ah, AR_PHY_PMU1(ah),
4031ab09b5b4SVasanthakumar Thiagarajan AR_PHY_PMU1_PWD))
4032ab09b5b4SVasanthakumar Thiagarajan udelay(10);
4033*b3a663f0SWenli Looi REG_RMW_FIELD(ah, AR_PHY_PMU2(ah), AR_PHY_PMU2_PGM, 0x1);
4034*b3a663f0SWenli Looi while (!REG_READ_FIELD(ah, AR_PHY_PMU2(ah),
4035ab09b5b4SVasanthakumar Thiagarajan AR_PHY_PMU2_PGM))
4036ab09b5b4SVasanthakumar Thiagarajan udelay(10);
4037a4a2954fSSujith Manoharan } else if (AR_SREV_9462(ah) || AR_SREV_9565(ah))
4038*b3a663f0SWenli Looi REG_RMW_FIELD(ah, AR_PHY_PMU1(ah), AR_PHY_PMU1_PWD, 0x1);
40392577c6e8SSenthil Balasubramanian else {
4040*b3a663f0SWenli Looi reg_val = REG_READ(ah, AR_RTC_SLEEP_CLK(ah)) |
40412577c6e8SSenthil Balasubramanian AR_RTC_FORCE_SWREG_PRD;
4042*b3a663f0SWenli Looi REG_WRITE(ah, AR_RTC_SLEEP_CLK(ah), reg_val);
40432577c6e8SSenthil Balasubramanian }
404415c9ee7aSSenthil Balasubramanian }
4045ab09b5b4SVasanthakumar Thiagarajan
404615c9ee7aSSenthil Balasubramanian }
404715c9ee7aSSenthil Balasubramanian
ar9003_hw_apply_tuning_caps(struct ath_hw * ah)4048dd040f76SVasanthakumar Thiagarajan static void ar9003_hw_apply_tuning_caps(struct ath_hw *ah)
4049dd040f76SVasanthakumar Thiagarajan {
4050dd040f76SVasanthakumar Thiagarajan struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
4051dd040f76SVasanthakumar Thiagarajan u8 tuning_caps_param = eep->baseEepHeader.params_for_tuning_caps[0];
4052dd040f76SVasanthakumar Thiagarajan
40532c323058SSujith Manoharan if (AR_SREV_9340(ah) || AR_SREV_9531(ah))
405408a4a1abSFelix Fietkau return;
405508a4a1abSFelix Fietkau
4056dd040f76SVasanthakumar Thiagarajan if (eep->baseEepHeader.featureEnable & 0x40) {
4057dd040f76SVasanthakumar Thiagarajan tuning_caps_param &= 0x7f;
4058*b3a663f0SWenli Looi REG_RMW_FIELD(ah, AR_CH0_XTAL(ah), AR_CH0_XTAL_CAPINDAC,
4059dd040f76SVasanthakumar Thiagarajan tuning_caps_param);
4060*b3a663f0SWenli Looi REG_RMW_FIELD(ah, AR_CH0_XTAL(ah), AR_CH0_XTAL_CAPOUTDAC,
4061dd040f76SVasanthakumar Thiagarajan tuning_caps_param);
4062dd040f76SVasanthakumar Thiagarajan }
406315c9ee7aSSenthil Balasubramanian }
406415c9ee7aSSenthil Balasubramanian
ar9003_hw_quick_drop_apply(struct ath_hw * ah,u16 freq)4065df222edcSRajkumar Manoharan static void ar9003_hw_quick_drop_apply(struct ath_hw *ah, u16 freq)
4066df222edcSRajkumar Manoharan {
4067df222edcSRajkumar Manoharan struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
40680aefc591SFelix Fietkau struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader;
40690aefc591SFelix Fietkau int quick_drop;
4070df222edcSRajkumar Manoharan s32 t[3], f[3] = {5180, 5500, 5785};
4071df222edcSRajkumar Manoharan
407293c1cfbeSSujith Manoharan if (!(pBase->miscConfiguration & BIT(4)))
4073df222edcSRajkumar Manoharan return;
4074df222edcSRajkumar Manoharan
407593c1cfbeSSujith Manoharan if (AR_SREV_9300(ah) || AR_SREV_9580(ah) || AR_SREV_9340(ah)) {
407693c1cfbeSSujith Manoharan if (freq < 4000) {
4077df222edcSRajkumar Manoharan quick_drop = eep->modalHeader2G.quick_drop;
407893c1cfbeSSujith Manoharan } else {
4079df222edcSRajkumar Manoharan t[0] = eep->base_ext1.quick_drop_low;
4080df222edcSRajkumar Manoharan t[1] = eep->modalHeader5G.quick_drop;
4081df222edcSRajkumar Manoharan t[2] = eep->base_ext1.quick_drop_high;
4082df222edcSRajkumar Manoharan quick_drop = ar9003_hw_power_interpolate(freq, f, t, 3);
4083df222edcSRajkumar Manoharan }
4084df222edcSRajkumar Manoharan REG_RMW_FIELD(ah, AR_PHY_AGC, AR_PHY_AGC_QUICK_DROP, quick_drop);
4085df222edcSRajkumar Manoharan }
408693c1cfbeSSujith Manoharan }
4087df222edcSRajkumar Manoharan
ar9003_hw_txend_to_xpa_off_apply(struct ath_hw * ah,bool is2ghz)40880aefc591SFelix Fietkau static void ar9003_hw_txend_to_xpa_off_apply(struct ath_hw *ah, bool is2ghz)
4089202bff08SRajkumar Manoharan {
4090202bff08SRajkumar Manoharan u32 value;
4091202bff08SRajkumar Manoharan
40920aefc591SFelix Fietkau value = ar9003_modal_header(ah, is2ghz)->txEndToXpaOff;
4093202bff08SRajkumar Manoharan
4094202bff08SRajkumar Manoharan REG_RMW_FIELD(ah, AR_PHY_XPA_TIMING_CTL,
4095202bff08SRajkumar Manoharan AR_PHY_XPA_TIMING_CTL_TX_END_XPAB_OFF, value);
4096202bff08SRajkumar Manoharan REG_RMW_FIELD(ah, AR_PHY_XPA_TIMING_CTL,
4097202bff08SRajkumar Manoharan AR_PHY_XPA_TIMING_CTL_TX_END_XPAA_OFF, value);
4098202bff08SRajkumar Manoharan }
4099202bff08SRajkumar Manoharan
ar9003_hw_xpa_timing_control_apply(struct ath_hw * ah,bool is2ghz)41000aefc591SFelix Fietkau static void ar9003_hw_xpa_timing_control_apply(struct ath_hw *ah, bool is2ghz)
410189be49e1SFelix Fietkau {
410289be49e1SFelix Fietkau struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
410389be49e1SFelix Fietkau u8 xpa_ctl;
410489be49e1SFelix Fietkau
410589be49e1SFelix Fietkau if (!(eep->baseEepHeader.featureEnable & 0x80))
410689be49e1SFelix Fietkau return;
410789be49e1SFelix Fietkau
41082c323058SSujith Manoharan if (!AR_SREV_9300(ah) &&
41092c323058SSujith Manoharan !AR_SREV_9340(ah) &&
41102c323058SSujith Manoharan !AR_SREV_9580(ah) &&
4111ede6a5e7SMiaoqing Pan !AR_SREV_9531(ah) &&
4112ede6a5e7SMiaoqing Pan !AR_SREV_9561(ah))
411389be49e1SFelix Fietkau return;
411489be49e1SFelix Fietkau
41150aefc591SFelix Fietkau xpa_ctl = ar9003_modal_header(ah, is2ghz)->txFrameToXpaOn;
41160aefc591SFelix Fietkau if (is2ghz)
411789be49e1SFelix Fietkau REG_RMW_FIELD(ah, AR_PHY_XPA_TIMING_CTL,
411889be49e1SFelix Fietkau AR_PHY_XPA_TIMING_CTL_FRAME_XPAB_ON, xpa_ctl);
41190aefc591SFelix Fietkau else
412089be49e1SFelix Fietkau REG_RMW_FIELD(ah, AR_PHY_XPA_TIMING_CTL,
412189be49e1SFelix Fietkau AR_PHY_XPA_TIMING_CTL_FRAME_XPAA_ON, xpa_ctl);
412289be49e1SFelix Fietkau }
412389be49e1SFelix Fietkau
ar9003_hw_xlna_bias_strength_apply(struct ath_hw * ah,bool is2ghz)41243e2ea543SFelix Fietkau static void ar9003_hw_xlna_bias_strength_apply(struct ath_hw *ah, bool is2ghz)
41253e2ea543SFelix Fietkau {
41263e2ea543SFelix Fietkau struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
41273e2ea543SFelix Fietkau u8 bias;
41283e2ea543SFelix Fietkau
4129a1783a7bSSujith Manoharan if (!(eep->baseEepHeader.miscConfiguration & 0x40))
41303e2ea543SFelix Fietkau return;
41313e2ea543SFelix Fietkau
41323e2ea543SFelix Fietkau if (!AR_SREV_9300(ah))
41333e2ea543SFelix Fietkau return;
41343e2ea543SFelix Fietkau
41353e2ea543SFelix Fietkau bias = ar9003_modal_header(ah, is2ghz)->xlna_bias_strength;
41363e2ea543SFelix Fietkau REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_RXTX4, AR_PHY_65NM_RXTX4_XLNA_BIAS,
41373e2ea543SFelix Fietkau bias & 0x3);
41383e2ea543SFelix Fietkau bias >>= 2;
41393e2ea543SFelix Fietkau REG_RMW_FIELD(ah, AR_PHY_65NM_CH1_RXTX4, AR_PHY_65NM_RXTX4_XLNA_BIAS,
41403e2ea543SFelix Fietkau bias & 0x3);
41413e2ea543SFelix Fietkau bias >>= 2;
41423e2ea543SFelix Fietkau REG_RMW_FIELD(ah, AR_PHY_65NM_CH2_RXTX4, AR_PHY_65NM_RXTX4_XLNA_BIAS,
41433e2ea543SFelix Fietkau bias & 0x3);
41443e2ea543SFelix Fietkau }
41453e2ea543SFelix Fietkau
ar9003_hw_get_thermometer(struct ath_hw * ah)414602eba421SRajkumar Manoharan static int ar9003_hw_get_thermometer(struct ath_hw *ah)
414702eba421SRajkumar Manoharan {
414802eba421SRajkumar Manoharan struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
414902eba421SRajkumar Manoharan struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader;
415002eba421SRajkumar Manoharan int thermometer = (pBase->miscConfiguration >> 1) & 0x3;
415102eba421SRajkumar Manoharan
415202eba421SRajkumar Manoharan return --thermometer;
415302eba421SRajkumar Manoharan }
415402eba421SRajkumar Manoharan
ar9003_hw_thermometer_apply(struct ath_hw * ah)415502eba421SRajkumar Manoharan static void ar9003_hw_thermometer_apply(struct ath_hw *ah)
415602eba421SRajkumar Manoharan {
415789b6e35cSSujith Manoharan struct ath9k_hw_capabilities *pCap = &ah->caps;
415802eba421SRajkumar Manoharan int thermometer = ar9003_hw_get_thermometer(ah);
415902eba421SRajkumar Manoharan u8 therm_on = (thermometer < 0) ? 0 : 1;
416002eba421SRajkumar Manoharan
416102eba421SRajkumar Manoharan REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_RXTX4,
416202eba421SRajkumar Manoharan AR_PHY_65NM_CH0_RXTX4_THERM_ON_OVR, therm_on);
416389b6e35cSSujith Manoharan if (pCap->chip_chainmask & BIT(1))
416402eba421SRajkumar Manoharan REG_RMW_FIELD(ah, AR_PHY_65NM_CH1_RXTX4,
416502eba421SRajkumar Manoharan AR_PHY_65NM_CH0_RXTX4_THERM_ON_OVR, therm_on);
416689b6e35cSSujith Manoharan if (pCap->chip_chainmask & BIT(2))
416702eba421SRajkumar Manoharan REG_RMW_FIELD(ah, AR_PHY_65NM_CH2_RXTX4,
416802eba421SRajkumar Manoharan AR_PHY_65NM_CH0_RXTX4_THERM_ON_OVR, therm_on);
416902eba421SRajkumar Manoharan
41700fef3c76SIvan Safonov therm_on = thermometer == 0;
417102eba421SRajkumar Manoharan REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_RXTX4,
417202eba421SRajkumar Manoharan AR_PHY_65NM_CH0_RXTX4_THERM_ON, therm_on);
417389b6e35cSSujith Manoharan if (pCap->chip_chainmask & BIT(1)) {
41740fef3c76SIvan Safonov therm_on = thermometer == 1;
417502eba421SRajkumar Manoharan REG_RMW_FIELD(ah, AR_PHY_65NM_CH1_RXTX4,
417602eba421SRajkumar Manoharan AR_PHY_65NM_CH0_RXTX4_THERM_ON, therm_on);
417702eba421SRajkumar Manoharan }
417889b6e35cSSujith Manoharan if (pCap->chip_chainmask & BIT(2)) {
41790fef3c76SIvan Safonov therm_on = thermometer == 2;
418002eba421SRajkumar Manoharan REG_RMW_FIELD(ah, AR_PHY_65NM_CH2_RXTX4,
418102eba421SRajkumar Manoharan AR_PHY_65NM_CH0_RXTX4_THERM_ON, therm_on);
418202eba421SRajkumar Manoharan }
418302eba421SRajkumar Manoharan }
418402eba421SRajkumar Manoharan
ar9003_hw_thermo_cal_apply(struct ath_hw * ah)418580fe43f2SRajkumar Manoharan static void ar9003_hw_thermo_cal_apply(struct ath_hw *ah)
418680fe43f2SRajkumar Manoharan {
418780e84f36SDenis Efremov u32 data = 0, ko, kg;
418880fe43f2SRajkumar Manoharan
41892b5e54e2SSujith Manoharan if (!AR_SREV_9462_20_OR_LATER(ah))
419080fe43f2SRajkumar Manoharan return;
41912b5e54e2SSujith Manoharan
419280fe43f2SRajkumar Manoharan ar9300_otp_read_word(ah, 1, &data);
419380fe43f2SRajkumar Manoharan ko = data & 0xff;
419480fe43f2SRajkumar Manoharan kg = (data >> 8) & 0xff;
419580fe43f2SRajkumar Manoharan if (ko || kg) {
419680fe43f2SRajkumar Manoharan REG_RMW_FIELD(ah, AR_PHY_BB_THERM_ADC_3,
419780fe43f2SRajkumar Manoharan AR_PHY_BB_THERM_ADC_3_THERM_ADC_OFFSET, ko);
419880fe43f2SRajkumar Manoharan REG_RMW_FIELD(ah, AR_PHY_BB_THERM_ADC_3,
419980fe43f2SRajkumar Manoharan AR_PHY_BB_THERM_ADC_3_THERM_ADC_SCALE_GAIN,
420080fe43f2SRajkumar Manoharan kg + 256);
420180fe43f2SRajkumar Manoharan }
420280fe43f2SRajkumar Manoharan }
420380fe43f2SRajkumar Manoharan
ar9003_hw_apply_minccapwr_thresh(struct ath_hw * ah,bool is2ghz)42043533bf6bSSujith Manoharan static void ar9003_hw_apply_minccapwr_thresh(struct ath_hw *ah,
42053533bf6bSSujith Manoharan bool is2ghz)
42063533bf6bSSujith Manoharan {
42073533bf6bSSujith Manoharan struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
42083533bf6bSSujith Manoharan const u_int32_t cca_ctrl[AR9300_MAX_CHAINS] = {
42093533bf6bSSujith Manoharan AR_PHY_CCA_CTRL_0,
42103533bf6bSSujith Manoharan AR_PHY_CCA_CTRL_1,
42113533bf6bSSujith Manoharan AR_PHY_CCA_CTRL_2,
42123533bf6bSSujith Manoharan };
42133533bf6bSSujith Manoharan int chain;
42143533bf6bSSujith Manoharan u32 val;
42153533bf6bSSujith Manoharan
42163533bf6bSSujith Manoharan if (is2ghz) {
42173533bf6bSSujith Manoharan if (!(eep->base_ext1.misc_enable & BIT(2)))
42183533bf6bSSujith Manoharan return;
42193533bf6bSSujith Manoharan } else {
42203533bf6bSSujith Manoharan if (!(eep->base_ext1.misc_enable & BIT(3)))
42213533bf6bSSujith Manoharan return;
42223533bf6bSSujith Manoharan }
42233533bf6bSSujith Manoharan
42243533bf6bSSujith Manoharan for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) {
42253533bf6bSSujith Manoharan if (!(ah->caps.tx_chainmask & BIT(chain)))
42263533bf6bSSujith Manoharan continue;
42273533bf6bSSujith Manoharan
42283533bf6bSSujith Manoharan val = ar9003_modal_header(ah, is2ghz)->noiseFloorThreshCh[chain];
42293533bf6bSSujith Manoharan REG_RMW_FIELD(ah, cca_ctrl[chain],
42303533bf6bSSujith Manoharan AR_PHY_EXT_CCA0_THRESH62_1, val);
42313533bf6bSSujith Manoharan }
42323533bf6bSSujith Manoharan
42333533bf6bSSujith Manoharan }
42343533bf6bSSujith Manoharan
ath9k_hw_ar9300_set_board_values(struct ath_hw * ah,struct ath9k_channel * chan)423515c9ee7aSSenthil Balasubramanian static void ath9k_hw_ar9300_set_board_values(struct ath_hw *ah,
423615c9ee7aSSenthil Balasubramanian struct ath9k_channel *chan)
423715c9ee7aSSenthil Balasubramanian {
42380aefc591SFelix Fietkau bool is2ghz = IS_CHAN_2GHZ(chan);
42390aefc591SFelix Fietkau ar9003_hw_xpa_timing_control_apply(ah, is2ghz);
42400aefc591SFelix Fietkau ar9003_hw_xpa_bias_level_apply(ah, is2ghz);
42410aefc591SFelix Fietkau ar9003_hw_ant_ctrl_apply(ah, is2ghz);
424215c9ee7aSSenthil Balasubramanian ar9003_hw_drive_strength_apply(ah);
42433e2ea543SFelix Fietkau ar9003_hw_xlna_bias_strength_apply(ah, is2ghz);
4244f4475a6eSVasanthakumar Thiagarajan ar9003_hw_atten_apply(ah, chan);
4245df222edcSRajkumar Manoharan ar9003_hw_quick_drop_apply(ah, chan->channel);
42462c323058SSujith Manoharan if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah) && !AR_SREV_9531(ah))
424715c9ee7aSSenthil Balasubramanian ar9003_hw_internal_regulator_apply(ah);
4248dd040f76SVasanthakumar Thiagarajan ar9003_hw_apply_tuning_caps(ah);
4249aaab50fcSSven Eckelmann ar9003_hw_apply_minccapwr_thresh(ah, is2ghz);
42500aefc591SFelix Fietkau ar9003_hw_txend_to_xpa_off_apply(ah, is2ghz);
425102eba421SRajkumar Manoharan ar9003_hw_thermometer_apply(ah);
425280fe43f2SRajkumar Manoharan ar9003_hw_thermo_cal_apply(ah);
425315c9ee7aSSenthil Balasubramanian }
425415c9ee7aSSenthil Balasubramanian
ath9k_hw_ar9300_set_addac(struct ath_hw * ah,struct ath9k_channel * chan)425515c9ee7aSSenthil Balasubramanian static void ath9k_hw_ar9300_set_addac(struct ath_hw *ah,
425615c9ee7aSSenthil Balasubramanian struct ath9k_channel *chan)
425715c9ee7aSSenthil Balasubramanian {
425815c9ee7aSSenthil Balasubramanian }
425915c9ee7aSSenthil Balasubramanian
426015c9ee7aSSenthil Balasubramanian /*
426115c9ee7aSSenthil Balasubramanian * Returns the interpolated y value corresponding to the specified x value
426215c9ee7aSSenthil Balasubramanian * from the np ordered pairs of data (px,py).
426315c9ee7aSSenthil Balasubramanian * The pairs do not have to be in any order.
426415c9ee7aSSenthil Balasubramanian * If the specified x value is less than any of the px,
426515c9ee7aSSenthil Balasubramanian * the returned y value is equal to the py for the lowest px.
426615c9ee7aSSenthil Balasubramanian * If the specified x value is greater than any of the px,
426715c9ee7aSSenthil Balasubramanian * the returned y value is equal to the py for the highest px.
426815c9ee7aSSenthil Balasubramanian */
ar9003_hw_power_interpolate(int32_t x,int32_t * px,int32_t * py,u_int16_t np)426915c9ee7aSSenthil Balasubramanian static int ar9003_hw_power_interpolate(int32_t x,
427015c9ee7aSSenthil Balasubramanian int32_t *px, int32_t *py, u_int16_t np)
427115c9ee7aSSenthil Balasubramanian {
427215c9ee7aSSenthil Balasubramanian int ip = 0;
427315c9ee7aSSenthil Balasubramanian int lx = 0, ly = 0, lhave = 0;
427415c9ee7aSSenthil Balasubramanian int hx = 0, hy = 0, hhave = 0;
427515c9ee7aSSenthil Balasubramanian int dx = 0;
427615c9ee7aSSenthil Balasubramanian int y = 0;
427715c9ee7aSSenthil Balasubramanian
427815c9ee7aSSenthil Balasubramanian lhave = 0;
427915c9ee7aSSenthil Balasubramanian hhave = 0;
428015c9ee7aSSenthil Balasubramanian
428115c9ee7aSSenthil Balasubramanian /* identify best lower and higher x calibration measurement */
428215c9ee7aSSenthil Balasubramanian for (ip = 0; ip < np; ip++) {
428315c9ee7aSSenthil Balasubramanian dx = x - px[ip];
428415c9ee7aSSenthil Balasubramanian
428515c9ee7aSSenthil Balasubramanian /* this measurement is higher than our desired x */
428615c9ee7aSSenthil Balasubramanian if (dx <= 0) {
428715c9ee7aSSenthil Balasubramanian if (!hhave || dx > (x - hx)) {
428815c9ee7aSSenthil Balasubramanian /* new best higher x measurement */
428915c9ee7aSSenthil Balasubramanian hx = px[ip];
429015c9ee7aSSenthil Balasubramanian hy = py[ip];
429115c9ee7aSSenthil Balasubramanian hhave = 1;
429215c9ee7aSSenthil Balasubramanian }
429315c9ee7aSSenthil Balasubramanian }
429415c9ee7aSSenthil Balasubramanian /* this measurement is lower than our desired x */
429515c9ee7aSSenthil Balasubramanian if (dx >= 0) {
429615c9ee7aSSenthil Balasubramanian if (!lhave || dx < (x - lx)) {
429715c9ee7aSSenthil Balasubramanian /* new best lower x measurement */
429815c9ee7aSSenthil Balasubramanian lx = px[ip];
429915c9ee7aSSenthil Balasubramanian ly = py[ip];
430015c9ee7aSSenthil Balasubramanian lhave = 1;
430115c9ee7aSSenthil Balasubramanian }
430215c9ee7aSSenthil Balasubramanian }
430315c9ee7aSSenthil Balasubramanian }
430415c9ee7aSSenthil Balasubramanian
430515c9ee7aSSenthil Balasubramanian /* the low x is good */
430615c9ee7aSSenthil Balasubramanian if (lhave) {
430715c9ee7aSSenthil Balasubramanian /* so is the high x */
430815c9ee7aSSenthil Balasubramanian if (hhave) {
430915c9ee7aSSenthil Balasubramanian /* they're the same, so just pick one */
431015c9ee7aSSenthil Balasubramanian if (hx == lx)
431115c9ee7aSSenthil Balasubramanian y = ly;
431215c9ee7aSSenthil Balasubramanian else /* interpolate */
4313bc206802SVasanthakumar Thiagarajan y = interpolate(x, lx, hx, ly, hy);
431415c9ee7aSSenthil Balasubramanian } else /* only low is good, use it */
431515c9ee7aSSenthil Balasubramanian y = ly;
431615c9ee7aSSenthil Balasubramanian } else if (hhave) /* only high is good, use it */
431715c9ee7aSSenthil Balasubramanian y = hy;
431815c9ee7aSSenthil Balasubramanian else /* nothing is good,this should never happen unless np=0, ???? */
431915c9ee7aSSenthil Balasubramanian y = -(1 << 30);
432015c9ee7aSSenthil Balasubramanian return y;
432115c9ee7aSSenthil Balasubramanian }
432215c9ee7aSSenthil Balasubramanian
ar9003_hw_eeprom_get_tgt_pwr(struct ath_hw * ah,u16 rateIndex,u16 freq,bool is2GHz)432315c9ee7aSSenthil Balasubramanian static u8 ar9003_hw_eeprom_get_tgt_pwr(struct ath_hw *ah,
432415c9ee7aSSenthil Balasubramanian u16 rateIndex, u16 freq, bool is2GHz)
432515c9ee7aSSenthil Balasubramanian {
432615c9ee7aSSenthil Balasubramanian u16 numPiers, i;
432715c9ee7aSSenthil Balasubramanian s32 targetPowerArray[AR9300_NUM_5G_20_TARGET_POWERS];
432815c9ee7aSSenthil Balasubramanian s32 freqArray[AR9300_NUM_5G_20_TARGET_POWERS];
432915c9ee7aSSenthil Balasubramanian struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
433015c9ee7aSSenthil Balasubramanian struct cal_tgt_pow_legacy *pEepromTargetPwr;
433115c9ee7aSSenthil Balasubramanian u8 *pFreqBin;
433215c9ee7aSSenthil Balasubramanian
433315c9ee7aSSenthil Balasubramanian if (is2GHz) {
4334d10baf99SFelix Fietkau numPiers = AR9300_NUM_2G_20_TARGET_POWERS;
433515c9ee7aSSenthil Balasubramanian pEepromTargetPwr = eep->calTargetPower2G;
433615c9ee7aSSenthil Balasubramanian pFreqBin = eep->calTarget_freqbin_2G;
433715c9ee7aSSenthil Balasubramanian } else {
433815c9ee7aSSenthil Balasubramanian numPiers = AR9300_NUM_5G_20_TARGET_POWERS;
433915c9ee7aSSenthil Balasubramanian pEepromTargetPwr = eep->calTargetPower5G;
434015c9ee7aSSenthil Balasubramanian pFreqBin = eep->calTarget_freqbin_5G;
434115c9ee7aSSenthil Balasubramanian }
434215c9ee7aSSenthil Balasubramanian
434315c9ee7aSSenthil Balasubramanian /*
434415c9ee7aSSenthil Balasubramanian * create array of channels and targetpower from
434515c9ee7aSSenthil Balasubramanian * targetpower piers stored on eeprom
434615c9ee7aSSenthil Balasubramanian */
434715c9ee7aSSenthil Balasubramanian for (i = 0; i < numPiers; i++) {
43488edb254cSGabor Juhos freqArray[i] = ath9k_hw_fbin2freq(pFreqBin[i], is2GHz);
434915c9ee7aSSenthil Balasubramanian targetPowerArray[i] = pEepromTargetPwr[i].tPow2x[rateIndex];
435015c9ee7aSSenthil Balasubramanian }
435115c9ee7aSSenthil Balasubramanian
435215c9ee7aSSenthil Balasubramanian /* interpolate to get target power for given frequency */
435315c9ee7aSSenthil Balasubramanian return (u8) ar9003_hw_power_interpolate((s32) freq,
435415c9ee7aSSenthil Balasubramanian freqArray,
435515c9ee7aSSenthil Balasubramanian targetPowerArray, numPiers);
435615c9ee7aSSenthil Balasubramanian }
435715c9ee7aSSenthil Balasubramanian
ar9003_hw_eeprom_get_ht20_tgt_pwr(struct ath_hw * ah,u16 rateIndex,u16 freq,bool is2GHz)435815c9ee7aSSenthil Balasubramanian static u8 ar9003_hw_eeprom_get_ht20_tgt_pwr(struct ath_hw *ah,
435915c9ee7aSSenthil Balasubramanian u16 rateIndex,
436015c9ee7aSSenthil Balasubramanian u16 freq, bool is2GHz)
436115c9ee7aSSenthil Balasubramanian {
436215c9ee7aSSenthil Balasubramanian u16 numPiers, i;
436315c9ee7aSSenthil Balasubramanian s32 targetPowerArray[AR9300_NUM_5G_20_TARGET_POWERS];
436415c9ee7aSSenthil Balasubramanian s32 freqArray[AR9300_NUM_5G_20_TARGET_POWERS];
436515c9ee7aSSenthil Balasubramanian struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
436615c9ee7aSSenthil Balasubramanian struct cal_tgt_pow_ht *pEepromTargetPwr;
436715c9ee7aSSenthil Balasubramanian u8 *pFreqBin;
436815c9ee7aSSenthil Balasubramanian
436915c9ee7aSSenthil Balasubramanian if (is2GHz) {
4370d10baf99SFelix Fietkau numPiers = AR9300_NUM_2G_20_TARGET_POWERS;
437115c9ee7aSSenthil Balasubramanian pEepromTargetPwr = eep->calTargetPower2GHT20;
437215c9ee7aSSenthil Balasubramanian pFreqBin = eep->calTarget_freqbin_2GHT20;
437315c9ee7aSSenthil Balasubramanian } else {
437415c9ee7aSSenthil Balasubramanian numPiers = AR9300_NUM_5G_20_TARGET_POWERS;
437515c9ee7aSSenthil Balasubramanian pEepromTargetPwr = eep->calTargetPower5GHT20;
437615c9ee7aSSenthil Balasubramanian pFreqBin = eep->calTarget_freqbin_5GHT20;
437715c9ee7aSSenthil Balasubramanian }
437815c9ee7aSSenthil Balasubramanian
437915c9ee7aSSenthil Balasubramanian /*
438015c9ee7aSSenthil Balasubramanian * create array of channels and targetpower
438115c9ee7aSSenthil Balasubramanian * from targetpower piers stored on eeprom
438215c9ee7aSSenthil Balasubramanian */
438315c9ee7aSSenthil Balasubramanian for (i = 0; i < numPiers; i++) {
43848edb254cSGabor Juhos freqArray[i] = ath9k_hw_fbin2freq(pFreqBin[i], is2GHz);
438515c9ee7aSSenthil Balasubramanian targetPowerArray[i] = pEepromTargetPwr[i].tPow2x[rateIndex];
438615c9ee7aSSenthil Balasubramanian }
438715c9ee7aSSenthil Balasubramanian
438815c9ee7aSSenthil Balasubramanian /* interpolate to get target power for given frequency */
438915c9ee7aSSenthil Balasubramanian return (u8) ar9003_hw_power_interpolate((s32) freq,
439015c9ee7aSSenthil Balasubramanian freqArray,
439115c9ee7aSSenthil Balasubramanian targetPowerArray, numPiers);
439215c9ee7aSSenthil Balasubramanian }
439315c9ee7aSSenthil Balasubramanian
ar9003_hw_eeprom_get_ht40_tgt_pwr(struct ath_hw * ah,u16 rateIndex,u16 freq,bool is2GHz)439415c9ee7aSSenthil Balasubramanian static u8 ar9003_hw_eeprom_get_ht40_tgt_pwr(struct ath_hw *ah,
439515c9ee7aSSenthil Balasubramanian u16 rateIndex,
439615c9ee7aSSenthil Balasubramanian u16 freq, bool is2GHz)
439715c9ee7aSSenthil Balasubramanian {
439815c9ee7aSSenthil Balasubramanian u16 numPiers, i;
439915c9ee7aSSenthil Balasubramanian s32 targetPowerArray[AR9300_NUM_5G_40_TARGET_POWERS];
440015c9ee7aSSenthil Balasubramanian s32 freqArray[AR9300_NUM_5G_40_TARGET_POWERS];
440115c9ee7aSSenthil Balasubramanian struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
440215c9ee7aSSenthil Balasubramanian struct cal_tgt_pow_ht *pEepromTargetPwr;
440315c9ee7aSSenthil Balasubramanian u8 *pFreqBin;
440415c9ee7aSSenthil Balasubramanian
440515c9ee7aSSenthil Balasubramanian if (is2GHz) {
440615c9ee7aSSenthil Balasubramanian numPiers = AR9300_NUM_2G_40_TARGET_POWERS;
440715c9ee7aSSenthil Balasubramanian pEepromTargetPwr = eep->calTargetPower2GHT40;
440815c9ee7aSSenthil Balasubramanian pFreqBin = eep->calTarget_freqbin_2GHT40;
440915c9ee7aSSenthil Balasubramanian } else {
441015c9ee7aSSenthil Balasubramanian numPiers = AR9300_NUM_5G_40_TARGET_POWERS;
441115c9ee7aSSenthil Balasubramanian pEepromTargetPwr = eep->calTargetPower5GHT40;
441215c9ee7aSSenthil Balasubramanian pFreqBin = eep->calTarget_freqbin_5GHT40;
441315c9ee7aSSenthil Balasubramanian }
441415c9ee7aSSenthil Balasubramanian
441515c9ee7aSSenthil Balasubramanian /*
441615c9ee7aSSenthil Balasubramanian * create array of channels and targetpower from
441715c9ee7aSSenthil Balasubramanian * targetpower piers stored on eeprom
441815c9ee7aSSenthil Balasubramanian */
441915c9ee7aSSenthil Balasubramanian for (i = 0; i < numPiers; i++) {
44208edb254cSGabor Juhos freqArray[i] = ath9k_hw_fbin2freq(pFreqBin[i], is2GHz);
442115c9ee7aSSenthil Balasubramanian targetPowerArray[i] = pEepromTargetPwr[i].tPow2x[rateIndex];
442215c9ee7aSSenthil Balasubramanian }
442315c9ee7aSSenthil Balasubramanian
442415c9ee7aSSenthil Balasubramanian /* interpolate to get target power for given frequency */
442515c9ee7aSSenthil Balasubramanian return (u8) ar9003_hw_power_interpolate((s32) freq,
442615c9ee7aSSenthil Balasubramanian freqArray,
442715c9ee7aSSenthil Balasubramanian targetPowerArray, numPiers);
442815c9ee7aSSenthil Balasubramanian }
442915c9ee7aSSenthil Balasubramanian
ar9003_hw_eeprom_get_cck_tgt_pwr(struct ath_hw * ah,u16 rateIndex,u16 freq)443015c9ee7aSSenthil Balasubramanian static u8 ar9003_hw_eeprom_get_cck_tgt_pwr(struct ath_hw *ah,
443115c9ee7aSSenthil Balasubramanian u16 rateIndex, u16 freq)
443215c9ee7aSSenthil Balasubramanian {
443315c9ee7aSSenthil Balasubramanian u16 numPiers = AR9300_NUM_2G_CCK_TARGET_POWERS, i;
443415c9ee7aSSenthil Balasubramanian s32 targetPowerArray[AR9300_NUM_2G_CCK_TARGET_POWERS];
443515c9ee7aSSenthil Balasubramanian s32 freqArray[AR9300_NUM_2G_CCK_TARGET_POWERS];
443615c9ee7aSSenthil Balasubramanian struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
443715c9ee7aSSenthil Balasubramanian struct cal_tgt_pow_legacy *pEepromTargetPwr = eep->calTargetPowerCck;
443815c9ee7aSSenthil Balasubramanian u8 *pFreqBin = eep->calTarget_freqbin_Cck;
443915c9ee7aSSenthil Balasubramanian
444015c9ee7aSSenthil Balasubramanian /*
444115c9ee7aSSenthil Balasubramanian * create array of channels and targetpower from
444215c9ee7aSSenthil Balasubramanian * targetpower piers stored on eeprom
444315c9ee7aSSenthil Balasubramanian */
444415c9ee7aSSenthil Balasubramanian for (i = 0; i < numPiers; i++) {
44458edb254cSGabor Juhos freqArray[i] = ath9k_hw_fbin2freq(pFreqBin[i], 1);
444615c9ee7aSSenthil Balasubramanian targetPowerArray[i] = pEepromTargetPwr[i].tPow2x[rateIndex];
444715c9ee7aSSenthil Balasubramanian }
444815c9ee7aSSenthil Balasubramanian
444915c9ee7aSSenthil Balasubramanian /* interpolate to get target power for given frequency */
445015c9ee7aSSenthil Balasubramanian return (u8) ar9003_hw_power_interpolate((s32) freq,
445115c9ee7aSSenthil Balasubramanian freqArray,
445215c9ee7aSSenthil Balasubramanian targetPowerArray, numPiers);
445315c9ee7aSSenthil Balasubramanian }
445415c9ee7aSSenthil Balasubramanian
ar9003_hw_selfgen_tpc_txpower(struct ath_hw * ah,struct ath9k_channel * chan,u8 * pwr_array)445523f53dd3SLorenzo Bianconi static void ar9003_hw_selfgen_tpc_txpower(struct ath_hw *ah,
445623f53dd3SLorenzo Bianconi struct ath9k_channel *chan,
445723f53dd3SLorenzo Bianconi u8 *pwr_array)
445823f53dd3SLorenzo Bianconi {
445923f53dd3SLorenzo Bianconi u32 val;
446023f53dd3SLorenzo Bianconi
446123f53dd3SLorenzo Bianconi /* target power values for self generated frames (ACK,RTS/CTS) */
446223f53dd3SLorenzo Bianconi if (IS_CHAN_2GHZ(chan)) {
446323f53dd3SLorenzo Bianconi val = SM(pwr_array[ALL_TARGET_LEGACY_1L_5L], AR_TPC_ACK) |
446423f53dd3SLorenzo Bianconi SM(pwr_array[ALL_TARGET_LEGACY_1L_5L], AR_TPC_CTS) |
446523f53dd3SLorenzo Bianconi SM(0x3f, AR_TPC_CHIRP) | SM(0x3f, AR_TPC_RPT);
446623f53dd3SLorenzo Bianconi } else {
446723f53dd3SLorenzo Bianconi val = SM(pwr_array[ALL_TARGET_LEGACY_6_24], AR_TPC_ACK) |
446823f53dd3SLorenzo Bianconi SM(pwr_array[ALL_TARGET_LEGACY_6_24], AR_TPC_CTS) |
446923f53dd3SLorenzo Bianconi SM(0x3f, AR_TPC_CHIRP) | SM(0x3f, AR_TPC_RPT);
447023f53dd3SLorenzo Bianconi }
447123f53dd3SLorenzo Bianconi REG_WRITE(ah, AR_TPC, val);
447223f53dd3SLorenzo Bianconi }
447323f53dd3SLorenzo Bianconi
447415c9ee7aSSenthil Balasubramanian /* Set tx power registers to array of values passed in */
ar9003_hw_tx_power_regwrite(struct ath_hw * ah,u8 * pPwrArray)44758569f591SHelmut Schaa int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray)
447615c9ee7aSSenthil Balasubramanian {
447715c9ee7aSSenthil Balasubramanian #define POW_SM(_r, _s) (((_r) & 0x3f) << (_s))
447815c9ee7aSSenthil Balasubramanian /* make sure forced gain is not set */
44794a4fdf2eSFelix Fietkau REG_WRITE(ah, AR_PHY_TX_FORCED_GAIN, 0);
448015c9ee7aSSenthil Balasubramanian
448115c9ee7aSSenthil Balasubramanian /* Write the OFDM power per rate set */
448215c9ee7aSSenthil Balasubramanian
448315c9ee7aSSenthil Balasubramanian /* 6 (LSB), 9, 12, 18 (MSB) */
44844a4fdf2eSFelix Fietkau REG_WRITE(ah, AR_PHY_POWER_TX_RATE(0),
448515c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 24) |
448615c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 16) |
448715c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 8) |
448815c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 0));
448915c9ee7aSSenthil Balasubramanian
449015c9ee7aSSenthil Balasubramanian /* 24 (LSB), 36, 48, 54 (MSB) */
44914a4fdf2eSFelix Fietkau REG_WRITE(ah, AR_PHY_POWER_TX_RATE(1),
449215c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_LEGACY_54], 24) |
449315c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_LEGACY_48], 16) |
449415c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_LEGACY_36], 8) |
449515c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 0));
449615c9ee7aSSenthil Balasubramanian
449715c9ee7aSSenthil Balasubramanian /* Write the CCK power per rate set */
449815c9ee7aSSenthil Balasubramanian
449915c9ee7aSSenthil Balasubramanian /* 1L (LSB), reserved, 2L, 2S (MSB) */
45004a4fdf2eSFelix Fietkau REG_WRITE(ah, AR_PHY_POWER_TX_RATE(2),
450115c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 24) |
450215c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 16) |
450315c9ee7aSSenthil Balasubramanian /* POW_SM(txPowerTimes2, 8) | this is reserved for AR9003 */
450415c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 0));
450515c9ee7aSSenthil Balasubramanian
450615c9ee7aSSenthil Balasubramanian /* 5.5L (LSB), 5.5S, 11L, 11S (MSB) */
45074a4fdf2eSFelix Fietkau REG_WRITE(ah, AR_PHY_POWER_TX_RATE(3),
450815c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_LEGACY_11S], 24) |
450915c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_LEGACY_11L], 16) |
451015c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_LEGACY_5S], 8) |
451115c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 0)
451215c9ee7aSSenthil Balasubramanian );
451315c9ee7aSSenthil Balasubramanian
4514cf3a03b9SLuis R. Rodriguez /* Write the power for duplicated frames - HT40 */
4515cf3a03b9SLuis R. Rodriguez
4516cf3a03b9SLuis R. Rodriguez /* dup40_cck (LSB), dup40_ofdm, ext20_cck, ext20_ofdm (MSB) */
45178d7763b4SAlex Hacker REG_WRITE(ah, AR_PHY_POWER_TX_RATE(8),
4518cf3a03b9SLuis R. Rodriguez POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 24) |
4519cf3a03b9SLuis R. Rodriguez POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 16) |
4520cf3a03b9SLuis R. Rodriguez POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 8) |
4521cf3a03b9SLuis R. Rodriguez POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 0)
4522cf3a03b9SLuis R. Rodriguez );
4523cf3a03b9SLuis R. Rodriguez
452415c9ee7aSSenthil Balasubramanian /* Write the HT20 power per rate set */
452515c9ee7aSSenthil Balasubramanian
452615c9ee7aSSenthil Balasubramanian /* 0/8/16 (LSB), 1-3/9-11/17-19, 4, 5 (MSB) */
45274a4fdf2eSFelix Fietkau REG_WRITE(ah, AR_PHY_POWER_TX_RATE(4),
452815c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT20_5], 24) |
452915c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT20_4], 16) |
453015c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT20_1_3_9_11_17_19], 8) |
453115c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT20_0_8_16], 0)
453215c9ee7aSSenthil Balasubramanian );
453315c9ee7aSSenthil Balasubramanian
453415c9ee7aSSenthil Balasubramanian /* 6 (LSB), 7, 12, 13 (MSB) */
45354a4fdf2eSFelix Fietkau REG_WRITE(ah, AR_PHY_POWER_TX_RATE(5),
453615c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT20_13], 24) |
453715c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT20_12], 16) |
453815c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT20_7], 8) |
453915c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT20_6], 0)
454015c9ee7aSSenthil Balasubramanian );
454115c9ee7aSSenthil Balasubramanian
454215c9ee7aSSenthil Balasubramanian /* 14 (LSB), 15, 20, 21 */
45434a4fdf2eSFelix Fietkau REG_WRITE(ah, AR_PHY_POWER_TX_RATE(9),
454415c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT20_21], 24) |
454515c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT20_20], 16) |
454615c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT20_15], 8) |
454715c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT20_14], 0)
454815c9ee7aSSenthil Balasubramanian );
454915c9ee7aSSenthil Balasubramanian
455015c9ee7aSSenthil Balasubramanian /* Mixed HT20 and HT40 rates */
455115c9ee7aSSenthil Balasubramanian
455215c9ee7aSSenthil Balasubramanian /* HT20 22 (LSB), HT20 23, HT40 22, HT40 23 (MSB) */
45534a4fdf2eSFelix Fietkau REG_WRITE(ah, AR_PHY_POWER_TX_RATE(10),
455415c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT40_23], 24) |
455515c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT40_22], 16) |
455615c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT20_23], 8) |
455715c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT20_22], 0)
455815c9ee7aSSenthil Balasubramanian );
455915c9ee7aSSenthil Balasubramanian
456015c9ee7aSSenthil Balasubramanian /*
456115c9ee7aSSenthil Balasubramanian * Write the HT40 power per rate set
456215c9ee7aSSenthil Balasubramanian * correct PAR difference between HT40 and HT20/LEGACY
456315c9ee7aSSenthil Balasubramanian * 0/8/16 (LSB), 1-3/9-11/17-19, 4, 5 (MSB)
456415c9ee7aSSenthil Balasubramanian */
45654a4fdf2eSFelix Fietkau REG_WRITE(ah, AR_PHY_POWER_TX_RATE(6),
456615c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT40_5], 24) |
456715c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT40_4], 16) |
456815c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT40_1_3_9_11_17_19], 8) |
456915c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT40_0_8_16], 0)
457015c9ee7aSSenthil Balasubramanian );
457115c9ee7aSSenthil Balasubramanian
457215c9ee7aSSenthil Balasubramanian /* 6 (LSB), 7, 12, 13 (MSB) */
45734a4fdf2eSFelix Fietkau REG_WRITE(ah, AR_PHY_POWER_TX_RATE(7),
457415c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT40_13], 24) |
457515c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT40_12], 16) |
457615c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT40_7], 8) |
457715c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT40_6], 0)
457815c9ee7aSSenthil Balasubramanian );
457915c9ee7aSSenthil Balasubramanian
458015c9ee7aSSenthil Balasubramanian /* 14 (LSB), 15, 20, 21 */
45814a4fdf2eSFelix Fietkau REG_WRITE(ah, AR_PHY_POWER_TX_RATE(11),
458215c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT40_21], 24) |
458315c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT40_20], 16) |
458415c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT40_15], 8) |
458515c9ee7aSSenthil Balasubramanian POW_SM(pPwrArray[ALL_TARGET_HT40_14], 0)
458615c9ee7aSSenthil Balasubramanian );
458715c9ee7aSSenthil Balasubramanian
458815c9ee7aSSenthil Balasubramanian return 0;
458915c9ee7aSSenthil Balasubramanian #undef POW_SM
459015c9ee7aSSenthil Balasubramanian }
459115c9ee7aSSenthil Balasubramanian
ar9003_hw_get_legacy_target_powers(struct ath_hw * ah,u16 freq,u8 * targetPowerValT2,bool is2GHz)459275acd5a8SGabor Juhos static void ar9003_hw_get_legacy_target_powers(struct ath_hw *ah, u16 freq,
459375acd5a8SGabor Juhos u8 *targetPowerValT2,
459475acd5a8SGabor Juhos bool is2GHz)
459515c9ee7aSSenthil Balasubramanian {
459615c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_LEGACY_6_24] =
459715c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_6_24, freq,
459815c9ee7aSSenthil Balasubramanian is2GHz);
459915c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_LEGACY_36] =
460015c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_36, freq,
460115c9ee7aSSenthil Balasubramanian is2GHz);
460215c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_LEGACY_48] =
460315c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_48, freq,
460415c9ee7aSSenthil Balasubramanian is2GHz);
460515c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_LEGACY_54] =
460615c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_54, freq,
460715c9ee7aSSenthil Balasubramanian is2GHz);
460875acd5a8SGabor Juhos }
460975acd5a8SGabor Juhos
ar9003_hw_get_cck_target_powers(struct ath_hw * ah,u16 freq,u8 * targetPowerValT2)461075acd5a8SGabor Juhos static void ar9003_hw_get_cck_target_powers(struct ath_hw *ah, u16 freq,
461175acd5a8SGabor Juhos u8 *targetPowerValT2)
461275acd5a8SGabor Juhos {
461315c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_LEGACY_1L_5L] =
461415c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_1L_5L,
461515c9ee7aSSenthil Balasubramanian freq);
461615c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_LEGACY_5S] =
461715c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_5S, freq);
461815c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_LEGACY_11L] =
461915c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_11L, freq);
462015c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_LEGACY_11S] =
462115c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_11S, freq);
462275acd5a8SGabor Juhos }
462375acd5a8SGabor Juhos
ar9003_hw_get_ht20_target_powers(struct ath_hw * ah,u16 freq,u8 * targetPowerValT2,bool is2GHz)462475acd5a8SGabor Juhos static void ar9003_hw_get_ht20_target_powers(struct ath_hw *ah, u16 freq,
462575acd5a8SGabor Juhos u8 *targetPowerValT2, bool is2GHz)
462675acd5a8SGabor Juhos {
462715c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT20_0_8_16] =
462815c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_0_8_16, freq,
462915c9ee7aSSenthil Balasubramanian is2GHz);
463015c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT20_1_3_9_11_17_19] =
463115c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_1_3_9_11_17_19,
463215c9ee7aSSenthil Balasubramanian freq, is2GHz);
463315c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT20_4] =
463415c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_4, freq,
463515c9ee7aSSenthil Balasubramanian is2GHz);
463615c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT20_5] =
463715c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_5, freq,
463815c9ee7aSSenthil Balasubramanian is2GHz);
463915c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT20_6] =
464015c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_6, freq,
464115c9ee7aSSenthil Balasubramanian is2GHz);
464215c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT20_7] =
464315c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_7, freq,
464415c9ee7aSSenthil Balasubramanian is2GHz);
464515c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT20_12] =
464615c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_12, freq,
464715c9ee7aSSenthil Balasubramanian is2GHz);
464815c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT20_13] =
464915c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_13, freq,
465015c9ee7aSSenthil Balasubramanian is2GHz);
465115c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT20_14] =
465215c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_14, freq,
465315c9ee7aSSenthil Balasubramanian is2GHz);
465415c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT20_15] =
465515c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_15, freq,
465615c9ee7aSSenthil Balasubramanian is2GHz);
465715c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT20_20] =
465815c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_20, freq,
465915c9ee7aSSenthil Balasubramanian is2GHz);
466015c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT20_21] =
466115c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_21, freq,
466215c9ee7aSSenthil Balasubramanian is2GHz);
466315c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT20_22] =
466415c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_22, freq,
466515c9ee7aSSenthil Balasubramanian is2GHz);
466615c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT20_23] =
466715c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_23, freq,
466815c9ee7aSSenthil Balasubramanian is2GHz);
466975acd5a8SGabor Juhos }
467075acd5a8SGabor Juhos
ar9003_hw_get_ht40_target_powers(struct ath_hw * ah,u16 freq,u8 * targetPowerValT2,bool is2GHz)467175acd5a8SGabor Juhos static void ar9003_hw_get_ht40_target_powers(struct ath_hw *ah,
467275acd5a8SGabor Juhos u16 freq,
467375acd5a8SGabor Juhos u8 *targetPowerValT2,
467475acd5a8SGabor Juhos bool is2GHz)
467575acd5a8SGabor Juhos {
467675acd5a8SGabor Juhos /* XXX: hard code for now, need to get from eeprom struct */
467775acd5a8SGabor Juhos u8 ht40PowerIncForPdadc = 0;
467875acd5a8SGabor Juhos
467915c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT40_0_8_16] =
468015c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_0_8_16, freq,
468115c9ee7aSSenthil Balasubramanian is2GHz) + ht40PowerIncForPdadc;
468215c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT40_1_3_9_11_17_19] =
468315c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_1_3_9_11_17_19,
468415c9ee7aSSenthil Balasubramanian freq,
468515c9ee7aSSenthil Balasubramanian is2GHz) + ht40PowerIncForPdadc;
468615c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT40_4] =
468715c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_4, freq,
468815c9ee7aSSenthil Balasubramanian is2GHz) + ht40PowerIncForPdadc;
468915c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT40_5] =
469015c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_5, freq,
469115c9ee7aSSenthil Balasubramanian is2GHz) + ht40PowerIncForPdadc;
469215c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT40_6] =
469315c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_6, freq,
469415c9ee7aSSenthil Balasubramanian is2GHz) + ht40PowerIncForPdadc;
469515c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT40_7] =
469615c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_7, freq,
469715c9ee7aSSenthil Balasubramanian is2GHz) + ht40PowerIncForPdadc;
469815c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT40_12] =
469915c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_12, freq,
470015c9ee7aSSenthil Balasubramanian is2GHz) + ht40PowerIncForPdadc;
470115c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT40_13] =
470215c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_13, freq,
470315c9ee7aSSenthil Balasubramanian is2GHz) + ht40PowerIncForPdadc;
470415c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT40_14] =
470515c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_14, freq,
470615c9ee7aSSenthil Balasubramanian is2GHz) + ht40PowerIncForPdadc;
470715c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT40_15] =
470815c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_15, freq,
470915c9ee7aSSenthil Balasubramanian is2GHz) + ht40PowerIncForPdadc;
471015c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT40_20] =
471115c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_20, freq,
471215c9ee7aSSenthil Balasubramanian is2GHz) + ht40PowerIncForPdadc;
471315c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT40_21] =
471415c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_21, freq,
471515c9ee7aSSenthil Balasubramanian is2GHz) + ht40PowerIncForPdadc;
471615c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT40_22] =
471715c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_22, freq,
471815c9ee7aSSenthil Balasubramanian is2GHz) + ht40PowerIncForPdadc;
471915c9ee7aSSenthil Balasubramanian targetPowerValT2[ALL_TARGET_HT40_23] =
472015c9ee7aSSenthil Balasubramanian ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_23, freq,
472115c9ee7aSSenthil Balasubramanian is2GHz) + ht40PowerIncForPdadc;
472275acd5a8SGabor Juhos }
472375acd5a8SGabor Juhos
ar9003_hw_get_target_power_eeprom(struct ath_hw * ah,struct ath9k_channel * chan,u8 * targetPowerValT2)472475acd5a8SGabor Juhos static void ar9003_hw_get_target_power_eeprom(struct ath_hw *ah,
472575acd5a8SGabor Juhos struct ath9k_channel *chan,
472675acd5a8SGabor Juhos u8 *targetPowerValT2)
472775acd5a8SGabor Juhos {
472875acd5a8SGabor Juhos bool is2GHz = IS_CHAN_2GHZ(chan);
472975acd5a8SGabor Juhos unsigned int i = 0;
473075acd5a8SGabor Juhos struct ath_common *common = ath9k_hw_common(ah);
473175acd5a8SGabor Juhos u16 freq = chan->channel;
473275acd5a8SGabor Juhos
473375acd5a8SGabor Juhos if (is2GHz)
473475acd5a8SGabor Juhos ar9003_hw_get_cck_target_powers(ah, freq, targetPowerValT2);
473575acd5a8SGabor Juhos
473675acd5a8SGabor Juhos ar9003_hw_get_legacy_target_powers(ah, freq, targetPowerValT2, is2GHz);
473775acd5a8SGabor Juhos ar9003_hw_get_ht20_target_powers(ah, freq, targetPowerValT2, is2GHz);
473875acd5a8SGabor Juhos
473975acd5a8SGabor Juhos if (IS_CHAN_HT40(chan))
474075acd5a8SGabor Juhos ar9003_hw_get_ht40_target_powers(ah, freq, targetPowerValT2,
474175acd5a8SGabor Juhos is2GHz);
474215c9ee7aSSenthil Balasubramanian
4743a1cbc7a8SJoe Perches for (i = 0; i < ar9300RateSize; i++) {
4744df401907SSujith Manoharan ath_dbg(common, REGULATORY, "TPC[%02d] 0x%08x\n",
4745d2182b69SJoe Perches i, targetPowerValT2[i]);
474615c9ee7aSSenthil Balasubramanian }
474715c9ee7aSSenthil Balasubramanian }
474815c9ee7aSSenthil Balasubramanian
ar9003_hw_cal_pier_get(struct ath_hw * ah,bool is2ghz,int ipier,int ichain,int * pfrequency,int * pcorrection,int * ptemperature,int * pvoltage,int * pnf_cal,int * pnf_power)474915c9ee7aSSenthil Balasubramanian static int ar9003_hw_cal_pier_get(struct ath_hw *ah,
47507c458230SWenli Looi bool is2ghz,
475115c9ee7aSSenthil Balasubramanian int ipier,
475215c9ee7aSSenthil Balasubramanian int ichain,
475315c9ee7aSSenthil Balasubramanian int *pfrequency,
475415c9ee7aSSenthil Balasubramanian int *pcorrection,
475534d4fcd8SWojciech Dubowik int *ptemperature, int *pvoltage,
475634d4fcd8SWojciech Dubowik int *pnf_cal, int *pnf_power)
475715c9ee7aSSenthil Balasubramanian {
475815c9ee7aSSenthil Balasubramanian u8 *pCalPier;
475915c9ee7aSSenthil Balasubramanian struct ar9300_cal_data_per_freq_op_loop *pCalPierStruct;
476015c9ee7aSSenthil Balasubramanian struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
476115c9ee7aSSenthil Balasubramanian struct ath_common *common = ath9k_hw_common(ah);
476215c9ee7aSSenthil Balasubramanian
476315c9ee7aSSenthil Balasubramanian if (ichain >= AR9300_MAX_CHAINS) {
4764d2182b69SJoe Perches ath_dbg(common, EEPROM,
476515c9ee7aSSenthil Balasubramanian "Invalid chain index, must be less than %d\n",
476615c9ee7aSSenthil Balasubramanian AR9300_MAX_CHAINS);
476715c9ee7aSSenthil Balasubramanian return -1;
476815c9ee7aSSenthil Balasubramanian }
476915c9ee7aSSenthil Balasubramanian
47707c458230SWenli Looi if (is2ghz) {
477115c9ee7aSSenthil Balasubramanian if (ipier >= AR9300_NUM_2G_CAL_PIERS) {
4772d2182b69SJoe Perches ath_dbg(common, EEPROM,
4773226afe68SJoe Perches "Invalid 2GHz cal pier index, must be less than %d\n",
4774226afe68SJoe Perches AR9300_NUM_2G_CAL_PIERS);
477515c9ee7aSSenthil Balasubramanian return -1;
477615c9ee7aSSenthil Balasubramanian }
477715c9ee7aSSenthil Balasubramanian
477815c9ee7aSSenthil Balasubramanian pCalPier = &(eep->calFreqPier2G[ipier]);
477915c9ee7aSSenthil Balasubramanian pCalPierStruct = &(eep->calPierData2G[ichain][ipier]);
47807c458230SWenli Looi } else {
47817c458230SWenli Looi if (ipier >= AR9300_NUM_5G_CAL_PIERS) {
47827c458230SWenli Looi ath_dbg(common, EEPROM,
47837c458230SWenli Looi "Invalid 5GHz cal pier index, must be less than %d\n",
47847c458230SWenli Looi AR9300_NUM_5G_CAL_PIERS);
47857c458230SWenli Looi return -1;
47867c458230SWenli Looi }
47877c458230SWenli Looi pCalPier = &(eep->calFreqPier5G[ipier]);
47887c458230SWenli Looi pCalPierStruct = &(eep->calPierData5G[ichain][ipier]);
478915c9ee7aSSenthil Balasubramanian }
479015c9ee7aSSenthil Balasubramanian
47917c458230SWenli Looi *pfrequency = ath9k_hw_fbin2freq(*pCalPier, is2ghz);
479215c9ee7aSSenthil Balasubramanian *pcorrection = pCalPierStruct->refPower;
479315c9ee7aSSenthil Balasubramanian *ptemperature = pCalPierStruct->tempMeas;
479415c9ee7aSSenthil Balasubramanian *pvoltage = pCalPierStruct->voltMeas;
479534d4fcd8SWojciech Dubowik *pnf_cal = pCalPierStruct->rxTempMeas ?
479634d4fcd8SWojciech Dubowik N2DBM(pCalPierStruct->rxNoisefloorCal) : 0;
479734d4fcd8SWojciech Dubowik *pnf_power = pCalPierStruct->rxTempMeas ?
479834d4fcd8SWojciech Dubowik N2DBM(pCalPierStruct->rxNoisefloorPower) : 0;
479915c9ee7aSSenthil Balasubramanian
480015c9ee7aSSenthil Balasubramanian return 0;
480115c9ee7aSSenthil Balasubramanian }
480215c9ee7aSSenthil Balasubramanian
ar9003_hw_power_control_override(struct ath_hw * ah,int frequency,int * correction,int * voltage,int * temperature)48032d7caefbSSujith Manoharan static void ar9003_hw_power_control_override(struct ath_hw *ah,
480415c9ee7aSSenthil Balasubramanian int frequency,
480515c9ee7aSSenthil Balasubramanian int *correction,
480615c9ee7aSSenthil Balasubramanian int *voltage, int *temperature)
480715c9ee7aSSenthil Balasubramanian {
48082d7caefbSSujith Manoharan int temp_slope = 0, temp_slope1 = 0, temp_slope2 = 0;
480915c9ee7aSSenthil Balasubramanian struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
48102d7caefbSSujith Manoharan int f[8], t[8], t1[3], t2[3], i;
481115c9ee7aSSenthil Balasubramanian
481215c9ee7aSSenthil Balasubramanian REG_RMW(ah, AR_PHY_TPC_11_B0,
481315c9ee7aSSenthil Balasubramanian (correction[0] << AR_PHY_TPC_OLPC_GAIN_DELTA_S),
481415c9ee7aSSenthil Balasubramanian AR_PHY_TPC_OLPC_GAIN_DELTA);
48155f139ebaSVasanthakumar Thiagarajan if (ah->caps.tx_chainmask & BIT(1))
481615c9ee7aSSenthil Balasubramanian REG_RMW(ah, AR_PHY_TPC_11_B1,
481715c9ee7aSSenthil Balasubramanian (correction[1] << AR_PHY_TPC_OLPC_GAIN_DELTA_S),
481815c9ee7aSSenthil Balasubramanian AR_PHY_TPC_OLPC_GAIN_DELTA);
48195f139ebaSVasanthakumar Thiagarajan if (ah->caps.tx_chainmask & BIT(2))
482015c9ee7aSSenthil Balasubramanian REG_RMW(ah, AR_PHY_TPC_11_B2,
482115c9ee7aSSenthil Balasubramanian (correction[2] << AR_PHY_TPC_OLPC_GAIN_DELTA_S),
482215c9ee7aSSenthil Balasubramanian AR_PHY_TPC_OLPC_GAIN_DELTA);
482315c9ee7aSSenthil Balasubramanian
482415c9ee7aSSenthil Balasubramanian /* enable open loop power control on chip */
482515c9ee7aSSenthil Balasubramanian REG_RMW(ah, AR_PHY_TPC_6_B0,
482615c9ee7aSSenthil Balasubramanian (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S),
482715c9ee7aSSenthil Balasubramanian AR_PHY_TPC_6_ERROR_EST_MODE);
48285f139ebaSVasanthakumar Thiagarajan if (ah->caps.tx_chainmask & BIT(1))
482915c9ee7aSSenthil Balasubramanian REG_RMW(ah, AR_PHY_TPC_6_B1,
483015c9ee7aSSenthil Balasubramanian (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S),
483115c9ee7aSSenthil Balasubramanian AR_PHY_TPC_6_ERROR_EST_MODE);
48325f139ebaSVasanthakumar Thiagarajan if (ah->caps.tx_chainmask & BIT(2))
483315c9ee7aSSenthil Balasubramanian REG_RMW(ah, AR_PHY_TPC_6_B2,
483415c9ee7aSSenthil Balasubramanian (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S),
483515c9ee7aSSenthil Balasubramanian AR_PHY_TPC_6_ERROR_EST_MODE);
483615c9ee7aSSenthil Balasubramanian
483715c9ee7aSSenthil Balasubramanian /*
483815c9ee7aSSenthil Balasubramanian * enable temperature compensation
483915c9ee7aSSenthil Balasubramanian * Need to use register names
484015c9ee7aSSenthil Balasubramanian */
48412d7caefbSSujith Manoharan if (frequency < 4000) {
48422d7caefbSSujith Manoharan temp_slope = eep->modalHeader2G.tempSlope;
48432d7caefbSSujith Manoharan } else {
48442d7caefbSSujith Manoharan if (AR_SREV_9550(ah)) {
48452d7caefbSSujith Manoharan t[0] = eep->base_ext1.tempslopextension[2];
48462d7caefbSSujith Manoharan t1[0] = eep->base_ext1.tempslopextension[3];
48472d7caefbSSujith Manoharan t2[0] = eep->base_ext1.tempslopextension[4];
48482d7caefbSSujith Manoharan f[0] = 5180;
48492d7caefbSSujith Manoharan
48502d7caefbSSujith Manoharan t[1] = eep->modalHeader5G.tempSlope;
48512d7caefbSSujith Manoharan t1[1] = eep->base_ext1.tempslopextension[0];
48522d7caefbSSujith Manoharan t2[1] = eep->base_ext1.tempslopextension[1];
48532d7caefbSSujith Manoharan f[1] = 5500;
48542d7caefbSSujith Manoharan
48552d7caefbSSujith Manoharan t[2] = eep->base_ext1.tempslopextension[5];
48562d7caefbSSujith Manoharan t1[2] = eep->base_ext1.tempslopextension[6];
48572d7caefbSSujith Manoharan t2[2] = eep->base_ext1.tempslopextension[7];
48582d7caefbSSujith Manoharan f[2] = 5785;
48592d7caefbSSujith Manoharan
48602d7caefbSSujith Manoharan temp_slope = ar9003_hw_power_interpolate(frequency,
48612d7caefbSSujith Manoharan f, t, 3);
48622d7caefbSSujith Manoharan temp_slope1 = ar9003_hw_power_interpolate(frequency,
48632d7caefbSSujith Manoharan f, t1, 3);
48642d7caefbSSujith Manoharan temp_slope2 = ar9003_hw_power_interpolate(frequency,
48652d7caefbSSujith Manoharan f, t2, 3);
48662d7caefbSSujith Manoharan
48672d7caefbSSujith Manoharan goto tempslope;
48682d7caefbSSujith Manoharan }
48692d7caefbSSujith Manoharan
48702d7caefbSSujith Manoharan if ((eep->baseEepHeader.miscConfiguration & 0x20) != 0) {
4871420e2b1bSRajkumar Manoharan for (i = 0; i < 8; i++) {
4872420e2b1bSRajkumar Manoharan t[i] = eep->base_ext1.tempslopextension[i];
4873420e2b1bSRajkumar Manoharan f[i] = FBIN2FREQ(eep->calFreqPier5G[i], 0);
4874420e2b1bSRajkumar Manoharan }
48752d7caefbSSujith Manoharan temp_slope = ar9003_hw_power_interpolate((s32) frequency,
4876420e2b1bSRajkumar Manoharan f, t, 8);
4877420e2b1bSRajkumar Manoharan } else if (eep->base_ext2.tempSlopeLow != 0) {
487815cbbc44SVasanthakumar Thiagarajan t[0] = eep->base_ext2.tempSlopeLow;
487915cbbc44SVasanthakumar Thiagarajan f[0] = 5180;
488015cbbc44SVasanthakumar Thiagarajan t[1] = eep->modalHeader5G.tempSlope;
488115cbbc44SVasanthakumar Thiagarajan f[1] = 5500;
488215cbbc44SVasanthakumar Thiagarajan t[2] = eep->base_ext2.tempSlopeHigh;
488315cbbc44SVasanthakumar Thiagarajan f[2] = 5785;
48842d7caefbSSujith Manoharan temp_slope = ar9003_hw_power_interpolate((s32) frequency,
488515cbbc44SVasanthakumar Thiagarajan f, t, 3);
48862d7caefbSSujith Manoharan } else {
48872d7caefbSSujith Manoharan temp_slope = eep->modalHeader5G.tempSlope;
48882d7caefbSSujith Manoharan }
48892d7caefbSSujith Manoharan }
489015c9ee7aSSenthil Balasubramanian
48912d7caefbSSujith Manoharan tempslope:
4892ede6a5e7SMiaoqing Pan if (AR_SREV_9550(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah)) {
4893d65b1278SSujith Manoharan u8 txmask = (eep->baseEepHeader.txrxMask & 0xf0) >> 4;
4894d65b1278SSujith Manoharan
48952d7caefbSSujith Manoharan /*
48962d7caefbSSujith Manoharan * AR955x has tempSlope register for each chain.
48972d7caefbSSujith Manoharan * Check whether temp_compensation feature is enabled or not.
48982d7caefbSSujith Manoharan */
48992d7caefbSSujith Manoharan if (eep->baseEepHeader.featureEnable & 0x1) {
49002d7caefbSSujith Manoharan if (frequency < 4000) {
4901d65b1278SSujith Manoharan if (txmask & BIT(0))
49022d7caefbSSujith Manoharan REG_RMW_FIELD(ah, AR_PHY_TPC_19,
49032d7caefbSSujith Manoharan AR_PHY_TPC_19_ALPHA_THERM,
49042d7caefbSSujith Manoharan eep->base_ext2.tempSlopeLow);
4905d65b1278SSujith Manoharan if (txmask & BIT(1))
49062d7caefbSSujith Manoharan REG_RMW_FIELD(ah, AR_PHY_TPC_19_B1,
49072d7caefbSSujith Manoharan AR_PHY_TPC_19_ALPHA_THERM,
49082d7caefbSSujith Manoharan temp_slope);
4909d65b1278SSujith Manoharan if (txmask & BIT(2))
49102d7caefbSSujith Manoharan REG_RMW_FIELD(ah, AR_PHY_TPC_19_B2,
49112d7caefbSSujith Manoharan AR_PHY_TPC_19_ALPHA_THERM,
49122d7caefbSSujith Manoharan eep->base_ext2.tempSlopeHigh);
49132d7caefbSSujith Manoharan } else {
4914d65b1278SSujith Manoharan if (txmask & BIT(0))
49152d7caefbSSujith Manoharan REG_RMW_FIELD(ah, AR_PHY_TPC_19,
49162d7caefbSSujith Manoharan AR_PHY_TPC_19_ALPHA_THERM,
49172d7caefbSSujith Manoharan temp_slope);
4918d65b1278SSujith Manoharan if (txmask & BIT(1))
49192d7caefbSSujith Manoharan REG_RMW_FIELD(ah, AR_PHY_TPC_19_B1,
49202d7caefbSSujith Manoharan AR_PHY_TPC_19_ALPHA_THERM,
49212d7caefbSSujith Manoharan temp_slope1);
4922d65b1278SSujith Manoharan if (txmask & BIT(2))
49232d7caefbSSujith Manoharan REG_RMW_FIELD(ah, AR_PHY_TPC_19_B2,
49242d7caefbSSujith Manoharan AR_PHY_TPC_19_ALPHA_THERM,
49252d7caefbSSujith Manoharan temp_slope2);
49262d7caefbSSujith Manoharan }
49272d7caefbSSujith Manoharan } else {
49282d7caefbSSujith Manoharan /*
49292d7caefbSSujith Manoharan * If temp compensation is not enabled,
49302d7caefbSSujith Manoharan * set all registers to 0.
49312d7caefbSSujith Manoharan */
4932d65b1278SSujith Manoharan if (txmask & BIT(0))
49332d7caefbSSujith Manoharan REG_RMW_FIELD(ah, AR_PHY_TPC_19,
49342d7caefbSSujith Manoharan AR_PHY_TPC_19_ALPHA_THERM, 0);
4935d65b1278SSujith Manoharan if (txmask & BIT(1))
49362d7caefbSSujith Manoharan REG_RMW_FIELD(ah, AR_PHY_TPC_19_B1,
49372d7caefbSSujith Manoharan AR_PHY_TPC_19_ALPHA_THERM, 0);
4938d65b1278SSujith Manoharan if (txmask & BIT(2))
49392d7caefbSSujith Manoharan REG_RMW_FIELD(ah, AR_PHY_TPC_19_B2,
49402d7caefbSSujith Manoharan AR_PHY_TPC_19_ALPHA_THERM, 0);
49412d7caefbSSujith Manoharan }
49422d7caefbSSujith Manoharan } else {
49432d7caefbSSujith Manoharan REG_RMW_FIELD(ah, AR_PHY_TPC_19,
49442d7caefbSSujith Manoharan AR_PHY_TPC_19_ALPHA_THERM, temp_slope);
49452d7caefbSSujith Manoharan }
49462577c6e8SSenthil Balasubramanian
49472b5e54e2SSujith Manoharan if (AR_SREV_9462_20_OR_LATER(ah))
49482577c6e8SSenthil Balasubramanian REG_RMW_FIELD(ah, AR_PHY_TPC_19_B1,
49492d7caefbSSujith Manoharan AR_PHY_TPC_19_B1_ALPHA_THERM, temp_slope);
49502577c6e8SSenthil Balasubramanian
49512577c6e8SSenthil Balasubramanian
495215c9ee7aSSenthil Balasubramanian REG_RMW_FIELD(ah, AR_PHY_TPC_18, AR_PHY_TPC_18_THERM_CAL_VALUE,
495315c9ee7aSSenthil Balasubramanian temperature[0]);
495415c9ee7aSSenthil Balasubramanian }
495515c9ee7aSSenthil Balasubramanian
495615c9ee7aSSenthil Balasubramanian /* Apply the recorded correction values. */
ar9003_hw_calibration_apply(struct ath_hw * ah,int frequency)495715c9ee7aSSenthil Balasubramanian static int ar9003_hw_calibration_apply(struct ath_hw *ah, int frequency)
495815c9ee7aSSenthil Balasubramanian {
495915c9ee7aSSenthil Balasubramanian int ichain, ipier, npier;
496015c9ee7aSSenthil Balasubramanian int lfrequency[AR9300_MAX_CHAINS],
496115c9ee7aSSenthil Balasubramanian lcorrection[AR9300_MAX_CHAINS],
496234d4fcd8SWojciech Dubowik ltemperature[AR9300_MAX_CHAINS], lvoltage[AR9300_MAX_CHAINS],
496334d4fcd8SWojciech Dubowik lnf_cal[AR9300_MAX_CHAINS], lnf_pwr[AR9300_MAX_CHAINS];
496415c9ee7aSSenthil Balasubramanian int hfrequency[AR9300_MAX_CHAINS],
496515c9ee7aSSenthil Balasubramanian hcorrection[AR9300_MAX_CHAINS],
496634d4fcd8SWojciech Dubowik htemperature[AR9300_MAX_CHAINS], hvoltage[AR9300_MAX_CHAINS],
496734d4fcd8SWojciech Dubowik hnf_cal[AR9300_MAX_CHAINS], hnf_pwr[AR9300_MAX_CHAINS];
496815c9ee7aSSenthil Balasubramanian int fdiff;
496915c9ee7aSSenthil Balasubramanian int correction[AR9300_MAX_CHAINS],
497034d4fcd8SWojciech Dubowik voltage[AR9300_MAX_CHAINS], temperature[AR9300_MAX_CHAINS],
497134d4fcd8SWojciech Dubowik nf_cal[AR9300_MAX_CHAINS], nf_pwr[AR9300_MAX_CHAINS];
497234d4fcd8SWojciech Dubowik int pfrequency, pcorrection, ptemperature, pvoltage,
497334d4fcd8SWojciech Dubowik pnf_cal, pnf_pwr;
497415c9ee7aSSenthil Balasubramanian struct ath_common *common = ath9k_hw_common(ah);
49757c458230SWenli Looi bool is2ghz = frequency < 4000;
497615c9ee7aSSenthil Balasubramanian
49777c458230SWenli Looi if (is2ghz)
497815c9ee7aSSenthil Balasubramanian npier = AR9300_NUM_2G_CAL_PIERS;
49797c458230SWenli Looi else
49807c458230SWenli Looi npier = AR9300_NUM_5G_CAL_PIERS;
498115c9ee7aSSenthil Balasubramanian
498215c9ee7aSSenthil Balasubramanian for (ichain = 0; ichain < AR9300_MAX_CHAINS; ichain++) {
498315c9ee7aSSenthil Balasubramanian lfrequency[ichain] = 0;
498415c9ee7aSSenthil Balasubramanian hfrequency[ichain] = 100000;
498515c9ee7aSSenthil Balasubramanian }
498615c9ee7aSSenthil Balasubramanian /* identify best lower and higher frequency calibration measurement */
498715c9ee7aSSenthil Balasubramanian for (ichain = 0; ichain < AR9300_MAX_CHAINS; ichain++) {
498815c9ee7aSSenthil Balasubramanian for (ipier = 0; ipier < npier; ipier++) {
49897c458230SWenli Looi if (!ar9003_hw_cal_pier_get(ah, is2ghz, ipier, ichain,
499015c9ee7aSSenthil Balasubramanian &pfrequency, &pcorrection,
499134d4fcd8SWojciech Dubowik &ptemperature, &pvoltage,
499234d4fcd8SWojciech Dubowik &pnf_cal, &pnf_pwr)) {
499315c9ee7aSSenthil Balasubramanian fdiff = frequency - pfrequency;
499415c9ee7aSSenthil Balasubramanian
499515c9ee7aSSenthil Balasubramanian /*
499615c9ee7aSSenthil Balasubramanian * this measurement is higher than
499715c9ee7aSSenthil Balasubramanian * our desired frequency
499815c9ee7aSSenthil Balasubramanian */
499915c9ee7aSSenthil Balasubramanian if (fdiff <= 0) {
500015c9ee7aSSenthil Balasubramanian if (hfrequency[ichain] <= 0 ||
500115c9ee7aSSenthil Balasubramanian hfrequency[ichain] >= 100000 ||
500215c9ee7aSSenthil Balasubramanian fdiff >
500315c9ee7aSSenthil Balasubramanian (frequency - hfrequency[ichain])) {
500415c9ee7aSSenthil Balasubramanian /*
500515c9ee7aSSenthil Balasubramanian * new best higher
500615c9ee7aSSenthil Balasubramanian * frequency measurement
500715c9ee7aSSenthil Balasubramanian */
500815c9ee7aSSenthil Balasubramanian hfrequency[ichain] = pfrequency;
500915c9ee7aSSenthil Balasubramanian hcorrection[ichain] =
501015c9ee7aSSenthil Balasubramanian pcorrection;
501115c9ee7aSSenthil Balasubramanian htemperature[ichain] =
501215c9ee7aSSenthil Balasubramanian ptemperature;
501315c9ee7aSSenthil Balasubramanian hvoltage[ichain] = pvoltage;
501434d4fcd8SWojciech Dubowik hnf_cal[ichain] = pnf_cal;
501534d4fcd8SWojciech Dubowik hnf_pwr[ichain] = pnf_pwr;
501615c9ee7aSSenthil Balasubramanian }
501715c9ee7aSSenthil Balasubramanian }
501815c9ee7aSSenthil Balasubramanian if (fdiff >= 0) {
501915c9ee7aSSenthil Balasubramanian if (lfrequency[ichain] <= 0
502015c9ee7aSSenthil Balasubramanian || fdiff <
502115c9ee7aSSenthil Balasubramanian (frequency - lfrequency[ichain])) {
502215c9ee7aSSenthil Balasubramanian /*
502315c9ee7aSSenthil Balasubramanian * new best lower
502415c9ee7aSSenthil Balasubramanian * frequency measurement
502515c9ee7aSSenthil Balasubramanian */
502615c9ee7aSSenthil Balasubramanian lfrequency[ichain] = pfrequency;
502715c9ee7aSSenthil Balasubramanian lcorrection[ichain] =
502815c9ee7aSSenthil Balasubramanian pcorrection;
502915c9ee7aSSenthil Balasubramanian ltemperature[ichain] =
503015c9ee7aSSenthil Balasubramanian ptemperature;
503115c9ee7aSSenthil Balasubramanian lvoltage[ichain] = pvoltage;
503234d4fcd8SWojciech Dubowik lnf_cal[ichain] = pnf_cal;
503334d4fcd8SWojciech Dubowik lnf_pwr[ichain] = pnf_pwr;
503415c9ee7aSSenthil Balasubramanian }
503515c9ee7aSSenthil Balasubramanian }
503615c9ee7aSSenthil Balasubramanian }
503715c9ee7aSSenthil Balasubramanian }
503815c9ee7aSSenthil Balasubramanian }
503915c9ee7aSSenthil Balasubramanian
504015c9ee7aSSenthil Balasubramanian /* interpolate */
504115c9ee7aSSenthil Balasubramanian for (ichain = 0; ichain < AR9300_MAX_CHAINS; ichain++) {
504234d4fcd8SWojciech Dubowik ath_dbg(common, EEPROM,
504334d4fcd8SWojciech Dubowik "ch=%d f=%d low=%d %d h=%d %d n=%d %d p=%d %d\n",
504415c9ee7aSSenthil Balasubramanian ichain, frequency, lfrequency[ichain],
504515c9ee7aSSenthil Balasubramanian lcorrection[ichain], hfrequency[ichain],
504634d4fcd8SWojciech Dubowik hcorrection[ichain], lnf_cal[ichain],
504734d4fcd8SWojciech Dubowik hnf_cal[ichain], lnf_pwr[ichain],
504834d4fcd8SWojciech Dubowik hnf_pwr[ichain]);
504915c9ee7aSSenthil Balasubramanian /* they're the same, so just pick one */
505015c9ee7aSSenthil Balasubramanian if (hfrequency[ichain] == lfrequency[ichain]) {
505115c9ee7aSSenthil Balasubramanian correction[ichain] = lcorrection[ichain];
505215c9ee7aSSenthil Balasubramanian voltage[ichain] = lvoltage[ichain];
505315c9ee7aSSenthil Balasubramanian temperature[ichain] = ltemperature[ichain];
505434d4fcd8SWojciech Dubowik nf_cal[ichain] = lnf_cal[ichain];
505534d4fcd8SWojciech Dubowik nf_pwr[ichain] = lnf_pwr[ichain];
505615c9ee7aSSenthil Balasubramanian }
505715c9ee7aSSenthil Balasubramanian /* the low frequency is good */
505815c9ee7aSSenthil Balasubramanian else if (frequency - lfrequency[ichain] < 1000) {
505915c9ee7aSSenthil Balasubramanian /* so is the high frequency, interpolate */
506015c9ee7aSSenthil Balasubramanian if (hfrequency[ichain] - frequency < 1000) {
506115c9ee7aSSenthil Balasubramanian
5062bc206802SVasanthakumar Thiagarajan correction[ichain] = interpolate(frequency,
5063bc206802SVasanthakumar Thiagarajan lfrequency[ichain],
5064bc206802SVasanthakumar Thiagarajan hfrequency[ichain],
5065bc206802SVasanthakumar Thiagarajan lcorrection[ichain],
5066bc206802SVasanthakumar Thiagarajan hcorrection[ichain]);
506715c9ee7aSSenthil Balasubramanian
5068bc206802SVasanthakumar Thiagarajan temperature[ichain] = interpolate(frequency,
5069bc206802SVasanthakumar Thiagarajan lfrequency[ichain],
5070bc206802SVasanthakumar Thiagarajan hfrequency[ichain],
5071bc206802SVasanthakumar Thiagarajan ltemperature[ichain],
5072bc206802SVasanthakumar Thiagarajan htemperature[ichain]);
507315c9ee7aSSenthil Balasubramanian
5074bc206802SVasanthakumar Thiagarajan voltage[ichain] = interpolate(frequency,
5075bc206802SVasanthakumar Thiagarajan lfrequency[ichain],
5076bc206802SVasanthakumar Thiagarajan hfrequency[ichain],
5077bc206802SVasanthakumar Thiagarajan lvoltage[ichain],
5078bc206802SVasanthakumar Thiagarajan hvoltage[ichain]);
507934d4fcd8SWojciech Dubowik
508034d4fcd8SWojciech Dubowik nf_cal[ichain] = interpolate(frequency,
508134d4fcd8SWojciech Dubowik lfrequency[ichain],
508234d4fcd8SWojciech Dubowik hfrequency[ichain],
508334d4fcd8SWojciech Dubowik lnf_cal[ichain],
508434d4fcd8SWojciech Dubowik hnf_cal[ichain]);
508534d4fcd8SWojciech Dubowik
508634d4fcd8SWojciech Dubowik nf_pwr[ichain] = interpolate(frequency,
508734d4fcd8SWojciech Dubowik lfrequency[ichain],
508834d4fcd8SWojciech Dubowik hfrequency[ichain],
508934d4fcd8SWojciech Dubowik lnf_pwr[ichain],
509034d4fcd8SWojciech Dubowik hnf_pwr[ichain]);
509115c9ee7aSSenthil Balasubramanian }
509215c9ee7aSSenthil Balasubramanian /* only low is good, use it */
509315c9ee7aSSenthil Balasubramanian else {
509415c9ee7aSSenthil Balasubramanian correction[ichain] = lcorrection[ichain];
509515c9ee7aSSenthil Balasubramanian temperature[ichain] = ltemperature[ichain];
509615c9ee7aSSenthil Balasubramanian voltage[ichain] = lvoltage[ichain];
509734d4fcd8SWojciech Dubowik nf_cal[ichain] = lnf_cal[ichain];
509834d4fcd8SWojciech Dubowik nf_pwr[ichain] = lnf_pwr[ichain];
509915c9ee7aSSenthil Balasubramanian }
510015c9ee7aSSenthil Balasubramanian }
510115c9ee7aSSenthil Balasubramanian /* only high is good, use it */
510215c9ee7aSSenthil Balasubramanian else if (hfrequency[ichain] - frequency < 1000) {
510315c9ee7aSSenthil Balasubramanian correction[ichain] = hcorrection[ichain];
510415c9ee7aSSenthil Balasubramanian temperature[ichain] = htemperature[ichain];
510515c9ee7aSSenthil Balasubramanian voltage[ichain] = hvoltage[ichain];
510634d4fcd8SWojciech Dubowik nf_cal[ichain] = hnf_cal[ichain];
510734d4fcd8SWojciech Dubowik nf_pwr[ichain] = hnf_pwr[ichain];
510815c9ee7aSSenthil Balasubramanian } else { /* nothing is good, presume 0???? */
510915c9ee7aSSenthil Balasubramanian correction[ichain] = 0;
511015c9ee7aSSenthil Balasubramanian temperature[ichain] = 0;
511115c9ee7aSSenthil Balasubramanian voltage[ichain] = 0;
511234d4fcd8SWojciech Dubowik nf_cal[ichain] = 0;
511334d4fcd8SWojciech Dubowik nf_pwr[ichain] = 0;
511415c9ee7aSSenthil Balasubramanian }
511515c9ee7aSSenthil Balasubramanian }
511615c9ee7aSSenthil Balasubramanian
511715c9ee7aSSenthil Balasubramanian ar9003_hw_power_control_override(ah, frequency, correction, voltage,
511815c9ee7aSSenthil Balasubramanian temperature);
511915c9ee7aSSenthil Balasubramanian
5120d2182b69SJoe Perches ath_dbg(common, EEPROM,
512115c9ee7aSSenthil Balasubramanian "for frequency=%d, calibration correction = %d %d %d\n",
512215c9ee7aSSenthil Balasubramanian frequency, correction[0], correction[1], correction[2]);
512315c9ee7aSSenthil Balasubramanian
512434d4fcd8SWojciech Dubowik /* Store calibrated noise floor values */
51253096a4d9SWenli Looi for (ichain = 0; ichain < AR9300_MAX_CHAINS; ichain++)
51267c458230SWenli Looi if (is2ghz) {
512734d4fcd8SWojciech Dubowik ah->nf_2g.cal[ichain] = nf_cal[ichain];
512834d4fcd8SWojciech Dubowik ah->nf_2g.pwr[ichain] = nf_pwr[ichain];
51297c458230SWenli Looi } else {
51307c458230SWenli Looi ah->nf_5g.cal[ichain] = nf_cal[ichain];
51317c458230SWenli Looi ah->nf_5g.pwr[ichain] = nf_pwr[ichain];
513234d4fcd8SWojciech Dubowik }
513334d4fcd8SWojciech Dubowik
513415c9ee7aSSenthil Balasubramanian return 0;
513515c9ee7aSSenthil Balasubramanian }
513615c9ee7aSSenthil Balasubramanian
ar9003_hw_get_direct_edge_power(struct ar9300_eeprom * eep,int idx,int edge,bool is2GHz)5137824b185aSLuis R. Rodriguez static u16 ar9003_hw_get_direct_edge_power(struct ar9300_eeprom *eep,
5138824b185aSLuis R. Rodriguez int idx,
5139824b185aSLuis R. Rodriguez int edge,
5140824b185aSLuis R. Rodriguez bool is2GHz)
5141824b185aSLuis R. Rodriguez {
5142824b185aSLuis R. Rodriguez struct cal_ctl_data_2g *ctl_2g = eep->ctlPowerData_2G;
5143824b185aSLuis R. Rodriguez struct cal_ctl_data_5g *ctl_5g = eep->ctlPowerData_5G;
5144824b185aSLuis R. Rodriguez
5145824b185aSLuis R. Rodriguez if (is2GHz)
5146e702ba18SFelix Fietkau return CTL_EDGE_TPOWER(ctl_2g[idx].ctlEdges[edge]);
5147824b185aSLuis R. Rodriguez else
5148e702ba18SFelix Fietkau return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge]);
5149824b185aSLuis R. Rodriguez }
5150824b185aSLuis R. Rodriguez
ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom * eep,int idx,unsigned int edge,u16 freq,bool is2GHz)5151824b185aSLuis R. Rodriguez static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep,
5152824b185aSLuis R. Rodriguez int idx,
5153824b185aSLuis R. Rodriguez unsigned int edge,
5154824b185aSLuis R. Rodriguez u16 freq,
5155824b185aSLuis R. Rodriguez bool is2GHz)
5156824b185aSLuis R. Rodriguez {
5157824b185aSLuis R. Rodriguez struct cal_ctl_data_2g *ctl_2g = eep->ctlPowerData_2G;
5158824b185aSLuis R. Rodriguez struct cal_ctl_data_5g *ctl_5g = eep->ctlPowerData_5G;
5159824b185aSLuis R. Rodriguez
5160824b185aSLuis R. Rodriguez u8 *ctl_freqbin = is2GHz ?
5161824b185aSLuis R. Rodriguez &eep->ctl_freqbin_2G[idx][0] :
5162824b185aSLuis R. Rodriguez &eep->ctl_freqbin_5G[idx][0];
5163824b185aSLuis R. Rodriguez
5164824b185aSLuis R. Rodriguez if (is2GHz) {
5165824b185aSLuis R. Rodriguez if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 1) < freq &&
5166e702ba18SFelix Fietkau CTL_EDGE_FLAGS(ctl_2g[idx].ctlEdges[edge - 1]))
5167e702ba18SFelix Fietkau return CTL_EDGE_TPOWER(ctl_2g[idx].ctlEdges[edge - 1]);
5168824b185aSLuis R. Rodriguez } else {
5169824b185aSLuis R. Rodriguez if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 0) < freq &&
5170e702ba18SFelix Fietkau CTL_EDGE_FLAGS(ctl_5g[idx].ctlEdges[edge - 1]))
5171e702ba18SFelix Fietkau return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge - 1]);
5172824b185aSLuis R. Rodriguez }
5173824b185aSLuis R. Rodriguez
51744ddfcd7dSFelix Fietkau return MAX_RATE_POWER;
5175824b185aSLuis R. Rodriguez }
5176824b185aSLuis R. Rodriguez
5177824b185aSLuis R. Rodriguez /*
5178824b185aSLuis R. Rodriguez * Find the maximum conformance test limit for the given channel and CTL info
5179824b185aSLuis R. Rodriguez */
ar9003_hw_get_max_edge_power(struct ar9300_eeprom * eep,u16 freq,int idx,bool is2GHz)5180824b185aSLuis R. Rodriguez static u16 ar9003_hw_get_max_edge_power(struct ar9300_eeprom *eep,
5181824b185aSLuis R. Rodriguez u16 freq, int idx, bool is2GHz)
5182824b185aSLuis R. Rodriguez {
51834ddfcd7dSFelix Fietkau u16 twiceMaxEdgePower = MAX_RATE_POWER;
5184824b185aSLuis R. Rodriguez u8 *ctl_freqbin = is2GHz ?
5185824b185aSLuis R. Rodriguez &eep->ctl_freqbin_2G[idx][0] :
5186824b185aSLuis R. Rodriguez &eep->ctl_freqbin_5G[idx][0];
5187824b185aSLuis R. Rodriguez u16 num_edges = is2GHz ?
5188824b185aSLuis R. Rodriguez AR9300_NUM_BAND_EDGES_2G : AR9300_NUM_BAND_EDGES_5G;
5189824b185aSLuis R. Rodriguez unsigned int edge;
5190824b185aSLuis R. Rodriguez
5191824b185aSLuis R. Rodriguez /* Get the edge power */
5192824b185aSLuis R. Rodriguez for (edge = 0;
51934ddfcd7dSFelix Fietkau (edge < num_edges) && (ctl_freqbin[edge] != AR5416_BCHAN_UNUSED);
5194824b185aSLuis R. Rodriguez edge++) {
5195824b185aSLuis R. Rodriguez /*
5196824b185aSLuis R. Rodriguez * If there's an exact channel match or an inband flag set
5197824b185aSLuis R. Rodriguez * on the lower channel use the given rdEdgePower
5198824b185aSLuis R. Rodriguez */
5199824b185aSLuis R. Rodriguez if (freq == ath9k_hw_fbin2freq(ctl_freqbin[edge], is2GHz)) {
5200824b185aSLuis R. Rodriguez twiceMaxEdgePower =
5201824b185aSLuis R. Rodriguez ar9003_hw_get_direct_edge_power(eep, idx,
5202824b185aSLuis R. Rodriguez edge, is2GHz);
5203824b185aSLuis R. Rodriguez break;
5204824b185aSLuis R. Rodriguez } else if ((edge > 0) &&
5205824b185aSLuis R. Rodriguez (freq < ath9k_hw_fbin2freq(ctl_freqbin[edge],
5206824b185aSLuis R. Rodriguez is2GHz))) {
5207824b185aSLuis R. Rodriguez twiceMaxEdgePower =
5208824b185aSLuis R. Rodriguez ar9003_hw_get_indirect_edge_power(eep, idx,
5209824b185aSLuis R. Rodriguez edge, freq,
5210824b185aSLuis R. Rodriguez is2GHz);
5211824b185aSLuis R. Rodriguez /*
5212824b185aSLuis R. Rodriguez * Leave loop - no more affecting edges possible in
5213824b185aSLuis R. Rodriguez * this monotonic increasing list
5214824b185aSLuis R. Rodriguez */
5215824b185aSLuis R. Rodriguez break;
5216824b185aSLuis R. Rodriguez }
5217824b185aSLuis R. Rodriguez }
52184cfe9a8dSSujith Manoharan
52194cfe9a8dSSujith Manoharan if (is2GHz && !twiceMaxEdgePower)
52204cfe9a8dSSujith Manoharan twiceMaxEdgePower = 60;
52214cfe9a8dSSujith Manoharan
5222824b185aSLuis R. Rodriguez return twiceMaxEdgePower;
5223824b185aSLuis R. Rodriguez }
5224824b185aSLuis R. Rodriguez
ar9003_hw_set_power_per_rate_table(struct ath_hw * ah,struct ath9k_channel * chan,u8 * pPwrArray,u16 cfgCtl,u8 antenna_reduction,u16 powerLimit)5225824b185aSLuis R. Rodriguez static void ar9003_hw_set_power_per_rate_table(struct ath_hw *ah,
5226824b185aSLuis R. Rodriguez struct ath9k_channel *chan,
5227824b185aSLuis R. Rodriguez u8 *pPwrArray, u16 cfgCtl,
5228ca2c68ccSFelix Fietkau u8 antenna_reduction,
5229824b185aSLuis R. Rodriguez u16 powerLimit)
5230824b185aSLuis R. Rodriguez {
5231824b185aSLuis R. Rodriguez struct ath_common *common = ath9k_hw_common(ah);
5232824b185aSLuis R. Rodriguez struct ar9300_eeprom *pEepData = &ah->eeprom.ar9300_eep;
5233a261f0e9SRajkumar Manoharan u16 twiceMaxEdgePower;
5234824b185aSLuis R. Rodriguez int i;
5235ca2c68ccSFelix Fietkau u16 scaledPower = 0, minCtlPower;
523607b2fa5aSJoe Perches static const u16 ctlModesFor11a[] = {
5237824b185aSLuis R. Rodriguez CTL_11A, CTL_5GHT20, CTL_11A_EXT, CTL_5GHT40
5238824b185aSLuis R. Rodriguez };
523907b2fa5aSJoe Perches static const u16 ctlModesFor11g[] = {
5240824b185aSLuis R. Rodriguez CTL_11B, CTL_11G, CTL_2GHT20, CTL_11B_EXT,
5241824b185aSLuis R. Rodriguez CTL_11G_EXT, CTL_2GHT40
5242824b185aSLuis R. Rodriguez };
524307b2fa5aSJoe Perches u16 numCtlModes;
524407b2fa5aSJoe Perches const u16 *pCtlMode;
524507b2fa5aSJoe Perches u16 ctlMode, freq;
5246824b185aSLuis R. Rodriguez struct chan_centers centers;
5247824b185aSLuis R. Rodriguez u8 *ctlIndex;
5248824b185aSLuis R. Rodriguez u8 ctlNum;
5249824b185aSLuis R. Rodriguez u16 twiceMinEdgePower;
5250824b185aSLuis R. Rodriguez bool is2ghz = IS_CHAN_2GHZ(chan);
5251824b185aSLuis R. Rodriguez
5252824b185aSLuis R. Rodriguez ath9k_hw_get_channel_centers(ah, chan, ¢ers);
5253ea6f792bSGabor Juhos scaledPower = ath9k_hw_get_scaled_power(ah, powerLimit,
5254ea6f792bSGabor Juhos antenna_reduction);
5255824b185aSLuis R. Rodriguez
5256824b185aSLuis R. Rodriguez if (is2ghz) {
5257824b185aSLuis R. Rodriguez /* Setup for CTL modes */
5258824b185aSLuis R. Rodriguez /* CTL_11B, CTL_11G, CTL_2GHT20 */
5259824b185aSLuis R. Rodriguez numCtlModes =
5260824b185aSLuis R. Rodriguez ARRAY_SIZE(ctlModesFor11g) -
5261824b185aSLuis R. Rodriguez SUB_NUM_CTL_MODES_AT_2G_40;
5262824b185aSLuis R. Rodriguez pCtlMode = ctlModesFor11g;
5263824b185aSLuis R. Rodriguez if (IS_CHAN_HT40(chan))
5264824b185aSLuis R. Rodriguez /* All 2G CTL's */
5265824b185aSLuis R. Rodriguez numCtlModes = ARRAY_SIZE(ctlModesFor11g);
5266824b185aSLuis R. Rodriguez } else {
5267824b185aSLuis R. Rodriguez /* Setup for CTL modes */
5268824b185aSLuis R. Rodriguez /* CTL_11A, CTL_5GHT20 */
5269824b185aSLuis R. Rodriguez numCtlModes = ARRAY_SIZE(ctlModesFor11a) -
5270824b185aSLuis R. Rodriguez SUB_NUM_CTL_MODES_AT_5G_40;
5271824b185aSLuis R. Rodriguez pCtlMode = ctlModesFor11a;
5272824b185aSLuis R. Rodriguez if (IS_CHAN_HT40(chan))
5273824b185aSLuis R. Rodriguez /* All 5G CTL's */
5274824b185aSLuis R. Rodriguez numCtlModes = ARRAY_SIZE(ctlModesFor11a);
5275824b185aSLuis R. Rodriguez }
5276824b185aSLuis R. Rodriguez
5277824b185aSLuis R. Rodriguez /*
5278824b185aSLuis R. Rodriguez * For MIMO, need to apply regulatory caps individually across
5279824b185aSLuis R. Rodriguez * dynamically running modes: CCK, OFDM, HT20, HT40
5280824b185aSLuis R. Rodriguez *
5281824b185aSLuis R. Rodriguez * The outer loop walks through each possible applicable runtime mode.
5282824b185aSLuis R. Rodriguez * The inner loop walks through each ctlIndex entry in EEPROM.
5283824b185aSLuis R. Rodriguez * The ctl value is encoded as [7:4] == test group, [3:0] == test mode.
5284824b185aSLuis R. Rodriguez */
5285824b185aSLuis R. Rodriguez for (ctlMode = 0; ctlMode < numCtlModes; ctlMode++) {
5286824b185aSLuis R. Rodriguez bool isHt40CtlMode = (pCtlMode[ctlMode] == CTL_5GHT40) ||
5287824b185aSLuis R. Rodriguez (pCtlMode[ctlMode] == CTL_2GHT40);
5288824b185aSLuis R. Rodriguez if (isHt40CtlMode)
5289824b185aSLuis R. Rodriguez freq = centers.synth_center;
5290824b185aSLuis R. Rodriguez else if (pCtlMode[ctlMode] & EXT_ADDITIVE)
5291824b185aSLuis R. Rodriguez freq = centers.ext_center;
5292824b185aSLuis R. Rodriguez else
5293824b185aSLuis R. Rodriguez freq = centers.ctl_center;
5294824b185aSLuis R. Rodriguez
5295d2182b69SJoe Perches ath_dbg(common, REGULATORY,
5296226afe68SJoe Perches "LOOP-Mode ctlMode %d < %d, isHt40CtlMode %d, EXT_ADDITIVE %d\n",
5297824b185aSLuis R. Rodriguez ctlMode, numCtlModes, isHt40CtlMode,
5298824b185aSLuis R. Rodriguez (pCtlMode[ctlMode] & EXT_ADDITIVE));
5299824b185aSLuis R. Rodriguez
5300824b185aSLuis R. Rodriguez /* walk through each CTL index stored in EEPROM */
5301824b185aSLuis R. Rodriguez if (is2ghz) {
5302824b185aSLuis R. Rodriguez ctlIndex = pEepData->ctlIndex_2G;
5303824b185aSLuis R. Rodriguez ctlNum = AR9300_NUM_CTLS_2G;
5304824b185aSLuis R. Rodriguez } else {
5305824b185aSLuis R. Rodriguez ctlIndex = pEepData->ctlIndex_5G;
5306824b185aSLuis R. Rodriguez ctlNum = AR9300_NUM_CTLS_5G;
5307824b185aSLuis R. Rodriguez }
5308824b185aSLuis R. Rodriguez
5309a261f0e9SRajkumar Manoharan twiceMaxEdgePower = MAX_RATE_POWER;
5310824b185aSLuis R. Rodriguez for (i = 0; (i < ctlNum) && ctlIndex[i]; i++) {
5311d2182b69SJoe Perches ath_dbg(common, REGULATORY,
5312226afe68SJoe Perches "LOOP-Ctlidx %d: cfgCtl 0x%2.2x pCtlMode 0x%2.2x ctlIndex 0x%2.2x chan %d\n",
5313824b185aSLuis R. Rodriguez i, cfgCtl, pCtlMode[ctlMode], ctlIndex[i],
5314824b185aSLuis R. Rodriguez chan->channel);
5315824b185aSLuis R. Rodriguez
5316824b185aSLuis R. Rodriguez /*
5317824b185aSLuis R. Rodriguez * compare test group from regulatory
5318824b185aSLuis R. Rodriguez * channel list with test mode from pCtlMode
5319824b185aSLuis R. Rodriguez * list
5320824b185aSLuis R. Rodriguez */
5321824b185aSLuis R. Rodriguez if ((((cfgCtl & ~CTL_MODE_M) |
5322824b185aSLuis R. Rodriguez (pCtlMode[ctlMode] & CTL_MODE_M)) ==
5323824b185aSLuis R. Rodriguez ctlIndex[i]) ||
5324824b185aSLuis R. Rodriguez (((cfgCtl & ~CTL_MODE_M) |
5325824b185aSLuis R. Rodriguez (pCtlMode[ctlMode] & CTL_MODE_M)) ==
5326824b185aSLuis R. Rodriguez ((ctlIndex[i] & CTL_MODE_M) |
5327824b185aSLuis R. Rodriguez SD_NO_CTL))) {
5328824b185aSLuis R. Rodriguez twiceMinEdgePower =
5329824b185aSLuis R. Rodriguez ar9003_hw_get_max_edge_power(pEepData,
5330824b185aSLuis R. Rodriguez freq, i,
5331824b185aSLuis R. Rodriguez is2ghz);
5332824b185aSLuis R. Rodriguez
5333824b185aSLuis R. Rodriguez if ((cfgCtl & ~CTL_MODE_M) == SD_NO_CTL)
5334824b185aSLuis R. Rodriguez /*
5335824b185aSLuis R. Rodriguez * Find the minimum of all CTL
5336824b185aSLuis R. Rodriguez * edge powers that apply to
5337824b185aSLuis R. Rodriguez * this channel
5338824b185aSLuis R. Rodriguez */
5339824b185aSLuis R. Rodriguez twiceMaxEdgePower =
5340824b185aSLuis R. Rodriguez min(twiceMaxEdgePower,
5341824b185aSLuis R. Rodriguez twiceMinEdgePower);
5342824b185aSLuis R. Rodriguez else {
5343824b185aSLuis R. Rodriguez /* specific */
53442a0b50c7SGabor Juhos twiceMaxEdgePower = twiceMinEdgePower;
5345824b185aSLuis R. Rodriguez break;
5346824b185aSLuis R. Rodriguez }
5347824b185aSLuis R. Rodriguez }
5348824b185aSLuis R. Rodriguez }
5349824b185aSLuis R. Rodriguez
5350824b185aSLuis R. Rodriguez minCtlPower = (u8)min(twiceMaxEdgePower, scaledPower);
5351824b185aSLuis R. Rodriguez
5352d2182b69SJoe Perches ath_dbg(common, REGULATORY,
5353226afe68SJoe Perches "SEL-Min ctlMode %d pCtlMode %d 2xMaxEdge %d sP %d minCtlPwr %d\n",
5354824b185aSLuis R. Rodriguez ctlMode, pCtlMode[ctlMode], twiceMaxEdgePower,
5355824b185aSLuis R. Rodriguez scaledPower, minCtlPower);
5356824b185aSLuis R. Rodriguez
5357824b185aSLuis R. Rodriguez /* Apply ctl mode to correct target power set */
5358824b185aSLuis R. Rodriguez switch (pCtlMode[ctlMode]) {
5359824b185aSLuis R. Rodriguez case CTL_11B:
5360824b185aSLuis R. Rodriguez for (i = ALL_TARGET_LEGACY_1L_5L;
5361824b185aSLuis R. Rodriguez i <= ALL_TARGET_LEGACY_11S; i++)
53622a0b50c7SGabor Juhos pPwrArray[i] = (u8)min((u16)pPwrArray[i],
5363824b185aSLuis R. Rodriguez minCtlPower);
5364824b185aSLuis R. Rodriguez break;
5365824b185aSLuis R. Rodriguez case CTL_11A:
5366824b185aSLuis R. Rodriguez case CTL_11G:
5367824b185aSLuis R. Rodriguez for (i = ALL_TARGET_LEGACY_6_24;
5368824b185aSLuis R. Rodriguez i <= ALL_TARGET_LEGACY_54; i++)
53692a0b50c7SGabor Juhos pPwrArray[i] = (u8)min((u16)pPwrArray[i],
5370824b185aSLuis R. Rodriguez minCtlPower);
5371824b185aSLuis R. Rodriguez break;
5372824b185aSLuis R. Rodriguez case CTL_5GHT20:
5373824b185aSLuis R. Rodriguez case CTL_2GHT20:
5374824b185aSLuis R. Rodriguez for (i = ALL_TARGET_HT20_0_8_16;
5375e82cb03fSRajkumar Manoharan i <= ALL_TARGET_HT20_23; i++) {
53762a0b50c7SGabor Juhos pPwrArray[i] = (u8)min((u16)pPwrArray[i],
5377824b185aSLuis R. Rodriguez minCtlPower);
5378e82cb03fSRajkumar Manoharan if (ath9k_hw_mci_is_enabled(ah))
5379e82cb03fSRajkumar Manoharan pPwrArray[i] =
5380e82cb03fSRajkumar Manoharan (u8)min((u16)pPwrArray[i],
5381e82cb03fSRajkumar Manoharan ar9003_mci_get_max_txpower(ah,
5382e82cb03fSRajkumar Manoharan pCtlMode[ctlMode]));
5383e82cb03fSRajkumar Manoharan }
5384824b185aSLuis R. Rodriguez break;
5385824b185aSLuis R. Rodriguez case CTL_5GHT40:
5386824b185aSLuis R. Rodriguez case CTL_2GHT40:
5387824b185aSLuis R. Rodriguez for (i = ALL_TARGET_HT40_0_8_16;
5388e82cb03fSRajkumar Manoharan i <= ALL_TARGET_HT40_23; i++) {
53892a0b50c7SGabor Juhos pPwrArray[i] = (u8)min((u16)pPwrArray[i],
5390824b185aSLuis R. Rodriguez minCtlPower);
5391e82cb03fSRajkumar Manoharan if (ath9k_hw_mci_is_enabled(ah))
5392e82cb03fSRajkumar Manoharan pPwrArray[i] =
5393e82cb03fSRajkumar Manoharan (u8)min((u16)pPwrArray[i],
5394e82cb03fSRajkumar Manoharan ar9003_mci_get_max_txpower(ah,
5395e82cb03fSRajkumar Manoharan pCtlMode[ctlMode]));
5396e82cb03fSRajkumar Manoharan }
5397824b185aSLuis R. Rodriguez break;
5398824b185aSLuis R. Rodriguez default:
5399824b185aSLuis R. Rodriguez break;
5400824b185aSLuis R. Rodriguez }
5401824b185aSLuis R. Rodriguez } /* end ctl mode checking */
5402824b185aSLuis R. Rodriguez }
5403824b185aSLuis R. Rodriguez
mcsidx_to_tgtpwridx(unsigned int mcs_idx,u8 base_pwridx)540445ef6a0bSVasanthakumar Thiagarajan static inline u8 mcsidx_to_tgtpwridx(unsigned int mcs_idx, u8 base_pwridx)
540545ef6a0bSVasanthakumar Thiagarajan {
540645ef6a0bSVasanthakumar Thiagarajan u8 mod_idx = mcs_idx % 8;
540745ef6a0bSVasanthakumar Thiagarajan
540845ef6a0bSVasanthakumar Thiagarajan if (mod_idx <= 3)
540945ef6a0bSVasanthakumar Thiagarajan return mod_idx ? (base_pwridx + 1) : base_pwridx;
541045ef6a0bSVasanthakumar Thiagarajan else
541145ef6a0bSVasanthakumar Thiagarajan return base_pwridx + 4 * (mcs_idx / 8) + mod_idx - 2;
541245ef6a0bSVasanthakumar Thiagarajan }
541345ef6a0bSVasanthakumar Thiagarajan
ar9003_paprd_set_txpower(struct ath_hw * ah,struct ath9k_channel * chan,u8 * targetPowerValT2)54141562580eSSujith Manoharan static void ar9003_paprd_set_txpower(struct ath_hw *ah,
54151562580eSSujith Manoharan struct ath9k_channel *chan,
54161562580eSSujith Manoharan u8 *targetPowerValT2)
54171562580eSSujith Manoharan {
54181562580eSSujith Manoharan int i;
54191562580eSSujith Manoharan
54201562580eSSujith Manoharan if (!ar9003_is_paprd_enabled(ah))
54211562580eSSujith Manoharan return;
54221562580eSSujith Manoharan
54231562580eSSujith Manoharan if (IS_CHAN_HT40(chan))
54241562580eSSujith Manoharan i = ALL_TARGET_HT40_7;
54251562580eSSujith Manoharan else
54261562580eSSujith Manoharan i = ALL_TARGET_HT20_7;
54271562580eSSujith Manoharan
54281562580eSSujith Manoharan if (IS_CHAN_2GHZ(chan)) {
54291562580eSSujith Manoharan if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah) &&
54301562580eSSujith Manoharan !AR_SREV_9462(ah) && !AR_SREV_9565(ah)) {
54311562580eSSujith Manoharan if (IS_CHAN_HT40(chan))
54321562580eSSujith Manoharan i = ALL_TARGET_HT40_0_8_16;
54331562580eSSujith Manoharan else
54341562580eSSujith Manoharan i = ALL_TARGET_HT20_0_8_16;
54351562580eSSujith Manoharan }
54361562580eSSujith Manoharan }
54371562580eSSujith Manoharan
54381562580eSSujith Manoharan ah->paprd_target_power = targetPowerValT2[i];
54391562580eSSujith Manoharan }
54401562580eSSujith Manoharan
ath9k_hw_ar9300_set_txpower(struct ath_hw * ah,struct ath9k_channel * chan,u16 cfgCtl,u8 twiceAntennaReduction,u8 powerLimit,bool test)544115c9ee7aSSenthil Balasubramanian static void ath9k_hw_ar9300_set_txpower(struct ath_hw *ah,
544215c9ee7aSSenthil Balasubramanian struct ath9k_channel *chan, u16 cfgCtl,
544315c9ee7aSSenthil Balasubramanian u8 twiceAntennaReduction,
5444de40f316SFelix Fietkau u8 powerLimit, bool test)
544515c9ee7aSSenthil Balasubramanian {
54466b7b6cf5SFelix Fietkau struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
5447824b185aSLuis R. Rodriguez struct ath_common *common = ath9k_hw_common(ah);
5448824b185aSLuis R. Rodriguez u8 targetPowerValT2[ar9300RateSize];
54497072bf62SVasanthakumar Thiagarajan u8 target_power_val_t2_eep[ar9300RateSize];
545023f53dd3SLorenzo Bianconi u8 targetPowerValT2_tpc[ar9300RateSize];
54517072bf62SVasanthakumar Thiagarajan unsigned int i = 0, paprd_scale_factor = 0;
545245ef6a0bSVasanthakumar Thiagarajan u8 pwr_idx, min_pwridx = 0;
5453824b185aSLuis R. Rodriguez
545475acd5a8SGabor Juhos memset(targetPowerValT2, 0 , sizeof(targetPowerValT2));
545575acd5a8SGabor Juhos
545675acd5a8SGabor Juhos /*
545775acd5a8SGabor Juhos * Get target powers from EEPROM - our baseline for TX Power
545875acd5a8SGabor Juhos */
545975acd5a8SGabor Juhos ar9003_hw_get_target_power_eeprom(ah, chan, targetPowerValT2);
54607072bf62SVasanthakumar Thiagarajan
54610f21ee8dSSujith Manoharan if (ar9003_is_paprd_enabled(ah)) {
5462f1a8abb0SFelix Fietkau ah->paprd_ratemask =
5463673424ceSWenli Looi ar9003_get_paprd_rate_mask_ht20(ah, IS_CHAN_2GHZ(chan)) &
5464f1a8abb0SFelix Fietkau AR9300_PAPRD_RATE_MASK;
5465f1a8abb0SFelix Fietkau
5466f1a8abb0SFelix Fietkau ah->paprd_ratemask_ht40 =
5467673424ceSWenli Looi ar9003_get_paprd_rate_mask_ht40(ah, IS_CHAN_2GHZ(chan)) &
5468f1a8abb0SFelix Fietkau AR9300_PAPRD_RATE_MASK;
54697072bf62SVasanthakumar Thiagarajan
547045ef6a0bSVasanthakumar Thiagarajan paprd_scale_factor = ar9003_get_paprd_scale_factor(ah, chan);
547145ef6a0bSVasanthakumar Thiagarajan min_pwridx = IS_CHAN_HT40(chan) ? ALL_TARGET_HT40_0_8_16 :
547245ef6a0bSVasanthakumar Thiagarajan ALL_TARGET_HT20_0_8_16;
547345ef6a0bSVasanthakumar Thiagarajan
547445ef6a0bSVasanthakumar Thiagarajan if (!ah->paprd_table_write_done) {
547545ef6a0bSVasanthakumar Thiagarajan memcpy(target_power_val_t2_eep, targetPowerValT2,
547645ef6a0bSVasanthakumar Thiagarajan sizeof(targetPowerValT2));
547745ef6a0bSVasanthakumar Thiagarajan for (i = 0; i < 24; i++) {
547845ef6a0bSVasanthakumar Thiagarajan pwr_idx = mcsidx_to_tgtpwridx(i, min_pwridx);
547945ef6a0bSVasanthakumar Thiagarajan if (ah->paprd_ratemask & (1 << i)) {
548045ef6a0bSVasanthakumar Thiagarajan if (targetPowerValT2[pwr_idx] &&
548145ef6a0bSVasanthakumar Thiagarajan targetPowerValT2[pwr_idx] ==
548245ef6a0bSVasanthakumar Thiagarajan target_power_val_t2_eep[pwr_idx])
548345ef6a0bSVasanthakumar Thiagarajan targetPowerValT2[pwr_idx] -=
548445ef6a0bSVasanthakumar Thiagarajan paprd_scale_factor;
548545ef6a0bSVasanthakumar Thiagarajan }
548645ef6a0bSVasanthakumar Thiagarajan }
548745ef6a0bSVasanthakumar Thiagarajan }
54887072bf62SVasanthakumar Thiagarajan memcpy(target_power_val_t2_eep, targetPowerValT2,
54897072bf62SVasanthakumar Thiagarajan sizeof(targetPowerValT2));
54907072bf62SVasanthakumar Thiagarajan }
54917072bf62SVasanthakumar Thiagarajan
5492824b185aSLuis R. Rodriguez ar9003_hw_set_power_per_rate_table(ah, chan,
5493824b185aSLuis R. Rodriguez targetPowerValT2, cfgCtl,
5494824b185aSLuis R. Rodriguez twiceAntennaReduction,
5495824b185aSLuis R. Rodriguez powerLimit);
5496824b185aSLuis R. Rodriguez
549723f53dd3SLorenzo Bianconi memcpy(targetPowerValT2_tpc, targetPowerValT2,
549823f53dd3SLorenzo Bianconi sizeof(targetPowerValT2));
549923f53dd3SLorenzo Bianconi
55000f21ee8dSSujith Manoharan if (ar9003_is_paprd_enabled(ah)) {
55017072bf62SVasanthakumar Thiagarajan for (i = 0; i < ar9300RateSize; i++) {
55027072bf62SVasanthakumar Thiagarajan if ((ah->paprd_ratemask & (1 << i)) &&
55037072bf62SVasanthakumar Thiagarajan (abs(targetPowerValT2[i] -
55047072bf62SVasanthakumar Thiagarajan target_power_val_t2_eep[i]) >
55057072bf62SVasanthakumar Thiagarajan paprd_scale_factor)) {
55067072bf62SVasanthakumar Thiagarajan ah->paprd_ratemask &= ~(1 << i);
5507d2182b69SJoe Perches ath_dbg(common, EEPROM,
55087072bf62SVasanthakumar Thiagarajan "paprd disabled for mcs %d\n", i);
55097072bf62SVasanthakumar Thiagarajan }
55107072bf62SVasanthakumar Thiagarajan }
55117072bf62SVasanthakumar Thiagarajan }
55127072bf62SVasanthakumar Thiagarajan
5513de40f316SFelix Fietkau regulatory->max_power_level = 0;
5514de40f316SFelix Fietkau for (i = 0; i < ar9300RateSize; i++) {
5515de40f316SFelix Fietkau if (targetPowerValT2[i] > regulatory->max_power_level)
5516de40f316SFelix Fietkau regulatory->max_power_level = targetPowerValT2[i];
5517de40f316SFelix Fietkau }
5518de40f316SFelix Fietkau
55198915f980SRajkumar Manoharan ath9k_hw_update_regulatory_maxpower(ah);
55208915f980SRajkumar Manoharan
5521de40f316SFelix Fietkau if (test)
5522de40f316SFelix Fietkau return;
5523de40f316SFelix Fietkau
5524de40f316SFelix Fietkau for (i = 0; i < ar9300RateSize; i++) {
5525df401907SSujith Manoharan ath_dbg(common, REGULATORY, "TPC[%02d] 0x%08x\n",
5526d2182b69SJoe Perches i, targetPowerValT2[i]);
5527824b185aSLuis R. Rodriguez }
5528824b185aSLuis R. Rodriguez
5529de40f316SFelix Fietkau /* Write target power array to registers */
5530de40f316SFelix Fietkau ar9003_hw_tx_power_regwrite(ah, targetPowerValT2);
553115c9ee7aSSenthil Balasubramanian ar9003_hw_calibration_apply(ah, chan->channel);
55321562580eSSujith Manoharan ar9003_paprd_set_txpower(ah, chan, targetPowerValT2);
553323f53dd3SLorenzo Bianconi
553423f53dd3SLorenzo Bianconi ar9003_hw_selfgen_tpc_txpower(ah, chan, targetPowerValT2);
553523f53dd3SLorenzo Bianconi
553623f53dd3SLorenzo Bianconi /* TPC initializations */
553723f53dd3SLorenzo Bianconi if (ah->tpc_enabled) {
553823f53dd3SLorenzo Bianconi u32 val;
553923f53dd3SLorenzo Bianconi
554023f53dd3SLorenzo Bianconi ar9003_hw_init_rate_txpower(ah, targetPowerValT2_tpc, chan);
554123f53dd3SLorenzo Bianconi
554223f53dd3SLorenzo Bianconi /* Enable TPC */
554323f53dd3SLorenzo Bianconi REG_WRITE(ah, AR_PHY_PWRTX_MAX,
554423f53dd3SLorenzo Bianconi AR_PHY_POWER_TX_RATE_MAX_TPC_ENABLE);
554523f53dd3SLorenzo Bianconi /* Disable per chain power reduction */
554623f53dd3SLorenzo Bianconi val = REG_READ(ah, AR_PHY_POWER_TX_SUB);
554723f53dd3SLorenzo Bianconi if (AR_SREV_9340(ah))
554823f53dd3SLorenzo Bianconi REG_WRITE(ah, AR_PHY_POWER_TX_SUB,
554923f53dd3SLorenzo Bianconi val & 0xFFFFFFC0);
555023f53dd3SLorenzo Bianconi else
555123f53dd3SLorenzo Bianconi REG_WRITE(ah, AR_PHY_POWER_TX_SUB,
555223f53dd3SLorenzo Bianconi val & 0xFFFFF000);
555323f53dd3SLorenzo Bianconi } else {
555423f53dd3SLorenzo Bianconi /* Disable TPC */
555523f53dd3SLorenzo Bianconi REG_WRITE(ah, AR_PHY_PWRTX_MAX, 0);
555623f53dd3SLorenzo Bianconi }
555715c9ee7aSSenthil Balasubramanian }
555815c9ee7aSSenthil Balasubramanian
ath9k_hw_ar9300_get_spur_channel(struct ath_hw * ah,u16 i,bool is2GHz)555915c9ee7aSSenthil Balasubramanian static u16 ath9k_hw_ar9300_get_spur_channel(struct ath_hw *ah,
556015c9ee7aSSenthil Balasubramanian u16 i, bool is2GHz)
556115c9ee7aSSenthil Balasubramanian {
556215c9ee7aSSenthil Balasubramanian return AR_NO_SPUR;
556315c9ee7aSSenthil Balasubramanian }
556415c9ee7aSSenthil Balasubramanian
ar9003_hw_get_tx_gain_idx(struct ath_hw * ah)5565c14a85daSLuis R. Rodriguez s32 ar9003_hw_get_tx_gain_idx(struct ath_hw *ah)
5566c14a85daSLuis R. Rodriguez {
5567c14a85daSLuis R. Rodriguez struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
5568c14a85daSLuis R. Rodriguez
5569c14a85daSLuis R. Rodriguez return (eep->baseEepHeader.txrxgain >> 4) & 0xf; /* bits 7:4 */
5570c14a85daSLuis R. Rodriguez }
5571c14a85daSLuis R. Rodriguez
ar9003_hw_get_rx_gain_idx(struct ath_hw * ah)5572c14a85daSLuis R. Rodriguez s32 ar9003_hw_get_rx_gain_idx(struct ath_hw *ah)
5573c14a85daSLuis R. Rodriguez {
5574c14a85daSLuis R. Rodriguez struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
5575c14a85daSLuis R. Rodriguez
5576c14a85daSLuis R. Rodriguez return (eep->baseEepHeader.txrxgain) & 0xf; /* bits 3:0 */
5577c14a85daSLuis R. Rodriguez }
5578c14a85daSLuis R. Rodriguez
ar9003_get_spur_chan_ptr(struct ath_hw * ah,bool is2ghz)55790aefc591SFelix Fietkau u8 *ar9003_get_spur_chan_ptr(struct ath_hw *ah, bool is2ghz)
5580272ceba8SVasanthakumar Thiagarajan {
55810aefc591SFelix Fietkau return ar9003_modal_header(ah, is2ghz)->spurChans;
5582272ceba8SVasanthakumar Thiagarajan }
5583272ceba8SVasanthakumar Thiagarajan
ar9003_get_paprd_rate_mask_ht20(struct ath_hw * ah,bool is2ghz)5584673424ceSWenli Looi u32 ar9003_get_paprd_rate_mask_ht20(struct ath_hw *ah, bool is2ghz)
5585673424ceSWenli Looi {
5586673424ceSWenli Looi return le32_to_cpu(ar9003_modal_header(ah, is2ghz)->papdRateMaskHt20);
5587673424ceSWenli Looi }
5588673424ceSWenli Looi
ar9003_get_paprd_rate_mask_ht40(struct ath_hw * ah,bool is2ghz)5589673424ceSWenli Looi u32 ar9003_get_paprd_rate_mask_ht40(struct ath_hw *ah, bool is2ghz)
5590673424ceSWenli Looi {
5591673424ceSWenli Looi return le32_to_cpu(ar9003_modal_header(ah, is2ghz)->papdRateMaskHt40);
5592673424ceSWenli Looi }
5593673424ceSWenli Looi
ar9003_get_paprd_scale_factor(struct ath_hw * ah,struct ath9k_channel * chan)55948698bca6SVasanthakumar Thiagarajan unsigned int ar9003_get_paprd_scale_factor(struct ath_hw *ah,
55958698bca6SVasanthakumar Thiagarajan struct ath9k_channel *chan)
55968698bca6SVasanthakumar Thiagarajan {
5597673424ceSWenli Looi bool is2ghz = IS_CHAN_2GHZ(chan);
55988698bca6SVasanthakumar Thiagarajan
5599673424ceSWenli Looi if (is2ghz)
5600673424ceSWenli Looi return MS(ar9003_get_paprd_rate_mask_ht20(ah, is2ghz),
56018698bca6SVasanthakumar Thiagarajan AR9300_PAPRD_SCALE_1);
56028698bca6SVasanthakumar Thiagarajan else {
56038698bca6SVasanthakumar Thiagarajan if (chan->channel >= 5700)
5604673424ceSWenli Looi return MS(ar9003_get_paprd_rate_mask_ht20(ah, is2ghz),
56058698bca6SVasanthakumar Thiagarajan AR9300_PAPRD_SCALE_1);
56068698bca6SVasanthakumar Thiagarajan else if (chan->channel >= 5400)
5607673424ceSWenli Looi return MS(ar9003_get_paprd_rate_mask_ht40(ah, is2ghz),
56088698bca6SVasanthakumar Thiagarajan AR9300_PAPRD_SCALE_2);
56098698bca6SVasanthakumar Thiagarajan else
5610673424ceSWenli Looi return MS(ar9003_get_paprd_rate_mask_ht40(ah, is2ghz),
56118698bca6SVasanthakumar Thiagarajan AR9300_PAPRD_SCALE_1);
56128698bca6SVasanthakumar Thiagarajan }
56138698bca6SVasanthakumar Thiagarajan }
56148698bca6SVasanthakumar Thiagarajan
ar9003_get_eepmisc(struct ath_hw * ah)5615d8ec2e2aSMartin Blumenstingl static u8 ar9003_get_eepmisc(struct ath_hw *ah)
5616d8ec2e2aSMartin Blumenstingl {
56179aaff386SWenli Looi return ah->eeprom.ar9300_eep.baseEepHeader.opCapFlags.eepMisc;
5618d8ec2e2aSMartin Blumenstingl }
5619d8ec2e2aSMartin Blumenstingl
562015c9ee7aSSenthil Balasubramanian const struct eeprom_ops eep_ar9300_ops = {
562115c9ee7aSSenthil Balasubramanian .check_eeprom = ath9k_hw_ar9300_check_eeprom,
562215c9ee7aSSenthil Balasubramanian .get_eeprom = ath9k_hw_ar9300_get_eeprom,
562315c9ee7aSSenthil Balasubramanian .fill_eeprom = ath9k_hw_ar9300_fill_eeprom,
562426526202SRajkumar Manoharan .dump_eeprom = ath9k_hw_ar9003_dump_eeprom,
562515c9ee7aSSenthil Balasubramanian .get_eeprom_ver = ath9k_hw_ar9300_get_eeprom_ver,
562615c9ee7aSSenthil Balasubramanian .get_eeprom_rev = ath9k_hw_ar9300_get_eeprom_rev,
562715c9ee7aSSenthil Balasubramanian .set_board_values = ath9k_hw_ar9300_set_board_values,
562815c9ee7aSSenthil Balasubramanian .set_addac = ath9k_hw_ar9300_set_addac,
562915c9ee7aSSenthil Balasubramanian .set_txpower = ath9k_hw_ar9300_set_txpower,
5630d8ec2e2aSMartin Blumenstingl .get_spur_channel = ath9k_hw_ar9300_get_spur_channel,
5631d8ec2e2aSMartin Blumenstingl .get_eepmisc = ar9003_get_eepmisc
563215c9ee7aSSenthil Balasubramanian };
5633