xref: /openbsd/sys/dev/ic/ar5416reg.h (revision 8529ddd3)
1 /*	$OpenBSD: ar5416reg.h,v 1.5 2012/10/20 09:54:20 stsp Exp $	*/
2 
3 /*-
4  * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
5  * Copyright (c) 2008-2009 Atheros Communications Inc.
6  *
7  * Permission to use, copy, modify, and/or distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #define AR5416_MAX_CHAINS	3
21 
22 #define AR5416_PHY_CCA_MAX_GOOD_VALUE	( -85)
23 
24 /*
25  * ROM layout used by AR5416, AR9160 and AR9280.
26  */
27 #define AR5416_EEP_START_LOC		256
28 #define AR5416_NUM_5G_CAL_PIERS		8
29 #define AR5416_NUM_2G_CAL_PIERS		4
30 #define AR5416_NUM_5G_20_TARGET_POWERS	8
31 #define AR5416_NUM_5G_40_TARGET_POWERS	8
32 #define AR5416_NUM_2G_CCK_TARGET_POWERS	3
33 #define AR5416_NUM_2G_20_TARGET_POWERS	4
34 #define AR5416_NUM_2G_40_TARGET_POWERS	4
35 #define AR5416_NUM_CTLS			24
36 #define AR5416_NUM_BAND_EDGES		8
37 #define AR5416_NUM_PD_GAINS		4
38 #define AR5416_PD_GAINS_IN_MASK		4
39 #define AR5416_PD_GAIN_ICEPTS		5
40 
41 struct ar5416_base_eep_header {
42 	uint16_t	length;
43 	uint16_t	checksum;
44 	uint16_t	version;
45 	uint8_t		opCapFlags;
46 	uint8_t		eepMisc;
47 	uint16_t	regDmn[2];
48 	uint8_t		macAddr[6];
49 	uint8_t		rxMask;
50 	uint8_t		txMask;
51 	uint16_t	rfSilent;
52 	uint16_t	blueToothOptions;
53 	uint16_t	deviceCap;
54 	uint32_t	binBuildNumber;
55 	uint8_t		deviceType;
56 	/* End of common header. */
57 	uint8_t		pwdclkind;
58 	uint8_t		fastClk5g;
59 	uint8_t		divChain;
60 	uint8_t		rxGainType;
61 #define AR5416_EEP_RXGAIN_23DB_BACKOFF	0
62 #define AR5416_EEP_RXGAIN_13DB_BACKOFF	1
63 #define AR5416_EEP_RXGAIN_ORIG		2
64 
65 	uint8_t		dacHiPwrMode_5G;
66 	uint8_t		openLoopPwrCntl;
67 	uint8_t		dacLpMode;
68 	uint8_t		txGainType;
69 	uint8_t		rcChainMask;
70 	uint8_t		desiredScaleCCK;
71 	uint8_t		pwrTableOffset;
72 	uint8_t		frac_n_5g;
73 	uint8_t		futureBase[21];
74 } __packed;
75 
76 struct ar5416_modal_eep_header {
77 	uint32_t	antCtrlChain[AR5416_MAX_CHAINS];
78 	uint32_t	antCtrlCommon;
79 	uint8_t		antennaGainCh[AR5416_MAX_CHAINS];
80 	uint8_t		switchSettling;
81 	uint8_t		txRxAttenCh[AR5416_MAX_CHAINS];
82 	uint8_t		rxTxMarginCh[AR5416_MAX_CHAINS];
83 	uint8_t		adcDesiredSize;
84 	uint8_t		pgaDesiredSize;
85 	uint8_t		xlnaGainCh[AR5416_MAX_CHAINS];
86 	uint8_t		txEndToXpaOff;
87 	uint8_t		txEndToRxOn;
88 	uint8_t		txFrameToXpaOn;
89 	uint8_t		thresh62;
90 	uint8_t		noiseFloorThreshCh[AR5416_MAX_CHAINS];
91 	uint8_t		xpdGain;
92 	uint8_t		xpd;
93 	uint8_t		iqCalICh[AR5416_MAX_CHAINS];
94 	uint8_t		iqCalQCh[AR5416_MAX_CHAINS];
95 	uint8_t		pdGainOverlap;
96 	uint8_t		ob;
97 	uint8_t		db;
98 	uint8_t		xpaBiasLvl;
99 	uint8_t		pwrDecreaseFor2Chain;
100 	uint8_t		pwrDecreaseFor3Chain;
101 	uint8_t		txFrameToDataStart;
102 	uint8_t		txFrameToPaOn;
103 	uint8_t		ht40PowerIncForPdadc;
104 	uint8_t		bswAtten[AR5416_MAX_CHAINS];
105 	uint8_t		bswMargin[AR5416_MAX_CHAINS];
106 	uint8_t		swSettleHt40;
107 	uint8_t		xatten2Db[AR5416_MAX_CHAINS];
108 	uint8_t		xatten2Margin[AR5416_MAX_CHAINS];
109 	uint8_t		ob_ch1;
110 	uint8_t		db_ch1;
111 	uint8_t		flagBits;
112 #define AR5416_EEP_FLAG_USEANT1		0x01
113 #define AR5416_EEP_FLAG_FORCEXPAON	0x02
114 #define AR5416_EEP_FLAG_LOCALBIAS	0x04
115 #define AR5416_EEP_FLAG_FEMBANDSELECT	0x08
116 #define AR5416_EEP_FLAG_XLNABUFIN	0x10
117 #define AR5416_EEP_FLAG_XLNAISEL_M	0x60
118 #define AR5416_EEP_FLAG_XLNAISEL_S	5
119 #define AR5416_EEP_FLAG_XLNABUFMODE	0x80
120 
121 	uint8_t		miscBits;
122 #define AR5416_EEP_MISC_TX_DAC_SCALE_CCK_M	0x03
123 #define AR5416_EEP_MISC_TX_DAC_SCALE_CCK_S	0
124 #define AR5416_EEP_MISC_TX_CLIP_M		0xfc
125 #define AR5416_EEP_MISC_TX_CLIP_S		2
126 
127 	uint16_t	xpaBiasLvlFreq[3];
128 	uint8_t		futureModal[6];
129 	struct		ar_spur_chan spurChans[AR_EEPROM_MODAL_SPURS];
130 } __packed;
131 
132 struct ar5416_cal_data_per_freq {
133 	uint8_t	pwrPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
134 	uint8_t	vpdPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
135 } __packed;
136 
137 struct ar5416_cal_ctl_data {
138 	struct ar_cal_ctl_edges
139 	    ctlEdges[AR5416_MAX_CHAINS][AR5416_NUM_BAND_EDGES];
140 } __packed;
141 
142 struct ar5416_eeprom {
143 	struct	ar5416_base_eep_header baseEepHeader;
144 	uint8_t custData[64];
145 	struct	ar5416_modal_eep_header modalHeader[2];
146 	uint8_t calFreqPier5G[AR5416_NUM_5G_CAL_PIERS];
147 	uint8_t calFreqPier2G[AR5416_NUM_2G_CAL_PIERS];
148 	struct	ar5416_cal_data_per_freq
149 	    calPierData5G[AR5416_MAX_CHAINS][AR5416_NUM_5G_CAL_PIERS];
150 	struct	ar5416_cal_data_per_freq
151 	    calPierData2G[AR5416_MAX_CHAINS][AR5416_NUM_2G_CAL_PIERS];
152 	struct	ar_cal_target_power_leg
153 	    calTargetPower5G[AR5416_NUM_5G_20_TARGET_POWERS];
154 	struct	ar_cal_target_power_ht
155 	    calTargetPower5GHT20[AR5416_NUM_5G_20_TARGET_POWERS];
156 	struct	ar_cal_target_power_ht
157 	    calTargetPower5GHT40[AR5416_NUM_5G_40_TARGET_POWERS];
158 	struct	ar_cal_target_power_leg
159 	    calTargetPowerCck[AR5416_NUM_2G_CCK_TARGET_POWERS];
160 	struct	ar_cal_target_power_leg
161 	    calTargetPower2G[AR5416_NUM_2G_20_TARGET_POWERS];
162 	struct	ar_cal_target_power_ht
163 	    calTargetPower2GHT20[AR5416_NUM_2G_20_TARGET_POWERS];
164 	struct	ar_cal_target_power_ht
165 	    calTargetPower2GHT40[AR5416_NUM_2G_40_TARGET_POWERS];
166 	uint8_t	ctlIndex[AR5416_NUM_CTLS];
167 	struct	ar5416_cal_ctl_data ctlData[AR5416_NUM_CTLS];
168 	uint8_t padding;
169 } __packed;
170 
171 /* Macro to "pack" registers to 16-bit to save some .rodata space. */
172 #define P(x)	(x)
173 
174 /*
175  * AR5416 initialization values.
176  */
177 static const uint16_t ar5416_regs[] = {
178 	P(0x01030), P(0x01070), P(0x010b0), P(0x010f0), P(0x08014),
179 	P(0x0801c), P(0x08120), P(0x081d0), P(0x09804), P(0x09820),
180 	P(0x09824), P(0x09828), P(0x09834), P(0x09838), P(0x09844),
181 	P(0x09848), P(0x0a848), P(0x0b848), P(0x09850), P(0x09858),
182 	P(0x0985c), P(0x09860), P(0x09864), P(0x09868), P(0x0986c),
183 	P(0x09914), P(0x09918), P(0x09924), P(0x09944), P(0x09960),
184 	P(0x0a960), P(0x0b960), P(0x09964), P(0x099bc), P(0x099c0),
185 	P(0x099c4), P(0x099c8), P(0x099cc), P(0x099d0), P(0x099d4),
186 	P(0x099d8), P(0x0a204), P(0x0a208), P(0x0a20c), P(0x0b20c),
187 	P(0x0c20c), P(0x0a21c), P(0x0a230), P(0x0a274), P(0x0a300),
188 	P(0x0a304), P(0x0a308), P(0x0a30c), P(0x0a310), P(0x0a314),
189 	P(0x0a318), P(0x0a31c), P(0x0a320), P(0x0a324), P(0x0a328),
190 	P(0x0a32c), P(0x0a330), P(0x0a334)
191 };
192 
193 static const uint32_t ar5416_vals_5g20[] = {
194 	0x00000230, 0x00000168, 0x00000e60, 0x0000a000, 0x03e803e8,
195 	0x128d93a7, 0x08f04800, 0x00003210, 0x00000300, 0x02020200,
196 	0x00000e0e, 0x0a020001, 0x00000e0e, 0x00000007, 0x1372161e,
197 	0x001a6a65, 0x001a6a65, 0x001a6a65, 0x6c48b4e0, 0x7ec82d2e,
198 	0x31395d5e, 0x00049d18, 0x0001ce00, 0x409a4190, 0x050cb081,
199 	0x000007d0, 0x000001b8, 0xd0058a0b, 0xffb81020, 0x00000900,
200 	0x00000900, 0x00000900, 0x00000000, 0x001a0a00, 0x038919be,
201 	0x06336f77, 0x6af6532c, 0x08f186c8, 0x00046384, 0x00000000,
202 	0x00000000, 0x00000880, 0xd6be4788, 0x002ec1e0, 0x002ec1e0,
203 	0x002ec1e0, 0x1883800a, 0x00000000, 0x0a1a9caa, 0x18010000,
204 	0x30032602, 0x48073e06, 0x560b4c0a, 0x641a600f, 0x7a4f6e1b,
205 	0x8c5b7e5a, 0x9d0f96cf, 0xb51fa69f, 0xcb3fbd07, 0x0000d7bf,
206 	0x00000000, 0x00000000, 0x00000000
207 };
208 
209 #ifndef IEEE80211_NO_HT
210 static const uint32_t ar5416_vals_5g40[] = {
211 	0x00000460, 0x000002d0, 0x00001cc0, 0x00014000, 0x07d007d0,
212 	0x128d93cf, 0x08f04800, 0x00003210, 0x000003c4, 0x02020200,
213 	0x00000e0e, 0x0a020001, 0x00000e0e, 0x00000007, 0x1372161e,
214 	0x001a6a65, 0x001a6a65, 0x001a6a65, 0x6d48b4e0, 0x7ec82d2e,
215 	0x3139605e, 0x00049d18, 0x0001ce00, 0x409a4190, 0x050cb081,
216 	0x00000fa0, 0x00000370, 0xd0058a0b, 0xffb81020, 0x00000900,
217 	0x00000900, 0x00000900, 0x00000000, 0x001a0a00, 0x038919be,
218 	0x06336f77, 0x6af6532c, 0x08f186c8, 0x00046384, 0x00000000,
219 	0x00000000, 0x00000880, 0xd6be4788, 0x002ec1e0, 0x002ec1e0,
220 	0x002ec1e0, 0x1883800a, 0x00000000, 0x0a1a9caa, 0x18010000,
221 	0x30032602, 0x48073e06, 0x560b4c0a, 0x641a600f, 0x7a4f6e1b,
222 	0x8c5b7e5a, 0x9d0f96cf, 0xb51fa69f, 0xcb3fbcbf, 0x0000d7bf,
223 	0x00000000, 0x00000000, 0x00000000
224 };
225 
226 static const uint32_t ar5416_vals_2g40[] = {
227 	0x000002c0, 0x00000318, 0x00007c70, 0x00016000, 0x10801600,
228 	0x12e013d7, 0x08f04810, 0x0000320a, 0x000003c4, 0x02020200,
229 	0x00000e0e, 0x0a020001, 0x00000e0e, 0x00000007, 0x137216a0,
230 	0x00197a68, 0x00197a68, 0x00197a68, 0x6d48b0de, 0x7ec82d2e,
231 	0x3139605e, 0x00049d18, 0x0001ce00, 0x409a4190, 0x050cb081,
232 	0x00001130, 0x00000268, 0xd0058a0b, 0xffb81020, 0x00012d80,
233 	0x00012d80, 0x00012d80, 0x00001120, 0x001a0a00, 0x038919be,
234 	0x06336f77, 0x6af6532c, 0x08f186c8, 0x00046384, 0x00000000,
235 	0x00000000, 0x00000880, 0xd03e4788, 0x002ac120, 0x002ac120,
236 	0x002ac120, 0x1883800a, 0x00000210, 0x0a1a7caa, 0x18010000,
237 	0x2e032402, 0x4a0a3c06, 0x621a540b, 0x764f6c1b, 0x845b7a5a,
238 	0x950f8ccf, 0xa5cf9b4f, 0xbddfaf1f, 0xd1ffc93f, 0x00000000,
239 	0x00000000, 0x00000000, 0x00000000
240 };
241 #endif
242 
243 static const uint32_t ar5416_vals_2g20[] = {
244 	0x00000160, 0x0000018c, 0x00003e38, 0x0000b000, 0x08400b00,
245 	0x12e013ab, 0x08f04810, 0x0000320a, 0x00000300, 0x02020200,
246 	0x00000e0e, 0x0a020001, 0x00000e0e, 0x00000007, 0x137216a0,
247 	0x00197a68, 0x00197a68, 0x00197a68, 0x6c48b0de, 0x7ec82d2e,
248 	0x31395d5e, 0x00049d18, 0x0001ce00, 0x409a4190, 0x050cb081,
249 	0x00000898, 0x00000134, 0xd0058a0b, 0xffb81020, 0x00012d80,
250 	0x00012d80, 0x00012d80, 0x00001120, 0x001a0a00, 0x038919be,
251 	0x06336f77, 0x6af6532c, 0x08f186c8, 0x00046384, 0x00000000,
252 	0x00000000, 0x00000880, 0xd03e4788, 0x002ac120, 0x002ac120,
253 	0x002ac120, 0x1883800a, 0x00000108, 0x0a1a7caa, 0x18010000,
254 	0x2e032402, 0x4a0a3c06, 0x621a540b, 0x764f6c1b, 0x845b7a5a,
255 	0x950f8ccf, 0xa5cf9b4f, 0xbddfaf1f, 0xd1ffc93f, 0x00000000,
256 	0x00000000, 0x00000000, 0x00000000
257 };
258 
259 static const uint16_t ar5416_cm_regs[] = {
260 	P(0x0000c), P(0x00030), P(0x00034), P(0x00040), P(0x00044),
261 	P(0x00048), P(0x0004c), P(0x00050), P(0x00054), P(0x00800),
262 	P(0x00804), P(0x00808), P(0x0080c), P(0x00810), P(0x00814),
263 	P(0x00818), P(0x0081c), P(0x00820), P(0x00824), P(0x01040),
264 	P(0x01044), P(0x01048), P(0x0104c), P(0x01050), P(0x01054),
265 	P(0x01058), P(0x0105c), P(0x01060), P(0x01064), P(0x01230),
266 	P(0x01270), P(0x01038), P(0x01078), P(0x010b8), P(0x010f8),
267 	P(0x01138), P(0x01178), P(0x011b8), P(0x011f8), P(0x01238),
268 	P(0x01278), P(0x012b8), P(0x012f8), P(0x01338), P(0x01378),
269 	P(0x013b8), P(0x013f8), P(0x01438), P(0x01478), P(0x014b8),
270 	P(0x014f8), P(0x01538), P(0x01578), P(0x015b8), P(0x015f8),
271 	P(0x01638), P(0x01678), P(0x016b8), P(0x016f8), P(0x01738),
272 	P(0x01778), P(0x017b8), P(0x017f8), P(0x0103c), P(0x0107c),
273 	P(0x010bc), P(0x010fc), P(0x0113c), P(0x0117c), P(0x011bc),
274 	P(0x011fc), P(0x0123c), P(0x0127c), P(0x012bc), P(0x012fc),
275 	P(0x0133c), P(0x0137c), P(0x013bc), P(0x013fc), P(0x0143c),
276 	P(0x0147c), P(0x04030), P(0x0403c), P(0x07010), P(0x07038),
277 	P(0x08004), P(0x08008), P(0x0800c), P(0x08018), P(0x08020),
278 	P(0x08038), P(0x0803c), P(0x08048), P(0x08054), P(0x08058),
279 	P(0x0805c), P(0x08060), P(0x08064), P(0x080c0), P(0x080c4),
280 	P(0x080c8), P(0x080cc), P(0x080d0), P(0x080d4), P(0x080d8),
281 	P(0x080e0), P(0x080e4), P(0x080e8), P(0x080ec), P(0x080f0),
282 	P(0x080f4), P(0x080f8), P(0x080fc), P(0x08100), P(0x08104),
283 	P(0x08108), P(0x0810c), P(0x08110), P(0x08118), P(0x0811c),
284 	P(0x08124), P(0x08128), P(0x0812c), P(0x08130), P(0x08134),
285 	P(0x08138), P(0x0813c), P(0x08144), P(0x08168), P(0x0816c),
286 	P(0x08170), P(0x08174), P(0x08178), P(0x0817c), P(0x081c4),
287 	P(0x081ec), P(0x081f0), P(0x081f4), P(0x081f8), P(0x081fc),
288 	P(0x08200), P(0x08204), P(0x08208), P(0x0820c), P(0x08210),
289 	P(0x08214), P(0x08218), P(0x0821c), P(0x08220), P(0x08224),
290 	P(0x08228), P(0x0822c), P(0x08230), P(0x08234), P(0x08238),
291 	P(0x0823c), P(0x08240), P(0x08244), P(0x08248), P(0x0824c),
292 	P(0x08250), P(0x08254), P(0x08258), P(0x0825c), P(0x08260),
293 	P(0x08264), P(0x08270), P(0x08274), P(0x08278), P(0x0827c),
294 	P(0x08284), P(0x08288), P(0x0828c), P(0x08294), P(0x08298),
295 	P(0x08300), P(0x08304), P(0x08308), P(0x0830c), P(0x08310),
296 	P(0x08314), P(0x08318), P(0x08328), P(0x0832c), P(0x08330),
297 	P(0x08334), P(0x08338), P(0x0833c), P(0x08340), P(0x09808),
298 	P(0x0980c), P(0x09810), P(0x09814), P(0x0981c), P(0x0982c),
299 	P(0x09830), P(0x0983c), P(0x09840), P(0x0984c), P(0x09854),
300 	P(0x09900), P(0x09904), P(0x09908), P(0x0990c), P(0x0991c),
301 	P(0x09920), P(0x0a920), P(0x0b920), P(0x09928), P(0x0992c),
302 	P(0x09934), P(0x09938), P(0x0993c), P(0x09948), P(0x0994c),
303 	P(0x09954), P(0x09958), P(0x0c95c), P(0x0c968), P(0x09970),
304 	P(0x09974), P(0x09978), P(0x0997c), P(0x09980), P(0x09984),
305 	P(0x09988), P(0x0998c), P(0x09990), P(0x09994), P(0x09998),
306 	P(0x0999c), P(0x099a0), P(0x099a4), P(0x099a8), P(0x099ac),
307 	P(0x099b0), P(0x099dc), P(0x099e0), P(0x099e4), P(0x099e8),
308 	P(0x099ec), P(0x099fc), P(0x09b00), P(0x09b04), P(0x09b08),
309 	P(0x09b0c), P(0x09b10), P(0x09b14), P(0x09b18), P(0x09b1c),
310 	P(0x09b20), P(0x09b24), P(0x09b28), P(0x09b2c), P(0x09b30),
311 	P(0x09b34), P(0x09b38), P(0x09b3c), P(0x09b40), P(0x09b44),
312 	P(0x09b48), P(0x09b4c), P(0x09b50), P(0x09b54), P(0x09b58),
313 	P(0x09b5c), P(0x09b60), P(0x09b64), P(0x09b68), P(0x09b6c),
314 	P(0x09b70), P(0x09b74), P(0x09b78), P(0x09b7c), P(0x09b80),
315 	P(0x09b84), P(0x09b88), P(0x09b8c), P(0x09b90), P(0x09b94),
316 	P(0x09b98), P(0x09b9c), P(0x09ba0), P(0x09ba4), P(0x09ba8),
317 	P(0x09bac), P(0x09bb0), P(0x09bb4), P(0x09bb8), P(0x09bbc),
318 	P(0x09bc0), P(0x09bc4), P(0x09bc8), P(0x09bcc), P(0x09bd0),
319 	P(0x09bd4), P(0x09bd8), P(0x09bdc), P(0x09be0), P(0x09be4),
320 	P(0x09be8), P(0x09bec), P(0x09bf0), P(0x09bf4), P(0x09bf8),
321 	P(0x09bfc), P(0x0a210), P(0x0a214), P(0x0a218), P(0x0a220),
322 	P(0x0a224), P(0x0a228), P(0x0a22c), P(0x0a234), P(0x0a238),
323 	P(0x0a23c), P(0x0a240), P(0x0a244), P(0x0a248), P(0x0a24c),
324 	P(0x0a250), P(0x0a254), P(0x0a258), P(0x0a25c), P(0x0a260),
325 	P(0x0a268), P(0x0a26c), P(0x0b26c), P(0x0c26c), P(0x0d270),
326 	P(0x0a278), P(0x0a27c), P(0x0a338), P(0x0a33c), P(0x0a340),
327 	P(0x0a344), P(0x0a348), P(0x0a34c), P(0x0a350), P(0x0a354),
328 	P(0x0a358), P(0x0d35c), P(0x0d360), P(0x0d364), P(0x0d368),
329 	P(0x0d36c), P(0x0d370), P(0x0d374), P(0x0d378), P(0x0d37c),
330 	P(0x0d380), P(0x0d384), P(0x0a388), P(0x0a38c), P(0x0a390),
331 	P(0x0a394), P(0x0a398), P(0x0a39c), P(0x0a3a0), P(0x0a3a4),
332 	P(0x0a3a8), P(0x0a3ac), P(0x0a3b0), P(0x0a3b4), P(0x0a3b8),
333 	P(0x0a3bc), P(0x0a3c0), P(0x0a3c4), P(0x0a3c8), P(0x0a3cc),
334 	P(0x0a3d0), P(0x0a3d4), P(0x0a3dc), P(0x0a3e0)
335 };
336 
337 static const uint32_t ar5416_cm_vals[] = {
338 	0x00000000, 0x00020015, 0x00000005, 0x00000000, 0x00000008,
339 	0x00000008, 0x00000010, 0x00000000, 0x0000001f, 0x00000000,
340 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
341 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x002ffc0f,
342 	0x002ffc0f, 0x002ffc0f, 0x002ffc0f, 0x002ffc0f, 0x002ffc0f,
343 	0x002ffc0f, 0x002ffc0f, 0x002ffc0f, 0x002ffc0f, 0x00000000,
344 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
345 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
346 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
347 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
348 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
349 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
350 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
351 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
352 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
353 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
354 	0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x000004c2,
355 	0x00000000, 0x00000000, 0x00000000, 0x00000700, 0x00000000,
356 	0x00000000, 0x00000000, 0x40000000, 0x00000000, 0x00000000,
357 	0x000fc78f, 0x0000000f, 0x00000000, 0x2a82301a, 0x05dc01e0,
358 	0x1f402710, 0x01f40000, 0x00001e00, 0x00000000, 0x00400000,
359 	0xffffffff, 0x0000ffff, 0x003f3f3f, 0x00000000, 0x00000000,
360 	0x00000000, 0x00000000, 0x00020000, 0x00020000, 0x00000001,
361 	0x00000052, 0x00000000, 0x00000168, 0x000100aa, 0x00003210,
362 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
363 	0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
364 	0x32143320, 0xfaa4fa50, 0x00000100, 0x00000000, 0x00000000,
365 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
366 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
367 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
368 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
369 	0x00000000, 0x00100000, 0x0010f400, 0x00000100, 0x0001e800,
370 	0x00000000, 0x00000000, 0x00000000, 0x400000ff, 0x00080922,
371 	0x88000010, 0x00000000, 0x40000000, 0x003e4180, 0x00000000,
372 	0x0000002c, 0x0000002c, 0x00000000, 0x00000000, 0x00000000,
373 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
374 	0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000302,
375 	0x00000e00, 0x00070000, 0x00000000, 0x000107ff, 0x00000000,
376 	0xad848e19, 0x7d14e000, 0x9c0a9f6b, 0x00000000, 0x0000a000,
377 	0x00000000, 0x00200400, 0x206a002e, 0x1284233c, 0x00000859,
378 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x10000fff,
379 	0x05100000, 0x05100000, 0x05100000, 0x00000001, 0x00000004,
380 	0x1e1f2022, 0x0a0b0c0d, 0x00000000, 0x9280b212, 0x00020028,
381 	0x5d50e188, 0x00081fff, 0x004b6a8e, 0x000003ce, 0x190fb515,
382 	0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
383 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
384 	0x00000000, 0x00000000, 0x00000001, 0x001fff00, 0x00000000,
385 	0x03051000, 0x00000000, 0x00000200, 0xaaaaaaaa, 0x3c466478,
386 	0x000000aa, 0x00001042, 0x00000000, 0x00000001, 0x00000002,
387 	0x00000003, 0x00000004, 0x00000005, 0x00000008, 0x00000009,
388 	0x0000000a, 0x0000000b, 0x0000000c, 0x0000000d, 0x00000010,
389 	0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015,
390 	0x00000018, 0x00000019, 0x0000001a, 0x0000001b, 0x0000001c,
391 	0x0000001d, 0x00000020, 0x00000021, 0x00000022, 0x00000023,
392 	0x00000024, 0x00000025, 0x00000028, 0x00000029, 0x0000002a,
393 	0x0000002b, 0x0000002c, 0x0000002d, 0x00000030, 0x00000031,
394 	0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000035,
395 	0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
396 	0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
397 	0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
398 	0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000010,
399 	0x0000001a, 0x40806333, 0x00106c10, 0x009c4060, 0x018830c6,
400 	0x00000400, 0x00000bb5, 0x00000011, 0x20202020, 0x20202020,
401 	0x13c889af, 0x38490a20, 0x00007bb6, 0x0fff3ffc, 0x00000001,
402 	0x0000a000, 0x00000000, 0x0cc75380, 0x0f0f0f01, 0xdfa91f01,
403 	0x00000000, 0x0e79e5c6, 0x0e79e5c6, 0x0e79e5c6, 0x00820820,
404 	0x1ce739ce, 0x051701ce, 0x00000000, 0x00000000, 0x00000000,
405 	0x00000000, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x0003ffff,
406 	0x79a8aa1f, 0x07ffffef, 0x0fffffe7, 0x17ffffe5, 0x1fffffe4,
407 	0x37ffffe3, 0x3fffffe3, 0x57ffffe3, 0x5fffffe2, 0x7fffffe2,
408 	0x7f3c7bba, 0xf3307ff0, 0x08000000, 0x20202020, 0x20202020,
409 	0x1ce739ce, 0x000001ce, 0x00000001, 0x00000000, 0x00000000,
410 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
411 	0x00000000, 0x00000000, 0x00000000, 0x00000246, 0x20202020,
412 	0x20202020, 0x20202020, 0x1ce739ce, 0x000001ce
413 };
414 
415 static const struct athn_ini ar5416_ini = {
416 	nitems(ar5416_regs),
417 	ar5416_regs,
418 	ar5416_vals_5g20,
419 #ifndef IEEE80211_NO_HT
420 	ar5416_vals_5g40,
421 	ar5416_vals_2g40,
422 #endif
423 	ar5416_vals_2g20,
424 	nitems(ar5416_cm_regs),
425 	ar5416_cm_regs,
426 	ar5416_cm_vals
427 };
428 
429 /*
430  * AR9160 initialization values.
431  */
432 static const uint16_t ar9160_regs[] = {
433 	P(0x01030), P(0x01070), P(0x010b0), P(0x010f0), P(0x08014),
434 	P(0x0801c), P(0x08120), P(0x081d0), P(0x09804), P(0x09820),
435 	P(0x09824), P(0x09828), P(0x09834), P(0x09838), P(0x09844),
436 	P(0x09848), P(0x0a848), P(0x0b848), P(0x09850), P(0x09858),
437 	P(0x0985c), P(0x09860), P(0x09864), P(0x09868), P(0x0986c),
438 	P(0x09914), P(0x09918), P(0x09924), P(0x09944), P(0x09960),
439 	P(0x0a960), P(0x0b960), P(0x09964), P(0x0c968), P(0x099bc),
440 	P(0x099c0), P(0x099c4), P(0x099c8), P(0x099cc), P(0x099d0),
441 	P(0x099d4), P(0x099d8), P(0x0a204), P(0x0a208), P(0x0a20c),
442 	P(0x0b20c), P(0x0c20c), P(0x0a21c), P(0x0a230), P(0x0a274),
443 	P(0x0a300), P(0x0a304), P(0x0a308), P(0x0a30c), P(0x0a310),
444 	P(0x0a314), P(0x0a318), P(0x0a31c), P(0x0a320), P(0x0a324),
445 	P(0x0a328), P(0x0a32c), P(0x0a330), P(0x0a334)
446 };
447 
448 static const uint32_t ar9160_vals_5g20[] = {
449 	0x00000230, 0x00000168, 0x00000e60, 0x0000a000, 0x03e803e8,
450 	0x128d93a7, 0x08f04800, 0x00003210, 0x00000300, 0x02020200,
451 	0x00000e0e, 0x0a020001, 0x00000e0e, 0x00000007, 0x0372161e,
452 	0x001a6a65, 0x001a6a65, 0x001a6a65, 0x6c48b4e2, 0x7ec82d2e,
453 	0x31395d5e, 0x00048d18, 0x0001ce00, 0x409a40d0, 0x050cb081,
454 	0x000007d0, 0x0000000a, 0xd00a8a07, 0xffb81020, 0x00009b40,
455 	0x00009b40, 0x00009b40, 0x00001120, 0x000003b5, 0x001a0600,
456 	0x038919be, 0x06336f77, 0x6af65329, 0x08f186c8, 0x00046384,
457 	0x00000000, 0x00000000, 0x00000880, 0xd6be4788, 0x002fc160,
458 	0x002fc160, 0x002fc160, 0x1883800a, 0x00000000, 0x0a1a9caa,
459 	0x18010000, 0x30032602, 0x48073e06, 0x560b4c0a, 0x641a600f,
460 	0x7a4f6e1b, 0x8c5b7e5a, 0x9d0f96cf, 0xb51fa69f, 0xcb3fbd07,
461 	0x0000d7bf, 0x00000000, 0x00000000, 0x00000000
462 };
463 
464 #ifndef IEEE80211_NO_HT
465 static const uint32_t ar9160_vals_5g40[] = {
466 	0x00000460, 0x000002d0, 0x00001cc0, 0x00014000, 0x07d007d0,
467 	0x128d93cf, 0x08f04800, 0x00003210, 0x000003c4, 0x02020200,
468 	0x00000e0e, 0x0a020001, 0x00000e0e, 0x00000007, 0x0372161e,
469 	0x001a6a65, 0x001a6a65, 0x001a6a65, 0x6d48b4e2, 0x7ec82d2e,
470 	0x3139605e, 0x00048d18, 0x0001ce00, 0x409a40d0, 0x050cb081,
471 	0x00000fa0, 0x00000014, 0xd00a8a07, 0xffb81020, 0x00009b40,
472 	0x00009b40, 0x00009b40, 0x00001120, 0x000003b5, 0x001a0600,
473 	0x038919be, 0x06336f77, 0x6af65329, 0x08f186c8, 0x00046384,
474 	0x00000000, 0x00000000, 0x00000880, 0xd6be4788, 0x002fc160,
475 	0x002fc160, 0x002fc160, 0x1883800a, 0x00000000, 0x0a1a9caa,
476 	0x18010000, 0x30032602, 0x48073e06, 0x560b4c0a, 0x641a600f,
477 	0x7a4f6e1b, 0x8c5b7e5a, 0x9d0f96cf, 0xb51fa69f, 0xcb3fbcbf,
478 	0x0000d7bf, 0x00000000, 0x00000000, 0x00000000
479 };
480 
481 static const uint32_t ar9160_vals_2g40[] = {
482 	0x000002c0, 0x00000318, 0x00007c70, 0x00016000, 0x10801600,
483 	0x12e013d7, 0x08f04810, 0x0000320a, 0x000003c4, 0x02020200,
484 	0x00000e0e, 0x0a020001, 0x00000e0e, 0x00000007, 0x037216a0,
485 	0x00197a68, 0x00197a68, 0x00197a68, 0x6d48b0e2, 0x7ec82d2e,
486 	0x3139605e, 0x00048d20, 0x0001ce00, 0x409a40d0, 0x050cb081,
487 	0x00001130, 0x00000016, 0xd00a8a0d, 0xffb81020, 0x00009b40,
488 	0x00009b40, 0x00009b40, 0x00001120, 0x000003ce, 0x001a0c00,
489 	0x038919be, 0x06336f77, 0x6af65329, 0x08f186c8, 0x00046384,
490 	0x00000000, 0x00000000, 0x00000880, 0xd03e4788, 0x002ac120,
491 	0x002ac120, 0x002ac120, 0x1883800a, 0x00000210, 0x0a1a7caa,
492 	0x18010000, 0x2e032402, 0x4a0a3c06, 0x621a540b, 0x764f6c1b,
493 	0x845b7a5a, 0x950f8ccf, 0xa5cf9b4f, 0xbddfaf1f, 0xd1ffc93f,
494 	0x00000000, 0x00000000, 0x00000000, 0x00000000
495 };
496 #endif
497 
498 static const uint32_t ar9160_vals_2g20[] = {
499 	0x00000160, 0x0000018c, 0x00003e38, 0x0000b000, 0x08400b00,
500 	0x12e013ab, 0x08f04810, 0x0000320a, 0x00000300, 0x02020200,
501 	0x00000e0e, 0x0a020001, 0x00000e0e, 0x00000007, 0x037216a0,
502 	0x00197a68, 0x00197a68, 0x00197a68, 0x6c48b0e2, 0x7ec82d2e,
503 	0x31395d5e, 0x00048d20, 0x0001ce00, 0x409a40d0, 0x050cb081,
504 	0x00000898, 0x0000000b, 0xd00a8a0d, 0xffb81020, 0x00009b40,
505 	0x00009b40, 0x00009b40, 0x00001120, 0x000003ce, 0x001a0c00,
506 	0x038919be, 0x06336f77, 0x6af65329, 0x08f186c8, 0x00046384,
507 	0x00000000, 0x00000000, 0x00000880, 0xd03e4788, 0x002ac120,
508 	0x002ac120, 0x002ac120, 0x1883800a, 0x00000108, 0x0a1a7caa,
509 	0x18010000, 0x2e032402, 0x4a0a3c06, 0x621a540b, 0x764f6c1b,
510 	0x845b7a5a, 0x950f8ccf, 0xa5cf9b4f, 0xbddfaf1f, 0xd1ffc93f,
511 	0x00000000, 0x00000000, 0x00000000, 0x00000000
512 };
513 
514 static const uint16_t ar9160_cm_regs[] = {
515 	P(0x0000c), P(0x00030), P(0x00034), P(0x00040), P(0x00044),
516 	P(0x00048), P(0x0004c), P(0x00050), P(0x00054), P(0x00800),
517 	P(0x00804), P(0x00808), P(0x0080c), P(0x00810), P(0x00814),
518 	P(0x00818), P(0x0081c), P(0x00820), P(0x00824), P(0x01040),
519 	P(0x01044), P(0x01048), P(0x0104c), P(0x01050), P(0x01054),
520 	P(0x01058), P(0x0105c), P(0x01060), P(0x01064), P(0x01230),
521 	P(0x01270), P(0x01038), P(0x01078), P(0x010b8), P(0x010f8),
522 	P(0x01138), P(0x01178), P(0x011b8), P(0x011f8), P(0x01238),
523 	P(0x01278), P(0x012b8), P(0x012f8), P(0x01338), P(0x01378),
524 	P(0x013b8), P(0x013f8), P(0x01438), P(0x01478), P(0x014b8),
525 	P(0x014f8), P(0x01538), P(0x01578), P(0x015b8), P(0x015f8),
526 	P(0x01638), P(0x01678), P(0x016b8), P(0x016f8), P(0x01738),
527 	P(0x01778), P(0x017b8), P(0x017f8), P(0x0103c), P(0x0107c),
528 	P(0x010bc), P(0x010fc), P(0x0113c), P(0x0117c), P(0x011bc),
529 	P(0x011fc), P(0x0123c), P(0x0127c), P(0x012bc), P(0x012fc),
530 	P(0x0133c), P(0x0137c), P(0x013bc), P(0x013fc), P(0x0143c),
531 	P(0x0147c), P(0x04030), P(0x0403c), P(0x07010), P(0x07038),
532 	P(0x08004), P(0x08008), P(0x0800c), P(0x08018), P(0x08020),
533 	P(0x08038), P(0x0803c), P(0x08048), P(0x08054), P(0x08058),
534 	P(0x0805c), P(0x08060), P(0x08064), P(0x080c0), P(0x080c4),
535 	P(0x080c8), P(0x080cc), P(0x080d0), P(0x080d4), P(0x080d8),
536 	P(0x080e0), P(0x080e4), P(0x080e8), P(0x080ec), P(0x080f0),
537 	P(0x080f4), P(0x080f8), P(0x080fc), P(0x08100), P(0x08104),
538 	P(0x08108), P(0x0810c), P(0x08110), P(0x08118), P(0x0811c),
539 	P(0x08124), P(0x08128), P(0x0812c), P(0x08130), P(0x08134),
540 	P(0x08138), P(0x0813c), P(0x08144), P(0x08168), P(0x0816c),
541 	P(0x08170), P(0x08174), P(0x08178), P(0x0817c), P(0x081c4),
542 	P(0x081ec), P(0x081f0), P(0x081f4), P(0x081f8), P(0x081fc),
543 	P(0x08200), P(0x08204), P(0x08208), P(0x0820c), P(0x08210),
544 	P(0x08214), P(0x08218), P(0x0821c), P(0x08220), P(0x08224),
545 	P(0x08228), P(0x0822c), P(0x08230), P(0x08234), P(0x08238),
546 	P(0x0823c), P(0x08240), P(0x08244), P(0x08248), P(0x0824c),
547 	P(0x08250), P(0x08254), P(0x08258), P(0x0825c), P(0x08260),
548 	P(0x08264), P(0x08270), P(0x08274), P(0x08278), P(0x0827c),
549 	P(0x08284), P(0x08288), P(0x0828c), P(0x08294), P(0x08298),
550 	P(0x08300), P(0x08304), P(0x08308), P(0x0830c), P(0x08310),
551 	P(0x08314), P(0x08318), P(0x08328), P(0x0832c), P(0x08330),
552 	P(0x08334), P(0x08338), P(0x0833c), P(0x08340), P(0x09808),
553 	P(0x0980c), P(0x09810), P(0x09814), P(0x0981c), P(0x0982c),
554 	P(0x09830), P(0x0983c), P(0x09840), P(0x0984c), P(0x09854),
555 	P(0x09900), P(0x09904), P(0x09908), P(0x0990c), P(0x0991c),
556 	P(0x09920), P(0x0a920), P(0x0b920), P(0x09928), P(0x0992c),
557 	P(0x09934), P(0x09938), P(0x0993c), P(0x09948), P(0x0994c),
558 	P(0x09954), P(0x09958), P(0x09940), P(0x0c95c), P(0x09970),
559 	P(0x09974), P(0x09978), P(0x0997c), P(0x09980), P(0x09984),
560 	P(0x09988), P(0x0998c), P(0x09990), P(0x09994), P(0x09998),
561 	P(0x0999c), P(0x099a0), P(0x099a4), P(0x099a8), P(0x099ac),
562 	P(0x099b0), P(0x099dc), P(0x099e0), P(0x099e4), P(0x099e8),
563 	P(0x099ec), P(0x099fc), P(0x09b00), P(0x09b04), P(0x09b08),
564 	P(0x09b0c), P(0x09b10), P(0x09b14), P(0x09b18), P(0x09b1c),
565 	P(0x09b20), P(0x09b24), P(0x09b28), P(0x09b2c), P(0x09b30),
566 	P(0x09b34), P(0x09b38), P(0x09b3c), P(0x09b40), P(0x09b44),
567 	P(0x09b48), P(0x09b4c), P(0x09b50), P(0x09b54), P(0x09b58),
568 	P(0x09b5c), P(0x09b60), P(0x09b64), P(0x09b68), P(0x09b6c),
569 	P(0x09b70), P(0x09b74), P(0x09b78), P(0x09b7c), P(0x09b80),
570 	P(0x09b84), P(0x09b88), P(0x09b8c), P(0x09b90), P(0x09b94),
571 	P(0x09b98), P(0x09b9c), P(0x09ba0), P(0x09ba4), P(0x09ba8),
572 	P(0x09bac), P(0x09bb0), P(0x09bb4), P(0x09bb8), P(0x09bbc),
573 	P(0x09bc0), P(0x09bc4), P(0x09bc8), P(0x09bcc), P(0x09bd0),
574 	P(0x09bd4), P(0x09bd8), P(0x09bdc), P(0x09be0), P(0x09be4),
575 	P(0x09be8), P(0x09bec), P(0x09bf0), P(0x09bf4), P(0x09bf8),
576 	P(0x09bfc), P(0x0a210), P(0x0a214), P(0x0a218), P(0x0a220),
577 	P(0x0a224), P(0x0a228), P(0x0a22c), P(0x0a234), P(0x0a238),
578 	P(0x0a23c), P(0x0a240), P(0x0a244), P(0x0a248), P(0x0a24c),
579 	P(0x0a250), P(0x0a254), P(0x0a258), P(0x0a25c), P(0x0a260),
580 	P(0x0a268), P(0x0a26c), P(0x0b26c), P(0x0c26c), P(0x0d270),
581 	P(0x0a278), P(0x0a27c), P(0x0a338), P(0x0a33c), P(0x0a340),
582 	P(0x0a344), P(0x0a348), P(0x0a34c), P(0x0a350), P(0x0a354),
583 	P(0x0a358), P(0x0d35c), P(0x0d360), P(0x0d364), P(0x0d368),
584 	P(0x0d36c), P(0x0d370), P(0x0d374), P(0x0d378), P(0x0d37c),
585 	P(0x0d380), P(0x0d384), P(0x0a388), P(0x0a38c), P(0x0a390),
586 	P(0x0a394), P(0x0a398), P(0x0a39c), P(0x0a3a0), P(0x0a3a4),
587 	P(0x0a3a8), P(0x0a3ac), P(0x0a3b0), P(0x0a3b4), P(0x0a3b8),
588 	P(0x0a3bc), P(0x0a3c0), P(0x0a3c4), P(0x0a3c8), P(0x0a3cc),
589 	P(0x0a3d0), P(0x0a3d4), P(0x0a3dc), P(0x0a3e0)
590 };
591 
592 static const uint32_t ar9160_cm_vals[] = {
593 	0x00000000, 0x00020015, 0x00000005, 0x00000000, 0x00000008,
594 	0x00000008, 0x00000010, 0x00000000, 0x0000001f, 0x00000000,
595 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
596 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x002ffc0f,
597 	0x002ffc0f, 0x002ffc0f, 0x002ffc0f, 0x002ffc0f, 0x002ffc0f,
598 	0x002ffc0f, 0x002ffc0f, 0x002ffc0f, 0x002ffc0f, 0x00000000,
599 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
600 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
601 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
602 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
603 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
604 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
605 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
606 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
607 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
608 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
609 	0x00000000, 0x00000002, 0x00000002, 0x00000020, 0x000004c2,
610 	0x00000000, 0x00000000, 0x00000000, 0x00000700, 0x00000000,
611 	0x00000000, 0x00000000, 0x40000000, 0x00000000, 0x00000000,
612 	0x000fc78f, 0x0000000f, 0x00000000, 0x2a82301a, 0x05dc01e0,
613 	0x1f402710, 0x01f40000, 0x00001e00, 0x00000000, 0x00400000,
614 	0xffffffff, 0x0000ffff, 0x003f3f3f, 0x00000000, 0x00000000,
615 	0x00000000, 0x00000000, 0x00020000, 0x00020000, 0x00000001,
616 	0x00000052, 0x00000000, 0x00000168, 0x000100aa, 0x00003210,
617 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
618 	0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
619 	0x32143320, 0xfaa4fa50, 0x00000100, 0x00000000, 0x00000000,
620 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
621 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
622 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
623 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
624 	0x00000000, 0x00100000, 0x0010f400, 0x00000100, 0x0001e800,
625 	0x00000000, 0x00000000, 0x00000000, 0x400000ff, 0x00080922,
626 	0x88a00010, 0x00000000, 0x40000000, 0x003e4180, 0x00000000,
627 	0x0000002c, 0x0000002c, 0x00000000, 0x00000000, 0x00000000,
628 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
629 	0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000302,
630 	0x00000e00, 0x00ff0000, 0x00000000, 0x000107ff, 0x00000000,
631 	0xad848e19, 0x7d14e000, 0x9c0a9f6b, 0x00000000, 0x0000a000,
632 	0x00000000, 0x00200400, 0x206a01ae, 0x1284233c, 0x00000859,
633 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x10000fff,
634 	0x05100000, 0x05100000, 0x05100000, 0x00000001, 0x00000004,
635 	0x1e1f2022, 0x0a0b0c0d, 0x00000000, 0x9280b212, 0x00020028,
636 	0x5f3ca3de, 0x2108ecff, 0x00750604, 0x004b6a8e, 0x190fb515,
637 	0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
638 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
639 	0x00000000, 0x00000000, 0x00000001, 0x201fff00, 0x006f0000,
640 	0x03051000, 0x00000000, 0x00000200, 0xaaaaaaaa, 0x3c466478,
641 	0x0cc80caa, 0x00001042, 0x00000000, 0x00000001, 0x00000002,
642 	0x00000003, 0x00000004, 0x00000005, 0x00000008, 0x00000009,
643 	0x0000000a, 0x0000000b, 0x0000000c, 0x0000000d, 0x00000010,
644 	0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015,
645 	0x00000018, 0x00000019, 0x0000001a, 0x0000001b, 0x0000001c,
646 	0x0000001d, 0x00000020, 0x00000021, 0x00000022, 0x00000023,
647 	0x00000024, 0x00000025, 0x00000028, 0x00000029, 0x0000002a,
648 	0x0000002b, 0x0000002c, 0x0000002d, 0x00000030, 0x00000031,
649 	0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000035,
650 	0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
651 	0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
652 	0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000035,
653 	0x00000035, 0x00000035, 0x00000035, 0x00000035, 0x00000010,
654 	0x0000001a, 0x40806333, 0x00106c10, 0x009c4060, 0x018830c6,
655 	0x00000400, 0x001a0bb5, 0x00000000, 0x20202020, 0x20202020,
656 	0x13c889af, 0x38490a20, 0x00007bb6, 0x0fff3ffc, 0x00000001,
657 	0x0000e000, 0x00000000, 0x0cc75380, 0x0f0f0f01, 0xdfa91f01,
658 	0x00000001, 0x0e79e5c6, 0x0e79e5c6, 0x0e79e5c6, 0x00820820,
659 	0x1ce739ce, 0x050701ce, 0x00000000, 0x00000000, 0x00000000,
660 	0x00000000, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x0003ffff,
661 	0x79bfaa03, 0x07ffffef, 0x0fffffe7, 0x17ffffe5, 0x1fffffe4,
662 	0x37ffffe3, 0x3fffffe3, 0x57ffffe3, 0x5fffffe2, 0x7fffffe2,
663 	0x7f3c7bba, 0xf3307ff0, 0x0c000000, 0x20202020, 0x20202020,
664 	0x1ce739ce, 0x000001ce, 0x00000001, 0x00000000, 0x00000000,
665 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
666 	0x00000000, 0x00000000, 0x00000000, 0x00000246, 0x20202020,
667 	0x20202020, 0x20202020, 0x1ce739ce, 0x000001ce
668 };
669 
670 static const struct athn_ini ar9160_ini = {
671 	nitems(ar9160_regs),
672 	ar9160_regs,
673 	ar9160_vals_5g20,
674 #ifndef IEEE80211_NO_HT
675 	ar9160_vals_5g40,
676 	ar9160_vals_2g40,
677 #endif
678 	ar9160_vals_2g20,
679 	nitems(ar9160_cm_regs),
680 	ar9160_cm_regs,
681 	ar9160_cm_vals
682 };
683 
684 /*
685  * BB/RF Gains common to AR5416 and AR9160.
686  */
687 static const uint32_t ar5416_bb_rfgain_vals_5g[] = {
688 	0x00000000, 0x00000040, 0x00000080, 0x000001a1, 0x000001e1,
689 	0x00000021, 0x00000061, 0x00000168, 0x000001a8, 0x000001e8,
690 	0x00000028, 0x00000068, 0x00000189, 0x000001c9, 0x00000009,
691 	0x00000049, 0x00000089, 0x00000170, 0x000001b0, 0x000001f0,
692 	0x00000030, 0x00000070, 0x00000191, 0x000001d1, 0x00000011,
693 	0x00000051, 0x00000091, 0x000001b8, 0x000001f8, 0x00000038,
694 	0x00000078, 0x00000199, 0x000001d9, 0x00000019, 0x00000059,
695 	0x00000099, 0x000000d9, 0x000000f9, 0x000000f9, 0x000000f9,
696 	0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
697 	0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
698 	0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
699 	0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
700 	0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9
701 };
702 
703 static const uint32_t ar5416_bb_rfgain_vals_2g[] = {
704 	0x00000000, 0x00000040, 0x00000080, 0x00000141, 0x00000181,
705 	0x000001c1, 0x00000001, 0x00000041, 0x000001a8, 0x000001e8,
706 	0x00000028, 0x00000068, 0x000000a8, 0x00000169, 0x000001a9,
707 	0x000001e9, 0x00000029, 0x00000069, 0x00000190, 0x000001d0,
708 	0x00000010, 0x00000050, 0x00000090, 0x00000151, 0x00000191,
709 	0x000001d1, 0x00000011, 0x00000051, 0x00000198, 0x000001d8,
710 	0x00000018, 0x00000058, 0x00000098, 0x00000159, 0x00000199,
711 	0x000001d9, 0x00000019, 0x00000059, 0x00000099, 0x000000d9,
712 	0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
713 	0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
714 	0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
715 	0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9,
716 	0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9
717 };
718 
719 static const uint32_t ar5416_2_1_addac_vals[] = {
720 	0x00000000, 0x00000003, 0x00000000, 0x0000000c, 0x00000000,
721 	0x00000030, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
722 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
723 	0x00000000, 0x00000000, 0x00000000, 0x00000060, 0x00000000,
724 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
725 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
726 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
727 	0x00000000
728 };
729 
730 static const struct athn_addac ar5416_2_1_addac = {
731 	nitems(ar5416_2_1_addac_vals),
732 	ar5416_2_1_addac_vals
733 };
734 
735 static const uint32_t ar5416_2_2_addac_vals[] = {
736 	0x00000000, 0x00000003, 0x00000000, 0x0000000c, 0x00000000,
737 	0x00000030, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
738 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
739 	0x00000000, 0x00000000, 0x00000000, 0x00000060, 0x00000000,
740 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
741 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
742 	0x00000000, 0x00000058, 0x00000000, 0x00000000, 0x00000000,
743 	0x00000000
744 };
745 
746 static const struct athn_addac ar5416_2_2_addac = {
747 	nitems(ar5416_2_2_addac_vals),
748 	ar5416_2_2_addac_vals
749 };
750 
751 static const uint32_t ar9160_1_0_addac_vals[] = {
752 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
753 	0x00000000, 0x000000c0, 0x00000018, 0x00000004, 0x00000000,
754 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
755 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
756 	0x00000000, 0x000000c0, 0x00000019, 0x00000004, 0x00000000,
757 	0x00000000, 0x00000000, 0x00000004, 0x00000003, 0x00000008,
758 	0x00000000
759 };
760 
761 static const struct athn_addac ar9160_1_0_addac = {
762 	nitems(ar9160_1_0_addac_vals),
763 	ar9160_1_0_addac_vals
764 };
765 
766 static const uint32_t ar9160_1_1_addac_vals[] = {
767 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
768 	0x00000000, 0x000000c0, 0x00000018, 0x00000004, 0x00000000,
769 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
770 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
771 	0x00000000, 0x000000c0, 0x00000019, 0x00000004, 0x00000000,
772 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
773 	0x00000000
774 };
775 
776 static const struct athn_addac ar9160_1_1_addac = {
777 	nitems(ar9160_1_1_addac_vals),
778 	ar9160_1_1_addac_vals
779 };
780 
781 static const uint32_t ar5416_bank6tpc_vals[] = {
782 	0x00000000, 0x00000000, 0x00000000, 0x00e00000, 0x005e0000,
783 	0x00120000, 0x00620000, 0x00020000, 0x00ff0000, 0x00ff0000,
784 	0x00ff0000, 0x40ff0000, 0x005f0000, 0x00870000, 0x00f90000,
785 	0x007b0000, 0x00ff0000, 0x00f50000, 0x00dc0000, 0x00110000,
786 	0x006100a8, 0x00423022, 0x201400df, 0x00c40002, 0x003000f2,
787 	0x00440016, 0x00410040, 0x0001805e, 0x0000c0ab, 0x000000e1,
788 	0x00007081, 0x000000d4
789 };
790 
791 static const uint32_t ar9160_bank6tpc_vals[] = {
792 	0x00000000, 0x00000000, 0x00000000, 0x00e00000, 0x005e0000,
793 	0x00120000, 0x00620000, 0x00020000, 0x00ff0000, 0x00ff0000,
794 	0x00ff0000, 0x40ff0000, 0x005f0000, 0x00870000, 0x00f90000,
795 	0x007b0000, 0x00ff0000, 0x00f50000, 0x00dc0000, 0x00110000,
796 	0x006100a8, 0x00423022, 0x2014008f, 0x00c40002, 0x003000f2,
797 	0x00440016, 0x00410040, 0x0001805e, 0x0000c0ab, 0x000000e1,
798 	0x00007080, 0x000000d4
799 };
800 
801 static const uint32_t ar5416_bank6_vals[] = {
802 	0x00000000, 0x00000000, 0x00000000, 0x00e00000, 0x005e0000,
803 	0x00120000, 0x00620000, 0x00020000, 0x00ff0000, 0x00ff0000,
804 	0x00ff0000, 0x40ff0000, 0x005f0000, 0x00870000, 0x00f90000,
805 	0x007b0000, 0x00ff0000, 0x00f50000, 0x00dc0000, 0x00110000,
806 	0x006100a8, 0x004210a2, 0x0014008f, 0x00c40003, 0x003000f2,
807 	0x00440016, 0x00410040, 0x0001805e, 0x0000c0ab, 0x000000f1,
808 	0x00002081, 0x000000d4
809 };
810 
811 /*
812  * Serializer/Deserializer programming.
813  */
814 
815 static const uint32_t ar5416_serdes_regs[] = {
816 	AR_PCIE_SERDES,
817 	AR_PCIE_SERDES,
818 	AR_PCIE_SERDES,
819 	AR_PCIE_SERDES,
820 	AR_PCIE_SERDES,
821 	AR_PCIE_SERDES,
822 	AR_PCIE_SERDES,
823 	AR_PCIE_SERDES,
824 	AR_PCIE_SERDES,
825 	AR_PCIE_SERDES2
826 };
827 
828 static const uint32_t ar5416_serdes_vals[] = {
829 	0x9248fc00,
830 	0x24924924,
831 	/* RX shut off when elecidle is asserted. */
832 	0x28000039,
833 	0x53160824,
834 	0xe5980579,
835 	0x001defff,
836 	0x1aaabe40,
837 	0xbe105554,
838 	0x000e3007,
839 	0x00000000
840 };
841 
842 static const struct athn_serdes ar5416_serdes = {
843 	nitems(ar5416_serdes_vals),
844 	ar5416_serdes_regs,
845 	ar5416_serdes_vals,
846 };
847