linux/drivers/staging/rtl8188eu/include/rtl8188e_spec.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2/******************************************************************************
   3 *
   4 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
   5 *
   6 *******************************************************************************/
   7#ifndef __RTL8188E_SPEC_H__
   8#define __RTL8188E_SPEC_H__
   9
  10/*  8188E PKT_BUFF_ACCESS_CTRL value */
  11#define TXPKT_BUF_SELECT                0x69
  12#define DISABLE_TRXPKT_BUF_ACCESS       0x0
  13
  14/*      0x0000h ~ 0x00FFh       System Configuration */
  15#define REG_SYS_ISO_CTRL                0x0000
  16#define REG_SYS_FUNC_EN                 0x0002
  17#define REG_APS_FSMCO                   0x0004
  18#define REG_SYS_CLKR                    0x0008
  19#define REG_9346CR                      0x000A
  20#define REG_EE_VPD                      0x000C
  21#define REG_AFE_MISC                    0x0010
  22#define REG_SPS0_CTRL                   0x0011
  23#define REG_SPS_OCP_CFG                 0x0018
  24#define REG_RSV_CTRL                    0x001C
  25#define REG_RF_CTRL                     0x001F
  26#define REG_LDOA15_CTRL                 0x0020
  27#define REG_LDOV12D_CTRL                0x0021
  28#define REG_LDOHCI12_CTRL               0x0022
  29#define REG_LPLDO_CTRL                  0x0023
  30#define REG_AFE_XTAL_CTRL               0x0024
  31#define REG_AFE_PLL_CTRL                0x0028
  32#define REG_APE_PLL_CTRL_EXT            0x002c
  33#define REG_EFUSE_CTRL                  0x0030
  34#define REG_EFUSE_TEST                  0x0034
  35#define REG_GPIO_MUXCFG                 0x0040
  36#define REG_GPIO_IO_SEL                 0x0042
  37#define REG_MAC_PINMUX_CFG              0x0043
  38#define REG_GPIO_PIN_CTRL               0x0044
  39#define REG_GPIO_INTM                   0x0048
  40#define REG_LEDCFG0                     0x004C
  41#define REG_LEDCFG1                     0x004D
  42#define REG_LEDCFG2                     0x004E
  43#define REG_LEDCFG3                     0x004F
  44#define REG_FSIMR                       0x0050
  45#define REG_FSISR                       0x0054
  46#define REG_HSIMR                       0x0058
  47#define REG_HSISR                       0x005c
  48#define REG_BB_PAD_CTRL                 0x0064
  49#define REG_MCUFWDL                     0x0080
  50#define REG_WOL_EVENT                   0x0081 /* RTL8188E */
  51#define REG_MCUTSTCFG                   0x0084
  52#define REG_HMEBOX_E0                   0x0088
  53#define REG_HMEBOX_E1                   0x008A
  54#define REG_HMEBOX_E2                   0x008C
  55#define REG_HMEBOX_E3                   0x008E
  56#define REG_HMEBOX_EXT_0                0x01F0
  57#define REG_HMEBOX_EXT_1                0x01F4
  58#define REG_HMEBOX_EXT_2                0x01F8
  59#define REG_HMEBOX_EXT_3                0x01FC
  60#define REG_HIMR_88E                    0x00B0
  61#define REG_HISR_88E                    0x00B4
  62#define REG_HIMRE_88E                   0x00B8
  63#define REG_HISRE_88E                   0x00BC
  64#define REG_EFUSE_ACCESS                0x00CF  /*  Efuse access protection
  65                                                 * for RTL8723
  66                                                 */
  67#define REG_BIST_SCAN                   0x00D0
  68#define REG_BIST_RPT                    0x00D4
  69#define REG_BIST_ROM_RPT                0x00D8
  70#define REG_USB_SIE_INTF                0x00E0
  71#define REG_PCIE_MIO_INTF               0x00E4
  72#define REG_PCIE_MIO_INTD               0x00E8
  73#define REG_HPON_FSM                    0x00EC
  74#define REG_SYS_CFG                     0x00F0
  75#define REG_GPIO_OUTSTS                 0x00F4  /*  For RTL8723 only. */
  76#define REG_TYPE_ID                     0x00FC
  77
  78#define REG_MAC_PHY_CTRL_NORMAL         0x00f8
  79
  80/*      0x0100h ~ 0x01FFh       MACTOP General Configuration */
  81#define REG_CR                          0x0100
  82#define REG_PBP                         0x0104
  83#define REG_PKT_BUFF_ACCESS_CTRL        0x0106
  84#define REG_TRXDMA_CTRL                 0x010C
  85#define REG_TRXFF_BNDY                  0x0114
  86#define REG_TRXFF_STATUS                0x0118
  87#define REG_RXFF_PTR                    0x011C
  88/* define REG_HIMR                      0x0120 */
  89/* define REG_HISR                      0x0124 */
  90#define REG_HIMRE                       0x0128
  91#define REG_HISRE                       0x012C
  92#define REG_CPWM                        0x012F
  93#define REG_FWIMR                       0x0130
  94#define REG_FTIMR                       0x0138
  95#define REG_FWISR                       0x0134
  96#define REG_PKTBUF_DBG_CTRL             0x0140
  97#define REG_PKTBUF_DBG_ADDR             (REG_PKTBUF_DBG_CTRL)
  98#define REG_RXPKTBUF_DBG                (REG_PKTBUF_DBG_CTRL + 2)
  99#define REG_TXPKTBUF_DBG                (REG_PKTBUF_DBG_CTRL + 3)
 100#define REG_RXPKTBUF_CTRL               (REG_PKTBUF_DBG_CTRL + 2)
 101#define REG_PKTBUF_DBG_DATA_L           0x0144
 102#define REG_PKTBUF_DBG_DATA_H           0x0148
 103
 104#define REG_TC0_CTRL                    0x0150
 105#define REG_TC1_CTRL                    0x0154
 106#define REG_TC2_CTRL                    0x0158
 107#define REG_TC3_CTRL                    0x015C
 108#define REG_TC4_CTRL                    0x0160
 109#define REG_TCUNIT_BASE                 0x0164
 110#define REG_MBIST_START                 0x0174
 111#define REG_MBIST_DONE                  0x0178
 112#define REG_MBIST_FAIL                  0x017C
 113#define REG_32K_CTRL                    0x0194 /* RTL8188E */
 114#define REG_C2HEVT_MSG_NORMAL           0x01A0
 115#define REG_C2HEVT_CLEAR                0x01AF
 116#define REG_MCUTST_1                    0x01c0
 117#define REG_FMETHR                      0x01C8
 118#define REG_HMETFR                      0x01CC
 119#define REG_HMEBOX_0                    0x01D0
 120#define REG_HMEBOX_1                    0x01D4
 121#define REG_HMEBOX_2                    0x01D8
 122#define REG_HMEBOX_3                    0x01DC
 123
 124#define REG_LLT_INIT                    0x01E0
 125
 126/*      0x0200h ~ 0x027Fh       TXDMA Configuration */
 127#define REG_RQPN                        0x0200
 128#define REG_FIFOPAGE                    0x0204
 129#define REG_TDECTRL                     0x0208
 130#define REG_TXDMA_OFFSET_CHK            0x020C
 131#define REG_TXDMA_STATUS                0x0210
 132#define REG_RQPN_NPQ                    0x0214
 133
 134/*      0x0280h ~ 0x02FFh       RXDMA Configuration */
 135#define         REG_RXDMA_AGG_PG_TH     0x0280
 136#define REG_RXPKT_NUM                   0x0284
 137#define         REG_RXDMA_STATUS        0x0288
 138
 139/*      0x0300h ~ 0x03FFh       PCIe */
 140#define REG_PCIE_CTRL_REG               0x0300
 141#define REG_INT_MIG                     0x0304  /*  Interrupt Migration */
 142#define REG_BCNQ_DESA                   0x0308  /*  TX Beacon Descr Address */
 143#define REG_HQ_DESA                     0x0310  /*  TX High Queue Descr Addr */
 144#define REG_MGQ_DESA                    0x0318  /*  TX Manage Queue Descr Addr*/
 145#define REG_VOQ_DESA                    0x0320  /*  TX VO Queue Descr Addr */
 146#define REG_VIQ_DESA                    0x0328  /*  TX VI Queue Descr Addr */
 147#define REG_BEQ_DESA                    0x0330  /*  TX BE Queue Descr Addr */
 148#define REG_BKQ_DESA                    0x0338  /*  TX BK Queue Descr Addr */
 149#define REG_RX_DESA                     0x0340  /*  RX Queue Descr Addr */
 150#define REG_MDIO                        0x0354  /*  MDIO for Access PCIE PHY */
 151#define REG_DBG_SEL                     0x0360  /*  Debug Selection Register */
 152#define REG_PCIE_HRPWM                  0x0361  /* PCIe RPWM */
 153#define REG_PCIE_HCPWM                  0x0363  /* PCIe CPWM */
 154#define REG_WATCH_DOG                   0x0368
 155
 156/*  spec version 11 */
 157/*      0x0400h ~ 0x047Fh       Protocol Configuration */
 158#define REG_VOQ_INFORMATION             0x0400
 159#define REG_VIQ_INFORMATION             0x0404
 160#define REG_BEQ_INFORMATION             0x0408
 161#define REG_BKQ_INFORMATION             0x040C
 162#define REG_MGQ_INFORMATION             0x0410
 163#define REG_HGQ_INFORMATION             0x0414
 164#define REG_BCNQ_INFORMATION            0x0418
 165#define REG_TXPKT_EMPTY                 0x041A
 166
 167#define REG_CPU_MGQ_INFORMATION         0x041C
 168#define REG_FWHW_TXQ_CTRL               0x0420
 169#define REG_HWSEQ_CTRL                  0x0423
 170#define REG_TXPKTBUF_BCNQ_BDNY          0x0424
 171#define REG_TXPKTBUF_MGQ_BDNY           0x0425
 172#define REG_LIFETIME_EN                 0x0426
 173#define REG_MULTI_BCNQ_OFFSET           0x0427
 174#define REG_SPEC_SIFS                   0x0428
 175#define REG_RL                          0x042A
 176#define REG_DARFRC                      0x0430
 177#define REG_RARFRC                      0x0438
 178#define REG_RRSR                        0x0440
 179#define REG_ARFR0                       0x0444
 180#define REG_ARFR1                       0x0448
 181#define REG_ARFR2                       0x044C
 182#define REG_ARFR3                       0x0450
 183#define REG_AGGLEN_LMT                  0x0458
 184#define REG_AMPDU_MIN_SPACE             0x045C
 185#define REG_TXPKTBUF_WMAC_LBK_BF_HD     0x045D
 186#define REG_FAST_EDCA_CTRL              0x0460
 187#define REG_RD_RESP_PKT_TH              0x0463
 188#define REG_INIRTS_RATE_SEL             0x0480
 189/* define REG_INIDATA_RATE_SEL          0x0484 */
 190#define REG_POWER_STATUS                0x04A4
 191#define REG_POWER_STAGE1                0x04B4
 192#define REG_POWER_STAGE2                0x04B8
 193#define REG_PKT_VO_VI_LIFE_TIME         0x04C0
 194#define REG_PKT_BE_BK_LIFE_TIME         0x04C2
 195#define REG_STBC_SETTING                0x04C4
 196#define REG_PROT_MODE_CTRL              0x04C8
 197#define REG_MAX_AGGR_NUM                0x04CA
 198#define REG_RTS_MAX_AGGR_NUM            0x04CB
 199#define REG_BAR_MODE_CTRL               0x04CC
 200#define REG_RA_TRY_RATE_AGG_LMT         0x04CF
 201#define REG_EARLY_MODE_CONTROL          0x4D0
 202#define REG_NQOS_SEQ                    0x04DC
 203#define REG_QOS_SEQ                     0x04DE
 204#define REG_NEED_CPU_HANDLE             0x04E0
 205#define REG_PKT_LOSE_RPT                0x04E1
 206#define REG_PTCL_ERR_STATUS             0x04E2
 207#define REG_TX_RPT_CTRL                 0x04EC
 208#define REG_TX_RPT_TIME                 0x04F0  /*  2 byte */
 209#define REG_DUMMY                       0x04FC
 210
 211/*      0x0500h ~ 0x05FFh       EDCA Configuration */
 212#define REG_EDCA_VO_PARAM               0x0500
 213#define REG_EDCA_VI_PARAM               0x0504
 214#define REG_EDCA_BE_PARAM               0x0508
 215#define REG_EDCA_BK_PARAM               0x050C
 216#define REG_BCNTCFG                     0x0510
 217#define REG_PIFS                        0x0512
 218#define REG_RDG_PIFS                    0x0513
 219#define REG_SIFS_CTX                    0x0514
 220#define REG_SIFS_TRX                    0x0516
 221#define REG_TSFTR_SYN_OFFSET            0x0518
 222#define REG_AGGR_BREAK_TIME             0x051A
 223#define REG_SLOT                        0x051B
 224#define REG_TX_PTCL_CTRL                0x0520
 225#define REG_TXPAUSE                     0x0522
 226#define REG_DIS_TXREQ_CLR               0x0523
 227#define REG_RD_CTRL                     0x0524
 228/*  Format for offset 540h-542h:
 229 *      [3:0]:   TBTT prohibit setup in unit of 32us. The time for HW getting
 230 *               beacon content before TBTT.
 231 *
 232 *      [7:4]:   Reserved.
 233 *      [19:8]:  TBTT prohibit hold in unit of 32us. The time for HW holding
 234 *               to send the beacon packet.
 235 *
 236 *      [23:20]: Reserved
 237 *  Description:
 238 *                    |
 239 *      |<--Setup--|--Hold------------>|
 240 *      --------------|----------------------
 241 *                 |
 242 *                TBTT
 243 *  Note: We cannot update beacon content to HW or send any AC packets during
 244 *        the time between Setup and Hold.
 245 */
 246#define REG_TBTT_PROHIBIT               0x0540
 247#define REG_RD_NAV_NXT                  0x0544
 248#define REG_NAV_PROT_LEN                0x0546
 249#define REG_BCN_CTRL                    0x0550
 250#define REG_BCN_CTRL_1                  0x0551
 251#define REG_MBID_NUM                    0x0552
 252#define REG_DUAL_TSF_RST                0x0553
 253#define REG_BCN_INTERVAL                0x0554
 254#define REG_DRVERLYINT                  0x0558
 255#define REG_BCNDMATIM                   0x0559
 256#define REG_ATIMWND                     0x055A
 257#define REG_BCN_MAX_ERR                 0x055D
 258#define REG_RXTSF_OFFSET_CCK            0x055E
 259#define REG_RXTSF_OFFSET_OFDM           0x055F
 260#define REG_TSFTR                       0x0560
 261#define REG_TSFTR1                      0x0568
 262#define REG_ATIMWND_1                   0x0570
 263#define REG_PSTIMER                     0x0580
 264#define REG_TIMER0                      0x0584
 265#define REG_TIMER1                      0x0588
 266#define REG_ACMHWCTRL                   0x05C0
 267
 268/* define REG_FW_TSF_SYNC_CNT           0x04A0 */
 269#define REG_FW_RESET_TSF_CNT_1          0x05FC
 270#define REG_FW_RESET_TSF_CNT_0          0x05FD
 271#define REG_FW_BCN_DIS_CNT              0x05FE
 272
 273/*      0x0600h ~ 0x07FFh       WMAC Configuration */
 274#define REG_APSD_CTRL                   0x0600
 275#define REG_BWOPMODE                    0x0603
 276#define REG_TCR                         0x0604
 277#define REG_RCR                         0x0608
 278#define REG_RX_PKT_LIMIT                0x060C
 279#define REG_RX_DLK_TIME                 0x060D
 280#define REG_RX_DRVINFO_SZ               0x060F
 281
 282#define REG_MACID                       0x0610
 283#define REG_BSSID                       0x0618
 284#define REG_MAR                         0x0620
 285#define REG_MBIDCAMCFG                  0x0628
 286
 287#define REG_USTIME_EDCA                 0x0638
 288#define REG_MAC_SPEC_SIFS               0x063A
 289
 290/*  20100719 Joseph: Hardware register definition change. (HW datasheet v54) */
 291/*  [15:8]SIFS_R2T_OFDM, [7:0]SIFS_R2T_CCK */
 292#define REG_R2T_SIFS                    0x063C
 293/*  [15:8]SIFS_T2T_OFDM, [7:0]SIFS_T2T_CCK */
 294#define REG_T2T_SIFS                    0x063E
 295#define REG_ACKTO                       0x0640
 296#define REG_CTS2TO                      0x0641
 297#define REG_EIFS                        0x0642
 298
 299/* RXERR_RPT */
 300#define RXERR_TYPE_OFDM_PPDU            0
 301#define RXERR_TYPE_OFDM_false_ALARM     1
 302#define RXERR_TYPE_OFDM_MPDU_OK         2
 303#define RXERR_TYPE_OFDM_MPDU_FAIL       3
 304#define RXERR_TYPE_CCK_PPDU             4
 305#define RXERR_TYPE_CCK_false_ALARM      5
 306#define RXERR_TYPE_CCK_MPDU_OK          6
 307#define RXERR_TYPE_CCK_MPDU_FAIL        7
 308#define RXERR_TYPE_HT_PPDU              8
 309#define RXERR_TYPE_HT_false_ALARM       9
 310#define RXERR_TYPE_HT_MPDU_TOTAL        10
 311#define RXERR_TYPE_HT_MPDU_OK           11
 312#define RXERR_TYPE_HT_MPDU_FAIL         12
 313#define RXERR_TYPE_RX_FULL_DROP         15
 314
 315#define RXERR_COUNTER_MASK              0xFFFFF
 316#define RXERR_RPT_RST                   BIT(27)
 317#define _RXERR_RPT_SEL(type)            ((type) << 28)
 318
 319/*  Note:
 320 *      The NAV upper value is very important to WiFi 11n 5.2.3 NAV test.
 321 *      The default value is always too small, but the WiFi TestPlan test
 322 *      by 25,000 microseconds of NAV through sending CTS in the air.
 323 *      We must update this value greater than 25,000 microseconds to pass
 324 *      the item. The offset of NAV_UPPER in 8192C Spec is incorrect, and
 325 *      the offset should be 0x0652.
 326 */
 327#define REG_NAV_UPPER                   0x0652  /*  unit of 128 */
 328
 329/* WMA, BA, CCX */
 330/* define REG_NAV_CTRL                  0x0650 */
 331#define REG_BACAMCMD                    0x0654
 332#define REG_BACAMCONTENT                0x0658
 333#define REG_LBDLY                       0x0660
 334#define REG_FWDLY                       0x0661
 335#define REG_RXERR_RPT                   0x0664
 336#define REG_WMAC_TRXPTCL_CTL            0x0668
 337
 338/*  Security */
 339#define REG_CAMCMD                      0x0670
 340#define REG_CAMWRITE                    0x0674
 341#define REG_CAMREAD                     0x0678
 342#define REG_CAMDBG                      0x067C
 343#define REG_SECCFG                      0x0680
 344
 345/*  Power */
 346#define REG_WOW_CTRL                    0x0690
 347#define REG_PS_RX_INFO                  0x0692
 348#define REG_UAPSD_TID                   0x0693
 349#define REG_WKFMCAM_CMD                 0x0698
 350#define REG_WKFMCAM_NUM_88E             0x698
 351#define REG_RXFLTMAP0                   0x06A0
 352#define REG_RXFLTMAP1                   0x06A2
 353#define REG_RXFLTMAP2                   0x06A4
 354#define REG_BCN_PSR_RPT                 0x06A8
 355#define REG_BT_COEX_TABLE               0x06C0
 356
 357/*  Hardware Port 2 */
 358#define REG_MACID1                      0x0700
 359#define REG_BSSID1                      0x0708
 360
 361/*      0xFE00h ~ 0xFE55h       USB Configuration */
 362#define REG_USB_INFO                    0xFE17
 363#define REG_USB_SPECIAL_OPTION          0xFE55
 364#define REG_USB_DMA_AGG_TO              0xFE5B
 365#define REG_USB_AGG_TO                  0xFE5C
 366#define REG_USB_AGG_TH                  0xFE5D
 367
 368/*  For normal chip */
 369#define REG_NORMAL_SIE_VID              0xFE60          /*  0xFE60~0xFE61 */
 370#define REG_NORMAL_SIE_PID              0xFE62          /*  0xFE62~0xFE63 */
 371#define REG_NORMAL_SIE_OPTIONAL         0xFE64
 372#define REG_NORMAL_SIE_EP               0xFE65          /*  0xFE65~0xFE67 */
 373#define REG_NORMAL_SIE_PHY              0xFE68          /*  0xFE68~0xFE6B */
 374#define REG_NORMAL_SIE_OPTIONAL2        0xFE6C
 375#define REG_NORMAL_SIE_GPS_EP           0xFE6D  /*  0xFE6D, for RTL8723 only. */
 376#define REG_NORMAL_SIE_MAC_ADDR         0xFE70          /*  0xFE70~0xFE75 */
 377#define REG_NORMAL_SIE_STRING           0xFE80          /*  0xFE80~0xFEDF */
 378
 379/*  TODO: use these definition when using REG_xxx naming rule. */
 380/*  NOTE: DO NOT Remove these definition. Use later. */
 381
 382#define EFUSE_CTRL                      REG_EFUSE_CTRL  /*  E-Fuse Control. */
 383#define EFUSE_TEST                      REG_EFUSE_TEST  /*  E-Fuse Test. */
 384#define MSR                             (REG_CR + 2)    /*  Media Status reg */
 385#define ISR                             REG_HISR_88E
 386/*  Timing Sync Function Timer Register. */
 387#define TSFR                            REG_TSFTR
 388
 389#define         PBP                     REG_PBP
 390
 391/*  Redifine MACID register, to compatible prior ICs. */
 392/*  MAC ID Register, Offset 0x0050-0x0053 */
 393#define IDR0                            REG_MACID
 394/*  MAC ID Register, Offset 0x0054-0x0055 */
 395#define IDR4                            (REG_MACID + 4)
 396
 397/*  9. Security Control Registers       (Offset: ) */
 398/* IN 8190 Data Sheet is called CAMcmd */
 399#define RWCAM                           REG_CAMCMD
 400/*  Software write CAM input content */
 401#define WCAMI                           REG_CAMWRITE
 402/*  Software read/write CAM config */
 403#define RCAMO                           REG_CAMREAD
 404#define CAMDBG                          REG_CAMDBG
 405/* Security Configuration Register */
 406#define SECR                            REG_SECCFG
 407
 408/*  Unused register */
 409#define UnusedRegister                  0x1BF
 410#define DCAM                            UnusedRegister
 411#define PSR                             UnusedRegister
 412#define BBAddr                          UnusedRegister
 413#define PhyDataR                        UnusedRegister
 414
 415/*  Min Spacing related settings. */
 416#define MAX_MSS_DENSITY_2T              0x13
 417#define MAX_MSS_DENSITY_1T              0x0A
 418
 419/*  EEPROM enable when set 1 */
 420#define CmdEEPROM_En                    BIT(5)
 421/*  System EEPROM select, 0: boot from E-FUSE, 1: The EEPROM used is 9346 */
 422#define CmdEERPOMSEL                    BIT(4)
 423#define Cmd9346CR_9356SEL               BIT(4)
 424
 425/*        8192C GPIO MUX Configuration Register (offset 0x40, 4 byte) */
 426#define GPIOSEL_GPIO                    0
 427#define GPIOSEL_ENBT                    BIT(5)
 428
 429/*        8192C GPIO PIN Control Register (offset 0x44, 4 byte) */
 430/*  GPIO pins input value */
 431#define GPIO_IN                         REG_GPIO_PIN_CTRL
 432/*  GPIO pins output value */
 433#define GPIO_OUT                        (REG_GPIO_PIN_CTRL + 1)
 434/*  GPIO pins output enable when a bit is set to "1"; otherwise,
 435 *  input is configured.
 436 */
 437#define GPIO_IO_SEL                     (REG_GPIO_PIN_CTRL + 2)
 438#define GPIO_MOD                        (REG_GPIO_PIN_CTRL + 3)
 439
 440/*   88EU (MSR) Media Status Register   (Offset 0x4C, 8 bits) */
 441#define USB_INTR_CONTENT_C2H_OFFSET     0
 442#define USB_INTR_CONTENT_CPWM1_OFFSET   16
 443#define USB_INTR_CONTENT_CPWM2_OFFSET   20
 444#define USB_INTR_CONTENT_HISR_OFFSET    48
 445#define USB_INTR_CONTENT_HISRE_OFFSET   52
 446
 447/*  88E Driver Initialization Offload REG_FDHM0(Offset 0x88, 8 bits) */
 448/* IOL config for REG_FDHM0(Reg0x88) */
 449#define CMD_INIT_LLT                    BIT(0)
 450#define CMD_READ_EFUSE_MAP              BIT(1)
 451#define CMD_EFUSE_PATCH                 BIT(2)
 452#define CMD_IOCONFIG                    BIT(3)
 453#define CMD_INIT_LLT_ERR                BIT(4)
 454#define CMD_READ_EFUSE_MAP_ERR          BIT(5)
 455#define CMD_EFUSE_PATCH_ERR             BIT(6)
 456#define CMD_IOCONFIG_ERR                BIT(7)
 457
 458/*        8192C BW_OPMODE bits          (Offset 0x203, 8bit) */
 459#define BW_OPMODE_20MHZ                 BIT(2)
 460#define BW_OPMODE_5G                    BIT(1)
 461
 462/*        8192C CAM Config Setting (offset 0x250, 1 byte) */
 463#define CAM_VALID                       BIT(15)
 464#define CAM_NOTVALID                    0x0000
 465#define CAM_USEDK                       BIT(5)
 466
 467#define CAM_CONTENT_COUNT               8
 468
 469#define CAM_NONE                        0x0
 470#define CAM_WEP40                       0x01
 471#define CAM_TKIP                        0x02
 472#define CAM_AES                         0x04
 473#define CAM_WEP104                      0x05
 474#define CAM_SMS4                        0x6
 475
 476#define TOTAL_CAM_ENTRY                 32
 477#define HALF_CAM_ENTRY                  16
 478
 479#define CAM_CONFIG_USEDK                true
 480#define CAM_CONFIG_NO_USEDK             false
 481
 482#define CAM_WRITE                       BIT(16)
 483#define CAM_READ                        0x00000000
 484#define CAM_POLLINIG                    BIT(31)
 485
 486#define SCR_UseDK                       0x01
 487#define SCR_TxSecEnable                 0x02
 488#define SCR_RxSecEnable                 0x04
 489
 490/*  12. Host Interrupt Status Registers  (Offset: 0x0300 - 0x030F) */
 491/*        8188 IMR/ISR bits */
 492#define IMR_DISABLED_88E                0x0
 493/*  IMR DW0(0x0060-0063) Bit 0-31 */
 494#define IMR_TXCCK_88E                   BIT(30) /*  TXRPT interrupt when CCX bit of the packet is set */
 495#define IMR_PSTIMEOUT_88E               BIT(29) /*  Power Save Time Out Interrupt */
 496#define IMR_GTINT4_88E                  BIT(28) /*  When GTIMER4 expires, this bit is set to 1 */
 497#define IMR_GTINT3_88E                  BIT(27) /*  When GTIMER3 expires, this bit is set to 1 */
 498#define IMR_TBDER_88E                   BIT(26) /*  Transmit Beacon0 Error */
 499#define IMR_TBDOK_88E                   BIT(25) /*  Transmit Beacon0 OK */
 500#define IMR_TSF_BIT32_TOGGLE_88E        BIT(24) /*  TSF Timer BIT32 toggle indication interrupt */
 501#define IMR_BCNDMAINT0_88E              BIT(20) /*  Beacon DMA Interrupt 0 */
 502#define IMR_BCNDERR0_88E                BIT(16) /*  Beacon Queue DMA Error 0 */
 503#define IMR_HSISR_IND_ON_INT_88E        BIT(15) /*  HSISR Indicator (HSIMR & HSISR is true, this bit is set to 1) */
 504#define IMR_BCNDMAINT_E_88E             BIT(14) /*  Beacon DMA Interrupt Extension for Win7 */
 505#define IMR_ATIMEND_88E                 BIT(12) /*  CTWidnow End or ATIM Window End */
 506#define IMR_HISR1_IND_INT_88E           BIT(11) /*  HISR1 Indicator (HISR1 & HIMR1 is true, this bit is set to 1) */
 507#define IMR_C2HCMD_88E                  BIT(10) /*  CPU to Host Command INT Status, Write 1 clear */
 508#define IMR_CPWM2_88E                   BIT(9)  /*  CPU power Mode exchange INT Status, Write 1 clear */
 509#define IMR_CPWM_88E                    BIT(8)  /*  CPU power Mode exchange INT Status, Write 1 clear */
 510#define IMR_HIGHDOK_88E                 BIT(7)  /*  High Queue DMA OK */
 511#define IMR_MGNTDOK_88E                 BIT(6)  /*  Management Queue DMA OK */
 512#define IMR_BKDOK_88E                   BIT(5)  /*  AC_BK DMA OK */
 513#define IMR_BEDOK_88E                   BIT(4)  /*  AC_BE DMA OK */
 514#define IMR_VIDOK_88E                   BIT(3)  /*  AC_VI DMA OK */
 515#define IMR_VODOK_88E                   BIT(2)  /*  AC_VO DMA OK */
 516#define IMR_RDU_88E                     BIT(1)  /*  Rx Descriptor Unavailable */
 517#define IMR_ROK_88E                     BIT(0)  /*  Receive DMA OK */
 518
 519/*  IMR DW1(0x00B4-00B7) Bit 0-31 */
 520#define IMR_BCNDMAINT7_88E              BIT(27) /*  Beacon DMA Interrupt 7 */
 521#define IMR_BCNDMAINT6_88E              BIT(26) /*  Beacon DMA Interrupt 6 */
 522#define IMR_BCNDMAINT5_88E              BIT(25) /*  Beacon DMA Interrupt 5 */
 523#define IMR_BCNDMAINT4_88E              BIT(24) /*  Beacon DMA Interrupt 4 */
 524#define IMR_BCNDMAINT3_88E              BIT(23) /*  Beacon DMA Interrupt 3 */
 525#define IMR_BCNDMAINT2_88E              BIT(22) /*  Beacon DMA Interrupt 2 */
 526#define IMR_BCNDMAINT1_88E              BIT(21) /*  Beacon DMA Interrupt 1 */
 527#define IMR_BCNDERR7_88E                BIT(20) /*  Beacon DMA Error Int 7 */
 528#define IMR_BCNDERR6_88E                BIT(19) /*  Beacon DMA Error Int 6 */
 529#define IMR_BCNDERR5_88E                BIT(18) /*  Beacon DMA Error Int 5 */
 530#define IMR_BCNDERR4_88E                BIT(17) /*  Beacon DMA Error Int 4 */
 531#define IMR_BCNDERR3_88E                BIT(16) /*  Beacon DMA Error Int 3 */
 532#define IMR_BCNDERR2_88E                BIT(15) /*  Beacon DMA Error Int 2 */
 533#define IMR_BCNDERR1_88E                BIT(14) /*  Beacon DMA Error Int 1 */
 534#define IMR_ATIMEND_E_88E               BIT(13) /*  ATIM Window End Ext for Win7 */
 535#define IMR_TXERR_88E                   BIT(11) /*  Tx Err Flag Int Status, write 1 clear. */
 536#define IMR_RXERR_88E                   BIT(10) /*  Rx Err Flag INT Status, Write 1 clear */
 537#define IMR_TXFOVW_88E                  BIT(9)  /*  Transmit FIFO Overflow */
 538#define IMR_RXFOVW_88E                  BIT(8)  /*  Receive FIFO Overflow */
 539
 540#define HAL_NIC_UNPLUG_ISR              0xFFFFFFFF      /*  The value when the NIC is unplugged for PCI. */
 541
 542/*  8192C EFUSE */
 543#define         HWSET_MAX_SIZE                  256
 544#define         HWSET_MAX_SIZE_88E              512
 545
 546/*===================================================================
 547=====================================================================
 548Here the register defines are for 92C. When the define is as same with 92C,
 549we will use the 92C's define for the consistency
 550So the following defines for 92C is not entire!!!!!!
 551=====================================================================
 552=====================================================================*/
 553/*
 554 * Based on Datasheet V33---090401
 555 * Register Summary
 556 * Current IOREG MAP
 557 * 0x0000h ~ 0x00FFh   System Configuration (256 Bytes)
 558 * 0x0100h ~ 0x01FFh   MACTOP General Configuration (256 Bytes)
 559 * 0x0200h ~ 0x027Fh   TXDMA Configuration (128 Bytes)
 560 * 0x0280h ~ 0x02FFh   RXDMA Configuration (128 Bytes)
 561 * 0x0300h ~ 0x03FFh   PCIE EMAC Reserved Region (256 Bytes)
 562 * 0x0400h ~ 0x04FFh   Protocol Configuration (256 Bytes)
 563 * 0x0500h ~ 0x05FFh   EDCA Configuration (256 Bytes)
 564 * 0x0600h ~ 0x07FFh   WMAC Configuration (512 Bytes)
 565 * 0x2000h ~ 0x3FFFh   8051 FW Download Region (8196 Bytes)
 566 */
 567
 568/*        8192C (RCR) Receive Configuration Register(Offset 0x608, 32 bits) */
 569#define RCR_APPFCS              BIT(31) /* WMAC append FCS after payload */
 570#define RCR_APP_MIC             BIT(30)
 571#define RCR_APP_PHYSTS          BIT(28)
 572#define RCR_APP_ICV             BIT(29)
 573#define RCR_APP_PHYST_RXFF      BIT(28)
 574#define RCR_APP_BA_SSN          BIT(27) /* Accept BA SSN */
 575#define RCR_ENMBID              BIT(24) /* Enable Multiple BssId. */
 576#define RCR_LSIGEN              BIT(23)
 577#define RCR_MFBEN               BIT(22)
 578#define RCR_HTC_LOC_CTRL        BIT(14)   /* MFC<--HTC=1 MFC-->HTC=0 */
 579#define RCR_AMF                 BIT(13) /* Accept management type frame */
 580#define RCR_ACF                 BIT(12) /* Accept control type frame */
 581#define RCR_ADF                 BIT(11) /* Accept data type frame */
 582#define RCR_AICV                BIT(9)  /* Accept ICV error packet */
 583#define RCR_ACRC32              BIT(8)  /* Accept CRC32 error packet */
 584#define RCR_CBSSID_BCN          BIT(7)  /* Accept BSSID match packet
 585                                         * (Rx beacon, probe rsp)
 586                                         */
 587#define RCR_CBSSID_DATA         BIT(6)  /* Accept BSSID match (Data)*/
 588#define RCR_CBSSID              RCR_CBSSID_DATA /* Accept BSSID match */
 589#define RCR_APWRMGT             BIT(5)  /* Accept power management pkt*/
 590#define RCR_ADD3                BIT(4)  /* Accept address 3 match pkt */
 591#define RCR_AB                  BIT(3)  /* Accept broadcast packet */
 592#define RCR_AM                  BIT(2)  /* Accept multicast packet */
 593#define RCR_APM                 BIT(1)  /* Accept physical match pkt */
 594#define RCR_AAP                 BIT(0)  /* Accept all unicast packet */
 595#define RCR_MXDMA_OFFSET        8
 596#define RCR_FIFO_OFFSET         13
 597
 598/*      0xFE00h ~ 0xFE55h       USB Configuration */
 599#define REG_USB_HRPWM                   0xFE58
 600
 601/*        8192C Register Bit and Content definition */
 602/*      0x0000h ~ 0x00FFh       System Configuration */
 603
 604/* 2 SYS_ISO_CTRL */
 605#define ISO_MD2PP                       BIT(0)
 606#define ISO_UA2USB                      BIT(1)
 607#define ISO_UD2CORE                     BIT(2)
 608#define ISO_PA2PCIE                     BIT(3)
 609#define ISO_PD2CORE                     BIT(4)
 610#define ISO_IP2MAC                      BIT(5)
 611#define ISO_DIOP                        BIT(6)
 612#define ISO_DIOE                        BIT(7)
 613#define ISO_EB2CORE                     BIT(8)
 614#define ISO_DIOR                        BIT(9)
 615#define PWC_EV12V                       BIT(15)
 616
 617/* 2 SYS_FUNC_EN */
 618#define FEN_BBRSTB                      BIT(0)
 619#define FEN_BB_GLB_RSTn                 BIT(1)
 620#define FEN_USBA                        BIT(2)
 621#define FEN_UPLL                        BIT(3)
 622#define FEN_USBD                        BIT(4)
 623#define FEN_DIO_PCIE                    BIT(5)
 624#define FEN_PCIEA                       BIT(6)
 625#define FEN_PPLL                        BIT(7)
 626#define FEN_PCIED                       BIT(8)
 627#define FEN_DIOE                        BIT(9)
 628#define FEN_CPUEN                       BIT(10)
 629#define FEN_DCORE                       BIT(11)
 630#define FEN_ELDR                        BIT(12)
 631#define FEN_DIO_RF                      BIT(13)
 632#define FEN_HWPDN                       BIT(14)
 633#define FEN_MREGEN                      BIT(15)
 634
 635/* 2 APS_FSMCO */
 636#define PFM_LDALL                       BIT(0)
 637#define PFM_ALDN                        BIT(1)
 638#define PFM_LDKP                        BIT(2)
 639#define PFM_WOWL                        BIT(3)
 640#define EnPDN                           BIT(4)
 641#define PDN_PL                          BIT(5)
 642#define APFM_ONMAC                      BIT(8)
 643#define APFM_OFF                        BIT(9)
 644#define APFM_RSM                        BIT(10)
 645#define AFSM_HSUS                       BIT(11)
 646#define AFSM_PCIE                       BIT(12)
 647#define APDM_MAC                        BIT(13)
 648#define APDM_HOST                       BIT(14)
 649#define APDM_HPDN                       BIT(15)
 650#define RDY_MACON                       BIT(16)
 651#define SUS_HOST                        BIT(17)
 652#define ROP_ALD                         BIT(20)
 653#define ROP_PWR                         BIT(21)
 654#define ROP_SPS                         BIT(22)
 655#define SOP_MRST                        BIT(25)
 656#define SOP_FUSE                        BIT(26)
 657#define SOP_ABG                         BIT(27)
 658#define SOP_AMB                         BIT(28)
 659#define SOP_RCK                         BIT(29)
 660#define SOP_A8M                         BIT(30)
 661#define XOP_BTCK                        BIT(31)
 662
 663/* 2 SYS_CLKR */
 664#define ANAD16V_EN                      BIT(0)
 665#define ANA8M                           BIT(1)
 666#define MACSLP                          BIT(4)
 667#define LOADER_CLK_EN                   BIT(5)
 668
 669/* 2 9346CR */
 670
 671#define         BOOT_FROM_EEPROM        BIT(4)
 672#define         EEPROM_EN               BIT(5)
 673
 674/* 2 SPS0_CTRL */
 675
 676/* 2 SPS_OCP_CFG */
 677
 678/* 2 RF_CTRL */
 679#define RF_EN                           BIT(0)
 680#define RF_RSTB                         BIT(1)
 681#define RF_SDMRSTB                      BIT(2)
 682
 683/* 2 LDOV12D_CTRL */
 684#define LDV12_EN                        BIT(0)
 685#define LDV12_SDBY                      BIT(1)
 686#define LPLDO_HSM                       BIT(2)
 687#define LPLDO_LSM_DIS                   BIT(3)
 688#define _LDV12_VADJ(x)                  (((x) & 0xF) << 4)
 689
 690/* 2EFUSE_CTRL */
 691#define ALD_EN                          BIT(18)
 692#define EF_PD                           BIT(19)
 693#define EF_FLAG                         BIT(31)
 694
 695/* 2 EFUSE_TEST (For RTL8723 partially) */
 696#define EF_TRPT                         BIT(7)
 697/*  00: Wifi Efuse, 01: BT Efuse0, 10: BT Efuse1, 11: BT Efuse2 */
 698#define EF_CELL_SEL                     (BIT(8) | BIT(9))
 699#define LDOE25_EN                       BIT(31)
 700#define EFUSE_SEL(x)                    (((x) & 0x3) << 8)
 701#define EFUSE_SEL_MASK                  0x300
 702#define EFUSE_WIFI_SEL_0                0x0
 703#define EFUSE_BT_SEL_0                  0x1
 704#define EFUSE_BT_SEL_1                  0x2
 705#define EFUSE_BT_SEL_2                  0x3
 706
 707#define EFUSE_ACCESS_ON                 0x69    /*  For RTL8723 only. */
 708#define EFUSE_ACCESS_OFF                0x00    /*  For RTL8723 only. */
 709
 710/* 2 8051FWDL */
 711/* 2 MCUFWDL */
 712#define MCUFWDL_EN                      BIT(0)
 713#define MCUFWDL_RDY                     BIT(1)
 714#define FWDL_CHKSUM_RPT                 BIT(2)
 715#define MACINI_RDY                      BIT(3)
 716#define BBINI_RDY                       BIT(4)
 717#define RFINI_RDY                       BIT(5)
 718#define WINTINI_RDY                     BIT(6)
 719#define RAM_DL_SEL                      BIT(7) /*  1:RAM, 0:ROM */
 720#define ROM_DLEN                        BIT(19)
 721#define CPRST                           BIT(23)
 722
 723/* 2 REG_SYS_CFG */
 724#define XCLK_VLD                        BIT(0)
 725#define ACLK_VLD                        BIT(1)
 726#define UCLK_VLD                        BIT(2)
 727#define PCLK_VLD                        BIT(3)
 728#define PCIRSTB                         BIT(4)
 729#define V15_VLD                         BIT(5)
 730#define SW_OFFLOAD_EN                   BIT(7)
 731#define SIC_IDLE                        BIT(8)
 732#define BD_MAC2                         BIT(9)
 733#define BD_MAC1                         BIT(10)
 734#define IC_MACPHY_MODE                  BIT(11)
 735#define CHIP_VER                        (BIT(12) | BIT(13) | BIT(14) | BIT(15))
 736#define BT_FUNC                         BIT(16)
 737#define VENDOR_ID                       BIT(19)
 738#define PAD_HWPD_IDN                    BIT(22)
 739#define TRP_VAUX_EN                     BIT(23) /*  RTL ID */
 740#define TRP_BT_EN                       BIT(24)
 741#define BD_PKG_SEL                      BIT(25)
 742#define BD_HCI_SEL                      BIT(26)
 743#define TYPE_ID                         BIT(27)
 744
 745#define CHIP_VER_RTL_MASK               0xF000  /* Bit 12 ~ 15 */
 746#define CHIP_VER_RTL_SHIFT              12
 747
 748/* 2REG_GPIO_OUTSTS (For RTL8723 only) */
 749#define EFS_HCI_SEL                     (BIT(0) | BIT(1))
 750#define PAD_HCI_SEL                     (BIT(2) | BIT(3))
 751#define HCI_SEL                         (BIT(4) | BIT(5))
 752#define PKG_SEL_HCI                     BIT(6)
 753#define FEN_GPS                         BIT(7)
 754#define FEN_BT                          BIT(8)
 755#define FEN_WL                          BIT(9)
 756#define FEN_PCI                         BIT(10)
 757#define FEN_USB                         BIT(11)
 758#define BTRF_HWPDN_N                    BIT(12)
 759#define WLRF_HWPDN_N                    BIT(13)
 760#define PDN_BT_N                        BIT(14)
 761#define PDN_GPS_N                       BIT(15)
 762#define BT_CTL_HWPDN                    BIT(16)
 763#define GPS_CTL_HWPDN                   BIT(17)
 764#define PPHY_SUSB                       BIT(20)
 765#define UPHY_SUSB                       BIT(21)
 766#define PCI_SUSEN                       BIT(22)
 767#define USB_SUSEN                       BIT(23)
 768#define RF_RL_ID                        (BIT(31) | BIT(30) | BIT(29) | BIT(28))
 769
 770/* 2SYS_CFG */
 771#define RTL_ID                          BIT(23) /*  TestChip ID, 1:Test(RLE); 0:MP(RL) */
 772
 773/*      0x0100h ~ 0x01FFh       MACTOP General Configuration */
 774
 775/* 2 Function Enable Registers */
 776/* 2 CR */
 777
 778#define HCI_TXDMA_EN                    BIT(0)
 779#define HCI_RXDMA_EN                    BIT(1)
 780#define TXDMA_EN                        BIT(2)
 781#define RXDMA_EN                        BIT(3)
 782#define PROTOCOL_EN                     BIT(4)
 783#define SCHEDULE_EN                     BIT(5)
 784#define MACTXEN                         BIT(6)
 785#define MACRXEN                         BIT(7)
 786#define ENSWBCN                         BIT(8)
 787#define ENSEC                           BIT(9)
 788#define CALTMR_EN                       BIT(10) /*  32k CAL TMR enable */
 789
 790/*  Network type */
 791#define _NETTYPE(x)                     (((x) & 0x3) << 16)
 792#define MASK_NETTYPE                    0x30000
 793#define NT_NO_LINK                      0x0
 794#define NT_LINK_AD_HOC                  0x1
 795#define NT_LINK_AP                      0x2
 796#define NT_AS_AP                        0x3
 797
 798/* 2 PBP - Page Size Register */
 799#define GET_RX_PAGE_SIZE(value)         ((value) & 0xF)
 800#define GET_TX_PAGE_SIZE(value)         (((value) & 0xF0) >> 4)
 801#define _PSRX_MASK                      0xF
 802#define _PSTX_MASK                      0xF0
 803#define _PSRX(x)                        (x)
 804#define _PSTX(x)                        ((x) << 4)
 805
 806#define PBP_64                          0x0
 807#define PBP_128                         0x1
 808#define PBP_256                         0x2
 809#define PBP_512                         0x3
 810#define PBP_1024                        0x4
 811
 812/* 2 TX/RXDMA */
 813#define RXDMA_ARBBW_EN                  BIT(0)
 814#define RXSHFT_EN                       BIT(1)
 815#define RXDMA_AGG_EN                    BIT(2)
 816#define QS_VO_QUEUE                     BIT(8)
 817#define QS_VI_QUEUE                     BIT(9)
 818#define QS_BE_QUEUE                     BIT(10)
 819#define QS_BK_QUEUE                     BIT(11)
 820#define QS_MANAGER_QUEUE                BIT(12)
 821#define QS_HIGH_QUEUE                   BIT(13)
 822
 823#define HQSEL_VOQ                       BIT(0)
 824#define HQSEL_VIQ                       BIT(1)
 825#define HQSEL_BEQ                       BIT(2)
 826#define HQSEL_BKQ                       BIT(3)
 827#define HQSEL_MGTQ                      BIT(4)
 828#define HQSEL_HIQ                       BIT(5)
 829
 830/*  For normal driver, 0x10C */
 831#define _TXDMA_HIQ_MAP(x)               (((x) & 0x3) << 14)
 832#define _TXDMA_MGQ_MAP(x)               (((x) & 0x3) << 12)
 833#define _TXDMA_BKQ_MAP(x)               (((x) & 0x3) << 10)
 834#define _TXDMA_BEQ_MAP(x)               (((x) & 0x3) << 8)
 835#define _TXDMA_VIQ_MAP(x)               (((x) & 0x3) << 6)
 836#define _TXDMA_VOQ_MAP(x)               (((x) & 0x3) << 4)
 837
 838#define QUEUE_LOW                       1
 839#define QUEUE_NORMAL                    2
 840#define QUEUE_HIGH                      3
 841
 842/* 2 TRXFF_BNDY */
 843
 844/* 2 LLT_INIT */
 845#define _LLT_NO_ACTIVE                  0x0
 846#define _LLT_WRITE_ACCESS               0x1
 847#define _LLT_READ_ACCESS                0x2
 848
 849#define _LLT_INIT_DATA(x)               ((x) & 0xFF)
 850#define _LLT_INIT_ADDR(x)               (((x) & 0xFF) << 8)
 851#define _LLT_OP(x)                      (((x) & 0x3) << 30)
 852#define _LLT_OP_VALUE(x)                (((x) >> 30) & 0x3)
 853
 854/*      0x0200h ~ 0x027Fh       TXDMA Configuration */
 855/* 2RQPN */
 856#define _HPQ(x)                         ((x) & 0xFF)
 857#define _LPQ(x)                         (((x) & 0xFF) << 8)
 858#define _PUBQ(x)                        (((x) & 0xFF) << 16)
 859/*  NOTE: in RQPN_NPQ register */
 860#define _NPQ(x)                         ((x) & 0xFF)
 861
 862#define HPQ_PUBLIC_DIS                  BIT(24)
 863#define LPQ_PUBLIC_DIS                  BIT(25)
 864#define LD_RQPN                         BIT(31)
 865
 866/* 2TDECTRL */
 867#define BCN_VALID                       BIT(16)
 868#define BCN_HEAD(x)                     (((x) & 0xFF) << 8)
 869#define BCN_HEAD_MASK                   0xFF00
 870
 871/* 2 TDECTL */
 872#define BLK_DESC_NUM_SHIFT              4
 873#define BLK_DESC_NUM_MASK               0xF
 874
 875/* 2 TXDMA_OFFSET_CHK */
 876#define DROP_DATA_EN                    BIT(9)
 877
 878/*      0x0280h ~ 0x028Bh       RX DMA Configuration */
 879
 880/*     REG_RXDMA_CONTROL, 0x0286h */
 881
 882/* 2 REG_RXPKT_NUM, 0x0284 */
 883#define         RXPKT_RELEASE_POLL      BIT(16)
 884#define RXDMA_IDLE                      BIT(17)
 885#define RW_RELEASE_EN                   BIT(18)
 886
 887/*      0x0400h ~ 0x047Fh       Protocol Configuration */
 888/* 2 FWHW_TXQ_CTRL */
 889#define EN_AMPDU_RTY_NEW                BIT(7)
 890
 891/* 2 SPEC SIFS */
 892#define _SPEC_SIFS_CCK(x)               ((x) & 0xFF)
 893#define _SPEC_SIFS_OFDM(x)              (((x) & 0xFF) << 8)
 894
 895/* 2 RL */
 896#define RETRY_LIMIT_SHORT_SHIFT         8
 897#define RETRY_LIMIT_LONG_SHIFT          0
 898
 899/*      0x0500h ~ 0x05FFh       EDCA Configuration */
 900
 901/* 2 EDCA setting */
 902#define AC_PARAM_TXOP_LIMIT_OFFSET      16
 903#define AC_PARAM_ECW_MAX_OFFSET         12
 904#define AC_PARAM_ECW_MIN_OFFSET         8
 905#define AC_PARAM_AIFS_OFFSET            0
 906
 907#define _LRL(x)                 ((x) & 0x3F)
 908#define _SRL(x)                 (((x) & 0x3F) << 8)
 909
 910/* 2 BCN_CTRL */
 911#define EN_MBSSID               BIT(1)
 912#define EN_TXBCN_RPT            BIT(2)
 913#define EN_BCN_FUNCTION         BIT(3)
 914#define DIS_TSF_UPDATE          BIT(3)
 915
 916/*  The same function but different bit field. */
 917#define DIS_TSF_UDT0_NORMAL_CHIP        BIT(4)
 918#define DIS_TSF_UDT0_TEST_CHIP  BIT(5)
 919#define STOP_BCNQ               BIT(6)
 920
 921/* 2 ACMHWCTRL */
 922#define AcmHw_HwEn              BIT(0)
 923#define AcmHw_BeqEn             BIT(1)
 924#define AcmHw_ViqEn             BIT(2)
 925#define AcmHw_VoqEn             BIT(3)
 926#define AcmHw_BeqStatus         BIT(4)
 927#define AcmHw_ViqStatus         BIT(5)
 928#define AcmHw_VoqStatus         BIT(6)
 929
 930/*      0x0600h ~ 0x07FFh       WMAC Configuration */
 931/* 2APSD_CTRL */
 932#define APSDOFF                 BIT(6)
 933#define APSDOFF_STATUS          BIT(7)
 934
 935#define RATE_BITMAP_ALL         0xFFFFF
 936
 937/*  Only use CCK 1M rate for ACK */
 938#define RATE_RRSR_CCK_ONLY_1M   0xFFFF1
 939
 940/* 2 TCR */
 941#define TSFRST                  BIT(0)
 942#define DIS_GCLK                BIT(1)
 943#define PAD_SEL                 BIT(2)
 944#define PWR_ST                  BIT(6)
 945#define PWRBIT_OW_EN            BIT(7)
 946#define ACRC                    BIT(8)
 947#define CFENDFORM               BIT(9)
 948#define ICV                     BIT(10)
 949
 950/* 2 RCR */
 951#define AAP                     BIT(0)
 952#define APM                     BIT(1)
 953#define AM                      BIT(2)
 954#define AB                      BIT(3)
 955#define ADD3                    BIT(4)
 956#define APWRMGT                 BIT(5)
 957#define CBSSID                  BIT(6)
 958#define CBSSID_DATA             BIT(6)
 959#define CBSSID_BCN              BIT(7)
 960#define ACRC32                  BIT(8)
 961#define AICV                    BIT(9)
 962#define ADF                     BIT(11)
 963#define ACF                     BIT(12)
 964#define AMF                     BIT(13)
 965#define HTC_LOC_CTRL            BIT(14)
 966#define UC_DATA_EN              BIT(16)
 967#define BM_DATA_EN              BIT(17)
 968#define MFBEN                   BIT(22)
 969#define LSIGEN                  BIT(23)
 970#define EnMBID                  BIT(24)
 971#define APP_BASSN               BIT(27)
 972#define APP_PHYSTS              BIT(28)
 973#define APP_ICV                 BIT(29)
 974#define APP_MIC                 BIT(30)
 975#define APP_FCS                 BIT(31)
 976
 977/* 2 SECCFG */
 978#define SCR_TxUseDK             BIT(0)  /* Force Tx Use Default Key */
 979#define SCR_RxUseDK             BIT(1)  /* Force Rx Use Default Key */
 980#define SCR_TxEncEnable         BIT(2)  /* Enable Tx Encryption */
 981#define SCR_RxDecEnable         BIT(3)  /* Enable Rx Decryption */
 982#define SCR_SKByA2              BIT(4)  /* Search kEY BY A2 */
 983#define SCR_NoSKMC              BIT(5)  /* No Key Search Multicast */
 984#define SCR_TXBCUSEDK           BIT(6)  /* Force Tx Bcast pkt Use Default Key */
 985#define SCR_RXBCUSEDK           BIT(7)  /* Force Rx Bcast pkt Use Default Key */
 986
 987/*      0xFE00h ~ 0xFE55h       USB Configuration */
 988
 989/* 2 USB Information (0xFE17) */
 990#define USB_IS_HIGH_SPEED                       0
 991#define USB_IS_FULL_SPEED                       1
 992#define USB_SPEED_MASK                          BIT(5)
 993
 994#define USB_NORMAL_SIE_EP_MASK                  0xF
 995#define USB_NORMAL_SIE_EP_SHIFT                 4
 996
 997/* 2 Special Option */
 998#define USB_AGG_EN                              BIT(3)
 999
1000/*  0; Use interrupt endpoint to upload interrupt pkt */
1001/*  1; Use bulk endpoint to upload interrupt pkt, */
1002#define INT_BULK_SEL                            BIT(4)
1003
1004/* 2REG_C2HEVT_CLEAR */
1005/*  Set by driver and notify FW that the driver has read
1006 *  the C2H command message
1007 */
1008#define C2H_EVT_HOST_CLOSE      0x00
1009/*  Set by FW indicating that FW had set the C2H command
1010 *  message and it's not yet read by driver.
1011 */
1012#define C2H_EVT_FW_CLOSE        0xFF
1013
1014/* 2REG_MULTI_FUNC_CTRL(For RTL8723 Only) */
1015/*  Enable GPIO[9] as WiFi HW PDn source */
1016#define WL_HWPDN_EN                             BIT(0)
1017/*  WiFi HW PDn polarity control */
1018#define WL_HWPDN_SL                             BIT(1)
1019/*  WiFi function enable */
1020#define WL_FUNC_EN                              BIT(2)
1021/*  Enable GPIO[9] as WiFi RF HW PDn source */
1022#define WL_HWROF_EN                             BIT(3)
1023/*  Enable GPIO[11] as BT HW PDn source */
1024#define BT_HWPDN_EN                             BIT(16)
1025/*  BT HW PDn polarity control */
1026#define BT_HWPDN_SL                             BIT(17)
1027/*  BT function enable */
1028#define BT_FUNC_EN                              BIT(18)
1029/*  Enable GPIO[11] as BT/GPS RF HW PDn source */
1030#define BT_HWROF_EN                             BIT(19)
1031/*  Enable GPIO[10] as GPS HW PDn source */
1032#define GPS_HWPDN_EN                            BIT(20)
1033/*  GPS HW PDn polarity control */
1034#define GPS_HWPDN_SL                            BIT(21)
1035/*  GPS function enable */
1036#define GPS_FUNC_EN                             BIT(22)
1037
1038/*  General definitions */
1039#define LAST_ENTRY_OF_TX_PKT_BUFFER             176 /*  22k 22528 bytes */
1040
1041#define POLLING_LLT_THRESHOLD                   20
1042#define POLLING_READY_TIMEOUT_COUNT             1000
1043/*  GPIO BIT */
1044#define HAL_8192C_HW_GPIO_WPS_BIT               BIT(2)
1045
1046/*      8192C EEPROM/EFUSE share register definition. */
1047
1048/*      EEPROM/Efuse PG Offset for 88EE/88EU/88ES */
1049#define EEPROM_TX_PWR_INX_88E                   0x10
1050
1051#define EEPROM_ChannelPlan_88E                  0xB8
1052#define EEPROM_XTAL_88E                         0xB9
1053#define EEPROM_THERMAL_METER_88E                0xBA
1054#define EEPROM_IQK_LCK_88E                      0xBB
1055
1056#define EEPROM_RF_BOARD_OPTION_88E              0xC1
1057#define EEPROM_RF_FEATURE_OPTION_88E            0xC2
1058#define EEPROM_RF_BT_SETTING_88E                0xC3
1059#define EEPROM_VERSION_88E                      0xC4
1060#define EEPROM_CUSTOMERID_88E                   0xC5
1061#define EEPROM_RF_ANTENNA_OPT_88E               0xC9
1062
1063/* RTL88EU */
1064#define EEPROM_MAC_ADDR_88EU                    0xD7
1065#define EEPROM_VID_88EU                         0xD0
1066#define EEPROM_PID_88EU                         0xD2
1067#define EEPROM_USB_OPTIONAL_FUNCTION0           0xD4
1068
1069/*              EEPROM/Efuse Value Type */
1070#define EETYPE_TX_PWR                           0x0
1071
1072#define EEPROM_Default_CrystalCap_88E           0x20
1073#define EEPROM_Default_ThermalMeter_88E         0x18
1074
1075/* New EFUSE default value */
1076#define         EEPROM_DEFAULT_24G_INDEX        0x2D
1077#define         EEPROM_DEFAULT_24G_HT20_DIFF    0X02
1078#define         EEPROM_DEFAULT_24G_OFDM_DIFF    0X04
1079
1080#define         EEPROM_DEFAULT_5G_INDEX         0X2A
1081#define         EEPROM_DEFAULT_5G_HT20_DIFF     0X00
1082#define         EEPROM_DEFAULT_5G_OFDM_DIFF     0X04
1083
1084#define         EEPROM_DEFAULT_DIFF             0XFE
1085#define EEPROM_DEFAULT_CHANNEL_PLAN             0x7F
1086#define EEPROM_DEFAULT_BOARD_OPTION             0x00
1087#define EEPROM_DEFAULT_FEATURE_OPTION           0x00
1088#define EEPROM_DEFAULT_BT_OPTION                0x10
1089
1090/*  For debug */
1091#define EEPROM_Default_PID                      0x1234
1092#define EEPROM_Default_VID                      0x5678
1093#define EEPROM_Default_CustomerID               0xAB
1094#define EEPROM_Default_CustomerID_8188E         0x00
1095#define EEPROM_Default_SubCustomerID            0xCD
1096#define EEPROM_Default_Version                  0
1097
1098#define EEPROM_CHANNEL_PLAN_FCC                 0x0
1099#define EEPROM_CHANNEL_PLAN_IC                  0x1
1100#define EEPROM_CHANNEL_PLAN_ETSI                0x2
1101#define EEPROM_CHANNEL_PLAN_SPA                 0x3
1102#define EEPROM_CHANNEL_PLAN_FRANCE              0x4
1103#define EEPROM_CHANNEL_PLAN_MKK                 0x5
1104#define EEPROM_CHANNEL_PLAN_MKK1                0x6
1105#define EEPROM_CHANNEL_PLAN_ISRAEL              0x7
1106#define EEPROM_CHANNEL_PLAN_TELEC               0x8
1107#define EEPROM_CHANNEL_PLAN_GLOBAL_DOMA         0x9
1108#define EEPROM_CHANNEL_PLAN_WORLD_WIDE_13       0xA
1109#define EEPROM_CHANNEL_PLAN_NCC                 0xB
1110#define EEPROM_USB_OPTIONAL1                    0xE
1111#define EEPROM_CHANNEL_PLAN_BY_HW_MASK          0x80
1112
1113#define EEPROM_CID_DEFAULT              0x0
1114#define EEPROM_CID_TOSHIBA              0x4
1115#define EEPROM_CID_CCX                  0x10 /*  CCX test. */
1116#define EEPROM_CID_QMI                  0x0D
1117#define EEPROM_CID_WHQL                 0xFE
1118#define RTL_EEPROM_ID                   0x8129
1119
1120#endif /* __RTL8188E_SPEC_H__ */
1121