18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* Copyright(c) 2009-2013  Realtek Corporation.*/
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#ifndef __RTL92C_DEF_H__
58c2ecf20Sopenharmony_ci#define __RTL92C_DEF_H__
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#define HAL_PRIME_CHNL_OFFSET_DONT_CARE			0
88c2ecf20Sopenharmony_ci#define HAL_PRIME_CHNL_OFFSET_LOWER			1
98c2ecf20Sopenharmony_ci#define HAL_PRIME_CHNL_OFFSET_UPPER			2
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define RX_MPDU_QUEUE					0
128c2ecf20Sopenharmony_ci#define RX_CMD_QUEUE					1
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#define	C2H_RX_CMD_HDR_LEN				8
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define CHIP_BONDING_IDENTIFIER(_value)	(((_value)>>22)&0x3)
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/* [15:12] IC version(CUT): A-cut=0, B-cut=1, C-cut=2, D-cut=3
198c2ecf20Sopenharmony_ci * [7] Manufacturer: TSMC=0, UMC=1
208c2ecf20Sopenharmony_ci * [6:4] RF type: 1T1R=0, 1T2R=1, 2T2R=2
218c2ecf20Sopenharmony_ci * [3] Chip type: TEST=0, NORMAL=1
228c2ecf20Sopenharmony_ci * [2:0] IC type: 81xxC=0, 8723=1, 92D=2
238c2ecf20Sopenharmony_ci */
248c2ecf20Sopenharmony_ci#define CHIP_8723			BIT(0)
258c2ecf20Sopenharmony_ci#define CHIP_92D			BIT(1)
268c2ecf20Sopenharmony_ci#define NORMAL_CHIP			BIT(3)
278c2ecf20Sopenharmony_ci#define RF_TYPE_1T1R			(~(BIT(4)|BIT(5)|BIT(6)))
288c2ecf20Sopenharmony_ci#define RF_TYPE_1T2R			BIT(4)
298c2ecf20Sopenharmony_ci#define RF_TYPE_2T2R			BIT(5)
308c2ecf20Sopenharmony_ci#define CHIP_VENDOR_UMC			BIT(7)
318c2ecf20Sopenharmony_ci#define B_CUT_VERSION			BIT(12)
328c2ecf20Sopenharmony_ci#define C_CUT_VERSION			BIT(13)
338c2ecf20Sopenharmony_ci#define D_CUT_VERSION			((BIT(12)|BIT(13)))
348c2ecf20Sopenharmony_ci#define E_CUT_VERSION			BIT(14)
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/* MASK */
378c2ecf20Sopenharmony_ci#define IC_TYPE_MASK			(BIT(0)|BIT(1)|BIT(2))
388c2ecf20Sopenharmony_ci#define CHIP_TYPE_MASK			BIT(3)
398c2ecf20Sopenharmony_ci#define RF_TYPE_MASK			(BIT(4)|BIT(5)|BIT(6))
408c2ecf20Sopenharmony_ci#define MANUFACTUER_MASK		BIT(7)
418c2ecf20Sopenharmony_ci#define ROM_VERSION_MASK		(BIT(11)|BIT(10)|BIT(9)|BIT(8))
428c2ecf20Sopenharmony_ci#define CUT_VERSION_MASK		(BIT(15)|BIT(14)|BIT(13)|BIT(12))
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/* Get element */
458c2ecf20Sopenharmony_ci#define GET_CVID_IC_TYPE(version)	((version) & IC_TYPE_MASK)
468c2ecf20Sopenharmony_ci#define GET_CVID_CHIP_TYPE(version)	((version) & CHIP_TYPE_MASK)
478c2ecf20Sopenharmony_ci#define GET_CVID_RF_TYPE(version)	((version) & RF_TYPE_MASK)
488c2ecf20Sopenharmony_ci#define GET_CVID_MANUFACTUER(version)	((version) & MANUFACTUER_MASK)
498c2ecf20Sopenharmony_ci#define GET_CVID_ROM_VERSION(version)	((version) & ROM_VERSION_MASK)
508c2ecf20Sopenharmony_ci#define GET_CVID_CUT_VERSION(version)	((version) & CUT_VERSION_MASK)
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#define IS_81XXC(version)						\
538c2ecf20Sopenharmony_ci	((GET_CVID_IC_TYPE(version) == 0) ? true : false)
548c2ecf20Sopenharmony_ci#define IS_8723_SERIES(version)						\
558c2ecf20Sopenharmony_ci	((GET_CVID_IC_TYPE(version) == CHIP_8723) ? true : false)
568c2ecf20Sopenharmony_ci#define IS_92D(version)							\
578c2ecf20Sopenharmony_ci	((GET_CVID_IC_TYPE(version) == CHIP_92D) ? true : false)
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#define IS_NORMAL_CHIP(version)						\
608c2ecf20Sopenharmony_ci	((GET_CVID_CHIP_TYPE(version)) ? true : false)
618c2ecf20Sopenharmony_ci#define IS_NORMAL_CHIP92D(version)					\
628c2ecf20Sopenharmony_ci	((GET_CVID_CHIP_TYPE(version)) ? true : false)
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci#define IS_1T1R(version)						\
658c2ecf20Sopenharmony_ci	((GET_CVID_RF_TYPE(version)) ? false : true)
668c2ecf20Sopenharmony_ci#define IS_1T2R(version)						\
678c2ecf20Sopenharmony_ci	((GET_CVID_RF_TYPE(version) == RF_TYPE_1T2R) ? true : false)
688c2ecf20Sopenharmony_ci#define IS_2T2R(version)						\
698c2ecf20Sopenharmony_ci	((GET_CVID_RF_TYPE(version) == RF_TYPE_2T2R) ? true : false)
708c2ecf20Sopenharmony_ci#define IS_CHIP_VENDOR_UMC(version)					\
718c2ecf20Sopenharmony_ci	((GET_CVID_MANUFACTUER(version)) ? true : false)
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#define IS_92C_SERIAL(version)						\
748c2ecf20Sopenharmony_ci	((IS_81XXC(version) && IS_2T2R(version)) ? true : false)
758c2ecf20Sopenharmony_ci#define IS_81XXC_VENDOR_UMC_B_CUT(version)				\
768c2ecf20Sopenharmony_ci	(IS_81XXC(version) ? (IS_CHIP_VENDOR_UMC(version) ?		\
778c2ecf20Sopenharmony_ci	((GET_CVID_CUT_VERSION(version) == B_CUT_VERSION) ? true	\
788c2ecf20Sopenharmony_ci	: false) : false) : false)
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_cienum version_8188e {
818c2ecf20Sopenharmony_ci	VERSION_TEST_CHIP_88E = 0x00,
828c2ecf20Sopenharmony_ci	VERSION_NORMAL_CHIP_88E = 0x01,
838c2ecf20Sopenharmony_ci	VERSION_UNKNOWN = 0xFF,
848c2ecf20Sopenharmony_ci};
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_cienum rtl819x_loopback_e {
878c2ecf20Sopenharmony_ci	RTL819X_NO_LOOPBACK = 0,
888c2ecf20Sopenharmony_ci	RTL819X_MAC_LOOPBACK = 1,
898c2ecf20Sopenharmony_ci	RTL819X_DMA_LOOPBACK = 2,
908c2ecf20Sopenharmony_ci	RTL819X_CCK_LOOPBACK = 3,
918c2ecf20Sopenharmony_ci};
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_cienum rf_optype {
948c2ecf20Sopenharmony_ci	RF_OP_BY_SW_3WIRE = 0,
958c2ecf20Sopenharmony_ci	RF_OP_BY_FW,
968c2ecf20Sopenharmony_ci	RF_OP_MAX
978c2ecf20Sopenharmony_ci};
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_cienum rf_power_state {
1008c2ecf20Sopenharmony_ci	RF_ON,
1018c2ecf20Sopenharmony_ci	RF_OFF,
1028c2ecf20Sopenharmony_ci	RF_SLEEP,
1038c2ecf20Sopenharmony_ci	RF_SHUT_DOWN,
1048c2ecf20Sopenharmony_ci};
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_cienum power_save_mode {
1078c2ecf20Sopenharmony_ci	POWER_SAVE_MODE_ACTIVE,
1088c2ecf20Sopenharmony_ci	POWER_SAVE_MODE_SAVE,
1098c2ecf20Sopenharmony_ci};
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_cienum power_polocy_config {
1128c2ecf20Sopenharmony_ci	POWERCFG_MAX_POWER_SAVINGS,
1138c2ecf20Sopenharmony_ci	POWERCFG_GLOBAL_POWER_SAVINGS,
1148c2ecf20Sopenharmony_ci	POWERCFG_LOCAL_POWER_SAVINGS,
1158c2ecf20Sopenharmony_ci	POWERCFG_LENOVO,
1168c2ecf20Sopenharmony_ci};
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_cienum interface_select_pci {
1198c2ecf20Sopenharmony_ci	INTF_SEL1_MINICARD = 0,
1208c2ecf20Sopenharmony_ci	INTF_SEL0_PCIE = 1,
1218c2ecf20Sopenharmony_ci	INTF_SEL2_RSV = 2,
1228c2ecf20Sopenharmony_ci	INTF_SEL3_RSV = 3,
1238c2ecf20Sopenharmony_ci};
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_cienum rtl_desc_qsel {
1268c2ecf20Sopenharmony_ci	QSLT_BK = 0x2,
1278c2ecf20Sopenharmony_ci	QSLT_BE = 0x0,
1288c2ecf20Sopenharmony_ci	QSLT_VI = 0x5,
1298c2ecf20Sopenharmony_ci	QSLT_VO = 0x7,
1308c2ecf20Sopenharmony_ci	QSLT_BEACON = 0x10,
1318c2ecf20Sopenharmony_ci	QSLT_HIGH = 0x11,
1328c2ecf20Sopenharmony_ci	QSLT_MGNT = 0x12,
1338c2ecf20Sopenharmony_ci	QSLT_CMD = 0x13,
1348c2ecf20Sopenharmony_ci};
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_cienum rtl_desc92c_rate {
1378c2ecf20Sopenharmony_ci	DESC92C_RATE1M = 0x00,
1388c2ecf20Sopenharmony_ci	DESC92C_RATE2M = 0x01,
1398c2ecf20Sopenharmony_ci	DESC92C_RATE5_5M = 0x02,
1408c2ecf20Sopenharmony_ci	DESC92C_RATE11M = 0x03,
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci	DESC92C_RATE6M = 0x04,
1438c2ecf20Sopenharmony_ci	DESC92C_RATE9M = 0x05,
1448c2ecf20Sopenharmony_ci	DESC92C_RATE12M = 0x06,
1458c2ecf20Sopenharmony_ci	DESC92C_RATE18M = 0x07,
1468c2ecf20Sopenharmony_ci	DESC92C_RATE24M = 0x08,
1478c2ecf20Sopenharmony_ci	DESC92C_RATE36M = 0x09,
1488c2ecf20Sopenharmony_ci	DESC92C_RATE48M = 0x0a,
1498c2ecf20Sopenharmony_ci	DESC92C_RATE54M = 0x0b,
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci	DESC92C_RATEMCS0 = 0x0c,
1528c2ecf20Sopenharmony_ci	DESC92C_RATEMCS1 = 0x0d,
1538c2ecf20Sopenharmony_ci	DESC92C_RATEMCS2 = 0x0e,
1548c2ecf20Sopenharmony_ci	DESC92C_RATEMCS3 = 0x0f,
1558c2ecf20Sopenharmony_ci	DESC92C_RATEMCS4 = 0x10,
1568c2ecf20Sopenharmony_ci	DESC92C_RATEMCS5 = 0x11,
1578c2ecf20Sopenharmony_ci	DESC92C_RATEMCS6 = 0x12,
1588c2ecf20Sopenharmony_ci	DESC92C_RATEMCS7 = 0x13,
1598c2ecf20Sopenharmony_ci	DESC92C_RATEMCS8 = 0x14,
1608c2ecf20Sopenharmony_ci	DESC92C_RATEMCS9 = 0x15,
1618c2ecf20Sopenharmony_ci	DESC92C_RATEMCS10 = 0x16,
1628c2ecf20Sopenharmony_ci	DESC92C_RATEMCS11 = 0x17,
1638c2ecf20Sopenharmony_ci	DESC92C_RATEMCS12 = 0x18,
1648c2ecf20Sopenharmony_ci	DESC92C_RATEMCS13 = 0x19,
1658c2ecf20Sopenharmony_ci	DESC92C_RATEMCS14 = 0x1a,
1668c2ecf20Sopenharmony_ci	DESC92C_RATEMCS15 = 0x1b,
1678c2ecf20Sopenharmony_ci	DESC92C_RATEMCS15_SG = 0x1c,
1688c2ecf20Sopenharmony_ci	DESC92C_RATEMCS32 = 0x20,
1698c2ecf20Sopenharmony_ci};
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_cistruct phy_sts_cck_8192s_t {
1728c2ecf20Sopenharmony_ci	u8 adc_pwdb_X[4];
1738c2ecf20Sopenharmony_ci	u8 sq_rpt;
1748c2ecf20Sopenharmony_ci	u8 cck_agc_rpt;
1758c2ecf20Sopenharmony_ci};
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_cistruct h2c_cmd_8192c {
1788c2ecf20Sopenharmony_ci	u8 element_id;
1798c2ecf20Sopenharmony_ci	u32 cmd_len;
1808c2ecf20Sopenharmony_ci	u8 *p_cmdbuffer;
1818c2ecf20Sopenharmony_ci};
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci#endif
184