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