Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
[cascardo/linux.git] / drivers / net / wireless / realtek / rtl8xxxu / rtl8xxxu_regs.h
1 /*
2  * Copyright (c) 2014 - 2016 Jes Sorensen <Jes.Sorensen@redhat.com>
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of version 2 of the GNU General Public License as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11  * more details.
12  *
13  * Register definitions taken from original Realtek rtl8723au driver
14  */
15
16 /* 0x0000 ~ 0x00FF      System Configuration */
17 #define REG_SYS_ISO_CTRL                0x0000
18 #define  SYS_ISO_MD2PP                  BIT(0)
19 #define  SYS_ISO_ANALOG_IPS             BIT(5)
20 #define  SYS_ISO_DIOR                   BIT(9)
21 #define  SYS_ISO_PWC_EV25V              BIT(14)
22 #define  SYS_ISO_PWC_EV12V              BIT(15)
23
24 #define REG_SYS_FUNC                    0x0002
25 #define  SYS_FUNC_BBRSTB                BIT(0)
26 #define  SYS_FUNC_BB_GLB_RSTN           BIT(1)
27 #define  SYS_FUNC_USBA                  BIT(2)
28 #define  SYS_FUNC_UPLL                  BIT(3)
29 #define  SYS_FUNC_USBD                  BIT(4)
30 #define  SYS_FUNC_DIO_PCIE              BIT(5)
31 #define  SYS_FUNC_PCIEA                 BIT(6)
32 #define  SYS_FUNC_PPLL                  BIT(7)
33 #define  SYS_FUNC_PCIED                 BIT(8)
34 #define  SYS_FUNC_DIOE                  BIT(9)
35 #define  SYS_FUNC_CPU_ENABLE            BIT(10)
36 #define  SYS_FUNC_DCORE                 BIT(11)
37 #define  SYS_FUNC_ELDR                  BIT(12)
38 #define  SYS_FUNC_DIO_RF                BIT(13)
39 #define  SYS_FUNC_HWPDN                 BIT(14)
40 #define  SYS_FUNC_MREGEN                BIT(15)
41
42 #define REG_APS_FSMCO                   0x0004
43 #define  APS_FSMCO_PFM_ALDN             BIT(1)
44 #define  APS_FSMCO_PFM_WOWL             BIT(3)
45 #define  APS_FSMCO_ENABLE_POWERDOWN     BIT(4)
46 #define  APS_FSMCO_MAC_ENABLE           BIT(8)
47 #define  APS_FSMCO_MAC_OFF              BIT(9)
48 #define  APS_FSMCO_SW_LPS               BIT(10)
49 #define  APS_FSMCO_HW_SUSPEND           BIT(11)
50 #define  APS_FSMCO_PCIE                 BIT(12)
51 #define  APS_FSMCO_HW_POWERDOWN         BIT(15)
52 #define  APS_FSMCO_WLON_RESET           BIT(16)
53
54 #define REG_SYS_CLKR                    0x0008
55 #define  SYS_CLK_ANAD16V_ENABLE         BIT(0)
56 #define  SYS_CLK_ANA8M                  BIT(1)
57 #define  SYS_CLK_MACSLP                 BIT(4)
58 #define  SYS_CLK_LOADER_ENABLE          BIT(5)
59 #define  SYS_CLK_80M_SSC_DISABLE        BIT(7)
60 #define  SYS_CLK_80M_SSC_ENABLE_HO      BIT(8)
61 #define  SYS_CLK_PHY_SSC_RSTB           BIT(9)
62 #define  SYS_CLK_SEC_CLK_ENABLE         BIT(10)
63 #define  SYS_CLK_MAC_CLK_ENABLE         BIT(11)
64 #define  SYS_CLK_ENABLE                 BIT(12)
65 #define  SYS_CLK_RING_CLK_ENABLE        BIT(13)
66
67 #define REG_9346CR                      0x000a
68 #define  EEPROM_BOOT                    BIT(4)
69 #define  EEPROM_ENABLE                  BIT(5)
70
71 #define REG_EE_VPD                      0x000c
72 #define REG_AFE_MISC                    0x0010
73 #define  AFE_MISC_WL_XTAL_CTRL          BIT(6)
74
75 #define REG_SPS0_CTRL                   0x0011
76 #define REG_SPS_OCP_CFG                 0x0018
77 #define REG_8192E_LDOV12_CTRL           0x0014
78 #define REG_RSV_CTRL                    0x001c
79
80 #define REG_RF_CTRL                     0x001f
81 #define  RF_ENABLE                      BIT(0)
82 #define  RF_RSTB                        BIT(1)
83 #define  RF_SDMRSTB                     BIT(2)
84
85 #define REG_LDOA15_CTRL                 0x0020
86 #define  LDOA15_ENABLE                  BIT(0)
87 #define  LDOA15_STANDBY                 BIT(1)
88 #define  LDOA15_OBUF                    BIT(2)
89 #define  LDOA15_REG_VOS                 BIT(3)
90 #define  LDOA15_VOADJ_SHIFT             4
91
92 #define REG_LDOV12D_CTRL                0x0021
93 #define  LDOV12D_ENABLE                 BIT(0)
94 #define  LDOV12D_STANDBY                BIT(1)
95 #define  LDOV12D_VADJ_SHIFT             4
96
97 #define REG_LDOHCI12_CTRL               0x0022
98
99 #define REG_LPLDO_CTRL                  0x0023
100 #define  LPLDO_HSM                      BIT(2)
101 #define  LPLDO_LSM_DIS                  BIT(3)
102
103 #define REG_AFE_XTAL_CTRL               0x0024
104 #define  AFE_XTAL_ENABLE                BIT(0)
105 #define  AFE_XTAL_B_SELECT              BIT(1)
106 #define  AFE_XTAL_GATE_USB              BIT(8)
107 #define  AFE_XTAL_GATE_AFE              BIT(11)
108 #define  AFE_XTAL_RF_GATE               BIT(14)
109 #define  AFE_XTAL_GATE_DIG              BIT(17)
110 #define  AFE_XTAL_BT_GATE               BIT(20)
111
112 /*
113  * 0x0028 is also known as REG_AFE_CTRL2 on 8723bu/8192eu
114  */
115 #define REG_AFE_PLL_CTRL                0x0028
116 #define  AFE_PLL_ENABLE                 BIT(0)
117 #define  AFE_PLL_320_ENABLE             BIT(1)
118 #define  APE_PLL_FREF_SELECT            BIT(2)
119 #define  AFE_PLL_EDGE_SELECT            BIT(3)
120 #define  AFE_PLL_WDOGB                  BIT(4)
121 #define  AFE_PLL_LPF_ENABLE             BIT(5)
122
123 #define REG_MAC_PHY_CTRL                0x002c
124
125 #define REG_EFUSE_CTRL                  0x0030
126 #define REG_EFUSE_TEST                  0x0034
127 #define  EFUSE_TRPT                     BIT(7)
128         /*  00: Wifi Efuse, 01: BT Efuse0, 10: BT Efuse1, 11: BT Efuse2 */
129 #define  EFUSE_CELL_SEL                 (BIT(8) | BIT(9))
130 #define  EFUSE_LDOE25_ENABLE            BIT(31)
131 #define  EFUSE_SELECT_MASK              0x0300
132 #define  EFUSE_WIFI_SELECT              0x0000
133 #define  EFUSE_BT0_SELECT               0x0100
134 #define  EFUSE_BT1_SELECT               0x0200
135 #define  EFUSE_BT2_SELECT               0x0300
136
137 #define  EFUSE_ACCESS_ENABLE            0x69    /* RTL8723 only */
138 #define  EFUSE_ACCESS_DISABLE           0x00    /* RTL8723 only */
139
140 #define REG_PWR_DATA                    0x0038
141 #define  PWR_DATA_EEPRPAD_RFE_CTRL_EN   BIT(11)
142
143 #define REG_CAL_TIMER                   0x003c
144 #define REG_ACLK_MON                    0x003e
145 #define REG_GPIO_MUXCFG                 0x0040
146 #define REG_GPIO_IO_SEL                 0x0042
147 #define REG_MAC_PINMUX_CFG              0x0043
148 #define REG_GPIO_PIN_CTRL               0x0044
149 #define REG_GPIO_INTM                   0x0048
150 #define  GPIO_INTM_EDGE_TRIG_IRQ        BIT(9)
151
152 #define REG_LEDCFG0                     0x004c
153 #define  LEDCFG0_DPDT_SELECT            BIT(23)
154 #define REG_LEDCFG1                     0x004d
155 #define REG_LEDCFG2                     0x004e
156 #define  LEDCFG2_DPDT_SELECT            BIT(7)
157 #define REG_LEDCFG3                     0x004f
158 #define REG_LEDCFG                      REG_LEDCFG2
159 #define REG_FSIMR                       0x0050
160 #define REG_FSISR                       0x0054
161 #define REG_HSIMR                       0x0058
162 #define REG_HSISR                       0x005c
163 /*  RTL8723 WIFI/BT/GPS Multi-Function GPIO Pin Control. */
164 #define REG_GPIO_PIN_CTRL_2             0x0060
165 /*  RTL8723 WIFI/BT/GPS Multi-Function GPIO Select. */
166 #define REG_GPIO_IO_SEL_2               0x0062
167 #define  GPIO_IO_SEL_2_GPIO09_INPUT     BIT(1)
168 #define  GPIO_IO_SEL_2_GPIO09_IRQ       BIT(9)
169
170 /*  RTL8723B */
171 #define REG_PAD_CTRL1                   0x0064
172 #define  PAD_CTRL1_SW_DPDT_SEL_DATA     BIT(0)
173
174 /*  RTL8723 only WIFI/BT/GPS Multi-Function control source. */
175 #define REG_MULTI_FUNC_CTRL             0x0068
176
177 #define  MULTI_FN_WIFI_HW_PWRDOWN_EN    BIT(0)  /* Enable GPIO[9] as WiFi HW
178                                                    powerdown source */
179 #define  MULTI_FN_WIFI_HW_PWRDOWN_SL    BIT(1)  /* WiFi HW powerdown polarity
180                                                    control */
181 #define  MULTI_WIFI_FUNC_EN             BIT(2)  /* WiFi function enable */
182
183 #define  MULTI_WIFI_HW_ROF_EN           BIT(3)  /* Enable GPIO[9] as WiFi RF HW
184                                                    powerdown source */
185 #define  MULTI_BT_HW_PWRDOWN_EN         BIT(16) /* Enable GPIO[11] as BT HW
186                                                    powerdown source */
187 #define  MULTI_BT_HW_PWRDOWN_SL         BIT(17) /* BT HW powerdown polarity
188                                                    control */
189 #define  MULTI_BT_FUNC_EN               BIT(18) /* BT function enable */
190 #define  MULTI_BT_HW_ROF_EN             BIT(19) /* Enable GPIO[11] as BT/GPS
191                                                    RF HW powerdown source */
192 #define  MULTI_GPS_HW_PWRDOWN_EN        BIT(20) /* Enable GPIO[10] as GPS HW
193                                                    powerdown source */
194 #define  MULTI_GPS_HW_PWRDOWN_SL        BIT(21) /* GPS HW powerdown polarity
195                                                    control */
196 #define  MULTI_GPS_FUNC_EN              BIT(22) /* GPS function enable */
197
198 #define REG_AFE_CTRL4                   0x0078  /* 8192eu/8723bu */
199 #define REG_LDO_SW_CTRL                 0x007c  /* 8192eu */
200
201 #define REG_MCU_FW_DL                   0x0080
202 #define  MCU_FW_DL_ENABLE               BIT(0)
203 #define  MCU_FW_DL_READY                BIT(1)
204 #define  MCU_FW_DL_CSUM_REPORT          BIT(2)
205 #define  MCU_MAC_INIT_READY             BIT(3)
206 #define  MCU_BB_INIT_READY              BIT(4)
207 #define  MCU_RF_INIT_READY              BIT(5)
208 #define  MCU_WINT_INIT_READY            BIT(6)
209 #define  MCU_FW_RAM_SEL                 BIT(7)  /* 1: RAM, 0:ROM */
210 #define  MCU_CP_RESET                   BIT(23)
211
212 #define REG_HMBOX_EXT_0                 0x0088
213 #define REG_HMBOX_EXT_1                 0x008a
214 #define REG_HMBOX_EXT_2                 0x008c
215 #define REG_HMBOX_EXT_3                 0x008e
216 /* Interrupt registers for 8192e/8723bu/8812 */
217 #define REG_HIMR0                       0x00b0
218 #define REG_HISR0                       0x00b4
219 #define REG_HIMR1                       0x00b8
220 #define REG_HISR1                       0x00bc
221
222 /*  Host suspend counter on FPGA platform */
223 #define REG_HOST_SUSP_CNT               0x00bc
224 /*  Efuse access protection for RTL8723 */
225 #define REG_EFUSE_ACCESS                0x00cf
226 #define REG_BIST_SCAN                   0x00d0
227 #define REG_BIST_RPT                    0x00d4
228 #define REG_BIST_ROM_RPT                0x00d8
229 #define REG_USB_SIE_INTF                0x00e0
230 #define REG_PCIE_MIO_INTF               0x00e4
231 #define REG_PCIE_MIO_INTD               0x00e8
232 #define REG_HPON_FSM                    0x00ec
233 #define  HPON_FSM_BONDING_MASK          (BIT(22) | BIT(23))
234 #define  HPON_FSM_BONDING_1T2R          BIT(22)
235 #define REG_SYS_CFG                     0x00f0
236 #define  SYS_CFG_XCLK_VLD               BIT(0)
237 #define  SYS_CFG_ACLK_VLD               BIT(1)
238 #define  SYS_CFG_UCLK_VLD               BIT(2)
239 #define  SYS_CFG_PCLK_VLD               BIT(3)
240 #define  SYS_CFG_PCIRSTB                BIT(4)
241 #define  SYS_CFG_V15_VLD                BIT(5)
242 #define  SYS_CFG_TRP_B15V_EN            BIT(7)
243 #define  SYS_CFG_SW_OFFLOAD_EN          BIT(7)  /* For chips with IOL support */
244 #define  SYS_CFG_SIC_IDLE               BIT(8)
245 #define  SYS_CFG_BD_MAC2                BIT(9)
246 #define  SYS_CFG_BD_MAC1                BIT(10)
247 #define  SYS_CFG_IC_MACPHY_MODE         BIT(11)
248 #define  SYS_CFG_CHIP_VER               (BIT(12) | BIT(13) | BIT(14) | BIT(15))
249 #define  SYS_CFG_BT_FUNC                BIT(16)
250 #define  SYS_CFG_VENDOR_ID              BIT(19)
251 #define  SYS_CFG_VENDOR_EXT_MASK        (BIT(18) | BIT(19))
252 #define   SYS_CFG_VENDOR_ID_TSMC        0
253 #define   SYS_CFG_VENDOR_ID_SMIC        BIT(18)
254 #define   SYS_CFG_VENDOR_ID_UMC         BIT(19)
255 #define  SYS_CFG_PAD_HWPD_IDN           BIT(22)
256 #define  SYS_CFG_TRP_VAUX_EN            BIT(23)
257 #define  SYS_CFG_TRP_BT_EN              BIT(24)
258 #define  SYS_CFG_SPS_LDO_SEL            BIT(24) /* 8192eu */
259 #define  SYS_CFG_BD_PKG_SEL             BIT(25)
260 #define  SYS_CFG_BD_HCI_SEL             BIT(26)
261 #define  SYS_CFG_TYPE_ID                BIT(27)
262 #define  SYS_CFG_RTL_ID                 BIT(23) /*  TestChip ID,
263                                                     1:Test(RLE); 0:MP(RL) */
264 #define  SYS_CFG_SPS_SEL                BIT(24) /*  1:LDO regulator mode;
265                                                     0:Switching regulator mode*/
266 #define  SYS_CFG_CHIP_VERSION_MASK      0xf000  /* Bit 12 - 15 */
267 #define  SYS_CFG_CHIP_VERSION_SHIFT     12
268
269 #define REG_GPIO_OUTSTS                 0x00f4  /*  For RTL8723 only. */
270 #define  GPIO_EFS_HCI_SEL               (BIT(0) | BIT(1))
271 #define  GPIO_PAD_HCI_SEL               (BIT(2) | BIT(3))
272 #define  GPIO_HCI_SEL                   (BIT(4) | BIT(5))
273 #define  GPIO_PKG_SEL_HCI               BIT(6)
274 #define  GPIO_FEN_GPS                   BIT(7)
275 #define  GPIO_FEN_BT                    BIT(8)
276 #define  GPIO_FEN_WL                    BIT(9)
277 #define  GPIO_FEN_PCI                   BIT(10)
278 #define  GPIO_FEN_USB                   BIT(11)
279 #define  GPIO_BTRF_HWPDN_N              BIT(12)
280 #define  GPIO_WLRF_HWPDN_N              BIT(13)
281 #define  GPIO_PDN_BT_N                  BIT(14)
282 #define  GPIO_PDN_GPS_N                 BIT(15)
283 #define  GPIO_BT_CTL_HWPDN              BIT(16)
284 #define  GPIO_GPS_CTL_HWPDN             BIT(17)
285 #define  GPIO_PPHY_SUSB                 BIT(20)
286 #define  GPIO_UPHY_SUSB                 BIT(21)
287 #define  GPIO_PCI_SUSEN                 BIT(22)
288 #define  GPIO_USB_SUSEN                 BIT(23)
289 #define  GPIO_RF_RL_ID                  (BIT(31) | BIT(30) | BIT(29) | BIT(28))
290
291 #define REG_SYS_CFG2                    0x00fc  /* 8192eu */
292
293 /* 0x0100 ~ 0x01FF      MACTOP General Configuration */
294 #define REG_CR                          0x0100
295 #define  CR_HCI_TXDMA_ENABLE            BIT(0)
296 #define  CR_HCI_RXDMA_ENABLE            BIT(1)
297 #define  CR_TXDMA_ENABLE                BIT(2)
298 #define  CR_RXDMA_ENABLE                BIT(3)
299 #define  CR_PROTOCOL_ENABLE             BIT(4)
300 #define  CR_SCHEDULE_ENABLE             BIT(5)
301 #define  CR_MAC_TX_ENABLE               BIT(6)
302 #define  CR_MAC_RX_ENABLE               BIT(7)
303 #define  CR_SW_BEACON_ENABLE            BIT(8)
304 #define  CR_SECURITY_ENABLE             BIT(9)
305 #define  CR_CALTIMER_ENABLE             BIT(10)
306
307 /* Media Status Register */
308 #define REG_MSR                         0x0102
309 #define  MSR_LINKTYPE_MASK              0x3
310 #define  MSR_LINKTYPE_NONE              0x0
311 #define  MSR_LINKTYPE_ADHOC             0x1
312 #define  MSR_LINKTYPE_STATION           0x2
313 #define  MSR_LINKTYPE_AP                0x3
314
315 #define REG_PBP                         0x0104
316 #define  PBP_PAGE_SIZE_RX_SHIFT         0
317 #define  PBP_PAGE_SIZE_TX_SHIFT         4
318 #define  PBP_PAGE_SIZE_64               0x0
319 #define  PBP_PAGE_SIZE_128              0x1
320 #define  PBP_PAGE_SIZE_256              0x2
321 #define  PBP_PAGE_SIZE_512              0x3
322 #define  PBP_PAGE_SIZE_1024             0x4
323
324 #define REG_TRXDMA_CTRL                 0x010c
325 #define  TRXDMA_CTRL_RXDMA_AGG_EN       BIT(2)
326 #define  TRXDMA_CTRL_VOQ_SHIFT          4
327 #define  TRXDMA_CTRL_VIQ_SHIFT          6
328 #define  TRXDMA_CTRL_BEQ_SHIFT          8
329 #define  TRXDMA_CTRL_BKQ_SHIFT          10
330 #define  TRXDMA_CTRL_MGQ_SHIFT          12
331 #define  TRXDMA_CTRL_HIQ_SHIFT          14
332 #define  TRXDMA_QUEUE_LOW               1
333 #define  TRXDMA_QUEUE_NORMAL            2
334 #define  TRXDMA_QUEUE_HIGH              3
335
336 #define REG_TRXFF_BNDY                  0x0114
337 #define REG_TRXFF_STATUS                0x0118
338 #define REG_RXFF_PTR                    0x011c
339 #define REG_HIMR                        0x0120
340 #define REG_HISR                        0x0124
341 #define REG_HIMRE                       0x0128
342 #define REG_HISRE                       0x012c
343 #define REG_CPWM                        0x012f
344 #define REG_FWIMR                       0x0130
345 #define REG_FWISR                       0x0134
346 #define REG_PKTBUF_DBG_CTRL             0x0140
347 #define REG_PKTBUF_DBG_DATA_L           0x0144
348 #define REG_PKTBUF_DBG_DATA_H           0x0148
349
350 #define REG_TC0_CTRL                    0x0150
351 #define REG_TC1_CTRL                    0x0154
352 #define REG_TC2_CTRL                    0x0158
353 #define REG_TC3_CTRL                    0x015c
354 #define REG_TC4_CTRL                    0x0160
355 #define REG_TCUNIT_BASE                 0x0164
356 #define REG_MBIST_START                 0x0174
357 #define REG_MBIST_DONE                  0x0178
358 #define REG_MBIST_FAIL                  0x017c
359 #define REG_C2HEVT_MSG_NORMAL           0x01a0
360 /* 8192EU/8723BU/8812 */
361 #define REG_C2HEVT_CMD_ID_8723B         0x01ae
362 #define REG_C2HEVT_CLEAR                0x01af
363 #define REG_C2HEVT_MSG_TEST             0x01b8
364 #define REG_MCUTST_1                    0x01c0
365 #define REG_FMTHR                       0x01c8
366 #define REG_HMTFR                       0x01cc
367 #define REG_HMBOX_0                     0x01d0
368 #define REG_HMBOX_1                     0x01d4
369 #define REG_HMBOX_2                     0x01d8
370 #define REG_HMBOX_3                     0x01dc
371
372 #define REG_LLT_INIT                    0x01e0
373 #define  LLT_OP_INACTIVE                0x0
374 #define  LLT_OP_WRITE                   (0x1 << 30)
375 #define  LLT_OP_READ                    (0x2 << 30)
376 #define  LLT_OP_MASK                    (0x3 << 30)
377
378 #define REG_BB_ACCEESS_CTRL             0x01e8
379 #define REG_BB_ACCESS_DATA              0x01ec
380
381 #define REG_HMBOX_EXT0_8723B            0x01f0
382 #define REG_HMBOX_EXT1_8723B            0x01f4
383 #define REG_HMBOX_EXT2_8723B            0x01f8
384 #define REG_HMBOX_EXT3_8723B            0x01fc
385
386 /* 0x0200 ~ 0x027F      TXDMA Configuration */
387 #define REG_RQPN                        0x0200
388 #define  RQPN_HI_PQ_SHIFT               0
389 #define  RQPN_LO_PQ_SHIFT               8
390 #define  RQPN_PUB_PQ_SHIFT              16
391 #define  RQPN_LOAD                      BIT(31)
392
393 #define REG_FIFOPAGE                    0x0204
394 #define REG_TDECTRL                     0x0208
395 #define REG_TXDMA_OFFSET_CHK            0x020c
396 #define  TXDMA_OFFSET_DROP_DATA_EN      BIT(9)
397 #define REG_TXDMA_STATUS                0x0210
398 #define REG_RQPN_NPQ                    0x0214
399 #define  RQPN_NPQ_SHIFT                 0
400 #define  RQPN_EPQ_SHIFT                 16
401
402 #define REG_AUTO_LLT                    0x0224
403 #define  AUTO_LLT_INIT_LLT              BIT(16)
404
405 #define REG_DWBCN1_CTRL_8723B           0x0228
406
407 /* 0x0280 ~ 0x02FF      RXDMA Configuration */
408 #define REG_RXDMA_AGG_PG_TH             0x0280  /* 0-7 : USB DMA size bits
409                                                    8-14: USB DMA timeout
410                                                    15  : Aggregation enable
411                                                          Only seems to be used
412                                                          on 8723bu/8192eu */
413 #define  RXDMA_USB_AGG_ENABLE           BIT(31)
414 #define REG_RXPKT_NUM                   0x0284
415 #define  RXPKT_NUM_RXDMA_IDLE           BIT(17)
416 #define  RXPKT_NUM_RW_RELEASE_EN        BIT(18)
417 #define REG_RXDMA_STATUS                0x0288
418
419 /* Presumably only found on newer chips such as 8723bu */
420 #define REG_RX_DMA_CTRL_8723B           0x0286
421 #define REG_RXDMA_PRO_8723B             0x0290
422
423 #define REG_RF_BB_CMD_ADDR              0x02c0
424 #define REG_RF_BB_CMD_DATA              0x02c4
425
426 /*  spec version 11 */
427 /* 0x0400 ~ 0x047F      Protocol Configuration */
428 /* 8192c, 8192d */
429 #define REG_VOQ_INFO                    0x0400
430 #define REG_VIQ_INFO                    0x0404
431 #define REG_BEQ_INFO                    0x0408
432 #define REG_BKQ_INFO                    0x040c
433 /* 8188e, 8723a, 8812a, 8821a, 8192e, 8723b */
434 #define REG_Q0_INFO                     0x400
435 #define REG_Q1_INFO                     0x404
436 #define REG_Q2_INFO                     0x408
437 #define REG_Q3_INFO                     0x40c
438
439 #define REG_MGQ_INFO                    0x0410
440 #define REG_HGQ_INFO                    0x0414
441 #define REG_BCNQ_INFO                   0x0418
442
443 #define REG_CPU_MGQ_INFORMATION         0x041c
444 #define REG_FWHW_TXQ_CTRL               0x0420
445 #define  FWHW_TXQ_CTRL_AMPDU_RETRY      BIT(7)
446 #define  FWHW_TXQ_CTRL_XMIT_MGMT_ACK    BIT(12)
447
448 #define REG_HWSEQ_CTRL                  0x0423
449 #define REG_TXPKTBUF_BCNQ_BDNY          0x0424
450 #define REG_TXPKTBUF_MGQ_BDNY           0x0425
451 #define REG_LIFETIME_EN                 0x0426
452 #define REG_MULTI_BCNQ_OFFSET           0x0427
453
454 #define REG_SPEC_SIFS                   0x0428
455 #define  SPEC_SIFS_CCK_MASK             0x00ff
456 #define  SPEC_SIFS_CCK_SHIFT            0
457 #define  SPEC_SIFS_OFDM_MASK            0xff00
458 #define  SPEC_SIFS_OFDM_SHIFT           8
459
460 #define REG_RETRY_LIMIT                 0x042a
461 #define  RETRY_LIMIT_LONG_SHIFT         0
462 #define  RETRY_LIMIT_LONG_MASK          0x003f
463 #define  RETRY_LIMIT_SHORT_SHIFT        8
464 #define  RETRY_LIMIT_SHORT_MASK         0x3f00
465
466 #define REG_DARFRC                      0x0430
467 #define REG_RARFRC                      0x0438
468 #define REG_RESPONSE_RATE_SET           0x0440
469 #define  RESPONSE_RATE_BITMAP_ALL       0xfffff
470 #define  RESPONSE_RATE_RRSR_CCK_ONLY_1M 0xffff1
471 #define  RSR_1M                         BIT(0)
472 #define  RSR_2M                         BIT(1)
473 #define  RSR_5_5M                       BIT(2)
474 #define  RSR_11M                        BIT(3)
475 #define  RSR_6M                         BIT(4)
476 #define  RSR_9M                         BIT(5)
477 #define  RSR_12M                        BIT(6)
478 #define  RSR_18M                        BIT(7)
479 #define  RSR_24M                        BIT(8)
480 #define  RSR_36M                        BIT(9)
481 #define  RSR_48M                        BIT(10)
482 #define  RSR_54M                        BIT(11)
483 #define  RSR_MCS0                       BIT(12)
484 #define  RSR_MCS1                       BIT(13)
485 #define  RSR_MCS2                       BIT(14)
486 #define  RSR_MCS3                       BIT(15)
487 #define  RSR_MCS4                       BIT(16)
488 #define  RSR_MCS5                       BIT(17)
489 #define  RSR_MCS6                       BIT(18)
490 #define  RSR_MCS7                       BIT(19)
491 #define  RSR_RSC_LOWER_SUB_CHANNEL      BIT(21) /* 0x200000 */
492 #define  RSR_RSC_UPPER_SUB_CHANNEL      BIT(22) /* 0x400000 */
493 #define  RSR_RSC_BANDWIDTH_40M          (RSR_RSC_UPPER_SUB_CHANNEL | \
494                                          RSR_RSC_LOWER_SUB_CHANNEL)
495 #define  RSR_ACK_SHORT_PREAMBLE         BIT(23)
496
497 #define REG_ARFR0                       0x0444
498 #define REG_ARFR1                       0x0448
499 #define REG_ARFR2                       0x044c
500 #define REG_ARFR3                       0x0450
501 #define REG_AMPDU_MAX_TIME_8723B        0x0456
502 #define REG_AGGLEN_LMT                  0x0458
503 #define REG_AMPDU_MIN_SPACE             0x045c
504 #define REG_TXPKTBUF_WMAC_LBK_BF_HD     0x045d
505 #define REG_FAST_EDCA_CTRL              0x0460
506 #define REG_RD_RESP_PKT_TH              0x0463
507 #define REG_INIRTS_RATE_SEL             0x0480
508 /* 8723bu */
509 #define REG_DATA_SUBCHANNEL             0x0483
510 /* 8723au */
511 #define REG_INIDATA_RATE_SEL            0x0484
512 /* MACID_SLEEP_1/3 for 8723b, 8192e, 8812a, 8821a */
513 #define REG_MACID_SLEEP_3_8732B         0x0484
514 #define REG_MACID_SLEEP_1_8732B         0x0488
515
516 #define REG_POWER_STATUS                0x04a4
517 #define REG_POWER_STAGE1                0x04b4
518 #define REG_POWER_STAGE2                0x04b8
519 #define REG_AMPDU_BURST_MODE_8723B      0x04bc
520 #define REG_PKT_VO_VI_LIFE_TIME         0x04c0
521 #define REG_PKT_BE_BK_LIFE_TIME         0x04c2
522 #define REG_STBC_SETTING                0x04c4
523 #define REG_QUEUE_CTRL                  0x04c6
524 #define REG_HT_SINGLE_AMPDU_8723B       0x04c7
525 #define REG_PROT_MODE_CTRL              0x04c8
526 #define REG_MAX_AGGR_NUM                0x04ca
527 #define REG_RTS_MAX_AGGR_NUM            0x04cb
528 #define REG_BAR_MODE_CTRL               0x04cc
529 #define REG_RA_TRY_RATE_AGG_LMT         0x04cf
530 /* MACID_DROP for 8723a */
531 #define REG_MACID_DROP_8732A            0x04d0
532 /* EARLY_MODE_CONTROL 8188e */
533 #define REG_EARLY_MODE_CONTROL_8188E    0x04d0
534 /* MACID_SLEEP_2 for 8723b, 8192e, 8812a, 8821a */
535 #define REG_MACID_SLEEP_2_8732B         0x04d0
536 #define REG_MACID_SLEEP                 0x04d4
537 #define REG_NQOS_SEQ                    0x04dc
538 #define REG_QOS_SEQ                     0x04de
539 #define REG_NEED_CPU_HANDLE             0x04e0
540 #define REG_PKT_LOSE_RPT                0x04e1
541 #define REG_PTCL_ERR_STATUS             0x04e2
542 #define REG_TX_REPORT_CTRL              0x04ec
543 #define  TX_REPORT_CTRL_TIMER_ENABLE    BIT(1)
544
545 #define REG_TX_REPORT_TIME              0x04f0
546 #define REG_DUMMY                       0x04fc
547
548 /* 0x0500 ~ 0x05FF      EDCA Configuration */
549 #define REG_EDCA_VO_PARAM               0x0500
550 #define REG_EDCA_VI_PARAM               0x0504
551 #define REG_EDCA_BE_PARAM               0x0508
552 #define REG_EDCA_BK_PARAM               0x050c
553 #define  EDCA_PARAM_ECW_MIN_SHIFT       8
554 #define  EDCA_PARAM_ECW_MAX_SHIFT       12
555 #define  EDCA_PARAM_TXOP_SHIFT          16
556 #define REG_BEACON_TCFG                 0x0510
557 #define REG_PIFS                        0x0512
558 #define REG_RDG_PIFS                    0x0513
559 #define REG_SIFS_CCK                    0x0514
560 #define REG_SIFS_OFDM                   0x0516
561 #define REG_TSFTR_SYN_OFFSET            0x0518
562 #define REG_AGGR_BREAK_TIME             0x051a
563 #define REG_SLOT                        0x051b
564 #define REG_TX_PTCL_CTRL                0x0520
565 #define REG_TXPAUSE                     0x0522
566 #define REG_DIS_TXREQ_CLR               0x0523
567 #define REG_RD_CTRL                     0x0524
568 #define REG_TBTT_PROHIBIT               0x0540
569 #define REG_RD_NAV_NXT                  0x0544
570 #define REG_NAV_PROT_LEN                0x0546
571
572 #define REG_BEACON_CTRL                 0x0550
573 #define REG_BEACON_CTRL_1               0x0551
574 #define  BEACON_ATIM                    BIT(0)
575 #define  BEACON_CTRL_MBSSID             BIT(1)
576 #define  BEACON_CTRL_TX_BEACON_RPT      BIT(2)
577 #define  BEACON_FUNCTION_ENABLE         BIT(3)
578 #define  BEACON_DISABLE_TSF_UPDATE      BIT(4)
579
580 #define REG_MBID_NUM                    0x0552
581 #define REG_DUAL_TSF_RST                0x0553
582 #define  DUAL_TSF_RESET_TSF0            BIT(0)
583 #define  DUAL_TSF_RESET_TSF1            BIT(1)
584 #define  DUAL_TSF_RESET_P2P             BIT(4)
585 #define  DUAL_TSF_TX_OK                 BIT(5)
586
587 /*  The same as REG_MBSSID_BCN_SPACE */
588 #define REG_BCN_INTERVAL                0x0554
589 #define REG_MBSSID_BCN_SPACE            0x0554
590
591 #define REG_DRIVER_EARLY_INT            0x0558
592 #define  DRIVER_EARLY_INT_TIME          5
593
594 #define REG_BEACON_DMA_TIME             0x0559
595 #define  BEACON_DMA_ATIME_INT_TIME      2
596
597 #define REG_ATIMWND                     0x055a
598 #define REG_USTIME_TSF_8723B            0x055c
599 #define REG_BCN_MAX_ERR                 0x055d
600 #define REG_RXTSF_OFFSET_CCK            0x055e
601 #define REG_RXTSF_OFFSET_OFDM           0x055f
602 #define REG_TSFTR                       0x0560
603 #define REG_TSFTR1                      0x0568
604 #define REG_INIT_TSFTR                  0x0564
605 #define REG_ATIMWND_1                   0x0570
606 #define REG_PSTIMER                     0x0580
607 #define REG_TIMER0                      0x0584
608 #define REG_TIMER1                      0x0588
609 #define REG_ACM_HW_CTRL                 0x05c0
610 #define  ACM_HW_CTRL_BK                 BIT(0)
611 #define  ACM_HW_CTRL_BE                 BIT(1)
612 #define  ACM_HW_CTRL_VI                 BIT(2)
613 #define  ACM_HW_CTRL_VO                 BIT(3)
614 #define REG_ACM_RST_CTRL                0x05c1
615 #define REG_ACMAVG                      0x05c2
616 #define REG_VO_ADMTIME                  0x05c4
617 #define REG_VI_ADMTIME                  0x05c6
618 #define REG_BE_ADMTIME                  0x05c8
619 #define REG_EDCA_RANDOM_GEN             0x05cc
620 #define REG_SCH_TXCMD                   0x05d0
621
622 /* define REG_FW_TSF_SYNC_CNT           0x04a0 */
623 #define REG_FW_RESET_TSF_CNT_1          0x05fc
624 #define REG_FW_RESET_TSF_CNT_0          0x05fd
625 #define REG_FW_BCN_DIS_CNT              0x05fe
626
627 /* 0x0600 ~ 0x07FF  WMAC Configuration */
628 #define REG_APSD_CTRL                   0x0600
629 #define  APSD_CTRL_OFF                  BIT(6)
630 #define  APSD_CTRL_OFF_STATUS           BIT(7)
631 #define REG_BW_OPMODE                   0x0603
632 #define  BW_OPMODE_20MHZ                BIT(2)
633 #define  BW_OPMODE_5G                   BIT(1)
634 #define  BW_OPMODE_11J                  BIT(0)
635
636 #define REG_TCR                         0x0604
637
638 /* Receive Configuration Register */
639 #define REG_RCR                         0x0608
640 #define  RCR_ACCEPT_AP                  BIT(0)  /* Accept all unicast packet */
641 #define  RCR_ACCEPT_PHYS_MATCH          BIT(1)  /* Accept phys match packet */
642 #define  RCR_ACCEPT_MCAST               BIT(2)
643 #define  RCR_ACCEPT_BCAST               BIT(3)
644 #define  RCR_ACCEPT_ADDR3               BIT(4)  /* Accept address 3 match
645                                                  packet */
646 #define  RCR_ACCEPT_PM                  BIT(5)  /* Accept power management
647                                                  packet */
648 #define  RCR_CHECK_BSSID_MATCH          BIT(6)  /* Accept BSSID match packet */
649 #define  RCR_CHECK_BSSID_BEACON         BIT(7)  /* Accept BSSID match packet
650                                                  (Rx beacon, probe rsp) */
651 #define  RCR_ACCEPT_CRC32               BIT(8)  /* Accept CRC32 error packet */
652 #define  RCR_ACCEPT_ICV                 BIT(9)  /* Accept ICV error packet */
653 #define  RCR_ACCEPT_DATA_FRAME          BIT(11) /* Accept all data pkt or use
654                                                    REG_RXFLTMAP2 */
655 #define  RCR_ACCEPT_CTRL_FRAME          BIT(12) /* Accept all control pkt or use
656                                                    REG_RXFLTMAP1 */
657 #define  RCR_ACCEPT_MGMT_FRAME          BIT(13) /* Accept all mgmt pkt or use
658                                                    REG_RXFLTMAP0 */
659 #define  RCR_HTC_LOC_CTRL               BIT(14) /* MFC<--HTC=1 MFC-->HTC=0 */
660 #define  RCR_UC_DATA_PKT_INT_ENABLE     BIT(16) /* Enable unicast data packet
661                                                    interrupt */
662 #define  RCR_BM_DATA_PKT_INT_ENABLE     BIT(17) /* Enable broadcast data packet
663                                                    interrupt */
664 #define  RCR_TIM_PARSER_ENABLE          BIT(18) /* Enable RX beacon TIM parser*/
665 #define  RCR_MFBEN                      BIT(22)
666 #define  RCR_LSIG_ENABLE                BIT(23) /* Enable LSIG TXOP Protection
667                                                    function. Search KEYCAM for
668                                                    each rx packet to check if
669                                                    LSIGEN bit is set. */
670 #define  RCR_MULTI_BSSID_ENABLE         BIT(24) /* Enable Multiple BssId */
671 #define  RCR_FORCE_ACK                  BIT(26)
672 #define  RCR_ACCEPT_BA_SSN              BIT(27) /* Accept BA SSN */
673 #define  RCR_APPEND_PHYSTAT             BIT(28)
674 #define  RCR_APPEND_ICV                 BIT(29)
675 #define  RCR_APPEND_MIC                 BIT(30)
676 #define  RCR_APPEND_FCS                 BIT(31) /* WMAC append FCS after */
677
678 #define REG_RX_PKT_LIMIT                0x060c
679 #define REG_RX_DLK_TIME                 0x060d
680 #define REG_RX_DRVINFO_SZ               0x060f
681
682 #define REG_MACID                       0x0610
683 #define REG_BSSID                       0x0618
684 #define REG_MAR                         0x0620
685 #define REG_MBIDCAMCFG                  0x0628
686
687 #define REG_USTIME_EDCA                 0x0638
688 #define REG_MAC_SPEC_SIFS               0x063a
689
690 /*  20100719 Joseph: Hardware register definition change. (HW datasheet v54) */
691         /*  [15:8]SIFS_R2T_OFDM, [7:0]SIFS_R2T_CCK */
692 #define REG_R2T_SIFS                    0x063c
693         /*  [15:8]SIFS_T2T_OFDM, [7:0]SIFS_T2T_CCK */
694 #define REG_T2T_SIFS                    0x063e
695 #define REG_ACKTO                       0x0640
696 #define REG_CTS2TO                      0x0641
697 #define REG_EIFS                        0x0642
698
699 /* WMA, BA, CCX */
700 #define REG_NAV_CTRL                    0x0650
701 /* In units of 128us */
702 #define REG_NAV_UPPER                   0x0652
703 #define  NAV_UPPER_UNIT                 128
704
705 #define REG_BACAMCMD                    0x0654
706 #define REG_BACAMCONTENT                0x0658
707 #define REG_LBDLY                       0x0660
708 #define REG_FWDLY                       0x0661
709 #define REG_RXERR_RPT                   0x0664
710 #define REG_WMAC_TRXPTCL_CTL            0x0668
711 #define  WMAC_TRXPTCL_CTL_BW_MASK       (BIT(7) | BIT(8))
712 #define  WMAC_TRXPTCL_CTL_BW_20         0
713 #define  WMAC_TRXPTCL_CTL_BW_40         BIT(7)
714 #define  WMAC_TRXPTCL_CTL_BW_80         BIT(8)
715
716 /*  Security */
717 #define REG_CAM_CMD                     0x0670
718 #define  CAM_CMD_POLLING                BIT(31)
719 #define  CAM_CMD_WRITE                  BIT(16)
720 #define  CAM_CMD_KEY_SHIFT              3
721 #define REG_CAM_WRITE                   0x0674
722 #define  CAM_WRITE_VALID                BIT(15)
723 #define REG_CAM_READ                    0x0678
724 #define REG_CAM_DEBUG                   0x067c
725 #define REG_SECURITY_CFG                0x0680
726 #define  SEC_CFG_TX_USE_DEFKEY          BIT(0)
727 #define  SEC_CFG_RX_USE_DEFKEY          BIT(1)
728 #define  SEC_CFG_TX_SEC_ENABLE          BIT(2)
729 #define  SEC_CFG_RX_SEC_ENABLE          BIT(3)
730 #define  SEC_CFG_SKBYA2                 BIT(4)
731 #define  SEC_CFG_NO_SKMC                BIT(5)
732 #define  SEC_CFG_TXBC_USE_DEFKEY        BIT(6)
733 #define  SEC_CFG_RXBC_USE_DEFKEY        BIT(7)
734
735 /*  Power */
736 #define REG_WOW_CTRL                    0x0690
737 #define REG_PSSTATUS                    0x0691
738 #define REG_PS_RX_INFO                  0x0692
739 #define REG_LPNAV_CTRL                  0x0694
740 #define REG_WKFMCAM_CMD                 0x0698
741 #define REG_WKFMCAM_RWD                 0x069c
742
743 /*
744  * RX Filters: each bit corresponds to the numerical value of the subtype.
745  * If it is set the subtype frame type is passed. The filter is only used when
746  * the RCR_ACCEPT_DATA_FRAME, RCR_ACCEPT_CTRL_FRAME, RCR_ACCEPT_MGMT_FRAME bit
747  * in the RCR are low.
748  *
749  * Example: Beacon subtype is binary 1000 which is decimal 8 so we have to set
750  * bit 8 (0x100) in REG_RXFLTMAP0 to enable reception.
751  */
752 #define REG_RXFLTMAP0                   0x06a0  /* Management frames */
753 #define REG_RXFLTMAP1                   0x06a2  /* Control frames */
754 #define REG_RXFLTMAP2                   0x06a4  /* Data frames */
755
756 #define REG_BCN_PSR_RPT                 0x06a8
757 #define REG_CALB32K_CTRL                0x06ac
758 #define REG_PKT_MON_CTRL                0x06b4
759 #define REG_BT_COEX_TABLE1              0x06c0
760 #define REG_BT_COEX_TABLE2              0x06c4
761 #define REG_BT_COEX_TABLE3              0x06c8
762 #define REG_BT_COEX_TABLE4              0x06cc
763 #define REG_WMAC_RESP_TXINFO            0x06d8
764
765 #define REG_MACID1                      0x0700
766 #define REG_BSSID1                      0x0708
767
768 /*
769  * This seems to be 8723bu specific
770  */
771 #define REG_BT_CONTROL_8723BU           0x0764
772 #define  BT_CONTROL_BT_GRANT            BIT(12)
773
774 #define REG_WLAN_ACT_CONTROL_8723B      0x076e
775
776 #define REG_FPGA0_RF_MODE               0x0800
777 #define  FPGA_RF_MODE                   BIT(0)
778 #define  FPGA_RF_MODE_JAPAN             BIT(1)
779 #define  FPGA_RF_MODE_CCK               BIT(24)
780 #define  FPGA_RF_MODE_OFDM              BIT(25)
781
782 #define REG_FPGA0_TX_INFO               0x0804
783 #define REG_FPGA0_PSD_FUNC              0x0808
784 #define REG_FPGA0_TX_GAIN               0x080c
785 #define REG_FPGA0_RF_TIMING1            0x0810
786 #define REG_FPGA0_RF_TIMING2            0x0814
787 #define REG_FPGA0_POWER_SAVE            0x0818
788 #define  FPGA0_PS_LOWER_CHANNEL         BIT(26)
789 #define  FPGA0_PS_UPPER_CHANNEL         BIT(27)
790
791 #define REG_FPGA0_XA_HSSI_PARM1         0x0820  /* RF 3 wire register */
792 #define  FPGA0_HSSI_PARM1_PI            BIT(8)
793 #define REG_FPGA0_XA_HSSI_PARM2         0x0824
794 #define REG_FPGA0_XB_HSSI_PARM1         0x0828
795 #define REG_FPGA0_XB_HSSI_PARM2         0x082c
796 #define  FPGA0_HSSI_3WIRE_DATA_LEN      0x800
797 #define  FPGA0_HSSI_3WIRE_ADDR_LEN      0x400
798 #define  FPGA0_HSSI_PARM2_ADDR_SHIFT    23
799 #define  FPGA0_HSSI_PARM2_ADDR_MASK     0x7f800000      /* 0xff << 23 */
800 #define  FPGA0_HSSI_PARM2_CCK_HIGH_PWR  BIT(9)
801 #define  FPGA0_HSSI_PARM2_EDGE_READ     BIT(31)
802
803 #define REG_TX_AGC_B_RATE18_06          0x0830
804 #define REG_TX_AGC_B_RATE54_24          0x0834
805 #define REG_TX_AGC_B_CCK1_55_MCS32      0x0838
806 #define REG_TX_AGC_B_MCS03_MCS00        0x083c
807
808 #define REG_FPGA0_XA_LSSI_PARM          0x0840
809 #define REG_FPGA0_XB_LSSI_PARM          0x0844
810 #define  FPGA0_LSSI_PARM_ADDR_SHIFT     20
811 #define  FPGA0_LSSI_PARM_ADDR_MASK      0x0ff00000
812 #define  FPGA0_LSSI_PARM_DATA_MASK      0x000fffff
813
814 #define REG_TX_AGC_B_MCS07_MCS04        0x0848
815 #define REG_TX_AGC_B_MCS11_MCS08        0x084c
816
817 #define REG_FPGA0_XCD_SWITCH_CTRL       0x085c
818
819 #define REG_FPGA0_XA_RF_INT_OE          0x0860  /* RF Channel switch */
820 #define REG_FPGA0_XB_RF_INT_OE          0x0864
821 #define  FPGA0_INT_OE_ANTENNA_AB_OPEN   0x000
822 #define  FPGA0_INT_OE_ANTENNA_A         BIT(8)
823 #define  FPGA0_INT_OE_ANTENNA_B         BIT(9)
824 #define  FPGA0_INT_OE_ANTENNA_MASK      (FPGA0_INT_OE_ANTENNA_A | \
825                                          FPGA0_INT_OE_ANTENNA_B)
826
827 #define REG_TX_AGC_B_MCS15_MCS12        0x0868
828 #define REG_TX_AGC_B_CCK11_A_CCK2_11    0x086c
829
830 #define REG_FPGA0_XAB_RF_SW_CTRL        0x0870
831 #define REG_FPGA0_XA_RF_SW_CTRL         0x0870  /* 16 bit */
832 #define REG_FPGA0_XB_RF_SW_CTRL         0x0872  /* 16 bit */
833 #define REG_FPGA0_XCD_RF_SW_CTRL        0x0874
834 #define REG_FPGA0_XC_RF_SW_CTRL         0x0874  /* 16 bit */
835 #define REG_FPGA0_XD_RF_SW_CTRL         0x0876  /* 16 bit */
836 #define  FPGA0_RF_3WIRE_DATA            BIT(0)
837 #define  FPGA0_RF_3WIRE_CLOC            BIT(1)
838 #define  FPGA0_RF_3WIRE_LOAD            BIT(2)
839 #define  FPGA0_RF_3WIRE_RW              BIT(3)
840 #define  FPGA0_RF_3WIRE_MASK            0xf
841 #define  FPGA0_RF_RFENV                 BIT(4)
842 #define  FPGA0_RF_TRSW                  BIT(5)  /* Useless now */
843 #define  FPGA0_RF_TRSWB                 BIT(6)
844 #define  FPGA0_RF_ANTSW                 BIT(8)
845 #define  FPGA0_RF_ANTSWB                BIT(9)
846 #define  FPGA0_RF_PAPE                  BIT(10)
847 #define  FPGA0_RF_PAPE5G                BIT(11)
848 #define  FPGA0_RF_BD_CTRL_SHIFT         16
849
850 #define REG_FPGA0_XAB_RF_PARM           0x0878  /* Antenna select path in ODM */
851 #define REG_FPGA0_XA_RF_PARM            0x0878  /* 16 bit */
852 #define REG_FPGA0_XB_RF_PARM            0x087a  /* 16 bit */
853 #define REG_FPGA0_XCD_RF_PARM           0x087c
854 #define REG_FPGA0_XC_RF_PARM            0x087c  /* 16 bit */
855 #define REG_FPGA0_XD_RF_PARM            0x087e  /* 16 bit */
856 #define  FPGA0_RF_PARM_RFA_ENABLE       BIT(1)
857 #define  FPGA0_RF_PARM_RFB_ENABLE       BIT(17)
858 #define  FPGA0_RF_PARM_CLK_GATE         BIT(31)
859
860 #define REG_FPGA0_ANALOG1               0x0880
861 #define REG_FPGA0_ANALOG2               0x0884
862 #define  FPGA0_ANALOG2_20MHZ            BIT(10)
863 #define REG_FPGA0_ANALOG3               0x0888
864 #define REG_FPGA0_ANALOG4               0x088c
865
866 #define REG_NHM_TH9_TH10_8723B          0x0890
867 #define REG_NHM_TIMER_8723B             0x0894
868 #define REG_NHM_TH3_TO_TH0_8723B        0x0898
869 #define REG_NHM_TH7_TO_TH4_8723B        0x089c
870
871 #define REG_FPGA0_XA_LSSI_READBACK      0x08a0  /* Tranceiver LSSI Readback */
872 #define REG_FPGA0_XB_LSSI_READBACK      0x08a4
873 #define REG_HSPI_XA_READBACK            0x08b8  /* Transceiver A HSPI read */
874 #define REG_HSPI_XB_READBACK            0x08bc  /* Transceiver B HSPI read */
875
876 #define REG_FPGA1_RF_MODE               0x0900
877
878 #define REG_FPGA1_TX_INFO               0x090c
879 #define REG_DPDT_CTRL                   0x092c  /* 8723BU */
880 #define REG_RFE_CTRL_ANTA_SRC           0x0930  /* 8723BU */
881 #define REG_RFE_PATH_SELECT             0x0940  /* 8723BU */
882 #define REG_RFE_BUFFER                  0x0944  /* 8723BU */
883 #define REG_S0S1_PATH_SWITCH            0x0948  /* 8723BU */
884
885 #define REG_CCK0_SYSTEM                 0x0a00
886 #define  CCK0_SIDEBAND                  BIT(4)
887
888 #define REG_CCK0_AFE_SETTING            0x0a04
889 #define  CCK0_AFE_RX_MASK               0x0f000000
890 #define  CCK0_AFE_RX_ANT_AB             BIT(24)
891 #define  CCK0_AFE_RX_ANT_A              0
892 #define  CCK0_AFE_RX_ANT_B              (BIT(24) | BIT(26))
893
894 #define REG_CONFIG_ANT_A                0x0b68
895 #define REG_CONFIG_ANT_B                0x0b6c
896
897 #define REG_OFDM0_TRX_PATH_ENABLE       0x0c04
898 #define OFDM_RF_PATH_RX_MASK            0x0f
899 #define OFDM_RF_PATH_RX_A               BIT(0)
900 #define OFDM_RF_PATH_RX_B               BIT(1)
901 #define OFDM_RF_PATH_RX_C               BIT(2)
902 #define OFDM_RF_PATH_RX_D               BIT(3)
903 #define OFDM_RF_PATH_TX_MASK            0xf0
904 #define OFDM_RF_PATH_TX_A               BIT(4)
905 #define OFDM_RF_PATH_TX_B               BIT(5)
906 #define OFDM_RF_PATH_TX_C               BIT(6)
907 #define OFDM_RF_PATH_TX_D               BIT(7)
908
909 #define REG_OFDM0_TR_MUX_PAR            0x0c08
910
911 #define REG_OFDM0_FA_RSTC               0x0c0c
912
913 #define REG_OFDM0_XA_RX_IQ_IMBALANCE    0x0c14
914 #define REG_OFDM0_XB_RX_IQ_IMBALANCE    0x0c1c
915
916 #define REG_OFDM0_ENERGY_CCA_THRES      0x0c4c
917
918 #define REG_OFDM0_RX_D_SYNC_PATH        0x0c40
919 #define  OFDM0_SYNC_PATH_NOTCH_FILTER   BIT(1)
920
921 #define REG_OFDM0_XA_AGC_CORE1          0x0c50
922 #define REG_OFDM0_XA_AGC_CORE2          0x0c54
923 #define REG_OFDM0_XB_AGC_CORE1          0x0c58
924 #define REG_OFDM0_XB_AGC_CORE2          0x0c5c
925 #define REG_OFDM0_XC_AGC_CORE1          0x0c60
926 #define REG_OFDM0_XC_AGC_CORE2          0x0c64
927 #define REG_OFDM0_XD_AGC_CORE1          0x0c68
928 #define REG_OFDM0_XD_AGC_CORE2          0x0c6c
929 #define  OFDM0_X_AGC_CORE1_IGI_MASK     0x0000007F
930
931 #define REG_OFDM0_AGC_PARM1             0x0c70
932
933 #define REG_OFDM0_AGCR_SSI_TABLE        0x0c78
934
935 #define REG_OFDM0_XA_TX_IQ_IMBALANCE    0x0c80
936 #define REG_OFDM0_XB_TX_IQ_IMBALANCE    0x0c88
937 #define REG_OFDM0_XC_TX_IQ_IMBALANCE    0x0c90
938 #define REG_OFDM0_XD_TX_IQ_IMBALANCE    0x0c98
939
940 #define REG_OFDM0_XC_TX_AFE             0x0c94
941 #define REG_OFDM0_XD_TX_AFE             0x0c9c
942
943 #define REG_OFDM0_RX_IQ_EXT_ANTA        0x0ca0
944
945 /* 8723bu */
946 #define REG_OFDM0_TX_PSDO_NOISE_WEIGHT  0x0ce4
947
948 #define REG_OFDM1_LSTF                  0x0d00
949 #define  OFDM_LSTF_PRIME_CH_LOW         BIT(10)
950 #define  OFDM_LSTF_PRIME_CH_HIGH        BIT(11)
951 #define  OFDM_LSTF_PRIME_CH_MASK        (OFDM_LSTF_PRIME_CH_LOW | \
952                                          OFDM_LSTF_PRIME_CH_HIGH)
953 #define  OFDM_LSTF_CONTINUE_TX          BIT(28)
954 #define  OFDM_LSTF_SINGLE_CARRIER       BIT(29)
955 #define  OFDM_LSTF_SINGLE_TONE          BIT(30)
956 #define  OFDM_LSTF_MASK                 0x70000000
957
958 #define REG_OFDM1_TRX_PATH_ENABLE       0x0d04
959
960 #define REG_TX_AGC_A_RATE18_06          0x0e00
961 #define REG_TX_AGC_A_RATE54_24          0x0e04
962 #define REG_TX_AGC_A_CCK1_MCS32         0x0e08
963 #define REG_TX_AGC_A_MCS03_MCS00        0x0e10
964 #define REG_TX_AGC_A_MCS07_MCS04        0x0e14
965 #define REG_TX_AGC_A_MCS11_MCS08        0x0e18
966 #define REG_TX_AGC_A_MCS15_MCS12        0x0e1c
967
968 #define REG_FPGA0_IQK                   0x0e28
969
970 #define REG_TX_IQK_TONE_A               0x0e30
971 #define REG_RX_IQK_TONE_A               0x0e34
972 #define REG_TX_IQK_PI_A                 0x0e38
973 #define REG_RX_IQK_PI_A                 0x0e3c
974
975 #define REG_TX_IQK                      0x0e40
976 #define REG_RX_IQK                      0x0e44
977 #define REG_IQK_AGC_PTS                 0x0e48
978 #define REG_IQK_AGC_RSP                 0x0e4c
979 #define REG_TX_IQK_TONE_B               0x0e50
980 #define REG_RX_IQK_TONE_B               0x0e54
981 #define REG_TX_IQK_PI_B                 0x0e58
982 #define REG_RX_IQK_PI_B                 0x0e5c
983 #define REG_IQK_AGC_CONT                0x0e60
984
985 #define REG_BLUETOOTH                   0x0e6c
986 #define REG_RX_WAIT_CCA                 0x0e70
987 #define REG_TX_CCK_RFON                 0x0e74
988 #define REG_TX_CCK_BBON                 0x0e78
989 #define REG_TX_OFDM_RFON                0x0e7c
990 #define REG_TX_OFDM_BBON                0x0e80
991 #define REG_TX_TO_RX                    0x0e84
992 #define REG_TX_TO_TX                    0x0e88
993 #define REG_RX_CCK                      0x0e8c
994
995 #define REG_TX_POWER_BEFORE_IQK_A       0x0e94
996 #define REG_TX_POWER_AFTER_IQK_A        0x0e9c
997
998 #define REG_RX_POWER_BEFORE_IQK_A       0x0ea0
999 #define REG_RX_POWER_BEFORE_IQK_A_2     0x0ea4
1000 #define REG_RX_POWER_AFTER_IQK_A        0x0ea8
1001 #define REG_RX_POWER_AFTER_IQK_A_2      0x0eac
1002
1003 #define REG_TX_POWER_BEFORE_IQK_B       0x0eb4
1004 #define REG_TX_POWER_AFTER_IQK_B        0x0ebc
1005
1006 #define REG_RX_POWER_BEFORE_IQK_B       0x0ec0
1007 #define REG_RX_POWER_BEFORE_IQK_B_2     0x0ec4
1008 #define REG_RX_POWER_AFTER_IQK_B        0x0ec8
1009 #define REG_RX_POWER_AFTER_IQK_B_2      0x0ecc
1010
1011 #define REG_RX_OFDM                     0x0ed0
1012 #define REG_RX_WAIT_RIFS                0x0ed4
1013 #define REG_RX_TO_RX                    0x0ed8
1014 #define REG_STANDBY                     0x0edc
1015 #define REG_SLEEP                       0x0ee0
1016 #define REG_PMPD_ANAEN                  0x0eec
1017
1018 #define REG_FW_START_ADDRESS            0x1000
1019
1020 #define REG_USB_INFO                    0xfe17
1021 #define REG_USB_HIMR                    0xfe38
1022 #define  USB_HIMR_TIMEOUT2              BIT(31)
1023 #define  USB_HIMR_TIMEOUT1              BIT(30)
1024 #define  USB_HIMR_PSTIMEOUT             BIT(29)
1025 #define  USB_HIMR_GTINT4                BIT(28)
1026 #define  USB_HIMR_GTINT3                BIT(27)
1027 #define  USB_HIMR_TXBCNERR              BIT(26)
1028 #define  USB_HIMR_TXBCNOK               BIT(25)
1029 #define  USB_HIMR_TSF_BIT32_TOGGLE      BIT(24)
1030 #define  USB_HIMR_BCNDMAINT3            BIT(23)
1031 #define  USB_HIMR_BCNDMAINT2            BIT(22)
1032 #define  USB_HIMR_BCNDMAINT1            BIT(21)
1033 #define  USB_HIMR_BCNDMAINT0            BIT(20)
1034 #define  USB_HIMR_BCNDOK3               BIT(19)
1035 #define  USB_HIMR_BCNDOK2               BIT(18)
1036 #define  USB_HIMR_BCNDOK1               BIT(17)
1037 #define  USB_HIMR_BCNDOK0               BIT(16)
1038 #define  USB_HIMR_HSISR_IND             BIT(15)
1039 #define  USB_HIMR_BCNDMAINT_E           BIT(14)
1040 /* RSVD BIT(13) */
1041 #define  USB_HIMR_CTW_END               BIT(12)
1042 /* RSVD BIT(11) */
1043 #define  USB_HIMR_C2HCMD                BIT(10)
1044 #define  USB_HIMR_CPWM2                 BIT(9)
1045 #define  USB_HIMR_CPWM                  BIT(8)
1046 #define  USB_HIMR_HIGHDOK               BIT(7)  /*  High Queue DMA OK
1047                                                     Interrupt */
1048 #define  USB_HIMR_MGNTDOK               BIT(6)  /*  Management Queue DMA OK
1049                                                     Interrupt */
1050 #define  USB_HIMR_BKDOK                 BIT(5)  /*  AC_BK DMA OK Interrupt */
1051 #define  USB_HIMR_BEDOK                 BIT(4)  /*  AC_BE DMA OK Interrupt */
1052 #define  USB_HIMR_VIDOK                 BIT(3)  /*  AC_VI DMA OK Interrupt */
1053 #define  USB_HIMR_VODOK                 BIT(2)  /*  AC_VO DMA Interrupt */
1054 #define  USB_HIMR_RDU                   BIT(1)  /*  Receive Descriptor
1055                                                     Unavailable */
1056 #define  USB_HIMR_ROK                   BIT(0)  /*  Receive DMA OK Interrupt */
1057
1058 #define REG_USB_SPECIAL_OPTION          0xfe55
1059 #define  USB_SPEC_USB_AGG_ENABLE        BIT(3)  /* Enable USB aggregation */
1060 #define  USB_SPEC_INT_BULK_SELECT       BIT(4)  /* Use interrupt endpoint to
1061                                                    deliver interrupt packet.
1062                                                    0: Use int, 1: use bulk */
1063 #define REG_USB_HRPWM                   0xfe58
1064 #define REG_USB_DMA_AGG_TO              0xfe5b
1065 #define REG_USB_AGG_TIMEOUT             0xfe5c
1066 #define REG_USB_AGG_THRESH              0xfe5d
1067
1068 #define REG_NORMAL_SIE_VID              0xfe60  /* 0xfe60 - 0xfe61 */
1069 #define REG_NORMAL_SIE_PID              0xfe62  /* 0xfe62 - 0xfe63 */
1070 #define REG_NORMAL_SIE_OPTIONAL         0xfe64
1071 #define REG_NORMAL_SIE_EP               0xfe65  /* 0xfe65 - 0xfe67 */
1072 #define REG_NORMAL_SIE_EP_TX            0xfe66
1073 #define  NORMAL_SIE_EP_TX_HIGH_MASK     0x000f
1074 #define  NORMAL_SIE_EP_TX_NORMAL_MASK   0x00f0
1075 #define  NORMAL_SIE_EP_TX_LOW_MASK      0x0f00
1076
1077 #define REG_NORMAL_SIE_PHY              0xfe68  /* 0xfe68 - 0xfe6b */
1078 #define REG_NORMAL_SIE_OPTIONAL2        0xfe6c
1079 #define REG_NORMAL_SIE_GPS_EP           0xfe6d  /* RTL8723 only */
1080 #define REG_NORMAL_SIE_MAC_ADDR         0xfe70  /* 0xfe70 - 0xfe75 */
1081 #define REG_NORMAL_SIE_STRING           0xfe80  /* 0xfe80 - 0xfedf */
1082
1083 /* RF6052 registers */
1084 #define RF6052_REG_AC                   0x00
1085 #define RF6052_REG_IQADJ_G1             0x01
1086 #define RF6052_REG_IQADJ_G2             0x02
1087 #define RF6052_REG_BS_PA_APSET_G1_G4    0x03
1088 #define RF6052_REG_BS_PA_APSET_G5_G8    0x04
1089 #define RF6052_REG_POW_TRSW             0x05
1090 #define RF6052_REG_GAIN_RX              0x06
1091 #define RF6052_REG_GAIN_TX              0x07
1092 #define RF6052_REG_TXM_IDAC             0x08
1093 #define RF6052_REG_IPA_G                0x09
1094 #define RF6052_REG_TXBIAS_G             0x0a
1095 #define RF6052_REG_TXPA_AG              0x0b
1096 #define RF6052_REG_IPA_A                0x0c
1097 #define RF6052_REG_TXBIAS_A             0x0d
1098 #define RF6052_REG_BS_PA_APSET_G9_G11   0x0e
1099 #define RF6052_REG_BS_IQGEN             0x0f
1100 #define RF6052_REG_MODE1                0x10
1101 #define RF6052_REG_MODE2                0x11
1102 #define RF6052_REG_RX_AGC_HP            0x12
1103 #define RF6052_REG_TX_AGC               0x13
1104 #define RF6052_REG_BIAS                 0x14
1105 #define RF6052_REG_IPA                  0x15
1106 #define RF6052_REG_TXBIAS               0x16
1107 #define RF6052_REG_POW_ABILITY          0x17
1108 #define RF6052_REG_MODE_AG              0x18    /* RF channel and BW switch */
1109 #define  MODE_AG_CHANNEL_MASK           0x3ff
1110 #define  MODE_AG_CHANNEL_20MHZ          BIT(10)
1111 #define  MODE_AG_BW_MASK                (BIT(10) | BIT(11))
1112 #define  MODE_AG_BW_20MHZ_8723B         (BIT(10) | BIT(11))
1113 #define  MODE_AG_BW_40MHZ_8723B         BIT(10)
1114 #define  MODE_AG_BW_80MHZ_8723B         0
1115
1116 #define RF6052_REG_TOP                  0x19
1117 #define RF6052_REG_RX_G1                0x1a
1118 #define RF6052_REG_RX_G2                0x1b
1119 #define RF6052_REG_RX_BB2               0x1c
1120 #define RF6052_REG_RX_BB1               0x1d
1121 #define RF6052_REG_RCK1                 0x1e
1122 #define RF6052_REG_RCK2                 0x1f
1123 #define RF6052_REG_TX_G1                0x20
1124 #define RF6052_REG_TX_G2                0x21
1125 #define RF6052_REG_TX_G3                0x22
1126 #define RF6052_REG_TX_BB1               0x23
1127 #define RF6052_REG_T_METER              0x24
1128 #define RF6052_REG_SYN_G1               0x25    /* RF TX Power control */
1129 #define RF6052_REG_SYN_G2               0x26    /* RF TX Power control */
1130 #define RF6052_REG_SYN_G3               0x27    /* RF TX Power control */
1131 #define RF6052_REG_SYN_G4               0x28    /* RF TX Power control */
1132 #define RF6052_REG_SYN_G5               0x29    /* RF TX Power control */
1133 #define RF6052_REG_SYN_G6               0x2a    /* RF TX Power control */
1134 #define RF6052_REG_SYN_G7               0x2b    /* RF TX Power control */
1135 #define RF6052_REG_SYN_G8               0x2c    /* RF TX Power control */
1136
1137 #define RF6052_REG_RCK_OS               0x30    /* RF TX PA control */
1138
1139 #define RF6052_REG_TXPA_G1              0x31    /* RF TX PA control */
1140 #define RF6052_REG_TXPA_G2              0x32    /* RF TX PA control */
1141 #define RF6052_REG_TXPA_G3              0x33    /* RF TX PA control */
1142
1143 /*
1144  * NextGen regs: 8723BU
1145  */
1146 #define RF6052_REG_T_METER_8723B        0x42
1147 #define RF6052_REG_UNKNOWN_43           0x43
1148 #define RF6052_REG_UNKNOWN_55           0x55
1149 #define RF6052_REG_UNKNOWN_56           0x56
1150 #define RF6052_REG_S0S1                 0xb0
1151 #define RF6052_REG_UNKNOWN_DF           0xdf
1152 #define RF6052_REG_UNKNOWN_ED           0xed
1153 #define RF6052_REG_WE_LUT               0xef