1*03f3dd37SLarry Finger /* SPDX-License-Identifier: GPL-2.0 */ 2*03f3dd37SLarry Finger /* Copyright(c) 2009-2010 Realtek Corporation.*/ 3f1d2b4d3SLarry Finger 4f1d2b4d3SLarry Finger #ifndef __RTL8821AE_DEF_H__ 5f1d2b4d3SLarry Finger #define __RTL8821AE_DEF_H__ 6f1d2b4d3SLarry Finger 7f1d2b4d3SLarry Finger /*--------------------------Define -------------------------------------------*/ 8f1d2b4d3SLarry Finger #define USE_SPECIFIC_FW_TO_SUPPORT_WOWLAN 1 9f1d2b4d3SLarry Finger 10f1d2b4d3SLarry Finger /* BIT 7 HT Rate*/ 11f1d2b4d3SLarry Finger /*TxHT = 0*/ 12f1d2b4d3SLarry Finger #define MGN_1M 0x02 13f1d2b4d3SLarry Finger #define MGN_2M 0x04 14f1d2b4d3SLarry Finger #define MGN_5_5M 0x0b 15f1d2b4d3SLarry Finger #define MGN_11M 0x16 16f1d2b4d3SLarry Finger 17f1d2b4d3SLarry Finger #define MGN_6M 0x0c 18f1d2b4d3SLarry Finger #define MGN_9M 0x12 19f1d2b4d3SLarry Finger #define MGN_12M 0x18 20f1d2b4d3SLarry Finger #define MGN_18M 0x24 21f1d2b4d3SLarry Finger #define MGN_24M 0x30 22f1d2b4d3SLarry Finger #define MGN_36M 0x48 23f1d2b4d3SLarry Finger #define MGN_48M 0x60 24f1d2b4d3SLarry Finger #define MGN_54M 0x6c 25f1d2b4d3SLarry Finger 26f1d2b4d3SLarry Finger /* TxHT = 1 */ 27f1d2b4d3SLarry Finger #define MGN_MCS0 0x80 28f1d2b4d3SLarry Finger #define MGN_MCS1 0x81 29f1d2b4d3SLarry Finger #define MGN_MCS2 0x82 30f1d2b4d3SLarry Finger #define MGN_MCS3 0x83 31f1d2b4d3SLarry Finger #define MGN_MCS4 0x84 32f1d2b4d3SLarry Finger #define MGN_MCS5 0x85 33f1d2b4d3SLarry Finger #define MGN_MCS6 0x86 34f1d2b4d3SLarry Finger #define MGN_MCS7 0x87 35f1d2b4d3SLarry Finger #define MGN_MCS8 0x88 36f1d2b4d3SLarry Finger #define MGN_MCS9 0x89 37f1d2b4d3SLarry Finger #define MGN_MCS10 0x8a 38f1d2b4d3SLarry Finger #define MGN_MCS11 0x8b 39f1d2b4d3SLarry Finger #define MGN_MCS12 0x8c 40f1d2b4d3SLarry Finger #define MGN_MCS13 0x8d 41f1d2b4d3SLarry Finger #define MGN_MCS14 0x8e 42f1d2b4d3SLarry Finger #define MGN_MCS15 0x8f 43f1d2b4d3SLarry Finger /* VHT rate */ 44f1d2b4d3SLarry Finger #define MGN_VHT1SS_MCS0 0x90 45f1d2b4d3SLarry Finger #define MGN_VHT1SS_MCS1 0x91 46f1d2b4d3SLarry Finger #define MGN_VHT1SS_MCS2 0x92 47f1d2b4d3SLarry Finger #define MGN_VHT1SS_MCS3 0x93 48f1d2b4d3SLarry Finger #define MGN_VHT1SS_MCS4 0x94 49f1d2b4d3SLarry Finger #define MGN_VHT1SS_MCS5 0x95 50f1d2b4d3SLarry Finger #define MGN_VHT1SS_MCS6 0x96 51f1d2b4d3SLarry Finger #define MGN_VHT1SS_MCS7 0x97 52f1d2b4d3SLarry Finger #define MGN_VHT1SS_MCS8 0x98 53f1d2b4d3SLarry Finger #define MGN_VHT1SS_MCS9 0x99 54f1d2b4d3SLarry Finger #define MGN_VHT2SS_MCS0 0x9a 55f1d2b4d3SLarry Finger #define MGN_VHT2SS_MCS1 0x9b 56f1d2b4d3SLarry Finger #define MGN_VHT2SS_MCS2 0x9c 57f1d2b4d3SLarry Finger #define MGN_VHT2SS_MCS3 0x9d 58f1d2b4d3SLarry Finger #define MGN_VHT2SS_MCS4 0x9e 59f1d2b4d3SLarry Finger #define MGN_VHT2SS_MCS5 0x9f 60f1d2b4d3SLarry Finger #define MGN_VHT2SS_MCS6 0xa0 61f1d2b4d3SLarry Finger #define MGN_VHT2SS_MCS7 0xa1 62f1d2b4d3SLarry Finger #define MGN_VHT2SS_MCS8 0xa2 63f1d2b4d3SLarry Finger #define MGN_VHT2SS_MCS9 0xa3 64f1d2b4d3SLarry Finger 65f1d2b4d3SLarry Finger #define MGN_VHT3SS_MCS0 0xa4 66f1d2b4d3SLarry Finger #define MGN_VHT3SS_MCS1 0xa5 67f1d2b4d3SLarry Finger #define MGN_VHT3SS_MCS2 0xa6 68f1d2b4d3SLarry Finger #define MGN_VHT3SS_MCS3 0xa7 69f1d2b4d3SLarry Finger #define MGN_VHT3SS_MCS4 0xa8 70f1d2b4d3SLarry Finger #define MGN_VHT3SS_MCS5 0xa9 71f1d2b4d3SLarry Finger #define MGN_VHT3SS_MCS6 0xaa 72f1d2b4d3SLarry Finger #define MGN_VHT3SS_MCS7 0xab 73f1d2b4d3SLarry Finger #define MGN_VHT3SS_MCS8 0xac 74f1d2b4d3SLarry Finger #define MGN_VHT3SS_MCS9 0xad 75f1d2b4d3SLarry Finger 76f1d2b4d3SLarry Finger #define MGN_MCS0_SG 0xc0 77f1d2b4d3SLarry Finger #define MGN_MCS1_SG 0xc1 78f1d2b4d3SLarry Finger #define MGN_MCS2_SG 0xc2 79f1d2b4d3SLarry Finger #define MGN_MCS3_SG 0xc3 80f1d2b4d3SLarry Finger #define MGN_MCS4_SG 0xc4 81f1d2b4d3SLarry Finger #define MGN_MCS5_SG 0xc5 82f1d2b4d3SLarry Finger #define MGN_MCS6_SG 0xc6 83f1d2b4d3SLarry Finger #define MGN_MCS7_SG 0xc7 84f1d2b4d3SLarry Finger #define MGN_MCS8_SG 0xc8 85f1d2b4d3SLarry Finger #define MGN_MCS9_SG 0xc9 86f1d2b4d3SLarry Finger #define MGN_MCS10_SG 0xca 87f1d2b4d3SLarry Finger #define MGN_MCS11_SG 0xcb 88f1d2b4d3SLarry Finger #define MGN_MCS12_SG 0xcc 89f1d2b4d3SLarry Finger #define MGN_MCS13_SG 0xcd 90f1d2b4d3SLarry Finger #define MGN_MCS14_SG 0xce 91f1d2b4d3SLarry Finger #define MGN_MCS15_SG 0xcf 92f1d2b4d3SLarry Finger 93f1d2b4d3SLarry Finger #define MGN_UNKNOWN 0xff 94f1d2b4d3SLarry Finger 95f1d2b4d3SLarry Finger /* 30 ms */ 96f1d2b4d3SLarry Finger #define WIFI_NAV_UPPER_US 30000 97f1d2b4d3SLarry Finger #define HAL_92C_NAV_UPPER_UNIT 128 98f1d2b4d3SLarry Finger 99f1d2b4d3SLarry Finger #define MAX_RX_DMA_BUFFER_SIZE 0x3E80 100f1d2b4d3SLarry Finger 101f1d2b4d3SLarry Finger #define HAL_PRIME_CHNL_OFFSET_DONT_CARE 0 102f1d2b4d3SLarry Finger #define HAL_PRIME_CHNL_OFFSET_LOWER 1 103f1d2b4d3SLarry Finger #define HAL_PRIME_CHNL_OFFSET_UPPER 2 104f1d2b4d3SLarry Finger 105f1d2b4d3SLarry Finger #define RX_MPDU_QUEUE 0 106f1d2b4d3SLarry Finger #define RX_CMD_QUEUE 1 107f1d2b4d3SLarry Finger 108f1d2b4d3SLarry Finger #define MAX_RX_DMA_BUFFER_SIZE_8812 0x3E80 109f1d2b4d3SLarry Finger 110f1d2b4d3SLarry Finger #define CHIP_BONDING_IDENTIFIER(_value) (((_value)>>22)&0x3) 111f1d2b4d3SLarry Finger 112f1d2b4d3SLarry Finger #define CHIP_8812 BIT(2) 113f1d2b4d3SLarry Finger #define CHIP_8821 (BIT(0)|BIT(2)) 114f1d2b4d3SLarry Finger 115f1d2b4d3SLarry Finger #define CHIP_8821A (BIT(0)|BIT(2)) 116f1d2b4d3SLarry Finger #define NORMAL_CHIP BIT(3) 117f1d2b4d3SLarry Finger #define RF_TYPE_1T1R (~(BIT(4)|BIT(5)|BIT(6))) 118f1d2b4d3SLarry Finger #define RF_TYPE_1T2R BIT(4) 119f1d2b4d3SLarry Finger #define RF_TYPE_2T2R BIT(5) 120f1d2b4d3SLarry Finger #define CHIP_VENDOR_UMC BIT(7) 121f1d2b4d3SLarry Finger #define B_CUT_VERSION BIT(12) 122f1d2b4d3SLarry Finger #define C_CUT_VERSION BIT(13) 123f1d2b4d3SLarry Finger #define D_CUT_VERSION ((BIT(12)|BIT(13))) 124f1d2b4d3SLarry Finger #define E_CUT_VERSION BIT(14) 125f1d2b4d3SLarry Finger #define RF_RL_ID (BIT(31)|BIT(30)|BIT(29)|BIT(28)) 126f1d2b4d3SLarry Finger 127f1d2b4d3SLarry Finger enum version_8821ae { 128f1d2b4d3SLarry Finger VERSION_TEST_CHIP_1T1R_8812 = 0x0004, 129f1d2b4d3SLarry Finger VERSION_TEST_CHIP_2T2R_8812 = 0x0024, 130f1d2b4d3SLarry Finger VERSION_NORMAL_TSMC_CHIP_1T1R_8812 = 0x100c, 131f1d2b4d3SLarry Finger VERSION_NORMAL_TSMC_CHIP_2T2R_8812 = 0x102c, 132f1d2b4d3SLarry Finger VERSION_NORMAL_TSMC_CHIP_1T1R_8812_C_CUT = 0x200c, 133f1d2b4d3SLarry Finger VERSION_NORMAL_TSMC_CHIP_2T2R_8812_C_CUT = 0x202c, 134f1d2b4d3SLarry Finger VERSION_TEST_CHIP_8821 = 0x0005, 135f1d2b4d3SLarry Finger VERSION_NORMAL_TSMC_CHIP_8821 = 0x000d, 136f1d2b4d3SLarry Finger VERSION_NORMAL_TSMC_CHIP_8821_B_CUT = 0x100d, 137f1d2b4d3SLarry Finger VERSION_UNKNOWN = 0xFF, 138f1d2b4d3SLarry Finger }; 139f1d2b4d3SLarry Finger 140f1d2b4d3SLarry Finger enum vht_data_sc { 141f1d2b4d3SLarry Finger VHT_DATA_SC_DONOT_CARE = 0, 142f1d2b4d3SLarry Finger VHT_DATA_SC_20_UPPER_OF_80MHZ = 1, 143f1d2b4d3SLarry Finger VHT_DATA_SC_20_LOWER_OF_80MHZ = 2, 144f1d2b4d3SLarry Finger VHT_DATA_SC_20_UPPERST_OF_80MHZ = 3, 145f1d2b4d3SLarry Finger VHT_DATA_SC_20_LOWEST_OF_80MHZ = 4, 146f1d2b4d3SLarry Finger VHT_DATA_SC_20_RECV1 = 5, 147f1d2b4d3SLarry Finger VHT_DATA_SC_20_RECV2 = 6, 148f1d2b4d3SLarry Finger VHT_DATA_SC_20_RECV3 = 7, 149f1d2b4d3SLarry Finger VHT_DATA_SC_20_RECV4 = 8, 150f1d2b4d3SLarry Finger VHT_DATA_SC_40_UPPER_OF_80MHZ = 9, 151f1d2b4d3SLarry Finger VHT_DATA_SC_40_LOWER_OF_80MHZ = 10, 152f1d2b4d3SLarry Finger }; 153f1d2b4d3SLarry Finger 154f1d2b4d3SLarry Finger /* MASK */ 155f1d2b4d3SLarry Finger #define IC_TYPE_MASK (BIT(0)|BIT(1)|BIT(2)) 156f1d2b4d3SLarry Finger #define CHIP_TYPE_MASK BIT(3) 157f1d2b4d3SLarry Finger #define RF_TYPE_MASK (BIT(4)|BIT(5)|BIT(6)) 158f1d2b4d3SLarry Finger #define MANUFACTUER_MASK BIT(7) 159f1d2b4d3SLarry Finger #define ROM_VERSION_MASK (BIT(11)|BIT(10)|BIT(9)|BIT(8)) 160f1d2b4d3SLarry Finger #define CUT_VERSION_MASK (BIT(15)|BIT(14)|BIT(13)|BIT(12)) 161f1d2b4d3SLarry Finger 162f1d2b4d3SLarry Finger /* Get element */ 163f1d2b4d3SLarry Finger #define GET_CVID_IC_TYPE(version) ((version) & IC_TYPE_MASK) 164f1d2b4d3SLarry Finger #define GET_CVID_CHIP_TYPE(version) ((version) & CHIP_TYPE_MASK) 165f1d2b4d3SLarry Finger #define GET_CVID_RF_TYPE(version) ((version) & RF_TYPE_MASK) 166f1d2b4d3SLarry Finger #define GET_CVID_MANUFACTUER(version) ((version) & MANUFACTUER_MASK) 167f1d2b4d3SLarry Finger #define GET_CVID_ROM_VERSION(version) ((version) & ROM_VERSION_MASK) 168f1d2b4d3SLarry Finger #define GET_CVID_CUT_VERSION(version) ((version) & CUT_VERSION_MASK) 169f1d2b4d3SLarry Finger 170f1d2b4d3SLarry Finger #define IS_1T1R(version) ((GET_CVID_RF_TYPE(version)) ? false : true) 171f1d2b4d3SLarry Finger #define IS_1T2R(version) ((GET_CVID_RF_TYPE(version) == RF_TYPE_1T2R)\ 172f1d2b4d3SLarry Finger ? true : false) 173f1d2b4d3SLarry Finger #define IS_2T2R(version) ((GET_CVID_RF_TYPE(version) == RF_TYPE_2T2R)\ 174f1d2b4d3SLarry Finger ? true : false) 175f1d2b4d3SLarry Finger 176f1d2b4d3SLarry Finger #define IS_8812_SERIES(version) ((GET_CVID_IC_TYPE(version) == CHIP_8812) ? \ 177f1d2b4d3SLarry Finger true : false) 178f1d2b4d3SLarry Finger #define IS_8821_SERIES(version) ((GET_CVID_IC_TYPE(version) == CHIP_8821) ? \ 179f1d2b4d3SLarry Finger true : false) 180f1d2b4d3SLarry Finger 181f1d2b4d3SLarry Finger #define IS_VENDOR_8812A_TEST_CHIP(version) ((IS_8812_SERIES(version)) ? \ 182f1d2b4d3SLarry Finger ((IS_NORMAL_CHIP(version)) ? \ 183f1d2b4d3SLarry Finger false : true) : false) 184f1d2b4d3SLarry Finger #define IS_VENDOR_8812A_MP_CHIP(version) ((IS_8812_SERIES(version)) ? \ 185f1d2b4d3SLarry Finger ((IS_NORMAL_CHIP(version)) ? \ 186f1d2b4d3SLarry Finger true : false) : false) 187f1d2b4d3SLarry Finger #define IS_VENDOR_8812A_C_CUT(version) ((IS_8812_SERIES(version)) ? \ 188f1d2b4d3SLarry Finger ((GET_CVID_CUT_VERSION(version) == \ 189f1d2b4d3SLarry Finger C_CUT_VERSION) ? \ 190f1d2b4d3SLarry Finger true : false) : false) 191f1d2b4d3SLarry Finger 192f1d2b4d3SLarry Finger #define IS_VENDOR_8821A_TEST_CHIP(version) ((IS_8821_SERIES(version)) ? \ 193f1d2b4d3SLarry Finger ((IS_NORMAL_CHIP(version)) ? \ 194f1d2b4d3SLarry Finger false : true) : false) 195f1d2b4d3SLarry Finger #define IS_VENDOR_8821A_MP_CHIP(version) ((IS_8821_SERIES(version)) ? \ 196f1d2b4d3SLarry Finger ((IS_NORMAL_CHIP(version)) ? \ 197f1d2b4d3SLarry Finger true : false) : false) 198f1d2b4d3SLarry Finger #define IS_VENDOR_8821A_B_CUT(version) ((IS_8821_SERIES(version)) ? \ 199f1d2b4d3SLarry Finger ((GET_CVID_CUT_VERSION(version) == \ 200f1d2b4d3SLarry Finger B_CUT_VERSION) ? \ 201f1d2b4d3SLarry Finger true : false) : false) 202f1d2b4d3SLarry Finger enum board_type { 203f1d2b4d3SLarry Finger ODM_BOARD_DEFAULT = 0, /* The DEFAULT case. */ 204f1d2b4d3SLarry Finger ODM_BOARD_MINICARD = BIT(0), /* 0 = non-mini card, 1 = mini card. */ 205f1d2b4d3SLarry Finger ODM_BOARD_SLIM = BIT(1), /* 0 = non-slim card, 1 = slim card */ 206f1d2b4d3SLarry Finger ODM_BOARD_BT = BIT(2), /* 0 = without BT card, 1 = with BT */ 207f1d2b4d3SLarry Finger ODM_BOARD_EXT_PA = BIT(3), /* 1 = existing 2G ext-PA */ 208f1d2b4d3SLarry Finger ODM_BOARD_EXT_LNA = BIT(4), /* 1 = existing 2G ext-LNA */ 209f1d2b4d3SLarry Finger ODM_BOARD_EXT_TRSW = BIT(5), /* 1 = existing ext-TRSW */ 210f1d2b4d3SLarry Finger ODM_BOARD_EXT_PA_5G = BIT(6), /* 1 = existing 5G ext-PA */ 211f1d2b4d3SLarry Finger ODM_BOARD_EXT_LNA_5G = BIT(7), /* 1 = existing 5G ext-LNA */ 212f1d2b4d3SLarry Finger }; 213f1d2b4d3SLarry Finger 214f1d2b4d3SLarry Finger enum rf_optype { 215f1d2b4d3SLarry Finger RF_OP_BY_SW_3WIRE = 0, 216f1d2b4d3SLarry Finger RF_OP_BY_FW, 217f1d2b4d3SLarry Finger RF_OP_MAX 218f1d2b4d3SLarry Finger }; 219f1d2b4d3SLarry Finger 220f1d2b4d3SLarry Finger enum rf_power_state { 221f1d2b4d3SLarry Finger RF_ON, 222f1d2b4d3SLarry Finger RF_OFF, 223f1d2b4d3SLarry Finger RF_SLEEP, 224f1d2b4d3SLarry Finger RF_SHUT_DOWN, 225f1d2b4d3SLarry Finger }; 226f1d2b4d3SLarry Finger 227f1d2b4d3SLarry Finger enum power_save_mode { 228f1d2b4d3SLarry Finger POWER_SAVE_MODE_ACTIVE, 229f1d2b4d3SLarry Finger POWER_SAVE_MODE_SAVE, 230f1d2b4d3SLarry Finger }; 231f1d2b4d3SLarry Finger 232f1d2b4d3SLarry Finger enum power_polocy_config { 233f1d2b4d3SLarry Finger POWERCFG_MAX_POWER_SAVINGS, 234f1d2b4d3SLarry Finger POWERCFG_GLOBAL_POWER_SAVINGS, 235f1d2b4d3SLarry Finger POWERCFG_LOCAL_POWER_SAVINGS, 236f1d2b4d3SLarry Finger POWERCFG_LENOVO, 237f1d2b4d3SLarry Finger }; 238f1d2b4d3SLarry Finger 239f1d2b4d3SLarry Finger enum interface_select_pci { 240f1d2b4d3SLarry Finger INTF_SEL1_MINICARD = 0, 241f1d2b4d3SLarry Finger INTF_SEL0_PCIE = 1, 242f1d2b4d3SLarry Finger INTF_SEL2_RSV = 2, 243f1d2b4d3SLarry Finger INTF_SEL3_RSV = 3, 244f1d2b4d3SLarry Finger }; 245f1d2b4d3SLarry Finger 246f1d2b4d3SLarry Finger enum rtl_desc_qsel { 247f1d2b4d3SLarry Finger QSLT_BK = 0x2, 248f1d2b4d3SLarry Finger QSLT_BE = 0x0, 249f1d2b4d3SLarry Finger QSLT_VI = 0x5, 250f1d2b4d3SLarry Finger QSLT_VO = 0x7, 251f1d2b4d3SLarry Finger QSLT_BEACON = 0x10, 252f1d2b4d3SLarry Finger QSLT_HIGH = 0x11, 253f1d2b4d3SLarry Finger QSLT_MGNT = 0x12, 254f1d2b4d3SLarry Finger QSLT_CMD = 0x13, 255f1d2b4d3SLarry Finger }; 256f1d2b4d3SLarry Finger 257f1d2b4d3SLarry Finger struct phy_sts_cck_8821ae_t { 258f1d2b4d3SLarry Finger u8 adc_pwdb_X[4]; 259f1d2b4d3SLarry Finger u8 sq_rpt; 260f1d2b4d3SLarry Finger u8 cck_agc_rpt; 261f1d2b4d3SLarry Finger }; 262f1d2b4d3SLarry Finger 263f1d2b4d3SLarry Finger struct h2c_cmd_8821ae { 264f1d2b4d3SLarry Finger u8 element_id; 265f1d2b4d3SLarry Finger u32 cmd_len; 266f1d2b4d3SLarry Finger u8 *p_cmdbuffer; 267f1d2b4d3SLarry Finger }; 268f1d2b4d3SLarry Finger 269f1d2b4d3SLarry Finger #endif 270