18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* Copyright(c) 2009-2010 Realtek Corporation.*/ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#ifndef __RTL8821AE_DEF_H__ 58c2ecf20Sopenharmony_ci#define __RTL8821AE_DEF_H__ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci/*--------------------------Define -------------------------------------------*/ 88c2ecf20Sopenharmony_ci#define USE_SPECIFIC_FW_TO_SUPPORT_WOWLAN 1 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci/* BIT 7 HT Rate*/ 118c2ecf20Sopenharmony_ci/*TxHT = 0*/ 128c2ecf20Sopenharmony_ci#define MGN_1M 0x02 138c2ecf20Sopenharmony_ci#define MGN_2M 0x04 148c2ecf20Sopenharmony_ci#define MGN_5_5M 0x0b 158c2ecf20Sopenharmony_ci#define MGN_11M 0x16 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#define MGN_6M 0x0c 188c2ecf20Sopenharmony_ci#define MGN_9M 0x12 198c2ecf20Sopenharmony_ci#define MGN_12M 0x18 208c2ecf20Sopenharmony_ci#define MGN_18M 0x24 218c2ecf20Sopenharmony_ci#define MGN_24M 0x30 228c2ecf20Sopenharmony_ci#define MGN_36M 0x48 238c2ecf20Sopenharmony_ci#define MGN_48M 0x60 248c2ecf20Sopenharmony_ci#define MGN_54M 0x6c 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* TxHT = 1 */ 278c2ecf20Sopenharmony_ci#define MGN_MCS0 0x80 288c2ecf20Sopenharmony_ci#define MGN_MCS1 0x81 298c2ecf20Sopenharmony_ci#define MGN_MCS2 0x82 308c2ecf20Sopenharmony_ci#define MGN_MCS3 0x83 318c2ecf20Sopenharmony_ci#define MGN_MCS4 0x84 328c2ecf20Sopenharmony_ci#define MGN_MCS5 0x85 338c2ecf20Sopenharmony_ci#define MGN_MCS6 0x86 348c2ecf20Sopenharmony_ci#define MGN_MCS7 0x87 358c2ecf20Sopenharmony_ci#define MGN_MCS8 0x88 368c2ecf20Sopenharmony_ci#define MGN_MCS9 0x89 378c2ecf20Sopenharmony_ci#define MGN_MCS10 0x8a 388c2ecf20Sopenharmony_ci#define MGN_MCS11 0x8b 398c2ecf20Sopenharmony_ci#define MGN_MCS12 0x8c 408c2ecf20Sopenharmony_ci#define MGN_MCS13 0x8d 418c2ecf20Sopenharmony_ci#define MGN_MCS14 0x8e 428c2ecf20Sopenharmony_ci#define MGN_MCS15 0x8f 438c2ecf20Sopenharmony_ci/* VHT rate */ 448c2ecf20Sopenharmony_ci#define MGN_VHT1SS_MCS0 0x90 458c2ecf20Sopenharmony_ci#define MGN_VHT1SS_MCS1 0x91 468c2ecf20Sopenharmony_ci#define MGN_VHT1SS_MCS2 0x92 478c2ecf20Sopenharmony_ci#define MGN_VHT1SS_MCS3 0x93 488c2ecf20Sopenharmony_ci#define MGN_VHT1SS_MCS4 0x94 498c2ecf20Sopenharmony_ci#define MGN_VHT1SS_MCS5 0x95 508c2ecf20Sopenharmony_ci#define MGN_VHT1SS_MCS6 0x96 518c2ecf20Sopenharmony_ci#define MGN_VHT1SS_MCS7 0x97 528c2ecf20Sopenharmony_ci#define MGN_VHT1SS_MCS8 0x98 538c2ecf20Sopenharmony_ci#define MGN_VHT1SS_MCS9 0x99 548c2ecf20Sopenharmony_ci#define MGN_VHT2SS_MCS0 0x9a 558c2ecf20Sopenharmony_ci#define MGN_VHT2SS_MCS1 0x9b 568c2ecf20Sopenharmony_ci#define MGN_VHT2SS_MCS2 0x9c 578c2ecf20Sopenharmony_ci#define MGN_VHT2SS_MCS3 0x9d 588c2ecf20Sopenharmony_ci#define MGN_VHT2SS_MCS4 0x9e 598c2ecf20Sopenharmony_ci#define MGN_VHT2SS_MCS5 0x9f 608c2ecf20Sopenharmony_ci#define MGN_VHT2SS_MCS6 0xa0 618c2ecf20Sopenharmony_ci#define MGN_VHT2SS_MCS7 0xa1 628c2ecf20Sopenharmony_ci#define MGN_VHT2SS_MCS8 0xa2 638c2ecf20Sopenharmony_ci#define MGN_VHT2SS_MCS9 0xa3 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci#define MGN_VHT3SS_MCS0 0xa4 668c2ecf20Sopenharmony_ci#define MGN_VHT3SS_MCS1 0xa5 678c2ecf20Sopenharmony_ci#define MGN_VHT3SS_MCS2 0xa6 688c2ecf20Sopenharmony_ci#define MGN_VHT3SS_MCS3 0xa7 698c2ecf20Sopenharmony_ci#define MGN_VHT3SS_MCS4 0xa8 708c2ecf20Sopenharmony_ci#define MGN_VHT3SS_MCS5 0xa9 718c2ecf20Sopenharmony_ci#define MGN_VHT3SS_MCS6 0xaa 728c2ecf20Sopenharmony_ci#define MGN_VHT3SS_MCS7 0xab 738c2ecf20Sopenharmony_ci#define MGN_VHT3SS_MCS8 0xac 748c2ecf20Sopenharmony_ci#define MGN_VHT3SS_MCS9 0xad 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci#define MGN_MCS0_SG 0xc0 778c2ecf20Sopenharmony_ci#define MGN_MCS1_SG 0xc1 788c2ecf20Sopenharmony_ci#define MGN_MCS2_SG 0xc2 798c2ecf20Sopenharmony_ci#define MGN_MCS3_SG 0xc3 808c2ecf20Sopenharmony_ci#define MGN_MCS4_SG 0xc4 818c2ecf20Sopenharmony_ci#define MGN_MCS5_SG 0xc5 828c2ecf20Sopenharmony_ci#define MGN_MCS6_SG 0xc6 838c2ecf20Sopenharmony_ci#define MGN_MCS7_SG 0xc7 848c2ecf20Sopenharmony_ci#define MGN_MCS8_SG 0xc8 858c2ecf20Sopenharmony_ci#define MGN_MCS9_SG 0xc9 868c2ecf20Sopenharmony_ci#define MGN_MCS10_SG 0xca 878c2ecf20Sopenharmony_ci#define MGN_MCS11_SG 0xcb 888c2ecf20Sopenharmony_ci#define MGN_MCS12_SG 0xcc 898c2ecf20Sopenharmony_ci#define MGN_MCS13_SG 0xcd 908c2ecf20Sopenharmony_ci#define MGN_MCS14_SG 0xce 918c2ecf20Sopenharmony_ci#define MGN_MCS15_SG 0xcf 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci#define MGN_UNKNOWN 0xff 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci/* 30 ms */ 968c2ecf20Sopenharmony_ci#define WIFI_NAV_UPPER_US 30000 978c2ecf20Sopenharmony_ci#define HAL_92C_NAV_UPPER_UNIT 128 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci#define MAX_RX_DMA_BUFFER_SIZE 0x3E80 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci#define HAL_PRIME_CHNL_OFFSET_DONT_CARE 0 1028c2ecf20Sopenharmony_ci#define HAL_PRIME_CHNL_OFFSET_LOWER 1 1038c2ecf20Sopenharmony_ci#define HAL_PRIME_CHNL_OFFSET_UPPER 2 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci#define RX_MPDU_QUEUE 0 1068c2ecf20Sopenharmony_ci#define RX_CMD_QUEUE 1 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci#define MAX_RX_DMA_BUFFER_SIZE_8812 0x3E80 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci#define CHIP_BONDING_IDENTIFIER(_value) (((_value)>>22)&0x3) 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci#define CHIP_8812 BIT(2) 1138c2ecf20Sopenharmony_ci#define CHIP_8821 (BIT(0)|BIT(2)) 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci#define CHIP_8821A (BIT(0)|BIT(2)) 1168c2ecf20Sopenharmony_ci#define NORMAL_CHIP BIT(3) 1178c2ecf20Sopenharmony_ci#define RF_TYPE_1T1R (~(BIT(4)|BIT(5)|BIT(6))) 1188c2ecf20Sopenharmony_ci#define RF_TYPE_1T2R BIT(4) 1198c2ecf20Sopenharmony_ci#define RF_TYPE_2T2R BIT(5) 1208c2ecf20Sopenharmony_ci#define CHIP_VENDOR_UMC BIT(7) 1218c2ecf20Sopenharmony_ci#define B_CUT_VERSION BIT(12) 1228c2ecf20Sopenharmony_ci#define C_CUT_VERSION BIT(13) 1238c2ecf20Sopenharmony_ci#define D_CUT_VERSION ((BIT(12)|BIT(13))) 1248c2ecf20Sopenharmony_ci#define E_CUT_VERSION BIT(14) 1258c2ecf20Sopenharmony_ci#define RF_RL_ID (BIT(31)|BIT(30)|BIT(29)|BIT(28)) 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_cienum version_8821ae { 1288c2ecf20Sopenharmony_ci VERSION_TEST_CHIP_1T1R_8812 = 0x0004, 1298c2ecf20Sopenharmony_ci VERSION_TEST_CHIP_2T2R_8812 = 0x0024, 1308c2ecf20Sopenharmony_ci VERSION_NORMAL_TSMC_CHIP_1T1R_8812 = 0x100c, 1318c2ecf20Sopenharmony_ci VERSION_NORMAL_TSMC_CHIP_2T2R_8812 = 0x102c, 1328c2ecf20Sopenharmony_ci VERSION_NORMAL_TSMC_CHIP_1T1R_8812_C_CUT = 0x200c, 1338c2ecf20Sopenharmony_ci VERSION_NORMAL_TSMC_CHIP_2T2R_8812_C_CUT = 0x202c, 1348c2ecf20Sopenharmony_ci VERSION_TEST_CHIP_8821 = 0x0005, 1358c2ecf20Sopenharmony_ci VERSION_NORMAL_TSMC_CHIP_8821 = 0x000d, 1368c2ecf20Sopenharmony_ci VERSION_NORMAL_TSMC_CHIP_8821_B_CUT = 0x100d, 1378c2ecf20Sopenharmony_ci VERSION_UNKNOWN = 0xFF, 1388c2ecf20Sopenharmony_ci}; 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_cienum vht_data_sc { 1418c2ecf20Sopenharmony_ci VHT_DATA_SC_DONOT_CARE = 0, 1428c2ecf20Sopenharmony_ci VHT_DATA_SC_20_UPPER_OF_80MHZ = 1, 1438c2ecf20Sopenharmony_ci VHT_DATA_SC_20_LOWER_OF_80MHZ = 2, 1448c2ecf20Sopenharmony_ci VHT_DATA_SC_20_UPPERST_OF_80MHZ = 3, 1458c2ecf20Sopenharmony_ci VHT_DATA_SC_20_LOWEST_OF_80MHZ = 4, 1468c2ecf20Sopenharmony_ci VHT_DATA_SC_20_RECV1 = 5, 1478c2ecf20Sopenharmony_ci VHT_DATA_SC_20_RECV2 = 6, 1488c2ecf20Sopenharmony_ci VHT_DATA_SC_20_RECV3 = 7, 1498c2ecf20Sopenharmony_ci VHT_DATA_SC_20_RECV4 = 8, 1508c2ecf20Sopenharmony_ci VHT_DATA_SC_40_UPPER_OF_80MHZ = 9, 1518c2ecf20Sopenharmony_ci VHT_DATA_SC_40_LOWER_OF_80MHZ = 10, 1528c2ecf20Sopenharmony_ci}; 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci/* MASK */ 1558c2ecf20Sopenharmony_ci#define IC_TYPE_MASK (BIT(0)|BIT(1)|BIT(2)) 1568c2ecf20Sopenharmony_ci#define CHIP_TYPE_MASK BIT(3) 1578c2ecf20Sopenharmony_ci#define RF_TYPE_MASK (BIT(4)|BIT(5)|BIT(6)) 1588c2ecf20Sopenharmony_ci#define MANUFACTUER_MASK BIT(7) 1598c2ecf20Sopenharmony_ci#define ROM_VERSION_MASK (BIT(11)|BIT(10)|BIT(9)|BIT(8)) 1608c2ecf20Sopenharmony_ci#define CUT_VERSION_MASK (BIT(15)|BIT(14)|BIT(13)|BIT(12)) 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci/* Get element */ 1638c2ecf20Sopenharmony_ci#define GET_CVID_IC_TYPE(version) ((version) & IC_TYPE_MASK) 1648c2ecf20Sopenharmony_ci#define GET_CVID_CHIP_TYPE(version) ((version) & CHIP_TYPE_MASK) 1658c2ecf20Sopenharmony_ci#define GET_CVID_RF_TYPE(version) ((version) & RF_TYPE_MASK) 1668c2ecf20Sopenharmony_ci#define GET_CVID_MANUFACTUER(version) ((version) & MANUFACTUER_MASK) 1678c2ecf20Sopenharmony_ci#define GET_CVID_ROM_VERSION(version) ((version) & ROM_VERSION_MASK) 1688c2ecf20Sopenharmony_ci#define GET_CVID_CUT_VERSION(version) ((version) & CUT_VERSION_MASK) 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_ci#define IS_1T1R(version) ((GET_CVID_RF_TYPE(version)) ? false : true) 1718c2ecf20Sopenharmony_ci#define IS_1T2R(version) ((GET_CVID_RF_TYPE(version) == RF_TYPE_1T2R)\ 1728c2ecf20Sopenharmony_ci ? true : false) 1738c2ecf20Sopenharmony_ci#define IS_2T2R(version) ((GET_CVID_RF_TYPE(version) == RF_TYPE_2T2R)\ 1748c2ecf20Sopenharmony_ci ? true : false) 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci#define IS_8812_SERIES(version) ((GET_CVID_IC_TYPE(version) == CHIP_8812) ? \ 1778c2ecf20Sopenharmony_ci true : false) 1788c2ecf20Sopenharmony_ci#define IS_8821_SERIES(version) ((GET_CVID_IC_TYPE(version) == CHIP_8821) ? \ 1798c2ecf20Sopenharmony_ci true : false) 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci#define IS_VENDOR_8812A_TEST_CHIP(version) ((IS_8812_SERIES(version)) ? \ 1828c2ecf20Sopenharmony_ci ((IS_NORMAL_CHIP(version)) ? \ 1838c2ecf20Sopenharmony_ci false : true) : false) 1848c2ecf20Sopenharmony_ci#define IS_VENDOR_8812A_MP_CHIP(version) ((IS_8812_SERIES(version)) ? \ 1858c2ecf20Sopenharmony_ci ((IS_NORMAL_CHIP(version)) ? \ 1868c2ecf20Sopenharmony_ci true : false) : false) 1878c2ecf20Sopenharmony_ci#define IS_VENDOR_8812A_C_CUT(version) ((IS_8812_SERIES(version)) ? \ 1888c2ecf20Sopenharmony_ci ((GET_CVID_CUT_VERSION(version) == \ 1898c2ecf20Sopenharmony_ci C_CUT_VERSION) ? \ 1908c2ecf20Sopenharmony_ci true : false) : false) 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ci#define IS_VENDOR_8821A_TEST_CHIP(version) ((IS_8821_SERIES(version)) ? \ 1938c2ecf20Sopenharmony_ci ((IS_NORMAL_CHIP(version)) ? \ 1948c2ecf20Sopenharmony_ci false : true) : false) 1958c2ecf20Sopenharmony_ci#define IS_VENDOR_8821A_MP_CHIP(version) ((IS_8821_SERIES(version)) ? \ 1968c2ecf20Sopenharmony_ci ((IS_NORMAL_CHIP(version)) ? \ 1978c2ecf20Sopenharmony_ci true : false) : false) 1988c2ecf20Sopenharmony_ci#define IS_VENDOR_8821A_B_CUT(version) ((IS_8821_SERIES(version)) ? \ 1998c2ecf20Sopenharmony_ci ((GET_CVID_CUT_VERSION(version) == \ 2008c2ecf20Sopenharmony_ci B_CUT_VERSION) ? \ 2018c2ecf20Sopenharmony_ci true : false) : false) 2028c2ecf20Sopenharmony_cienum board_type { 2038c2ecf20Sopenharmony_ci ODM_BOARD_DEFAULT = 0, /* The DEFAULT case. */ 2048c2ecf20Sopenharmony_ci ODM_BOARD_MINICARD = BIT(0), /* 0 = non-mini card, 1 = mini card. */ 2058c2ecf20Sopenharmony_ci ODM_BOARD_SLIM = BIT(1), /* 0 = non-slim card, 1 = slim card */ 2068c2ecf20Sopenharmony_ci ODM_BOARD_BT = BIT(2), /* 0 = without BT card, 1 = with BT */ 2078c2ecf20Sopenharmony_ci ODM_BOARD_EXT_PA = BIT(3), /* 1 = existing 2G ext-PA */ 2088c2ecf20Sopenharmony_ci ODM_BOARD_EXT_LNA = BIT(4), /* 1 = existing 2G ext-LNA */ 2098c2ecf20Sopenharmony_ci ODM_BOARD_EXT_TRSW = BIT(5), /* 1 = existing ext-TRSW */ 2108c2ecf20Sopenharmony_ci ODM_BOARD_EXT_PA_5G = BIT(6), /* 1 = existing 5G ext-PA */ 2118c2ecf20Sopenharmony_ci ODM_BOARD_EXT_LNA_5G = BIT(7), /* 1 = existing 5G ext-LNA */ 2128c2ecf20Sopenharmony_ci}; 2138c2ecf20Sopenharmony_ci 2148c2ecf20Sopenharmony_cienum rf_optype { 2158c2ecf20Sopenharmony_ci RF_OP_BY_SW_3WIRE = 0, 2168c2ecf20Sopenharmony_ci RF_OP_BY_FW, 2178c2ecf20Sopenharmony_ci RF_OP_MAX 2188c2ecf20Sopenharmony_ci}; 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_cienum rf_power_state { 2218c2ecf20Sopenharmony_ci RF_ON, 2228c2ecf20Sopenharmony_ci RF_OFF, 2238c2ecf20Sopenharmony_ci RF_SLEEP, 2248c2ecf20Sopenharmony_ci RF_SHUT_DOWN, 2258c2ecf20Sopenharmony_ci}; 2268c2ecf20Sopenharmony_ci 2278c2ecf20Sopenharmony_cienum power_save_mode { 2288c2ecf20Sopenharmony_ci POWER_SAVE_MODE_ACTIVE, 2298c2ecf20Sopenharmony_ci POWER_SAVE_MODE_SAVE, 2308c2ecf20Sopenharmony_ci}; 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_cienum power_polocy_config { 2338c2ecf20Sopenharmony_ci POWERCFG_MAX_POWER_SAVINGS, 2348c2ecf20Sopenharmony_ci POWERCFG_GLOBAL_POWER_SAVINGS, 2358c2ecf20Sopenharmony_ci POWERCFG_LOCAL_POWER_SAVINGS, 2368c2ecf20Sopenharmony_ci POWERCFG_LENOVO, 2378c2ecf20Sopenharmony_ci}; 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_cienum interface_select_pci { 2408c2ecf20Sopenharmony_ci INTF_SEL1_MINICARD = 0, 2418c2ecf20Sopenharmony_ci INTF_SEL0_PCIE = 1, 2428c2ecf20Sopenharmony_ci INTF_SEL2_RSV = 2, 2438c2ecf20Sopenharmony_ci INTF_SEL3_RSV = 3, 2448c2ecf20Sopenharmony_ci}; 2458c2ecf20Sopenharmony_ci 2468c2ecf20Sopenharmony_cienum rtl_desc_qsel { 2478c2ecf20Sopenharmony_ci QSLT_BK = 0x2, 2488c2ecf20Sopenharmony_ci QSLT_BE = 0x0, 2498c2ecf20Sopenharmony_ci QSLT_VI = 0x5, 2508c2ecf20Sopenharmony_ci QSLT_VO = 0x7, 2518c2ecf20Sopenharmony_ci QSLT_BEACON = 0x10, 2528c2ecf20Sopenharmony_ci QSLT_HIGH = 0x11, 2538c2ecf20Sopenharmony_ci QSLT_MGNT = 0x12, 2548c2ecf20Sopenharmony_ci QSLT_CMD = 0x13, 2558c2ecf20Sopenharmony_ci}; 2568c2ecf20Sopenharmony_ci 2578c2ecf20Sopenharmony_cistruct phy_sts_cck_8821ae_t { 2588c2ecf20Sopenharmony_ci u8 adc_pwdb_X[4]; 2598c2ecf20Sopenharmony_ci u8 sq_rpt; 2608c2ecf20Sopenharmony_ci u8 cck_agc_rpt; 2618c2ecf20Sopenharmony_ci}; 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_cistruct h2c_cmd_8821ae { 2648c2ecf20Sopenharmony_ci u8 element_id; 2658c2ecf20Sopenharmony_ci u32 cmd_len; 2668c2ecf20Sopenharmony_ci u8 *p_cmdbuffer; 2678c2ecf20Sopenharmony_ci}; 2688c2ecf20Sopenharmony_ci 2698c2ecf20Sopenharmony_ci#endif 270