xref: /openbsd-src/sys/dev/ic/ar5xxx.h (revision 6842f7102ed40737967da8004e72658f39f151e5)
1*6842f710Stb /*	$OpenBSD: ar5xxx.h,v 1.60 2017/08/25 12:17:27 tb Exp $	*/
2f51c4ae1Sreyk 
3f51c4ae1Sreyk /*
4ea5b165aSreyk  * Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
5f51c4ae1Sreyk  *
691dca01fSreyk  * Permission to use, copy, modify, and distribute this software for any
791dca01fSreyk  * purpose with or without fee is hereby granted, provided that the above
891dca01fSreyk  * copyright notice and this permission notice appear in all copies.
9f51c4ae1Sreyk  *
1091dca01fSreyk  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1191dca01fSreyk  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1291dca01fSreyk  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1391dca01fSreyk  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1491dca01fSreyk  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1591dca01fSreyk  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1691dca01fSreyk  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17f51c4ae1Sreyk  */
18f51c4ae1Sreyk 
19f51c4ae1Sreyk /*
20f51c4ae1Sreyk  * HAL interface for Atheros Wireless LAN devices.
21f51c4ae1Sreyk  *
22f51c4ae1Sreyk  * ar5k is a free replacement of the binary-only HAL used by some drivers
23f51c4ae1Sreyk  * for Atheros chipsets. While using a different ABI, it tries to be
24f51c4ae1Sreyk  * source-compatible with the original (non-free) HAL interface.
25f51c4ae1Sreyk  *
26f51c4ae1Sreyk  * Many thanks to various contributors who supported the development of
27f51c4ae1Sreyk  * ar5k with hard work and useful information. And, of course, for all the
28f51c4ae1Sreyk  * people who encouraged me to continue this work which has been based
29f51c4ae1Sreyk  * on my initial approach found on http://team.vantronix.net/ar5k/.
30f51c4ae1Sreyk  */
31f51c4ae1Sreyk 
32f51c4ae1Sreyk #ifndef _AR5K_H
33f51c4ae1Sreyk #define _AR5K_H
34f51c4ae1Sreyk 
35f51c4ae1Sreyk #include <sys/param.h>
369b074ffaStedu #include <sys/systm.h>
37f51c4ae1Sreyk #include <sys/malloc.h>
38f51c4ae1Sreyk #include <sys/lock.h>
39f51c4ae1Sreyk #include <sys/kernel.h>
40f51c4ae1Sreyk #include <sys/socket.h>
41f51c4ae1Sreyk #include <sys/sockio.h>
42f51c4ae1Sreyk #include <sys/errno.h>
439b18ffb8Sguenther #include <sys/endian.h>
44f51c4ae1Sreyk 
45f51c4ae1Sreyk #include <machine/bus.h>
46f51c4ae1Sreyk 
47f51c4ae1Sreyk #include <net/if.h>
48f51c4ae1Sreyk #include <net/if_media.h>
49f51c4ae1Sreyk 
50f51c4ae1Sreyk #include <netinet/in.h>
51f51c4ae1Sreyk #include <netinet/if_ether.h>
52f51c4ae1Sreyk 
53f51c4ae1Sreyk #include <net80211/ieee80211_var.h>
549ebef271Sreyk #include <net80211/ieee80211_radiotap.h>
55f51c4ae1Sreyk #include <net80211/ieee80211_regdomain.h>
56f51c4ae1Sreyk 
57f51c4ae1Sreyk /*
589ebef271Sreyk  * Possible chipsets (could appear in different combinations)
599ebef271Sreyk  */
609ebef271Sreyk 
619ebef271Sreyk enum ar5k_version {
629ebef271Sreyk 	AR5K_AR5210	= 0,
639ebef271Sreyk 	AR5K_AR5211	= 1,
649ebef271Sreyk 	AR5K_AR5212	= 2,
659ebef271Sreyk };
669ebef271Sreyk 
679ebef271Sreyk enum ar5k_radio {
689ebef271Sreyk 	AR5K_AR5110	= 0,
699ebef271Sreyk 	AR5K_AR5111	= 1,
709ebef271Sreyk 	AR5K_AR5112	= 2,
71b59011f9Sreyk 	AR5K_AR2413	= 3,
72b59011f9Sreyk 	AR5K_AR5413	= 4,
73b59011f9Sreyk 	AR5K_AR2425	= 5
749ebef271Sreyk };
759ebef271Sreyk 
769ebef271Sreyk /*
77f51c4ae1Sreyk  * Generic definitions
78f51c4ae1Sreyk  */
79f51c4ae1Sreyk 
80f51c4ae1Sreyk typedef enum {
81f51c4ae1Sreyk 	AH_FALSE = 0,
82f51c4ae1Sreyk 	AH_TRUE,
83f51c4ae1Sreyk } HAL_BOOL;
84f51c4ae1Sreyk 
85f51c4ae1Sreyk typedef enum {
86f51c4ae1Sreyk 	HAL_MODE_11A = 0x001,
87f51c4ae1Sreyk 	HAL_MODE_TURBO = 0x002,
88f51c4ae1Sreyk 	HAL_MODE_11B = 0x004,
89f51c4ae1Sreyk 	HAL_MODE_PUREG = 0x008,
909ebef271Sreyk 	HAL_MODE_11G = 0x010,
91f51c4ae1Sreyk 	HAL_MODE_108G = 0x020,
92dd37d60cSreyk 	HAL_MODE_XR = 0x040,
93f51c4ae1Sreyk 	HAL_MODE_ALL = 0xfff
94f51c4ae1Sreyk } HAL_MODE;
95f51c4ae1Sreyk 
96f51c4ae1Sreyk typedef enum {
979ebef271Sreyk 	HAL_ANT_VARIABLE = 0,
989ebef271Sreyk 	HAL_ANT_FIXED_A = 1,
999ebef271Sreyk 	HAL_ANT_FIXED_B	= 2,
1009ebef271Sreyk 	HAL_ANT_MAX = 3,
1019ebef271Sreyk } HAL_ANT_SETTING;
1029ebef271Sreyk 
10361d1d1deSkettenis typedef enum ieee80211_opmode HAL_OPMODE;
10461d1d1deSkettenis 
10561d1d1deSkettenis #define	HAL_M_STA	IEEE80211_M_STA
10661d1d1deSkettenis #define HAL_M_IBSS	IEEE80211_M_IBSS
10761d1d1deSkettenis #define HAL_M_HOSTAP	IEEE80211_M_HOSTAP
10861d1d1deSkettenis #define HAL_M_MONITOR	IEEE80211_M_MONITOR
109f51c4ae1Sreyk 
110f51c4ae1Sreyk typedef int HAL_STATUS;
111f51c4ae1Sreyk 
112f51c4ae1Sreyk #define HAL_OK		0
113c39ae617Sreyk #define HAL_EINPROGRESS EINPROGRESS
114f51c4ae1Sreyk 
1156fc94ee3Sreyk #define AR5K_MAX_RSSI	64
1166fc94ee3Sreyk 
117f51c4ae1Sreyk /*
118f51c4ae1Sreyk  * TX queues
119f51c4ae1Sreyk  */
120f51c4ae1Sreyk 
121f51c4ae1Sreyk typedef enum {
122f51c4ae1Sreyk 	HAL_TX_QUEUE_INACTIVE = 0,
123f51c4ae1Sreyk 	HAL_TX_QUEUE_DATA,
124f51c4ae1Sreyk 	HAL_TX_QUEUE_BEACON,
125f51c4ae1Sreyk 	HAL_TX_QUEUE_CAB,
126f51c4ae1Sreyk 	HAL_TX_QUEUE_PSPOLL,
127f51c4ae1Sreyk } HAL_TX_QUEUE;
128f51c4ae1Sreyk 
129f51c4ae1Sreyk #define HAL_NUM_TX_QUEUES	10
130f51c4ae1Sreyk 
131f51c4ae1Sreyk typedef enum {
1329ebef271Sreyk 	HAL_TX_QUEUE_ID_DATA_MIN = 0,
1339ebef271Sreyk 	HAL_TX_QUEUE_ID_DATA_MAX = 6,
1349ebef271Sreyk 	HAL_TX_QUEUE_ID_PSPOLL = 7,
1359ebef271Sreyk 	HAL_TX_QUEUE_ID_BEACON = 8,
1369ebef271Sreyk 	HAL_TX_QUEUE_ID_CAB = 9,
1379ebef271Sreyk } HAL_TX_QUEUE_ID;
1389ebef271Sreyk 
1399ebef271Sreyk typedef enum {
140f51c4ae1Sreyk 	HAL_WME_AC_BK = 0,
141f51c4ae1Sreyk 	HAL_WME_AC_BE = 1,
142f51c4ae1Sreyk 	HAL_WME_AC_VI = 2,
143f51c4ae1Sreyk 	HAL_WME_AC_VO = 3,
144f51c4ae1Sreyk 	HAL_WME_UPSD = 4,
145f51c4ae1Sreyk } HAL_TX_QUEUE_SUBTYPE;
146f51c4ae1Sreyk 
147f51c4ae1Sreyk #define AR5K_TXQ_FLAG_TXINT_ENABLE		0x0001
148f51c4ae1Sreyk #define AR5K_TXQ_FLAG_TXDESCINT_ENABLE		0x0002
149f51c4ae1Sreyk #define AR5K_TXQ_FLAG_BACKOFF_DISABLE		0x0004
150f51c4ae1Sreyk #define AR5K_TXQ_FLAG_COMPRESSION_ENABLE	0x0008
151f51c4ae1Sreyk #define AR5K_TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE	0x0010
152f51c4ae1Sreyk #define AR5K_TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE	0x0020
1539ebef271Sreyk #define AR5K_TXQ_FLAG_POST_FR_BKOFF_DIS         0x0040
154f51c4ae1Sreyk 
155f51c4ae1Sreyk typedef struct {
156f51c4ae1Sreyk 	u_int32_t		tqi_ver;
157f51c4ae1Sreyk 	HAL_TX_QUEUE		tqi_type;
158f51c4ae1Sreyk 	HAL_TX_QUEUE_SUBTYPE	tqi_subtype;
159f51c4ae1Sreyk 	u_int16_t		tqi_flags;
160f51c4ae1Sreyk 	u_int32_t		tqi_priority;
161f51c4ae1Sreyk 	u_int32_t		tqi_aifs;
162f51c4ae1Sreyk 	int32_t			tqi_cw_min;
163f51c4ae1Sreyk 	int32_t			tqi_cw_max;
164f51c4ae1Sreyk 	u_int32_t		tqi_cbr_period;
165f51c4ae1Sreyk 	u_int32_t		tqi_cbr_overflow_limit;
166f51c4ae1Sreyk 	u_int32_t		tqi_burst_time;
167f51c4ae1Sreyk 	u_int32_t		tqi_ready_time;
168f51c4ae1Sreyk } HAL_TXQ_INFO;
169f51c4ae1Sreyk 
170f51c4ae1Sreyk typedef enum {
171f51c4ae1Sreyk 	HAL_PKT_TYPE_NORMAL = 0,
172a4490bb3Sreyk 	HAL_PKT_TYPE_ATIM = 1,
173a4490bb3Sreyk 	HAL_PKT_TYPE_PSPOLL = 2,
174a4490bb3Sreyk 	HAL_PKT_TYPE_BEACON = 3,
175a4490bb3Sreyk 	HAL_PKT_TYPE_PROBE_RESP = 4,
176a4490bb3Sreyk 	HAL_PKT_TYPE_PIFS = 5,
177f51c4ae1Sreyk } HAL_PKT_TYPE;
178f51c4ae1Sreyk 
179f51c4ae1Sreyk /*
180f51c4ae1Sreyk  * Used to compute TX times
181f51c4ae1Sreyk  */
182f51c4ae1Sreyk 
183f51c4ae1Sreyk #define AR5K_CCK_SIFS_TIME		10
184f51c4ae1Sreyk #define AR5K_CCK_PREAMBLE_BITS		144
185f51c4ae1Sreyk #define AR5K_CCK_PLCP_BITS		48
186f51c4ae1Sreyk #define AR5K_CCK_NUM_BITS(_frmlen) (_frmlen << 3)
187f51c4ae1Sreyk #define AR5K_CCK_PHY_TIME(_sp) (_sp ?					\
188f51c4ae1Sreyk 	((AR5K_CCK_PREAMBLE_BITS + AR5K_CCK_PLCP_BITS) >> 1) :		\
189f51c4ae1Sreyk 	(AR5K_CCK_PREAMBLE_BITS + AR5K_CCK_PLCP_BITS))
190f51c4ae1Sreyk #define AR5K_CCK_TX_TIME(_kbps, _frmlen, _sp)				\
191f51c4ae1Sreyk 	AR5K_CCK_PHY_TIME(_sp) +					\
192f51c4ae1Sreyk 	((AR5K_CCK_NUM_BITS(_frmlen) * 1000) / _kbps) +			\
193f51c4ae1Sreyk 	AR5K_CCK_SIFS_TIME
194f51c4ae1Sreyk 
195f51c4ae1Sreyk #define AR5K_OFDM_SIFS_TIME		16
196f51c4ae1Sreyk #define AR5K_OFDM_PREAMBLE_TIME	20
197f51c4ae1Sreyk #define AR5K_OFDM_PLCP_BITS		22
198f51c4ae1Sreyk #define AR5K_OFDM_SYMBOL_TIME		4
199f51c4ae1Sreyk #define AR5K_OFDM_NUM_BITS(_frmlen) (AR5K_OFDM_PLCP_BITS + (_frmlen << 3))
200f51c4ae1Sreyk #define AR5K_OFDM_NUM_BITS_PER_SYM(_kbps) ((_kbps *			\
201f51c4ae1Sreyk 	AR5K_OFDM_SYMBOL_TIME) / 1000)
202f51c4ae1Sreyk #define AR5K_OFDM_NUM_BITS(_frmlen) (AR5K_OFDM_PLCP_BITS + (_frmlen << 3))
203f51c4ae1Sreyk #define AR5K_OFDM_NUM_SYMBOLS(_kbps, _frmlen)				\
204f51c4ae1Sreyk 	howmany(AR5K_OFDM_NUM_BITS(_frmlen), AR5K_OFDM_NUM_BITS_PER_SYM(_kbps))
205f51c4ae1Sreyk #define AR5K_OFDM_TX_TIME(_kbps, _frmlen)				\
206f51c4ae1Sreyk 	AR5K_OFDM_PREAMBLE_TIME + AR5K_OFDM_SIFS_TIME +			\
207f51c4ae1Sreyk 	(AR5K_OFDM_NUM_SYMBOLS(_kbps, _frmlen) * AR5K_OFDM_SYMBOL_TIME)
208f51c4ae1Sreyk 
209f51c4ae1Sreyk #define AR5K_TURBO_SIFS_TIME		8
210f51c4ae1Sreyk #define AR5K_TURBO_PREAMBLE_TIME	14
211f51c4ae1Sreyk #define AR5K_TURBO_PLCP_BITS		22
212f51c4ae1Sreyk #define AR5K_TURBO_SYMBOL_TIME		4
213f51c4ae1Sreyk #define AR5K_TURBO_NUM_BITS(_frmlen) (AR5K_TURBO_PLCP_BITS + (_frmlen << 3))
214f51c4ae1Sreyk #define AR5K_TURBO_NUM_BITS_PER_SYM(_kbps) (((_kbps << 1) *		\
215f51c4ae1Sreyk 	AR5K_TURBO_SYMBOL_TIME) / 1000)
216f51c4ae1Sreyk #define AR5K_TURBO_NUM_BITS(_frmlen) (AR5K_TURBO_PLCP_BITS + (_frmlen << 3))
217f51c4ae1Sreyk #define AR5K_TURBO_NUM_SYMBOLS(_kbps, _frmlen)				\
218f51c4ae1Sreyk 	howmany(AR5K_TURBO_NUM_BITS(_frmlen),				\
219f51c4ae1Sreyk 	AR5K_TURBO_NUM_BITS_PER_SYM(_kbps))
220f51c4ae1Sreyk #define AR5K_TURBO_TX_TIME(_kbps, _frmlen)				\
221f51c4ae1Sreyk 	AR5K_TURBO_PREAMBLE_TIME + AR5K_TURBO_SIFS_TIME +		\
222f51c4ae1Sreyk 	(AR5K_TURBO_NUM_SYMBOLS(_kbps, _frmlen) * AR5K_TURBO_SYMBOL_TIME)
223f51c4ae1Sreyk 
224f51c4ae1Sreyk #define AR5K_XR_SIFS_TIME		16
225f51c4ae1Sreyk #define AR5K_XR_PLCP_BITS		22
226f51c4ae1Sreyk #define AR5K_XR_SYMBOL_TIME		4
227f51c4ae1Sreyk #define AR5K_XR_PREAMBLE_TIME(_kbps) (((_kbps) < 1000) ? 173 : 76)
228f51c4ae1Sreyk #define AR5K_XR_NUM_BITS_PER_SYM(_kbps) ((_kbps *			\
229f51c4ae1Sreyk 	AR5K_XR_SYMBOL_TIME) / 1000)
230f51c4ae1Sreyk #define AR5K_XR_NUM_BITS(_frmlen) (AR5K_XR_PLCP_BITS + (_frmlen << 3))
231f51c4ae1Sreyk #define AR5K_XR_NUM_SYMBOLS(_kbps, _frmlen)				\
232f51c4ae1Sreyk 	howmany(AR5K_XR_NUM_BITS(_frmlen), AR5K_XR_NUM_BITS_PER_SYM(_kbps))
233f51c4ae1Sreyk #define AR5K_XR_TX_TIME(_kbps, _frmlen)					\
234f51c4ae1Sreyk 	AR5K_XR_PREAMBLE_TIME(_kbps) + AR5K_XR_SIFS_TIME +		\
235f51c4ae1Sreyk 	(AR5K_XR_NUM_SYMBOLS(_kbps, _frmlen) * AR5K_XR_SYMBOL_TIME)
236f51c4ae1Sreyk 
237f51c4ae1Sreyk /*
238f51c4ae1Sreyk  * RX definitions
239f51c4ae1Sreyk  */
240f51c4ae1Sreyk 
241f51c4ae1Sreyk #define HAL_RX_FILTER_UCAST	0x00000001
242f51c4ae1Sreyk #define HAL_RX_FILTER_MCAST	0x00000002
243f51c4ae1Sreyk #define HAL_RX_FILTER_BCAST	0x00000004
244f51c4ae1Sreyk #define HAL_RX_FILTER_CONTROL	0x00000008
245f51c4ae1Sreyk #define HAL_RX_FILTER_BEACON	0x00000010
246f51c4ae1Sreyk #define HAL_RX_FILTER_PROM	0x00000020
247f51c4ae1Sreyk #define HAL_RX_FILTER_PROBEREQ	0x00000080
248f51c4ae1Sreyk #define HAL_RX_FILTER_PHYERR	0x00000100
249f51c4ae1Sreyk #define HAL_RX_FILTER_PHYRADAR	0x00000200
250f51c4ae1Sreyk 
251f51c4ae1Sreyk typedef struct {
252f51c4ae1Sreyk 	u_int32_t	ackrcv_bad;
253f51c4ae1Sreyk 	u_int32_t	rts_bad;
254f51c4ae1Sreyk 	u_int32_t	rts_good;
255f51c4ae1Sreyk 	u_int32_t	fcs_bad;
256f51c4ae1Sreyk 	u_int32_t	beacons;
257f51c4ae1Sreyk } HAL_MIB_STATS;
258f51c4ae1Sreyk 
259f51c4ae1Sreyk /*
260f51c4ae1Sreyk  * Beacon/AP definitions
261f51c4ae1Sreyk  */
262f51c4ae1Sreyk 
263f51c4ae1Sreyk #define HAL_BEACON_PERIOD	0x0000ffff
264f51c4ae1Sreyk #define HAL_BEACON_ENA		0x00800000
265f51c4ae1Sreyk #define HAL_BEACON_RESET_TSF	0x01000000
266f51c4ae1Sreyk 
267f51c4ae1Sreyk typedef struct {
268f51c4ae1Sreyk 	u_int32_t	bs_next_beacon;
269f51c4ae1Sreyk 	u_int32_t	bs_next_dtim;
270f51c4ae1Sreyk 	u_int32_t	bs_interval;
271f51c4ae1Sreyk 	u_int8_t	bs_dtim_period;
272f51c4ae1Sreyk 	u_int8_t	bs_cfp_period;
273f51c4ae1Sreyk 	u_int16_t	bs_cfp_max_duration;
274f51c4ae1Sreyk 	u_int16_t	bs_cfp_du_remain;
275f51c4ae1Sreyk 	u_int16_t	bs_tim_offset;
276f51c4ae1Sreyk 	u_int16_t	bs_sleep_duration;
277f51c4ae1Sreyk 	u_int16_t	bs_bmiss_threshold;
278f51c4ae1Sreyk 
279f51c4ae1Sreyk #define bs_nexttbtt		bs_next_beacon
280f51c4ae1Sreyk #define bs_intval		bs_interval
281f51c4ae1Sreyk #define bs_nextdtim		bs_next_dtim
282f51c4ae1Sreyk #define bs_bmissthreshold	bs_bmiss_threshold
283f51c4ae1Sreyk #define bs_sleepduration	bs_sleep_duration
284f51c4ae1Sreyk #define bs_dtimperiod		bs_dtim_period
285f51c4ae1Sreyk 
286f51c4ae1Sreyk } HAL_BEACON_STATE;
287f51c4ae1Sreyk 
288f51c4ae1Sreyk /*
289f51c4ae1Sreyk  * Power management
290f51c4ae1Sreyk  */
291f51c4ae1Sreyk 
292f51c4ae1Sreyk typedef enum {
293f51c4ae1Sreyk 	HAL_PM_UNDEFINED = 0,
294f51c4ae1Sreyk 	HAL_PM_AUTO,
295f51c4ae1Sreyk 	HAL_PM_AWAKE,
296f51c4ae1Sreyk 	HAL_PM_FULL_SLEEP,
297f51c4ae1Sreyk 	HAL_PM_NETWORK_SLEEP,
298f51c4ae1Sreyk } HAL_POWER_MODE;
299f51c4ae1Sreyk 
300f51c4ae1Sreyk /*
301f51c4ae1Sreyk  * Weak wireless crypto definitions (use IPsec/WLSec/...)
302f51c4ae1Sreyk  */
303f51c4ae1Sreyk 
304f51c4ae1Sreyk typedef enum {
305f51c4ae1Sreyk 	HAL_CIPHER_WEP = 0,
306f51c4ae1Sreyk 	HAL_CIPHER_AES_CCM,
307f51c4ae1Sreyk 	HAL_CIPHER_CKIP,
308f51c4ae1Sreyk } HAL_CIPHER;
309f51c4ae1Sreyk 
310f7acd08aSreyk #define AR5K_KEYVAL_LENGTH_40	5
311f7acd08aSreyk #define AR5K_KEYVAL_LENGTH_104	13
312f7acd08aSreyk #define AR5K_KEYVAL_LENGTH_128	16
313f7acd08aSreyk #define AR5K_KEYVAL_LENGTH_MAX	AR5K_KEYVAL_LENGTH_128
314f51c4ae1Sreyk 
315f51c4ae1Sreyk typedef struct {
316f51c4ae1Sreyk 	int		wk_len;
317f7acd08aSreyk 	u_int8_t	wk_key[AR5K_KEYVAL_LENGTH_MAX];
318f51c4ae1Sreyk } HAL_KEYVAL;
319f51c4ae1Sreyk 
320f51c4ae1Sreyk #define AR5K_ASSERT_ENTRY(_e, _s) do {					\
321f51c4ae1Sreyk 	if (_e >= _s)							\
322f51c4ae1Sreyk 		return (AH_FALSE);					\
323f51c4ae1Sreyk } while (0)
324f51c4ae1Sreyk 
325f51c4ae1Sreyk /*
326f51c4ae1Sreyk  * PHY
327f51c4ae1Sreyk  */
328f51c4ae1Sreyk 
329f51c4ae1Sreyk #define AR5K_MAX_RATES	32
330f51c4ae1Sreyk 
331f51c4ae1Sreyk typedef struct {
332f51c4ae1Sreyk 	u_int8_t	valid;
333f51c4ae1Sreyk 	u_int8_t	phy;
334f51c4ae1Sreyk 	u_int16_t	rateKbps;
335f51c4ae1Sreyk 	u_int8_t	rateCode;
336f51c4ae1Sreyk 	u_int8_t	shortPreamble;
337f51c4ae1Sreyk 	u_int8_t	dot11Rate;
338f51c4ae1Sreyk 	u_int8_t	controlRate;
339f51c4ae1Sreyk 
340f51c4ae1Sreyk #define r_valid			valid
341f51c4ae1Sreyk #define r_phy			phy
342f51c4ae1Sreyk #define r_rate_kbps		rateKbps
343dd37d60cSreyk #define r_rate_code		rateCode
344dd37d60cSreyk #define r_short_preamble	shortPreamble
345f51c4ae1Sreyk #define r_dot11_rate		dot11Rate
346f51c4ae1Sreyk #define r_control_rate		controlRate
347f51c4ae1Sreyk 
348f51c4ae1Sreyk } HAL_RATE;
349f51c4ae1Sreyk 
350f51c4ae1Sreyk typedef struct {
351f51c4ae1Sreyk 	u_int16_t	rateCount;
352f51c4ae1Sreyk 	u_int8_t	rateCodeToIndex[AR5K_MAX_RATES];
353f51c4ae1Sreyk 	HAL_RATE	info[AR5K_MAX_RATES];
354f51c4ae1Sreyk 
355f51c4ae1Sreyk #define rt_rate_count		rateCount
356f51c4ae1Sreyk #define rt_rate_code_index	rateCodeToIndex
357f51c4ae1Sreyk #define rt_info			info
358f51c4ae1Sreyk 
359f51c4ae1Sreyk } HAL_RATE_TABLE;
360f51c4ae1Sreyk 
361dd37d60cSreyk #define AR5K_RATES_11A { 8, {						\
362dd37d60cSreyk 	255, 255, 255, 255, 255, 255, 255, 255, 6, 4, 2, 0,		\
363dd37d60cSreyk 	7, 5, 3, 1, 255, 255, 255, 255, 255, 255, 255, 255,		\
364dd37d60cSreyk 	255, 255, 255, 255, 255, 255, 255, 255 }, {			\
365f51c4ae1Sreyk 	{ 1, IEEE80211_T_OFDM, 6000, 11, 0, 140, 0 },			\
366f51c4ae1Sreyk 	{ 1, IEEE80211_T_OFDM, 9000, 15, 0, 18, 0 },			\
367f51c4ae1Sreyk 	{ 1, IEEE80211_T_OFDM, 12000, 10, 0, 152, 2 },			\
368f51c4ae1Sreyk 	{ 1, IEEE80211_T_OFDM, 18000, 14, 0, 36, 2 },			\
369f51c4ae1Sreyk 	{ 1, IEEE80211_T_OFDM, 24000, 9, 0, 176, 4 },			\
370f51c4ae1Sreyk 	{ 1, IEEE80211_T_OFDM, 36000, 13, 0, 72, 4 },			\
371f51c4ae1Sreyk 	{ 1, IEEE80211_T_OFDM, 48000, 8, 0, 96, 4 },			\
372f51c4ae1Sreyk 	{ 1, IEEE80211_T_OFDM, 54000, 12, 0, 108, 4 } }			\
373f51c4ae1Sreyk }
374f51c4ae1Sreyk 
375dd37d60cSreyk #define AR5K_RATES_11B { 4, {						\
376dd37d60cSreyk 	255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,	\
377dd37d60cSreyk 	255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,	\
378dd37d60cSreyk 	3, 2, 1, 0, 255, 255, 255, 255 }, {				\
3799ebef271Sreyk 	{ 1, IEEE80211_T_CCK, 1000, 27, 0x00, 130, 0 },			\
3806eac2691Sreyk 	{ 1, IEEE80211_T_CCK, 2000, 26, 0x04, 132, 1 },			\
3816eac2691Sreyk 	{ 1, IEEE80211_T_CCK, 5500, 25, 0x04, 139, 1 },			\
3826eac2691Sreyk 	{ 1, IEEE80211_T_CCK, 11000, 24, 0x04, 150, 1 } }		\
3839ebef271Sreyk }
3849ebef271Sreyk 
385dd37d60cSreyk #define AR5K_RATES_11G { 12, {						\
386dd37d60cSreyk 	255, 255, 255, 255, 255, 255, 255, 255, 10, 8, 6, 4,		\
387dd37d60cSreyk 	11, 9, 7, 5, 255, 255, 255, 255, 255, 255, 255, 255,		\
388dd37d60cSreyk 	3, 2, 1, 0, 255, 255, 255, 255 }, {				\
38946de7734Sstsp 	{ 1, IEEE80211_T_CCK, 1000, 27, 0x00, 130, 0 },			\
39046de7734Sstsp 	{ 1, IEEE80211_T_CCK, 2000, 26, 0x04, 132, 1 },			\
39146de7734Sstsp 	{ 1, IEEE80211_T_CCK, 5500, 25, 0x04, 139, 2 },			\
39246de7734Sstsp 	{ 1, IEEE80211_T_CCK, 11000, 24, 0x04, 150, 3 },		\
3939ebef271Sreyk 	{ 0, IEEE80211_T_OFDM, 6000, 11, 0, 12, 4 },			\
3949ebef271Sreyk 	{ 0, IEEE80211_T_OFDM, 9000, 15, 0, 18, 4 },			\
3959ebef271Sreyk 	{ 1, IEEE80211_T_OFDM, 12000, 10, 0, 24, 6 },			\
3969ebef271Sreyk 	{ 1, IEEE80211_T_OFDM, 18000, 14, 0, 36, 6 },			\
3979ebef271Sreyk 	{ 1, IEEE80211_T_OFDM, 24000, 9, 0, 48, 8 },			\
3989ebef271Sreyk 	{ 1, IEEE80211_T_OFDM, 36000, 13, 0, 72, 8 },			\
3999ebef271Sreyk 	{ 1, IEEE80211_T_OFDM, 48000, 8, 0, 96, 8 },			\
4009ebef271Sreyk 	{ 1, IEEE80211_T_OFDM, 54000, 12, 0, 108, 8 } }			\
4019ebef271Sreyk }
4029ebef271Sreyk 
403dd37d60cSreyk #define AR5K_RATES_XR { 12, {						\
404dd37d60cSreyk 	255, 3, 1, 255, 255, 255, 2, 0, 10, 8, 6, 4,			\
405dd37d60cSreyk 	11, 9, 7, 5, 255, 255, 255, 255, 255, 255, 255, 255,		\
406dd37d60cSreyk 	255, 255, 255, 255, 255, 255, 255, 255 }, {			\
407dd37d60cSreyk 	{ 1, IEEE80211_T_XR, 500, 7, 0, 129, 0 },			\
408dd37d60cSreyk 	{ 1, IEEE80211_T_XR, 1000, 2, 0, 139, 1 },			\
409dd37d60cSreyk 	{ 1, IEEE80211_T_XR, 2000, 6, 0, 150, 2 },			\
410dd37d60cSreyk 	{ 1, IEEE80211_T_XR, 3000, 1, 0, 150, 3 },			\
411dd37d60cSreyk 	{ 1, IEEE80211_T_OFDM, 6000, 11, 0, 140, 4 },			\
412dd37d60cSreyk 	{ 1, IEEE80211_T_OFDM, 9000, 15, 0, 18, 4 },			\
413dd37d60cSreyk 	{ 1, IEEE80211_T_OFDM, 12000, 10, 0, 152, 6 },			\
414dd37d60cSreyk 	{ 1, IEEE80211_T_OFDM, 18000, 14, 0, 36, 6 },			\
415dd37d60cSreyk 	{ 1, IEEE80211_T_OFDM, 24000, 9, 0, 176, 8 },			\
416dd37d60cSreyk 	{ 1, IEEE80211_T_OFDM, 36000, 13, 0, 72, 8 },			\
417dd37d60cSreyk 	{ 1, IEEE80211_T_OFDM, 48000, 8, 0, 96, 8 },			\
418dd37d60cSreyk 	{ 1, IEEE80211_T_OFDM, 54000, 12, 0, 108, 8 } }			\
419dd37d60cSreyk }
420dd37d60cSreyk 
421f51c4ae1Sreyk typedef enum {
422f51c4ae1Sreyk 	HAL_RFGAIN_INACTIVE = 0,
423f51c4ae1Sreyk 	HAL_RFGAIN_READ_REQUESTED,
424f51c4ae1Sreyk 	HAL_RFGAIN_NEED_CHANGE,
425f51c4ae1Sreyk } HAL_RFGAIN;
426f51c4ae1Sreyk 
427f51c4ae1Sreyk typedef struct {
428f51c4ae1Sreyk 	u_int16_t	channel; /* MHz */
429f51c4ae1Sreyk 	u_int16_t	channelFlags;
430f51c4ae1Sreyk 
431f51c4ae1Sreyk #define c_channel	channel
432b28497f7Sreyk #define c_channel_flags	channelFlags
433f51c4ae1Sreyk 
434f51c4ae1Sreyk } HAL_CHANNEL;
435f51c4ae1Sreyk 
4366eac2691Sreyk #define HAL_SLOT_TIME_9		396
4376eac2691Sreyk #define HAL_SLOT_TIME_20	880
4386eac2691Sreyk #define HAL_SLOT_TIME_MAX	0xffff
439f51c4ae1Sreyk 
440f51c4ae1Sreyk #define CHANNEL_A	(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
441f51c4ae1Sreyk #define CHANNEL_B	(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK)
442958b4d3eSreyk #define CHANNEL_G	(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN)
443f51c4ae1Sreyk #define CHANNEL_PUREG	(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM)
444f51c4ae1Sreyk #define CHANNEL_XR	(CHANNEL_A | IEEE80211_CHAN_XR)
44554aa1b74Sreyk #define CHANNEL_MODES	\
4468fa13e1fSstsp 	(CHANNEL_A | CHANNEL_B | CHANNEL_G | CHANNEL_PUREG | CHANNEL_XR)
447f51c4ae1Sreyk 
4489ebef271Sreyk typedef enum {
4499ebef271Sreyk 	HAL_CHIP_5GHZ = IEEE80211_CHAN_5GHZ,
45054aa1b74Sreyk 	HAL_CHIP_2GHZ = IEEE80211_CHAN_2GHZ
4519ebef271Sreyk } HAL_CHIP;
4529ebef271Sreyk 
4539ebef271Sreyk /*
4549ebef271Sreyk  * The following structure will be used to map 2GHz channels to
4559ebef271Sreyk  * 5GHz Atheros channels.
4569ebef271Sreyk  */
4579ebef271Sreyk 
4589ebef271Sreyk struct ar5k_athchan_2ghz {
4599ebef271Sreyk 	u_int32_t	a2_flags;
4609ebef271Sreyk 	u_int16_t	a2_athchan;
4619ebef271Sreyk };
4629ebef271Sreyk 
463f51c4ae1Sreyk /*
464f51c4ae1Sreyk  * Regulation stuff
465f51c4ae1Sreyk  */
466f51c4ae1Sreyk 
467f51c4ae1Sreyk typedef enum ieee80211_countrycode HAL_CTRY_CODE;
468f51c4ae1Sreyk 
469f51c4ae1Sreyk /*
470f51c4ae1Sreyk  * HAL interrupt abstraction
471f51c4ae1Sreyk  */
472f51c4ae1Sreyk 
473f51c4ae1Sreyk #define HAL_INT_RX	0x00000001
474f51c4ae1Sreyk #define HAL_INT_RXDESC	0x00000002
475f51c4ae1Sreyk #define HAL_INT_RXNOFRM	0x00000008
476f51c4ae1Sreyk #define HAL_INT_RXEOL	0x00000010
477f51c4ae1Sreyk #define HAL_INT_RXORN	0x00000020
478f51c4ae1Sreyk #define HAL_INT_TX	0x00000040
479f51c4ae1Sreyk #define HAL_INT_TXDESC	0x00000080
480f51c4ae1Sreyk #define HAL_INT_TXURN	0x00000800
481f51c4ae1Sreyk #define HAL_INT_MIB	0x00001000
482f51c4ae1Sreyk #define HAL_INT_RXPHY	0x00004000
483f51c4ae1Sreyk #define HAL_INT_RXKCM	0x00008000
484f51c4ae1Sreyk #define HAL_INT_SWBA	0x00010000
485f51c4ae1Sreyk #define HAL_INT_BMISS	0x00040000
486f51c4ae1Sreyk #define HAL_INT_BNR	0x00100000
487f51c4ae1Sreyk #define HAL_INT_GPIO	0x01000000
488f51c4ae1Sreyk #define HAL_INT_FATAL	0x40000000
489f51c4ae1Sreyk #define HAL_INT_GLOBAL	0x80000000
490f51c4ae1Sreyk #define HAL_INT_NOCARD	0xffffffff
491f51c4ae1Sreyk #define HAL_INT_COMMON	(						\
492f51c4ae1Sreyk 	HAL_INT_RXNOFRM | HAL_INT_RXDESC | HAL_INT_RXEOL |		\
493f51c4ae1Sreyk 	HAL_INT_RXORN | HAL_INT_TXURN | HAL_INT_TXDESC |		\
494f51c4ae1Sreyk 	HAL_INT_MIB | HAL_INT_RXPHY | HAL_INT_RXKCM |			\
495f51c4ae1Sreyk 	HAL_INT_SWBA | HAL_INT_BMISS | HAL_INT_GPIO			\
496f51c4ae1Sreyk )
497f51c4ae1Sreyk 
498f51c4ae1Sreyk typedef u_int32_t HAL_INT;
499f51c4ae1Sreyk 
500f51c4ae1Sreyk /*
501f51c4ae1Sreyk  * LED states
502f51c4ae1Sreyk  */
503f51c4ae1Sreyk 
504f51c4ae1Sreyk typedef enum ieee80211_state HAL_LED_STATE;
505f51c4ae1Sreyk 
506f51c4ae1Sreyk #define HAL_LED_INIT	IEEE80211_S_INIT
507f51c4ae1Sreyk #define HAL_LED_SCAN	IEEE80211_S_SCAN
508f51c4ae1Sreyk #define HAL_LED_AUTH	IEEE80211_S_AUTH
509f51c4ae1Sreyk #define HAL_LED_ASSOC	IEEE80211_S_ASSOC
510f51c4ae1Sreyk #define HAL_LED_RUN	IEEE80211_S_RUN
511f51c4ae1Sreyk 
512bc212de1Sreyk /* GPIO-controlled software LED */
513bc212de1Sreyk #define AR5K_SOFTLED_PIN	0
514bc212de1Sreyk #define AR5K_SOFTLED_ON		0
515bc212de1Sreyk #define AR5K_SOFTLED_OFF	1
516bc212de1Sreyk 
517f51c4ae1Sreyk /*
518dd37d60cSreyk  * Gain settings
519dd37d60cSreyk  */
520dd37d60cSreyk 
521dd37d60cSreyk #define	AR5K_GAIN_CRN_FIX_BITS_5111	4
522dd37d60cSreyk #define	AR5K_GAIN_CRN_FIX_BITS_5112	7
523dd37d60cSreyk #define	AR5K_GAIN_CRN_MAX_FIX_BITS	AR5K_GAIN_CRN_FIX_BITS_5112
524dd37d60cSreyk #define	AR5K_GAIN_DYN_ADJUST_HI_MARGIN	15
525dd37d60cSreyk #define	AR5K_GAIN_DYN_ADJUST_LO_MARGIN	20
526dd37d60cSreyk #define	AR5K_GAIN_CCK_PROBE_CORR	5
527dd37d60cSreyk #define	AR5K_GAIN_CCK_OFDM_GAIN_DELTA	15
528dd37d60cSreyk #define	AR5K_GAIN_STEP_COUNT		10
529dd37d60cSreyk #define AR5K_GAIN_PARAM_TX_CLIP		0
530dd37d60cSreyk #define AR5K_GAIN_PARAM_PD_90		1
531dd37d60cSreyk #define AR5K_GAIN_PARAM_PD_84		2
532dd37d60cSreyk #define AR5K_GAIN_PARAM_GAIN_SEL	3
533dd37d60cSreyk #define AR5K_GAIN_PARAM_MIX_ORN		0
534dd37d60cSreyk #define AR5K_GAIN_PARAM_PD_138		1
535dd37d60cSreyk #define AR5K_GAIN_PARAM_PD_137		2
536dd37d60cSreyk #define AR5K_GAIN_PARAM_PD_136		3
537dd37d60cSreyk #define AR5K_GAIN_PARAM_PD_132		4
538dd37d60cSreyk #define AR5K_GAIN_PARAM_PD_131		5
539dd37d60cSreyk #define AR5K_GAIN_PARAM_PD_130		6
540dd37d60cSreyk #define AR5K_GAIN_CHECK_ADJUST(_g)					\
541dd37d60cSreyk 	((_g)->g_current <= (_g)->g_low || (_g)->g_current >= (_g)->g_high)
542dd37d60cSreyk 
543dd37d60cSreyk struct ar5k_gain_opt_step {
544dd37d60cSreyk 	int16_t				gos_param[AR5K_GAIN_CRN_MAX_FIX_BITS];
545dd37d60cSreyk 	int32_t				gos_gain;
546dd37d60cSreyk };
547dd37d60cSreyk 
548dd37d60cSreyk struct ar5k_gain_opt {
549dd37d60cSreyk 	u_int32_t			go_default;
550dd37d60cSreyk 	u_int32_t			go_steps_count;
551dd37d60cSreyk 	const struct ar5k_gain_opt_step	go_step[AR5K_GAIN_STEP_COUNT];
552dd37d60cSreyk };
553dd37d60cSreyk 
554dd37d60cSreyk struct ar5k_gain {
555dd37d60cSreyk 	u_int32_t			g_step_idx;
556dd37d60cSreyk 	u_int32_t			g_current;
557dd37d60cSreyk 	u_int32_t			g_target;
558dd37d60cSreyk 	u_int32_t			g_low;
559dd37d60cSreyk 	u_int32_t			g_high;
560dd37d60cSreyk 	u_int32_t			g_f_corr;
561dd37d60cSreyk 	u_int32_t			g_active;
562dd37d60cSreyk 	const struct ar5k_gain_opt_step	*g_step;
563dd37d60cSreyk };
564dd37d60cSreyk 
565dd37d60cSreyk #define AR5K_AR5111_GAIN_OPT	{					\
566dd37d60cSreyk 	4,								\
567dd37d60cSreyk 	9,								\
568dd37d60cSreyk 	{								\
569dd37d60cSreyk 		{ { 4, 1, 1, 1 }, 6 },					\
570dd37d60cSreyk 		{ { 4, 0, 1, 1 }, 4 },					\
571dd37d60cSreyk 		{ { 3, 1, 1, 1 }, 3 },					\
572dd37d60cSreyk 		{ { 4, 0, 0, 1 }, 1 },					\
573dd37d60cSreyk 		{ { 4, 1, 1, 0 }, 0 },					\
574dd37d60cSreyk 		{ { 4, 0, 1, 0 }, -2 },					\
575dd37d60cSreyk 		{ { 3, 1, 1, 0 }, -3 },					\
576dd37d60cSreyk 		{ { 4, 0, 0, 0 }, -4 },					\
577dd37d60cSreyk 		{ { 2, 1, 1, 0 }, -6 }					\
578dd37d60cSreyk 	}								\
579dd37d60cSreyk }
580dd37d60cSreyk 
581dd37d60cSreyk #define AR5K_AR5112_GAIN_OPT	{					\
582dd37d60cSreyk 	1,								\
583dd37d60cSreyk 	8,								\
584dd37d60cSreyk 	{								\
585dd37d60cSreyk 		{ { 3, 0, 0, 0, 0, 0, 0 }, 6 },				\
586dd37d60cSreyk 		{ { 2, 0, 0, 0, 0, 0, 0 }, 0 },				\
587dd37d60cSreyk 		{ { 1, 0, 0, 0, 0, 0, 0 }, -3 },			\
588dd37d60cSreyk 		{ { 0, 0, 0, 0, 0, 0, 0 }, -6 },			\
589dd37d60cSreyk 		{ { 0, 1, 1, 0, 0, 0, 0 }, -8 },			\
590dd37d60cSreyk 		{ { 0, 1, 1, 0, 1, 1, 0 }, -10 },			\
591dd37d60cSreyk 		{ { 0, 1, 0, 1, 1, 1, 0 }, -13 },			\
592dd37d60cSreyk 		{ { 0, 1, 0, 1, 1, 0, 1 }, -16 },			\
593dd37d60cSreyk 	}								\
594dd37d60cSreyk }
595dd37d60cSreyk 
596dd37d60cSreyk /*
5979ebef271Sreyk  * Common ar5xxx EEPROM data registers
5989ebef271Sreyk  */
5999ebef271Sreyk 
6009ebef271Sreyk #define AR5K_EEPROM_MAGIC		0x003d
6019ebef271Sreyk #define AR5K_EEPROM_MAGIC_VALUE		0x5aa5
6029ebef271Sreyk #define AR5K_EEPROM_PROTECT		0x003f
6039ebef271Sreyk #define AR5K_EEPROM_PROTECT_RD_0_31	0x0001
6049ebef271Sreyk #define AR5K_EEPROM_PROTECT_WR_0_31	0x0002
6059ebef271Sreyk #define AR5K_EEPROM_PROTECT_RD_32_63	0x0004
6069ebef271Sreyk #define AR5K_EEPROM_PROTECT_WR_32_63	0x0008
6079ebef271Sreyk #define AR5K_EEPROM_PROTECT_RD_64_127	0x0010
6089ebef271Sreyk #define AR5K_EEPROM_PROTECT_WR_64_127	0x0020
6099ebef271Sreyk #define AR5K_EEPROM_PROTECT_RD_128_191	0x0040
6109ebef271Sreyk #define AR5K_EEPROM_PROTECT_WR_128_191	0x0080
6119ebef271Sreyk #define AR5K_EEPROM_PROTECT_RD_192_207	0x0100
6129ebef271Sreyk #define AR5K_EEPROM_PROTECT_WR_192_207	0x0200
6139ebef271Sreyk #define AR5K_EEPROM_PROTECT_RD_208_223	0x0400
6149ebef271Sreyk #define AR5K_EEPROM_PROTECT_WR_208_223	0x0800
6159ebef271Sreyk #define AR5K_EEPROM_PROTECT_RD_224_239	0x1000
6169ebef271Sreyk #define AR5K_EEPROM_PROTECT_WR_224_239	0x2000
6179ebef271Sreyk #define AR5K_EEPROM_PROTECT_RD_240_255	0x4000
6189ebef271Sreyk #define AR5K_EEPROM_PROTECT_WR_240_255	0x8000
6199ebef271Sreyk #define AR5K_EEPROM_REG_DOMAIN		0x00bf
6209ebef271Sreyk #define AR5K_EEPROM_INFO_BASE		0x00c0
6219ebef271Sreyk #define AR5K_EEPROM_INFO_MAX						\
6229ebef271Sreyk 	(0x400 - AR5K_EEPROM_INFO_BASE)
6230ce211edSreyk #define AR5K_EEPROM_INFO_CKSUM		0xffff
6249ebef271Sreyk #define AR5K_EEPROM_INFO(_n)		(AR5K_EEPROM_INFO_BASE + (_n))
6259ebef271Sreyk 
6269ebef271Sreyk #define AR5K_EEPROM_VERSION		AR5K_EEPROM_INFO(1)
6279ebef271Sreyk #define AR5K_EEPROM_VERSION_3_0		0x3000
6289ebef271Sreyk #define AR5K_EEPROM_VERSION_3_1		0x3001
6299ebef271Sreyk #define AR5K_EEPROM_VERSION_3_2		0x3002
6309ebef271Sreyk #define AR5K_EEPROM_VERSION_3_3		0x3003
6319ebef271Sreyk #define AR5K_EEPROM_VERSION_3_4		0x3004
6329ebef271Sreyk #define AR5K_EEPROM_VERSION_4_0		0x4000
6339ebef271Sreyk #define AR5K_EEPROM_VERSION_4_1		0x4001
6349ebef271Sreyk #define AR5K_EEPROM_VERSION_4_2		0x4002
6359ebef271Sreyk #define AR5K_EEPROM_VERSION_4_3		0x4003
6369ebef271Sreyk #define AR5K_EEPROM_VERSION_4_6		0x4006
6379ebef271Sreyk #define AR5K_EEPROM_VERSION_4_7		0x3007
6389ebef271Sreyk 
6399ebef271Sreyk #define AR5K_EEPROM_MODE_11A	0
6409ebef271Sreyk #define AR5K_EEPROM_MODE_11B	1
6419ebef271Sreyk #define AR5K_EEPROM_MODE_11G	2
6429ebef271Sreyk 
6439ebef271Sreyk #define AR5K_EEPROM_HDR			AR5K_EEPROM_INFO(2)
6449ebef271Sreyk #define AR5K_EEPROM_HDR_11A(_v)		(((_v) >> AR5K_EEPROM_MODE_11A) & 0x1)
6459ebef271Sreyk #define AR5K_EEPROM_HDR_11B(_v)		(((_v) >> AR5K_EEPROM_MODE_11B) & 0x1)
6469ebef271Sreyk #define AR5K_EEPROM_HDR_11G(_v)		(((_v) >> AR5K_EEPROM_MODE_11G) & 0x1)
6479ebef271Sreyk #define AR5K_EEPROM_HDR_T_2GHZ_DIS(_v)	(((_v) >> 3) & 0x1)
6489ebef271Sreyk #define AR5K_EEPROM_HDR_T_5GHZ_DBM(_v)	(((_v) >> 4) & 0x7f)
6499ebef271Sreyk #define AR5K_EEPROM_HDR_DEVICE(_v)	(((_v) >> 11) & 0x7)
6509ebef271Sreyk #define AR5K_EEPROM_HDR_T_5GHZ_DIS(_v)	(((_v) >> 15) & 0x1)
6519ebef271Sreyk #define AR5K_EEPROM_HDR_RFKILL(_v)	(((_v) >> 14) & 0x1)
6529ebef271Sreyk 
6539ebef271Sreyk #define AR5K_EEPROM_RFKILL_GPIO_SEL	0x0000001c
6549ebef271Sreyk #define AR5K_EEPROM_RFKILL_GPIO_SEL_S	2
6559ebef271Sreyk #define AR5K_EEPROM_RFKILL_POLARITY	0x00000002
6569ebef271Sreyk #define AR5K_EEPROM_RFKILL_POLARITY_S	1
6579ebef271Sreyk 
6589ebef271Sreyk /* Newer EEPROMs are using a different offset */
6599ebef271Sreyk #define AR5K_EEPROM_OFF(_v, _v3_0, _v3_3)					\
6609ebef271Sreyk 	(((_v) >= AR5K_EEPROM_VERSION_3_3) ? _v3_3 : _v3_0)
6619ebef271Sreyk 
6629ebef271Sreyk #define AR5K_EEPROM_ANT_GAIN(_v)	AR5K_EEPROM_OFF(_v, 0x00c4, 0x00c3)
663486f10cbSreyk #define AR5K_EEPROM_ANT_GAIN_5GHZ(_v)	((int8_t)(((_v) >> 8) & 0xff))
6649ebef271Sreyk #define AR5K_EEPROM_ANT_GAIN_2GHZ(_v)	((int8_t)((_v) & 0xff))
6659ebef271Sreyk 
6669ebef271Sreyk #define AR5K_EEPROM_MODES_11A(_v)	AR5K_EEPROM_OFF(_v, 0x00c5, 0x00d4)
6679ebef271Sreyk #define AR5K_EEPROM_MODES_11B(_v)	AR5K_EEPROM_OFF(_v, 0x00d0, 0x00f2)
6689ebef271Sreyk #define AR5K_EEPROM_MODES_11G(_v)	AR5K_EEPROM_OFF(_v, 0x00da, 0x010d)
6699ebef271Sreyk #define AR5K_EEPROM_CTL(_v)		AR5K_EEPROM_OFF(_v, 0x00e4, 0x0128)
6709ebef271Sreyk 
6719ebef271Sreyk /* Since 3.1 */
6729ebef271Sreyk #define AR5K_EEPROM_OBDB0_2GHZ	0x00ec
6739ebef271Sreyk #define AR5K_EEPROM_OBDB1_2GHZ	0x00ed
6749ebef271Sreyk 
6759ebef271Sreyk /* Misc values available since EEPROM 4.0 */
6769ebef271Sreyk #define AR5K_EEPROM_MISC0		0x00c4
6779ebef271Sreyk #define AR5K_EEPROM_EARSTART(_v)	((_v) & 0xfff)
6789ebef271Sreyk #define AR5K_EEPROM_EEMAP(_v)		(((_v) >> 14) & 0x3)
6799ebef271Sreyk #define AR5K_EEPROM_MISC1		0x00c5
6809ebef271Sreyk #define AR5K_EEPROM_TARGET_PWRSTART(_v)	((_v) & 0xfff)
6819ebef271Sreyk #define AR5K_EEPROM_HAS32KHZCRYSTAL(_v)	(((_v) >> 14) & 0x1)
6829ebef271Sreyk 
6839ebef271Sreyk /* Some EEPROM defines */
6849ebef271Sreyk #define AR5K_EEPROM_EEP_SCALE		100
6859ebef271Sreyk #define AR5K_EEPROM_EEP_DELTA		10
6869ebef271Sreyk #define AR5K_EEPROM_N_MODES		3
6879ebef271Sreyk #define AR5K_EEPROM_N_5GHZ_CHAN		10
6889ebef271Sreyk #define AR5K_EEPROM_N_2GHZ_CHAN		3
6899ebef271Sreyk #define AR5K_EEPROM_MAX_CHAN		10
6909ebef271Sreyk #define AR5K_EEPROM_N_PCDAC		11
6919ebef271Sreyk #define AR5K_EEPROM_N_TEST_FREQ		8
6929ebef271Sreyk #define AR5K_EEPROM_N_EDGES		8
6939ebef271Sreyk #define AR5K_EEPROM_N_INTERCEPTS	11
6949ebef271Sreyk #define AR5K_EEPROM_FREQ_M(_v)		AR5K_EEPROM_OFF(_v, 0x7f, 0xff)
6959ebef271Sreyk #define AR5K_EEPROM_PCDAC_M		0x3f
6969ebef271Sreyk #define AR5K_EEPROM_PCDAC_START		1
6979ebef271Sreyk #define AR5K_EEPROM_PCDAC_STOP		63
6989ebef271Sreyk #define AR5K_EEPROM_PCDAC_STEP		1
6999ebef271Sreyk #define AR5K_EEPROM_NON_EDGE_M		0x40
7009ebef271Sreyk #define AR5K_EEPROM_CHANNEL_POWER	8
7019ebef271Sreyk #define AR5K_EEPROM_N_OBDB		4
7029ebef271Sreyk #define AR5K_EEPROM_OBDB_DIS		0xffff
7039ebef271Sreyk #define AR5K_EEPROM_CHANNEL_DIS		0xff
7049ebef271Sreyk #define AR5K_EEPROM_SCALE_OC_DELTA(_x)	(((_x) * 2) / 10)
7059ebef271Sreyk #define AR5K_EEPROM_N_CTLS(_v)		AR5K_EEPROM_OFF(_v, 16, 32)
7069ebef271Sreyk #define AR5K_EEPROM_MAX_CTLS		32
7079ebef271Sreyk #define AR5K_EEPROM_N_XPD_PER_CHANNEL	4
7089ebef271Sreyk #define AR5K_EEPROM_N_XPD0_POINTS	4
7099ebef271Sreyk #define AR5K_EEPROM_N_XPD3_POINTS	3
7109ebef271Sreyk #define AR5K_EEPROM_N_INTERCEPT_10_2GHZ	35
7119ebef271Sreyk #define AR5K_EEPROM_N_INTERCEPT_10_5GHZ	55
7129ebef271Sreyk #define AR5K_EEPROM_POWER_M		0x3f
7139ebef271Sreyk #define AR5K_EEPROM_POWER_MIN		0
7149ebef271Sreyk #define AR5K_EEPROM_POWER_MAX		3150
7159ebef271Sreyk #define AR5K_EEPROM_POWER_STEP		50
7169ebef271Sreyk #define AR5K_EEPROM_POWER_TABLE_SIZE	64
7179ebef271Sreyk #define AR5K_EEPROM_N_POWER_LOC_11B	4
7189ebef271Sreyk #define AR5K_EEPROM_N_POWER_LOC_11G	6
7199ebef271Sreyk #define AR5K_EEPROM_I_GAIN		10
7209ebef271Sreyk #define AR5K_EEPROM_CCK_OFDM_DELTA	15
7219ebef271Sreyk #define AR5K_EEPROM_N_IQ_CAL		2
7229ebef271Sreyk 
7239ebef271Sreyk struct ar5k_eeprom_info {
7249ebef271Sreyk 	u_int16_t	ee_magic;
7259ebef271Sreyk 	u_int16_t	ee_protect;
7269ebef271Sreyk 	u_int16_t	ee_regdomain;
7279ebef271Sreyk 	u_int16_t	ee_version;
7289ebef271Sreyk 	u_int16_t	ee_header;
7299ebef271Sreyk 	u_int16_t	ee_ant_gain;
7309ebef271Sreyk 	u_int16_t	ee_misc0;
7319ebef271Sreyk 	u_int16_t	ee_misc1;
7329ebef271Sreyk 	u_int16_t	ee_cck_ofdm_gain_delta;
7339ebef271Sreyk 	u_int16_t	ee_cck_ofdm_power_delta;
7349ebef271Sreyk 	u_int16_t	ee_scaled_cck_delta;
7359ebef271Sreyk 	u_int16_t	ee_tx_clip;
7369ebef271Sreyk 	u_int16_t	ee_pwd_84;
7379ebef271Sreyk 	u_int16_t	ee_pwd_90;
7389ebef271Sreyk 	u_int16_t	ee_gain_select;
7399ebef271Sreyk 
7409ebef271Sreyk 	u_int16_t	ee_i_cal[AR5K_EEPROM_N_MODES];
7419ebef271Sreyk 	u_int16_t	ee_q_cal[AR5K_EEPROM_N_MODES];
7429ebef271Sreyk 	u_int16_t	ee_fixed_bias[AR5K_EEPROM_N_MODES];
7439ebef271Sreyk 	u_int16_t	ee_xr_power[AR5K_EEPROM_N_MODES];
7449ebef271Sreyk 	u_int16_t	ee_switch_settling[AR5K_EEPROM_N_MODES];
7459ebef271Sreyk 	u_int16_t	ee_ant_tx_rx[AR5K_EEPROM_N_MODES];
7469ebef271Sreyk 	u_int16_t	ee_ant_control[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_PCDAC];
7479ebef271Sreyk 	u_int16_t	ee_ob[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_OBDB];
7489ebef271Sreyk 	u_int16_t	ee_db[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_OBDB];
7499ebef271Sreyk 	u_int16_t	ee_tx_end2xlna_enable[AR5K_EEPROM_N_MODES];
7509ebef271Sreyk 	u_int16_t	ee_tx_end2xpa_disable[AR5K_EEPROM_N_MODES];
7519ebef271Sreyk 	u_int16_t	ee_tx_frm2xpa_enable[AR5K_EEPROM_N_MODES];
7529ebef271Sreyk 	u_int16_t	ee_thr_62[AR5K_EEPROM_N_MODES];
7539ebef271Sreyk 	u_int16_t	ee_xlna_gain[AR5K_EEPROM_N_MODES];
7549ebef271Sreyk 	u_int16_t	ee_xpd[AR5K_EEPROM_N_MODES];
7559ebef271Sreyk 	u_int16_t	ee_x_gain[AR5K_EEPROM_N_MODES];
7569ebef271Sreyk 	u_int16_t	ee_i_gain[AR5K_EEPROM_N_MODES];
7579ebef271Sreyk 	u_int16_t	ee_margin_tx_rx[AR5K_EEPROM_N_MODES];
7589ebef271Sreyk 	u_int16_t	ee_false_detect[AR5K_EEPROM_N_MODES];
7599ebef271Sreyk 	u_int16_t	ee_cal_pier[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_2GHZ_CHAN];
7609ebef271Sreyk 	u_int16_t	ee_channel[AR5K_EEPROM_N_MODES][AR5K_EEPROM_MAX_CHAN];
7619ebef271Sreyk 
7629ebef271Sreyk 	u_int16_t	ee_ctls;
7639ebef271Sreyk 	u_int16_t	ee_ctl[AR5K_EEPROM_MAX_CTLS];
7649ebef271Sreyk 
7659ebef271Sreyk 	int16_t		ee_noise_floor_thr[AR5K_EEPROM_N_MODES];
7669ebef271Sreyk 	int8_t		ee_adc_desired_size[AR5K_EEPROM_N_MODES];
7679ebef271Sreyk 	int8_t		ee_pga_desired_size[AR5K_EEPROM_N_MODES];
7689ebef271Sreyk };
7699ebef271Sreyk 
7709ebef271Sreyk /*
771f51c4ae1Sreyk  * Chipset capabilities
772f51c4ae1Sreyk  */
773f51c4ae1Sreyk 
774f51c4ae1Sreyk typedef struct {
775f51c4ae1Sreyk 	/*
776f51c4ae1Sreyk 	 * Supported PHY modes
777f51c4ae1Sreyk 	 * (ie. IEEE80211_CHAN_A, IEEE80211_CHAN_B, ...)
778f51c4ae1Sreyk 	 */
779f51c4ae1Sreyk 	u_int16_t	cap_mode;
780f51c4ae1Sreyk 
781f51c4ae1Sreyk 	/*
782f51c4ae1Sreyk 	 * Frequency range (without regulation restrictions)
783f51c4ae1Sreyk 	 */
784f51c4ae1Sreyk 	struct {
785f51c4ae1Sreyk 		u_int16_t	range_2ghz_min;
786f51c4ae1Sreyk 		u_int16_t	range_2ghz_max;
787f51c4ae1Sreyk 		u_int16_t	range_5ghz_min;
788f51c4ae1Sreyk 		u_int16_t	range_5ghz_max;
789f51c4ae1Sreyk 	} cap_range;
790f51c4ae1Sreyk 
791f51c4ae1Sreyk 	/*
792f51c4ae1Sreyk 	 * Active regulation domain settings
793f51c4ae1Sreyk 	 */
794f51c4ae1Sreyk 	struct {
795f51c4ae1Sreyk 		ieee80211_regdomain_t	reg_current;
796f51c4ae1Sreyk 		ieee80211_regdomain_t	reg_hw;
797f51c4ae1Sreyk 	} cap_regdomain;
798f51c4ae1Sreyk 
799f51c4ae1Sreyk 	/*
800f51c4ae1Sreyk 	 * Values stored in the EEPROM (some of them...)
801f51c4ae1Sreyk 	 */
8029ebef271Sreyk 	struct ar5k_eeprom_info	cap_eeprom;
803f51c4ae1Sreyk 
804f51c4ae1Sreyk 	/*
805f51c4ae1Sreyk 	 * Queue information
806f51c4ae1Sreyk 	 */
807f51c4ae1Sreyk 	struct {
808f51c4ae1Sreyk 		u_int8_t	q_tx_num;
809f51c4ae1Sreyk 	} cap_queues;
810f51c4ae1Sreyk } ar5k_capabilities_t;
811f51c4ae1Sreyk 
812f51c4ae1Sreyk /*
8139ebef271Sreyk  * TX power and TPC settings
8149ebef271Sreyk  */
8159ebef271Sreyk 
8169ebef271Sreyk #define AR5K_TXPOWER_OFDM(_r, _v)	(				\
817486f10cbSreyk 	((0 & 1) << ((_v) + 6)) |					\
818486f10cbSreyk 	(((hal->ah_txpower.txp_rates[(_r)]) & 0x3f) << (_v))		\
8199ebef271Sreyk )
8209ebef271Sreyk 
8219ebef271Sreyk #define AR5K_TXPOWER_CCK(_r, _v)	(				\
822486f10cbSreyk 	(hal->ah_txpower.txp_rates[(_r)] & 0x3f) << (_v)		\
8239ebef271Sreyk )
8249ebef271Sreyk 
8259ebef271Sreyk /*
826f51c4ae1Sreyk  * Atheros descriptor definitions
827f51c4ae1Sreyk  */
828f51c4ae1Sreyk 
829f51c4ae1Sreyk struct ath_tx_status {
830f51c4ae1Sreyk 	u_int16_t	ts_seqnum;
831f51c4ae1Sreyk 	u_int16_t	ts_tstamp;
832f51c4ae1Sreyk 	u_int8_t	ts_status;
833f51c4ae1Sreyk 	u_int8_t	ts_rate;
834f51c4ae1Sreyk 	int8_t		ts_rssi;
835f51c4ae1Sreyk 	u_int8_t	ts_shortretry;
836f51c4ae1Sreyk 	u_int8_t	ts_longretry;
837f51c4ae1Sreyk 	u_int8_t	ts_virtcol;
838f51c4ae1Sreyk 	u_int8_t	ts_antenna;
839f51c4ae1Sreyk };
840f51c4ae1Sreyk 
841f51c4ae1Sreyk #define HAL_TXSTAT_ALTRATE	0x80
842f51c4ae1Sreyk #define HAL_TXERR_XRETRY	0x01
843f51c4ae1Sreyk #define HAL_TXERR_FILT		0x02
844f51c4ae1Sreyk #define HAL_TXERR_FIFO		0x04
845f51c4ae1Sreyk 
846f51c4ae1Sreyk struct ath_rx_status {
847f51c4ae1Sreyk 	u_int16_t	rs_datalen;
848f51c4ae1Sreyk 	u_int16_t	rs_tstamp;
849f51c4ae1Sreyk 	u_int8_t	rs_status;
850f51c4ae1Sreyk 	u_int8_t	rs_phyerr;
851f51c4ae1Sreyk 	int8_t		rs_rssi;
852f51c4ae1Sreyk 	u_int8_t	rs_keyix;
853f51c4ae1Sreyk 	u_int8_t	rs_rate;
854f51c4ae1Sreyk 	u_int8_t	rs_antenna;
855f51c4ae1Sreyk 	u_int8_t	rs_more;
856f51c4ae1Sreyk };
857f51c4ae1Sreyk 
858f51c4ae1Sreyk #define HAL_RXERR_CRC		0x01
859f51c4ae1Sreyk #define HAL_RXERR_PHY		0x02
860f51c4ae1Sreyk #define HAL_RXERR_FIFO		0x04
861f51c4ae1Sreyk #define HAL_RXERR_DECRYPT	0x08
862f51c4ae1Sreyk #define HAL_RXERR_MIC		0x10
863f51c4ae1Sreyk #define HAL_RXKEYIX_INVALID	((u_int8_t) - 1)
864f51c4ae1Sreyk #define HAL_TXKEYIX_INVALID	((u_int32_t) - 1)
865f51c4ae1Sreyk 
866f51c4ae1Sreyk #define HAL_PHYERR_UNDERRUN		0x00
867f51c4ae1Sreyk #define HAL_PHYERR_TIMING		0x01
868f51c4ae1Sreyk #define HAL_PHYERR_PARITY		0x02
869f51c4ae1Sreyk #define HAL_PHYERR_RATE			0x03
870f51c4ae1Sreyk #define HAL_PHYERR_LENGTH		0x04
871f51c4ae1Sreyk #define HAL_PHYERR_RADAR		0x05
872f51c4ae1Sreyk #define HAL_PHYERR_SERVICE		0x06
873f51c4ae1Sreyk #define HAL_PHYERR_TOR			0x07
874f51c4ae1Sreyk #define HAL_PHYERR_OFDM_TIMING		0x11
875f51c4ae1Sreyk #define HAL_PHYERR_OFDM_SIGNAL_PARITY	0x12
876f51c4ae1Sreyk #define HAL_PHYERR_OFDM_RATE_ILLEGAL	0x13
877f51c4ae1Sreyk #define HAL_PHYERR_OFDM_LENGTH_ILLEGAL	0x14
878f51c4ae1Sreyk #define HAL_PHYERR_OFDM_POWER_DROP	0x15
879f51c4ae1Sreyk #define HAL_PHYERR_OFDM_SERVICE		0x16
880f51c4ae1Sreyk #define HAL_PHYERR_OFDM_RESTART		0x17
881f51c4ae1Sreyk #define HAL_PHYERR_CCK_TIMING		0x19
882f51c4ae1Sreyk #define HAL_PHYERR_CCK_HEADER_CRC	0x1a
883f51c4ae1Sreyk #define HAL_PHYERR_CCK_RATE_ILLEGAL	0x1b
884f51c4ae1Sreyk #define HAL_PHYERR_CCK_SERVICE		0x1e
885f51c4ae1Sreyk #define HAL_PHYERR_CCK_RESTART		0x1f
886f51c4ae1Sreyk 
887f51c4ae1Sreyk struct ath_desc {
888f51c4ae1Sreyk 	u_int32_t	ds_link;
889f51c4ae1Sreyk 	u_int32_t	ds_data;
890f51c4ae1Sreyk 	u_int32_t	ds_ctl0;
891f51c4ae1Sreyk 	u_int32_t	ds_ctl1;
892f51c4ae1Sreyk 	u_int32_t	ds_hw[4];
893f51c4ae1Sreyk 
894f51c4ae1Sreyk 	union {
895f51c4ae1Sreyk 		struct ath_rx_status rx;
896f51c4ae1Sreyk 		struct ath_tx_status tx;
897f51c4ae1Sreyk 	} ds_us;
898f51c4ae1Sreyk 
899f51c4ae1Sreyk #define ds_rxstat ds_us.rx
900f51c4ae1Sreyk #define ds_txstat ds_us.tx
901f51c4ae1Sreyk 
902bbcdb2e8Sreyk } __packed;
903f51c4ae1Sreyk 
904f51c4ae1Sreyk #define HAL_RXDESC_INTREQ	0x0020
905f51c4ae1Sreyk 
906f51c4ae1Sreyk #define HAL_TXDESC_CLRDMASK	0x0001
907f51c4ae1Sreyk #define HAL_TXDESC_NOACK	0x0002
908f51c4ae1Sreyk #define HAL_TXDESC_RTSENA	0x0004
909f51c4ae1Sreyk #define HAL_TXDESC_CTSENA	0x0008
910f51c4ae1Sreyk #define HAL_TXDESC_INTREQ	0x0010
911f51c4ae1Sreyk #define HAL_TXDESC_VEOL		0x0020
912f51c4ae1Sreyk 
913f51c4ae1Sreyk /*
914f51c4ae1Sreyk  * Hardware abstraction layer structure
915f51c4ae1Sreyk  */
916f51c4ae1Sreyk 
917f51c4ae1Sreyk #define AR5K_HAL_FUNCTION(_hal, _n, _f)	(_hal)->ah_##_f = ar5k_##_n##_##_f
918f51c4ae1Sreyk #define AR5K_HAL_FUNCTIONS(_t, _n, _a) \
919d93ea26fSreyk 	_t const HAL_RATE_TABLE *(_a _n##_get_rate_table)(struct ath_hal *, \
920c39ae617Sreyk 	    u_int mode); \
921b28497f7Sreyk 	_t void (_a _n##_detach)(struct ath_hal *); \
922f51c4ae1Sreyk 	/* Reset functions */ \
923b28497f7Sreyk 	_t HAL_BOOL (_a _n##_reset)(struct ath_hal *, HAL_OPMODE, \
924c39ae617Sreyk 	    HAL_CHANNEL *, HAL_BOOL change_channel, HAL_STATUS *status); \
925d93ea26fSreyk 	_t void (_a _n##_set_opmode)(struct ath_hal *); \
926d93ea26fSreyk 	_t HAL_BOOL (_a _n##_calibrate)(struct ath_hal*, \
927c39ae617Sreyk 	    HAL_CHANNEL *); \
928f51c4ae1Sreyk 	/* Transmit functions */ \
929d93ea26fSreyk 	_t HAL_BOOL (_a _n##_update_tx_triglevel)(struct ath_hal*, \
930c39ae617Sreyk 	    HAL_BOOL level); \
931d93ea26fSreyk 	_t int (_a _n##_setup_tx_queue)(struct ath_hal *, HAL_TX_QUEUE, \
932f51c4ae1Sreyk 	    const HAL_TXQ_INFO *); \
933d93ea26fSreyk 	_t HAL_BOOL (_a _n##_setup_tx_queueprops)(struct ath_hal *, int queue, \
934f51c4ae1Sreyk 	    const HAL_TXQ_INFO *); \
935d93ea26fSreyk 	_t HAL_BOOL (_a _n##_release_tx_queue)(struct ath_hal *, u_int queue); \
936d93ea26fSreyk 	_t HAL_BOOL (_a _n##_reset_tx_queue)(struct ath_hal *, u_int queue); \
937d93ea26fSreyk 	_t u_int32_t (_a _n##_get_tx_buf)(struct ath_hal *, u_int queue); \
938d93ea26fSreyk 	_t HAL_BOOL (_a _n##_put_tx_buf)(struct ath_hal *, u_int, \
939c39ae617Sreyk 	    u_int32_t phys_addr); \
940d93ea26fSreyk 	_t HAL_BOOL (_a _n##_tx_start)(struct ath_hal *, u_int queue); \
941d93ea26fSreyk 	_t HAL_BOOL (_a _n##_stop_tx_dma)(struct ath_hal *, u_int queue); \
942d93ea26fSreyk 	_t HAL_BOOL (_a _n##_setup_tx_desc)(struct ath_hal *, \
943c39ae617Sreyk 	    struct ath_desc *, \
944f51c4ae1Sreyk 	    u_int packet_length, u_int header_length, HAL_PKT_TYPE type, \
945f51c4ae1Sreyk 	    u_int txPower, u_int tx_rate0, u_int tx_tries0, u_int key_index, \
946f51c4ae1Sreyk 	    u_int antenna_mode, u_int flags, u_int rtscts_rate, \
947f51c4ae1Sreyk 	    u_int rtscts_duration); \
948d93ea26fSreyk 	_t HAL_BOOL (_a _n##_setup_xtx_desc)(struct ath_hal *, \
949c39ae617Sreyk 	    struct ath_desc *, \
950f51c4ae1Sreyk 	    u_int tx_rate1, u_int tx_tries1, u_int tx_rate2, u_int tx_tries2, \
951f51c4ae1Sreyk 	    u_int tx_rate3, u_int tx_tries3); \
952d93ea26fSreyk 	_t HAL_BOOL (_a _n##_fill_tx_desc)(struct ath_hal *, \
953c39ae617Sreyk 	    struct ath_desc *, \
954f51c4ae1Sreyk 	    u_int segLen, HAL_BOOL firstSeg, HAL_BOOL lastSeg); \
955d93ea26fSreyk 	_t HAL_STATUS (_a _n##_proc_tx_desc)(struct ath_hal *, \
956c39ae617Sreyk 	    struct ath_desc *); \
957d93ea26fSreyk 	_t HAL_BOOL (_a _n##_has_veol)(struct ath_hal *); \
958f51c4ae1Sreyk 	/* Receive Functions */ \
959d93ea26fSreyk 	_t u_int32_t (_a _n##_get_rx_buf)(struct ath_hal*); \
960d93ea26fSreyk 	_t void (_a _n##_put_rx_buf)(struct ath_hal*, u_int32_t rxdp); \
961d93ea26fSreyk 	_t void (_a _n##_start_rx)(struct ath_hal*); \
962d93ea26fSreyk 	_t HAL_BOOL (_a _n##_stop_rx_dma)(struct ath_hal*); \
963d93ea26fSreyk 	_t void (_a _n##_start_rx_pcu)(struct ath_hal*); \
964d93ea26fSreyk 	_t void (_a _n##_stop_pcu_recv)(struct ath_hal*); \
965d93ea26fSreyk 	_t void (_a _n##_set_mcast_filter)(struct ath_hal*, \
966c39ae617Sreyk 	    u_int32_t filter0, u_int32_t filter1); \
967d93ea26fSreyk 	_t HAL_BOOL (_a _n##_set_mcast_filterindex)(struct ath_hal*, \
968c39ae617Sreyk 	    u_int32_t index); \
969d93ea26fSreyk 	_t HAL_BOOL (_a _n##_clear_mcast_filter_idx)(struct ath_hal*, \
970c39ae617Sreyk 	    u_int32_t index); \
971d93ea26fSreyk 	_t u_int32_t (_a _n##_get_rx_filter)(struct ath_hal*); \
972d93ea26fSreyk 	_t void (_a _n##_set_rx_filter)(struct ath_hal*, u_int32_t); \
973d93ea26fSreyk 	_t HAL_BOOL (_a _n##_setup_rx_desc)(struct ath_hal *, \
974c39ae617Sreyk 	    struct ath_desc *, u_int32_t size, u_int flags); \
975d93ea26fSreyk 	_t HAL_STATUS (_a _n##_proc_rx_desc)(struct ath_hal *, \
976c39ae617Sreyk 	    struct ath_desc *, u_int32_t phyAddr, struct ath_desc *next); \
977dcc633efSreyk 	_t void (_a _n##_set_rx_signal)(struct ath_hal *); \
978f51c4ae1Sreyk 	/* Misc Functions */ \
979d93ea26fSreyk 	_t void (_a _n##_dump_state)(struct ath_hal *); \
980d93ea26fSreyk 	_t HAL_BOOL (_a _n##_get_diag_state)(struct ath_hal *, int, void **, \
981c39ae617Sreyk 	    u_int *); \
982d93ea26fSreyk 	_t void (_a _n##_get_lladdr)(struct ath_hal *, u_int8_t *); \
983d93ea26fSreyk 	_t HAL_BOOL (_a _n##_set_lladdr)(struct ath_hal *, \
984cd42f1d6Sreyk 	    const u_int8_t*); \
985d93ea26fSreyk 	_t HAL_BOOL (_a _n##_set_regdomain)(struct ath_hal*, \
986c39ae617Sreyk 	    u_int16_t, HAL_STATUS *); \
987d93ea26fSreyk 	_t void (_a _n##_set_ledstate)(struct ath_hal*, HAL_LED_STATE); \
988d93ea26fSreyk 	_t void (_a _n##_set_associd)(struct ath_hal*, \
989c39ae617Sreyk 	    const u_int8_t *bssid, u_int16_t assocId, u_int16_t timOffset); \
990d93ea26fSreyk 	_t HAL_BOOL (_a _n##_set_gpio_output)(struct ath_hal *, \
991c39ae617Sreyk 	    u_int32_t gpio); \
992d93ea26fSreyk 	_t HAL_BOOL (_a _n##_set_gpio_input)(struct ath_hal *, \
993c39ae617Sreyk 	    u_int32_t gpio); \
994d93ea26fSreyk 	_t u_int32_t (_a _n##_get_gpio)(struct ath_hal *, u_int32_t gpio); \
995d93ea26fSreyk 	_t HAL_BOOL (_a _n##_set_gpio)(struct ath_hal *, u_int32_t gpio, \
996c39ae617Sreyk 	    u_int32_t val); \
997d93ea26fSreyk 	_t void (_a _n##_set_gpio_intr)(struct ath_hal*, u_int, u_int32_t); \
998d93ea26fSreyk 	_t u_int32_t (_a _n##_get_tsf32)(struct ath_hal*); \
999d93ea26fSreyk 	_t u_int64_t (_a _n##_get_tsf64)(struct ath_hal*); \
1000d93ea26fSreyk 	_t void (_a _n##_reset_tsf)(struct ath_hal*); \
1001d93ea26fSreyk 	_t u_int16_t (_a _n##_get_regdomain)(struct ath_hal*); \
1002d93ea26fSreyk 	_t HAL_BOOL (_a _n##_detect_card_present)(struct ath_hal*); \
1003d93ea26fSreyk 	_t void (_a _n##_update_mib_counters)(struct ath_hal*, \
1004c39ae617Sreyk 	    HAL_MIB_STATS*); \
1005d93ea26fSreyk 	_t HAL_BOOL (_a _n##_is_cipher_supported)(struct ath_hal*, \
1006c39ae617Sreyk 	    HAL_CIPHER); \
1007d93ea26fSreyk 	_t HAL_RFGAIN (_a _n##_get_rf_gain)(struct ath_hal*); \
1008d93ea26fSreyk 	_t HAL_BOOL (_a _n##_set_slot_time)(struct ath_hal*, u_int);	\
1009d93ea26fSreyk 	_t u_int (_a _n##_get_slot_time)(struct ath_hal*);		\
1010d93ea26fSreyk 	_t HAL_BOOL (_a _n##_set_ack_timeout)(struct ath_hal *, u_int); \
1011d93ea26fSreyk 	_t u_int (_a _n##_get_ack_timeout)(struct ath_hal*);		\
1012d93ea26fSreyk 	_t HAL_BOOL (_a _n##_set_cts_timeout)(struct ath_hal*, u_int);	\
1013d93ea26fSreyk 	_t u_int (_a _n##_get_cts_timeout)(struct ath_hal*);		\
1014f51c4ae1Sreyk 	/* Key Cache Functions */ \
1015d93ea26fSreyk 	_t u_int32_t (_a _n##_get_keycache_size)(struct ath_hal*); \
1016d93ea26fSreyk 	_t HAL_BOOL (_a _n##_reset_key)(struct ath_hal*, \
1017c39ae617Sreyk 	    u_int16_t); \
1018d93ea26fSreyk 	_t HAL_BOOL (_a _n##_is_key_valid)(struct ath_hal *, \
1019c39ae617Sreyk 	    u_int16_t); \
1020d93ea26fSreyk 	_t HAL_BOOL (_a _n##_set_key)(struct ath_hal*, u_int16_t, \
1021f51c4ae1Sreyk 	    const HAL_KEYVAL *, const u_int8_t *, int);	\
1022d93ea26fSreyk 	_t HAL_BOOL (_a _n##_set_key_lladdr)(struct ath_hal*, \
1023c39ae617Sreyk 	    u_int16_t, const u_int8_t *); \
102404f5d1c1Sreyk 	_t HAL_BOOL (_a _n##_softcrypto)(struct ath_hal *, HAL_BOOL); \
1025f51c4ae1Sreyk 	/* Power Management Functions */ \
1026d93ea26fSreyk 	_t HAL_BOOL (_a _n##_set_power)(struct ath_hal*, \
1027c39ae617Sreyk 	    HAL_POWER_MODE mode, \
10289ebef271Sreyk 	    HAL_BOOL set_chip, u_int16_t sleep_duration); \
1029d93ea26fSreyk 	_t HAL_POWER_MODE (_a _n##_get_power_mode)(struct ath_hal*); \
1030d93ea26fSreyk 	_t HAL_BOOL (_a _n##_query_pspoll_support)(struct ath_hal*); \
1031d93ea26fSreyk 	_t HAL_BOOL (_a _n##_init_pspoll)(struct ath_hal*); \
1032d93ea26fSreyk 	_t HAL_BOOL (_a _n##_enable_pspoll)(struct ath_hal *, u_int8_t *, \
1033c39ae617Sreyk 	    u_int16_t); \
1034d93ea26fSreyk 	_t HAL_BOOL (_a _n##_disable_pspoll)(struct ath_hal *); \
1035f51c4ae1Sreyk 	/* Beacon Management Functions */ \
1036d93ea26fSreyk 	_t void (_a _n##_init_beacon)(struct ath_hal *, u_int32_t nexttbtt, \
1037f51c4ae1Sreyk 	    u_int32_t intval); \
1038d93ea26fSreyk 	_t void (_a _n##_set_beacon_timers)(struct ath_hal *, \
1039f51c4ae1Sreyk 	    const HAL_BEACON_STATE *, u_int32_t tsf, u_int32_t dtimCount, \
1040f51c4ae1Sreyk 	    u_int32_t cfpCcount); \
1041d93ea26fSreyk 	_t void (_a _n##_reset_beacon)(struct ath_hal *); \
1042d93ea26fSreyk 	_t HAL_BOOL (_a _n##_wait_for_beacon)(struct ath_hal *, \
1043c39ae617Sreyk 	    bus_addr_t); \
1044f51c4ae1Sreyk 	/* Interrupt functions */ \
1045d93ea26fSreyk 	_t HAL_BOOL (_a _n##_is_intr_pending)(struct ath_hal *); \
1046d93ea26fSreyk 	_t HAL_BOOL (_a _n##_get_isr)(struct ath_hal *, \
1047c39ae617Sreyk 	    u_int32_t *); \
1048d93ea26fSreyk 	_t u_int32_t (_a _n##_get_intr)(struct ath_hal *); \
1049d93ea26fSreyk 	_t HAL_INT (_a _n##_set_intr)(struct ath_hal *, HAL_INT); \
1050f51c4ae1Sreyk 	/* Chipset functions (ar5k-specific, non-HAL) */ \
1051b28497f7Sreyk 	_t HAL_BOOL (_a _n##_get_capabilities)(struct ath_hal *); \
1052b28497f7Sreyk 	_t void (_a _n##_radar_alert)(struct ath_hal *, HAL_BOOL enable); \
1053b28497f7Sreyk 	_t HAL_BOOL (_a _n##_eeprom_is_busy)(struct ath_hal *); \
1054b28497f7Sreyk 	_t int (_a _n##_eeprom_read)(struct ath_hal *, u_int32_t offset, \
1055f51c4ae1Sreyk 	    u_int16_t *data); \
1056b28497f7Sreyk 	_t int (_a _n##_eeprom_write)(struct ath_hal *, u_int32_t offset, \
1057ea5b165aSreyk 	    u_int16_t data); \
1058ea5b165aSreyk 	/* Unused functions */ \
1059ea5b165aSreyk 	_t HAL_BOOL (_a _n##_get_tx_queueprops)(struct ath_hal *, int, \
1060ea5b165aSreyk 	    HAL_TXQ_INFO *); \
1061ea5b165aSreyk 	_t u_int32_t  (_a _n##_num_tx_pending)(struct ath_hal *, u_int); \
1062ea5b165aSreyk 	_t HAL_BOOL (_a _n##_phy_disable)(struct ath_hal *); \
1063ea5b165aSreyk 	_t HAL_BOOL (_a _n##_set_txpower_limit)(struct ath_hal *, u_int); \
1064ea5b165aSreyk 	_t void (_a _n##_set_def_antenna)(struct ath_hal *, u_int); \
1065ea5b165aSreyk 	_t u_int  (_a _n ##_get_def_antenna)(struct ath_hal *); \
1066ea5b165aSreyk 	_t HAL_BOOL (_a _n##_set_bssid_mask)(struct ath_hal *, \
1067ea5b165aSreyk 	    const u_int8_t*);
1068f51c4ae1Sreyk 
1069f51c4ae1Sreyk #define AR5K_MAX_GPIO		10
1070dd37d60cSreyk #define AR5K_MAX_RF_BANKS	8
1071f51c4ae1Sreyk 
1072f51c4ae1Sreyk struct ath_hal {
1073f51c4ae1Sreyk 	u_int32_t		ah_magic;
1074f51c4ae1Sreyk 	u_int32_t		ah_abi;
1075f51c4ae1Sreyk 	u_int16_t		ah_device;
1076f51c4ae1Sreyk 	u_int16_t		ah_sub_vendor;
1077f51c4ae1Sreyk 
1078f51c4ae1Sreyk 	void			*ah_sc;
1079f51c4ae1Sreyk 	bus_space_tag_t		ah_st;
1080f51c4ae1Sreyk 	bus_space_handle_t	ah_sh;
1081f51c4ae1Sreyk 
1082f51c4ae1Sreyk 	HAL_INT			ah_imr;
1083f51c4ae1Sreyk 
1084f51c4ae1Sreyk 	HAL_OPMODE		ah_op_mode;
1085f51c4ae1Sreyk 	HAL_POWER_MODE		ah_power_mode;
1086f51c4ae1Sreyk 	HAL_CHANNEL		ah_current_channel;
10879ebef271Sreyk 	HAL_BOOL		ah_calibration;
10889ebef271Sreyk 	HAL_BOOL		ah_running;
10896392c974Sreyk 	HAL_BOOL		ah_single_chip;
1090f26dd3a5Sreyk 	HAL_BOOL		ah_pci_express;
1091dd37d60cSreyk 	HAL_RFGAIN		ah_rf_gain;
1092f51c4ae1Sreyk 
10930a6c70f8Sreyk 	int			ah_chanoff;
10940a6c70f8Sreyk 
1095f51c4ae1Sreyk 	HAL_RATE_TABLE		ah_rt_11a;
1096f51c4ae1Sreyk 	HAL_RATE_TABLE		ah_rt_11b;
1097f51c4ae1Sreyk 	HAL_RATE_TABLE		ah_rt_11g;
1098dd37d60cSreyk 	HAL_RATE_TABLE		ah_rt_xr;
1099f51c4ae1Sreyk 
110019e33da8Sreyk 	u_int32_t		ah_mac_srev;
110119e33da8Sreyk 	u_int16_t		ah_mac_version;
1102f51c4ae1Sreyk 	u_int16_t		ah_mac_revision;
1103f51c4ae1Sreyk 	u_int16_t		ah_phy_revision;
1104f51c4ae1Sreyk 	u_int16_t		ah_radio_5ghz_revision;
1105f51c4ae1Sreyk 	u_int16_t		ah_radio_2ghz_revision;
1106f51c4ae1Sreyk 
11079ebef271Sreyk 	enum ar5k_version	ah_version;
11089ebef271Sreyk 	enum ar5k_radio		ah_radio;
1109b59011f9Sreyk 
11109ebef271Sreyk 	u_int32_t		ah_phy;
1111b59011f9Sreyk 	u_int32_t		ah_phy_spending;
11129ebef271Sreyk 
11139ebef271Sreyk 	HAL_BOOL		ah_5ghz;
11149ebef271Sreyk 	HAL_BOOL		ah_2ghz;
11159ebef271Sreyk 
11169ebef271Sreyk #define ah_regdomain		ah_capabilities.cap_regdomain.reg_current
111723349211Sreyk #define ah_regdomain_hw		ah_capabilities.cap_regdomain.reg_hw
11189ebef271Sreyk #define ah_modes		ah_capabilities.cap_mode
11199ebef271Sreyk #define ah_ee_version		ah_capabilities.cap_eeprom.ee_version
1120f51c4ae1Sreyk 
1121f51c4ae1Sreyk 	u_int32_t		ah_atim_window;
1122f51c4ae1Sreyk 	u_int32_t		ah_aifs;
1123f51c4ae1Sreyk 	u_int32_t		ah_cw_min;
11249ebef271Sreyk 	u_int32_t		ah_cw_max;
1125f51c4ae1Sreyk 	HAL_BOOL		ah_software_retry;
1126f51c4ae1Sreyk 	u_int32_t		ah_limit_tx_retries;
1127f51c4ae1Sreyk 
11289ebef271Sreyk 	u_int32_t		ah_antenna[AR5K_EEPROM_N_MODES][HAL_ANT_MAX];
11299ebef271Sreyk 	HAL_BOOL		ah_ant_diversity;
11309ebef271Sreyk 
1131f51c4ae1Sreyk 	u_int8_t		ah_sta_id[IEEE80211_ADDR_LEN];
1132f51c4ae1Sreyk 	u_int8_t		ah_bssid[IEEE80211_ADDR_LEN];
1133f51c4ae1Sreyk 
1134f51c4ae1Sreyk 	u_int32_t		ah_gpio[AR5K_MAX_GPIO];
113535a07534Sreyk 	int			ah_gpio_npins;
1136f51c4ae1Sreyk 
1137f51c4ae1Sreyk 	ar5k_capabilities_t	ah_capabilities;
1138f51c4ae1Sreyk 
1139f51c4ae1Sreyk 	HAL_TXQ_INFO		ah_txq[HAL_NUM_TX_QUEUES];
11409ebef271Sreyk 	u_int32_t		ah_txq_interrupts;
11419ebef271Sreyk 
1142e9147aabSreyk 	u_int32_t		*ah_rf_banks;
1143e9147aabSreyk 	size_t			ah_rf_banks_size;
1144dd37d60cSreyk 	struct ar5k_gain	ah_gain;
1145dd37d60cSreyk 	u_int32_t		ah_offset[AR5K_MAX_RF_BANKS];
1146dd37d60cSreyk 
11479ebef271Sreyk 	struct {
11489ebef271Sreyk 		u_int16_t	txp_pcdac[AR5K_EEPROM_POWER_TABLE_SIZE];
11499ebef271Sreyk 		u_int16_t	txp_rates[AR5K_MAX_RATES];
1150486f10cbSreyk 		int16_t		txp_min, txp_max;
11519ebef271Sreyk 		HAL_BOOL	txp_tpc;
1152e9147aabSreyk 		int16_t		txp_ofdm;
11539ebef271Sreyk 	} ah_txpower;
1154f51c4ae1Sreyk 
1155f51c4ae1Sreyk 	struct {
1156f51c4ae1Sreyk 		HAL_BOOL	r_enabled;
1157f51c4ae1Sreyk 		int		r_last_alert;
1158f51c4ae1Sreyk 		HAL_CHANNEL	r_last_channel;
1159f51c4ae1Sreyk 	} ah_radar;
1160f51c4ae1Sreyk 
1161f51c4ae1Sreyk 	/*
1162f51c4ae1Sreyk 	 * Function pointers
1163f51c4ae1Sreyk 	 */
1164f51c4ae1Sreyk 	AR5K_HAL_FUNCTIONS(, ah, *);
1165f51c4ae1Sreyk };
1166f51c4ae1Sreyk 
1167f51c4ae1Sreyk /*
11689ebef271Sreyk  * Common silicon revision/version values
11699ebef271Sreyk  */
1170fead7ab4Sreyk enum ar5k_srev_type {
1171fead7ab4Sreyk 	AR5K_VERSION_VER,
1172fead7ab4Sreyk 	AR5K_VERSION_REV,
1173bafd5704Sreyk 	AR5K_VERSION_RAD,
1174bafd5704Sreyk 	AR5K_VERSION_DEV,
1175fead7ab4Sreyk };
1176fead7ab4Sreyk 
1177fead7ab4Sreyk struct ar5k_srev_name {
1178fead7ab4Sreyk 	const char		*sr_name;
1179fead7ab4Sreyk 	enum ar5k_srev_type	sr_type;
1180fead7ab4Sreyk 	u_int			sr_val;
1181fead7ab4Sreyk };
1182fead7ab4Sreyk 
1183fead7ab4Sreyk #define AR5K_SREV_NAME	{						\
1184fead7ab4Sreyk 	{ "5210",	AR5K_VERSION_VER,	AR5K_SREV_VER_AR5210 },	\
1185fead7ab4Sreyk 	{ "5311",	AR5K_VERSION_VER,	AR5K_SREV_VER_AR5311 },	\
1186fead7ab4Sreyk 	{ "5311a",	AR5K_VERSION_VER,	AR5K_SREV_VER_AR5311A },\
1187fead7ab4Sreyk 	{ "5311b",	AR5K_VERSION_VER,	AR5K_SREV_VER_AR5311B },\
1188fead7ab4Sreyk 	{ "5211",	AR5K_VERSION_VER,	AR5K_SREV_VER_AR5211 },	\
1189fead7ab4Sreyk 	{ "5212",	AR5K_VERSION_VER,	AR5K_SREV_VER_AR5212 },	\
119019e33da8Sreyk 	{ "5213",	AR5K_VERSION_VER,	AR5K_SREV_VER_AR5213 },	\
1191f26dd3a5Sreyk 	{ "5213A",	AR5K_VERSION_VER,	AR5K_SREV_VER_AR5213A },\
1192f26dd3a5Sreyk 	{ "2413",	AR5K_VERSION_VER,	AR5K_SREV_VER_AR2413 },\
1193f26dd3a5Sreyk 	{ "2414",	AR5K_VERSION_VER,	AR5K_SREV_VER_AR2414 },\
1194f26dd3a5Sreyk 	{ "2424",	AR5K_VERSION_VER,	AR5K_SREV_VER_AR2424 },\
1195f26dd3a5Sreyk 	{ "5424",	AR5K_VERSION_VER,	AR5K_SREV_VER_AR5424 },\
1196f26dd3a5Sreyk 	{ "5413",	AR5K_VERSION_VER,	AR5K_SREV_VER_AR5413 },\
1197f26dd3a5Sreyk 	{ "5414",	AR5K_VERSION_VER,	AR5K_SREV_VER_AR5414 },\
1198f26dd3a5Sreyk 	{ "5416",	AR5K_VERSION_VER,	AR5K_SREV_VER_AR5416 },\
1199f26dd3a5Sreyk 	{ "5418",	AR5K_VERSION_VER,	AR5K_SREV_VER_AR5418 },\
1200f26dd3a5Sreyk 	{ "2425",	AR5K_VERSION_VER,	AR5K_SREV_VER_AR2425 },\
1201fead7ab4Sreyk 	{ "xxxx",	AR5K_VERSION_VER,	AR5K_SREV_UNKNOWN },	\
1202fead7ab4Sreyk 	{ "5110",	AR5K_VERSION_RAD,	AR5K_SREV_RAD_5110 },	\
1203fead7ab4Sreyk 	{ "5111",	AR5K_VERSION_RAD,	AR5K_SREV_RAD_5111 },	\
1204fead7ab4Sreyk 	{ "2111",	AR5K_VERSION_RAD,	AR5K_SREV_RAD_2111 },	\
1205fead7ab4Sreyk 	{ "5112",	AR5K_VERSION_RAD,	AR5K_SREV_RAD_5112 },	\
12060ce211edSreyk 	{ "5112a",	AR5K_VERSION_RAD,	AR5K_SREV_RAD_5112A },	\
1207fead7ab4Sreyk 	{ "2112",	AR5K_VERSION_RAD,	AR5K_SREV_RAD_2112 },	\
120819e33da8Sreyk 	{ "2112a",	AR5K_VERSION_RAD,	AR5K_SREV_RAD_2112A },	\
1209b59011f9Sreyk 	{ "2413",	AR5K_VERSION_RAD,	AR5K_SREV_RAD_SC0 },	\
1210b59011f9Sreyk 	{ "2414",	AR5K_VERSION_RAD,	AR5K_SREV_RAD_SC1 },	\
1211b59011f9Sreyk 	{ "5424",	AR5K_VERSION_RAD,	AR5K_SREV_RAD_SC2 },	\
1212bafd5704Sreyk 	{ "xxxx",	AR5K_VERSION_RAD,	AR5K_SREV_UNKNOWN },	\
1213bafd5704Sreyk 	{ "2413",	AR5K_VERSION_DEV,	AR5K_DEVID_AR2413 },	\
1214bafd5704Sreyk 	{ "5413",	AR5K_VERSION_DEV,	AR5K_DEVID_AR5413 },	\
1215bafd5704Sreyk 	{ "5424",	AR5K_VERSION_DEV,	AR5K_DEVID_AR5424 },	\
1216bafd5704Sreyk 	{ "xxxx",	AR5K_VERSION_DEV,	AR5K_SREV_UNKNOWN }	\
1217fead7ab4Sreyk }
1218*6842f710Stb 	/* XXX: ar5k_printver() needs AR5K_SREV_UNKNOWN in the last member. */
1219fead7ab4Sreyk 
1220fead7ab4Sreyk #define AR5K_SREV_UNKNOWN	0xffff
1221fead7ab4Sreyk 
122219e33da8Sreyk #define AR5K_SREV_VER_AR5210	0x00
122319e33da8Sreyk #define AR5K_SREV_VER_AR5311	0x10
122419e33da8Sreyk #define AR5K_SREV_VER_AR5311A	0x20
122519e33da8Sreyk #define AR5K_SREV_VER_AR5311B	0x30
122619e33da8Sreyk #define AR5K_SREV_VER_AR5211	0x40
122719e33da8Sreyk #define AR5K_SREV_VER_AR5212	0x50
122819e33da8Sreyk #define AR5K_SREV_VER_AR5213	0x55
1229f26dd3a5Sreyk #define AR5K_SREV_VER_AR5213A	0x59
1230f26dd3a5Sreyk #define AR5K_SREV_VER_AR2413	0x78
1231f26dd3a5Sreyk #define AR5K_SREV_VER_AR2414	0x79
1232f26dd3a5Sreyk #define AR5K_SREV_VER_AR2424	0xa0	/* PCI-Express */
1233f26dd3a5Sreyk #define AR5K_SREV_VER_AR5424	0xa3	/* PCI-Express */
1234f26dd3a5Sreyk #define AR5K_SREV_VER_AR5413	0xa4
1235f26dd3a5Sreyk #define AR5K_SREV_VER_AR5414	0xa5
1236f26dd3a5Sreyk #define AR5K_SREV_VER_AR5416	0xc0	/* PCI-Express */
1237f26dd3a5Sreyk #define AR5K_SREV_VER_AR5418	0xca	/* PCI-Express */
1238f26dd3a5Sreyk #define AR5K_SREV_VER_AR2425	0xe2	/* PCI-Express */
1239f26dd3a5Sreyk #define AR5K_SREV_VER_UNSUPP	0xff
12409ebef271Sreyk 
1241fead7ab4Sreyk #define AR5K_SREV_RAD_5110	0x00
12429ebef271Sreyk #define AR5K_SREV_RAD_5111	0x10
12439ebef271Sreyk #define AR5K_SREV_RAD_5111A	0x15
12449ebef271Sreyk #define AR5K_SREV_RAD_2111	0x20
12459ebef271Sreyk #define AR5K_SREV_RAD_5112	0x30
12469ebef271Sreyk #define AR5K_SREV_RAD_5112A	0x35
1247fead7ab4Sreyk #define AR5K_SREV_RAD_2112	0x40
12489ebef271Sreyk #define AR5K_SREV_RAD_2112A	0x45
1249b59011f9Sreyk #define AR5K_SREV_RAD_SC0	0x56
1250b59011f9Sreyk #define AR5K_SREV_RAD_SC1	0x63
1251b59011f9Sreyk #define AR5K_SREV_RAD_SC2	0xa2
1252f26dd3a5Sreyk #define AR5K_SREV_RAD_5133	0xc0
1253f26dd3a5Sreyk #define AR5K_SREV_RAD_UNSUPP	0xff
12549ebef271Sreyk 
1255bafd5704Sreyk #define AR5K_DEVID_AR2413	0x001a
1256bafd5704Sreyk #define AR5K_DEVID_AR5413	0x001b
1257bafd5704Sreyk #define AR5K_DEVID_AR5424	0x001c
1258bafd5704Sreyk 
12599ebef271Sreyk /*
1260f51c4ae1Sreyk  * Misc defines
1261f51c4ae1Sreyk  */
1262f51c4ae1Sreyk 
1263f51c4ae1Sreyk #define HAL_ABI_VERSION		0x04090901 /* YYMMDDnn */
1264f51c4ae1Sreyk 
1265b28497f7Sreyk #define AR5K_PRINTF(fmt, ...)	printf("%s: " fmt, __func__, ##__VA_ARGS__)
1266b28497f7Sreyk #define AR5K_PRINT(fmt)		printf("%s: " fmt, __func__)
12679ebef271Sreyk #ifdef AR5K_DEBUG
1268f51c4ae1Sreyk #define AR5K_TRACE		printf("%s:%d\n", __func__, __LINE__)
12699ebef271Sreyk #else
12709ebef271Sreyk #define AR5K_TRACE
12719ebef271Sreyk #endif
1272f51c4ae1Sreyk #define AR5K_DELAY(_n)		delay(_n)
1273f51c4ae1Sreyk 
1274f51c4ae1Sreyk typedef struct ath_hal * (ar5k_attach_t)
1275f51c4ae1Sreyk 	(u_int16_t, void *, bus_space_tag_t, bus_space_handle_t, HAL_STATUS *);
1276e9147aabSreyk typedef HAL_BOOL (ar5k_rfgain_t)
1277e9147aabSreyk 	(struct ath_hal *, HAL_CHANNEL *, u_int);
1278f51c4ae1Sreyk 
1279f51c4ae1Sreyk /*
1280f51c4ae1Sreyk  * Some tuneable values (these should be changeable by the user)
1281f51c4ae1Sreyk  */
1282f51c4ae1Sreyk 
1283f51c4ae1Sreyk #define AR5K_TUNE_DMA_BEACON_RESP		2
1284f51c4ae1Sreyk #define AR5K_TUNE_SW_BEACON_RESP		10
1285f51c4ae1Sreyk #define AR5K_TUNE_ADDITIONAL_SWBA_BACKOFF	0
1286f51c4ae1Sreyk #define AR5K_TUNE_RADAR_ALERT			AH_FALSE
1287f51c4ae1Sreyk #define AR5K_TUNE_MIN_TX_FIFO_THRES		1
1288f51c4ae1Sreyk #define AR5K_TUNE_MAX_TX_FIFO_THRES		((IEEE80211_MAX_LEN / 64) + 1)
1289f51c4ae1Sreyk #define AR5K_TUNE_RSSI_THRES			1792
1290f51c4ae1Sreyk #define AR5K_TUNE_REGISTER_TIMEOUT		20000
1291f51c4ae1Sreyk #define AR5K_TUNE_REGISTER_DWELL_TIME		20000
1292f51c4ae1Sreyk #define AR5K_TUNE_BEACON_INTERVAL		100
1293f51c4ae1Sreyk #define AR5K_TUNE_AIFS				2
12949ebef271Sreyk #define AR5K_TUNE_AIFS_11B			2
12959ebef271Sreyk #define AR5K_TUNE_AIFS_XR			0
1296f51c4ae1Sreyk #define AR5K_TUNE_CWMIN				15
12979ebef271Sreyk #define AR5K_TUNE_CWMIN_11B			31
12989ebef271Sreyk #define AR5K_TUNE_CWMIN_XR			3
12999ebef271Sreyk #define AR5K_TUNE_CWMAX				1023
13009ebef271Sreyk #define AR5K_TUNE_CWMAX_11B			1023
13019ebef271Sreyk #define AR5K_TUNE_CWMAX_XR			7
13029ebef271Sreyk #define AR5K_TUNE_NOISE_FLOOR			-72
13039ebef271Sreyk #define AR5K_TUNE_MAX_TXPOWER			60
1304e9147aabSreyk #define AR5K_TUNE_DEFAULT_TXPOWER		30
1305e9147aabSreyk #define AR5K_TUNE_TPC_TXPOWER			AH_TRUE
13069ebef271Sreyk #define AR5K_TUNE_ANT_DIVERSITY			AH_TRUE
13079ebef271Sreyk 
13089ebef271Sreyk /* Default regulation domain if stored value EEPROM value is invalid */
1309af69a79aSreyk #define AR5K_TUNE_REGDOMAIN	DMN_FCC2_FCCA	/* Canada */
1310f51c4ae1Sreyk 
1311f51c4ae1Sreyk /*
1312f51c4ae1Sreyk  * Common initial register values
1313f51c4ae1Sreyk  */
1314f51c4ae1Sreyk 
13159ebef271Sreyk #define AR5K_INIT_MODE				(			\
13160ce211edSreyk 	IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN			\
13179ebef271Sreyk )
1318f51c4ae1Sreyk #define AR5K_INIT_TX_LATENCY			502
1319f51c4ae1Sreyk #define AR5K_INIT_USEC				39
1320f51c4ae1Sreyk #define AR5K_INIT_USEC_TURBO			79
1321f51c4ae1Sreyk #define AR5K_INIT_USEC_32			31
1322f51c4ae1Sreyk #define AR5K_INIT_CARR_SENSE_EN			1
1323f51c4ae1Sreyk #define AR5K_INIT_PROG_IFS			920
1324f51c4ae1Sreyk #define AR5K_INIT_PROG_IFS_TURBO		960
1325f51c4ae1Sreyk #define AR5K_INIT_EIFS				3440
1326f51c4ae1Sreyk #define AR5K_INIT_EIFS_TURBO			6880
13276eac2691Sreyk #define AR5K_INIT_SLOT_TIME			396
1328f51c4ae1Sreyk #define AR5K_INIT_SLOT_TIME_TURBO		480
1329f51c4ae1Sreyk #define AR5K_INIT_ACK_CTS_TIMEOUT		1024
1330f51c4ae1Sreyk #define AR5K_INIT_ACK_CTS_TIMEOUT_TURBO		0x08000800
1331f51c4ae1Sreyk #define AR5K_INIT_SIFS				560
1332f51c4ae1Sreyk #define AR5K_INIT_SIFS_TURBO			480
1333f51c4ae1Sreyk #define AR5K_INIT_SH_RETRY			10
1334f51c4ae1Sreyk #define AR5K_INIT_LG_RETRY			AR5K_INIT_SH_RETRY
1335f51c4ae1Sreyk #define AR5K_INIT_SSH_RETRY			32
1336f51c4ae1Sreyk #define AR5K_INIT_SLG_RETRY			AR5K_INIT_SSH_RETRY
1337f51c4ae1Sreyk #define AR5K_INIT_TX_RETRY			10
1338f51c4ae1Sreyk #define AR5K_INIT_TOPS				8
1339f51c4ae1Sreyk #define AR5K_INIT_RXNOFRM			8
1340f51c4ae1Sreyk #define AR5K_INIT_RPGTO				0
1341f51c4ae1Sreyk #define AR5K_INIT_TXNOFRM			0
1342f51c4ae1Sreyk #define AR5K_INIT_BEACON_PERIOD			65535
1343f51c4ae1Sreyk #define AR5K_INIT_TIM_OFFSET			0
1344f51c4ae1Sreyk #define AR5K_INIT_BEACON_EN			0
1345f51c4ae1Sreyk #define AR5K_INIT_RESET_TSF			0
1346f51c4ae1Sreyk #define AR5K_INIT_TRANSMIT_LATENCY		(			\
1347f51c4ae1Sreyk 	(AR5K_INIT_TX_LATENCY << 14) | (AR5K_INIT_USEC_32 << 7) |	\
1348f51c4ae1Sreyk 	(AR5K_INIT_USEC)						\
1349f51c4ae1Sreyk )
1350f51c4ae1Sreyk #define AR5K_INIT_TRANSMIT_LATENCY_TURBO	(			\
1351f51c4ae1Sreyk 	(AR5K_INIT_TX_LATENCY << 14) | (AR5K_INIT_USEC_32 << 7) |	\
1352f51c4ae1Sreyk 	(AR5K_INIT_USEC_TURBO)						\
1353f51c4ae1Sreyk )
1354f51c4ae1Sreyk #define AR5K_INIT_PROTO_TIME_CNTRL		(			\
1355f51c4ae1Sreyk 	(AR5K_INIT_CARR_SENSE_EN << 26) | (AR5K_INIT_EIFS << 12) |	\
1356f51c4ae1Sreyk 	(AR5K_INIT_PROG_IFS)						\
1357f51c4ae1Sreyk )
1358f51c4ae1Sreyk #define AR5K_INIT_PROTO_TIME_CNTRL_TURBO	(			\
1359f51c4ae1Sreyk 	(AR5K_INIT_CARR_SENSE_EN << 26) | (AR5K_INIT_EIFS_TURBO << 12) |\
1360f51c4ae1Sreyk 	(AR5K_INIT_PROG_IFS_TURBO)					\
1361f51c4ae1Sreyk )
1362f51c4ae1Sreyk #define AR5K_INIT_BEACON_CONTROL		(			\
1363f51c4ae1Sreyk 	(AR5K_INIT_RESET_TSF << 24) | (AR5K_INIT_BEACON_EN << 23) |	\
1364f51c4ae1Sreyk 	(AR5K_INIT_TIM_OFFSET << 16) | (AR5K_INIT_BEACON_PERIOD)	\
1365f51c4ae1Sreyk )
1366f51c4ae1Sreyk 
1367f51c4ae1Sreyk /*
1368f51c4ae1Sreyk  * AR5k register access
1369f51c4ae1Sreyk  */
1370f51c4ae1Sreyk 
1371f51c4ae1Sreyk #define AR5K_REG_WRITE(_reg, _val)					\
1372bba49c9dSreyk 	bus_space_write_4(hal->ah_st, hal->ah_sh, (_reg), (_val))
1373f51c4ae1Sreyk #define AR5K_REG_READ(_reg)						\
1374bba49c9dSreyk 	bus_space_read_4(hal->ah_st, hal->ah_sh, (_reg))
1375f51c4ae1Sreyk 
1376f51c4ae1Sreyk #define AR5K_REG_SM(_val, _flags)					\
1377b009ba0aSkettenis 	(((uint32_t)(_val) << _flags##_S) & (_flags))
1378f51c4ae1Sreyk #define AR5K_REG_MS(_val, _flags)					\
1379b009ba0aSkettenis 	(((uint32_t)(_val) & (_flags)) >> _flags##_S)
1380f51c4ae1Sreyk #define AR5K_REG_WRITE_BITS(_reg, _flags, _val)				\
1381f51c4ae1Sreyk 	AR5K_REG_WRITE(_reg, (AR5K_REG_READ(_reg) &~ (_flags)) |	\
1382f51c4ae1Sreyk 	    (((_val) << _flags##_S) & (_flags)))
13839ebef271Sreyk #define AR5K_REG_MASKED_BITS(_reg, _flags, _mask)			\
13849ebef271Sreyk 	AR5K_REG_WRITE(_reg, (AR5K_REG_READ(_reg) & (_mask)) | (_flags))
1385f51c4ae1Sreyk #define AR5K_REG_ENABLE_BITS(_reg, _flags)				\
1386f51c4ae1Sreyk 	AR5K_REG_WRITE(_reg, AR5K_REG_READ(_reg) | (_flags))
1387f51c4ae1Sreyk #define AR5K_REG_DISABLE_BITS(_reg, _flags)				\
1388f51c4ae1Sreyk 	AR5K_REG_WRITE(_reg, AR5K_REG_READ(_reg) &~ (_flags))
1389f51c4ae1Sreyk 
13909ebef271Sreyk #define AR5K_PHY_WRITE(_reg, _val)					\
13919ebef271Sreyk 	AR5K_REG_WRITE(hal->ah_phy + ((_reg) << 2), _val)
13929ebef271Sreyk #define AR5K_PHY_READ(_reg)						\
13939ebef271Sreyk 	AR5K_REG_READ(hal->ah_phy + ((_reg) << 2))
1394f51c4ae1Sreyk 
1395e9147aabSreyk #define AR5K_REG_WAIT(_i)						\
1396e9147aabSreyk 	if (_i % 64)							\
1397e9147aabSreyk 		AR5K_DELAY(1);
1398e9147aabSreyk 
1399486f10cbSreyk #define AR5K_EEPROM_READ(_o, _v)	{				\
1400486f10cbSreyk 	if ((ret = hal->ah_eeprom_read(hal, (_o),			\
1401486f10cbSreyk 		 &(_v))) != 0)						\
1402486f10cbSreyk 		return (ret);						\
1403486f10cbSreyk }
1404486f10cbSreyk #define AR5K_EEPROM_READ_HDR(_o, _v)					\
1405486f10cbSreyk 	AR5K_EEPROM_READ(_o, hal->ah_capabilities.cap_eeprom._v);	\
1406486f10cbSreyk 
14079ebef271Sreyk /* Read status of selected queue */
14089ebef271Sreyk #define AR5K_REG_READ_Q(_reg, _queue)					\
14099ebef271Sreyk 	(AR5K_REG_READ(_reg) & (1 << _queue))				\
1410f51c4ae1Sreyk 
14119ebef271Sreyk #define AR5K_REG_WRITE_Q(_reg, _queue)					\
14129ebef271Sreyk 	AR5K_REG_WRITE(_reg, (1 << _queue))
14139ebef271Sreyk 
14149ebef271Sreyk #define AR5K_Q_ENABLE_BITS(_reg, _queue) do {				\
14159ebef271Sreyk 	_reg |= 1 << _queue;						\
14169ebef271Sreyk } while (0)
14179ebef271Sreyk 
14189ebef271Sreyk #define AR5K_Q_DISABLE_BITS(_reg, _queue) do {				\
14199ebef271Sreyk 	_reg &= ~(1 << _queue);						\
14209ebef271Sreyk } while (0)
1421f51c4ae1Sreyk 
14223d62f8d8Sreyk #define AR5K_LOW_ID(_a)		(					\
14233d62f8d8Sreyk 	(_a)[0] | (_a)[1] << 8 | (_a)[2] << 16 | (_a)[3] << 24		\
14243d62f8d8Sreyk )
14253d62f8d8Sreyk #define AR5K_HIGH_ID(_a)	((_a)[4] | (_a)[5] << 8)
14263d62f8d8Sreyk 
1427f51c4ae1Sreyk /*
1428f51c4ae1Sreyk  * Unaligned little endian access
1429f51c4ae1Sreyk  */
1430f51c4ae1Sreyk 
1431f51c4ae1Sreyk #define AR5K_LE_READ_2(_p)						\
1432b28497f7Sreyk 	(((const u_int8_t *)(_p))[0] | (((const u_int8_t *)(_p))[1] << 8))
1433f51c4ae1Sreyk #define AR5K_LE_READ_4(_p) \
1434cd42f1d6Sreyk 	(((const u_int8_t *)(_p))[0] |					\
1435cd42f1d6Sreyk 	(((const u_int8_t *)(_p))[1] << 8) |				\
1436cd42f1d6Sreyk 	(((const u_int8_t *)(_p))[2] << 16) |				\
1437cd42f1d6Sreyk 	(((const u_int8_t *)(_p))[3] << 24))
1438f51c4ae1Sreyk #define AR5K_LE_WRITE_2(_p, _val) \
1439f51c4ae1Sreyk 	((((u_int8_t *)(_p))[0] = ((u_int32_t)(_val) & 0xff)),		\
1440f51c4ae1Sreyk 	(((u_int8_t *)(_p))[1] = (((u_int32_t)(_val) >> 8) & 0xff)))
1441f51c4ae1Sreyk #define AR5K_LE_WRITE_4(_p, _val)					\
1442f51c4ae1Sreyk 	((((u_int8_t *)(_p))[0] = ((u_int32_t)(_val) & 0xff)),		\
1443f51c4ae1Sreyk 	(((u_int8_t *)(_p))[1] = (((u_int32_t)(_val) >> 8) & 0xff)),	\
1444f51c4ae1Sreyk 	(((u_int8_t *)(_p))[2] = (((u_int32_t)(_val) >> 16) & 0xff)),	\
1445f51c4ae1Sreyk 	(((u_int8_t *)(_p))[3] = (((u_int32_t)(_val) >> 24) & 0xff)))
1446f51c4ae1Sreyk 
1447f51c4ae1Sreyk /*
14489ebef271Sreyk  * Initial register values
14499ebef271Sreyk  */
14509ebef271Sreyk 
14519ebef271Sreyk struct ar5k_ini {
14529ebef271Sreyk 	u_int16_t	ini_register;
14539ebef271Sreyk 	u_int32_t	ini_value;
14549ebef271Sreyk 
14559ebef271Sreyk 	enum {
14569ebef271Sreyk 		AR5K_INI_WRITE = 0,
14579ebef271Sreyk 		AR5K_INI_READ = 1,
14589ebef271Sreyk 	} ini_mode;
14599ebef271Sreyk };
14609ebef271Sreyk 
1461b59011f9Sreyk #define AR5K_PCU_MIN		0x8000
1462b59011f9Sreyk #define AR5K_PCU_MAX		0x8fff
1463b59011f9Sreyk 
14649ebef271Sreyk #define AR5K_INI_VAL_11A	0
14659ebef271Sreyk #define AR5K_INI_VAL_11A_TURBO	1
14669ebef271Sreyk #define AR5K_INI_VAL_11B	2
14679ebef271Sreyk #define AR5K_INI_VAL_11G	3
14689ebef271Sreyk #define AR5K_INI_VAL_11G_TURBO	4
14699ebef271Sreyk #define AR5K_INI_VAL_XR		0
14709ebef271Sreyk #define AR5K_INI_VAL_MAX	5
14719ebef271Sreyk 
1472b59011f9Sreyk struct ar5k_mode {
1473b59011f9Sreyk 	u_int16_t	mode_register;
1474b59011f9Sreyk 	u_int32_t	mode_value[AR5K_INI_VAL_MAX];
1475b59011f9Sreyk };
1476b59011f9Sreyk 
1477f23d19fdSreyk #define AR5K_INI_PHY_5111	0
1478f23d19fdSreyk #define AR5K_INI_PHY_5112	1
1479f23d19fdSreyk #define AR5K_INI_PHY_511X	1
1480f23d19fdSreyk 
1481dd37d60cSreyk #define AR5K_AR5111_INI_RF_MAX_BANKS    AR5K_MAX_RF_BANKS
1482dd37d60cSreyk #define AR5K_AR5112_INI_RF_MAX_BANKS	AR5K_MAX_RF_BANKS
14839ebef271Sreyk 
14849ebef271Sreyk struct ar5k_ini_rf {
14859ebef271Sreyk 	u_int8_t	rf_bank;
14869ebef271Sreyk 	u_int16_t	rf_register;
14879ebef271Sreyk 	u_int32_t	rf_value[5];
14889ebef271Sreyk };
14899ebef271Sreyk 
14909ebef271Sreyk #define AR5K_AR5111_INI_RF	{						\
1491cd42f1d6Sreyk 	{ 0, 0x989c,								\
1492cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1493cd42f1d6Sreyk 	{ 0, 0x989c,								\
1494cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1495cd42f1d6Sreyk 	{ 0, 0x989c,								\
1496cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1497cd42f1d6Sreyk 	{ 0, 0x989c,								\
1498cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1499cd42f1d6Sreyk 	{ 0, 0x989c,								\
1500cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1501cd42f1d6Sreyk 	{ 0, 0x989c,								\
1502cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1503cd42f1d6Sreyk 	{ 0, 0x989c,								\
1504cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1505cd42f1d6Sreyk 	{ 0, 0x989c,								\
1506cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1507cd42f1d6Sreyk 	{ 0, 0x989c,								\
1508cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1509cd42f1d6Sreyk 	{ 0, 0x989c,								\
1510cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1511cd42f1d6Sreyk 	{ 0, 0x989c,								\
1512cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1513cd42f1d6Sreyk 	{ 0, 0x989c,								\
1514cd42f1d6Sreyk 	    { 0x00380000, 0x00380000, 0x00380000, 0x00380000, 0x00380000 } },	\
1515cd42f1d6Sreyk 	{ 0, 0x989c,								\
1516cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1517cd42f1d6Sreyk 	{ 0, 0x989c,								\
1518cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1519cd42f1d6Sreyk 	{ 0, 0x989c,								\
1520cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x000000c0, 0x00000080, 0x00000080 } },	\
1521cd42f1d6Sreyk 	{ 0, 0x989c,								\
1522cd42f1d6Sreyk 	    { 0x000400f9, 0x000400f9, 0x000400ff, 0x000400fd, 0x000400fd } },	\
1523cd42f1d6Sreyk 	{ 0, 0x98d4,								\
1524cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x00000004 } },	\
1525cd42f1d6Sreyk 	{ 1, 0x98d4,								\
1526cd42f1d6Sreyk 	    { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } },	\
1527cd42f1d6Sreyk 	{ 2, 0x98d4,								\
1528cd42f1d6Sreyk 	    { 0x00000010, 0x00000014, 0x00000010, 0x00000010, 0x00000014 } },	\
1529cd42f1d6Sreyk 	{ 3, 0x98d8,								\
1530cd42f1d6Sreyk 	    { 0x00601068, 0x00601068, 0x00601068, 0x00601068, 0x00601068 } },	\
1531cd42f1d6Sreyk 	{ 6, 0x989c,								\
1532cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1533cd42f1d6Sreyk 	{ 6, 0x989c,								\
1534cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1535cd42f1d6Sreyk 	{ 6, 0x989c,								\
1536cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1537cd42f1d6Sreyk 	{ 6, 0x989c,								\
1538cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1539cd42f1d6Sreyk 	{ 6, 0x989c,								\
1540cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1541cd42f1d6Sreyk 	{ 6, 0x989c,								\
1542cd42f1d6Sreyk 	    { 0x10000000, 0x10000000, 0x10000000, 0x10000000, 0x10000000 } },	\
1543cd42f1d6Sreyk 	{ 6, 0x989c,								\
1544cd42f1d6Sreyk 	    { 0x04000000, 0x04000000, 0x04000000, 0x04000000, 0x04000000 } },	\
1545cd42f1d6Sreyk 	{ 6, 0x989c,								\
1546cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1547cd42f1d6Sreyk 	{ 6, 0x989c,								\
1548cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1549cd42f1d6Sreyk 	{ 6, 0x989c,								\
1550cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1551cd42f1d6Sreyk 	{ 6, 0x989c,								\
1552cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x0a000000, 0x00000000, 0x00000000 } },	\
1553cd42f1d6Sreyk 	{ 6, 0x989c,								\
1554cd42f1d6Sreyk 	    { 0x003800c0, 0x00380080, 0x023800c0, 0x003800c0, 0x003800c0 } },	\
1555cd42f1d6Sreyk 	{ 6, 0x989c,								\
1556cd42f1d6Sreyk 	    { 0x00020006, 0x00020006, 0x00000006, 0x00020006, 0x00020006 } },	\
1557cd42f1d6Sreyk 	{ 6, 0x989c,								\
1558cd42f1d6Sreyk 	    { 0x00000089, 0x00000089, 0x00000089, 0x00000089, 0x00000089 } },	\
1559cd42f1d6Sreyk 	{ 6, 0x989c,								\
1560cd42f1d6Sreyk 	    { 0x000000a0, 0x000000a0, 0x000000a0, 0x000000a0, 0x000000a0 } },	\
1561cd42f1d6Sreyk 	{ 6, 0x989c,								\
1562cd42f1d6Sreyk 	    { 0x00040007, 0x00040007, 0x00040007, 0x00040007, 0x00040007 } },	\
1563cd42f1d6Sreyk 	{ 6, 0x98d4,								\
1564cd42f1d6Sreyk 	    { 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a } },	\
1565cd42f1d6Sreyk 	{ 7, 0x989c,								\
1566cd42f1d6Sreyk 	    { 0x00000040, 0x00000048, 0x00000040, 0x00000040, 0x00000040 } },	\
1567cd42f1d6Sreyk 	{ 7, 0x989c,								\
1568cd42f1d6Sreyk 	    { 0x00000010, 0x00000010, 0x00000010, 0x00000010, 0x00000010 } },	\
1569cd42f1d6Sreyk 	{ 7, 0x989c,								\
1570cd42f1d6Sreyk 	    { 0x00000008, 0x00000008, 0x00000008, 0x00000008, 0x00000008 } },	\
1571cd42f1d6Sreyk 	{ 7, 0x989c,								\
1572cd42f1d6Sreyk 	    { 0x0000004f, 0x0000004f, 0x0000004f, 0x0000004f, 0x0000004f } },	\
1573cd42f1d6Sreyk 	{ 7, 0x989c,								\
1574cd42f1d6Sreyk 	    { 0x000000f1, 0x000000f1, 0x00000061, 0x000000f1, 0x000000f1 } },	\
1575cd42f1d6Sreyk 	{ 7, 0x989c,								\
1576cd42f1d6Sreyk 	    { 0x0000904f, 0x0000904f, 0x0000904c, 0x0000904f, 0x0000904f } },	\
1577cd42f1d6Sreyk 	{ 7, 0x989c,								\
1578cd42f1d6Sreyk 	    { 0x0000125a, 0x0000125a, 0x0000129a, 0x0000125a, 0x0000125a } },	\
1579cd42f1d6Sreyk 	{ 7, 0x98cc,								\
1580cd42f1d6Sreyk 	    { 0x0000000e, 0x0000000e, 0x0000000f, 0x0000000e, 0x0000000e } },	\
15819ebef271Sreyk }
15829ebef271Sreyk 
15839ebef271Sreyk #define AR5K_AR5112_INI_RF	{						\
1584cd42f1d6Sreyk 	{ 1, 0x98d4,								\
1585cd42f1d6Sreyk 	    { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } },	\
1586cd42f1d6Sreyk 	{ 2, 0x98d0,								\
1587cd42f1d6Sreyk 	    { 0x03060408, 0x03070408, 0x03060408, 0x03060408, 0x03070408 } },	\
1588cd42f1d6Sreyk 	{ 3, 0x98dc,								\
1589cd42f1d6Sreyk 	    { 0x00a0c0c0, 0x00a0c0c0, 0x00e0c0c0, 0x00e0c0c0, 0x00e0c0c0 } },	\
1590cd42f1d6Sreyk 	{ 6, 0x989c,								\
15910ce211edSreyk 	    { 0x00a00000, 0x00a00000, 0x00a00000, 0x00a00000, 0x00a00000 } },	\
15920ce211edSreyk 	{ 6, 0x989c,								\
15930ce211edSreyk 	    { 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000 } },	\
15940ce211edSreyk 	{ 6, 0x989c,								\
15950ce211edSreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
15960ce211edSreyk 	{ 6, 0x989c,								\
15970ce211edSreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
15980ce211edSreyk 	{ 6, 0x989c,								\
15990ce211edSreyk 	    { 0x00660000, 0x00660000, 0x00660000, 0x00660000, 0x00660000 } },	\
16000ce211edSreyk 	{ 6, 0x989c,								\
16010ce211edSreyk 	    { 0x00db0000, 0x00db0000, 0x00db0000, 0x00db0000, 0x00db0000 } },	\
16020ce211edSreyk 	{ 6, 0x989c,								\
16030ce211edSreyk 	    { 0x00f10000, 0x00f10000, 0x00f10000, 0x00f10000, 0x00f10000 } },	\
16040ce211edSreyk 	{ 6, 0x989c,								\
16050ce211edSreyk 	    { 0x00120000, 0x00120000, 0x00120000, 0x00120000, 0x00120000 } },	\
16060ce211edSreyk 	{ 6, 0x989c,								\
16070ce211edSreyk 	    { 0x00120000, 0x00120000, 0x00120000, 0x00120000, 0x00120000 } },	\
16080ce211edSreyk 	{ 6, 0x989c,								\
16090ce211edSreyk 	    { 0x00730000, 0x00730000, 0x00730000, 0x00730000, 0x00730000 } },	\
16100ce211edSreyk 	{ 6, 0x989c,								\
16110ce211edSreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
16120ce211edSreyk 	{ 6, 0x989c,								\
16130ce211edSreyk 	    { 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000 } },	\
16140ce211edSreyk 	{ 6, 0x989c,								\
16150ce211edSreyk 	    { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },	\
16160ce211edSreyk 	{ 6, 0x989c,								\
16170ce211edSreyk 	    { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },	\
16180ce211edSreyk 	{ 6, 0x989c,								\
16190ce211edSreyk 	    { 0x008b0000, 0x008b0000, 0x008b0000, 0x008b0000, 0x008b0000 } },	\
16200ce211edSreyk 	{ 6, 0x989c,								\
16210ce211edSreyk 	    { 0x00600000, 0x00600000, 0x00600000, 0x00600000, 0x00600000 } },	\
16220ce211edSreyk 	{ 6, 0x989c,								\
16230ce211edSreyk 	    { 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000 } },	\
16240ce211edSreyk 	{ 6, 0x989c,								\
16250ce211edSreyk 	    { 0x00840000, 0x00840000, 0x00840000, 0x00840000, 0x00840000 } },	\
16260ce211edSreyk 	{ 6, 0x989c,								\
16270ce211edSreyk 	    { 0x00640000, 0x00640000, 0x00640000, 0x00640000, 0x00640000 } },	\
16280ce211edSreyk 	{ 6, 0x989c,								\
16290ce211edSreyk 	    { 0x00200000, 0x00200000, 0x00200000, 0x00200000, 0x00200000 } },	\
16300ce211edSreyk 	{ 6, 0x989c,								\
16310ce211edSreyk 	    { 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0x00240000 } },	\
16320ce211edSreyk 	{ 6, 0x989c,								\
16330ce211edSreyk 	    { 0x00250000, 0x00250000, 0x00250000, 0x00250000, 0x00250000 } },	\
16340ce211edSreyk 	{ 6, 0x989c,								\
16350ce211edSreyk 	    { 0x00110000, 0x00110000, 0x00110000, 0x00110000, 0x00110000 } },	\
16360ce211edSreyk 	{ 6, 0x989c,								\
16370ce211edSreyk 	    { 0x00110000, 0x00110000, 0x00110000, 0x00110000, 0x00110000 } },	\
16380ce211edSreyk 	{ 6, 0x989c,								\
16390ce211edSreyk 	    { 0x00510000, 0x00510000, 0x00510000, 0x00510000, 0x00510000 } },	\
16400ce211edSreyk 	{ 6, 0x989c,								\
16410ce211edSreyk 	    { 0x1c040000, 0x1c040000, 0x1c040000, 0x1c040000, 0x1c040000 } },	\
16420ce211edSreyk 	{ 6, 0x989c,								\
16430ce211edSreyk 	    { 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000 } },	\
16440ce211edSreyk 	{ 6, 0x989c,								\
16450ce211edSreyk 	    { 0x00a10000, 0x00a10000, 0x00a10000, 0x00a10000, 0x00a10000 } },	\
16460ce211edSreyk 	{ 6, 0x989c,								\
16470ce211edSreyk 	    { 0x00400000, 0x00400000, 0x00400000, 0x00400000, 0x00400000 } },	\
16480ce211edSreyk 	{ 6, 0x989c,								\
16490ce211edSreyk 	    { 0x03090000, 0x03090000, 0x03090000, 0x03090000, 0x03090000 } },	\
16500ce211edSreyk 	{ 6, 0x989c,								\
16510ce211edSreyk 	    { 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000 } },	\
16520ce211edSreyk 	{ 6, 0x989c,								\
16530ce211edSreyk 	    { 0x000000b0, 0x000000b0, 0x000000a8, 0x000000a8, 0x000000a8 } },	\
16540ce211edSreyk 	{ 6, 0x989c,								\
16550ce211edSreyk 	    { 0x0000002e, 0x0000002e, 0x0000002e, 0x0000002e, 0x0000002e } },	\
16560ce211edSreyk 	{ 6, 0x989c,								\
16570ce211edSreyk 	    { 0x006c4a41, 0x006c4a41, 0x006c4af1, 0x006c4a61, 0x006c4a61 } },	\
16580ce211edSreyk 	{ 6, 0x989c,								\
16590ce211edSreyk 	    { 0x0050892a, 0x0050892a, 0x0050892b, 0x0050892b, 0x0050892b } },	\
16600ce211edSreyk 	{ 6, 0x989c,								\
16610ce211edSreyk 	    { 0x00842400, 0x00842400, 0x00842400, 0x00842400, 0x00842400 } },	\
16620ce211edSreyk 	{ 6, 0x989c,								\
16630ce211edSreyk 	    { 0x00c69200, 0x00c69200, 0x00c69200, 0x00c69200, 0x00c69200 } },	\
16640ce211edSreyk 	{ 6, 0x98d0,								\
16650ce211edSreyk 	    { 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c } },	\
16660ce211edSreyk 	{ 7, 0x989c,								\
16670ce211edSreyk 	    { 0x00000094, 0x00000094, 0x00000094, 0x00000094, 0x00000094 } },	\
16680ce211edSreyk 	{ 7, 0x989c,								\
16690ce211edSreyk 	    { 0x00000091, 0x00000091, 0x00000091, 0x00000091, 0x00000091 } },	\
16700ce211edSreyk 	{ 7, 0x989c,								\
16710ce211edSreyk 	    { 0x0000000a, 0x0000000a, 0x00000012, 0x00000012, 0x00000012 } },	\
16720ce211edSreyk 	{ 7, 0x989c,								\
16730ce211edSreyk 	    { 0x00000080, 0x00000080, 0x00000080, 0x00000080, 0x00000080 } },	\
16740ce211edSreyk 	{ 7, 0x989c,								\
16750ce211edSreyk 	    { 0x000000c1, 0x000000c1, 0x000000c1, 0x000000c1, 0x000000c1 } },	\
16760ce211edSreyk 	{ 7, 0x989c,								\
16770ce211edSreyk 	    { 0x00000060, 0x00000060, 0x00000060, 0x00000060, 0x00000060 } },	\
16780ce211edSreyk 	{ 7, 0x989c,								\
16790ce211edSreyk 	    { 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0 } },	\
16800ce211edSreyk 	{ 7, 0x989c,								\
16810ce211edSreyk 	    { 0x00000022, 0x00000022, 0x00000022, 0x00000022, 0x00000022 } },	\
16820ce211edSreyk 	{ 7, 0x989c,								\
16830ce211edSreyk 	    { 0x00000092, 0x00000092, 0x00000092, 0x00000092, 0x00000092 } },	\
16840ce211edSreyk 	{ 7, 0x989c,								\
16850ce211edSreyk 	    { 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4 } },	\
16860ce211edSreyk 	{ 7, 0x989c,								\
16870ce211edSreyk 	    { 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc } },	\
16880ce211edSreyk 	{ 7, 0x989c,								\
16890ce211edSreyk 	    { 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c } },	\
16900ce211edSreyk 	{ 7, 0x98c4,								\
16910ce211edSreyk 	    { 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003 } },	\
16920ce211edSreyk }
16930ce211edSreyk 
16940ce211edSreyk #define AR5K_AR5112A_INI_RF	{						\
16950ce211edSreyk 	{ 1, 0x98d4,								\
16960ce211edSreyk 	    { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } },	\
16970ce211edSreyk 	{ 2, 0x98d0,								\
16980ce211edSreyk 	    { 0x03060408, 0x03070408, 0x03060408, 0x03060408, 0x03070408 } },	\
16990ce211edSreyk 	{ 3, 0x98dc,								\
17000ce211edSreyk 	    { 0x00a0c0c0, 0x00a0c0c0, 0x00e0c0c0, 0x00e0c0c0, 0x00e0c0c0 } },	\
17010ce211edSreyk 	{ 6, 0x989c,								\
1702cd42f1d6Sreyk 	    { 0x0f000000, 0x0f000000, 0x0f000000, 0x0f000000, 0x0f000000 } },	\
1703cd42f1d6Sreyk 	{ 6, 0x989c,								\
1704cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1705cd42f1d6Sreyk 	{ 6, 0x989c,								\
1706cd42f1d6Sreyk 	    { 0x00800000, 0x00800000, 0x00800000, 0x00800000, 0x00800000 } },	\
1707cd42f1d6Sreyk 	{ 6, 0x989c,								\
1708cd42f1d6Sreyk 	    { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } },	\
1709cd42f1d6Sreyk 	{ 6, 0x989c,								\
1710cd42f1d6Sreyk 	    { 0x00010000, 0x00010000, 0x00010000, 0x00010000, 0x00010000 } },	\
1711cd42f1d6Sreyk 	{ 6, 0x989c,								\
1712cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1713cd42f1d6Sreyk 	{ 6, 0x989c,								\
1714cd42f1d6Sreyk 	    { 0x00180000, 0x00180000, 0x00180000, 0x00180000, 0x00180000 } },	\
1715cd42f1d6Sreyk 	{ 6, 0x989c,								\
1716cd42f1d6Sreyk 	    { 0x00600000, 0x00600000, 0x006e0000, 0x006e0000, 0x006e0000 } },	\
1717cd42f1d6Sreyk 	{ 6, 0x989c,								\
1718cd42f1d6Sreyk 	    { 0x00c70000, 0x00c70000, 0x00c70000, 0x00c70000, 0x00c70000 } },	\
1719cd42f1d6Sreyk 	{ 6, 0x989c,								\
1720cd42f1d6Sreyk 	    { 0x004b0000, 0x004b0000, 0x004b0000, 0x004b0000, 0x004b0000 } },	\
1721cd42f1d6Sreyk 	{ 6, 0x989c,								\
1722cd42f1d6Sreyk 	    { 0x04480000, 0x04480000, 0x04480000, 0x04480000, 0x04480000 } },	\
1723cd42f1d6Sreyk 	{ 6, 0x989c,								\
1724cd42f1d6Sreyk 	    { 0x00220000, 0x00220000, 0x00220000, 0x00220000, 0x00220000 } },	\
1725cd42f1d6Sreyk 	{ 6, 0x989c,								\
1726cd42f1d6Sreyk 	    { 0x00e40000, 0x00e40000, 0x00e40000, 0x00e40000, 0x00e40000 } },	\
1727cd42f1d6Sreyk 	{ 6, 0x989c,								\
1728cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1729cd42f1d6Sreyk 	{ 6, 0x989c,								\
1730cd42f1d6Sreyk 	    { 0x00fc0000, 0x00fc0000, 0x00fc0000, 0x00fc0000, 0x00fc0000 } },	\
1731cd42f1d6Sreyk 	{ 6, 0x989c,								\
1732cd42f1d6Sreyk 	    { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },	\
1733cd42f1d6Sreyk 	{ 6, 0x989c,								\
1734cd42f1d6Sreyk 	    { 0x043f0000, 0x043f0000, 0x043f0000, 0x043f0000, 0x043f0000 } },	\
1735cd42f1d6Sreyk 	{ 6, 0x989c,								\
1736cd42f1d6Sreyk 	    { 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000 } },	\
1737cd42f1d6Sreyk 	{ 6, 0x989c,								\
17380ce211edSreyk 	    { 0x00190000, 0x00190000, 0x00190000, 0x00190000, 0x00190000 } },	\
1739cd42f1d6Sreyk 	{ 6, 0x989c,								\
1740cd42f1d6Sreyk 	    { 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0x00240000 } },	\
1741cd42f1d6Sreyk 	{ 6, 0x989c,								\
1742cd42f1d6Sreyk 	    { 0x00b40000, 0x00b40000, 0x00b40000, 0x00b40000, 0x00b40000 } },	\
1743cd42f1d6Sreyk 	{ 6, 0x989c,								\
1744cd42f1d6Sreyk 	    { 0x00990000, 0x00990000, 0x00990000, 0x00990000, 0x00990000 } },	\
1745cd42f1d6Sreyk 	{ 6, 0x989c,								\
1746cd42f1d6Sreyk 	    { 0x00500000, 0x00500000, 0x00500000, 0x00500000, 0x00500000 } },	\
1747cd42f1d6Sreyk 	{ 6, 0x989c,								\
1748cd42f1d6Sreyk 	    { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } },	\
1749cd42f1d6Sreyk 	{ 6, 0x989c,								\
1750cd42f1d6Sreyk 	    { 0x00120000, 0x00120000, 0x00120000, 0x00120000, 0x00120000 } },	\
1751cd42f1d6Sreyk 	{ 6, 0x989c,								\
1752cd42f1d6Sreyk 	    { 0xc0320000, 0xc0320000, 0xc0320000, 0xc0320000, 0xc0320000 } },	\
1753cd42f1d6Sreyk 	{ 6, 0x989c,								\
1754cd42f1d6Sreyk 	    { 0x01740000, 0x01740000, 0x01740000, 0x01740000, 0x01740000 } },	\
1755cd42f1d6Sreyk 	{ 6, 0x989c,								\
1756cd42f1d6Sreyk 	    { 0x00110000, 0x00110000, 0x00110000, 0x00110000, 0x00110000 } },	\
1757cd42f1d6Sreyk 	{ 6, 0x989c,								\
1758cd42f1d6Sreyk 	    { 0x86280000, 0x86280000, 0x86280000, 0x86280000, 0x86280000 } },	\
1759cd42f1d6Sreyk 	{ 6, 0x989c,								\
1760cd42f1d6Sreyk 	    { 0x31840000, 0x31840000, 0x31840000, 0x31840000, 0x31840000 } },	\
1761cd42f1d6Sreyk 	{ 6, 0x989c,								\
17620ce211edSreyk 	    { 0x00020080, 0x00020080, 0x00020080, 0x00020080, 0x00020080 } },	\
1763cd42f1d6Sreyk 	{ 6, 0x989c,								\
17640ce211edSreyk 	    { 0x00080009, 0x00080009, 0x00080009, 0x00080009, 0x00080009 } },	\
1765cd42f1d6Sreyk 	{ 6, 0x989c,								\
1766cd42f1d6Sreyk 	    { 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003 } },	\
1767cd42f1d6Sreyk 	{ 6, 0x989c,								\
1768cd42f1d6Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1769cd42f1d6Sreyk 	{ 6, 0x989c,								\
1770cd42f1d6Sreyk 	    { 0x000000b2, 0x000000b2, 0x000000b2, 0x000000b2, 0x000000b2 } },	\
1771cd42f1d6Sreyk 	{ 6, 0x989c,								\
1772cd42f1d6Sreyk 	    { 0x00b02084, 0x00b02084, 0x00b02084, 0x00b02084, 0x00b02084 } },	\
1773cd42f1d6Sreyk 	{ 6, 0x989c,								\
1774cd42f1d6Sreyk 	    { 0x004125a4, 0x004125a4, 0x004125a4, 0x004125a4, 0x004125a4 } },	\
1775cd42f1d6Sreyk 	{ 6, 0x989c,								\
1776cd42f1d6Sreyk 	    { 0x00119220, 0x00119220, 0x00119220, 0x00119220, 0x00119220 } },	\
1777cd42f1d6Sreyk 	{ 6, 0x989c,								\
1778cd42f1d6Sreyk 	    { 0x001a4800, 0x001a4800, 0x001a4800, 0x001a4800, 0x001a4800 } },	\
1779cd42f1d6Sreyk 	{ 6, 0x98d8,								\
1780cd42f1d6Sreyk 	    { 0x000b0230, 0x000b0230, 0x000b0230, 0x000b0230, 0x000b0230 } },	\
1781cd42f1d6Sreyk 	{ 7, 0x989c,								\
1782cd42f1d6Sreyk 	    { 0x00000094, 0x00000094, 0x00000094, 0x00000094, 0x00000094 } },	\
1783cd42f1d6Sreyk 	{ 7, 0x989c,								\
1784cd42f1d6Sreyk 	    { 0x00000091, 0x00000091, 0x00000091, 0x00000091, 0x00000091 } },	\
1785cd42f1d6Sreyk 	{ 7, 0x989c,								\
1786cd42f1d6Sreyk 	    { 0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000012 } },	\
1787cd42f1d6Sreyk 	{ 7, 0x989c,								\
1788cd42f1d6Sreyk 	    { 0x00000080, 0x00000080, 0x00000080, 0x00000080, 0x00000080 } },	\
1789cd42f1d6Sreyk 	{ 7, 0x989c,								\
1790cd42f1d6Sreyk 	    { 0x000000d9, 0x000000d9, 0x000000d9, 0x000000d9, 0x000000d9 } },	\
1791cd42f1d6Sreyk 	{ 7, 0x989c,								\
1792cd42f1d6Sreyk 	    { 0x00000060, 0x00000060, 0x00000060, 0x00000060, 0x00000060 } },	\
1793cd42f1d6Sreyk 	{ 7, 0x989c,								\
1794cd42f1d6Sreyk 	    { 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0 } },	\
1795cd42f1d6Sreyk 	{ 7, 0x989c,								\
1796cd42f1d6Sreyk 	    { 0x000000a2, 0x000000a2, 0x000000a2, 0x000000a2, 0x000000a2 } },	\
1797cd42f1d6Sreyk 	{ 7, 0x989c,								\
1798cd42f1d6Sreyk 	    { 0x00000052, 0x00000052, 0x00000052, 0x00000052, 0x00000052 } },	\
1799cd42f1d6Sreyk 	{ 7, 0x989c,								\
1800cd42f1d6Sreyk 	    { 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4 } },	\
1801cd42f1d6Sreyk 	{ 7, 0x989c,								\
1802cd42f1d6Sreyk 	    { 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc } },	\
1803cd42f1d6Sreyk 	{ 7, 0x989c,								\
1804cd42f1d6Sreyk 	    { 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c } },	\
1805cd42f1d6Sreyk 	{ 7, 0x98c4,								\
1806cd42f1d6Sreyk 	    { 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003 } },	\
18079ebef271Sreyk }
18089ebef271Sreyk 
1809b59011f9Sreyk #define AR5K_AR5413_INI_RF	{						\
1810b59011f9Sreyk 	{ 1, 0x98d4,								\
1811b59011f9Sreyk 	    { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } },	\
1812b59011f9Sreyk 	{ 2, 0x98d0,								\
1813b59011f9Sreyk 	    { 0x00000008, 0x00000008, 0x00000008, 0x00000008, 0x00000008 } },	\
1814b59011f9Sreyk 	{ 3, 0x98dc,								\
1815b59011f9Sreyk 	    { 0x00a000c0, 0x00a000c0, 0x00e000c0, 0x00e000c0, 0x00e000c0 } },	\
1816b59011f9Sreyk 	{ 6, 0x989c,								\
1817b59011f9Sreyk 	    { 0x33000000, 0x33000000, 0x33000000, 0x33000000, 0x33000000 } },	\
1818b59011f9Sreyk 	{ 6, 0x989c,								\
1819b59011f9Sreyk 	    { 0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000 } },	\
1820b59011f9Sreyk 	{ 6, 0x989c,								\
1821b59011f9Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1822b59011f9Sreyk 	{ 6, 0x989c,								\
1823b59011f9Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1824b59011f9Sreyk 	{ 6, 0x989c,								\
1825b59011f9Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1826b59011f9Sreyk 	{ 6, 0x989c,								\
1827b59011f9Sreyk 	    { 0x1f000000, 0x1f000000, 0x1f000000, 0x1f000000, 0x1f000000 } },	\
1828b59011f9Sreyk 	{ 6, 0x989c,								\
1829b59011f9Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1830b59011f9Sreyk 	{ 6, 0x989c,								\
1831b59011f9Sreyk 	    { 0x00b80000, 0x00b80000, 0x00b80000, 0x00b80000, 0x00b80000 } },	\
1832b59011f9Sreyk 	{ 6, 0x989c,								\
1833b59011f9Sreyk 	    { 0x00b70000, 0x00b70000, 0x00b70000, 0x00b70000, 0x00b70000 } },	\
1834b59011f9Sreyk 	{ 6, 0x989c,								\
1835b59011f9Sreyk 	    { 0x00840000, 0x00840000, 0x00840000, 0x00840000, 0x00840000 } },	\
1836b59011f9Sreyk 	{ 6, 0x989c,								\
1837b59011f9Sreyk 	    { 0x00980000, 0x00980000, 0x00980000, 0x00980000, 0x00980000 } },	\
1838b59011f9Sreyk 	{ 6, 0x989c,								\
1839b59011f9Sreyk 	    { 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000 } },	\
1840b59011f9Sreyk 	{ 6, 0x989c,								\
1841b59011f9Sreyk 	    { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },	\
1842b59011f9Sreyk 	{ 6, 0x989c,								\
1843b59011f9Sreyk 	    { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },	\
1844b59011f9Sreyk 	{ 6, 0x989c,								\
1845b59011f9Sreyk 	    { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },	\
1846b59011f9Sreyk 	{ 6, 0x989c,								\
1847b59011f9Sreyk 	    { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },	\
1848b59011f9Sreyk 	{ 6, 0x989c,								\
1849b59011f9Sreyk 	    { 0x00d70000, 0x00d70000, 0x00d70000, 0x00d70000, 0x00d70000 } },	\
1850b59011f9Sreyk 	{ 6, 0x989c,								\
1851b59011f9Sreyk 	    { 0x00610000, 0x00610000, 0x00610000, 0x00610000, 0x00610000 } },	\
1852b59011f9Sreyk 	{ 6, 0x989c,								\
1853b59011f9Sreyk 	    { 0x00fe0000, 0x00fe0000, 0x00fe0000, 0x00fe0000, 0x00fe0000 } },	\
1854b59011f9Sreyk 	{ 6, 0x989c,								\
1855b59011f9Sreyk 	    { 0x00de0000, 0x00de0000, 0x00de0000, 0x00de0000, 0x00de0000 } },	\
1856b59011f9Sreyk 	{ 6, 0x989c,								\
1857b59011f9Sreyk 	    { 0x007f0000, 0x007f0000, 0x007f0000, 0x007f0000, 0x007f0000 } },	\
1858b59011f9Sreyk 	{ 6, 0x989c,								\
1859b59011f9Sreyk 	    { 0x043d0000, 0x043d0000, 0x043d0000, 0x043d0000, 0x043d0000 } },	\
1860b59011f9Sreyk 	{ 6, 0x989c,								\
1861b59011f9Sreyk 	    { 0x00770000, 0x00770000, 0x00770000, 0x00770000, 0x00770000 } },	\
1862b59011f9Sreyk 	{ 6, 0x989c,								\
1863b59011f9Sreyk 	    { 0x00440000, 0x00440000, 0x00440000, 0x00440000, 0x00440000 } },	\
1864b59011f9Sreyk 	{ 6, 0x989c,								\
1865b59011f9Sreyk 	    { 0x00980000, 0x00980000, 0x00980000, 0x00980000, 0x00980000 } },	\
1866b59011f9Sreyk 	{ 6, 0x989c,								\
1867b59011f9Sreyk 	    { 0x00100080, 0x00100080, 0x00100080, 0x00100080, 0x00100080 } },	\
1868b59011f9Sreyk 	{ 6, 0x989c,								\
1869b59011f9Sreyk 	    { 0x0005c034, 0x0005c034, 0x0005c034, 0x0005c034, 0x0005c034 } },	\
1870b59011f9Sreyk 	{ 6, 0x989c,								\
1871b59011f9Sreyk 	    { 0x003100f0, 0x003100f0, 0x003100f0, 0x003100f0, 0x003100f0 } },	\
1872b59011f9Sreyk 	{ 6, 0x989c,								\
1873b59011f9Sreyk 	    { 0x000c011f, 0x000c011f, 0x000c011f, 0x000c011f, 0x000c011f } },	\
1874b59011f9Sreyk 	{ 6, 0x989c,								\
1875b59011f9Sreyk 	    { 0x00510040, 0x00510040, 0x005100a0, 0x005100a0, 0x005100a0 } },	\
1876b59011f9Sreyk 	{ 6, 0x989c,								\
1877b59011f9Sreyk 	    { 0x0050006a, 0x0050006a, 0x005000dd, 0x005000dd, 0x005000dd } },	\
1878b59011f9Sreyk 	{ 6, 0x989c,								\
1879b59011f9Sreyk 	    { 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000 } },	\
1880b59011f9Sreyk 	{ 6, 0x989c,								\
1881b59011f9Sreyk 	    { 0x00004044, 0x00004044, 0x00004044, 0x00004044, 0x00004044 } },	\
1882b59011f9Sreyk 	{ 6, 0x989c,								\
1883b59011f9Sreyk 	    { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },	\
1884b59011f9Sreyk 	{ 6, 0x989c,								\
1885b59011f9Sreyk 	    { 0x000060c0, 0x000060c0, 0x000060c0, 0x000060c0, 0x000060c0 } },	\
1886b59011f9Sreyk 	{ 6, 0x989c,								\
1887b59011f9Sreyk 	    { 0x00002c00, 0x00002c00, 0x00003600, 0x00003600, 0x00003600 } },	\
1888b59011f9Sreyk 	{ 6, 0x98c8,								\
1889b59011f9Sreyk 	    { 0x00000403, 0x00000403, 0x00040403, 0x00040403, 0x00040403 } },	\
1890b59011f9Sreyk 	{ 7, 0x989c,								\
1891b59011f9Sreyk 	    { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } },	\
1892b59011f9Sreyk 	{ 7, 0x989c,								\
1893b59011f9Sreyk 	    { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } },	\
1894b59011f9Sreyk 	{ 7, 0x98cc,								\
1895b59011f9Sreyk 	    { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } },	\
1896b59011f9Sreyk }
1897b59011f9Sreyk 
1898b59011f9Sreyk #define AR5K_AR2413_INI_RF	{						\
1899b59011f9Sreyk 	{ 1, 0x98d4, { 0, 0, 0x00000020, 0x00000020, 0x00000020 } },		\
1900b59011f9Sreyk 	{ 2, 0x98d0, { 0, 0, 0x02001408, 0x02001408, 0x02001408 } },		\
1901b59011f9Sreyk 	{ 3, 0x98dc, { 0, 0, 0x00e020c0, 0x00e020c0, 0x00e020c0 } },		\
1902b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0xf0000000, 0xf0000000, 0xf0000000 } },		\
1903b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },		\
1904b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x03000000, 0x03000000, 0x03000000 } },		\
1905b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },		\
1906b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },		\
1907b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },		\
1908b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },		\
1909b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },		\
1910b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x40400000, 0x40400000, 0x40400000 } },		\
1911b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x65050000, 0x65050000, 0x65050000 } },		\
1912b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },		\
1913b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },		\
1914b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x00420000, 0x00420000, 0x00420000 } },		\
1915b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x00b50000, 0x00b50000, 0x00b50000 } },		\
1916b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x00030000, 0x00030000, 0x00030000 } },		\
1917b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x00f70000, 0x00f70000, 0x00f70000 } },		\
1918b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x009d0000, 0x009d0000, 0x009d0000 } },		\
1919b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x00220000, 0x00220000, 0x00220000 } },		\
1920b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x04220000, 0x04220000, 0x04220000 } },		\
1921b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x00230018, 0x00230018, 0x00230018 } },		\
1922b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x00280050, 0x00280050, 0x00280050 } },		\
1923b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x005000c3, 0x005000c3, 0x005000c3 } },		\
1924b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x0004007f, 0x0004007f, 0x0004007f } },		\
1925b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x00000458, 0x00000458, 0x00000458 } },		\
1926b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },		\
1927b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0x0000c000, 0x0000c000, 0x0000c000 } },		\
1928b59011f9Sreyk 	{ 6, 0x98d8, { 0, 0, 0x00400230, 0x00400230, 0x00400230 } },		\
1929b59011f9Sreyk 	{ 7, 0x989c, { 0, 0, 0x00006400, 0x00006400, 0x00006400 } },		\
1930b59011f9Sreyk 	{ 7, 0x989c, { 0, 0, 0x00000800, 0x00000800, 0x00000800 } },		\
1931b59011f9Sreyk 	{ 7, 0x98cc, { 0, 0, 0x0000000e, 0x0000000e, 0x0000000e } },		\
1932b59011f9Sreyk }
1933b59011f9Sreyk 
1934b59011f9Sreyk #define AR5K_AR2425_INI_RF	{						\
1935b59011f9Sreyk 	{ 1, 0x98d4, { 0, 0, 0, 0x00000020, 0x00000020 } },			\
1936b59011f9Sreyk 	{ 2, 0x98d0, { 0, 0, 0, 0x02001408, 0x02001408 } },			\
1937b59011f9Sreyk 	{ 3, 0x98dc, { 0, 0, 0, 0x00e020c0, 0x00e020c0 } },			\
1938b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x10000000, 0x10000000 } },			\
1939b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },			\
1940b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },			\
1941b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },			\
1942b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },			\
1943b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },			\
1944b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },			\
1945b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },			\
1946b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },			\
1947b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },			\
1948b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },			\
1949b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x002a0000, 0x002a0000 } },			\
1950b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },			\
1951b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },			\
1952b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00100000, 0x00100000 } },			\
1953b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00020000, 0x00020000 } },			\
1954b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00730000, 0x00730000 } },			\
1955b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00f80000, 0x00f80000 } },			\
1956b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00e70000, 0x00e70000 } },			\
1957b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00140000, 0x00140000 } },			\
1958b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00910040, 0x00910040 } },			\
1959b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x0007001a, 0x0007001a } },			\
1960b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00410000, 0x00410000 } },			\
1961b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00810060, 0x00810060 } },			\
1962b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00020803, 0x00020803 } },			\
1963b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },			\
1964b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },			\
1965b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00001660, 0x00001660 } },			\
1966b59011f9Sreyk 	{ 6, 0x989c, { 0, 0, 0, 0x00001688, 0x00001688 } },			\
1967b59011f9Sreyk 	{ 6, 0x98c4, { 0, 0, 0, 0x00000001, 0x00000001 } },			\
1968b59011f9Sreyk 	{ 7, 0x989c, { 0, 0, 0, 0x00006400, 0x00006400 } },			\
1969b59011f9Sreyk 	{ 7, 0x989c, { 0, 0, 0, 0x00000800, 0x00000800 } },			\
1970b59011f9Sreyk 	{ 7, 0x98cc, { 0, 0, 0, 0x0000000e, 0x0000000e } }			\
1971b59011f9Sreyk }
1972b59011f9Sreyk 
1973f23d19fdSreyk struct ar5k_ini_rfgain {
1974f23d19fdSreyk 	u_int16_t	rfg_register;
1975b59011f9Sreyk 	u_int32_t	rfg_value[2];
1976f23d19fdSreyk 
1977f23d19fdSreyk #define AR5K_INI_RFGAIN_5GHZ	0
1978f23d19fdSreyk #define AR5K_INI_RFGAIN_2GHZ	1
1979b59011f9Sreyk #define AR5K_INI_RFGAIN(_n)	(0x9a00 + ((_n) << 2))
1980f23d19fdSreyk };
1981f23d19fdSreyk 
1982b59011f9Sreyk #define AR5K_AR5111_INI_RFGAIN	{				\
1983b59011f9Sreyk 	{ AR5K_INI_RFGAIN(0),	{ 0x000001a9, 0x00000000 } },	\
1984b59011f9Sreyk 	{ AR5K_INI_RFGAIN(1),	{ 0x000001e9, 0x00000040 } },	\
1985b59011f9Sreyk 	{ AR5K_INI_RFGAIN(2),	{ 0x00000029, 0x00000080 } },	\
1986b59011f9Sreyk 	{ AR5K_INI_RFGAIN(3),	{ 0x00000069, 0x00000150 } },	\
1987b59011f9Sreyk 	{ AR5K_INI_RFGAIN(4),	{ 0x00000199, 0x00000190 } },	\
1988b59011f9Sreyk 	{ AR5K_INI_RFGAIN(5),	{ 0x000001d9, 0x000001d0 } },	\
1989b59011f9Sreyk 	{ AR5K_INI_RFGAIN(6),	{ 0x00000019, 0x00000010 } },	\
1990b59011f9Sreyk 	{ AR5K_INI_RFGAIN(7),	{ 0x00000059, 0x00000044 } },	\
1991b59011f9Sreyk 	{ AR5K_INI_RFGAIN(8),	{ 0x00000099, 0x00000084 } },	\
1992b59011f9Sreyk 	{ AR5K_INI_RFGAIN(9),	{ 0x000001a5, 0x00000148 } },	\
1993b59011f9Sreyk 	{ AR5K_INI_RFGAIN(10),	{ 0x000001e5, 0x00000188 } },	\
1994b59011f9Sreyk 	{ AR5K_INI_RFGAIN(11),	{ 0x00000025, 0x000001c8 } },	\
1995b59011f9Sreyk 	{ AR5K_INI_RFGAIN(12),	{ 0x000001c8, 0x00000014 } },	\
1996b59011f9Sreyk 	{ AR5K_INI_RFGAIN(13),	{ 0x00000008, 0x00000042 } },	\
1997b59011f9Sreyk 	{ AR5K_INI_RFGAIN(14),	{ 0x00000048, 0x00000082 } },	\
1998b59011f9Sreyk 	{ AR5K_INI_RFGAIN(15),	{ 0x00000088, 0x00000178 } },	\
1999b59011f9Sreyk 	{ AR5K_INI_RFGAIN(16),	{ 0x00000198, 0x000001b8 } },	\
2000b59011f9Sreyk 	{ AR5K_INI_RFGAIN(17),	{ 0x000001d8, 0x000001f8 } },	\
2001b59011f9Sreyk 	{ AR5K_INI_RFGAIN(18),	{ 0x00000018, 0x00000012 } },	\
2002b59011f9Sreyk 	{ AR5K_INI_RFGAIN(19),	{ 0x00000058, 0x00000052 } },	\
2003b59011f9Sreyk 	{ AR5K_INI_RFGAIN(20),	{ 0x00000098, 0x00000092 } },	\
2004b59011f9Sreyk 	{ AR5K_INI_RFGAIN(21),	{ 0x000001a4, 0x0000017c } },	\
2005b59011f9Sreyk 	{ AR5K_INI_RFGAIN(22),	{ 0x000001e4, 0x000001bc } },	\
2006b59011f9Sreyk 	{ AR5K_INI_RFGAIN(23),	{ 0x00000024, 0x000001fc } },	\
2007b59011f9Sreyk 	{ AR5K_INI_RFGAIN(24),	{ 0x00000064, 0x0000000a } },	\
2008b59011f9Sreyk 	{ AR5K_INI_RFGAIN(25),	{ 0x000000a4, 0x0000004a } },	\
2009b59011f9Sreyk 	{ AR5K_INI_RFGAIN(26),	{ 0x000000e4, 0x0000008a } },	\
2010b59011f9Sreyk 	{ AR5K_INI_RFGAIN(27),	{ 0x0000010a, 0x0000015a } },	\
2011b59011f9Sreyk 	{ AR5K_INI_RFGAIN(28),	{ 0x0000014a, 0x0000019a } },	\
2012b59011f9Sreyk 	{ AR5K_INI_RFGAIN(29),	{ 0x0000018a, 0x000001da } },	\
2013b59011f9Sreyk 	{ AR5K_INI_RFGAIN(30),	{ 0x000001ca, 0x0000000e } },	\
2014b59011f9Sreyk 	{ AR5K_INI_RFGAIN(31),	{ 0x0000000a, 0x0000004e } },	\
2015b59011f9Sreyk 	{ AR5K_INI_RFGAIN(32),	{ 0x0000004a, 0x0000008e } },	\
2016b59011f9Sreyk 	{ AR5K_INI_RFGAIN(33),	{ 0x0000008a, 0x0000015e } },	\
2017b59011f9Sreyk 	{ AR5K_INI_RFGAIN(34),	{ 0x000001ba, 0x0000019e } },	\
2018b59011f9Sreyk 	{ AR5K_INI_RFGAIN(35),	{ 0x000001fa, 0x000001de } },	\
2019b59011f9Sreyk 	{ AR5K_INI_RFGAIN(36),	{ 0x0000003a, 0x00000009 } },	\
2020b59011f9Sreyk 	{ AR5K_INI_RFGAIN(37),	{ 0x0000007a, 0x00000049 } },	\
2021b59011f9Sreyk 	{ AR5K_INI_RFGAIN(38),	{ 0x00000186, 0x00000089 } },	\
2022b59011f9Sreyk 	{ AR5K_INI_RFGAIN(39),	{ 0x000001c6, 0x00000179 } },	\
2023b59011f9Sreyk 	{ AR5K_INI_RFGAIN(40),	{ 0x00000006, 0x000001b9 } },	\
2024b59011f9Sreyk 	{ AR5K_INI_RFGAIN(41),	{ 0x00000046, 0x000001f9 } },	\
2025b59011f9Sreyk 	{ AR5K_INI_RFGAIN(42),	{ 0x00000086, 0x00000039 } },	\
2026b59011f9Sreyk 	{ AR5K_INI_RFGAIN(43),	{ 0x000000c6, 0x00000079 } },	\
2027b59011f9Sreyk 	{ AR5K_INI_RFGAIN(44),	{ 0x000000c6, 0x000000b9 } },	\
2028b59011f9Sreyk 	{ AR5K_INI_RFGAIN(45),	{ 0x000000c6, 0x000001bd } },	\
2029b59011f9Sreyk 	{ AR5K_INI_RFGAIN(46),	{ 0x000000c6, 0x000001fd } },	\
2030b59011f9Sreyk 	{ AR5K_INI_RFGAIN(47),	{ 0x000000c6, 0x0000003d } },	\
2031b59011f9Sreyk 	{ AR5K_INI_RFGAIN(48),	{ 0x000000c6, 0x0000007d } },	\
2032b59011f9Sreyk 	{ AR5K_INI_RFGAIN(49),	{ 0x000000c6, 0x000000bd } },	\
2033b59011f9Sreyk 	{ AR5K_INI_RFGAIN(50),	{ 0x000000c6, 0x000000fd } },	\
2034b59011f9Sreyk 	{ AR5K_INI_RFGAIN(51),	{ 0x000000c6, 0x000000fd } },	\
2035b59011f9Sreyk 	{ AR5K_INI_RFGAIN(52),	{ 0x000000c6, 0x000000fd } },	\
2036b59011f9Sreyk 	{ AR5K_INI_RFGAIN(53),	{ 0x000000c6, 0x000000fd } },	\
2037b59011f9Sreyk 	{ AR5K_INI_RFGAIN(54),	{ 0x000000c6, 0x000000fd } },	\
2038b59011f9Sreyk 	{ AR5K_INI_RFGAIN(55),	{ 0x000000c6, 0x000000fd } },	\
2039b59011f9Sreyk 	{ AR5K_INI_RFGAIN(56),	{ 0x000000c6, 0x000000fd } },	\
2040b59011f9Sreyk 	{ AR5K_INI_RFGAIN(57),	{ 0x000000c6, 0x000000fd } },	\
2041b59011f9Sreyk 	{ AR5K_INI_RFGAIN(58),	{ 0x000000c6, 0x000000fd } },	\
2042b59011f9Sreyk 	{ AR5K_INI_RFGAIN(59),	{ 0x000000c6, 0x000000fd } },	\
2043b59011f9Sreyk 	{ AR5K_INI_RFGAIN(60),	{ 0x000000c6, 0x000000fd } },	\
2044b59011f9Sreyk 	{ AR5K_INI_RFGAIN(61),	{ 0x000000c6, 0x000000fd } },	\
2045b59011f9Sreyk 	{ AR5K_INI_RFGAIN(62),	{ 0x000000c6, 0x000000fd } },	\
2046b59011f9Sreyk 	{ AR5K_INI_RFGAIN(63),	{ 0x000000c6, 0x000000fd } }	\
2047b59011f9Sreyk }
2048b59011f9Sreyk 
2049b59011f9Sreyk #define AR5K_AR5112_INI_RFGAIN	{				\
2050b59011f9Sreyk 	{ AR5K_INI_RFGAIN(0),	{ 0x00000007, 0x00000007 } },	\
2051b59011f9Sreyk 	{ AR5K_INI_RFGAIN(1),	{ 0x00000047, 0x00000047 } },	\
2052b59011f9Sreyk 	{ AR5K_INI_RFGAIN(2),	{ 0x00000087, 0x00000087 } },	\
2053b59011f9Sreyk 	{ AR5K_INI_RFGAIN(3),	{ 0x000001a0, 0x000001a0 } },	\
2054b59011f9Sreyk 	{ AR5K_INI_RFGAIN(4),	{ 0x000001e0, 0x000001e0 } },	\
2055b59011f9Sreyk 	{ AR5K_INI_RFGAIN(5),	{ 0x00000020, 0x00000020 } },	\
2056b59011f9Sreyk 	{ AR5K_INI_RFGAIN(6),	{ 0x00000060, 0x00000060 } },	\
2057b59011f9Sreyk 	{ AR5K_INI_RFGAIN(7),	{ 0x000001a1, 0x000001a1 } },	\
2058b59011f9Sreyk 	{ AR5K_INI_RFGAIN(8),	{ 0x000001e1, 0x000001e1 } },	\
2059b59011f9Sreyk 	{ AR5K_INI_RFGAIN(9),	{ 0x00000021, 0x00000021 } },	\
2060b59011f9Sreyk 	{ AR5K_INI_RFGAIN(10),	{ 0x00000061, 0x00000061 } },	\
2061b59011f9Sreyk 	{ AR5K_INI_RFGAIN(11),	{ 0x00000162, 0x00000162 } },	\
2062b59011f9Sreyk 	{ AR5K_INI_RFGAIN(12),	{ 0x000001a2, 0x000001a2 } },	\
2063b59011f9Sreyk 	{ AR5K_INI_RFGAIN(13),	{ 0x000001e2, 0x000001e2 } },	\
2064b59011f9Sreyk 	{ AR5K_INI_RFGAIN(14),	{ 0x00000022, 0x00000022 } },	\
2065b59011f9Sreyk 	{ AR5K_INI_RFGAIN(15),	{ 0x00000062, 0x00000062 } },	\
2066b59011f9Sreyk 	{ AR5K_INI_RFGAIN(16),	{ 0x00000163, 0x00000163 } },	\
2067b59011f9Sreyk 	{ AR5K_INI_RFGAIN(17),	{ 0x000001a3, 0x000001a3 } },	\
2068b59011f9Sreyk 	{ AR5K_INI_RFGAIN(18),	{ 0x000001e3, 0x000001e3 } },	\
2069b59011f9Sreyk 	{ AR5K_INI_RFGAIN(19),	{ 0x00000023, 0x00000023 } },	\
2070b59011f9Sreyk 	{ AR5K_INI_RFGAIN(20),	{ 0x00000063, 0x00000063 } },	\
2071b59011f9Sreyk 	{ AR5K_INI_RFGAIN(21),	{ 0x00000184, 0x00000184 } },	\
2072b59011f9Sreyk 	{ AR5K_INI_RFGAIN(22),	{ 0x000001c4, 0x000001c4 } },	\
2073b59011f9Sreyk 	{ AR5K_INI_RFGAIN(23),	{ 0x00000004, 0x00000004 } },	\
2074b59011f9Sreyk 	{ AR5K_INI_RFGAIN(24),	{ 0x000001ea, 0x0000000b } },	\
2075b59011f9Sreyk 	{ AR5K_INI_RFGAIN(25),	{ 0x0000002a, 0x0000004b } },	\
2076b59011f9Sreyk 	{ AR5K_INI_RFGAIN(26),	{ 0x0000006a, 0x0000008b } },	\
2077b59011f9Sreyk 	{ AR5K_INI_RFGAIN(27),	{ 0x000000aa, 0x000001ac } },	\
2078b59011f9Sreyk 	{ AR5K_INI_RFGAIN(28),	{ 0x000001ab, 0x000001ec } },	\
2079b59011f9Sreyk 	{ AR5K_INI_RFGAIN(29),	{ 0x000001eb, 0x0000002c } },	\
2080b59011f9Sreyk 	{ AR5K_INI_RFGAIN(30),	{ 0x0000002b, 0x00000012 } },	\
2081b59011f9Sreyk 	{ AR5K_INI_RFGAIN(31),	{ 0x0000006b, 0x00000052 } },	\
2082b59011f9Sreyk 	{ AR5K_INI_RFGAIN(32),	{ 0x000000ab, 0x00000092 } },	\
2083b59011f9Sreyk 	{ AR5K_INI_RFGAIN(33),	{ 0x000001ac, 0x00000193 } },	\
2084b59011f9Sreyk 	{ AR5K_INI_RFGAIN(34),	{ 0x000001ec, 0x000001d3 } },	\
2085b59011f9Sreyk 	{ AR5K_INI_RFGAIN(35),	{ 0x0000002c, 0x00000013 } },	\
2086b59011f9Sreyk 	{ AR5K_INI_RFGAIN(36),	{ 0x0000003a, 0x00000053 } },	\
2087b59011f9Sreyk 	{ AR5K_INI_RFGAIN(37),	{ 0x0000007a, 0x00000093 } },	\
2088b59011f9Sreyk 	{ AR5K_INI_RFGAIN(38),	{ 0x000000ba, 0x00000194 } },	\
2089b59011f9Sreyk 	{ AR5K_INI_RFGAIN(39),	{ 0x000001bb, 0x000001d4 } },	\
2090b59011f9Sreyk 	{ AR5K_INI_RFGAIN(40),	{ 0x000001fb, 0x00000014 } },	\
2091b59011f9Sreyk 	{ AR5K_INI_RFGAIN(41),	{ 0x0000003b, 0x0000003a } },	\
2092b59011f9Sreyk 	{ AR5K_INI_RFGAIN(42),	{ 0x0000007b, 0x0000007a } },	\
2093b59011f9Sreyk 	{ AR5K_INI_RFGAIN(43),	{ 0x000000bb, 0x000000ba } },	\
2094b59011f9Sreyk 	{ AR5K_INI_RFGAIN(44),	{ 0x000001bc, 0x000001bb } },	\
2095b59011f9Sreyk 	{ AR5K_INI_RFGAIN(45),	{ 0x000001fc, 0x000001fb } },	\
2096b59011f9Sreyk 	{ AR5K_INI_RFGAIN(46),	{ 0x0000003c, 0x0000003b } },	\
2097b59011f9Sreyk 	{ AR5K_INI_RFGAIN(47),	{ 0x0000007c, 0x0000007b } },	\
2098b59011f9Sreyk 	{ AR5K_INI_RFGAIN(48),	{ 0x000000bc, 0x000000bb } },	\
2099b59011f9Sreyk 	{ AR5K_INI_RFGAIN(49),	{ 0x000000fc, 0x000001bc } },	\
2100b59011f9Sreyk 	{ AR5K_INI_RFGAIN(50),	{ 0x000000fc, 0x000001fc } },	\
2101b59011f9Sreyk 	{ AR5K_INI_RFGAIN(51),	{ 0x000000fc, 0x0000003c } },	\
2102b59011f9Sreyk 	{ AR5K_INI_RFGAIN(52),	{ 0x000000fc, 0x0000007c } },	\
2103b59011f9Sreyk 	{ AR5K_INI_RFGAIN(53),	{ 0x000000fc, 0x000000bc } },	\
2104b59011f9Sreyk 	{ AR5K_INI_RFGAIN(54),	{ 0x000000fc, 0x000000fc } },	\
2105b59011f9Sreyk 	{ AR5K_INI_RFGAIN(55),	{ 0x000000fc, 0x000000fc } },	\
2106b59011f9Sreyk 	{ AR5K_INI_RFGAIN(56),	{ 0x000000fc, 0x000000fc } },	\
2107b59011f9Sreyk 	{ AR5K_INI_RFGAIN(57),	{ 0x000000fc, 0x000000fc } },	\
2108b59011f9Sreyk 	{ AR5K_INI_RFGAIN(58),	{ 0x000000fc, 0x000000fc } },	\
2109b59011f9Sreyk 	{ AR5K_INI_RFGAIN(59),	{ 0x000000fc, 0x000000fc } },	\
2110b59011f9Sreyk 	{ AR5K_INI_RFGAIN(60),	{ 0x000000fc, 0x000000fc } },	\
2111b59011f9Sreyk 	{ AR5K_INI_RFGAIN(61),	{ 0x000000fc, 0x000000fc } },	\
2112b59011f9Sreyk 	{ AR5K_INI_RFGAIN(62),	{ 0x000000fc, 0x000000fc } },	\
2113b59011f9Sreyk 	{ AR5K_INI_RFGAIN(63),	{ 0x000000fc, 0x000000fc } },	\
2114b59011f9Sreyk }
2115b59011f9Sreyk 
2116b59011f9Sreyk #define AR5K_AR5413_INI_RFGAIN	{				\
2117b59011f9Sreyk 	{ AR5K_INI_RFGAIN(0),	{ 0x00000000, 0x00000000 } },	\
2118b59011f9Sreyk 	{ AR5K_INI_RFGAIN(1),	{ 0x00000040, 0x00000040 } },	\
2119b59011f9Sreyk 	{ AR5K_INI_RFGAIN(2),	{ 0x00000080, 0x00000080 } },	\
2120b59011f9Sreyk 	{ AR5K_INI_RFGAIN(3),	{ 0x000001a1, 0x00000161 } },	\
2121b59011f9Sreyk 	{ AR5K_INI_RFGAIN(4),	{ 0x000001e1, 0x000001a1 } },	\
2122b59011f9Sreyk 	{ AR5K_INI_RFGAIN(5),	{ 0x00000021, 0x000001e1 } },	\
2123b59011f9Sreyk 	{ AR5K_INI_RFGAIN(6),	{ 0x00000061, 0x00000021 } },	\
2124b59011f9Sreyk 	{ AR5K_INI_RFGAIN(7),	{ 0x00000188, 0x00000061 } },	\
2125b59011f9Sreyk 	{ AR5K_INI_RFGAIN(8),	{ 0x000001c8, 0x00000188 } },	\
2126b59011f9Sreyk 	{ AR5K_INI_RFGAIN(9),	{ 0x00000008, 0x000001c8 } },	\
2127b59011f9Sreyk 	{ AR5K_INI_RFGAIN(10),	{ 0x00000048, 0x00000008 } },	\
2128b59011f9Sreyk 	{ AR5K_INI_RFGAIN(11),	{ 0x00000088, 0x00000048 } },	\
2129b59011f9Sreyk 	{ AR5K_INI_RFGAIN(12),	{ 0x000001a9, 0x00000088 } },	\
2130b59011f9Sreyk 	{ AR5K_INI_RFGAIN(13),	{ 0x000001e9, 0x00000169 } },	\
2131b59011f9Sreyk 	{ AR5K_INI_RFGAIN(14),	{ 0x00000029, 0x000001a9 } },	\
2132b59011f9Sreyk 	{ AR5K_INI_RFGAIN(15),	{ 0x00000069, 0x000001e9 } },	\
2133b59011f9Sreyk 	{ AR5K_INI_RFGAIN(16),	{ 0x000001d0, 0x00000029 } },	\
2134b59011f9Sreyk 	{ AR5K_INI_RFGAIN(17),	{ 0x00000010, 0x00000069 } },	\
2135b59011f9Sreyk 	{ AR5K_INI_RFGAIN(18),	{ 0x00000050, 0x00000190 } },	\
2136b59011f9Sreyk 	{ AR5K_INI_RFGAIN(19),	{ 0x00000090, 0x000001d0 } },	\
2137b59011f9Sreyk 	{ AR5K_INI_RFGAIN(20),	{ 0x000001b1, 0x00000010 } },	\
2138b59011f9Sreyk 	{ AR5K_INI_RFGAIN(21),	{ 0x000001f1, 0x00000050 } },	\
2139b59011f9Sreyk 	{ AR5K_INI_RFGAIN(22),	{ 0x00000031, 0x00000090 } },	\
2140b59011f9Sreyk 	{ AR5K_INI_RFGAIN(23),	{ 0x00000071, 0x00000171 } },	\
2141b59011f9Sreyk 	{ AR5K_INI_RFGAIN(24),	{ 0x000001b8, 0x000001b1 } },	\
2142b59011f9Sreyk 	{ AR5K_INI_RFGAIN(25),	{ 0x000001f8, 0x000001f1 } },	\
2143b59011f9Sreyk 	{ AR5K_INI_RFGAIN(26),	{ 0x00000038, 0x00000031 } },	\
2144b59011f9Sreyk 	{ AR5K_INI_RFGAIN(27),	{ 0x00000078, 0x00000071 } },	\
2145b59011f9Sreyk 	{ AR5K_INI_RFGAIN(28),	{ 0x00000199, 0x00000198 } },	\
2146b59011f9Sreyk 	{ AR5K_INI_RFGAIN(29),	{ 0x000001d9, 0x000001d8 } },	\
2147b59011f9Sreyk 	{ AR5K_INI_RFGAIN(30),	{ 0x00000019, 0x00000018 } },	\
2148b59011f9Sreyk 	{ AR5K_INI_RFGAIN(31),	{ 0x00000059, 0x00000058 } },	\
2149b59011f9Sreyk 	{ AR5K_INI_RFGAIN(32),	{ 0x00000099, 0x00000098 } },	\
2150b59011f9Sreyk 	{ AR5K_INI_RFGAIN(33),	{ 0x000000d9, 0x00000179 } },	\
2151b59011f9Sreyk 	{ AR5K_INI_RFGAIN(34),	{ 0x000000f9, 0x000001b9 } },	\
2152b59011f9Sreyk 	{ AR5K_INI_RFGAIN(35),	{ 0x000000f9, 0x000001f9 } },	\
2153b59011f9Sreyk 	{ AR5K_INI_RFGAIN(36),	{ 0x000000f9, 0x00000039 } },	\
2154b59011f9Sreyk 	{ AR5K_INI_RFGAIN(37),	{ 0x000000f9, 0x00000079 } },	\
2155b59011f9Sreyk 	{ AR5K_INI_RFGAIN(38),	{ 0x000000f9, 0x000000b9 } },	\
2156b59011f9Sreyk 	{ AR5K_INI_RFGAIN(39),	{ 0x000000f9, 0x000000f9 } },	\
2157b59011f9Sreyk 	{ AR5K_INI_RFGAIN(40),	{ 0x000000f9, 0x000000f9 } },	\
2158b59011f9Sreyk 	{ AR5K_INI_RFGAIN(41),	{ 0x000000f9, 0x000000f9 } },	\
2159b59011f9Sreyk 	{ AR5K_INI_RFGAIN(42),	{ 0x000000f9, 0x000000f9 } },	\
2160b59011f9Sreyk 	{ AR5K_INI_RFGAIN(43),	{ 0x000000f9, 0x000000f9 } },	\
2161b59011f9Sreyk 	{ AR5K_INI_RFGAIN(44),	{ 0x000000f9, 0x000000f9 } },	\
2162b59011f9Sreyk 	{ AR5K_INI_RFGAIN(45),	{ 0x000000f9, 0x000000f9 } },	\
2163b59011f9Sreyk 	{ AR5K_INI_RFGAIN(46),	{ 0x000000f9, 0x000000f9 } },	\
2164b59011f9Sreyk 	{ AR5K_INI_RFGAIN(47),	{ 0x000000f9, 0x000000f9 } },	\
2165b59011f9Sreyk 	{ AR5K_INI_RFGAIN(48),	{ 0x000000f9, 0x000000f9 } },	\
2166b59011f9Sreyk 	{ AR5K_INI_RFGAIN(49),	{ 0x000000f9, 0x000000f9 } },	\
2167b59011f9Sreyk 	{ AR5K_INI_RFGAIN(50),	{ 0x000000f9, 0x000000f9 } },	\
2168b59011f9Sreyk 	{ AR5K_INI_RFGAIN(51),	{ 0x000000f9, 0x000000f9 } },	\
2169b59011f9Sreyk 	{ AR5K_INI_RFGAIN(52),	{ 0x000000f9, 0x000000f9 } },	\
2170b59011f9Sreyk 	{ AR5K_INI_RFGAIN(53),	{ 0x000000f9, 0x000000f9 } },	\
2171b59011f9Sreyk 	{ AR5K_INI_RFGAIN(54),	{ 0x000000f9, 0x000000f9 } },	\
2172b59011f9Sreyk 	{ AR5K_INI_RFGAIN(55),	{ 0x000000f9, 0x000000f9 } },	\
2173b59011f9Sreyk 	{ AR5K_INI_RFGAIN(56),	{ 0x000000f9, 0x000000f9 } },	\
2174b59011f9Sreyk 	{ AR5K_INI_RFGAIN(57),	{ 0x000000f9, 0x000000f9 } },	\
2175b59011f9Sreyk 	{ AR5K_INI_RFGAIN(58),	{ 0x000000f9, 0x000000f9 } },	\
2176b59011f9Sreyk 	{ AR5K_INI_RFGAIN(59),	{ 0x000000f9, 0x000000f9 } },	\
2177b59011f9Sreyk 	{ AR5K_INI_RFGAIN(60),	{ 0x000000f9, 0x000000f9 } },	\
2178b59011f9Sreyk 	{ AR5K_INI_RFGAIN(61),	{ 0x000000f9, 0x000000f9 } },	\
2179b59011f9Sreyk 	{ AR5K_INI_RFGAIN(62),	{ 0x000000f9, 0x000000f9 } },	\
2180b59011f9Sreyk 	{ AR5K_INI_RFGAIN(63),	{ 0x000000f9, 0x000000f9 } }	\
2181b59011f9Sreyk }
2182b59011f9Sreyk 
2183b59011f9Sreyk #define AR5K_AR2413_INI_RFGAIN	{				\
2184b59011f9Sreyk 	{ AR5K_INI_RFGAIN(0),	{ 0, 0x00000000 } },		\
2185b59011f9Sreyk 	{ AR5K_INI_RFGAIN(1),	{ 0, 0x00000040 } },		\
2186b59011f9Sreyk 	{ AR5K_INI_RFGAIN(2),	{ 0, 0x00000080 } },		\
2187b59011f9Sreyk 	{ AR5K_INI_RFGAIN(3),	{ 0, 0x00000181 } },		\
2188b59011f9Sreyk 	{ AR5K_INI_RFGAIN(4),	{ 0, 0x000001c1 } },		\
2189b59011f9Sreyk 	{ AR5K_INI_RFGAIN(5),	{ 0, 0x00000001 } },		\
2190b59011f9Sreyk 	{ AR5K_INI_RFGAIN(6),	{ 0, 0x00000041 } },		\
2191b59011f9Sreyk 	{ AR5K_INI_RFGAIN(7),	{ 0, 0x00000081 } },		\
2192b59011f9Sreyk 	{ AR5K_INI_RFGAIN(8),	{ 0, 0x00000168 } },		\
2193b59011f9Sreyk 	{ AR5K_INI_RFGAIN(9),	{ 0, 0x000001a8 } },		\
2194b59011f9Sreyk 	{ AR5K_INI_RFGAIN(10),	{ 0, 0x000001e8 } },		\
2195b59011f9Sreyk 	{ AR5K_INI_RFGAIN(11),	{ 0, 0x00000028 } },		\
2196b59011f9Sreyk 	{ AR5K_INI_RFGAIN(12),	{ 0, 0x00000068 } },		\
2197b59011f9Sreyk 	{ AR5K_INI_RFGAIN(13),	{ 0, 0x00000189 } },		\
2198b59011f9Sreyk 	{ AR5K_INI_RFGAIN(14),	{ 0, 0x000001c9 } },		\
2199b59011f9Sreyk 	{ AR5K_INI_RFGAIN(15),	{ 0, 0x00000009 } },		\
2200b59011f9Sreyk 	{ AR5K_INI_RFGAIN(16),	{ 0, 0x00000049 } },		\
2201b59011f9Sreyk 	{ AR5K_INI_RFGAIN(17),	{ 0, 0x00000089 } },		\
2202b59011f9Sreyk 	{ AR5K_INI_RFGAIN(18),	{ 0, 0x00000190 } },		\
2203b59011f9Sreyk 	{ AR5K_INI_RFGAIN(19),	{ 0, 0x000001d0 } },		\
2204b59011f9Sreyk 	{ AR5K_INI_RFGAIN(20),	{ 0, 0x00000010 } },		\
2205b59011f9Sreyk 	{ AR5K_INI_RFGAIN(21),	{ 0, 0x00000050 } },		\
2206b59011f9Sreyk 	{ AR5K_INI_RFGAIN(22),	{ 0, 0x00000090 } },		\
2207b59011f9Sreyk 	{ AR5K_INI_RFGAIN(23),	{ 0, 0x00000191 } },		\
2208b59011f9Sreyk 	{ AR5K_INI_RFGAIN(24),	{ 0, 0x000001d1 } },		\
2209b59011f9Sreyk 	{ AR5K_INI_RFGAIN(25),	{ 0, 0x00000011 } },		\
2210b59011f9Sreyk 	{ AR5K_INI_RFGAIN(26),	{ 0, 0x00000051 } },		\
2211b59011f9Sreyk 	{ AR5K_INI_RFGAIN(27),	{ 0, 0x00000091 } },		\
2212b59011f9Sreyk 	{ AR5K_INI_RFGAIN(28),	{ 0, 0x00000178 } },		\
2213b59011f9Sreyk 	{ AR5K_INI_RFGAIN(29),	{ 0, 0x000001b8 } },		\
2214b59011f9Sreyk 	{ AR5K_INI_RFGAIN(30),	{ 0, 0x000001f8 } },		\
2215b59011f9Sreyk 	{ AR5K_INI_RFGAIN(31),	{ 0, 0x00000038 } },		\
2216b59011f9Sreyk 	{ AR5K_INI_RFGAIN(32),	{ 0, 0x00000078 } },		\
2217b59011f9Sreyk 	{ AR5K_INI_RFGAIN(33),	{ 0, 0x00000199 } },		\
2218b59011f9Sreyk 	{ AR5K_INI_RFGAIN(34),	{ 0, 0x000001d9 } },		\
2219b59011f9Sreyk 	{ AR5K_INI_RFGAIN(35),	{ 0, 0x00000019 } },		\
2220b59011f9Sreyk 	{ AR5K_INI_RFGAIN(36),	{ 0, 0x00000059 } },		\
2221b59011f9Sreyk 	{ AR5K_INI_RFGAIN(37),	{ 0, 0x00000099 } },		\
2222b59011f9Sreyk 	{ AR5K_INI_RFGAIN(38),	{ 0, 0x000000d9 } },		\
2223b59011f9Sreyk 	{ AR5K_INI_RFGAIN(39),	{ 0, 0x000000f9 } },		\
2224b59011f9Sreyk 	{ AR5K_INI_RFGAIN(40),	{ 0, 0x000000f9 } },		\
2225b59011f9Sreyk 	{ AR5K_INI_RFGAIN(41),	{ 0, 0x000000f9 } },		\
2226b59011f9Sreyk 	{ AR5K_INI_RFGAIN(42),	{ 0, 0x000000f9 } },		\
2227b59011f9Sreyk 	{ AR5K_INI_RFGAIN(43),	{ 0, 0x000000f9 } },		\
2228b59011f9Sreyk 	{ AR5K_INI_RFGAIN(44),	{ 0, 0x000000f9 } },		\
2229b59011f9Sreyk 	{ AR5K_INI_RFGAIN(45),	{ 0, 0x000000f9 } },		\
2230b59011f9Sreyk 	{ AR5K_INI_RFGAIN(46),	{ 0, 0x000000f9 } },		\
2231b59011f9Sreyk 	{ AR5K_INI_RFGAIN(47),	{ 0, 0x000000f9 } },		\
2232b59011f9Sreyk 	{ AR5K_INI_RFGAIN(48),	{ 0, 0x000000f9 } },		\
2233b59011f9Sreyk 	{ AR5K_INI_RFGAIN(49),	{ 0, 0x000000f9 } },		\
2234b59011f9Sreyk 	{ AR5K_INI_RFGAIN(50),	{ 0, 0x000000f9 } },		\
2235b59011f9Sreyk 	{ AR5K_INI_RFGAIN(51),	{ 0, 0x000000f9 } },		\
2236b59011f9Sreyk 	{ AR5K_INI_RFGAIN(52),	{ 0, 0x000000f9 } },		\
2237b59011f9Sreyk 	{ AR5K_INI_RFGAIN(53),	{ 0, 0x000000f9 } },		\
2238b59011f9Sreyk 	{ AR5K_INI_RFGAIN(54),	{ 0, 0x000000f9 } },		\
2239b59011f9Sreyk 	{ AR5K_INI_RFGAIN(55),	{ 0, 0x000000f9 } },		\
2240b59011f9Sreyk 	{ AR5K_INI_RFGAIN(56),	{ 0, 0x000000f9 } },		\
2241b59011f9Sreyk 	{ AR5K_INI_RFGAIN(57),	{ 0, 0x000000f9 } },		\
2242b59011f9Sreyk 	{ AR5K_INI_RFGAIN(58),	{ 0, 0x000000f9 } },		\
2243b59011f9Sreyk 	{ AR5K_INI_RFGAIN(59),	{ 0, 0x000000f9 } },		\
2244b59011f9Sreyk 	{ AR5K_INI_RFGAIN(60),	{ 0, 0x000000f9 } },		\
2245b59011f9Sreyk 	{ AR5K_INI_RFGAIN(61),	{ 0, 0x000000f9 } },		\
2246b59011f9Sreyk 	{ AR5K_INI_RFGAIN(62),	{ 0, 0x000000f9 } },		\
2247b59011f9Sreyk 	{ AR5K_INI_RFGAIN(63),	{ 0, 0x000000f9 } },		\
2248f23d19fdSreyk }
2249f23d19fdSreyk 
22509ebef271Sreyk /*
2251f51c4ae1Sreyk  * Prototypes
2252f51c4ae1Sreyk  */
2253f51c4ae1Sreyk 
2254f51c4ae1Sreyk __BEGIN_DECLS
2255f51c4ae1Sreyk 
2256f51c4ae1Sreyk const char		*ath_hal_probe(u_int16_t, u_int16_t);
2257f51c4ae1Sreyk 
2258f51c4ae1Sreyk struct ath_hal		*ath_hal_attach(u_int16_t, void *, bus_space_tag_t,
22599cfa9686Sreyk     bus_space_handle_t, u_int, HAL_STATUS *);
2260f51c4ae1Sreyk 
2261f51c4ae1Sreyk u_int16_t		 ath_hal_computetxtime(struct ath_hal *,
2262f51c4ae1Sreyk     const HAL_RATE_TABLE *, u_int32_t, u_int16_t, HAL_BOOL);
2263f51c4ae1Sreyk 
2264f51c4ae1Sreyk HAL_BOOL		 ath_hal_init_channels(struct ath_hal *, HAL_CHANNEL *,
226523349211Sreyk     u_int, u_int *, u_int16_t, HAL_BOOL, HAL_BOOL);
2266f51c4ae1Sreyk 
2267bafd5704Sreyk const char		*ar5k_printver(enum ar5k_srev_type, u_int32_t);
2268f51c4ae1Sreyk void			 ar5k_radar_alert(struct ath_hal *);
2269ff3f4e6cSreyk ieee80211_regdomain_t	 ar5k_regdomain_to_ieee(u_int16_t);
2270ff3f4e6cSreyk u_int16_t		 ar5k_regdomain_from_ieee(ieee80211_regdomain_t);
2271486f10cbSreyk u_int16_t		 ar5k_get_regdomain(struct ath_hal *);
2272486f10cbSreyk 
2273f51c4ae1Sreyk u_int32_t		 ar5k_bitswap(u_int32_t, u_int);
22748fa13e1fSstsp u_int			 ar5k_clocktoh(u_int);
22758fa13e1fSstsp u_int			 ar5k_htoclock(u_int);
227612410832Sreyk void			 ar5k_rt_copy(HAL_RATE_TABLE *, const HAL_RATE_TABLE *);
2277f51c4ae1Sreyk 
2278f51c4ae1Sreyk HAL_BOOL		 ar5k_register_timeout(struct ath_hal *, u_int32_t,
2279f51c4ae1Sreyk     u_int32_t, u_int32_t, HAL_BOOL);
2280f51c4ae1Sreyk 
22819ebef271Sreyk int			 ar5k_eeprom_init(struct ath_hal *);
22829ebef271Sreyk int			 ar5k_eeprom_read_mac(struct ath_hal *, u_int8_t *);
22839ebef271Sreyk HAL_BOOL		 ar5k_eeprom_regulation_domain(struct ath_hal *,
2284486f10cbSreyk     HAL_BOOL, ieee80211_regdomain_t *);
22859ebef271Sreyk 
22869ebef271Sreyk HAL_BOOL		 ar5k_channel(struct ath_hal *, HAL_CHANNEL *);
22879ebef271Sreyk HAL_BOOL		 ar5k_rfregs(struct ath_hal *, HAL_CHANNEL *, u_int);
2288dd37d60cSreyk u_int32_t		 ar5k_rfregs_gainf_corr(struct ath_hal *);
2289dd37d60cSreyk HAL_BOOL		 ar5k_rfregs_gain_readback(struct ath_hal *);
2290dd37d60cSreyk int32_t			 ar5k_rfregs_gain_adjust(struct ath_hal *);
2291b59011f9Sreyk HAL_BOOL		 ar5k_rfgain(struct ath_hal *, u_int);
22929ebef271Sreyk 
2293e9147aabSreyk void			 ar5k_txpower_table(struct ath_hal *, HAL_CHANNEL *,
2294e9147aabSreyk     int16_t);
2295e9147aabSreyk 
2296b59011f9Sreyk void			 ar5k_write_ini(struct ath_hal *,
2297b59011f9Sreyk 			    const struct ar5k_ini *, size_t, HAL_BOOL);
2298b59011f9Sreyk void			 ar5k_write_mode(struct ath_hal *,
2299b59011f9Sreyk 			    const struct ar5k_mode *, size_t, u_int);
2300b59011f9Sreyk 
2301f51c4ae1Sreyk __END_DECLS
2302f51c4ae1Sreyk 
2303f51c4ae1Sreyk #endif /* _AR5K_H */
2304