162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* Copyright(c) 2009-2013 Realtek Corporation.*/ 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci#ifndef __RTL92C_DEF_H__ 562306a36Sopenharmony_ci#define __RTL92C_DEF_H__ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#define HAL_PRIME_CHNL_OFFSET_DONT_CARE 0 862306a36Sopenharmony_ci#define HAL_PRIME_CHNL_OFFSET_LOWER 1 962306a36Sopenharmony_ci#define HAL_PRIME_CHNL_OFFSET_UPPER 2 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#define RX_MPDU_QUEUE 0 1262306a36Sopenharmony_ci#define RX_CMD_QUEUE 1 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#define C2H_RX_CMD_HDR_LEN 8 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci#define CHIP_BONDING_IDENTIFIER(_value) (((_value)>>22)&0x3) 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci/* [15:12] IC version(CUT): A-cut=0, B-cut=1, C-cut=2, D-cut=3 1962306a36Sopenharmony_ci * [7] Manufacturer: TSMC=0, UMC=1 2062306a36Sopenharmony_ci * [6:4] RF type: 1T1R=0, 1T2R=1, 2T2R=2 2162306a36Sopenharmony_ci * [3] Chip type: TEST=0, NORMAL=1 2262306a36Sopenharmony_ci * [2:0] IC type: 81xxC=0, 8723=1, 92D=2 2362306a36Sopenharmony_ci */ 2462306a36Sopenharmony_ci#define CHIP_8723 BIT(0) 2562306a36Sopenharmony_ci#define CHIP_92D BIT(1) 2662306a36Sopenharmony_ci#define NORMAL_CHIP BIT(3) 2762306a36Sopenharmony_ci#define RF_TYPE_1T1R (~(BIT(4)|BIT(5)|BIT(6))) 2862306a36Sopenharmony_ci#define RF_TYPE_1T2R BIT(4) 2962306a36Sopenharmony_ci#define RF_TYPE_2T2R BIT(5) 3062306a36Sopenharmony_ci#define CHIP_VENDOR_UMC BIT(7) 3162306a36Sopenharmony_ci#define B_CUT_VERSION BIT(12) 3262306a36Sopenharmony_ci#define C_CUT_VERSION BIT(13) 3362306a36Sopenharmony_ci#define D_CUT_VERSION ((BIT(12)|BIT(13))) 3462306a36Sopenharmony_ci#define E_CUT_VERSION BIT(14) 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci/* MASK */ 3762306a36Sopenharmony_ci#define IC_TYPE_MASK (BIT(0)|BIT(1)|BIT(2)) 3862306a36Sopenharmony_ci#define CHIP_TYPE_MASK BIT(3) 3962306a36Sopenharmony_ci#define RF_TYPE_MASK (BIT(4)|BIT(5)|BIT(6)) 4062306a36Sopenharmony_ci#define MANUFACTUER_MASK BIT(7) 4162306a36Sopenharmony_ci#define ROM_VERSION_MASK (BIT(11)|BIT(10)|BIT(9)|BIT(8)) 4262306a36Sopenharmony_ci#define CUT_VERSION_MASK (BIT(15)|BIT(14)|BIT(13)|BIT(12)) 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci/* Get element */ 4562306a36Sopenharmony_ci#define GET_CVID_IC_TYPE(version) ((version) & IC_TYPE_MASK) 4662306a36Sopenharmony_ci#define GET_CVID_CHIP_TYPE(version) ((version) & CHIP_TYPE_MASK) 4762306a36Sopenharmony_ci#define GET_CVID_RF_TYPE(version) ((version) & RF_TYPE_MASK) 4862306a36Sopenharmony_ci#define GET_CVID_MANUFACTUER(version) ((version) & MANUFACTUER_MASK) 4962306a36Sopenharmony_ci#define GET_CVID_ROM_VERSION(version) ((version) & ROM_VERSION_MASK) 5062306a36Sopenharmony_ci#define GET_CVID_CUT_VERSION(version) ((version) & CUT_VERSION_MASK) 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci#define IS_81XXC(version) \ 5362306a36Sopenharmony_ci ((GET_CVID_IC_TYPE(version) == 0) ? true : false) 5462306a36Sopenharmony_ci#define IS_8723_SERIES(version) \ 5562306a36Sopenharmony_ci ((GET_CVID_IC_TYPE(version) == CHIP_8723) ? true : false) 5662306a36Sopenharmony_ci#define IS_92D(version) \ 5762306a36Sopenharmony_ci ((GET_CVID_IC_TYPE(version) == CHIP_92D) ? true : false) 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci#define IS_NORMAL_CHIP(version) \ 6062306a36Sopenharmony_ci ((GET_CVID_CHIP_TYPE(version)) ? true : false) 6162306a36Sopenharmony_ci#define IS_NORMAL_CHIP92D(version) \ 6262306a36Sopenharmony_ci ((GET_CVID_CHIP_TYPE(version)) ? true : false) 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci#define IS_1T1R(version) \ 6562306a36Sopenharmony_ci ((GET_CVID_RF_TYPE(version)) ? false : true) 6662306a36Sopenharmony_ci#define IS_1T2R(version) \ 6762306a36Sopenharmony_ci ((GET_CVID_RF_TYPE(version) == RF_TYPE_1T2R) ? true : false) 6862306a36Sopenharmony_ci#define IS_2T2R(version) \ 6962306a36Sopenharmony_ci ((GET_CVID_RF_TYPE(version) == RF_TYPE_2T2R) ? true : false) 7062306a36Sopenharmony_ci#define IS_CHIP_VENDOR_UMC(version) \ 7162306a36Sopenharmony_ci ((GET_CVID_MANUFACTUER(version)) ? true : false) 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci#define IS_92C_SERIAL(version) \ 7462306a36Sopenharmony_ci ((IS_81XXC(version) && IS_2T2R(version)) ? true : false) 7562306a36Sopenharmony_ci#define IS_81XXC_VENDOR_UMC_B_CUT(version) \ 7662306a36Sopenharmony_ci (IS_81XXC(version) ? (IS_CHIP_VENDOR_UMC(version) ? \ 7762306a36Sopenharmony_ci ((GET_CVID_CUT_VERSION(version) == B_CUT_VERSION) ? true \ 7862306a36Sopenharmony_ci : false) : false) : false) 7962306a36Sopenharmony_ci 8062306a36Sopenharmony_cienum version_8188e { 8162306a36Sopenharmony_ci VERSION_TEST_CHIP_88E = 0x00, 8262306a36Sopenharmony_ci VERSION_NORMAL_CHIP_88E = 0x01, 8362306a36Sopenharmony_ci VERSION_UNKNOWN = 0xFF, 8462306a36Sopenharmony_ci}; 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_cienum rtl819x_loopback_e { 8762306a36Sopenharmony_ci RTL819X_NO_LOOPBACK = 0, 8862306a36Sopenharmony_ci RTL819X_MAC_LOOPBACK = 1, 8962306a36Sopenharmony_ci RTL819X_DMA_LOOPBACK = 2, 9062306a36Sopenharmony_ci RTL819X_CCK_LOOPBACK = 3, 9162306a36Sopenharmony_ci}; 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_cienum rf_optype { 9462306a36Sopenharmony_ci RF_OP_BY_SW_3WIRE = 0, 9562306a36Sopenharmony_ci RF_OP_BY_FW, 9662306a36Sopenharmony_ci RF_OP_MAX 9762306a36Sopenharmony_ci}; 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_cienum rf_power_state { 10062306a36Sopenharmony_ci RF_ON, 10162306a36Sopenharmony_ci RF_OFF, 10262306a36Sopenharmony_ci RF_SLEEP, 10362306a36Sopenharmony_ci RF_SHUT_DOWN, 10462306a36Sopenharmony_ci}; 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_cienum power_save_mode { 10762306a36Sopenharmony_ci POWER_SAVE_MODE_ACTIVE, 10862306a36Sopenharmony_ci POWER_SAVE_MODE_SAVE, 10962306a36Sopenharmony_ci}; 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_cienum power_polocy_config { 11262306a36Sopenharmony_ci POWERCFG_MAX_POWER_SAVINGS, 11362306a36Sopenharmony_ci POWERCFG_GLOBAL_POWER_SAVINGS, 11462306a36Sopenharmony_ci POWERCFG_LOCAL_POWER_SAVINGS, 11562306a36Sopenharmony_ci POWERCFG_LENOVO, 11662306a36Sopenharmony_ci}; 11762306a36Sopenharmony_ci 11862306a36Sopenharmony_cienum interface_select_pci { 11962306a36Sopenharmony_ci INTF_SEL1_MINICARD = 0, 12062306a36Sopenharmony_ci INTF_SEL0_PCIE = 1, 12162306a36Sopenharmony_ci INTF_SEL2_RSV = 2, 12262306a36Sopenharmony_ci INTF_SEL3_RSV = 3, 12362306a36Sopenharmony_ci}; 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_cienum rtl_desc_qsel { 12662306a36Sopenharmony_ci QSLT_BK = 0x2, 12762306a36Sopenharmony_ci QSLT_BE = 0x0, 12862306a36Sopenharmony_ci QSLT_VI = 0x5, 12962306a36Sopenharmony_ci QSLT_VO = 0x7, 13062306a36Sopenharmony_ci QSLT_BEACON = 0x10, 13162306a36Sopenharmony_ci QSLT_HIGH = 0x11, 13262306a36Sopenharmony_ci QSLT_MGNT = 0x12, 13362306a36Sopenharmony_ci QSLT_CMD = 0x13, 13462306a36Sopenharmony_ci}; 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_cienum rtl_desc92c_rate { 13762306a36Sopenharmony_ci DESC92C_RATE1M = 0x00, 13862306a36Sopenharmony_ci DESC92C_RATE2M = 0x01, 13962306a36Sopenharmony_ci DESC92C_RATE5_5M = 0x02, 14062306a36Sopenharmony_ci DESC92C_RATE11M = 0x03, 14162306a36Sopenharmony_ci 14262306a36Sopenharmony_ci DESC92C_RATE6M = 0x04, 14362306a36Sopenharmony_ci DESC92C_RATE9M = 0x05, 14462306a36Sopenharmony_ci DESC92C_RATE12M = 0x06, 14562306a36Sopenharmony_ci DESC92C_RATE18M = 0x07, 14662306a36Sopenharmony_ci DESC92C_RATE24M = 0x08, 14762306a36Sopenharmony_ci DESC92C_RATE36M = 0x09, 14862306a36Sopenharmony_ci DESC92C_RATE48M = 0x0a, 14962306a36Sopenharmony_ci DESC92C_RATE54M = 0x0b, 15062306a36Sopenharmony_ci 15162306a36Sopenharmony_ci DESC92C_RATEMCS0 = 0x0c, 15262306a36Sopenharmony_ci DESC92C_RATEMCS1 = 0x0d, 15362306a36Sopenharmony_ci DESC92C_RATEMCS2 = 0x0e, 15462306a36Sopenharmony_ci DESC92C_RATEMCS3 = 0x0f, 15562306a36Sopenharmony_ci DESC92C_RATEMCS4 = 0x10, 15662306a36Sopenharmony_ci DESC92C_RATEMCS5 = 0x11, 15762306a36Sopenharmony_ci DESC92C_RATEMCS6 = 0x12, 15862306a36Sopenharmony_ci DESC92C_RATEMCS7 = 0x13, 15962306a36Sopenharmony_ci DESC92C_RATEMCS8 = 0x14, 16062306a36Sopenharmony_ci DESC92C_RATEMCS9 = 0x15, 16162306a36Sopenharmony_ci DESC92C_RATEMCS10 = 0x16, 16262306a36Sopenharmony_ci DESC92C_RATEMCS11 = 0x17, 16362306a36Sopenharmony_ci DESC92C_RATEMCS12 = 0x18, 16462306a36Sopenharmony_ci DESC92C_RATEMCS13 = 0x19, 16562306a36Sopenharmony_ci DESC92C_RATEMCS14 = 0x1a, 16662306a36Sopenharmony_ci DESC92C_RATEMCS15 = 0x1b, 16762306a36Sopenharmony_ci DESC92C_RATEMCS15_SG = 0x1c, 16862306a36Sopenharmony_ci DESC92C_RATEMCS32 = 0x20, 16962306a36Sopenharmony_ci}; 17062306a36Sopenharmony_ci 17162306a36Sopenharmony_cistruct phy_sts_cck_8192s_t { 17262306a36Sopenharmony_ci u8 adc_pwdb_X[4]; 17362306a36Sopenharmony_ci u8 sq_rpt; 17462306a36Sopenharmony_ci u8 cck_agc_rpt; 17562306a36Sopenharmony_ci}; 17662306a36Sopenharmony_ci 17762306a36Sopenharmony_cistruct h2c_cmd_8192c { 17862306a36Sopenharmony_ci u8 element_id; 17962306a36Sopenharmony_ci u32 cmd_len; 18062306a36Sopenharmony_ci u8 *p_cmdbuffer; 18162306a36Sopenharmony_ci}; 18262306a36Sopenharmony_ci 18362306a36Sopenharmony_ci#endif 184