xref: /linux/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/def.h (revision 976e3645923bdd2fe7893aae33fd7a21098bfb28)
148fa0b4dSLarry Finger /* SPDX-License-Identifier: GPL-2.0 */
248fa0b4dSLarry Finger /* Copyright(c) 2009-2012  Realtek Corporation.*/
3f1d2b4d3SLarry Finger 
4f1d2b4d3SLarry Finger #ifndef __RTL8723E_DEF_H__
5f1d2b4d3SLarry Finger #define __RTL8723E_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 CHIP_BONDING_IDENTIFIER(_value)	(((_value)>>22)&0x3)
15f1d2b4d3SLarry Finger #define	CHIP_BONDING_92C_1T2R		0x1
16f1d2b4d3SLarry Finger 
17f1d2b4d3SLarry Finger #define CHIP_8723		BIT(0)
18f1d2b4d3SLarry Finger #define NORMAL_CHIP		BIT(3)
19f1d2b4d3SLarry Finger #define RF_TYPE_1T1R		(~(BIT(4)|BIT(5)|BIT(6)))
20f1d2b4d3SLarry Finger #define RF_TYPE_1T2R		BIT(4)
21f1d2b4d3SLarry Finger #define RF_TYPE_2T2R		BIT(5)
22f1d2b4d3SLarry Finger #define CHIP_VENDOR_UMC		BIT(7)
23f1d2b4d3SLarry Finger #define B_CUT_VERSION		BIT(12)
24f1d2b4d3SLarry Finger #define C_CUT_VERSION		BIT(13)
25f1d2b4d3SLarry Finger #define D_CUT_VERSION		((BIT(12)|BIT(13)))
26f1d2b4d3SLarry Finger #define E_CUT_VERSION		BIT(14)
27f1d2b4d3SLarry Finger #define	RF_RL_ID		(BIT(31)|BIT(30)|BIT(29)|BIT(28))
28f1d2b4d3SLarry Finger 
29f1d2b4d3SLarry Finger /* MASK */
30f1d2b4d3SLarry Finger #define IC_TYPE_MASK		(BIT(0)|BIT(1)|BIT(2))
31f1d2b4d3SLarry Finger #define CHIP_TYPE_MASK		BIT(3)
32f1d2b4d3SLarry Finger #define RF_TYPE_MASK		(BIT(4)|BIT(5)|BIT(6))
33f1d2b4d3SLarry Finger #define MANUFACTUER_MASK	BIT(7)
34f1d2b4d3SLarry Finger #define ROM_VERSION_MASK	(BIT(11)|BIT(10)|BIT(9)|BIT(8))
35f1d2b4d3SLarry Finger #define CUT_VERSION_MASK	(BIT(15)|BIT(14)|BIT(13)|BIT(12))
36f1d2b4d3SLarry Finger 
37f1d2b4d3SLarry Finger /* Get element */
38f1d2b4d3SLarry Finger #define GET_CVID_IC_TYPE(version)	((version) & IC_TYPE_MASK)
39f1d2b4d3SLarry Finger #define GET_CVID_CHIP_TYPE(version)	((version) & CHIP_TYPE_MASK)
40f1d2b4d3SLarry Finger #define GET_CVID_RF_TYPE(version)	((version) & RF_TYPE_MASK)
41f1d2b4d3SLarry Finger #define GET_CVID_MANUFACTUER(version)	((version) & MANUFACTUER_MASK)
42f1d2b4d3SLarry Finger #define GET_CVID_ROM_VERSION(version)	((version) & ROM_VERSION_MASK)
43f1d2b4d3SLarry Finger #define GET_CVID_CUT_VERSION(version)	((version) & CUT_VERSION_MASK)
44f1d2b4d3SLarry Finger 
45f1d2b4d3SLarry Finger #define IS_81XXC(version)	((GET_CVID_IC_TYPE(version) == 0) ?\
46f1d2b4d3SLarry Finger 						true : false)
47f1d2b4d3SLarry Finger #define IS_8723_SERIES(version)	((GET_CVID_IC_TYPE(version) == CHIP_8723) ? \
48f1d2b4d3SLarry Finger 						true : false)
49f1d2b4d3SLarry Finger #define IS_1T1R(version)	((GET_CVID_RF_TYPE(version)) ? false : true)
50f1d2b4d3SLarry Finger #define IS_1T2R(version)	((GET_CVID_RF_TYPE(version) == RF_TYPE_1T2R)\
51f1d2b4d3SLarry Finger 						? true : false)
52f1d2b4d3SLarry Finger #define IS_2T2R(version)	((GET_CVID_RF_TYPE(version) == RF_TYPE_2T2R)\
53f1d2b4d3SLarry Finger 						? true : false)
54f1d2b4d3SLarry Finger #define IS_CHIP_VENDOR_UMC(version)	((GET_CVID_MANUFACTUER(version)) ? \
55f1d2b4d3SLarry Finger 						true : false)
56f1d2b4d3SLarry Finger 
57f1d2b4d3SLarry Finger #define IS_VENDOR_UMC_A_CUT(version)	((IS_CHIP_VENDOR_UMC(version))\
58f1d2b4d3SLarry Finger 					? ((GET_CVID_CUT_VERSION(version)) ? \
59f1d2b4d3SLarry Finger 					false : true) : false)
60f1d2b4d3SLarry Finger #define IS_VENDOR_8723_A_CUT(version)	((IS_8723_SERIES(version))\
61f1d2b4d3SLarry Finger 					? ((GET_CVID_CUT_VERSION(version)) ? \
62f1d2b4d3SLarry Finger 					false : true) : false)
63f1d2b4d3SLarry Finger #define IS_VENDOR_8723A_B_CUT(version)	((IS_8723_SERIES(version))\
64f1d2b4d3SLarry Finger 		? ((GET_CVID_CUT_VERSION(version) == \
65f1d2b4d3SLarry Finger 		B_CUT_VERSION) ? true : false) : false)
66*92a1aa25SLarry Finger #define IS_81XXC_VENDOR_UMC_B_CUT(version)	((IS_CHIP_VENDOR_UMC(version))\
67f1d2b4d3SLarry Finger 		? ((GET_CVID_CUT_VERSION(version) == \
68f1d2b4d3SLarry Finger 		B_CUT_VERSION) ? true : false) : false)
69f1d2b4d3SLarry Finger 
70f1d2b4d3SLarry Finger enum rf_optype {
71f1d2b4d3SLarry Finger 	RF_OP_BY_SW_3WIRE = 0,
72f1d2b4d3SLarry Finger 	RF_OP_BY_FW,
73f1d2b4d3SLarry Finger 	RF_OP_MAX
74f1d2b4d3SLarry Finger };
75f1d2b4d3SLarry Finger 
76f1d2b4d3SLarry Finger enum rf_power_state {
77f1d2b4d3SLarry Finger 	RF_ON,
78f1d2b4d3SLarry Finger 	RF_OFF,
79f1d2b4d3SLarry Finger 	RF_SLEEP,
80f1d2b4d3SLarry Finger 	RF_SHUT_DOWN,
81f1d2b4d3SLarry Finger };
82f1d2b4d3SLarry Finger 
83f1d2b4d3SLarry Finger enum power_save_mode {
84f1d2b4d3SLarry Finger 	POWER_SAVE_MODE_ACTIVE,
85f1d2b4d3SLarry Finger 	POWER_SAVE_MODE_SAVE,
86f1d2b4d3SLarry Finger };
87f1d2b4d3SLarry Finger 
88f1d2b4d3SLarry Finger enum power_policy_config {
89f1d2b4d3SLarry Finger 	POWERCFG_MAX_POWER_SAVINGS,
90f1d2b4d3SLarry Finger 	POWERCFG_GLOBAL_POWER_SAVINGS,
91f1d2b4d3SLarry Finger 	POWERCFG_LOCAL_POWER_SAVINGS,
92f1d2b4d3SLarry Finger 	POWERCFG_LENOVO,
93f1d2b4d3SLarry Finger };
94f1d2b4d3SLarry Finger 
95f1d2b4d3SLarry Finger enum interface_select_pci {
96f1d2b4d3SLarry Finger 	INTF_SEL1_MINICARD = 0,
97f1d2b4d3SLarry Finger 	INTF_SEL0_PCIE = 1,
98f1d2b4d3SLarry Finger 	INTF_SEL2_RSV = 2,
99f1d2b4d3SLarry Finger 	INTF_SEL3_RSV = 3,
100f1d2b4d3SLarry Finger };
101f1d2b4d3SLarry Finger 
102f1d2b4d3SLarry Finger enum rtl_desc_qsel {
103f1d2b4d3SLarry Finger 	QSLT_BK = 0x2,
104f1d2b4d3SLarry Finger 	QSLT_BE = 0x0,
105f1d2b4d3SLarry Finger 	QSLT_VI = 0x5,
106f1d2b4d3SLarry Finger 	QSLT_VO = 0x7,
107f1d2b4d3SLarry Finger 	QSLT_BEACON = 0x10,
108f1d2b4d3SLarry Finger 	QSLT_HIGH = 0x11,
109f1d2b4d3SLarry Finger 	QSLT_MGNT = 0x12,
110f1d2b4d3SLarry Finger 	QSLT_CMD = 0x13,
111f1d2b4d3SLarry Finger };
112f1d2b4d3SLarry Finger 
113f1d2b4d3SLarry Finger enum rtl_desc8723e_rate {
114f1d2b4d3SLarry Finger 	DESC92C_RATE1M = 0x00,
115f1d2b4d3SLarry Finger 	DESC92C_RATE2M = 0x01,
116f1d2b4d3SLarry Finger 	DESC92C_RATE5_5M = 0x02,
117f1d2b4d3SLarry Finger 	DESC92C_RATE11M = 0x03,
118f1d2b4d3SLarry Finger 
119f1d2b4d3SLarry Finger 	DESC92C_RATE6M = 0x04,
120f1d2b4d3SLarry Finger 	DESC92C_RATE9M = 0x05,
121f1d2b4d3SLarry Finger 	DESC92C_RATE12M = 0x06,
122f1d2b4d3SLarry Finger 	DESC92C_RATE18M = 0x07,
123f1d2b4d3SLarry Finger 	DESC92C_RATE24M = 0x08,
124f1d2b4d3SLarry Finger 	DESC92C_RATE36M = 0x09,
125f1d2b4d3SLarry Finger 	DESC92C_RATE48M = 0x0a,
126f1d2b4d3SLarry Finger 	DESC92C_RATE54M = 0x0b,
127f1d2b4d3SLarry Finger 
128f1d2b4d3SLarry Finger 	DESC92C_RATEMCS0 = 0x0c,
129f1d2b4d3SLarry Finger 	DESC92C_RATEMCS1 = 0x0d,
130f1d2b4d3SLarry Finger 	DESC92C_RATEMCS2 = 0x0e,
131f1d2b4d3SLarry Finger 	DESC92C_RATEMCS3 = 0x0f,
132f1d2b4d3SLarry Finger 	DESC92C_RATEMCS4 = 0x10,
133f1d2b4d3SLarry Finger 	DESC92C_RATEMCS5 = 0x11,
134f1d2b4d3SLarry Finger 	DESC92C_RATEMCS6 = 0x12,
135f1d2b4d3SLarry Finger 	DESC92C_RATEMCS7 = 0x13,
136f1d2b4d3SLarry Finger 	DESC92C_RATEMCS8 = 0x14,
137f1d2b4d3SLarry Finger 	DESC92C_RATEMCS9 = 0x15,
138f1d2b4d3SLarry Finger 	DESC92C_RATEMCS10 = 0x16,
139f1d2b4d3SLarry Finger 	DESC92C_RATEMCS11 = 0x17,
140f1d2b4d3SLarry Finger 	DESC92C_RATEMCS12 = 0x18,
141f1d2b4d3SLarry Finger 	DESC92C_RATEMCS13 = 0x19,
142f1d2b4d3SLarry Finger 	DESC92C_RATEMCS14 = 0x1a,
143f1d2b4d3SLarry Finger 	DESC92C_RATEMCS15 = 0x1b,
144f1d2b4d3SLarry Finger 	DESC92C_RATEMCS15_SG = 0x1c,
145f1d2b4d3SLarry Finger 	DESC92C_RATEMCS32 = 0x20,
146f1d2b4d3SLarry Finger };
147f1d2b4d3SLarry Finger 
148f1d2b4d3SLarry Finger struct phy_sts_cck_8723e_t {
149f1d2b4d3SLarry Finger 	u8 adc_pwdb_X[4];
150f1d2b4d3SLarry Finger 	u8 sq_rpt;
151f1d2b4d3SLarry Finger 	u8 cck_agc_rpt;
152f1d2b4d3SLarry Finger };
153f1d2b4d3SLarry Finger 
154f1d2b4d3SLarry Finger struct h2c_cmd_8723e {
155f1d2b4d3SLarry Finger 	u8 element_id;
156f1d2b4d3SLarry Finger 	u32 cmd_len;
157f1d2b4d3SLarry Finger 	u8 *p_cmdbuffer;
158f1d2b4d3SLarry Finger };
159f1d2b4d3SLarry Finger 
160f1d2b4d3SLarry Finger #endif
161