xref: /freebsd/sys/dev/rtwn/rtl8812a/r12a_reg.h (revision 8aac90f18aef7c9eea906c3ff9a001ca7b94f375)
1 /*-
2  * Copyright (c) 2016 Andriy Voskoboinyk <avos@FreeBSD.org>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  */
26 
27 #ifndef R12A_REG_H
28 #define R12A_REG_H
29 
30 #include <dev/rtwn/rtl8188e/r88e_reg.h>
31 
32 /*
33  * MAC registers.
34  */
35 /* System Configuration. */
36 #define R12A_SDIO_CTRL			0x070
37 #define R12A_RF_B_CTRL			0x076
38 /* Rx DMA Configuration. */
39 #define R12A_RXDMA_PRO			0x290
40 #define R12A_EARLY_MODE_CONTROL		0x2bc
41 /* Protocol Configuration. */
42 #define R12A_TXPKT_EMPTY		0x41a
43 #define R12A_ARFR_5G(i)			(0x444 + (i) * 8)
44 #define R12A_CCK_CHECK			0x454
45 #define R12A_AMPDU_MAX_TIME		0x456
46 #define R12A_AMPDU_MAX_LENGTH		R92C_AGGLEN_LMT
47 #define R12A_DATA_SEC			0x483
48 #define R12A_ARFR_2G(i)			(0x48c + (i) * 8)
49 #define R12A_HT_SINGLE_AMPDU		0x4c7
50 
51 /* Bits for R92C_MAC_PHY_CTRL. */
52 #define R12A_MAC_PHY_CRYSTALCAP_M	0x7ff80000
53 #define R12A_MAC_PHY_CRYSTALCAP_S	19
54 
55 /* Bits for R92C_LEDCFG2. */
56 #define R12A_LEDCFG2_ENA		0x20
57 
58 /* Bits for R12A_RXDMA_PRO. */
59 #define R12A_DMA_MODE			0x02
60 #define R12A_BURST_CNT_M		0x0c
61 #define R12A_BURST_CNT_S		2
62 #define R12A_BURST_SZ_M			0x30
63 #define R12A_BURST_SZ_S			4
64 #define R12A_BURST_SZ_USB3		0
65 #define R12A_BURST_SZ_USB2		1
66 #define R12A_BURST_SZ_USB1		2
67 
68 /* Bits for R12A_CCK_CHECK. */
69 #define R12A_CCK_CHECK_BCN1		0x20
70 #define R12A_CCK_CHECK_5GHZ		0x80
71 
72 /* Bits for R12A_DATA_SEC. */
73 #define R12A_DATA_SEC_NO_EXT		0x00
74 #define R12A_DATA_SEC_PRIM_UP_20	0x01
75 #define R12A_DATA_SEC_PRIM_DOWN_20	0x02
76 #define R12A_DATA_SEC_PRIM_UPPER_20	0x03
77 #define R12A_DATA_SEC_PRIM_LOWER_20	0x04
78 #define R12A_DATA_SEC_PRIM_UP_40	0x90
79 #define R12A_DATA_SEC_PRIM_DOWN_40	0xa0
80 
81 /* Bits for R12A_HT_SINGLE_AMPDU. */
82 #define R12A_HT_SINGLE_AMPDU_PKT_ENA	0x80
83 
84 /* Bits for R92C_RCR. */
85 #define R12A_RCR_DIS_CHK_14		0x00200000
86 #define R12A_RCR_TCP_OFFLD_EN		0x02000000
87 #define R12A_RCR_VHT_ACK		0x04000000
88 
89 /*
90  * Baseband registers.
91  */
92 #define R12A_CCK_RPT_FORMAT		0x804
93 #define R12A_OFDMCCK_EN			0x808
94 #define R12A_RX_PATH			R12A_OFDMCCK_EN
95 #define R12A_TX_PATH			0x80c
96 #define R12A_TXAGC_TABLE_SELECT		0x82c
97 #define R12A_PWED_TH			0x830
98 #define R12A_BW_INDICATION		0x834
99 #define R12A_CCA_ON_SEC			0x838
100 #define R12A_L1_PEAK_TH			0x848
101 #define R12A_FC_AREA			0x860
102 #define R12A_RFMOD			0x8ac
103 #define R12A_HSSI_PARAM2		0x8b0
104 #define R12A_ADC_BUF_CLK		0x8c4
105 #define R12A_ANTSEL_SW			0x900
106 #define R12A_SINGLETONE_CONT_TX		0x914
107 #define R12A_CCK_RX_PATH		0xa04
108 #define R12A_HSSI_PARAM1(chain)		(0xc00 + (chain) * 0x200)
109 #define R12A_TX_SCALE(chain)		(0xc1c + (chain) * 0x200)
110 #define R12A_TXAGC_CCK11_1(chain)	(0xc20 + (chain) * 0x200)
111 #define R12A_TXAGC_OFDM18_6(chain)	(0xc24 + (chain) * 0x200)
112 #define R12A_TXAGC_OFDM54_24(chain)	(0xc28 + (chain) * 0x200)
113 #define R12A_TXAGC_MCS3_0(chain)	(0xc2c + (chain) * 0x200)
114 #define R12A_TXAGC_MCS7_4(chain)	(0xc30 + (chain) * 0x200)
115 #define R12A_TXAGC_MCS11_8(chain)	(0xc34 + (chain) * 0x200)
116 #define R12A_TXAGC_MCS15_12(chain)	(0xc38 + (chain) * 0x200)
117 #define R12A_TXAGC_NSS1IX3_1IX0(chain)	(0xc3c + (chain) * 0x200)
118 #define R12A_TXAGC_NSS1IX7_1IX4(chain)	(0xc40 + (chain) * 0x200)
119 #define R12A_TXAGC_NSS2IX1_1IX8(chain)	(0xc44 + (chain) * 0x200)
120 #define R12A_TXAGC_NSS2IX5_2IX2(chain)	(0xc48 + (chain) * 0x200)
121 #define R12A_TXAGC_NSS2IX9_2IX6(chain)	(0xc4c + (chain) * 0x200)
122 #define R12A_INITIAL_GAIN(chain)	(0xc50 + (chain) * 0x200)
123 #define R12A_AFE_POWER_1(chain)		(0xc60 + (chain) * 0x200)
124 #define R12A_AFE_POWER_2(chain)		(0xc64 + (chain) * 0x200)
125 #define R12A_SLEEP_NAV(chain)		(0xc80 + (chain) * 0x200)
126 #define R12A_PMPD(chain)		(0xc84 + (chain) * 0x200)
127 #define R12A_LSSI_PARAM(chain)		(0xc90 + (chain) * 0x200)
128 #define R12A_RFE_PINMUX(chain)		(0xcb0 + (chain) * 0x200)
129 #define R12A_RFE_INV(chain)		(0xcb4 + (chain) * 0x200)
130 #define R12A_RFE(chain)			(0xcb8 + (chain) * 0x200)
131 #define R12A_HSPI_READBACK(chain)	(0xd04 + (chain) * 0x40)
132 #define R12A_LSSI_READBACK(chain)	(0xd08 + (chain) * 0x40)
133 
134 /* Bits for R12A_CCK_RPT_FORMAT. */
135 #define R12A_CCK_RPT_FORMAT_HIPWR	0x00010000
136 
137 /* Bits for R12A_OFDMCCK_EN. */
138 #define R12A_OFDMCCK_EN_CCK	0x10000000
139 #define R12A_OFDMCCK_EN_OFDM	0x20000000
140 
141 /* Bits for R12A_CCA_ON_SEC. */
142 #define R12A_CCA_ON_SEC_EXT_CHAN_M	0xf0000000
143 #define R12A_CCA_ON_SEC_EXT_CHAN_S	28
144 
145 /* Bits for R12A_RFE_PINMUX(i). */
146 #define R12A_RFE_PINMUX_PA_A_MASK	0x000000f0
147 #define R12A_RFE_PINMUX_LNA_MASK	0x0000f000
148 
149 /* Bits for R12A_RFMOD. */
150 #define R12A_RFMOD_EXT_CHAN_M		0x3C
151 #define R12A_RFMOD_EXT_CHAN_S		2
152 
153 /* Bits for R12A_HSSI_PARAM2. */
154 #define R12A_HSSI_PARAM2_READ_ADDR_MASK	0xff
155 
156 /* Bits for R12A_HSSI_PARAM1(i). */
157 #define R12A_HSSI_PARAM1_PI		0x00000004
158 
159 /* Bits for R12A_TX_SCALE(i). */
160 #define R12A_TX_SCALE_SWING_M		0xffe00000
161 #define R12A_TX_SCALE_SWING_S		21
162 
163 /* Bits for R12A_TXAGC_CCK11_1(i). */
164 #define R12A_TXAGC_CCK1_M		0x000000ff
165 #define R12A_TXAGC_CCK1_S		0
166 #define R12A_TXAGC_CCK2_M		0x0000ff00
167 #define R12A_TXAGC_CCK2_S		8
168 #define R12A_TXAGC_CCK55_M		0x00ff0000
169 #define R12A_TXAGC_CCK55_S		16
170 #define R12A_TXAGC_CCK11_M		0xff000000
171 #define R12A_TXAGC_CCK11_S		24
172 
173 /* Bits for R12A_TXAGC_OFDM18_6(i). */
174 #define R12A_TXAGC_OFDM06_M		0x000000ff
175 #define R12A_TXAGC_OFDM06_S		0
176 #define R12A_TXAGC_OFDM09_M		0x0000ff00
177 #define R12A_TXAGC_OFDM09_S		8
178 #define R12A_TXAGC_OFDM12_M		0x00ff0000
179 #define R12A_TXAGC_OFDM12_S		16
180 #define R12A_TXAGC_OFDM18_M		0xff000000
181 #define R12A_TXAGC_OFDM18_S		24
182 
183 /* Bits for R12A_TXAGC_OFDM54_24(i). */
184 #define R12A_TXAGC_OFDM24_M		0x000000ff
185 #define R12A_TXAGC_OFDM24_S		0
186 #define R12A_TXAGC_OFDM36_M		0x0000ff00
187 #define R12A_TXAGC_OFDM36_S		8
188 #define R12A_TXAGC_OFDM48_M		0x00ff0000
189 #define R12A_TXAGC_OFDM48_S		16
190 #define R12A_TXAGC_OFDM54_M		0xff000000
191 #define R12A_TXAGC_OFDM54_S		24
192 
193 /* Bits for R12A_TXAGC_MCS3_0(i). */
194 #define R12A_TXAGC_MCS0_M		0x000000ff
195 #define R12A_TXAGC_MCS0_S		0
196 #define R12A_TXAGC_MCS1_M		0x0000ff00
197 #define R12A_TXAGC_MCS1_S		8
198 #define R12A_TXAGC_MCS2_M		0x00ff0000
199 #define R12A_TXAGC_MCS2_S		16
200 #define R12A_TXAGC_MCS3_M		0xff000000
201 #define R12A_TXAGC_MCS3_S		24
202 
203 /* Bits for R12A_TXAGC_MCS7_4(i). */
204 #define R12A_TXAGC_MCS4_M		0x000000ff
205 #define R12A_TXAGC_MCS4_S		0
206 #define R12A_TXAGC_MCS5_M		0x0000ff00
207 #define R12A_TXAGC_MCS5_S		8
208 #define R12A_TXAGC_MCS6_M		0x00ff0000
209 #define R12A_TXAGC_MCS6_S		16
210 #define R12A_TXAGC_MCS7_M		0xff000000
211 #define R12A_TXAGC_MCS7_S		24
212 
213 /* Bits for R12A_TXAGC_MCS11_8(i). */
214 #define R12A_TXAGC_MCS8_M		0x000000ff
215 #define R12A_TXAGC_MCS8_S		0
216 #define R12A_TXAGC_MCS9_M		0x0000ff00
217 #define R12A_TXAGC_MCS9_S		8
218 #define R12A_TXAGC_MCS10_M		0x00ff0000
219 #define R12A_TXAGC_MCS10_S		16
220 #define R12A_TXAGC_MCS11_M		0xff000000
221 #define R12A_TXAGC_MCS11_S		24
222 
223 /* Bits for R12A_TXAGC_MCS15_12(i). */
224 #define R12A_TXAGC_MCS12_M		0x000000ff
225 #define R12A_TXAGC_MCS12_S		0
226 #define R12A_TXAGC_MCS13_M		0x0000ff00
227 #define R12A_TXAGC_MCS13_S		8
228 #define R12A_TXAGC_MCS14_M		0x00ff0000
229 #define R12A_TXAGC_MCS14_S		16
230 #define R12A_TXAGC_MCS15_M		0xff000000
231 #define R12A_TXAGC_MCS15_S		24
232 
233 /*
234  * RF (6052) registers.
235  */
236 #define R12A_RF_LCK		0xb4
237 
238 /* Bits for R12A_RF_LCK. */
239 #define R12A_RF_LCK_MODE	0x4000
240 
241 #endif	/* R12A_REG_H */
242