xref: /titanic_52/usr/src/uts/common/io/rwn/rt2860_reg.h (revision 8a3c961b6b8e22607c570d092514b791eb1519e9)
1 /*
2  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*
7  * Copyright (c) 2007, 2008
8  *	Damien Bergamini <damien.bergamini@free.fr>
9  *
10  * Permission to use, copy, modify, and distribute this software for any
11  * purpose with or without fee is hereby granted, provided that the above
12  * copyright notice and this permission notice appear in all copies.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21  */
22 
23 #ifndef _RT2860_REG_H
24 #define	_RT2860_REG_H
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 /* Device ID */
31 #define	PRODUCT_RALINK_RT2860		0x0601
32 #define	PRODUCT_RALINK_RT2890		0x0681
33 #define	PRODUCT_RALINK_RT2760		0x0701
34 #define	PRODUCT_RALINK_RT2790		0x0781
35 #define	PRODUCT_AWT_RT2890		0x1059
36 
37 /* PCI registers */
38 #define	RT2860_PCI_CFG			0x0000
39 #define	RT2860_PCI_EECTRL		0x0004
40 #define	RT2860_PCI_MCUCTRL		0x0008
41 #define	RT2860_PCI_SYSCTRL		0x000c
42 #define	RT2860_PCIE_JTAG		0x0010
43 
44 /* SCH/DMA registers */
45 #define	RT2860_INT_STATUS		0x0200
46 #define	RT2860_INT_MASK			0x0204
47 #define	RT2860_WPDMA_GLO_CFG		0x0208
48 #define	RT2860_WPDMA_RST_IDX		0x020c
49 #define	RT2860_DELAY_INT_CFG		0x0210
50 #define	RT2860_WMM_AIFSN_CFG		0x0214
51 #define	RT2860_WMM_CWMIN_CFG		0x0218
52 #define	RT2860_WMM_CWMAX_CFG		0x021c
53 #define	RT2860_WMM_TXOP0_CFG		0x0220
54 #define	RT2860_WMM_TXOP1_CFG		0x0224
55 #define	RT2860_GPIO_CTRL		0x0228
56 #define	RT2860_MCU_CMD_REG		0x022c
57 #define	RT2860_TX_BASE_PTR(qid)		(0x0230 + (qid) * 16)
58 #define	RT2860_TX_MAX_CNT(qid)		(0x0234 + (qid) * 16)
59 #define	RT2860_TX_CTX_IDX(qid)		(0x0238 + (qid) * 16)
60 #define	RT2860_TX_DTX_IDX(qid)		(0x023c + (qid) * 16)
61 #define	RT2860_RX_BASE_PTR		0x0290
62 #define	RT2860_RX_MAX_CNT		0x0294
63 #define	RT2860_RX_CALC_IDX		0x0298
64 #define	RT2860_FS_DRX_IDX		0x029c
65 #define	RT2860_US_CYC_CNT		0x02a4
66 
67 /* PBF registers */
68 #define	RT2860_SYS_CTRL			0x0400
69 #define	RT2860_HOST_CMD			0x0404
70 #define	RT2860_PBF_CFG			0x0408
71 #define	RT2860_MAX_PCNT			0x040c
72 #define	RT2860_BUF_CTRL			0x0410
73 #define	RT2860_MCU_INT_STA		0x0414
74 #define	RT2860_MCU_INT_ENA		0x0418
75 #define	RT2860_TXQ_IO(qid)		(0x041c + (qid) * 4)
76 #define	RT2860_RX0Q_IO			0x0424
77 #define	RT2860_BCN_OFFSET0		0x042c
78 #define	RT2860_BCN_OFFSET1		0x0430
79 #define	RT2860_TXRXQ_STA		0x0434
80 #define	RT2860_TXRXQ_PCNT		0x0438
81 #define	RT2860_PBF_DBG			0x043c
82 #define	RT2860_CAP_CTRL			0x0440
83 
84 /* MAC registers */
85 #define	RT2860_ASIC_VER_ID		0x1000
86 #define	RT2860_MAC_SYS_CTRL		0x1004
87 #define	RT2860_MAC_ADDR_DW0		0x1008
88 #define	RT2860_MAC_ADDR_DW1		0x100c
89 #define	RT2860_MAC_BSSID_DW0		0x1010
90 #define	RT2860_MAC_BSSID_DW1		0x1014
91 #define	RT2860_MAX_LEN_CFG		0x1018
92 #define	RT2860_BBP_CSR_CFG		0x101c
93 #define	RT2860_RF_CSR_CFG0		0x1020
94 #define	RT2860_RF_CSR_CFG1		0x1024
95 #define	RT2860_RF_CSR_CFG2		0x1028
96 #define	RT2860_LED_CFG			0x102c
97 
98 /* undocumented registers */
99 #define	RT2860_DEBUG			0x10f4
100 
101 /* MAC Timing control registers */
102 #define	RT2860_XIFS_TIME_CFG		0x1100
103 #define	RT2860_BKOFF_SLOT_CFG		0x1104
104 #define	RT2860_NAV_TIME_CFG		0x1108
105 #define	RT2860_CH_TIME_CFG		0x110c
106 #define	RT2860_PBF_LIFE_TIMER		0x1110
107 #define	RT2860_BCN_TIME_CFG		0x1114
108 #define	RT2860_TBTT_SYNC_CFG		0x1118
109 #define	RT2860_TSF_TIMER_DW0		0x111c
110 #define	RT2860_TSF_TIMER_DW1		0x1120
111 #define	RT2860_TBTT_TIMER		0x1124
112 #define	RT2860_INT_TIMER_CFG		0x1128
113 #define	RT2860_INT_TIMER_EN		0x112c
114 #define	RT2860_CH_IDLE_TIME		0x1130
115 
116 /* MAC Power Save configuration registers */
117 #define	RT2860_MAC_STATUS_REG		0x1200
118 #define	RT2860_PWR_PIN_CFG		0x1204
119 #define	RT2860_AUTO_WAKEUP_CFG		0x1208
120 
121 /* MAC TX configuration registers */
122 #define	RT2860_EDCA_AC_CFG(aci)		(0x1300 + (aci) * 4)
123 #define	RT2860_EDCA_TID_AC_MAP		0x1310
124 #define	RT2860_TX_PWR_CFG(ridx)		(0x1314 + (ridx) * 4)
125 #define	RT2860_TX_PIN_CFG		0x1328
126 #define	RT2860_TX_BAND_CFG		0x132c
127 #define	RT2860_TX_SW_CFG0		0x1330
128 #define	RT2860_TX_SW_CFG1		0x1334
129 #define	RT2860_TX_SW_CFG2		0x1338
130 #define	RT2860_TXOP_THRES_CFG		0x133c
131 #define	RT2860_TXOP_CTRL_CFG		0x1340
132 #define	RT2860_TX_RTS_CFG		0x1344
133 #define	RT2860_TX_TIMEOUT_CFG		0x1348
134 #define	RT2860_TX_RTY_CFG		0x134c
135 #define	RT2860_TX_LINK_CFG		0x1350
136 #define	RT2860_HT_FBK_CFG0		0x1354
137 #define	RT2860_HT_FBK_CFG1		0x1358
138 #define	RT2860_LG_FBK_CFG0		0x135c
139 #define	RT2860_LG_FBK_CFG1		0x1360
140 #define	RT2860_CCK_PROT_CFG		0x1364
141 #define	RT2860_OFDM_PROT_CFG		0x1368
142 #define	RT2860_MM20_PROT_CFG		0x136c
143 #define	RT2860_MM40_PROT_CFG		0x1370
144 #define	RT2860_GF20_PROT_CFG		0x1374
145 #define	RT2860_GF40_PROT_CFG		0x1378
146 #define	RT2860_EXP_CTS_TIME		0x137c
147 #define	RT2860_EXP_ACK_TIME		0x1380
148 
149 /* MAC RX configuration registers */
150 #define	RT2860_RX_FILTR_CFG		0x1400
151 #define	RT2860_AUTO_RSP_CFG		0x1404
152 #define	RT2860_LEGACY_BASIC_RATE	0x1408
153 #define	RT2860_HT_BASIC_RATE		0x140c
154 #define	RT2860_HT_CTRL_CFG		0x1410
155 #define	RT2860_SIFS_COST_CFG		0x1414
156 #define	RT2860_RX_PARSER_CFG		0x1418
157 
158 /* MAC Security configuration registers */
159 #define	RT2860_TX_SEC_CNT0		0x1500
160 #define	RT2860_RX_SEC_CNT0		0x1504
161 #define	RT2860_CCMP_FC_MUTE		0x1508
162 
163 /* MAC HCCA/PSMP configuration registers */
164 #define	RT2860_TXOP_HLDR_ADDR0		0x1600
165 #define	RT2860_TXOP_HLDR_ADDR1		0x1604
166 #define	RT2860_TXOP_HLDR_ET		0x1608
167 #define	RT2860_QOS_CFPOLL_RA_DW0	0x160c
168 #define	RT2860_QOS_CFPOLL_A1_DW1	0x1610
169 #define	RT2860_QOS_CFPOLL_QC		0x1614
170 
171 /* MAC Statistics Counters */
172 #define	RT2860_RX_STA_CNT0		0x1700
173 #define	RT2860_RX_STA_CNT1		0x1704
174 #define	RT2860_RX_STA_CNT2		0x1708
175 #define	RT2860_TX_STA_CNT0		0x170c
176 #define	RT2860_TX_STA_CNT1		0x1710
177 #define	RT2860_TX_STA_CNT2		0x1714
178 #define	RT2860_TX_STAT_FIFO		0x1718
179 
180 /* RX WCID search table */
181 #define	RT2860_WCID_ENTRY(wcid)		(0x1800 + (wcid) * 8)
182 
183 #define	RT2860_FW_BASE			0x2000
184 
185 /* Pair-wise key table */
186 #define	RT2860_PKEY(wcid)		(0x4000 + (wcid) * 32)
187 
188 /* IV/EIV table */
189 #define	RT2860_IVEIV(wcid)		(0x6000 + (wcid) * 8)
190 
191 /* WCID attribute table */
192 #define	RT2860_WCID_ATTR(wcid)		(0x6800 + (wcid) * 4)
193 
194 /* Shared Key Table */
195 #define	RT2860_SKEY(vap, kidx)		(0x6c00 + (vap) * 128 + (kidx) * 32)
196 
197 /* Shared Key Mode */
198 #define	RT2860_SKEY_MODE_0_7		0x7000
199 #define	RT2860_SKEY_MODE_8_15		0x7004
200 #define	RT2860_SKEY_MODE_16_23		0x7008
201 #define	RT2860_SKEY_MODE_24_31		0x700c
202 
203 /* Shared Memory between MCU and host */
204 #define	RT2860_H2M_MAILBOX		0x7010
205 #define	RT2860_H2M_BBPAGENT		0x7028
206 #define	RT2860_BCN_BASE(vap)		(0x7800 + (vap) * 512)
207 
208 /* possible flags for register RT2860_PCI_EECTRL */
209 #define	RT2860_C	(1 << 0)
210 #define	RT2860_S	(1 << 1)
211 #define	RT2860_D	(1 << 2)
212 #define	RT2860_SHIFT_D	2
213 #define	RT2860_Q	(1 << 3)
214 #define	RT2860_SHIFT_Q	3
215 
216 /* possible flags for registers INT_STATUS/INT_MASK */
217 #define	RT2860_TX_COHERENT	(1 << 17)
218 #define	RT2860_RX_COHERENT	(1 << 16)
219 #define	RT2860_MAC_INT_4	(1 << 15)
220 #define	RT2860_MAC_INT_3	(1 << 14)
221 #define	RT2860_MAC_INT_2	(1 << 13)
222 #define	RT2860_MAC_INT_1	(1 << 12)
223 #define	RT2860_MAC_INT_0	(1 << 11)
224 #define	RT2860_TX_RX_COHERENT	(1 << 10)
225 #define	RT2860_MCU_CMD_INT	(1 <<  9)
226 #define	RT2860_TX_DONE_INT5	(1 <<  8)
227 #define	RT2860_TX_DONE_INT4	(1 <<  7)
228 #define	RT2860_TX_DONE_INT3	(1 <<  6)
229 #define	RT2860_TX_DONE_INT2	(1 <<  5)
230 #define	RT2860_TX_DONE_INT1	(1 <<  4)
231 #define	RT2860_TX_DONE_INT0	(1 <<  3)
232 #define	RT2860_RX_DONE_INT	(1 <<  2)
233 #define	RT2860_TX_DLY_INT	(1 <<  1)
234 #define	RT2860_RX_DLY_INT	(1 <<  0)
235 
236 /* possible flags for register WPDMA_GLO_CFG */
237 #define	RT2860_HDR_SEG_LEN_SHIFT	8
238 #define	RT2860_BIG_ENDIAN		(1 << 7)
239 #define	RT2860_TX_WB_DDONE		(1 << 6)
240 #define	RT2860_WPDMA_BT_SIZE_SHIFT	4
241 #define	RT2860_WPDMA_BT_SIZE16		0
242 #define	RT2860_WPDMA_BT_SIZE32		1
243 #define	RT2860_WPDMA_BT_SIZE64		2
244 #define	RT2860_WPDMA_BT_SIZE128		3
245 #define	RT2860_RX_DMA_BUSY		(1 << 3)
246 #define	RT2860_RX_DMA_EN		(1 << 2)
247 #define	RT2860_TX_DMA_BUSY		(1 << 1)
248 #define	RT2860_TX_DMA_EN		(1 << 0)
249 
250 /* possible flags for register DELAY_INT_CFG */
251 #define	RT2860_TXDLY_INT_EN		(1 << 31)
252 #define	RT2860_TXMAX_PINT_SHIFT		24
253 #define	RT2860_TXMAX_PTIME_SHIFT	16
254 #define	RT2860_RXDLY_INT_EN		(1 << 15)
255 #define	RT2860_RXMAX_PINT_SHIFT		8
256 #define	RT2860_RXMAX_PTIME_SHIFT	0
257 
258 /* possible flags for register GPIO_CTRL */
259 #define	RT2860_GPIO_D_SHIFT	8
260 #define	RT2860_GPIO_O_SHIFT	0
261 
262 /* possible flags for register US_CYC_CNT */
263 #define	RT2860_TEST_EN		(1 << 24)
264 #define	RT2860_TEST_SEL_SHIFT	16
265 #define	RT2860_BT_MODE_EN	(1 <<  8)
266 #define	RT2860_US_CYC_CNT_SHIFT	0
267 
268 /* possible flags for register SYS_CTRL */
269 #define	RT2860_HST_PM_SEL	(1 << 16)
270 #define	RT2860_CAP_MODE		(1 << 14)
271 #define	RT2860_PME_OEN		(1 << 13)
272 #define	RT2860_CLKSELECT	(1 << 12)
273 #define	RT2860_PBF_CLK_EN	(1 << 11)
274 #define	RT2860_MAC_CLK_EN	(1 << 10)
275 #define	RT2860_DMA_CLK_EN	(1 <<  9)
276 #define	RT2860_MCU_READY	(1 <<  7)
277 #define	RT2860_ASY_RESET	(1 <<  4)
278 #define	RT2860_PBF_RESET	(1 <<  3)
279 #define	RT2860_MAC_RESET	(1 <<  2)
280 #define	RT2860_DMA_RESET	(1 <<  1)
281 #define	RT2860_MCU_RESET	(1 <<  0)
282 
283 /* possible values for register HOST_CMD */
284 #define	RT2860_MCU_CMD_SLEEP	0x30
285 #define	RT2860_MCU_CMD_WAKEUP	0x31
286 #define	RT2860_MCU_CMD_LEDS	0x50
287 #define	RT2860_MCU_CMD_LED_RSSI	0x51
288 #define	RT2860_MCU_CMD_LED1	0x52
289 #define	RT2860_MCU_CMD_LED2	0x53
290 #define	RT2860_MCU_CMD_LED3	0x54
291 #define	RT2860_MCU_CMD_BOOT	0x72
292 #define	RT2860_MCU_CMD_BBP	0x80
293 #define	RT2860_MCU_CMD_PSLEVEL	0x83
294 
295 /* possible flags for register PBF_CFG */
296 #define	RT2860_TX1Q_NUM_SHIFT	21
297 #define	RT2860_TX2Q_NUM_SHIFT	16
298 #define	RT2860_NULL0_MODE	(1 << 15)
299 #define	RT2860_NULL1_MODE	(1 << 14)
300 #define	RT2860_RX_DROP_MODE	(1 << 13)
301 #define	RT2860_TX0Q_MANUAL	(1 << 12)
302 #define	RT2860_TX1Q_MANUAL	(1 << 11)
303 #define	RT2860_TX2Q_MANUAL	(1 << 10)
304 #define	RT2860_RX0Q_MANUAL	(1 <<  9)
305 #define	RT2860_HCCA_EN		(1 <<  8)
306 #define	RT2860_TX0Q_EN		(1 <<  4)
307 #define	RT2860_TX1Q_EN		(1 <<  3)
308 #define	RT2860_TX2Q_EN		(1 <<  2)
309 #define	RT2860_RX0Q_EN		(1 <<  1)
310 
311 /* possible flags for register BUF_CTRL */
312 #define	RT2860_WRITE_TXQ(qid)	(1 << (11 - (qid)))
313 #define	RT2860_NULL0_KICK	(1 << 7)
314 #define	RT2860_NULL1_KICK	(1 << 6)
315 #define	RT2860_BUF_RESET	(1 << 5)
316 #define	RT2860_READ_TXQ(qid)	(1 << (3 - (qid))
317 #define	RT2860_READ_RX0Q	(1 << 0)
318 
319 /* possible flags for registers MCU_INT_STA/MCU_INT_ENA */
320 #define	RT2860_MCU_MAC_INT_8	(1 << 24)
321 #define	RT2860_MCU_MAC_INT_7	(1 << 23)
322 #define	RT2860_MCU_MAC_INT_6	(1 << 22)
323 #define	RT2860_MCU_MAC_INT_4	(1 << 20)
324 #define	RT2860_MCU_MAC_INT_3	(1 << 19)
325 #define	RT2860_MCU_MAC_INT_2	(1 << 18)
326 #define	RT2860_MCU_MAC_INT_1	(1 << 17)
327 #define	RT2860_MCU_MAC_INT_0	(1 << 16)
328 #define	RT2860_DTX0_INT		(1 << 11)
329 #define	RT2860_DTX1_INT		(1 << 10)
330 #define	RT2860_DTX2_INT		(1 <<  9)
331 #define	RT2860_DRX0_INT		(1 <<  8)
332 #define	RT2860_HCMD_INT		(1 <<  7)
333 #define	RT2860_N0TX_INT		(1 <<  6)
334 #define	RT2860_N1TX_INT		(1 <<  5)
335 #define	RT2860_BCNTX_INT	(1 <<  4)
336 #define	RT2860_MTX0_INT		(1 <<  3)
337 #define	RT2860_MTX1_INT		(1 <<  2)
338 #define	RT2860_MTX2_INT		(1 <<  1)
339 #define	RT2860_MRX0_INT		(1 <<  0)
340 
341 /* possible flags for register CAP_CTRL */
342 #define	RT2860_CAP_ADC_FEQ		(1 << 31)
343 #define	RT2860_CAP_START		(1 << 30)
344 #define	RT2860_MAN_TRIG			(1 << 29)
345 #define	RT2860_TRIG_OFFSET_SHIFT	16
346 #define	RT2860_START_ADDR_SHIFT		0
347 
348 /* possible flags for register MAC_SYS_CTRL */
349 #define	RT2860_RX_TS_EN		(1 << 7)
350 #define	RT2860_WLAN_HALT_EN	(1 << 6)
351 #define	RT2860_PBF_LOOP_EN	(1 << 5)
352 #define	RT2860_CONT_TX_TEST	(1 << 4)
353 #define	RT2860_MAC_RX_EN	(1 << 3)
354 #define	RT2860_MAC_TX_EN	(1 << 2)
355 #define	RT2860_BBP_HRST		(1 << 1)
356 #define	RT2860_MAC_SRST		(1 << 0)
357 
358 /* possible flags for register MAC_BSSID_DW1 */
359 #define	RT2860_MULTI_BCN_NUM_SHIFT	18
360 #define	RT2860_MULTI_BSSID_MODE_SHIFT	16
361 
362 /* possible flags for register MAX_LEN_CFG */
363 #define	RT2860_MIN_MPDU_LEN_SHIFT	16
364 #define	RT2860_MAX_PSDU_LEN_SHIFT	12
365 #define	RT2860_MAX_PSDU_LEN8K		0
366 #define	RT2860_MAX_PSDU_LEN16K		1
367 #define	RT2860_MAX_PSDU_LEN32K		2
368 #define	RT2860_MAX_PSDU_LEN64K		3
369 #define	RT2860_MAX_MPDU_LEN_SHIFT	0
370 
371 /* possible flags for registers BBP_CSR_CFG/H2M_BBPAGENT */
372 #define	RT2860_BBP_RW_PARALLEL		(1 << 19)
373 #define	RT2860_BBP_PAR_DUR_112_5	(1 << 18)
374 #define	RT2860_BBP_CSR_KICK		(1 << 17)
375 #define	RT2860_BBP_CSR_READ		(1 << 16)
376 #define	RT2860_BBP_ADDR_SHIFT		8
377 #define	RT2860_BBP_DATA_SHIFT		0
378 
379 /* possible flags for register RF_CSR_CFG0 */
380 #define	RT2860_RF_REG_CTRL		((uint32_t)1 << 31)
381 #define	RT2860_RF_LE_SEL1		(1 << 30)
382 #define	RT2860_RF_LE_STBY		(1 << 29)
383 #define	RT2860_RF_REG_WIDTH_SHIFT	24
384 #define	RT2860_RF_REG_0_SHIFT		0
385 
386 /* possible flags for register RF_CSR_CFG1 */
387 #define	RT2860_RF_DUR_5		(1 << 24)
388 #define	RT2860_RF_REG_1_SHIFT	0
389 
390 /* possible flags for register LED_CFG */
391 #define	RT2860_LED_POL			(1 << 30)
392 #define	RT2860_Y_LED_MODE_SHIFT		28
393 #define	RT2860_G_LED_MODE_SHIFT		26
394 #define	RT2860_R_LED_MODE_SHIFT		24
395 #define	RT2860_LED_MODE_OFF		0
396 #define	RT2860_LED_MODE_BLINK_TX	1
397 #define	RT2860_LED_MODE_SLOW_BLINK	2
398 #define	RT2860_LED_MODE_ON		3
399 #define	RT2860_SLOW_BLK_TIME_SHIFT	16
400 #define	RT2860_LED_OFF_TIME_SHIFT	8
401 #define	RT2860_LED_ON_TIME_SHIFT	0
402 
403 /* possible flags for register XIFS_TIME_CFG */
404 #define	RT2860_BB_RXEND_EN		(1 << 29)
405 #define	RT2860_EIFS_TIME_SHIFT		20
406 #define	RT2860_OFDM_XIFS_TIME_SHIFT	16
407 #define	RT2860_OFDM_SIFS_TIME_SHIFT	8
408 #define	RT2860_CCK_SIFS_TIME_SHIFT	0
409 
410 /* possible flags for register BKOFF_SLOT_CFG */
411 #define	RT2860_CC_DELAY_TIME_SHIFT	8
412 #define	RT2860_SLOT_TIME		0
413 
414 /* possible flags for register NAV_TIME_CFG */
415 #define	RT2860_NAV_UPD			(1 << 31)
416 #define	RT2860_NAV_UPD_VAL_SHIFT	16
417 #define	RT2860_NAV_CLR_EN		(1 << 15)
418 #define	RT2860_NAV_TIMER_SHIFT		0
419 
420 /* possible flags for register CH_TIME_CFG */
421 #define	RT2860_EIFS_AS_CH_BUSY	(1 << 4)
422 #define	RT2860_NAV_AS_CH_BUSY	(1 << 3)
423 #define	RT2860_RX_AS_CH_BUSY	(1 << 2)
424 #define	RT2860_TX_AS_CH_BUSY	(1 << 1)
425 #define	RT2860_CH_STA_TIMER_EN	(1 << 0)
426 
427 /* possible values for register BCN_TIME_CFG */
428 #define	RT2860_TSF_INS_COMP_SHIFT	24
429 #define	RT2860_BCN_TX_EN		(1 << 20)
430 #define	RT2860_TBTT_TIMER_EN		(1 << 19)
431 #define	RT2860_TSF_SYNC_MODE_SHIFT	17
432 #define	RT2860_TSF_SYNC_MODE_DIS	0
433 #define	RT2860_TSF_SYNC_MODE_STA	1
434 #define	RT2860_TSF_SYNC_MODE_IBSS	2
435 #define	RT2860_TSF_SYNC_MODE_HOSTAP	3
436 #define	RT2860_TSF_TIMER_EN		(1 << 16)
437 #define	RT2860_BCN_INTVAL_SHIFT		0
438 
439 /* possible flags for register TBTT_SYNC_CFG */
440 #define	RT2860_BCN_CWMIN_SHIFT		20
441 #define	RT2860_BCN_AIFSN_SHIFT		16
442 #define	RT2860_BCN_EXP_WIN_SHIFT	8
443 #define	RT2860_TBTT_ADJUST_SHIFT	0
444 
445 /* possible flags for register INT_TIMER_CFG */
446 #define	RT2860_GP_TIMER_SHIFT		16
447 #define	RT2860_PRE_TBTT_TIMER_SHIFT	0
448 
449 /* possible flags for register INT_TIMER_EN */
450 #define	RT2860_GP_TIMER_EN	(1 << 1)
451 #define	RT2860_PRE_TBTT_INT_EN	(1 << 0)
452 
453 /* possible flags for register MAC_STATUS_REG */
454 #define	RT2860_RX_STATUS_BUSY	(1 << 1)
455 #define	RT2860_TX_STATUS_BUSY	(1 << 0)
456 
457 /* possible flags for register PWR_PIN_CFG */
458 #define	RT2860_IO_ADDA_PD	(1 << 3)
459 #define	RT2860_IO_PLL_PD	(1 << 2)
460 #define	RT2860_IO_RA_PE		(1 << 1)
461 #define	RT2860_IO_RF_PE		(1 << 0)
462 
463 /* possible flags for register AUTO_WAKEUP_CFG */
464 #define	RT2860_AUTO_WAKEUP_EN		(1 << 15)
465 #define	RT2860_SLEEP_TBTT_NUM_SHIFT	8
466 #define	RT2860_WAKEUP_LEAD_TIME_SHIFT	0
467 
468 /* possible flags for register TX_PIN_CFG */
469 #define	RT2860_TRSW_POL		(1 << 19)
470 #define	RT2860_TRSW_EN		(1 << 18)
471 #define	RT2860_RFTR_POL		(1 << 17)
472 #define	RT2860_RFTR_EN		(1 << 16)
473 #define	RT2860_LNA_PE_G1_POL	(1 << 15)
474 #define	RT2860_LNA_PE_A1_POL	(1 << 14)
475 #define	RT2860_LNA_PE_G0_POL	(1 << 13)
476 #define	RT2860_LNA_PE_A0_POL	(1 << 12)
477 #define	RT2860_LNA_PE_G1_EN	(1 << 11)
478 #define	RT2860_LNA_PE_A1_EN	(1 << 10)
479 #define	RT2860_LNA_PE_G0_EN	(1 <<  9)
480 #define	RT2860_LNA_PE_A0_EN	(1 <<  8)
481 #define	RT2860_PA_PE_G1_POL	(1 <<  7)
482 #define	RT2860_PA_PE_A1_POL	(1 <<  6)
483 #define	RT2860_PA_PE_G0_POL	(1 <<  5)
484 #define	RT2860_PA_PE_A0_POL	(1 <<  4)
485 #define	RT2860_PA_PE_G1_EN	(1 <<  3)
486 #define	RT2860_PA_PE_A1_EN	(1 <<  2)
487 #define	RT2860_PA_PE_G0_EN	(1 <<  1)
488 #define	RT2860_PA_PE_A0_EN	(1 <<  0)
489 
490 /* possible flags for register TX_BAND_CFG */
491 #define	RT2860_5G_BAND_SEL_N	(1 << 2)
492 #define	RT2860_5G_BAND_SEL_P	(1 << 1)
493 #define	RT2860_TX_BAND_SEL	(1 << 0)
494 
495 /* possible flags for register TX_SW_CFG0 */
496 #define	RT2860_DLY_RFTR_EN_SHIFT	24
497 #define	RT2860_DLY_TRSW_EN_SHIFT	16
498 #define	RT2860_DLY_PAPE_EN_SHIFT	8
499 #define	RT2860_DLY_TXPE_EN_SHIFT	0
500 
501 /* possible flags for register TX_SW_CFG1 */
502 #define	RT2860_DLY_RFTR_DIS_SHIFT	16
503 #define	RT2860_DLY_TRSW_DIS_SHIFT	8
504 #define	RT2860_DLY_PAPE_DIS SHIFT	0
505 
506 /* possible flags for register TX_SW_CFG2 */
507 #define	RT2860_DLY_LNA_EN_SHIFT		24
508 #define	RT2860_DLY_LNA_DIS_SHIFT	16
509 #define	RT2860_DLY_DAC_EN_SHIFT		8
510 #define	RT2860_DLY_DAC_DIS_SHIFT	0
511 
512 /* possible flags for register TXOP_THRES_CFG */
513 #define	RT2860_TXOP_REM_THRES_SHIFT	24
514 #define	RT2860_CF_END_THRES_SHIFT	16
515 #define	RT2860_RDG_IN_THRES		8
516 #define	RT2860_RDG_OUT_THRES		0
517 
518 /* possible flags for register TXOP_CTRL_CFG */
519 #define	RT2860_EXT_CW_MIN_SHIFT		16
520 #define	RT2860_EXT_CCA_DLY_SHIFT	8
521 #define	RT2860_EXT_CCA_EN		(1 << 7)
522 #define	RT2860_LSIG_TXOP_EN		(1 << 6)
523 #define	RT2860_TXOP_TRUN_EN_MIMOPS	(1 << 4)
524 #define	RT2860_TXOP_TRUN_EN_TXOP	(1 << 3)
525 #define	RT2860_TXOP_TRUN_EN_RATE	(1 << 2)
526 #define	RT2860_TXOP_TRUN_EN_AC		(1 << 1)
527 #define	RT2860_TXOP_TRUN_EN_TIMEOUT	(1 << 0)
528 
529 /* possible flags for register TX_RTS_CFG */
530 #define	RT2860_RTS_FBK_EN		(1 << 24)
531 #define	RT2860_RTS_THRES_SHIFT		8
532 #define	RT2860_RTS_RTY_LIMIT_SHIFT	0
533 
534 /* possible flags for register TX_TIMEOUT_CFG */
535 #define	RT2860_TXOP_TIMEOUT_SHIFT	16
536 #define	RT2860_RX_ACK_TIMEOUT_SHIFT	8
537 #define	RT2860_MPDU_LIFE_TIME_SHIFT	4
538 
539 /* possible flags for register TX_RTY_CFG */
540 #define	RT2860_TX_AUTOFB_EN		(1 << 30)
541 #define	RT2860_AGG_RTY_MODE_TIMER	(1 << 29)
542 #define	RT2860_NAG_RTY_MODE_TIMER	(1 << 28)
543 #define	RT2860_LONG_RTY_THRES_SHIFT	16
544 #define	RT2860_LONG_RTY_LIMIT_SHIFT	8
545 #define	RT2860_SHORT_RTY_LIMIT_SHIFT	0
546 
547 /* possible flags for register TX_LINK_CFG */
548 #define	RT2860_REMOTE_MFS_SHIFT		24
549 #define	RT2860_REMOTE_MFB_SHIFT		16
550 #define	RT2860_TX_CFACK_EN		(1 << 12)
551 #define	RT2860_TX_RDG_EN		(1 << 11)
552 #define	RT2860_TX_MRQ_EN		(1 << 10)
553 #define	RT2860_REMOTE_UMFS_EN		(1 <<  9)
554 #define	RT2860_TX_MFB_EN		(1 <<  8)
555 #define	RT2860_REMOTE_MFB_LT_SHIFT	0
556 
557 /* possible flags for registers *_PROT_CFG */
558 #define	RT2860_RTSTH_EN			(1 << 26)
559 #define	RT2860_TXOP_ALLOW_GF40		(1 << 25)
560 #define	RT2860_TXOP_ALLOW_GF20		(1 << 24)
561 #define	RT2860_TXOP_ALLOW_MM40		(1 << 23)
562 #define	RT2860_TXOP_ALLOW_MM20		(1 << 22)
563 #define	RT2860_TXOP_ALLOW_OFDM		(1 << 21)
564 #define	RT2860_TXOP_ALLOW_CCK		(1 << 20)
565 #define	RT2860_TXOP_ALLOW_ALL		(0x3f << 20)
566 #define	RT2860_PROT_NAV_SHORT		(1 << 18)
567 #define	RT2860_PROT_NAV_LONG		(2 << 18)
568 #define	RT2860_PROT_CTRL_RTS_CTS	(1 << 16)
569 #define	RT2860_PROT_CTRL_CTS		(2 << 16)
570 
571 /* possible flags for registers EXP_{CTS,ACK}_TIME */
572 #define	RT2860_EXP_OFDM_TIME_SHIFT	16
573 #define	RT2860_EXP_CCK_TIME_SHIFT	0
574 
575 /* possible flags for register RX_FILTR_CFG */
576 #define	RT2860_DROP_CTRL_RSV	(1 << 16)
577 #define	RT2860_DROP_BAR		(1 << 15)
578 #define	RT2860_DROP_BA		(1 << 14)
579 #define	RT2860_DROP_PSPOLL	(1 << 13)
580 #define	RT2860_DROP_RTS		(1 << 12)
581 #define	RT2860_DROP_CTS		(1 << 11)
582 #define	RT2860_DROP_ACK		(1 << 10)
583 #define	RT2860_DROP_CFEND	(1 <<  9)
584 #define	RT2860_DROP_CFACK	(1 <<  8)
585 #define	RT2860_DROP_DUPL	(1 <<  7)
586 #define	RT2860_DROP_BC		(1 <<  6)
587 #define	RT2860_DROP_MC		(1 <<  5)
588 #define	RT2860_DROP_VER_ERR	(1 <<  4)
589 #define	RT2860_DROP_NOT_MYBSS	(1 <<  3)
590 #define	RT2860_DROP_UC_NOME	(1 <<  2)
591 #define	RT2860_DROP_PHY_ERR	(1 <<  1)
592 #define	RT2860_DROP_CRC_ERR	(1 <<  0)
593 
594 /* possible flags for register AUTO_RSP_CFG */
595 #define	RT2860_CTRL_PWR_BIT	(1 << 7)
596 #define	RT2860_BAC_ACK_POLICY	(1 << 6)
597 #define	RT2860_CCK_SHORT_EN	(1 << 4)
598 #define	RT2860_CTS_40M_REF_EN	(1 << 3)
599 #define	RT2860_CTS_40M_MODE_EN	(1 << 2)
600 #define	RT2860_BAC_ACKPOLICY_EN	(1 << 1)
601 #define	RT2860_AUTO_RSP_EN	(1 << 0)
602 
603 /* possible flags for register SIFS_COST_CFG */
604 #define	RT2860_OFDM_SIFS_COST_SHIFT	8
605 #define	RT2860_CCK_SIFS_COST_SHIFT	0
606 
607 /* possible flags for register TXOP_HLDR_ET */
608 #define	RT2860_TXOP_ETM1_EN		(1 << 25)
609 #define	RT2860_TXOP_ETM0_EN		(1 << 24)
610 #define	RT2860_TXOP_ETM_THRES_SHIFT	16
611 #define	RT2860_TXOP_ETO_EN		(1 <<  8)
612 #define	RT2860_TXOP_ETO_THRES_SHIFT	1
613 #define	RT2860_PER_RX_RST_EN		(1 <<  0)
614 
615 /* possible flags for register TX_STAT_FIFO */
616 #define	RT2860_TXQ_MCS_SHIFT	16
617 #define	RT2860_TXQ_WCID_SHIFT	8
618 #define	RT2860_TXQ_ACKREQ	(1 << 7)
619 #define	RT2860_TXQ_AGG		(1 << 6)
620 #define	RT2860_TXQ_OK		(1 << 5)
621 #define	RT2860_TXQ_PID_SHIFT	1
622 #define	RT2860_TXQ_VLD		(1 << 0)
623 
624 /* possible flags for register WCID_ATTR */
625 #define	RT2860_MODE_NOSEC	0
626 #define	RT2860_MODE_WEP40	1
627 #define	RT2860_MODE_WEP104	2
628 #define	RT2860_MODE_TKIP	3
629 #define	RT2860_MODE_AES_CCMP	4
630 #define	RT2860_MODE_CKIP40	5
631 #define	RT2860_MODE_CKIP104	6
632 #define	RT2860_MODE_CKIP128	7
633 #define	RT2860_RX_PKEY_EN	(1 << 0)
634 
635 /* possible flags for register H2M_MAILBOX */
636 #define	RT2860_H2M_BUSY		(1 << 24)
637 #define	RT2860_TOKEN_NO_INTR	0xff
638 
639 /* possible flags for MCU command RT2860_MCU_CMD_LEDS */
640 #define	RT2860_LED_RADIO	(1 << 13)
641 #define	RT2860_LED_LINK_2GHZ	(1 << 14)
642 #define	RT2860_LED_LINK_5GHZ	(1 << 15)
643 
644 #pragma pack(1)
645 /* TX descriptor */
646 struct rt2860_txd {
647 	uint32_t	sdp0;		/* Segment Data Pointer 0 */
648 	uint16_t	sdl1;		/* Segment Data Length 1 */
649 #define	RT2860_TX_BURST	(1 << 15)
650 #define	RT2860_TX_LS1	(1 << 14)	/* SDP1 is the last segment */
651 
652 	uint16_t	sdl0;		/* Segment Data Length 0 */
653 #define	RT2860_TX_DDONE	(1 << 15)
654 #define	RT2860_TX_LS0	(1 << 14)	/* SDP0 is the last segment */
655 
656 	uint32_t	sdp1;		/* Segment Data Pointer 1 */
657 	uint8_t		reserved[3];
658 	uint8_t		flags;
659 #define	RT2860_TX_QSEL_SHIFT	1
660 #define	RT2860_TX_QSEL_MGMT	(0 << 1)
661 #define	RT2860_TX_QSEL_HCCA	(1 << 1)
662 #define	RT2860_TX_QSEL_EDCA	(2 << 1)
663 #define	RT2860_TX_WIV		(1 << 0)
664 };
665 #pragma pack()
666 
667 #pragma pack(1)
668 /* TX Wireless Information */
669 struct rt2860_txwi {
670 	uint8_t		flags;
671 #define	RT2860_TX_MPDU_DSITY_SHIFT	5
672 #define	RT2860_TX_AMPDU			(1 << 4)
673 #define	RT2860_TX_TS			(1 << 3)
674 #define	RT2860_TX_CFACK			(1 << 2)
675 #define	RT2860_TX_MMPS			(1 << 1)
676 #define	RT2860_TX_FRAG			(1 << 0)
677 
678 	uint8_t		txop;
679 #define	RT2860_TX_TXOP_HT	0
680 #define	RT2860_TX_TXOP_PIFS	1
681 #define	RT2860_TX_TXOP_SIFS	2
682 #define	RT2860_TX_TXOP_BACKOFF	3
683 
684 	uint16_t	phy;
685 #define	RT2860_PHY_MODE		0xc000
686 #define	RT2860_PHY_CCK		(0 << 14)
687 #define	RT2860_PHY_OFDM		(1 << 14)
688 #define	RT2860_PHY_HT		(2 << 14)
689 #define	RT2860_PHY_HT_GF	(3 << 14)
690 #define	RT2860_PHY_SGI		(1 << 8)
691 #define	RT2860_PHY_BW40		(1 << 7)
692 #define	RT2860_PHY_MCS		0x7f
693 #define	RT2860_PHY_SHPRE	(1 << 3)
694 
695 	uint8_t		xflags;
696 #define	RT2860_TX_BAWINSIZE_SHIFT	2
697 #define	RT2860_TX_NSEQ			(1 << 1)
698 #define	RT2860_TX_ACK			(1 << 0)
699 
700 	uint8_t		wcid;	/* Wireless Client ID */
701 	uint16_t	len;
702 #define	RT2860_TX_PID_SHIFT	12
703 
704 	uint32_t	iv;
705 	uint32_t	eiv;
706 
707 	struct		ieee80211_frame wh;
708 	uint16_t	pad;
709 };
710 #pragma pack()
711 
712 #pragma pack(1)
713 /* RX descriptor */
714 struct rt2860_rxd {
715 	uint32_t	sdp0;
716 	uint16_t	sdl1;	/* unused */
717 	uint16_t	sdl0;
718 #define	RT2860_RX_DDONE	(1 << 15)
719 #define	RT2860_RX_LS0	(1 << 14)
720 
721 	uint32_t	sdp1;	/* unused */
722 	uint32_t	flags;
723 #define	RT2860_RX_DEC		(1 << 16)
724 #define	RT2860_RX_AMPDU		(1 << 15)
725 #define	RT2860_RX_L2PAD		(1 << 14)
726 #define	RT2860_RX_RSSI		(1 << 13)
727 #define	RT2860_RX_HTC		(1 << 12)
728 #define	RT2860_RX_AMSDU		(1 << 11)
729 #define	RT2860_RX_MICERR	(1 << 10)
730 #define	RT2860_RX_ICVERR	(1 <<  9)
731 #define	RT2860_RX_CRCERR	(1 <<  8)
732 #define	RT2860_RX_MYBSS		(1 <<  7)
733 #define	RT2860_RX_BC		(1 <<  6)
734 #define	RT2860_RX_MC		(1 <<  5)
735 #define	RT2860_RX_UC2ME		(1 <<  4)
736 #define	RT2860_RX_FRAG		(1 <<  3)
737 #define	RT2860_RX_NULL		(1 <<  2)
738 #define	RT2860_RX_DATA		(1 <<  1)
739 #define	RT2860_RX_BA		(1 <<  0)
740 };
741 #pragma pack()
742 
743 #pragma pack(1)
744 /* RX Wireless Information */
745 struct rt2860_rxwi {
746 	uint8_t		wcid;
747 	uint8_t		keyidx;
748 #define	RT2860_RX_UDF_SHIFT	5
749 #define	RT2860_RX_BSS_IDX_SHIFT	2
750 
751 	uint16_t	len;
752 #define	RT2860_RX_TID_SHIFT	12
753 
754 	uint16_t	seq;
755 	uint16_t	phy;
756 	uint8_t		rssi[3];
757 	uint8_t		reserved1;
758 	uint8_t		snr[2];
759 	uint16_t	reserved2;
760 };
761 #pragma pack()
762 
763 #define	RAL_RF1	0
764 #define	RAL_RF2	2
765 #define	RAL_RF3	1
766 #define	RAL_RF4	3
767 
768 #define	RT2860_RF_2820			1	/* 2T3R */
769 #define	RT2860_RF_2850			2	/* dual-band 2T3R */
770 #define	RT2860_RF_2720			3	/* 1T2R */
771 #define	RT2860_RF_2750			4	/* dual-band 1T2R */
772 
773 #define	RT2860_EEPROM_DELAY	1	/* minimum hold time (microsecond) */
774 
775 #define	RT2860_EEPROM_VERSION		0x01
776 #define	RT2860_EEPROM_MAC01		0x02
777 #define	RT2860_EEPROM_MAC23		0x03
778 #define	RT2860_EEPROM_MAC45		0x04
779 #define	RT2860_EEPROM_PCIE_PSLEVEL	0x11
780 #define	RT2860_EEPROM_REV		0x12
781 #define	RT2860_EEPROM_ANTENNA		0x1a
782 #define	RT2860_EEPROM_CONFIG		0x1b
783 #define	RT2860_EEPROM_COUNTRY		0x1c
784 #define	RT2860_EEPROM_FREQ_LEDS		0x1d
785 #define	RT2860_EEPROM_LED1		0x1e
786 #define	RT2860_EEPROM_LED2		0x1f
787 #define	RT2860_EEPROM_LED3		0x20
788 #define	RT2860_EEPROM_LNA		0x22
789 #define	RT2860_EEPROM_RSSI1_2GHZ	0x23
790 #define	RT2860_EEPROM_RSSI2_2GHZ	0x24
791 #define	RT2860_EEPROM_RSSI1_5GHZ	0x25
792 #define	RT2860_EEPROM_RSSI2_5GHZ	0x26
793 #define	RT2860_EEPROM_DELTAPWR		0x28
794 #define	RT2860_EEPROM_PWR2GHZ_BASE1	0x29
795 #define	RT2860_EEPROM_PWR2GHZ_BASE2	0x30
796 #define	RT2860_EEPROM_TSSI1_2GHZ	0x37
797 #define	RT2860_EEPROM_TSSI2_2GHZ	0x38
798 #define	RT2860_EEPROM_TSSI3_2GHZ	0x39
799 #define	RT2860_EEPROM_TSSI4_2GHZ	0x3a
800 #define	RT2860_EEPROM_TSSI5_2GHZ	0x3b
801 #define	RT2860_EEPROM_PWR5GHZ_BASE1	0x3c
802 #define	RT2860_EEPROM_PWR5GHZ_BASE2	0x53
803 #define	RT2860_EEPROM_TSSI1_5GHZ	0x6a
804 #define	RT2860_EEPROM_TSSI2_5GHZ	0x6b
805 #define	RT2860_EEPROM_TSSI3_5GHZ	0x6c
806 #define	RT2860_EEPROM_TSSI4_5GHZ	0x6d
807 #define	RT2860_EEPROM_TSSI5_5GHZ	0x6e
808 #define	RT2860_EEPROM_RPWR		0x6f
809 #define	RT2860_EEPROM_BBP_BASE		0x78
810 
811 
812 /*
813  * control and status registers access macros
814  */
815 #define	RT2860_READ(sc, reg)						\
816 	ddi_get32((sc)->sc_io_handle,					\
817 	    (uint32_t *)((uintptr_t)(sc)->sc_io_base + (reg)))
818 
819 #define	RT2860_WRITE(sc, reg, val)					\
820 	ddi_put32((sc)->sc_io_handle,					\
821 	    (uint32_t *)((uintptr_t)(sc)->sc_io_base + (reg)), (val))
822 
823 #define	rt2860_mem_write1(sc, reg, val)					\
824 	ddi_put8((sc)->sc_io_handle,					\
825 	    (uint8_t *)((sc)->sc_io_base + (reg)), (val))
826 
827 /*
828  * EEPROM access macro
829  */
830 #define	RT2860_EEPROM_CTL(sc, val) {					\
831 	RT2860_WRITE((sc), RT2860_PCI_EECTRL, (val));			\
832 	DELAY(RT2860_EEPROM_DELAY);					\
833 }
834 
835 /*
836  * Default values for MAC registers; values taken from the reference driver.
837  */
838 #define	RT2860_DEF_MAC					\
839 	{ RT2860_BCN_OFFSET0,		0xf8f0e8e0 },	\
840 	{ RT2860_LEGACY_BASIC_RATE,	0x0000013f },	\
841 	{ RT2860_HT_BASIC_RATE,		0x00008003 },	\
842 	{ RT2860_MAC_SYS_CTRL,		0x00000000 },	\
843 	{ RT2860_BKOFF_SLOT_CFG,	0x00000209 },	\
844 	{ RT2860_TX_SW_CFG0,		0x00040a06 },	\
845 	{ RT2860_TX_SW_CFG1,		0x00080606 },	\
846 	{ RT2860_TX_LINK_CFG,		0x00001020 },	\
847 	{ RT2860_TX_TIMEOUT_CFG,	0x000a2090 },	\
848 	{ RT2860_LED_CFG,		0x7f031e46 },	\
849 	{ RT2860_WMM_AIFSN_CFG,		0x00002273 },	\
850 	{ RT2860_WMM_CWMIN_CFG,		0x00002344 },	\
851 	{ RT2860_WMM_CWMAX_CFG,		0x000034aa },	\
852 	{ RT2860_MAX_PCNT,		0x1f3fbf9f },	\
853 	{ RT2860_TX_RTY_CFG,		0x47d01f0f },	\
854 	{ RT2860_AUTO_RSP_CFG,		0x00000013 },	\
855 	{ RT2860_CCK_PROT_CFG,		0x05740003 },	\
856 	{ RT2860_OFDM_PROT_CFG,		0x05740003 },	\
857 	{ RT2860_GF20_PROT_CFG,		0x01744004 },	\
858 	{ RT2860_GF40_PROT_CFG,		0x03f44084 },	\
859 	{ RT2860_MM20_PROT_CFG,		0x01744004 },	\
860 	{ RT2860_MM40_PROT_CFG,		0x03f54084 },	\
861 	{ RT2860_TXOP_CTRL_CFG,		0x0000583f },	\
862 	{ RT2860_TXOP_HLDR_ET,		0x00000002 },	\
863 	{ RT2860_TX_RTS_CFG,		0x00092b20 },	\
864 	{ RT2860_EXP_ACK_TIME,		0x002400ca },	\
865 	{ RT2860_XIFS_TIME_CFG,		0x33a41010 },	\
866 	{ RT2860_PWR_PIN_CFG,		0x00000003 }
867 
868 /*
869  * Default values for BBP registers; values taken from the reference driver.
870  */
871 #define	RT2860_DEF_BBP	\
872 	{  65, 0x2c },	\
873 	{  66, 0x38 },	\
874 	{  69, 0x12 },	\
875 	{  73, 0x10 },	\
876 	{  81, 0x37 },	\
877 	{  82, 0x62 },	\
878 	{  83, 0x6a },	\
879 	{  84, 0x19 },	\
880 	{  86, 0x00 },	\
881 	{  91, 0x04 },	\
882 	{  92, 0x00 },	\
883 	{ 105, 0x01 }
884 
885 /*
886  * Default settings for RF registers; values derived from the reference driver.
887  */
888 #define	RT2860_RF2850						\
889 	{   1, 0x100bb3, 0x1301e1, 0x05a014, 0x001402 },	\
890 	{   2, 0x100bb3, 0x1301e1, 0x05a014, 0x001407 },	\
891 	{   3, 0x100bb3, 0x1301e2, 0x05a014, 0x001402 },	\
892 	{   4, 0x100bb3, 0x1301e2, 0x05a014, 0x001407 },	\
893 	{   5, 0x100bb3, 0x1301e3, 0x05a014, 0x001402 },	\
894 	{   6, 0x100bb3, 0x1301e3, 0x05a014, 0x001407 },	\
895 	{   7, 0x100bb3, 0x1301e4, 0x05a014, 0x001402 },	\
896 	{   8, 0x100bb3, 0x1301e4, 0x05a014, 0x001407 },	\
897 	{   9, 0x100bb3, 0x1301e5, 0x05a014, 0x001402 },	\
898 	{  10, 0x100bb3, 0x1301e5, 0x05a014, 0x001407 },	\
899 	{  11, 0x100bb3, 0x1301e6, 0x05a014, 0x001402 },	\
900 	{  12, 0x100bb3, 0x1301e6, 0x05a014, 0x001407 },	\
901 	{  13, 0x100bb3, 0x1301e7, 0x05a014, 0x001402 },	\
902 	{  14, 0x100bb3, 0x1301e8, 0x05a014, 0x001404 },	\
903 	{  36, 0x100bb3, 0x130266, 0x056014, 0x001408 },	\
904 	{  38, 0x100bb3, 0x130267, 0x056014, 0x001404 },	\
905 	{  40, 0x100bb2, 0x1301a0, 0x056014, 0x001400 },	\
906 	{  44, 0x100bb2, 0x1301a0, 0x056014, 0x001408 },	\
907 	{  46, 0x100bb2, 0x1301a1, 0x056014, 0x001402 },	\
908 	{  48, 0x100bb2, 0x1301a1, 0x056014, 0x001406 },	\
909 	{  52, 0x100bb2, 0x1301a2, 0x056014, 0x001404 },	\
910 	{  54, 0x100bb2, 0x1301a2, 0x056014, 0x001408 },	\
911 	{  56, 0x100bb2, 0x1301a3, 0x056014, 0x001402 },	\
912 	{  60, 0x100bb2, 0x1301a4, 0x056014, 0x001400 },	\
913 	{  62, 0x100bb2, 0x1301a4, 0x056014, 0x001404 },	\
914 	{  64, 0x100bb2, 0x1301a4, 0x056014, 0x001408 },	\
915 	{ 100, 0x100bb2, 0x1301ac, 0x05e014, 0x001400 },	\
916 	{ 102, 0x100bb2, 0x1301ac, 0x05e014, 0x001404 },	\
917 	{ 104, 0x100bb2, 0x1301ac, 0x05e014, 0x001408 },	\
918 	{ 108, 0x100bb3, 0x13028c, 0x05e014, 0x001404 },	\
919 	{ 110, 0x100bb3, 0x13028d, 0x05e014, 0x001400 },	\
920 	{ 112, 0x100bb3, 0x13028d, 0x05e014, 0x001406 },	\
921 	{ 116, 0x100bb3, 0x13028e, 0x05e014, 0x001408 },	\
922 	{ 118, 0x100bb3, 0x13028f, 0x05e014, 0x001404 },	\
923 	{ 120, 0x100bb1, 0x1300e0, 0x05e014, 0x001400 },	\
924 	{ 124, 0x100bb1, 0x1300e0, 0x05e014, 0x001404 },	\
925 	{ 126, 0x100bb1, 0x1300e0, 0x05e014, 0x001406 },	\
926 	{ 128, 0x100bb1, 0x1300e0, 0x05e014, 0x001408 },	\
927 	{ 132, 0x100bb1, 0x1300e1, 0x05e014, 0x001402 },	\
928 	{ 134, 0x100bb1, 0x1300e1, 0x05e014, 0x001404 },	\
929 	{ 136, 0x100bb1, 0x1300e1, 0x05e014, 0x001406 },	\
930 	{ 140, 0x100bb1, 0x1300e2, 0x05e014, 0x001400 },	\
931 	{ 149, 0x100bb1, 0x1300e2, 0x05e014, 0x001409 },	\
932 	{ 151, 0x100bb1, 0x1300e3, 0x05e014, 0x001401 },	\
933 	{ 153, 0x100bb1, 0x1300e3, 0x05e014, 0x001403 },	\
934 	{ 157, 0x100bb1, 0x1300e3, 0x05e014, 0x001407 },	\
935 	{ 159, 0x100bb1, 0x1300e3, 0x05e014, 0x001409 },	\
936 	{ 161, 0x100bb1, 0x1300e4, 0x05e014, 0x001401 },	\
937 	{ 165, 0x100bb1, 0x1300e4, 0x05e014, 0x001405 }
938 
939 
940 #ifdef __cplusplus
941 }
942 #endif
943 
944 #endif /* _RT2860_REG_H */
945