3 * Copyright (c) 2009-2010 Alexander Egorenkov <egorenar@gmail.com>
4 * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 #ifndef _RT2860_REG_H_
20 #define _RT2860_REG_H_
22 #define RT2860_REG_EEPROM_CSR 0x0004
24 #define RT2860_REG_SCHDMA_INT_STATUS 0x0200
25 #define RT2860_REG_SCHDMA_INT_MASK 0x0204
26 #define RT2860_REG_SCHDMA_WPDMA_GLO_CFG 0x0208
27 #define RT2860_REG_SCHDMA_WPDMA_RST_IDX 0x020c
28 #define RT2860_REG_SCHDMA_DELAY_INT_CFG 0x0210
29 #define RT2860_REG_SCHDMA_WMM_AIFSN_CFG 0x0214
30 #define RT2860_REG_SCHDMA_WMM_CWMIN_CFG 0x0218
31 #define RT2860_REG_SCHDMA_WMM_CWMAX_CFG 0x021c
32 #define RT2860_REG_SCHDMA_WMM_TXOP0_CFG 0x0220
33 #define RT2860_REG_SCHDMA_WMM_TXOP1_CFG 0x0224
34 #define RT2860_REG_SCHDMA_GPIO_CTRL_CFG 0x0228
35 #define RT2860_REG_SCHDMA_RX_BASE_PTR 0x0290
36 #define RT2860_REG_SCHDMA_RX_MAX_CNT 0x0294
37 #define RT2860_REG_SCHDMA_RX_CALC_IDX 0x0298
38 #define RT2860_REG_SCHDMA_RX_DRX_IDX 0x029c
39 #define RT2860_REG_SCHDMA_TX_BASE_PTR(qid) (0x0230 + (qid) * 16)
40 #define RT2860_REG_SCHDMA_TX_MAX_CNT(qid) (0x0234 + (qid) * 16)
41 #define RT2860_REG_SCHDMA_TX_CTX_IDX(qid) (0x0238 + (qid) * 16)
42 #define RT2860_REG_SCHDMA_TX_DTX_IDX(qid) (0x023c + (qid) * 16)
44 #define RT2860_REG_PBF_SYS_CTRL 0x0400
45 #define RT2860_REG_PBF_CFG 0x0408
46 #define RT2860_REG_PBF_MAX_PCNT 0x040c
47 #define RT2860_REG_PBF_BCN_OFFSET0 0x042c
48 #define RT2860_REG_PBF_BCN_OFFSET1 0x0430
49 #define RT2860_REG_PBF_TXRXQ_PCNT 0x0438
51 #define RT2860_REG_MAC_CSR0 0x1000
52 #define RT2860_REG_SYS_CTRL 0x1004
53 #define RT2860_REG_ADDR_DW0 0x1008
54 #define RT2860_REG_ADDR_DW1 0x100c
55 #define RT2860_REG_BSSID_DW0 0x1010
56 #define RT2860_REG_BSSID_DW1 0x1014
57 #define RT2860_REG_MAX_LEN_CFG 0x1018
58 #define RT2860_REG_BBP_CSR_CFG 0x101c
59 #define RT2860_REG_RF_CSR_CFG0 0x1020
60 #define RT2860_REG_LED_CFG 0x102c
62 #define RT2860_REG_XIFS_TIME_CFG 0x1100
63 #define RT2860_REG_BKOFF_SLOT_CFG 0x1104
64 #define RT2860_REG_BCN_TIME_CFG 0x1114
65 #define RT2860_REG_TSF_TIMER_DW0 0x111c
66 #define RT2860_REG_TSF_TIMER_DW1 0x1120
67 #define RT2860_REG_TBTT_TIMER 0x1124
69 #define RT2860_REG_STATUS_CFG 0x1200
70 #define RT2860_REG_PWR_PIN_CFG 0x1204
71 #define RT2860_REG_AUTO_WAKEUP_CFG 0x1208
73 #define RT2860_REG_TX_EDCA_AC_CFG(aci) (0x1300 + (aci) * 4)
74 #define RT2860_REG_TX_PWR_CFG(ridx) (0x1314 + (ridx) * 4)
75 #define RT2860_REG_TX_PIN_CFG 0x1328
76 #define RT2860_REG_TX_BAND_CFG 0x132c
77 #define RT2860_REG_TX_SW_CFG0 0x1330
78 #define RT2860_REG_TX_SW_CFG1 0x1334
79 #define RT2860_REG_TX_TXOP_CTRL_CFG 0x1340
80 #define RT2860_REG_TX_RTS_CFG 0x1344
81 #define RT2860_REG_TX_TIMEOUT_CFG 0x1348
82 #define RT2860_REG_TX_RTY_CFG 0x134c
83 #define RT2860_REG_TX_LINK_CFG 0x1350
84 #define RT2860_REG_TX_HT_FBK_CFG0 0x1354
85 #define RT2860_REG_TX_HT_FBK_CFG1 0x1358
86 #define RT2860_REG_TX_LG_FBK_CFG0 0x135c
87 #define RT2860_REG_TX_LG_FBK_CFG1 0x1360
88 #define RT2860_REG_TX_CCK_PROT_CFG 0x1364
89 #define RT2860_REG_TX_OFDM_PROT_CFG 0x1368
90 #define RT2860_REG_TX_MM20_PROT_CFG 0x136c
91 #define RT2860_REG_TX_MM40_PROT_CFG 0x1370
92 #define RT2860_REG_TX_GF20_PROT_CFG 0x1374
93 #define RT2860_REG_TX_GF40_PROT_CFG 0x1378
94 #define RT2860_REG_TX_EXP_ACK_TIME 0x1380
96 #define RT2860_REG_RX_FILTER_CFG 0x1400
97 #define RT2860_REG_AUTO_RSP_CFG 0x1404
98 #define RT2860_REG_LEGACY_BASIC_RATE 0x1408
99 #define RT2860_REG_HT_BASIC_RATE 0x140c
101 #define RT2860_REG_HCCAPSMP_TXOP_HLDR_ET 0x1608
103 #define RT2860_REG_RX_STA_CNT0 0x1700
104 #define RT2860_REG_RX_STA_CNT1 0x1704
105 #define RT2860_REG_RX_STA_CNT2 0x1708
106 #define RT2860_REG_TX_STA_CNT0 0x170c
107 #define RT2860_REG_TX_STA_CNT1 0x1710
108 #define RT2860_REG_TX_STA_CNT2 0x1714
109 #define RT2860_REG_TX_STA_FIFO 0x1718
110 #define RT2860_REG_TX_AGG_CNT 0x171c
111 #define RT2860_REG_TX_AGG_CNT0 0x1720
112 #define RT2860_REG_TX_AGG_CNT1 0x1724
113 #define RT2860_REG_TX_AGG_CNT2 0x1728
114 #define RT2860_REG_TX_AGG_CNT3 0x172c
115 #define RT2860_REG_TX_AGG_CNT4 0x1730
116 #define RT2860_REG_TX_AGG_CNT5 0x1734
117 #define RT2860_REG_TX_AGG_CNT6 0x1738
118 #define RT2860_REG_TX_AGG_CNT7 0x173c
119 #define RT2860_REG_TXRX_MPDU_DEN_CNT 0x1740
121 #define RT2860_REG_WCID(wcid) (0x1800 + (wcid) * 8)
122 #define RT2860_REG_PKEY(wcid) (0x4000 + (wcid) * 32)
123 #define RT2860_REG_IVEIV(wcid) (0x6000 + (wcid) * 8)
124 #define RT2860_REG_WCID_ATTR(wcid) (0x6800 + (wcid) * 4)
125 #define RT2860_REG_SKEY(vap, kidx) (0x6c00 + ((vap) * 4 + (kidx)) * 32)
126 #define RT2860_REG_SKEY_MODE(vap) (0x7000 + ((vap) / 2) * 4)
128 #define RT2860_REG_MCU_UCODE_BASE 0x2000
130 #define RT2860_REG_H2M_HOST_CMD 0x0404
131 #define RT2860_REG_H2M_MAILBOX 0x7010
132 #define RT2860_REG_H2M_MAILBOX_CID 0x7014
133 #define RT2860_REG_H2M_MAILBOX_STATUS 0x701c
134 #define RT2860_REG_H2M_MAILBOX_BBP_AGENT 0x7028
136 #define RT2860_REG_BEACON_BASE(vap) (0x7800 + (vap) * 512)
138 #define RT2860_REG_RF_R1 0
139 #define RT2860_REG_RF_R2 1
140 #define RT2860_REG_RF_R3 2
141 #define RT2860_REG_RF_R4 3
144 * RT2860_REG_EEPROM_CSR flags
146 #define RT2860_REG_EERL (1 << 7)
147 #define RT2860_REG_EEDO (1 << 3)
148 #define RT2860_REG_EEDI (1 << 2)
149 #define RT2860_REG_EECS (1 << 1)
150 #define RT2860_REG_EESK (1 << 0)
151 #define RT2860_REG_EEOP_READ 0x6
154 * RT2860_REG_SCHDMA_INT_STATUS
155 * RT2860_REG_SCHDMA_INT_MASK flags
157 #define RT2860_REG_INT_TX_COHERENT (1 << 17)
158 #define RT2860_REG_INT_RX_COHERENT (1 << 16)
159 #define RT2860_REG_INT_GP_TIMER (1 << 15)
160 #define RT2860_REG_INT_AUTO_WAKEUP (1 << 14)
161 #define RT2860_REG_INT_FIFO_STA_FULL (1 << 13)
162 #define RT2860_REG_INT_PRE_TBTT (1 << 12)
163 #define RT2860_REG_INT_TBTT (1 << 11)
164 #define RT2860_REG_INT_TXRX_COHERENT (1 << 10)
165 #define RT2860_REG_INT_MCU_CMD (1 << 9)
166 #define RT2860_REG_INT_TX_MGMT_DONE (1 << 8)
167 #define RT2860_REG_INT_TX_HCCA_DONE (1 << 7)
168 #define RT2860_REG_INT_TX_AC3_DONE (1 << 6)
169 #define RT2860_REG_INT_TX_AC2_DONE (1 << 5)
170 #define RT2860_REG_INT_TX_AC1_DONE (1 << 4)
171 #define RT2860_REG_INT_TX_AC0_DONE (1 << 3)
172 #define RT2860_REG_INT_RX_DONE (1 << 2)
173 #define RT2860_REG_INT_TX_DELAY_DONE (1 << 1)
174 #define RT2860_REG_INT_RX_DELAY_DONE (1 << 0)
177 * RT2860_REG_SCHDMA_WPDMA_GLO_CFG flags
179 #define RT2860_REG_TX_WB_DDONE (1 << 6)
180 #define RT2860_REG_RX_DMA_BUSY (1 << 3)
181 #define RT2860_REG_RX_DMA_ENABLE (1 << 2)
182 #define RT2860_REG_TX_DMA_BUSY (1 << 1)
183 #define RT2860_REG_TX_DMA_ENABLE (1 << 0)
184 #define RT2860_REG_WPDMA_BT_SIZE_SHIFT 4
185 #define RT2860_REG_WPDMA_BT_SIZE16 0
186 #define RT2860_REG_WPDMA_BT_SIZE32 1
187 #define RT2860_REG_WPDMA_BT_SIZE64 2
188 #define RT2860_REG_WPDMA_BT_SIZE128 3
191 * RT2860_REG_SCHDMA_WPDMA_RST_IDX flags
193 #define RT2860_REG_RST_IDX_RX (1 << 16)
194 #define RT2860_REG_RST_IDX_TX_MGMT (1 << 5)
195 #define RT2860_REG_RST_IDX_TX_HCCA (1 << 4)
196 #define RT2860_REG_RST_IDX_TX_AC3 (1 << 3)
197 #define RT2860_REG_RST_IDX_TX_AC2 (1 << 2)
198 #define RT2860_REG_RST_IDX_TX_AC1 (1 << 1)
199 #define RT2860_REG_RST_IDX_TX_AC0 (1 << 0)
202 * RT2860_REG_SCHDMA_DELAY_INT_CFG flags
204 #define RT2860_REG_INT_TX_DELAY_ENABLE (1 << 31)
205 #define RT2860_REG_INT_TX_MAX_PINT_SHIFT 24
206 #define RT2860_REG_INT_TX_MAX_PINT_MASK 0x7
207 #define RT2860_REG_INT_TX_MAX_PTIME_SHIFT 16
208 #define RT2860_REG_INT_TX_MAX_PTIME_MASK 0x8
209 #define RT2860_REG_INT_RX_DELAY_ENABLE (1 << 15)
210 #define RT2860_REG_INT_RX_MAX_PINT_SHIFT 8
211 #define RT2860_REG_INT_RX_MAX_PINT_MASK 0x7
212 #define RT2860_REG_INT_RX_MAX_PTIME_SHIFT 0
213 #define RT2860_REG_INT_RX_MAX_PTIME_MASK 0x8
216 * RT2860_REG_PBF_SYS_CTRL flags
218 #define RT2860_REG_HST_PM_SEL (1 << 16)
219 #define RT2860_REG_MCU_READY (1 << 7)
220 #define RT2860_REG_MCU_RESET (1 << 0)
223 * RT2860_REG_PBF_TXRXQ_PCNT flags
225 #define RT2860_REG_RXQ_PCNT_SHIFT 24
226 #define RT2860_REG_RXQ_PCNT_MASK 0xff
227 #define RT2860_REG_TX2Q_PCNT_SHIFT 16
228 #define RT2860_REG_TX2Q_PCNT_MASK 0xff
229 #define RT2860_REG_TX1Q_PCNT_SHIFT 8
230 #define RT2860_REG_TX1Q_PCNT_MASK 0xff
231 #define RT2860_REG_TX0Q_PCNT_SHIFT 0
232 #define RT2860_REG_TX0Q_PCNT_MASK 0xff
235 * RT2860_REG_SYS_CTRL flags
237 #define RT2860_REG_RX_ENABLE (1 << 3)
238 #define RT2860_REG_TX_ENABLE (1 << 2)
239 #define RT2860_REG_BBP_HRST (1 << 1)
240 #define RT2860_REG_MAC_SRST (1 << 0)
243 * RT2860_REG_BBP_CSR_CFG flags
245 #define RT2860_REG_BBP_RW_MODE_PARALLEL (1 << 19)
246 #define RT2860_REG_BBP_CSR_BUSY (1 << 17)
247 #define RT2860_REG_BBP_CSR_READ (1 << 16)
248 #define RT2860_REG_BBP_REG_SHIFT 8
249 #define RT2860_REG_BBP_REG_MASK 0xff
250 #define RT2860_REG_BBP_VAL_SHIFT 0
251 #define RT2860_REG_BBP_VAL_MASK 0xff
254 * RT2860_REG_RF_CSR_CFG0 flags
256 #define RT2860_REG_RF_BUSY (1 << 31)
259 * RT2860_REG_BCN_TIME_CFG flags
261 #define RT2860_REG_BCN_TX_ENABLE (1 << 20)
262 #define RT2860_REG_TBTT_TIMER_ENABLE (1 << 19)
263 #define RT2860_REG_TSF_TIMER_ENABLE (1 << 16)
264 #define RT2860_REG_TSF_SYNC_MODE_SHIFT 17
265 #define RT2860_REG_TSF_SYNC_MODE_MASK 0x3
266 #define RT2860_REG_TSF_SYNC_MODE_DISABLE 0
267 #define RT2860_REG_TSF_SYNC_MODE_STA 1
268 #define RT2860_REG_TSF_SYNC_MODE_IBSS 2
269 #define RT2860_REG_TSF_SYNC_MODE_HOSTAP 3
272 * RT2860_REG_STATUS_CFG flags
274 #define RT2860_REG_STATUS_RX_BUSY (1 << 1)
275 #define RT2860_REG_STATUS_TX_BUSY (1 << 0)
278 * RT2860_REG_TX_PIN_CFG flags
280 #define RT2860_REG_TRSW_ENABLE (1 << 18)
281 #define RT2860_REG_RFTR_ENABLE (1 << 16)
282 #define RT2860_REG_LNA_PE_G1_ENABLE (1 << 11)
283 #define RT2860_REG_LNA_PE_A1_ENABLE (1 << 10)
284 #define RT2860_REG_LNA_PE_G0_ENABLE (1 << 9)
285 #define RT2860_REG_LNA_PE_A0_ENABLE (1 << 8)
286 #define RT2860_REG_PA_PE_G1_ENABLE (1 << 3)
287 #define RT2860_REG_PA_PE_A1_ENABLE (1 << 2)
288 #define RT2860_REG_PA_PE_G0_ENABLE (1 << 1)
289 #define RT2860_REG_PA_PE_A0_ENABLE (1 << 0)
292 * RT2860_REG_TX_BAND_CFG flags
294 #define RT2860_REG_TX_BAND_BG (1 << 2)
295 #define RT2860_REG_TX_BAND_A (1 << 1)
296 #define RT2860_REG_TX_BAND_HT40_ABOVE (1 << 0)
297 #define RT2860_REG_TX_BAND_HT40_BELOW (0 << 0)
300 * RT2860_REG_TX_RTS_CFG flags
302 #define RT2860_REG_TX_RTS_THRESHOLD_SHIFT 8
303 #define RT2860_REG_TX_RTS_THRESHOLD_MASK 0xffff
306 * RT2860_REG_TX_CCK_PROT_CFG
307 * RT2860_REG_TX_OFDM_PROT_CFG
308 * RT2860_REG_TX_MM20_PROT_CFG
309 * RT2860_REG_TX_MM40_PROT_CFG
310 * RT2860_REG_TX_GF20_PROT_CFG
311 * RT2860_REG_TX_GF40_PROT_CFG flags
313 #define RT2860_REG_RTSTH_ENABLE (1 << 26)
314 #define RT2860_REG_TXOP_ALLOW_GF40 (1 << 25)
315 #define RT2860_REG_TXOP_ALLOW_GF20 (1 << 24)
316 #define RT2860_REG_TXOP_ALLOW_MM40 (1 << 23)
317 #define RT2860_REG_TXOP_ALLOW_MM20 (1 << 22)
318 #define RT2860_REG_TXOP_ALLOW_OFDM (1 << 21)
319 #define RT2860_REG_TXOP_ALLOW_CCK (1 << 20)
320 #define RT2860_REG_TXOP_ALLOW_ALL (0x3f << 20)
321 #define RT2860_REG_PROT_NAV_NONE (0 << 18)
322 #define RT2860_REG_PROT_NAV_SHORT (1 << 18)
323 #define RT2860_REG_PROT_NAV_LONG (2 << 18)
324 #define RT2860_REG_PROT_CTRL_NONE (0 << 16)
325 #define RT2860_REG_PROT_CTRL_RTS_CTS (1 << 16)
326 #define RT2860_REG_PROT_CTRL_CTS (2 << 16)
327 #define RT2860_REG_PROT_PHYMODE_SHIFT 14
328 #define RT2860_REG_PROT_PHYMODE_MASK 0x3
329 #define RT2860_REG_PROT_PHYMODE_CCK 0
330 #define RT2860_REG_PROT_PHYMODE_OFDM 1
331 #define RT2860_REG_PROT_MCS_SHIFT 0
332 #define RT2860_REG_PROT_MCS_MASK 0x7f
335 * RT2860_REG_RX_FILTER_CFG flags
337 #define RT2860_REG_RX_FILTER_DROP_CTRL_RSV (1 << 16)
338 #define RT2860_REG_RX_FILTER_DROP_BAR (1 << 15)
339 #define RT2860_REG_RX_FILTER_DROP_BA (1 << 14)
340 #define RT2860_REG_RX_FILTER_DROP_PSPOLL (1 << 13)
341 #define RT2860_REG_RX_FILTER_DROP_RTS (1 << 12)
342 #define RT2860_REG_RX_FILTER_DROP_CTS (1 << 11)
343 #define RT2860_REG_RX_FILTER_DROP_ACK (1 << 10)
344 #define RT2860_REG_RX_FILTER_DROP_CFEND (1 << 9)
345 #define RT2860_REG_RX_FILTER_DROP_CFACK (1 << 8)
346 #define RT2860_REG_RX_FILTER_DROP_DUPL (1 << 7)
347 #define RT2860_REG_RX_FILTER_DROP_BCAST (1 << 6)
348 #define RT2860_REG_RX_FILTER_DROP_MCAST (1 << 5)
349 #define RT2860_REG_RX_FILTER_DROP_VER_ERR (1 << 4)
350 #define RT2860_REG_RX_FILTER_DROP_NOT_MYBSS (1 << 3)
351 #define RT2860_REG_RX_FILTER_DROP_UC_NOME (1 << 2)
352 #define RT2860_REG_RX_FILTER_DROP_PHY_ERR (1 << 1)
353 #define RT2860_REG_RX_FILTER_DROP_CRC_ERR (1 << 0)
356 * RT2860_REG_AUTO_RSP_CFG flags
358 #define RT2860_REG_CCK_SHORT_ENABLE (1 << 4)
361 * RT2860_REG_TX_STA_FIFO flags
363 #define RT2860_REG_TX_STA_FIFO_MCS_SHIFT 16
364 #define RT2860_REG_TX_STA_FIFO_MCS_MASK 0x7f
365 #define RT2860_REG_TX_STA_FIFO_WCID_SHIFT 8
366 #define RT2860_REG_TX_STA_FIFO_WCID_MASK 0xff
367 #define RT2860_REG_TX_STA_FIFO_PID_SHIFT 1
368 #define RT2860_REG_TX_STA_FIFO_PID_MASK 0xf
369 #define RT2860_REG_TX_STA_FIFO_ACK_REQ (1 << 7)
370 #define RT2860_REG_TX_STA_FIFO_AGG (1 << 6)
371 #define RT2860_REG_TX_STA_FIFO_TX_OK (1 << 5)
372 #define RT2860_REG_TX_STA_FIFO_VALID (1 << 0)
375 * RT2860_REG_WCID_ATTR flags
377 #define RT2860_REG_VAP_SHIFT 4
378 #define RT2860_REG_VAP_MASK 0x7
379 #define RT2860_REG_CIPHER_MODE_SHIFT 1
380 #define RT2860_REG_CIPHER_MODE_MASK 0x7
381 #define RT2860_REG_CIPHER_MODE_NONE 0
382 #define RT2860_REG_CIPHER_MODE_WEP40 1
383 #define RT2860_REG_CIPHER_MODE_WEP104 2
384 #define RT2860_REG_CIPHER_MODE_TKIP 3
385 #define RT2860_REG_CIPHER_MODE_AES_CCMP 4
386 #define RT2860_REG_CIPHER_MODE_CKIP40 5
387 #define RT2860_REG_CIPHER_MODE_CKIP104 6
388 #define RT2860_REG_CIPHER_MODE_CKIP128 7
389 #define RT2860_REG_PKEY_ENABLE (1 << 0)
392 * RT2860_REG_H2M_MAILBOX flags
394 #define RT2860_REG_H2M_BUSY (1 << 24)
395 #define RT2860_REG_H2M_TOKEN_POWERSAVE 1
396 #define RT2860_REG_H2M_TOKEN_RADIOOFF 2
397 #define RT2860_REG_H2M_TOKEN_WAKEUP 3
398 #define RT2860_REG_H2M_TOKEN_NO_INTR 0xff
401 * RT2860_REG_H2M_MAILBOX_CID flags
403 #define RT2860_REG_H2M_CID0_SHIFT 0
404 #define RT2860_REG_H2M_CID1_SHIFT 8
405 #define RT2860_REG_H2M_CID2_SHIFT 16
406 #define RT2860_REG_H2M_CID3_SHIFT 24
407 #define RT2860_REG_H2M_CID_MASK 0xff
409 #endif /* #ifndef _RT2860_REG_H_ */