xref: /linux/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/def.h (revision 976e3645923bdd2fe7893aae33fd7a21098bfb28)
1*fbb35286SLarry Finger /* SPDX-License-Identifier: GPL-2.0 */
2*fbb35286SLarry Finger /* Copyright(c) 2009-2013  Realtek Corporation.*/
3f1d2b4d3SLarry Finger 
4f1d2b4d3SLarry Finger #ifndef __RTL92C_DEF_H__
5f1d2b4d3SLarry Finger #define __RTL92C_DEF_H__
6f1d2b4d3SLarry Finger 
7f1d2b4d3SLarry Finger #define HAL_PRIME_CHNL_OFFSET_DONT_CARE			0
8f1d2b4d3SLarry Finger #define HAL_PRIME_CHNL_OFFSET_LOWER			1
9f1d2b4d3SLarry Finger #define HAL_PRIME_CHNL_OFFSET_UPPER			2
10f1d2b4d3SLarry Finger 
11f1d2b4d3SLarry Finger #define RX_MPDU_QUEUE					0
12f1d2b4d3SLarry Finger #define RX_CMD_QUEUE					1
13f1d2b4d3SLarry Finger 
14f1d2b4d3SLarry Finger #define	C2H_RX_CMD_HDR_LEN				8
15f1d2b4d3SLarry Finger 
16f1d2b4d3SLarry Finger #define CHIP_BONDING_IDENTIFIER(_value)	(((_value)>>22)&0x3)
17f1d2b4d3SLarry Finger 
18f1d2b4d3SLarry Finger /* [15:12] IC version(CUT): A-cut=0, B-cut=1, C-cut=2, D-cut=3
19f1d2b4d3SLarry Finger  * [7] Manufacturer: TSMC=0, UMC=1
20f1d2b4d3SLarry Finger  * [6:4] RF type: 1T1R=0, 1T2R=1, 2T2R=2
21f1d2b4d3SLarry Finger  * [3] Chip type: TEST=0, NORMAL=1
22f1d2b4d3SLarry Finger  * [2:0] IC type: 81xxC=0, 8723=1, 92D=2
23f1d2b4d3SLarry Finger  */
24f1d2b4d3SLarry Finger #define CHIP_8723			BIT(0)
25f1d2b4d3SLarry Finger #define CHIP_92D			BIT(1)
26f1d2b4d3SLarry Finger #define NORMAL_CHIP			BIT(3)
27f1d2b4d3SLarry Finger #define RF_TYPE_1T1R			(~(BIT(4)|BIT(5)|BIT(6)))
28f1d2b4d3SLarry Finger #define RF_TYPE_1T2R			BIT(4)
29f1d2b4d3SLarry Finger #define RF_TYPE_2T2R			BIT(5)
30f1d2b4d3SLarry Finger #define CHIP_VENDOR_UMC			BIT(7)
31f1d2b4d3SLarry Finger #define B_CUT_VERSION			BIT(12)
32f1d2b4d3SLarry Finger #define C_CUT_VERSION			BIT(13)
33f1d2b4d3SLarry Finger #define D_CUT_VERSION			((BIT(12)|BIT(13)))
34f1d2b4d3SLarry Finger #define E_CUT_VERSION			BIT(14)
35f1d2b4d3SLarry Finger 
36f1d2b4d3SLarry Finger /* MASK */
37f1d2b4d3SLarry Finger #define IC_TYPE_MASK			(BIT(0)|BIT(1)|BIT(2))
38f1d2b4d3SLarry Finger #define CHIP_TYPE_MASK			BIT(3)
39f1d2b4d3SLarry Finger #define RF_TYPE_MASK			(BIT(4)|BIT(5)|BIT(6))
40f1d2b4d3SLarry Finger #define MANUFACTUER_MASK		BIT(7)
41f1d2b4d3SLarry Finger #define ROM_VERSION_MASK		(BIT(11)|BIT(10)|BIT(9)|BIT(8))
42f1d2b4d3SLarry Finger #define CUT_VERSION_MASK		(BIT(15)|BIT(14)|BIT(13)|BIT(12))
43f1d2b4d3SLarry Finger 
44f1d2b4d3SLarry Finger /* Get element */
45f1d2b4d3SLarry Finger #define GET_CVID_IC_TYPE(version)	((version) & IC_TYPE_MASK)
46f1d2b4d3SLarry Finger #define GET_CVID_CHIP_TYPE(version)	((version) & CHIP_TYPE_MASK)
47f1d2b4d3SLarry Finger #define GET_CVID_RF_TYPE(version)	((version) & RF_TYPE_MASK)
48f1d2b4d3SLarry Finger #define GET_CVID_MANUFACTUER(version)	((version) & MANUFACTUER_MASK)
49f1d2b4d3SLarry Finger #define GET_CVID_ROM_VERSION(version)	((version) & ROM_VERSION_MASK)
50f1d2b4d3SLarry Finger #define GET_CVID_CUT_VERSION(version)	((version) & CUT_VERSION_MASK)
51f1d2b4d3SLarry Finger 
52f1d2b4d3SLarry Finger #define IS_81XXC(version)						\
53f1d2b4d3SLarry Finger 	((GET_CVID_IC_TYPE(version) == 0) ? true : false)
54f1d2b4d3SLarry Finger #define IS_8723_SERIES(version)						\
55f1d2b4d3SLarry Finger 	((GET_CVID_IC_TYPE(version) == CHIP_8723) ? true : false)
56f1d2b4d3SLarry Finger #define IS_92D(version)							\
57f1d2b4d3SLarry Finger 	((GET_CVID_IC_TYPE(version) == CHIP_92D) ? true : false)
58f1d2b4d3SLarry Finger 
59f1d2b4d3SLarry Finger #define IS_NORMAL_CHIP(version)						\
60f1d2b4d3SLarry Finger 	((GET_CVID_CHIP_TYPE(version)) ? true : false)
61f1d2b4d3SLarry Finger #define IS_NORMAL_CHIP92D(version)					\
62f1d2b4d3SLarry Finger 	((GET_CVID_CHIP_TYPE(version)) ? true : false)
63f1d2b4d3SLarry Finger 
64f1d2b4d3SLarry Finger #define IS_1T1R(version)						\
65f1d2b4d3SLarry Finger 	((GET_CVID_RF_TYPE(version)) ? false : true)
66f1d2b4d3SLarry Finger #define IS_1T2R(version)						\
67f1d2b4d3SLarry Finger 	((GET_CVID_RF_TYPE(version) == RF_TYPE_1T2R) ? true : false)
68f1d2b4d3SLarry Finger #define IS_2T2R(version)						\
69f1d2b4d3SLarry Finger 	((GET_CVID_RF_TYPE(version) == RF_TYPE_2T2R) ? true : false)
70f1d2b4d3SLarry Finger #define IS_CHIP_VENDOR_UMC(version)					\
71f1d2b4d3SLarry Finger 	((GET_CVID_MANUFACTUER(version)) ? true : false)
72f1d2b4d3SLarry Finger 
73f1d2b4d3SLarry Finger #define IS_92C_SERIAL(version)						\
74f1d2b4d3SLarry Finger 	((IS_81XXC(version) && IS_2T2R(version)) ? true : false)
75f1d2b4d3SLarry Finger #define IS_81XXC_VENDOR_UMC_B_CUT(version)				\
76f1d2b4d3SLarry Finger 	(IS_81XXC(version) ? (IS_CHIP_VENDOR_UMC(version) ?		\
77f1d2b4d3SLarry Finger 	((GET_CVID_CUT_VERSION(version) == B_CUT_VERSION) ? true	\
78f1d2b4d3SLarry Finger 	: false) : false) : false)
79f1d2b4d3SLarry Finger 
80f1d2b4d3SLarry Finger enum version_8188e {
81f1d2b4d3SLarry Finger 	VERSION_TEST_CHIP_88E = 0x00,
82f1d2b4d3SLarry Finger 	VERSION_NORMAL_CHIP_88E = 0x01,
83f1d2b4d3SLarry Finger 	VERSION_UNKNOWN = 0xFF,
84f1d2b4d3SLarry Finger };
85f1d2b4d3SLarry Finger 
86f1d2b4d3SLarry Finger enum rtl819x_loopback_e {
87f1d2b4d3SLarry Finger 	RTL819X_NO_LOOPBACK = 0,
88f1d2b4d3SLarry Finger 	RTL819X_MAC_LOOPBACK = 1,
89f1d2b4d3SLarry Finger 	RTL819X_DMA_LOOPBACK = 2,
90f1d2b4d3SLarry Finger 	RTL819X_CCK_LOOPBACK = 3,
91f1d2b4d3SLarry Finger };
92f1d2b4d3SLarry Finger 
93f1d2b4d3SLarry Finger enum rf_optype {
94f1d2b4d3SLarry Finger 	RF_OP_BY_SW_3WIRE = 0,
95f1d2b4d3SLarry Finger 	RF_OP_BY_FW,
96f1d2b4d3SLarry Finger 	RF_OP_MAX
97f1d2b4d3SLarry Finger };
98f1d2b4d3SLarry Finger 
99f1d2b4d3SLarry Finger enum rf_power_state {
100f1d2b4d3SLarry Finger 	RF_ON,
101f1d2b4d3SLarry Finger 	RF_OFF,
102f1d2b4d3SLarry Finger 	RF_SLEEP,
103f1d2b4d3SLarry Finger 	RF_SHUT_DOWN,
104f1d2b4d3SLarry Finger };
105f1d2b4d3SLarry Finger 
106f1d2b4d3SLarry Finger enum power_save_mode {
107f1d2b4d3SLarry Finger 	POWER_SAVE_MODE_ACTIVE,
108f1d2b4d3SLarry Finger 	POWER_SAVE_MODE_SAVE,
109f1d2b4d3SLarry Finger };
110f1d2b4d3SLarry Finger 
111f1d2b4d3SLarry Finger enum power_polocy_config {
112f1d2b4d3SLarry Finger 	POWERCFG_MAX_POWER_SAVINGS,
113f1d2b4d3SLarry Finger 	POWERCFG_GLOBAL_POWER_SAVINGS,
114f1d2b4d3SLarry Finger 	POWERCFG_LOCAL_POWER_SAVINGS,
115f1d2b4d3SLarry Finger 	POWERCFG_LENOVO,
116f1d2b4d3SLarry Finger };
117f1d2b4d3SLarry Finger 
118f1d2b4d3SLarry Finger enum interface_select_pci {
119f1d2b4d3SLarry Finger 	INTF_SEL1_MINICARD = 0,
120f1d2b4d3SLarry Finger 	INTF_SEL0_PCIE = 1,
121f1d2b4d3SLarry Finger 	INTF_SEL2_RSV = 2,
122f1d2b4d3SLarry Finger 	INTF_SEL3_RSV = 3,
123f1d2b4d3SLarry Finger };
124f1d2b4d3SLarry Finger 
125f1d2b4d3SLarry Finger enum rtl_desc_qsel {
126f1d2b4d3SLarry Finger 	QSLT_BK = 0x2,
127f1d2b4d3SLarry Finger 	QSLT_BE = 0x0,
128f1d2b4d3SLarry Finger 	QSLT_VI = 0x5,
129f1d2b4d3SLarry Finger 	QSLT_VO = 0x7,
130f1d2b4d3SLarry Finger 	QSLT_BEACON = 0x10,
131f1d2b4d3SLarry Finger 	QSLT_HIGH = 0x11,
132f1d2b4d3SLarry Finger 	QSLT_MGNT = 0x12,
133f1d2b4d3SLarry Finger 	QSLT_CMD = 0x13,
134f1d2b4d3SLarry Finger };
135f1d2b4d3SLarry Finger 
136f1d2b4d3SLarry Finger enum rtl_desc92c_rate {
137f1d2b4d3SLarry Finger 	DESC92C_RATE1M = 0x00,
138f1d2b4d3SLarry Finger 	DESC92C_RATE2M = 0x01,
139f1d2b4d3SLarry Finger 	DESC92C_RATE5_5M = 0x02,
140f1d2b4d3SLarry Finger 	DESC92C_RATE11M = 0x03,
141f1d2b4d3SLarry Finger 
142f1d2b4d3SLarry Finger 	DESC92C_RATE6M = 0x04,
143f1d2b4d3SLarry Finger 	DESC92C_RATE9M = 0x05,
144f1d2b4d3SLarry Finger 	DESC92C_RATE12M = 0x06,
145f1d2b4d3SLarry Finger 	DESC92C_RATE18M = 0x07,
146f1d2b4d3SLarry Finger 	DESC92C_RATE24M = 0x08,
147f1d2b4d3SLarry Finger 	DESC92C_RATE36M = 0x09,
148f1d2b4d3SLarry Finger 	DESC92C_RATE48M = 0x0a,
149f1d2b4d3SLarry Finger 	DESC92C_RATE54M = 0x0b,
150f1d2b4d3SLarry Finger 
151f1d2b4d3SLarry Finger 	DESC92C_RATEMCS0 = 0x0c,
152f1d2b4d3SLarry Finger 	DESC92C_RATEMCS1 = 0x0d,
153f1d2b4d3SLarry Finger 	DESC92C_RATEMCS2 = 0x0e,
154f1d2b4d3SLarry Finger 	DESC92C_RATEMCS3 = 0x0f,
155f1d2b4d3SLarry Finger 	DESC92C_RATEMCS4 = 0x10,
156f1d2b4d3SLarry Finger 	DESC92C_RATEMCS5 = 0x11,
157f1d2b4d3SLarry Finger 	DESC92C_RATEMCS6 = 0x12,
158f1d2b4d3SLarry Finger 	DESC92C_RATEMCS7 = 0x13,
159f1d2b4d3SLarry Finger 	DESC92C_RATEMCS8 = 0x14,
160f1d2b4d3SLarry Finger 	DESC92C_RATEMCS9 = 0x15,
161f1d2b4d3SLarry Finger 	DESC92C_RATEMCS10 = 0x16,
162f1d2b4d3SLarry Finger 	DESC92C_RATEMCS11 = 0x17,
163f1d2b4d3SLarry Finger 	DESC92C_RATEMCS12 = 0x18,
164f1d2b4d3SLarry Finger 	DESC92C_RATEMCS13 = 0x19,
165f1d2b4d3SLarry Finger 	DESC92C_RATEMCS14 = 0x1a,
166f1d2b4d3SLarry Finger 	DESC92C_RATEMCS15 = 0x1b,
167f1d2b4d3SLarry Finger 	DESC92C_RATEMCS15_SG = 0x1c,
168f1d2b4d3SLarry Finger 	DESC92C_RATEMCS32 = 0x20,
169f1d2b4d3SLarry Finger };
170f1d2b4d3SLarry Finger 
171f1d2b4d3SLarry Finger struct phy_sts_cck_8192s_t {
172f1d2b4d3SLarry Finger 	u8 adc_pwdb_X[4];
173f1d2b4d3SLarry Finger 	u8 sq_rpt;
174f1d2b4d3SLarry Finger 	u8 cck_agc_rpt;
175f1d2b4d3SLarry Finger };
176f1d2b4d3SLarry Finger 
177f1d2b4d3SLarry Finger struct h2c_cmd_8192c {
178f1d2b4d3SLarry Finger 	u8 element_id;
179f1d2b4d3SLarry Finger 	u32 cmd_len;
180f1d2b4d3SLarry Finger 	u8 *p_cmdbuffer;
181f1d2b4d3SLarry Finger };
182f1d2b4d3SLarry Finger 
183f1d2b4d3SLarry Finger #endif
184