1185377Ssam/*
2185377Ssam * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3185377Ssam * Copyright (c) 2002-2008 Atheros Communications, Inc.
4185377Ssam *
5185377Ssam * Permission to use, copy, modify, and/or distribute this software for any
6185377Ssam * purpose with or without fee is hereby granted, provided that the above
7185377Ssam * copyright notice and this permission notice appear in all copies.
8185377Ssam *
9185377Ssam * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10185377Ssam * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11185377Ssam * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12185377Ssam * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13185377Ssam * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14185377Ssam * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15185377Ssam * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16185377Ssam *
17192399Ssam * $FreeBSD$
18185377Ssam */
19185377Ssam#ifndef _DEV_ATH_AR5212REG_H_
20185377Ssam#define _DEV_ATH_AR5212REG_H_
21185377Ssam
22185377Ssam/*
23185377Ssam * Definitions for the Atheros 5212 chipset.
24185377Ssam */
25185377Ssam
26185377Ssam/* DMA Control and Interrupt Registers */
27185377Ssam#define	AR_CR		0x0008	/* MAC control register */
28185377Ssam#define	AR_RXDP		0x000C	/* MAC receive queue descriptor pointer */
29185377Ssam#define	AR_CFG		0x0014	/* MAC configuration and status register */
30185377Ssam#define	AR_IER		0x0024	/* MAC Interrupt enable register */
31185377Ssam/* 0x28 is RTSD0 on the 5211 */
32185377Ssam/* 0x2c is RTSD1 on the 5211 */
33185377Ssam#define	AR_TXCFG	0x0030	/* MAC tx DMA size config register */
34185377Ssam#define	AR_RXCFG	0x0034	/* MAC rx DMA size config register */
35185377Ssam/* 0x38 is the jumbo descriptor address on the 5211 */
36185377Ssam#define	AR_MIBC		0x0040	/* MAC MIB control register */
37185377Ssam#define	AR_TOPS		0x0044	/* MAC timeout prescale count */
38185377Ssam#define	AR_RXNPTO	0x0048	/* MAC no frame received timeout */
39185377Ssam#define	AR_TXNPTO	0x004C	/* MAC no frame trasmitted timeout */
40185377Ssam#define	AR_RPGTO	0x0050	/* MAC receive frame gap timeout */
41185377Ssam#define	AR_RPCNT	0x0054	/* MAC receive frame count limit */
42185377Ssam#define	AR_MACMISC	0x0058	/* MAC miscellaneous control/status register */
43185377Ssam#define	AR_SPC_0	0x005c	/* MAC sleep performance (awake cycles) */
44185377Ssam#define	AR_SPC_1	0x0060	/* MAC sleep performance (asleep cycles) */
45185377Ssam/* 0x5c is for QCU/DCU clock gating control on 5311 */
46185377Ssam#define	AR_ISR		0x0080	/* MAC Primary interrupt status register */
47185377Ssam#define	AR_ISR_S0	0x0084	/* MAC Secondary interrupt status register 0 */
48185377Ssam#define	AR_ISR_S1	0x0088	/* MAC Secondary interrupt status register 1 */
49185377Ssam#define	AR_ISR_S2	0x008c	/* MAC Secondary interrupt status register 2 */
50185377Ssam#define	AR_ISR_S3	0x0090	/* MAC Secondary interrupt status register 3 */
51185377Ssam#define	AR_ISR_S4	0x0094	/* MAC Secondary interrupt status register 4 */
52185377Ssam#define	AR_IMR		0x00a0	/* MAC Primary interrupt mask register */
53185377Ssam#define	AR_IMR_S0	0x00a4	/* MAC Secondary interrupt mask register 0 */
54185377Ssam#define	AR_IMR_S1	0x00a8	/* MAC Secondary interrupt mask register 1 */
55185377Ssam#define	AR_IMR_S2	0x00ac	/* MAC Secondary interrupt mask register 2 */
56185377Ssam#define	AR_IMR_S3	0x00b0	/* MAC Secondary interrupt mask register 3 */
57185377Ssam#define	AR_IMR_S4	0x00b4	/* MAC Secondary interrupt mask register 4 */
58185377Ssam#define	AR_ISR_RAC	0x00c0	/* ISR read-and-clear access */
59185377Ssam/* Shadow copies with read-and-clear access */
60185377Ssam#define	AR_ISR_S0_S	0x00c4	/* ISR_S0 shadow copy */
61185377Ssam#define	AR_ISR_S1_S	0x00c8	/* ISR_S1 shadow copy */
62185377Ssam#define	AR_ISR_S2_S	0x00cc	/* ISR_S2 shadow copy */
63185377Ssam#define	AR_ISR_S3_S	0x00d0	/* ISR_S3 shadow copy */
64185377Ssam#define	AR_ISR_S4_S	0x00d4	/* ISR_S4 shadow copy */
65185377Ssam#define	AR_DMADBG_0	0x00e0	/* DMA debug 0 */
66185377Ssam#define	AR_DMADBG_1	0x00e4	/* DMA debug 1 */
67185377Ssam#define	AR_DMADBG_2	0x00e8	/* DMA debug 2 */
68185377Ssam#define	AR_DMADBG_3	0x00ec	/* DMA debug 3 */
69185377Ssam#define	AR_DMADBG_4	0x00f0	/* DMA debug 4 */
70185377Ssam#define	AR_DMADBG_5	0x00f4	/* DMA debug 5 */
71185377Ssam#define	AR_DMADBG_6	0x00f8	/* DMA debug 6 */
72185377Ssam#define	AR_DMADBG_7	0x00fc	/* DMA debug 7 */
73185377Ssam#define	AR_DCM_A	0x0400	/* Decompression mask address */
74185377Ssam#define	AR_DCM_D	0x0404	/* Decompression mask data */
75185377Ssam#define	AR_DCCFG	0x0420	/* Decompression configuration */
76185377Ssam#define	AR_CCFG		0x0600	/* Compression configuration */
77185377Ssam#define	AR_CCUCFG	0x0604	/* Compression catchup configuration */
78185377Ssam#define	AR_CPC_0	0x0610	/* Compression performance counter 0 */
79185377Ssam#define	AR_CPC_1	0x0614	/* Compression performance counter 1 */
80185377Ssam#define	AR_CPC_2	0x0618	/* Compression performance counter 2 */
81185377Ssam#define	AR_CPC_3	0x061c	/* Compression performance counter 3 */
82185377Ssam#define	AR_CPCOVF	0x0620	/* Compression performance overflow status */
83185377Ssam
84185377Ssam#define	AR_Q0_TXDP	0x0800	/* MAC Transmit Queue descriptor pointer */
85185377Ssam#define	AR_Q1_TXDP	0x0804	/* MAC Transmit Queue descriptor pointer */
86185377Ssam#define	AR_Q2_TXDP	0x0808	/* MAC Transmit Queue descriptor pointer */
87185377Ssam#define	AR_Q3_TXDP	0x080c	/* MAC Transmit Queue descriptor pointer */
88185377Ssam#define	AR_Q4_TXDP	0x0810	/* MAC Transmit Queue descriptor pointer */
89185377Ssam#define	AR_Q5_TXDP	0x0814	/* MAC Transmit Queue descriptor pointer */
90185377Ssam#define	AR_Q6_TXDP	0x0818	/* MAC Transmit Queue descriptor pointer */
91185377Ssam#define	AR_Q7_TXDP	0x081c	/* MAC Transmit Queue descriptor pointer */
92185377Ssam#define	AR_Q8_TXDP	0x0820	/* MAC Transmit Queue descriptor pointer */
93185377Ssam#define	AR_Q9_TXDP	0x0824	/* MAC Transmit Queue descriptor pointer */
94185377Ssam#define	AR_QTXDP(_i)	(AR_Q0_TXDP + ((_i)<<2))
95185377Ssam
96185377Ssam#define	AR_Q_TXE	0x0840	/* MAC Transmit Queue enable */
97226489Sadrian#define	AR_Q_TXE_M	0x000003FF	/* Mask for TXE (QCU 0-9) */
98185377Ssam#define	AR_Q_TXD	0x0880	/* MAC Transmit Queue disable */
99226489Sadrian#define	AR_Q_TXD_M	0x000003FF	/* Mask for TXD (QCU 0-9) */
100185377Ssam
101185377Ssam#define	AR_Q0_CBRCFG	0x08c0	/* MAC CBR configuration */
102185377Ssam#define	AR_Q1_CBRCFG	0x08c4	/* MAC CBR configuration */
103185377Ssam#define	AR_Q2_CBRCFG	0x08c8	/* MAC CBR configuration */
104185377Ssam#define	AR_Q3_CBRCFG	0x08cc	/* MAC CBR configuration */
105185377Ssam#define	AR_Q4_CBRCFG	0x08d0	/* MAC CBR configuration */
106185377Ssam#define	AR_Q5_CBRCFG	0x08d4	/* MAC CBR configuration */
107185377Ssam#define	AR_Q6_CBRCFG	0x08d8	/* MAC CBR configuration */
108185377Ssam#define	AR_Q7_CBRCFG	0x08dc	/* MAC CBR configuration */
109185377Ssam#define	AR_Q8_CBRCFG	0x08e0	/* MAC CBR configuration */
110185377Ssam#define	AR_Q9_CBRCFG	0x08e4	/* MAC CBR configuration */
111185377Ssam#define	AR_QCBRCFG(_i)	(AR_Q0_CBRCFG + ((_i)<<2))
112185377Ssam
113185377Ssam#define	AR_Q0_RDYTIMECFG	0x0900	/* MAC ReadyTime configuration */
114185377Ssam#define	AR_Q1_RDYTIMECFG	0x0904	/* MAC ReadyTime configuration */
115185377Ssam#define	AR_Q2_RDYTIMECFG	0x0908	/* MAC ReadyTime configuration */
116185377Ssam#define	AR_Q3_RDYTIMECFG	0x090c	/* MAC ReadyTime configuration */
117185377Ssam#define	AR_Q4_RDYTIMECFG	0x0910	/* MAC ReadyTime configuration */
118185377Ssam#define	AR_Q5_RDYTIMECFG	0x0914	/* MAC ReadyTime configuration */
119185377Ssam#define	AR_Q6_RDYTIMECFG	0x0918	/* MAC ReadyTime configuration */
120185377Ssam#define	AR_Q7_RDYTIMECFG	0x091c	/* MAC ReadyTime configuration */
121185377Ssam#define	AR_Q8_RDYTIMECFG	0x0920	/* MAC ReadyTime configuration */
122185377Ssam#define	AR_Q9_RDYTIMECFG	0x0924	/* MAC ReadyTime configuration */
123185377Ssam#define	AR_QRDYTIMECFG(_i)	(AR_Q0_RDYTIMECFG + ((_i)<<2))
124185377Ssam
125185377Ssam#define	AR_Q_ONESHOTARM_SC	0x0940	/* MAC OneShotArm set control */
126185377Ssam#define	AR_Q_ONESHOTARM_CC	0x0980	/* MAC OneShotArm clear control */
127185377Ssam
128185377Ssam#define	AR_Q0_MISC	0x09c0	/* MAC Miscellaneous QCU settings */
129185377Ssam#define	AR_Q1_MISC	0x09c4	/* MAC Miscellaneous QCU settings */
130185377Ssam#define	AR_Q2_MISC	0x09c8	/* MAC Miscellaneous QCU settings */
131185377Ssam#define	AR_Q3_MISC	0x09cc	/* MAC Miscellaneous QCU settings */
132185377Ssam#define	AR_Q4_MISC	0x09d0	/* MAC Miscellaneous QCU settings */
133185377Ssam#define	AR_Q5_MISC	0x09d4	/* MAC Miscellaneous QCU settings */
134185377Ssam#define	AR_Q6_MISC	0x09d8	/* MAC Miscellaneous QCU settings */
135185377Ssam#define	AR_Q7_MISC	0x09dc	/* MAC Miscellaneous QCU settings */
136185377Ssam#define	AR_Q8_MISC	0x09e0	/* MAC Miscellaneous QCU settings */
137185377Ssam#define	AR_Q9_MISC	0x09e4	/* MAC Miscellaneous QCU settings */
138185377Ssam#define	AR_QMISC(_i)	(AR_Q0_MISC + ((_i)<<2))
139185377Ssam
140185377Ssam#define	AR_Q0_STS	0x0a00	/* MAC Miscellaneous QCU status */
141185377Ssam#define	AR_Q1_STS	0x0a04	/* MAC Miscellaneous QCU status */
142185377Ssam#define	AR_Q2_STS	0x0a08	/* MAC Miscellaneous QCU status */
143185377Ssam#define	AR_Q3_STS	0x0a0c	/* MAC Miscellaneous QCU status */
144185377Ssam#define	AR_Q4_STS	0x0a10	/* MAC Miscellaneous QCU status */
145185377Ssam#define	AR_Q5_STS	0x0a14	/* MAC Miscellaneous QCU status */
146185377Ssam#define	AR_Q6_STS	0x0a18	/* MAC Miscellaneous QCU status */
147185377Ssam#define	AR_Q7_STS	0x0a1c	/* MAC Miscellaneous QCU status */
148185377Ssam#define	AR_Q8_STS	0x0a20	/* MAC Miscellaneous QCU status */
149185377Ssam#define	AR_Q9_STS	0x0a24	/* MAC Miscellaneous QCU status */
150185377Ssam#define	AR_QSTS(_i)	(AR_Q0_STS + ((_i)<<2))
151185377Ssam
152185377Ssam#define	AR_Q_RDYTIMESHDN	0x0a40	/* MAC ReadyTimeShutdown status */
153185377Ssam#define	AR_Q_CBBS	0xb00	/* Compression buffer base select */
154185377Ssam#define	AR_Q_CBBA	0xb04	/* Compression buffer base access */
155185377Ssam#define	AR_Q_CBC	0xb08	/* Compression buffer configuration */
156185377Ssam
157185377Ssam#define	AR_D0_QCUMASK	0x1000	/* MAC QCU Mask */
158185377Ssam#define	AR_D1_QCUMASK	0x1004	/* MAC QCU Mask */
159185377Ssam#define	AR_D2_QCUMASK	0x1008	/* MAC QCU Mask */
160185377Ssam#define	AR_D3_QCUMASK	0x100c	/* MAC QCU Mask */
161185377Ssam#define	AR_D4_QCUMASK	0x1010	/* MAC QCU Mask */
162185377Ssam#define	AR_D5_QCUMASK	0x1014	/* MAC QCU Mask */
163185377Ssam#define	AR_D6_QCUMASK	0x1018	/* MAC QCU Mask */
164185377Ssam#define	AR_D7_QCUMASK	0x101c	/* MAC QCU Mask */
165185377Ssam#define	AR_D8_QCUMASK	0x1020	/* MAC QCU Mask */
166185377Ssam#define	AR_D9_QCUMASK	0x1024	/* MAC QCU Mask */
167185377Ssam#define	AR_DQCUMASK(_i)	(AR_D0_QCUMASK + ((_i)<<2))
168185377Ssam
169185377Ssam#define	AR_D0_LCL_IFS	0x1040	/* MAC DCU-specific IFS settings */
170185377Ssam#define	AR_D1_LCL_IFS	0x1044	/* MAC DCU-specific IFS settings */
171185377Ssam#define	AR_D2_LCL_IFS	0x1048	/* MAC DCU-specific IFS settings */
172185377Ssam#define	AR_D3_LCL_IFS	0x104c	/* MAC DCU-specific IFS settings */
173185377Ssam#define	AR_D4_LCL_IFS	0x1050	/* MAC DCU-specific IFS settings */
174185377Ssam#define	AR_D5_LCL_IFS	0x1054	/* MAC DCU-specific IFS settings */
175185377Ssam#define	AR_D6_LCL_IFS	0x1058	/* MAC DCU-specific IFS settings */
176185377Ssam#define	AR_D7_LCL_IFS	0x105c	/* MAC DCU-specific IFS settings */
177185377Ssam#define	AR_D8_LCL_IFS	0x1060	/* MAC DCU-specific IFS settings */
178185377Ssam#define	AR_D9_LCL_IFS	0x1064	/* MAC DCU-specific IFS settings */
179185377Ssam#define	AR_DLCL_IFS(_i)	(AR_D0_LCL_IFS + ((_i)<<2))
180185377Ssam
181185377Ssam#define	AR_D0_RETRY_LIMIT	0x1080	/* MAC Retry limits */
182185377Ssam#define	AR_D1_RETRY_LIMIT	0x1084	/* MAC Retry limits */
183185377Ssam#define	AR_D2_RETRY_LIMIT	0x1088	/* MAC Retry limits */
184185377Ssam#define	AR_D3_RETRY_LIMIT	0x108c	/* MAC Retry limits */
185185377Ssam#define	AR_D4_RETRY_LIMIT	0x1090	/* MAC Retry limits */
186185377Ssam#define	AR_D5_RETRY_LIMIT	0x1094	/* MAC Retry limits */
187185377Ssam#define	AR_D6_RETRY_LIMIT	0x1098	/* MAC Retry limits */
188185377Ssam#define	AR_D7_RETRY_LIMIT	0x109c	/* MAC Retry limits */
189185377Ssam#define	AR_D8_RETRY_LIMIT	0x10a0	/* MAC Retry limits */
190185377Ssam#define	AR_D9_RETRY_LIMIT	0x10a4	/* MAC Retry limits */
191185377Ssam#define	AR_DRETRY_LIMIT(_i)	(AR_D0_RETRY_LIMIT + ((_i)<<2))
192185377Ssam
193185377Ssam#define	AR_D0_CHNTIME	0x10c0	/* MAC ChannelTime settings */
194185377Ssam#define	AR_D1_CHNTIME	0x10c4	/* MAC ChannelTime settings */
195185377Ssam#define	AR_D2_CHNTIME	0x10c8	/* MAC ChannelTime settings */
196185377Ssam#define	AR_D3_CHNTIME	0x10cc	/* MAC ChannelTime settings */
197185377Ssam#define	AR_D4_CHNTIME	0x10d0	/* MAC ChannelTime settings */
198185377Ssam#define	AR_D5_CHNTIME	0x10d4	/* MAC ChannelTime settings */
199185377Ssam#define	AR_D6_CHNTIME	0x10d8	/* MAC ChannelTime settings */
200185377Ssam#define	AR_D7_CHNTIME	0x10dc	/* MAC ChannelTime settings */
201185377Ssam#define	AR_D8_CHNTIME	0x10e0	/* MAC ChannelTime settings */
202185377Ssam#define	AR_D9_CHNTIME	0x10e4	/* MAC ChannelTime settings */
203185377Ssam#define	AR_DCHNTIME(_i)	(AR_D0_CHNTIME + ((_i)<<2))
204185377Ssam
205185377Ssam#define	AR_D0_MISC	0x1100	/* MAC Miscellaneous DCU-specific settings */
206185377Ssam#define	AR_D1_MISC	0x1104	/* MAC Miscellaneous DCU-specific settings */
207185377Ssam#define	AR_D2_MISC	0x1108	/* MAC Miscellaneous DCU-specific settings */
208185377Ssam#define	AR_D3_MISC	0x110c	/* MAC Miscellaneous DCU-specific settings */
209185377Ssam#define	AR_D4_MISC	0x1110	/* MAC Miscellaneous DCU-specific settings */
210185377Ssam#define	AR_D5_MISC	0x1114	/* MAC Miscellaneous DCU-specific settings */
211185377Ssam#define	AR_D6_MISC	0x1118	/* MAC Miscellaneous DCU-specific settings */
212185377Ssam#define	AR_D7_MISC	0x111c	/* MAC Miscellaneous DCU-specific settings */
213185377Ssam#define	AR_D8_MISC	0x1120	/* MAC Miscellaneous DCU-specific settings */
214185377Ssam#define	AR_D9_MISC	0x1124	/* MAC Miscellaneous DCU-specific settings */
215185377Ssam#define	AR_DMISC(_i)	(AR_D0_MISC + ((_i)<<2))
216185377Ssam
217185377Ssam#define	AR_D_SEQNUM	0x1140	/* MAC Frame sequence number */
218185377Ssam
219185377Ssam/* MAC DCU-global IFS settings */
220185377Ssam#define	AR_D_GBL_IFS_SIFS	0x1030	/* DCU global SIFS settings */
221185377Ssam#define	AR_D_GBL_IFS_SLOT	0x1070	/* DC global slot interval */
222185377Ssam#define	AR_D_GBL_IFS_EIFS	0x10b0	/* DCU global EIFS setting */
223185377Ssam#define	AR_D_GBL_IFS_MISC	0x10f0	/* DCU global misc. IFS settings */
224185377Ssam#define	AR_D_FPCTL	0x1230		/* DCU frame prefetch settings */
225185377Ssam#define	AR_D_TXPSE	0x1270		/* DCU transmit pause control/status */
226185377Ssam#define	AR_D_TXBLK_CMD	0x1038		/* DCU transmit filter cmd (w/only) */
227185377Ssam#define	AR_D_TXBLK_DATA(i) (AR_D_TXBLK_CMD+(i))	/* DCU transmit filter data */
228185377Ssam#define	AR_D_TXBLK_CLR	0x143c		/* DCU clear tx filter (w/only) */
229185377Ssam#define	AR_D_TXBLK_SET	0x147c		/* DCU set tx filter (w/only) */
230185377Ssam
231185377Ssam#define	AR_RC		0x4000	/* Warm reset control register */
232185377Ssam#define	AR_SCR		0x4004	/* Sleep control register */
233185377Ssam#define	AR_INTPEND	0x4008	/* Interrupt Pending register */
234185377Ssam#define	AR_SFR		0x400C	/* Sleep force register */
235185377Ssam#define	AR_PCICFG	0x4010	/* PCI configuration register */
236185377Ssam#define	AR_GPIOCR	0x4014	/* GPIO control register */
237185377Ssam#define	AR_GPIODO	0x4018	/* GPIO data output access register */
238185377Ssam#define	AR_GPIODI	0x401C	/* GPIO data input access register */
239185377Ssam#define	AR_SREV		0x4020	/* Silicon Revision register */
240185377Ssam#define	AR_TXEPOST	0x4028	/* TXE write posting resgister */
241185377Ssam#define	AR_QSM		0x402C	/* QCU sleep mask */
242185377Ssam
243185377Ssam#define	AR_PCIE_PMC	0x4068	/* PCIe power mgt config and status register */
244185377Ssam#define AR_PCIE_SERDES	0x4080  /* PCIe Serdes register */
245185377Ssam#define AR_PCIE_SERDES2	0x4084  /* PCIe Serdes register */
246185377Ssam
247185377Ssam#define	AR_EEPROM_ADDR	0x6000	/* EEPROM address register (10 bit) */
248185377Ssam#define	AR_EEPROM_DATA	0x6004	/* EEPROM data register (16 bit) */
249185377Ssam#define	AR_EEPROM_CMD	0x6008	/* EEPROM command register */
250185377Ssam#define	AR_EEPROM_STS	0x600c	/* EEPROM status register */
251185377Ssam#define	AR_EEPROM_CFG	0x6010	/* EEPROM configuration register */
252185377Ssam
253185377Ssam#define	AR_STA_ID0	0x8000	/* MAC station ID0 register - low 32 bits */
254185377Ssam#define	AR_STA_ID1	0x8004	/* MAC station ID1 register - upper 16 bits */
255185377Ssam#define	AR_BSS_ID0	0x8008	/* MAC BSSID low 32 bits */
256185377Ssam#define	AR_BSS_ID1	0x800C	/* MAC BSSID upper 16 bits / AID */
257185377Ssam#define	AR_SLOT_TIME	0x8010	/* MAC Time-out after a collision */
258185377Ssam#define	AR_TIME_OUT	0x8014	/* MAC ACK & CTS time-out */
259185377Ssam#define	AR_RSSI_THR	0x8018	/* MAC RSSI warning & missed beacon threshold */
260185377Ssam#define	AR_USEC		0x801c	/* MAC transmit latency register */
261185377Ssam#define	AR_BEACON	0x8020	/* MAC beacon control value/mode bits */
262185377Ssam#define	AR_CFP_PERIOD	0x8024	/* MAC CFP Interval (TU/msec) */
263185377Ssam#define	AR_TIMER0	0x8028	/* MAC Next beacon time (TU/msec) */
264185377Ssam#define	AR_TIMER1	0x802c	/* MAC DMA beacon alert time (1/8 TU) */
265185377Ssam#define	AR_TIMER2	0x8030	/* MAC Software beacon alert (1/8 TU) */
266185377Ssam#define	AR_TIMER3	0x8034	/* MAC ATIM window time */
267185377Ssam#define	AR_CFP_DUR	0x8038	/* MAC maximum CFP duration in TU */
268185377Ssam#define	AR_RX_FILTER	0x803C	/* MAC receive filter register */
269185377Ssam#define	AR_MCAST_FIL0	0x8040	/* MAC multicast filter lower 32 bits */
270185377Ssam#define	AR_MCAST_FIL1	0x8044	/* MAC multicast filter upper 32 bits */
271185377Ssam#define	AR_DIAG_SW	0x8048	/* MAC PCU control register */
272185377Ssam#define	AR_TSF_L32	0x804c	/* MAC local clock lower 32 bits */
273185377Ssam#define	AR_TSF_U32	0x8050	/* MAC local clock upper 32 bits */
274185377Ssam#define	AR_TST_ADDAC	0x8054	/* ADDAC test register */
275185377Ssam#define	AR_DEF_ANTENNA	0x8058	/* default antenna register */
276185377Ssam#define	AR_QOS_MASK	0x805c	/* MAC AES mute mask: QoS field */
277185377Ssam#define	AR_SEQ_MASK	0x8060	/* MAC AES mute mask: seqnum field */
278185377Ssam#define	AR_OBSERV_2	0x8068	/* Observation bus 2 */
279185377Ssam#define	AR_OBSERV_1	0x806c	/* Observation bus 1 */
280185377Ssam
281185377Ssam#define	AR_LAST_TSTP	0x8080	/* MAC Time stamp of the last beacon received */
282185377Ssam#define	AR_NAV		0x8084	/* MAC current NAV value */
283185377Ssam#define	AR_RTS_OK	0x8088	/* MAC RTS exchange success counter */
284185377Ssam#define	AR_RTS_FAIL	0x808c	/* MAC RTS exchange failure counter */
285185377Ssam#define	AR_ACK_FAIL	0x8090	/* MAC ACK failure counter */
286185377Ssam#define	AR_FCS_FAIL	0x8094	/* FCS check failure counter */
287185377Ssam#define	AR_BEACON_CNT	0x8098	/* Valid beacon counter */
288185377Ssam
289185377Ssam#define	AR_SLEEP1	0x80d4	/* Enhanced sleep control 1 */
290185377Ssam#define	AR_SLEEP2	0x80d8	/* Enhanced sleep control 2 */
291185377Ssam#define	AR_SLEEP3	0x80dc	/* Enhanced sleep control 3 */
292185377Ssam#define	AR_BSSMSKL	0x80e0	/* BSSID mask lower 32 bits */
293185377Ssam#define	AR_BSSMSKU	0x80e4	/* BSSID mask upper 16 bits */
294185377Ssam#define	AR_TPC		0x80e8	/* Transmit power control for self gen frames */
295185377Ssam#define	AR_TFCNT	0x80ec	/* Profile count, transmit frames */
296185377Ssam#define	AR_RFCNT	0x80f0	/* Profile count, receive frames */
297185377Ssam#define	AR_RCCNT	0x80f4	/* Profile count, receive clear */
298185377Ssam#define	AR_CCCNT	0x80f8	/* Profile count, cycle counter */
299185377Ssam
300185377Ssam#define AR_QUIET1   0x80fc  /* Quiet time programming for TGh */
301185377Ssam#define AR_QUIET1_NEXT_QUIET_S  0   /* TSF of next quiet period (TU) */
302185377Ssam#define AR_QUIET1_NEXT_QUIET    0xffff
303185377Ssam#define AR_QUIET1_QUIET_ENABLE  0x10000 /* Enable Quiet time operation */
304185377Ssam#define AR_QUIET1_QUIET_ACK_CTS_ENABLE  0x20000 /* Do we ack/cts during quiet period */
305222644Sadrian#define	AR_QUIET1_QUIET_ACK_CTS_ENABLE_S 17
306185377Ssam
307185377Ssam#define AR_QUIET2   0x8100  /* More Quiet time programming */
308185377Ssam#define AR_QUIET2_QUIET_PER_S   0   /* Periodicity of quiet period (TU) */
309185377Ssam#define AR_QUIET2_QUIET_PER 0xffff
310185377Ssam#define AR_QUIET2_QUIET_DUR_S   16  /* Duration of quiet period (TU) */
311185377Ssam#define AR_QUIET2_QUIET_DUR 0xffff0000
312185377Ssam
313185377Ssam#define	AR_TSF_PARM	0x8104	/* TSF parameters */
314185377Ssam#define AR_NOACK        0x8108  /* No ack policy in QoS Control Field */
315185377Ssam#define	AR_PHY_ERR	0x810c	/* Phy error filter */
316185377Ssam
317185377Ssam#define	AR_QOS_CONTROL	0x8118	/* Control TKIP MIC for QoS */
318185377Ssam#define	AR_QOS_SELECT	0x811c	/* MIC QoS select */
319185377Ssam#define	AR_MISC_MODE	0x8120	/* PCU Misc. mode control */
320185377Ssam
321185377Ssam/* Hainan MIB counter registers */
322185377Ssam#define	AR_FILTOFDM	0x8124	/* Count of filtered OFDM frames */
323185377Ssam#define	AR_FILTCCK	0x8128	/* Count of filtered CCK frames */
324185377Ssam#define	AR_PHYCNT1	0x812c	/* Phy Error 1 counter */
325185377Ssam#define	AR_PHYCNTMASK1	0x8130	/* Phy Error 1 counter mask */
326185377Ssam#define	AR_PHYCNT2	0x8134	/* Phy Error 2 counter */
327185377Ssam#define	AR_PHYCNTMASK2	0x8138	/* Phy Error 2 counter mask */
328185377Ssam#define	AR_PHY_COUNTMAX	(3 << 22)	/* Max value in counter before intr */
329185377Ssam#define	AR_MIBCNT_INTRMASK (3<<22)	/* Mask for top two bits of counters */
330185377Ssam
331185377Ssam#define	AR_RATE_DURATION_0	0x8700		/* base of multi-rate retry */
332185377Ssam#define	AR_RATE_DURATION(_n)	(AR_RATE_DURATION_0 + ((_n)<<2))
333185377Ssam
334185377Ssam#define	AR_KEYTABLE_0	0x8800	/* MAC Key Cache */
335185377Ssam#define	AR_KEYTABLE(_n)	(AR_KEYTABLE_0 + ((_n)*32))
336185377Ssam
337185377Ssam#define	AR_CFP_MASK	0x0000ffff /* Mask for next beacon time */
338185377Ssam
339185377Ssam#define	AR_CR_RXE	0x00000004 /* Receive enable */
340185377Ssam#define	AR_CR_RXD	0x00000020 /* Receive disable */
341185377Ssam#define	AR_CR_SWI	0x00000040 /* One-shot software interrupt */
342185377Ssam
343185377Ssam#define	AR_CFG_SWTD	0x00000001 /* byteswap tx descriptor words */
344185377Ssam#define	AR_CFG_SWTB	0x00000002 /* byteswap tx data buffer words */
345185377Ssam#define	AR_CFG_SWRD	0x00000004 /* byteswap rx descriptor words */
346185377Ssam#define	AR_CFG_SWRB	0x00000008 /* byteswap rx data buffer words */
347185377Ssam#define	AR_CFG_SWRG	0x00000010 /* byteswap register access data words */
348185377Ssam#define	AR_CFG_AP_ADHOC_INDICATION	0x00000020 /* AP/adhoc indication (0-AP, 1-Adhoc) */
349185377Ssam#define	AR_CFG_PHOK	0x00000100 /* PHY OK status */
350185377Ssam#define	AR_CFG_EEBS	0x00000200 /* EEPROM busy */
351185377Ssam#define	AR_5211_CFG_CLK_GATE_DIS	0x00000400 /* Clock gating disable (Oahu only) */
352185377Ssam#define	AR_CFG_PCI_MASTER_REQ_Q_THRESH	0x00060000 /* Mask of PCI core master request queue full threshold */
353185377Ssam#define	AR_CFG_PCI_MASTER_REQ_Q_THRESH_S	17         /* Shift for PCI core master request queue full threshold */
354185377Ssam
355185377Ssam#define	AR_IER_ENABLE	0x00000001 /* Global interrupt enable */
356185377Ssam#define	AR_IER_DISABLE	0x00000000 /* Global interrupt disable */
357185377Ssam
358185377Ssam#define	AR_DMASIZE_4B	0x00000000 /* DMA size 4 bytes (TXCFG + RXCFG) */
359185377Ssam#define	AR_DMASIZE_8B	0x00000001 /* DMA size 8 bytes */
360185377Ssam#define	AR_DMASIZE_16B	0x00000002 /* DMA size 16 bytes */
361185377Ssam#define	AR_DMASIZE_32B	0x00000003 /* DMA size 32 bytes */
362185377Ssam#define	AR_DMASIZE_64B	0x00000004 /* DMA size 64 bytes */
363185377Ssam#define	AR_DMASIZE_128B	0x00000005 /* DMA size 128 bytes */
364185377Ssam#define	AR_DMASIZE_256B	0x00000006 /* DMA size 256 bytes */
365185377Ssam#define	AR_DMASIZE_512B	0x00000007 /* DMA size 512 bytes */
366185377Ssam
367185377Ssam#define	AR_FTRIG	0x000003F0 /* Mask for Frame trigger level */
368185377Ssam#define	AR_FTRIG_S	4          /* Shift for Frame trigger level */
369185377Ssam#define	AR_FTRIG_IMMED	0x00000000 /* bytes in PCU TX FIFO before air */
370185377Ssam#define	AR_FTRIG_64B	0x00000010 /* default */
371185377Ssam#define	AR_FTRIG_128B	0x00000020
372185377Ssam#define	AR_FTRIG_192B	0x00000030
373185377Ssam#define	AR_FTRIG_256B	0x00000040 /* 5 bits total */
374185377Ssam
375185377Ssam#define	AR_RXCFG_ZLFDMA	0x00000010 /* Enable DMA of zero-length frame */
376185377Ssam
377185377Ssam#define	AR_MIBC_COW	0x00000001 /* counter overflow warning */
378185377Ssam#define	AR_MIBC_FMC	0x00000002 /* freeze MIB counters */
379185377Ssam#define	AR_MIBC_CMC	0x00000004 /* clear MIB counters */
380185377Ssam#define	AR_MIBC_MCS	0x00000008 /* MIB counter strobe, increment all */
381185377Ssam
382185377Ssam#define	AR_TOPS_MASK	0x0000FFFF /* Mask for timeout prescale */
383185377Ssam
384185377Ssam#define	AR_RXNPTO_MASK	0x000003FF /* Mask for no frame received timeout */
385185377Ssam
386185377Ssam#define	AR_TXNPTO_MASK	0x000003FF /* Mask for no frame transmitted timeout */
387185377Ssam#define	AR_TXNPTO_QCU_MASK	0x000FFC00 /* Mask indicating the set of QCUs */
388185377Ssam				 /* for which frame completions will cause */
389185377Ssam				 /* a reset of the no frame xmit'd timeout */
390185377Ssam
391185377Ssam#define	AR_RPGTO_MASK	0x000003FF /* Mask for receive frame gap timeout */
392185377Ssam
393185377Ssam#define	AR_RPCNT_MASK	0x0000001F /* Mask for receive frame count limit */
394185377Ssam
395185377Ssam#define	AR_MACMISC_DMA_OBS	0x000001E0 /* Mask for DMA observation bus mux select */
396185377Ssam#define	AR_MACMISC_DMA_OBS_S	5          /* Shift for DMA observation bus mux select */
397185377Ssam#define	AR_MACMISC_MISC_OBS	0x00000E00 /* Mask for MISC observation bus mux select */
398185377Ssam#define	AR_MACMISC_MISC_OBS_S	9          /* Shift for MISC observation bus mux select */
399185377Ssam#define	AR_MACMISC_MAC_OBS_BUS_LSB	0x00007000 /* Mask for MAC observation bus mux select (lsb) */
400185377Ssam#define	AR_MACMISC_MAC_OBS_BUS_LSB_S	12         /* Shift for MAC observation bus mux select (lsb) */
401185377Ssam#define	AR_MACMISC_MAC_OBS_BUS_MSB	0x00038000 /* Mask for MAC observation bus mux select (msb) */
402185377Ssam#define	AR_MACMISC_MAC_OBS_BUS_MSB_S	15         /* Shift for MAC observation bus mux select (msb) */
403185377Ssam
404185377Ssam/*
405185377Ssam * Interrupt Status Registers
406185377Ssam *
407185377Ssam * Only the bits in the ISR_P register and the IMR_P registers
408185377Ssam * control whether the MAC's INTA# output is asserted.  The bits in
409185377Ssam * the secondary interrupt status/mask registers control what bits
410185377Ssam * are set in the primary interrupt status register; however the
411185377Ssam * IMR_S* registers DO NOT determine whether INTA# is asserted.
412185377Ssam * That is INTA# is asserted only when the logical AND of ISR_P
413185377Ssam * and IMR_P is non-zero.  The secondary interrupt mask/status
414185377Ssam * registers affect what bits are set in ISR_P but they do not
415185377Ssam * directly affect whether INTA# is asserted.
416185377Ssam */
417185377Ssam#define	AR_ISR_RXOK	0x00000001 /* At least one frame received sans errors */
418185377Ssam#define	AR_ISR_RXDESC	0x00000002 /* Receive interrupt request */
419185377Ssam#define	AR_ISR_RXERR	0x00000004 /* Receive error interrupt */
420185377Ssam#define	AR_ISR_RXNOPKT	0x00000008 /* No frame received within timeout clock */
421185377Ssam#define	AR_ISR_RXEOL	0x00000010 /* Received descriptor empty interrupt */
422185377Ssam#define	AR_ISR_RXORN	0x00000020 /* Receive FIFO overrun interrupt */
423185377Ssam#define	AR_ISR_TXOK	0x00000040 /* Transmit okay interrupt */
424185377Ssam#define	AR_ISR_TXDESC	0x00000080 /* Transmit interrupt request */
425185377Ssam#define	AR_ISR_TXERR	0x00000100 /* Transmit error interrupt */
426185377Ssam#define	AR_ISR_TXNOPKT	0x00000200 /* No frame transmitted interrupt */
427185377Ssam#define	AR_ISR_TXEOL	0x00000400 /* Transmit descriptor empty interrupt */
428185377Ssam#define	AR_ISR_TXURN	0x00000800 /* Transmit FIFO underrun interrupt */
429185377Ssam#define	AR_ISR_MIB	0x00001000 /* MIB interrupt - see MIBC */
430185377Ssam#define	AR_ISR_SWI	0x00002000 /* Software interrupt */
431185377Ssam#define	AR_ISR_RXPHY	0x00004000 /* PHY receive error interrupt */
432185377Ssam#define	AR_ISR_RXKCM	0x00008000 /* Key-cache miss interrupt */
433185377Ssam#define	AR_ISR_SWBA	0x00010000 /* Software beacon alert interrupt */
434185377Ssam#define	AR_ISR_BRSSI	0x00020000 /* Beacon threshold interrupt */
435185377Ssam#define	AR_ISR_BMISS	0x00040000 /* Beacon missed interrupt */
436185377Ssam#define	AR_ISR_HIUERR	0x00080000 /* An unexpected bus error has occurred */
437185377Ssam#define	AR_ISR_BNR	0x00100000 /* Beacon not ready interrupt */
438185377Ssam#define	AR_ISR_RXCHIRP	0x00200000 /* Phy received a 'chirp' */
439185377Ssam#define	AR_ISR_RXDOPPL	0x00400000 /* Phy received a 'doppler chirp' */
440185377Ssam#define	AR_ISR_BCNMISC	0x00800000 /* 'or' of TIM, CABEND, DTIMSYNC, BCNTO,
441185377Ssam				      CABTO, DTIM bits from ISR_S2 */
442185377Ssam#define	AR_ISR_TIM	0x00800000 /* TIM interrupt */
443185377Ssam#define	AR_ISR_GPIO	0x01000000 /* GPIO Interrupt */
444185377Ssam#define	AR_ISR_QCBROVF	0x02000000 /* QCU CBR overflow interrupt */
445185377Ssam#define	AR_ISR_QCBRURN	0x04000000 /* QCU CBR underrun interrupt */
446185377Ssam#define	AR_ISR_QTRIG	0x08000000 /* QCU scheduling trigger interrupt */
447185377Ssam#define	AR_ISR_RESV0	0xF0000000 /* Reserved */
448185377Ssam
449185377Ssam#define	AR_ISR_S0_QCU_TXOK	0x000003FF /* Mask for TXOK (QCU 0-9) */
450185377Ssam#define AR_ISR_S0_QCU_TXOK_S	0
451185377Ssam#define	AR_ISR_S0_QCU_TXDESC	0x03FF0000 /* Mask for TXDESC (QCU 0-9) */
452185377Ssam#define AR_ISR_S0_QCU_TXDESC_S	16
453185377Ssam
454185377Ssam#define	AR_ISR_S1_QCU_TXERR	0x000003FF /* Mask for TXERR (QCU 0-9) */
455185377Ssam#define AR_ISR_S1_QCU_TXERR_S	0
456185377Ssam#define	AR_ISR_S1_QCU_TXEOL	0x03FF0000 /* Mask for TXEOL (QCU 0-9) */
457185377Ssam#define AR_ISR_S1_QCU_TXEOL_S	16
458185377Ssam
459185377Ssam#define	AR_ISR_S2_QCU_TXURN	0x000003FF /* Mask for TXURN (QCU 0-9) */
460185377Ssam#define	AR_ISR_S2_MCABT		0x00010000 /* Master cycle abort interrupt */
461185377Ssam#define	AR_ISR_S2_SSERR		0x00020000 /* SERR interrupt */
462185377Ssam#define	AR_ISR_S2_DPERR		0x00040000 /* PCI bus parity error */
463185377Ssam#define	AR_ISR_S2_TIM		0x01000000 /* TIM */
464185377Ssam#define	AR_ISR_S2_CABEND	0x02000000 /* CABEND */
465185377Ssam#define	AR_ISR_S2_DTIMSYNC	0x04000000 /* DTIMSYNC */
466185377Ssam#define	AR_ISR_S2_BCNTO		0x08000000 /* BCNTO */
467185377Ssam#define	AR_ISR_S2_CABTO		0x10000000 /* CABTO */
468185377Ssam#define	AR_ISR_S2_DTIM		0x20000000 /* DTIM */
469192400Ssam#define	AR_ISR_S2_TSFOOR	0x40000000 /* TSF OOR */
470192400Ssam#define	AR_ISR_S2_TBTT		0x80000000 /* TBTT timer */
471185377Ssam
472185377Ssam#define	AR_ISR_S3_QCU_QCBROVF	0x000003FF /* Mask for QCBROVF (QCU 0-9) */
473185377Ssam#define	AR_ISR_S3_QCU_QCBRURN	0x03FF0000 /* Mask for QCBRURN (QCU 0-9) */
474185377Ssam
475185377Ssam#define	AR_ISR_S4_QCU_QTRIG	0x000003FF /* Mask for QTRIG (QCU 0-9) */
476185377Ssam#define	AR_ISR_S4_RESV0		0xFFFFFC00 /* Reserved */
477185377Ssam
478185377Ssam/*
479185377Ssam * Interrupt Mask Registers
480185377Ssam *
481185377Ssam * Only the bits in the IMR control whether the MAC's INTA#
482185377Ssam * output will be asserted.  The bits in the secondary interrupt
483185377Ssam * mask registers control what bits get set in the primary
484185377Ssam * interrupt status register; however the IMR_S* registers
485185377Ssam * DO NOT determine whether INTA# is asserted.
486185377Ssam */
487185377Ssam#define	AR_IMR_RXOK	0x00000001 /* At least one frame received sans errors */
488185377Ssam#define	AR_IMR_RXDESC	0x00000002 /* Receive interrupt request */
489185377Ssam#define	AR_IMR_RXERR	0x00000004 /* Receive error interrupt */
490185377Ssam#define	AR_IMR_RXNOPKT	0x00000008 /* No frame received within timeout clock */
491185377Ssam#define	AR_IMR_RXEOL	0x00000010 /* Received descriptor empty interrupt */
492185377Ssam#define	AR_IMR_RXORN	0x00000020 /* Receive FIFO overrun interrupt */
493185377Ssam#define	AR_IMR_TXOK	0x00000040 /* Transmit okay interrupt */
494185377Ssam#define	AR_IMR_TXDESC	0x00000080 /* Transmit interrupt request */
495185377Ssam#define	AR_IMR_TXERR	0x00000100 /* Transmit error interrupt */
496185377Ssam#define	AR_IMR_TXNOPKT	0x00000200 /* No frame transmitted interrupt */
497185377Ssam#define	AR_IMR_TXEOL	0x00000400 /* Transmit descriptor empty interrupt */
498185377Ssam#define	AR_IMR_TXURN	0x00000800 /* Transmit FIFO underrun interrupt */
499185377Ssam#define	AR_IMR_MIB	0x00001000 /* MIB interrupt - see MIBC */
500185377Ssam#define	AR_IMR_SWI	0x00002000 /* Software interrupt */
501185377Ssam#define	AR_IMR_RXPHY	0x00004000 /* PHY receive error interrupt */
502185377Ssam#define	AR_IMR_RXKCM	0x00008000 /* Key-cache miss interrupt */
503185377Ssam#define	AR_IMR_SWBA	0x00010000 /* Software beacon alert interrupt */
504185377Ssam#define	AR_IMR_BRSSI	0x00020000 /* Beacon threshold interrupt */
505185377Ssam#define	AR_IMR_BMISS	0x00040000 /* Beacon missed interrupt */
506185377Ssam#define	AR_IMR_HIUERR	0x00080000 /* An unexpected bus error has occurred */
507185377Ssam#define	AR_IMR_BNR	0x00100000 /* BNR interrupt */
508185377Ssam#define	AR_IMR_RXCHIRP	0x00200000 /* RXCHIRP interrupt */
509185377Ssam#define	AR_IMR_BCNMISC	0x00800000 /* Venice: BCNMISC */
510185377Ssam#define	AR_IMR_TIM	0x00800000 /* TIM interrupt */
511185377Ssam#define	AR_IMR_GPIO	0x01000000 /* GPIO Interrupt */
512185377Ssam#define	AR_IMR_QCBROVF	0x02000000 /* QCU CBR overflow interrupt */
513185377Ssam#define	AR_IMR_QCBRURN	0x04000000 /* QCU CBR underrun interrupt */
514185377Ssam#define	AR_IMR_QTRIG	0x08000000 /* QCU scheduling trigger interrupt */
515185377Ssam#define	AR_IMR_RESV0	0xF0000000 /* Reserved */
516185377Ssam
517185377Ssam#define	AR_IMR_S0_QCU_TXOK	0x000003FF /* TXOK (QCU 0-9) */
518185377Ssam#define	AR_IMR_S0_QCU_TXOK_S	0
519185377Ssam#define	AR_IMR_S0_QCU_TXDESC	0x03FF0000 /* TXDESC (QCU 0-9) */
520185377Ssam#define	AR_IMR_S0_QCU_TXDESC_S	16
521185377Ssam
522185377Ssam#define	AR_IMR_S1_QCU_TXERR	0x000003FF /* TXERR (QCU 0-9) */
523185377Ssam#define	AR_IMR_S1_QCU_TXERR_S	0
524185377Ssam#define	AR_IMR_S1_QCU_TXEOL	0x03FF0000 /* TXEOL (QCU 0-9) */
525185377Ssam#define	AR_IMR_S1_QCU_TXEOL_S	16
526185377Ssam
527185377Ssam#define	AR_IMR_S2_QCU_TXURN	0x000003FF /* Mask for TXURN (QCU 0-9) */
528185377Ssam#define	AR_IMR_S2_QCU_TXURN_S	0
529185377Ssam#define	AR_IMR_S2_MCABT		0x00010000 /* Master cycle abort interrupt */
530185377Ssam#define	AR_IMR_S2_SSERR		0x00020000 /* SERR interrupt */
531185377Ssam#define	AR_IMR_S2_DPERR		0x00040000 /* PCI bus parity error */
532185377Ssam#define	AR_IMR_S2_TIM		0x01000000 /* TIM */
533185377Ssam#define	AR_IMR_S2_CABEND	0x02000000 /* CABEND */
534185377Ssam#define	AR_IMR_S2_DTIMSYNC	0x04000000 /* DTIMSYNC */
535185377Ssam#define	AR_IMR_S2_BCNTO		0x08000000 /* BCNTO */
536185377Ssam#define	AR_IMR_S2_CABTO		0x10000000 /* CABTO */
537185377Ssam#define	AR_IMR_S2_DTIM		0x20000000 /* DTIM */
538192400Ssam#define	AR_IMR_S2_TSFOOR	0x40000000 /* TSF OOR */
539192400Ssam#define	AR_IMR_S2_TBTT		0x80000000 /* TBTT timer */
540185377Ssam
541192399Ssam/* AR_IMR_SR2 bits that correspond to AR_IMR_BCNMISC */
542192399Ssam#define	AR_IMR_SR2_BCNMISC \
543192399Ssam	(AR_IMR_S2_TIM | AR_IMR_S2_DTIM | AR_IMR_S2_DTIMSYNC | \
544192400Ssam	 AR_IMR_S2_CABEND | AR_IMR_S2_CABTO  | AR_IMR_S2_TSFOOR | \
545192400Ssam	 AR_IMR_S2_TBTT)
546192399Ssam
547185377Ssam#define	AR_IMR_S3_QCU_QCBROVF	0x000003FF /* Mask for QCBROVF (QCU 0-9) */
548185377Ssam#define	AR_IMR_S3_QCU_QCBRURN	0x03FF0000 /* Mask for QCBRURN (QCU 0-9) */
549185377Ssam#define	AR_IMR_S3_QCU_QCBRURN_S	16         /* Shift for QCBRURN (QCU 0-9) */
550185377Ssam
551185377Ssam#define	AR_IMR_S4_QCU_QTRIG	0x000003FF /* Mask for QTRIG (QCU 0-9) */
552185377Ssam#define	AR_IMR_S4_RESV0		0xFFFFFC00 /* Reserved */
553185377Ssam
554185377Ssam/* QCU registers */
555185377Ssam#define	AR_NUM_QCU	10     /* Only use QCU 0-9 for forward QCU compatibility */
556185377Ssam#define	AR_QCU_0	0x0001
557185377Ssam#define	AR_QCU_1	0x0002
558185377Ssam#define	AR_QCU_2	0x0004
559185377Ssam#define	AR_QCU_3	0x0008
560185377Ssam#define	AR_QCU_4	0x0010
561185377Ssam#define	AR_QCU_5	0x0020
562185377Ssam#define	AR_QCU_6	0x0040
563185377Ssam#define	AR_QCU_7	0x0080
564185377Ssam#define	AR_QCU_8	0x0100
565185377Ssam#define	AR_QCU_9	0x0200
566185377Ssam
567185377Ssam#define	AR_Q_CBRCFG_CBR_INTERVAL	0x00FFFFFF /* Mask for CBR interval (us) */
568185377Ssam#define AR_Q_CBRCFG_CBR_INTERVAL_S      0   /* Shift for CBR interval */
569185377Ssam#define	AR_Q_CBRCFG_CBR_OVF_THRESH	0xFF000000 /* Mask for CBR overflow threshold */
570185377Ssam#define AR_Q_CBRCFG_CBR_OVF_THRESH_S    24  /* Shift for CBR overflow thresh */
571185377Ssam
572185377Ssam#define	AR_Q_RDYTIMECFG_INT	0x00FFFFFF /* CBR interval (us) */
573185377Ssam#define AR_Q_RDYTIMECFG_INT_S   0  // Shift for ReadyTime Interval (us) */
574185377Ssam#define	AR_Q_RDYTIMECFG_ENA	0x01000000 /* CBR enable */
575185377Ssam/* bits 25-31 are reserved */
576185377Ssam
577185377Ssam#define	AR_Q_MISC_FSP		0x0000000F /* Frame Scheduling Policy mask */
578185377Ssam#define	AR_Q_MISC_FSP_ASAP		0	/* ASAP */
579185377Ssam#define	AR_Q_MISC_FSP_CBR		1	/* CBR */
580185377Ssam#define	AR_Q_MISC_FSP_DBA_GATED		2	/* DMA Beacon Alert gated */
581185377Ssam#define	AR_Q_MISC_FSP_TIM_GATED		3	/* TIM gated */
582185377Ssam#define	AR_Q_MISC_FSP_BEACON_SENT_GATED	4	/* Beacon-sent-gated */
583185377Ssam#define	AR_Q_MISC_FSP_S		0
584185377Ssam#define	AR_Q_MISC_ONE_SHOT_EN	0x00000010 /* OneShot enable */
585185377Ssam#define	AR_Q_MISC_CBR_INCR_DIS1	0x00000020 /* Disable CBR expired counter incr
586185377Ssam					      (empty q) */
587185377Ssam#define	AR_Q_MISC_CBR_INCR_DIS0	0x00000040 /* Disable CBR expired counter incr
588185377Ssam					      (empty beacon q) */
589185377Ssam#define	AR_Q_MISC_BEACON_USE	0x00000080 /* Beacon use indication */
590185377Ssam#define	AR_Q_MISC_CBR_EXP_CNTR_LIMIT	0x00000100 /* CBR expired counter limit enable */
591185377Ssam#define	AR_Q_MISC_RDYTIME_EXP_POLICY	0x00000200 /* Enable TXE cleared on ReadyTime expired or VEOL */
592185377Ssam#define	AR_Q_MISC_RESET_CBR_EXP_CTR	0x00000400 /* Reset CBR expired counter */
593185377Ssam#define	AR_Q_MISC_DCU_EARLY_TERM_REQ	0x00000800 /* DCU frame early termination request control */
594185377Ssam#define	AR_Q_MISC_QCU_COMP_EN	0x00001000 /* QCU frame compression enable */
595185377Ssam#define	AR_Q_MISC_RESV0		0xFFFFF000 /* Reserved */
596185377Ssam
597185377Ssam#define	AR_Q_STS_PEND_FR_CNT	0x00000003 /* Mask for Pending Frame Count */
598185377Ssam#define	AR_Q_STS_RESV0		0x000000FC /* Reserved */
599185377Ssam#define	AR_Q_STS_CBR_EXP_CNT	0x0000FF00 /* Mask for CBR expired counter */
600185377Ssam#define	AR_Q_STS_RESV1		0xFFFF0000 /* Reserved */
601185377Ssam
602185377Ssam/* DCU registers */
603185377Ssam#define	AR_NUM_DCU	10     /* Only use 10 DCU's for forward QCU/DCU compatibility */
604185377Ssam#define	AR_DCU_0	0x0001
605185377Ssam#define	AR_DCU_1	0x0002
606185377Ssam#define	AR_DCU_2	0x0004
607185377Ssam#define	AR_DCU_3	0x0008
608185377Ssam#define	AR_DCU_4	0x0010
609185377Ssam#define	AR_DCU_5	0x0020
610185377Ssam#define	AR_DCU_6	0x0040
611185377Ssam#define	AR_DCU_7	0x0080
612185377Ssam#define	AR_DCU_8	0x0100
613185377Ssam#define	AR_DCU_9	0x0200
614185377Ssam
615185377Ssam#define	AR_D_QCUMASK		0x000003FF /* Mask for QCU Mask (QCU 0-9) */
616185377Ssam#define	AR_D_QCUMASK_RESV0	0xFFFFFC00 /* Reserved */
617185377Ssam
618185377Ssam#define	AR_D_LCL_IFS_CWMIN	0x000003FF /* Mask for CW_MIN */
619185377Ssam#define	AR_D_LCL_IFS_CWMIN_S	0
620185377Ssam#define	AR_D_LCL_IFS_CWMAX	0x000FFC00 /* Mask for CW_MAX */
621185377Ssam#define	AR_D_LCL_IFS_CWMAX_S	10
622185377Ssam#define	AR_D_LCL_IFS_AIFS	0x0FF00000 /* Mask for AIFS */
623185377Ssam#define	AR_D_LCL_IFS_AIFS_S	20
624185377Ssam/*
625185377Ssam *  Note:  even though this field is 8 bits wide the
626185377Ssam *  maximum supported AIFS value is 0xfc.  Setting the AIFS value
627185377Ssam *  to 0xfd 0xfe, or 0xff will not work correctly and will cause
628185377Ssam *  the DCU to hang.
629185377Ssam */
630185377Ssam#define	AR_D_LCL_IFS_RESV0	0xF0000000 /* Reserved */
631185377Ssam
632185377Ssam#define	AR_D_RETRY_LIMIT_FR_SH	0x0000000F /* frame short retry limit */
633185377Ssam#define	AR_D_RETRY_LIMIT_FR_SH_S	0
634185377Ssam#define	AR_D_RETRY_LIMIT_FR_LG	0x000000F0 /* frame long retry limit */
635185377Ssam#define	AR_D_RETRY_LIMIT_FR_LG_S	4
636185377Ssam#define	AR_D_RETRY_LIMIT_STA_SH	0x00003F00 /* station short retry limit */
637185377Ssam#define	AR_D_RETRY_LIMIT_STA_SH_S	8
638185377Ssam#define	AR_D_RETRY_LIMIT_STA_LG	0x000FC000 /* station short retry limit */
639185377Ssam#define	AR_D_RETRY_LIMIT_STA_LG_S	14
640185377Ssam#define	AR_D_RETRY_LIMIT_RESV0		0xFFF00000 /* Reserved */
641185377Ssam
642185377Ssam#define	AR_D_CHNTIME_DUR		0x000FFFFF /* ChannelTime duration (us) */
643185377Ssam#define AR_D_CHNTIME_DUR_S              0 /* Shift for ChannelTime duration */
644185377Ssam#define	AR_D_CHNTIME_EN			0x00100000 /* ChannelTime enable */
645185377Ssam#define	AR_D_CHNTIME_RESV0		0xFFE00000 /* Reserved */
646185377Ssam
647185377Ssam#define	AR_D_MISC_BKOFF_THRESH	0x0000003F /* Backoff threshold */
648185377Ssam#define	AR_D_MISC_ETS_RTS		0x00000040 /* End of transmission series
649185377Ssam						      station RTS/data failure
650185377Ssam						      count reset policy */
651185377Ssam#define	AR_D_MISC_ETS_CW		0x00000080 /* End of transmission series
652185377Ssam						      CW reset policy */
653185377Ssam#define AR_D_MISC_FRAG_WAIT_EN          0x00000100 /* Wait for next fragment */
654185377Ssam#define AR_D_MISC_FRAG_BKOFF_EN         0x00000200 /* Backoff during a frag burst */
655185377Ssam#define	AR_D_MISC_HCF_POLL_EN		0x00000800 /* HFC poll enable */
656185377Ssam#define	AR_D_MISC_BKOFF_PERSISTENCE	0x00001000 /* Backoff persistence factor
657185377Ssam						      setting */
658185377Ssam#define	AR_D_MISC_FR_PREFETCH_EN	0x00002000 /* Frame prefetch enable */
659185377Ssam#define	AR_D_MISC_VIR_COL_HANDLING	0x0000C000 /* Mask for Virtual collision
660185377Ssam						      handling policy */
661185377Ssam#define	AR_D_MISC_VIR_COL_HANDLING_S	14
662185377Ssam/* FOO redefined for venice CW increment policy */
663185377Ssam#define	AR_D_MISC_VIR_COL_HANDLING_DEFAULT	0	/* Normal */
664185377Ssam#define	AR_D_MISC_VIR_COL_HANDLING_IGNORE	1	/* Ignore */
665185377Ssam#define	AR_D_MISC_BEACON_USE		0x00010000 /* Beacon use indication */
666185377Ssam#define	AR_D_MISC_ARB_LOCKOUT_CNTRL	0x00060000 /* DCU arbiter lockout ctl */
667185377Ssam#define	AR_D_MISC_ARB_LOCKOUT_CNTRL_S	17         /* DCU arbiter lockout ctl */
668185377Ssam#define	AR_D_MISC_ARB_LOCKOUT_CNTRL_NONE	0	/* No lockout */
669185377Ssam#define	AR_D_MISC_ARB_LOCKOUT_CNTRL_INTRA_FR	1	/* Intra-frame */
670185377Ssam#define	AR_D_MISC_ARB_LOCKOUT_CNTRL_GLOBAL	2	/* Global */
671185377Ssam#define	AR_D_MISC_ARB_LOCKOUT_IGNORE	0x00080000 /* DCU arbiter lockout ignore control */
672185377Ssam#define	AR_D_MISC_SEQ_NUM_INCR_DIS	0x00100000 /* Sequence number increment disable */
673185377Ssam#define	AR_D_MISC_POST_FR_BKOFF_DIS	0x00200000 /* Post-frame backoff disable */
674185377Ssam#define	AR_D_MISC_VIRT_COLL_POLICY	0x00400000 /* Virtual coll. handling policy */
675185377Ssam#define	AR_D_MISC_BLOWN_IFS_POLICY	0x00800000 /* Blown IFS handling policy */
676185377Ssam#define	AR_D_MISC_RESV0			0xFE000000 /* Reserved */
677185377Ssam
678185377Ssam#define	AR_D_SEQNUM_RESV0	0xFFFFF000 /* Reserved */
679185377Ssam
680185377Ssam#define	AR_D_GBL_IFS_MISC_LFSR_SLICE_SEL	0x00000007 /* LFSR slice select */
681185377Ssam#define	AR_D_GBL_IFS_MISC_TURBO_MODE	0x00000008 /* Turbo mode indication */
682185377Ssam#define	AR_D_GBL_IFS_MISC_SIFS_DURATION_USEC	0x000003F0 /* SIFS duration (us) */
683185377Ssam#define	AR_D_GBL_IFS_MISC_USEC_DURATION	0x000FFC00 /* microsecond duration */
684185377Ssam#define	AR_D_GBL_IFS_MISC_USEC_DURATION_S 10
685185377Ssam#define	AR_D_GBL_IFS_MISC_DCU_ARBITER_DLY	0x00300000 /* DCU arbiter delay */
686185377Ssam#define	AR_D_GBL_IFS_MISC_RESV0	0xFFC00000 /* Reserved */
687185377Ssam
688185377Ssam/* DMA & PCI Registers in PCI space (usable during sleep) */
689185377Ssam#define	AR_RC_MAC		0x00000001 /* MAC reset */
690185377Ssam#define	AR_RC_BB		0x00000002 /* Baseband reset */
691185377Ssam#define	AR_RC_RESV0		0x00000004 /* Reserved */
692185377Ssam#define	AR_RC_RESV1		0x00000008 /* Reserved */
693185377Ssam#define	AR_RC_PCI		0x00000010 /* PCI-core reset */
694185377Ssam
695185377Ssam#define	AR_SCR_SLDUR		0x0000ffff /* sleep duration, units of 128us */
696185377Ssam#define	AR_SCR_SLDUR_S		0
697185377Ssam#define	AR_SCR_SLE		0x00030000 /* sleep enable */
698185377Ssam#define	AR_SCR_SLE_S		16
699185377Ssam#define	AR_SCR_SLE_WAKE		0 	/* force wake */
700185377Ssam#define	AR_SCR_SLE_SLP		1	/* force sleep */
701185377Ssam#define	AR_SCR_SLE_NORM		2	/* sleep logic normal operation */
702185377Ssam#define	AR_SCR_SLDTP		0x00040000 /* sleep duration timing policy */
703185377Ssam#define	AR_SCR_SLDWP		0x00080000 /* sleep duration write policy */
704185377Ssam#define	AR_SCR_SLEPOL		0x00100000 /* sleep policy mode */
705185377Ssam#define	AR_SCR_MIBIE		0x00200000 /* sleep perf cntrs MIB intr ena */
706203159Srpaulo#define	AR_SCR_UNKNOWN		0x00400000
707185377Ssam
708185377Ssam#define	AR_INTPEND_TRUE		0x00000001 /* interrupt pending */
709185377Ssam
710185377Ssam#define	AR_SFR_SLEEP		0x00000001 /* force sleep */
711185377Ssam
712185377Ssam#define	AR_PCICFG_SCLK_SEL	0x00000002 /* sleep clock select */
713185377Ssam#define	AR_PCICFG_SCLK_SEL_S	1
714185377Ssam#define	AR_PCICFG_CLKRUNEN	0x00000004 /* enable PCI CLKRUN function */
715185377Ssam#define	AR_PCICFG_EEPROM_SIZE	0x00000018 /* Mask for EEPROM size */
716185377Ssam#define	AR_PCICFG_EEPROM_SIZE_4		0	/* EEPROM size 4 Kbit */
717185377Ssam#define	AR_PCICFG_EEPROM_SIZE_8K	1	/* EEPROM size 8 Kbit */
718185377Ssam#define	AR_PCICFG_EEPROM_SIZE_16K	2	/* EEPROM size 16 Kbit */
719185377Ssam#define	AR_PCICFG_EEPROM_SIZE_FAILED	3	/* Failure */
720185377Ssam#define	AR_PCICFG_EEPROM_SIZE_S	3
721185377Ssam#define	AR_PCICFG_LEDCTL	0x00000060 /* LED control Status */
722185377Ssam#define	AR_PCICFG_LEDCTL_NONE	0	   /* STA is not associated or trying */
723185377Ssam#define	AR_PCICFG_LEDCTL_PEND	1	   /* STA is trying to associate */
724185377Ssam#define	AR_PCICFG_LEDCTL_ASSOC	2	   /* STA is associated */
725185377Ssam#define	AR_PCICFG_LEDCTL_S	5
726185377Ssam#define	AR_PCICFG_PCI_BUS_SEL	0x00000380 /* PCI observation bus mux select */
727185377Ssam#define	AR_PCICFG_DIS_CBE_FIX	0x00000400 /* Disable fix for bad PCI CBE# generation */
728185377Ssam#define	AR_PCICFG_SL_INTEN	0x00000800 /* enable interrupt line assertion when asleep */
729185377Ssam#define	AR_PCICFG_RETRYFIXEN	0x00001000 /* Enable PCI core retry fix */
730185377Ssam#define	AR_PCICFG_SL_INPEN	0x00002000 /* Force asleep when an interrupt is pending */
731185377Ssam#define	AR_PCICFG_RESV1		0x0000C000 /* Reserved */
732185377Ssam#define	AR_PCICFG_SPWR_DN	0x00010000 /* mask for sleep/awake indication */
733185377Ssam#define	AR_PCICFG_LEDMODE	0x000E0000 /* LED mode */
734185377Ssam#define	AR_PCICFG_LEDMODE_PROP	0	   /* Blink prop to filtered tx/rx */
735185377Ssam#define	AR_PCICFG_LEDMODE_RPROP	1	   /* Blink prop to unfiltered tx/rx */
736185377Ssam#define	AR_PCICFG_LEDMODE_SPLIT	2	   /* Blink power for tx/net for rx */
737185377Ssam#define	AR_PCICFG_LEDMODE_RAND	3	   /* Blink randomly */
738185377Ssam/* NB: s/w led control present in Hainan 1.1 and above */
739185377Ssam#define	AR_PCICFG_LEDMODE_OFF	4	   /* s/w control + both led's off */
740185377Ssam#define	AR_PCICFG_LEDMODE_POWON	5	   /* s/w control + power led on */
741185377Ssam#define	AR_PCICFG_LEDMODE_NETON	6	   /* s/w control + network led on */
742185377Ssam#define	AR_PCICFG_LEDMODE_S	17
743185377Ssam#define	AR_PCICFG_LEDBLINK	0x00700000 /* LED blink threshold select */
744185377Ssam#define	AR_PCICFG_LEDBLINK_S	20
745185377Ssam#define	AR_PCICFG_LEDSLOW	0x00800000 /* LED slowest blink rate mode */
746185377Ssam#define	AR_PCICFG_LEDSLOW_S	23
747185377Ssam#define	AR_PCICFG_SCLK_RATE_IND 0x03000000 /* Sleep clock rate */
748185377Ssam#define	AR_PCICFG_SCLK_RATE_IND_S 24
749185377Ssam#define	AR_PCICFG_RESV2		0xFC000000 /* Reserved */
750185377Ssam
751185377Ssam#define	AR_GPIOCR_CR_SHIFT	2          /* Each CR is 2 bits */
752185377Ssam#define	AR_GPIOCR_CR_N(_g)	(0 << (AR_GPIOCR_CR_SHIFT * (_g)))
753185377Ssam#define	AR_GPIOCR_CR_0(_g)	(1 << (AR_GPIOCR_CR_SHIFT * (_g)))
754185377Ssam#define	AR_GPIOCR_CR_1(_g)	(2 << (AR_GPIOCR_CR_SHIFT * (_g)))
755185377Ssam#define	AR_GPIOCR_CR_A(_g)	(3 << (AR_GPIOCR_CR_SHIFT * (_g)))
756185377Ssam#define	AR_GPIOCR_INT_SHIFT	12         /* Interrupt select field shifter */
757185377Ssam#define	AR_GPIOCR_INT(_g)	((_g) << AR_GPIOCR_INT_SHIFT)
758185377Ssam#define	AR_GPIOCR_INT_MASK	0x00007000 /* Interrupt select field mask */
759185377Ssam#define	AR_GPIOCR_INT_ENA	0x00008000 /* Enable GPIO Interrupt */
760185377Ssam#define	AR_GPIOCR_INT_SELL	0x00000000 /* Generate int if pin is low */
761185377Ssam#define	AR_GPIOCR_INT_SELH	0x00010000 /* Generate int if pin is high */
762185377Ssam#define	AR_GPIOCR_INT_SEL	AR_GPIOCR_INT_SELH
763185377Ssam
764185377Ssam#define	AR_SREV_ID		0x000000FF /* Mask to read SREV info */
765185377Ssam#define	AR_SREV_ID_S		4	   /* Mask to shift Major Rev Info */
766185377Ssam#define	AR_SREV_REVISION	0x0000000F /* Mask for Chip revision level */
767185377Ssam#define	AR_SREV_REVISION_MIN	0	   /* lowest revision level */
768185377Ssam#define	AR_SREV_REVISION_MAX	0xF	   /* highest revision level */
769185377Ssam#define	AR_SREV_FPGA		1
770185377Ssam#define	AR_SREV_D2PLUS		2
771185377Ssam#define	AR_SREV_D2PLUS_MS	3	/* metal spin */
772185377Ssam#define	AR_SREV_CRETE		4
773185377Ssam#define	AR_SREV_CRETE_MS	5	/* FCS metal spin */
774185377Ssam#define	AR_SREV_CRETE_MS23	7	/* 2.3 metal spin (6 skipped) */
775185377Ssam#define	AR_SREV_CRETE_23	8	/* 2.3 full tape out */
776185380Ssam#define	AR_SREV_GRIFFIN_LITE	8
777185380Ssam#define	AR_SREV_HAINAN		9
778185380Ssam#define	AR_SREV_CONDOR		11
779185377Ssam#define	AR_SREV_VERSION	0x000000F0 /* Mask for Chip version */
780185377Ssam#define	AR_SREV_VERSION_CRETE	0
781185377Ssam#define	AR_SREV_VERSION_MAUI_1	1
782185377Ssam#define	AR_SREV_VERSION_MAUI_2	2
783185377Ssam#define	AR_SREV_VERSION_SPIRIT	3
784185377Ssam#define	AR_SREV_VERSION_OAHU	4
785185377Ssam#define	AR_SREV_VERSION_VENICE	5
786185377Ssam#define	AR_SREV_VERSION_GRIFFIN	7
787185380Ssam#define	AR_SREV_VERSION_CONDOR	9
788185380Ssam#define	AR_SREV_VERSION_EAGLE	10
789185377Ssam#define	AR_SREV_VERSION_COBRA	11
790185377Ssam#define	AR_SREV_2413		AR_SREV_VERSION_GRIFFIN
791185380Ssam#define	AR_SREV_5413	        AR_SREV_VERSION_EAGLE
792185377Ssam#define	AR_SREV_2415		AR_SREV_VERSION_COBRA
793185380Ssam#define	AR_SREV_5424		AR_SREV_VERSION_CONDOR
794185380Ssam#define	AR_SREV_2425		14	/* SWAN */
795185380Ssam#define	AR_SREV_2417		15	/* Nala */
796185377Ssam#define	AR_SREV_OAHU_ES		0	/* Engineering Sample */
797185377Ssam#define	AR_SREV_OAHU_PROD	2	/* Production */
798185377Ssam
799185380Ssam#define	AR_PHYREV_HAINAN	0x43
800185380Ssam#define	AR_ANALOG5REV_HAINAN	0x46
801185377Ssam
802185380Ssam#define	AR_RADIO_SREV_MAJOR	0xF0
803185380Ssam#define	AR_RADIO_SREV_MINOR	0x0F
804185377Ssam#define	AR_RAD5111_SREV_MAJOR	0x10	/* All current supported ar5211 5 GHz
805185377Ssam					   radios are rev 0x10 */
806185377Ssam#define	AR_RAD5111_SREV_PROD	0x15	/* Current production level radios */
807185377Ssam#define	AR_RAD2111_SREV_MAJOR	0x20	/* All current supported ar5211 2 GHz
808185377Ssam					   radios are rev 0x10 */
809185377Ssam#define	AR_RAD5112_SREV_MAJOR	0x30	/* 5112 Major Rev */
810185380Ssam#define AR_RAD5112_SREV_2_0     0x35    /* AR5112 Revision 2.0 */
811185380Ssam#define AR_RAD5112_SREV_2_1     0x36    /* AR5112 Revision 2.1 */
812185377Ssam#define	AR_RAD2112_SREV_MAJOR	0x40	/* 2112 Major Rev */
813185380Ssam#define AR_RAD2112_SREV_2_0     0x45    /* AR2112 Revision 2.0 */
814185380Ssam#define AR_RAD2112_SREV_2_1     0x46    /* AR2112 Revision 2.1 */
815185377Ssam#define AR_RAD2413_SREV_MAJOR	0x50	/* 2413 Major Rev */
816185377Ssam#define AR_RAD5413_SREV_MAJOR   0x60    /* 5413 Major Rev */
817185377Ssam#define AR_RAD2316_SREV_MAJOR	0x70	/* 2316 Major Rev */
818185377Ssam#define AR_RAD2317_SREV_MAJOR	0x80	/* 2317 Major Rev */
819185380Ssam#define AR_RAD5424_SREV_MAJOR   0xa0    /* Mostly same as 5413 Major Rev */
820185377Ssam
821185377Ssam#define	AR_PCIE_PMC_ENA_L1	0x01	/* enable PCIe core enter L1 when
822185377Ssam					   d2_sleep_en is asserted */
823185377Ssam#define	AR_PCIE_PMC_ENA_RESET	0x08	/* enable reset on link going down */
824185377Ssam
825185377Ssam/* EEPROM Registers in the MAC */
826185377Ssam#define	AR_EEPROM_CMD_READ	0x00000001
827185377Ssam#define	AR_EEPROM_CMD_WRITE	0x00000002
828185377Ssam#define	AR_EEPROM_CMD_RESET	0x00000004
829185377Ssam
830185377Ssam#define	AR_EEPROM_STS_READ_ERROR	0x00000001
831185377Ssam#define	AR_EEPROM_STS_READ_COMPLETE	0x00000002
832185377Ssam#define	AR_EEPROM_STS_WRITE_ERROR	0x00000004
833185377Ssam#define	AR_EEPROM_STS_WRITE_COMPLETE	0x00000008
834185377Ssam
835185377Ssam#define	AR_EEPROM_CFG_SIZE	0x00000003	/* size determination override */
836185377Ssam#define	AR_EEPROM_CFG_SIZE_AUTO		0
837185377Ssam#define	AR_EEPROM_CFG_SIZE_4KBIT	1
838185377Ssam#define	AR_EEPROM_CFG_SIZE_8KBIT	2
839185377Ssam#define	AR_EEPROM_CFG_SIZE_16KBIT	3
840185377Ssam#define	AR_EEPROM_CFG_DIS_WWRCL	0x00000004	/* Disable wait for write completion */
841185377Ssam#define	AR_EEPROM_CFG_CLOCK	0x00000018	/* clock rate control */
842185377Ssam#define	AR_EEPROM_CFG_CLOCK_S		3	/* clock rate control */
843185377Ssam#define	AR_EEPROM_CFG_CLOCK_156KHZ	0
844185377Ssam#define	AR_EEPROM_CFG_CLOCK_312KHZ	1
845185377Ssam#define	AR_EEPROM_CFG_CLOCK_625KHZ	2
846185377Ssam#define	AR_EEPROM_CFG_RESV0	0x000000E0	/* Reserved */
847185377Ssam#define	AR_EEPROM_CFG_PKEY	0x00FFFF00	/* protection key */
848185377Ssam#define	AR_EEPROM_CFG_PKEY_S	8
849185377Ssam#define	AR_EEPROM_CFG_EN_L	0x01000000	/* EPRM_EN_L setting */
850185377Ssam
851185377Ssam/* MAC PCU Registers */
852185377Ssam
853185377Ssam#define	AR_STA_ID1_SADH_MASK	0x0000FFFF /* upper 16 bits of MAC addr */
854185377Ssam#define	AR_STA_ID1_STA_AP	0x00010000 /* Device is AP */
855185377Ssam#define	AR_STA_ID1_ADHOC	0x00020000 /* Device is ad-hoc */
856185377Ssam#define	AR_STA_ID1_PWR_SAV	0x00040000 /* Power save reporting in
857185377Ssam					      self-generated frames */
858185377Ssam#define	AR_STA_ID1_KSRCHDIS	0x00080000 /* Key search disable */
859185377Ssam#define	AR_STA_ID1_PCF		0x00100000 /* Observe PCF */
860185377Ssam#define	AR_STA_ID1_USE_DEFANT	0x00200000 /* Use default antenna */
861185377Ssam#define	AR_STA_ID1_UPD_DEFANT	0x00400000 /* Update default antenna w/
862185377Ssam					      TX antenna */
863185377Ssam#define	AR_STA_ID1_RTS_USE_DEF	0x00800000 /* Use default antenna to send RTS */
864185377Ssam#define	AR_STA_ID1_ACKCTS_6MB	0x01000000 /* Use 6Mb/s rate for ACK & CTS */
865185377Ssam#define	AR_STA_ID1_BASE_RATE_11B 0x02000000/* Use 11b base rate for ACK & CTS */
866185377Ssam#define	AR_STA_ID1_USE_DA_SG	0x04000000 /* Use default antenna for
867185377Ssam					      self-generated frames */
868185377Ssam#define	AR_STA_ID1_CRPT_MIC_ENABLE	0x08000000 /* Enable Michael */
869185377Ssam#define	AR_STA_ID1_KSRCH_MODE	0x10000000 /* Look-up key when keyID != 0 */
870185377Ssam#define	AR_STA_ID1_PRE_SEQNUM	0x20000000 /* Preserve s/w sequence number */
871185377Ssam#define	AR_STA_ID1_CBCIV_ENDIAN	0x40000000
872185377Ssam#define	AR_STA_ID1_MCAST_KSRCH	0x80000000 /* Do keycache search for mcast */
873185377Ssam
874185377Ssam#define	AR_BSS_ID1_U16		0x0000FFFF /* Upper 16 bits of BSSID */
875185377Ssam#define	AR_BSS_ID1_AID		0xFFFF0000 /* Association ID */
876185377Ssam#define	AR_BSS_ID1_AID_S	16
877185377Ssam
878185377Ssam#define	AR_SLOT_TIME_MASK	0x000007FF /* Slot time mask */
879185377Ssam
880185377Ssam#define	AR_TIME_OUT_ACK		0x00003FFF /* ACK time-out */
881185377Ssam#define	AR_TIME_OUT_ACK_S	0
882185377Ssam#define	AR_TIME_OUT_CTS		0x3FFF0000 /* CTS time-out */
883185377Ssam#define	AR_TIME_OUT_CTS_S	16
884185377Ssam
885185377Ssam#define	AR_RSSI_THR_MASK	0x000000FF /* Beacon RSSI warning threshold */
886185377Ssam#define	AR_RSSI_THR_BM_THR	0x0000FF00 /* Missed beacon threshold */
887185377Ssam#define	AR_RSSI_THR_BM_THR_S	8
888185377Ssam
889185377Ssam#define	AR_USEC_USEC		0x0000007F /* clock cycles in 1 usec */
890185377Ssam#define	AR_USEC_USEC_S		0
891185377Ssam#define	AR_USEC_USEC32		0x00003F80 /* 32MHz clock cycles in 1 usec */
892185377Ssam#define	AR_USEC_USEC32_S	7
893185377Ssam
894185377Ssam#define AR5212_USEC_TX_LAT_M    0x007FC000      /* Tx latency */
895185377Ssam#define AR5212_USEC_TX_LAT_S    14
896185377Ssam#define AR5212_USEC_RX_LAT_M    0x1F800000      /* Rx latency */
897185377Ssam#define AR5212_USEC_RX_LAT_S    23
898185377Ssam
899185377Ssam#define	AR_BEACON_PERIOD	0x0000FFFF /* Beacon period mask in TU/msec */
900185377Ssam#define	AR_BEACON_PERIOD_S	0
901185377Ssam#define	AR_BEACON_TIM		0x007F0000 /* byte offset of TIM start */
902185377Ssam#define	AR_BEACON_TIM_S		16
903185377Ssam#define	AR_BEACON_EN		0x00800000 /* Beacon enable */
904185377Ssam#define	AR_BEACON_RESET_TSF	0x01000000 /* Clear TSF to 0 */
905185377Ssam
906185377Ssam#define	AR_RX_NONE		0x00000000 /* Disallow all frames */
907185377Ssam#define	AR_RX_UCAST		0x00000001 /* Allow unicast frames */
908185377Ssam#define	AR_RX_MCAST		0x00000002 /* Allow multicast frames */
909185377Ssam#define	AR_RX_BCAST		0x00000004 /* Allow broadcast frames */
910185377Ssam#define	AR_RX_CONTROL		0x00000008 /* Allow control frames */
911185377Ssam#define	AR_RX_BEACON		0x00000010 /* Allow beacon frames */
912185377Ssam#define	AR_RX_PROM		0x00000020 /* Promiscuous mode, all packets */
913185377Ssam#define	AR_RX_PROBE_REQ		0x00000080 /* Allow probe request frames */
914185377Ssam
915185377Ssam#define	AR_DIAG_CACHE_ACK	0x00000001 /* No ACK if no valid key found */
916185377Ssam#define	AR_DIAG_ACK_DIS		0x00000002 /* Disable ACK generation */
917185377Ssam#define	AR_DIAG_CTS_DIS		0x00000004 /* Disable CTS generation */
918185377Ssam#define	AR_DIAG_ENCRYPT_DIS	0x00000008 /* Disable encryption */
919185377Ssam#define	AR_DIAG_DECRYPT_DIS	0x00000010 /* Disable decryption */
920185377Ssam#define	AR_DIAG_RX_DIS		0x00000020 /* Disable receive */
921185377Ssam#define	AR_DIAG_CORR_FCS	0x00000080 /* Corrupt FCS */
922185377Ssam#define	AR_DIAG_CHAN_INFO	0x00000100 /* Dump channel info */
923185377Ssam#define	AR_DIAG_EN_SCRAMSD	0x00000200 /* Enable fixed scrambler seed */
924185377Ssam#define	AR_DIAG_SCRAM_SEED	0x0001FC00 /* Fixed scrambler seed */
925185377Ssam#define	AR_DIAG_SCRAM_SEED_S	10
926185377Ssam#define	AR_DIAG_FRAME_NV0	0x00020000 /* Accept frames of non-zero
927185377Ssam					      protocol version */
928185377Ssam#define	AR_DIAG_OBS_PT_SEL	0x000C0000 /* Observation point select */
929185377Ssam#define	AR_DIAG_OBS_PT_SEL_S	18
930185377Ssam#define AR_DIAG_RX_CLR_HI	0x00100000 /* Force rx_clear high */
931185377Ssam#define AR_DIAG_IGNORE_CS	0x00200000 /* Force virtual carrier sense */
932185377Ssam#define AR_DIAG_CHAN_IDLE	0x00400000 /* Force channel idle high */
933185377Ssam#define AR_DIAG_PHEAR_ME	0x00800000 /* Uses framed and wait_wep in the pherr_enable_eifs if set to 0 */
934185377Ssam
935185377Ssam#define	AR_SLEEP1_NEXT_DTIM	0x0007ffff /* Abs. time(1/8TU) for next DTIM */
936185377Ssam#define	AR_SLEEP1_NEXT_DTIM_S	0
937185377Ssam#define	AR_SLEEP1_ASSUME_DTIM	0x00080000 /* Assume DTIM present on missent beacon */
938185377Ssam#define	AR_SLEEP1_ENH_SLEEP_ENA	0x00100000 /* Enable enhanced sleep logic */
939185377Ssam#define	AR_SLEEP1_CAB_TIMEOUT	0xff000000 /* CAB timeout(TU) */
940185377Ssam#define	AR_SLEEP1_CAB_TIMEOUT_S	24
941185377Ssam
942185377Ssam#define	AR_SLEEP2_NEXT_TIM	0x0007ffff /* Abs. time(1/8TU) for next DTIM */
943185377Ssam#define	AR_SLEEP2_NEXT_TIM_S	0
944185377Ssam#define	AR_SLEEP2_BEACON_TIMEOUT	0xff000000 /* Beacon timeout(TU) */
945185377Ssam#define	AR_SLEEP2_BEACON_TIMEOUT_S	24
946185377Ssam
947185377Ssam#define	AR_SLEEP3_TIM_PERIOD	0x0000ffff /* Tim/Beacon period (TU) */
948185377Ssam#define	AR_SLEEP3_TIM_PERIOD_S	0
949185377Ssam#define	AR_SLEEP3_DTIM_PERIOD	0xffff0000 /* DTIM period (TU) */
950185377Ssam#define	AR_SLEEP3_DTIM_PERIOD_S	16
951185377Ssam
952185377Ssam#define	AR_TPC_ACK		0x0000003f /* ack frames */
953185377Ssam#define	AR_TPC_ACK_S		0
954185377Ssam#define	AR_TPC_CTS		0x00003f00 /* cts frames */
955185377Ssam#define	AR_TPC_CTS_S		8
956185377Ssam#define	AR_TPC_CHIRP		0x003f0000 /* chirp frames */
957185377Ssam#define	AR_TPC_CHIRP_S		16
958185377Ssam#define AR_TPC_DOPPLER          0x0f000000 /* doppler chirp span */
959185377Ssam#define AR_TPC_DOPPLER_S        24
960185377Ssam
961185377Ssam#define	AR_PHY_ERR_RADAR	0x00000020	/* Radar signal */
962185377Ssam#define	AR_PHY_ERR_OFDM_TIMING	0x00020000	/* False detect for OFDM */
963185377Ssam#define	AR_PHY_ERR_CCK_TIMING	0x02000000	/* False detect for CCK */
964185377Ssam
965185377Ssam#define	AR_TSF_PARM_INCREMENT	0x000000ff
966185377Ssam#define	AR_TSF_PARM_INCREMENT_S	0
967185377Ssam
968185377Ssam#define AR_NOACK_2BIT_VALUE    0x0000000f
969185377Ssam#define AR_NOACK_2BIT_VALUE_S  0
970185377Ssam#define AR_NOACK_BIT_OFFSET     0x00000070
971185377Ssam#define AR_NOACK_BIT_OFFSET_S   4
972185377Ssam#define AR_NOACK_BYTE_OFFSET    0x00000180
973185377Ssam#define AR_NOACK_BYTE_OFFSET_S  7
974185377Ssam
975185377Ssam#define	AR_MISC_MODE_BSSID_MATCH_FORCE  0x1	/* Force BSSID match */
976185377Ssam#define	AR_MISC_MODE_ACKSIFS_MEMORY     0x2	/* ACKSIFS use contents of Rate */
977185377Ssam#define	AR_MISC_MODE_MIC_NEW_LOC_ENABLE 0x4	/* Xmit Michael Key same as Rcv */
978185377Ssam#define	AR_MISC_MODE_TX_ADD_TSF         0x8	/* Beacon/Probe-Rsp timestamp add (not replace) */
979185377Ssam
980185377Ssam#define	AR_KEYTABLE_KEY0(_n)	(AR_KEYTABLE(_n) + 0)	/* key bit 0-31 */
981185377Ssam#define	AR_KEYTABLE_KEY1(_n)	(AR_KEYTABLE(_n) + 4)	/* key bit 32-47 */
982185377Ssam#define	AR_KEYTABLE_KEY2(_n)	(AR_KEYTABLE(_n) + 8)	/* key bit 48-79 */
983185377Ssam#define	AR_KEYTABLE_KEY3(_n)	(AR_KEYTABLE(_n) + 12)	/* key bit 80-95 */
984185377Ssam#define	AR_KEYTABLE_KEY4(_n)	(AR_KEYTABLE(_n) + 16)	/* key bit 96-127 */
985185377Ssam#define	AR_KEYTABLE_TYPE(_n)	(AR_KEYTABLE(_n) + 20)	/* key type */
986185377Ssam#define	AR_KEYTABLE_TYPE_40	0x00000000	/* WEP 40 bit key */
987185377Ssam#define	AR_KEYTABLE_TYPE_104	0x00000001	/* WEP 104 bit key */
988185377Ssam#define	AR_KEYTABLE_TYPE_128	0x00000003	/* WEP 128 bit key */
989185377Ssam#define	AR_KEYTABLE_TYPE_TKIP	0x00000004	/* TKIP and Michael */
990185377Ssam#define	AR_KEYTABLE_TYPE_AES	0x00000005	/* AES/OCB 128 bit key */
991185377Ssam#define	AR_KEYTABLE_TYPE_CCM	0x00000006	/* AES/CCM 128 bit key */
992185377Ssam#define	AR_KEYTABLE_TYPE_CLR	0x00000007	/* no encryption */
993185377Ssam#define	AR_KEYTABLE_ANT		0x00000008	/* previous transmit antenna */
994185377Ssam#define	AR_KEYTABLE_MAC0(_n)	(AR_KEYTABLE(_n) + 24)	/* MAC address 1-32 */
995185377Ssam#define	AR_KEYTABLE_MAC1(_n)	(AR_KEYTABLE(_n) + 28)	/* MAC address 33-47 */
996185377Ssam#define	AR_KEYTABLE_VALID	0x00008000	/* key and MAC address valid */
997185377Ssam
998185377Ssam/* Compress settings */
999185377Ssam#define AR_CCFG_WIN_M           0x00000007 /* mask for AR_CCFG_WIN size */
1000185377Ssam#define AR_CCFG_MIB_INT_EN      0x00000008 /* compression performance MIB counter int enable */
1001185377Ssam#define AR_CCUCFG_RESET_VAL     0x00100200 /* the should be reset value */
1002185377Ssam#define AR_CCUCFG_CATCHUP_EN    0x00000001 /* Compression catchup enable */
1003185377Ssam#define AR_DCM_D_EN             0x00000001 /* all direct frames to be decompressed */
1004185377Ssam#define AR_COMPRESSION_WINDOW_SIZE      4096 /* default comp. window size */
1005185377Ssam
1006185377Ssam#endif /* _DEV_AR5212REG_H_ */
1007