Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  *  This is part of rtl8187 OpenSource driver.
0004  *  Copyright (C) Andrea Merello 2004-2005  <andrea.merello@gmail.com>
0005  *
0006  *  Parts of this driver are based on the GPL part of the
0007  *  official Realtek driver.
0008  *  Parts of this driver are based on the rtl8180 driver skeleton
0009  *  from Patric Schenke & Andres Salomon.
0010  *  Parts of this driver are based on the Intel Pro Wireless
0011  *  2100 GPL driver.
0012  *
0013  *  We want to thank the Authors of those projects
0014  *  and the Ndiswrapper project Authors.
0015  */
0016 
0017 /* Mariusz Matuszek added full registers definition with Realtek's name */
0018 
0019 /* this file contains register definitions for the rtl8187 MAC controller */
0020 #ifndef R8192_HW
0021 #define R8192_HW
0022 
0023 #define RTL8187_REQT_READ   0xc0
0024 #define RTL8187_REQT_WRITE  0x40
0025 #define RTL8187_REQ_GET_REGS    0x05
0026 #define RTL8187_REQ_SET_REGS    0x05
0027 
0028 #define MAX_TX_URB 5
0029 #define MAX_RX_URB 16
0030 
0031 #define R8180_MAX_RETRY 255
0032 
0033 #define RX_URB_SIZE 9100
0034 
0035 #define RTL8190_EEPROM_ID   0x8129
0036 #define EEPROM_VID      0x02
0037 #define EEPROM_PID      0x04
0038 #define EEPROM_NODE_ADDRESS_BYTE_0  0x0C
0039 
0040 #define EEPROM_TX_POWER_DIFF    0x1F
0041 #define EEPROM_THERMAL_METER    0x20
0042 #define EEPROM_PW_DIFF      0x21    //0x21
0043 #define EEPROM_CRYSTAL_CAP  0x22    //0x22
0044 
0045 #define EEPROM_TX_PW_INDEX_CCK  0x23    //0x23
0046 #define EEPROM_TX_PW_INDEX_OFDM_24G 0x24    //0x24~0x26
0047 #define EEPROM_TX_PW_INDEX_CCK_V1   0x29    //0x29~0x2B
0048 #define EEPROM_TX_PW_INDEX_OFDM_24G_V1  0x2C    //0x2C~0x2E
0049 #define EEPROM_TX_PW_INDEX_VER      0x27    //0x27
0050 
0051 #define EEPROM_DEFAULT_THERNAL_METER        0x7
0052 #define EEPROM_DEFAULT_PW_DIFF          0x4
0053 #define EEPROM_DEFAULT_CRYSTAL_CAP      0x5
0054 #define EEPROM_DEFAULT_TX_POWER     0x1010
0055 #define EEPROM_CUSTOMER_ID          0x7B    //0x7B:CustomerID
0056 #define EEPROM_CHANNEL_PLAN         0x16    //0x7C
0057 
0058 #define EEPROM_CID_RUNTOP               0x2
0059 #define EEPROM_CID_DLINK                0x8
0060 
0061 #define AC_PARAM_TXOP_LIMIT_OFFSET  16
0062 #define AC_PARAM_ECW_MAX_OFFSET     12
0063 #define AC_PARAM_ECW_MIN_OFFSET     8
0064 #define AC_PARAM_AIFS_OFFSET        0
0065 
0066 //#endif
0067 enum _RTL8192Usb_HW {
0068     MAC0            = 0x000,
0069     MAC4            = 0x004,
0070 
0071 #define BB_GLOBAL_RESET_BIT 0x1
0072     BB_GLOBAL_RESET     = 0x020, // BasebandGlobal Reset Register
0073     BSSIDR          = 0x02E, // BSSID Register
0074     CMDR            = 0x037, // Command register
0075 #define CR_RE           0x08
0076 #define CR_TE           0x04
0077     SIFS            = 0x03E, // SIFS register
0078 
0079 #define TCR_MXDMA_2048      7
0080 #define TCR_LRL_OFFSET      0
0081 #define TCR_SRL_OFFSET      8
0082 #define TCR_MXDMA_OFFSET    21
0083 #define TCR_SAT         BIT(24) // Enable Rate depedent ack timeout timer
0084     RCR         = 0x044, // Receive Configuration Register
0085 #define MAC_FILTER_MASK (BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(5) | \
0086              BIT(12) | BIT(18) | BIT(19) | BIT(20) | BIT(21) | \
0087              BIT(22) | BIT(23))
0088 #define RX_FIFO_THRESHOLD_MASK (BIT(13) | BIT(14) | BIT(15))
0089 #define RX_FIFO_THRESHOLD_SHIFT 13
0090 #define RX_FIFO_THRESHOLD_NONE 7
0091 #define MAX_RX_DMA_MASK (BIT(8) | BIT(9) | BIT(10))
0092 #define RCR_MXDMA_OFFSET    8
0093 #define RCR_FIFO_OFFSET     13
0094 #define RCR_ONLYERLPKT      BIT(31)         // Early Receiving based on Packet Size.
0095 #define RCR_CBSSID      BIT(23)         // Accept BSSID match packet
0096 #define RCR_APWRMGT     BIT(22)         // Accept power management packet
0097 #define RCR_AMF         BIT(20)         // Accept management type frame
0098 #define RCR_ACF         BIT(19)         // Accept control type frame
0099 #define RCR_ADF         BIT(18)         // Accept data type frame
0100 #define RCR_AICV        BIT(12)         // Accept ICV error packet
0101 #define RCR_ACRC32      BIT(5)          // Accept CRC32 error packet
0102 #define RCR_AB          BIT(3)          // Accept broadcast packet
0103 #define RCR_AM          BIT(2)          // Accept multicast packet
0104 #define RCR_APM         BIT(1)          // Accept physical match packet
0105 #define RCR_AAP         BIT(0)          // Accept all unicast packet
0106     SLOT_TIME       = 0x049, // Slot Time Register
0107     ACK_TIMEOUT     = 0x04c, // Ack Timeout Register
0108     EDCAPARA_BE     = 0x050, // EDCA Parameter of AC BE
0109     EDCAPARA_BK     = 0x054, // EDCA Parameter of AC BK
0110     EDCAPARA_VO     = 0x058, // EDCA Parameter of AC VO
0111     EDCAPARA_VI     = 0x05C, // EDCA Parameter of AC VI
0112     BCN_TCFG        = 0x062, // Beacon Time Configuration
0113 #define BCN_TCFG_CW_SHIFT       8
0114 #define BCN_TCFG_IFS            0
0115     BCN_INTERVAL        = 0x070, // Beacon Interval (TU)
0116     ATIMWND         = 0x072, // ATIM Window Size (TU)
0117     BCN_DRV_EARLY_INT   = 0x074, // Driver Early Interrupt Time (TU). Time to send interrupt to notify to change beacon content before TBTT
0118     BCN_DMATIME     = 0x076, // Beacon DMA and ATIM interrupt time (US). Indicates the time before TBTT to perform beacon queue DMA
0119     BCN_ERR_THRESH      = 0x078, // Beacon Error Threshold
0120     RWCAM           = 0x0A0, //IN 8190 Data Sheet is called CAMcmd
0121     WCAMI           = 0x0A4, // Software write CAM input content
0122     SECR            = 0x0B0, //Security Configuration Register
0123 #define SCR_TxUseDK     BIT(0)          //Force Tx Use Default Key
0124 #define SCR_RxUseDK     BIT(1)          //Force Rx Use Default Key
0125 #define SCR_TxEncEnable     BIT(2)          //Enable Tx Encryption
0126 #define SCR_RxDecEnable     BIT(3)          //Enable Rx Decryption
0127 #define SCR_SKByA2      BIT(4)          //Search kEY BY A2
0128 #define SCR_NoSKMC      BIT(5)          //No Key Search for Multicast
0129 
0130 //----------------------------------------------------------------------------
0131 //       8190 CPU General Register      (offset 0x100, 4 byte)
0132 //----------------------------------------------------------------------------
0133 #define CPU_CCK_LOOPBACK    0x00030000
0134 #define CPU_GEN_SYSTEM_RESET    0x00000001
0135 #define CPU_GEN_FIRMWARE_RESET  0x00000008
0136 #define CPU_GEN_BOOT_RDY    0x00000010
0137 #define CPU_GEN_FIRM_RDY    0x00000020
0138 #define CPU_GEN_PUT_CODE_OK 0x00000080
0139 #define CPU_GEN_BB_RST      0x00000100
0140 #define CPU_GEN_PWR_STB_CPU 0x00000004
0141 #define CPU_GEN_NO_LOOPBACK_MSK 0xFFF8FFFF // Set bit18,17,16 to 0. Set bit19
0142 #define CPU_GEN_NO_LOOPBACK_SET 0x00080000 // Set BIT19 to 1
0143     CPU_GEN         = 0x100, // CPU Reset Register
0144 
0145     AcmHwCtrl       = 0x171, // ACM Hardware Control Register
0146 //----------------------------------------------------------------------------
0147 ////
0148 ////       8190 AcmHwCtrl bits                                    (offset 0x171, 1 byte)
0149 ////----------------------------------------------------------------------------
0150 //
0151 #define AcmHw_BeqEn             BIT(1)
0152 
0153     RQPN1           = 0x180, // Reserved Queue Page Number , Vo Vi, Be, Bk
0154     RQPN2           = 0x184, // Reserved Queue Page Number, HCCA, Cmd, Mgnt, High
0155     RQPN3           = 0x188, // Reserved Queue Page Number, Bcn, Public,
0156     QPNR            = 0x1D0, //0x1F0, // Queue Packet Number report per TID
0157 
0158 #define BW_OPMODE_5G            BIT(1)
0159 #define BW_OPMODE_20MHZ         BIT(2)
0160     BW_OPMODE       = 0x300, // Bandwidth operation mode
0161     MSR         = 0x303, // Media Status register
0162 #define MSR_LINK_MASK      (BIT(0) | BIT(1))
0163 #define MSR_LINK_MANAGED   2
0164 #define MSR_LINK_NONE      0
0165 #define MSR_LINK_SHIFT     0
0166 #define MSR_LINK_ADHOC     1
0167 #define MSR_LINK_MASTER    3
0168     RETRY_LIMIT     = 0x304, // Retry Limit [15:8]-short, [7:0]-long
0169 #define RETRY_LIMIT_SHORT_SHIFT 8
0170 #define RETRY_LIMIT_LONG_SHIFT 0
0171     RRSR            = 0x310, // Response Rate Set
0172 #define RRSR_1M                     BIT(0)
0173 #define RRSR_2M                     BIT(1)
0174 #define RRSR_5_5M                   BIT(2)
0175 #define RRSR_11M                    BIT(3)
0176 #define RRSR_6M                     BIT(4)
0177 #define RRSR_9M                     BIT(5)
0178 #define RRSR_12M                    BIT(6)
0179 #define RRSR_18M                    BIT(7)
0180 #define RRSR_24M                    BIT(8)
0181 #define RRSR_36M                    BIT(9)
0182 #define RRSR_48M                    BIT(10)
0183 #define RRSR_54M                    BIT(11)
0184 #define BRSR_AckShortPmb            BIT(23)     // CCK ACK: use Short Preamble or not.
0185     UFWP            = 0x318,
0186     RATR0           = 0x320, // Rate Adaptive Table register1
0187     DRIVER_RSSI     = 0x32c,                    // Driver tell Firmware current RSSI
0188 //----------------------------------------------------------------------------
0189 //       8190 Rate Adaptive Table Register  (offset 0x320, 4 byte)
0190 //----------------------------------------------------------------------------
0191 //CCK
0192 #define RATR_1M         0x00000001
0193 #define RATR_2M         0x00000002
0194 #define RATR_55M        0x00000004
0195 #define RATR_11M        0x00000008
0196 //OFDM
0197 #define RATR_6M         0x00000010
0198 #define RATR_9M         0x00000020
0199 #define RATR_12M        0x00000040
0200 #define RATR_18M        0x00000080
0201 #define RATR_24M        0x00000100
0202 #define RATR_36M        0x00000200
0203 #define RATR_48M        0x00000400
0204 #define RATR_54M        0x00000800
0205 //MCS 1 Spatial Stream
0206 #define RATR_MCS0       0x00001000
0207 #define RATR_MCS1       0x00002000
0208 #define RATR_MCS2       0x00004000
0209 #define RATR_MCS3       0x00008000
0210 #define RATR_MCS4       0x00010000
0211 #define RATR_MCS5       0x00020000
0212 #define RATR_MCS6       0x00040000
0213 #define RATR_MCS7       0x00080000
0214 //MCS 2 Spatial Stream
0215 #define RATR_MCS8       0x00100000
0216 #define RATR_MCS9       0x00200000
0217 #define RATR_MCS10      0x00400000
0218 #define RATR_MCS11      0x00800000
0219 #define RATR_MCS12      0x01000000
0220 #define RATR_MCS13      0x02000000
0221 #define RATR_MCS14      0x04000000
0222 #define RATR_MCS15      0x08000000
0223 // ALL CCK Rate
0224 #define RATE_ALL_CCK        (RATR_1M | RATR_2M | RATR_55M | RATR_11M)
0225 #define RATE_ALL_OFDM_AG    (RATR_6M | RATR_9M | RATR_12M | RATR_18M |\
0226                  RATR_24M | RATR_36M | RATR_48M | RATR_54M)
0227 #define RATE_ALL_OFDM_1SS   (RATR_MCS0 | RATR_MCS1 | RATR_MCS2 | RATR_MCS3 |\
0228                  RATR_MCS4 | RATR_MCS5 | RATR_MCS6 | RATR_MCS7)
0229 #define RATE_ALL_OFDM_2SS   (RATR_MCS8 | RATR_MCS9 | RATR_MCS10 | RATR_MCS11 |\
0230                  RATR_MCS12 | RATR_MCS13 | RATR_MCS14 | RATR_MCS15)
0231     EPROM_CMD       = 0xfe58,
0232 #define Cmd9346CR_9356SEL   BIT(4)
0233 #define EPROM_CMD_OPERATING_MODE_SHIFT 6
0234 #define EPROM_CMD_NORMAL 0
0235 #define EPROM_CMD_PROGRAM 2
0236 #define EPROM_CS_BIT BIT(3)
0237 #define EPROM_CK_BIT BIT(2)
0238 #define EPROM_W_BIT  BIT(1)
0239 #define EPROM_R_BIT  BIT(0)
0240 };
0241 
0242 //----------------------------------------------------------------------------
0243 //       818xB AnaParm & AnaParm2 Register
0244 //----------------------------------------------------------------------------
0245 #define GPI 0x108
0246 #endif