1*f1d2b4d3SLarry Finger /****************************************************************************** 2*f1d2b4d3SLarry Finger * 3*f1d2b4d3SLarry Finger * Copyright(c) 2009-2012 Realtek Corporation. 4*f1d2b4d3SLarry Finger * 5*f1d2b4d3SLarry Finger * This program is free software; you can redistribute it and/or modify it 6*f1d2b4d3SLarry Finger * under the terms of version 2 of the GNU General Public License as 7*f1d2b4d3SLarry Finger * published by the Free Software Foundation. 8*f1d2b4d3SLarry Finger * 9*f1d2b4d3SLarry Finger * This program is distributed in the hope that it will be useful, but WITHOUT 10*f1d2b4d3SLarry Finger * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11*f1d2b4d3SLarry Finger * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12*f1d2b4d3SLarry Finger * more details. 13*f1d2b4d3SLarry Finger * 14*f1d2b4d3SLarry Finger * The full GNU General Public License is included in this distribution in the 15*f1d2b4d3SLarry Finger * file called LICENSE. 16*f1d2b4d3SLarry Finger * 17*f1d2b4d3SLarry Finger * Contact Information: 18*f1d2b4d3SLarry Finger * wlanfae <wlanfae@realtek.com> 19*f1d2b4d3SLarry Finger * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, 20*f1d2b4d3SLarry Finger * Hsinchu 300, Taiwan. 21*f1d2b4d3SLarry Finger * 22*f1d2b4d3SLarry Finger * Larry Finger <Larry.Finger@lwfinger.net> 23*f1d2b4d3SLarry Finger * 24*f1d2b4d3SLarry Finger *****************************************************************************/ 25*f1d2b4d3SLarry Finger 26*f1d2b4d3SLarry Finger #ifndef __RTL8723E_DEF_H__ 27*f1d2b4d3SLarry Finger #define __RTL8723E_DEF_H__ 28*f1d2b4d3SLarry Finger 29*f1d2b4d3SLarry Finger #define HAL_PRIME_CHNL_OFFSET_DONT_CARE 0 30*f1d2b4d3SLarry Finger #define HAL_PRIME_CHNL_OFFSET_LOWER 1 31*f1d2b4d3SLarry Finger #define HAL_PRIME_CHNL_OFFSET_UPPER 2 32*f1d2b4d3SLarry Finger 33*f1d2b4d3SLarry Finger #define RX_MPDU_QUEUE 0 34*f1d2b4d3SLarry Finger #define RX_CMD_QUEUE 1 35*f1d2b4d3SLarry Finger 36*f1d2b4d3SLarry Finger #define C2H_RX_CMD_HDR_LEN 8 37*f1d2b4d3SLarry Finger #define GET_C2H_CMD_CMD_LEN(__prxhdr) \ 38*f1d2b4d3SLarry Finger LE_BITS_TO_4BYTE((__prxhdr), 0, 16) 39*f1d2b4d3SLarry Finger #define GET_C2H_CMD_ELEMENT_ID(__prxhdr) \ 40*f1d2b4d3SLarry Finger LE_BITS_TO_4BYTE((__prxhdr), 16, 8) 41*f1d2b4d3SLarry Finger #define GET_C2H_CMD_CMD_SEQ(__prxhdr) \ 42*f1d2b4d3SLarry Finger LE_BITS_TO_4BYTE((__prxhdr), 24, 7) 43*f1d2b4d3SLarry Finger #define GET_C2H_CMD_CONTINUE(__prxhdr) \ 44*f1d2b4d3SLarry Finger LE_BITS_TO_4BYTE((__prxhdr), 31, 1) 45*f1d2b4d3SLarry Finger #define GET_C2H_CMD_CONTENT(__prxhdr) \ 46*f1d2b4d3SLarry Finger ((u8 *)(__prxhdr) + C2H_RX_CMD_HDR_LEN) 47*f1d2b4d3SLarry Finger 48*f1d2b4d3SLarry Finger #define GET_C2H_CMD_FEEDBACK_ELEMENT_ID(__pcmdfbhdr) \ 49*f1d2b4d3SLarry Finger LE_BITS_TO_4BYTE((__pcmdfbhdr), 0, 8) 50*f1d2b4d3SLarry Finger #define GET_C2H_CMD_FEEDBACK_CCX_LEN(__pcmdfbhdr) \ 51*f1d2b4d3SLarry Finger LE_BITS_TO_4BYTE((__pcmdfbhdr), 8, 8) 52*f1d2b4d3SLarry Finger #define GET_C2H_CMD_FEEDBACK_CCX_CMD_CNT(__pcmdfbhdr) \ 53*f1d2b4d3SLarry Finger LE_BITS_TO_4BYTE((__pcmdfbhdr), 16, 16) 54*f1d2b4d3SLarry Finger #define GET_C2H_CMD_FEEDBACK_CCX_MAC_ID(__pcmdfbhdr) \ 55*f1d2b4d3SLarry Finger LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 0, 5) 56*f1d2b4d3SLarry Finger #define GET_C2H_CMD_FEEDBACK_CCX_VALID(__pcmdfbhdr) \ 57*f1d2b4d3SLarry Finger LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 7, 1) 58*f1d2b4d3SLarry Finger #define GET_C2H_CMD_FEEDBACK_CCX_RETRY_CNT(__pcmdfbhdr) \ 59*f1d2b4d3SLarry Finger LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 8, 5) 60*f1d2b4d3SLarry Finger #define GET_C2H_CMD_FEEDBACK_CCX_TOK(__pcmdfbhdr) \ 61*f1d2b4d3SLarry Finger LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 15, 1) 62*f1d2b4d3SLarry Finger #define GET_C2H_CMD_FEEDBACK_CCX_QSEL(__pcmdfbhdr) \ 63*f1d2b4d3SLarry Finger LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 16, 4) 64*f1d2b4d3SLarry Finger #define GET_C2H_CMD_FEEDBACK_CCX_SEQ(__pcmdfbhdr) \ 65*f1d2b4d3SLarry Finger LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 20, 12) 66*f1d2b4d3SLarry Finger 67*f1d2b4d3SLarry Finger #define CHIP_BONDING_IDENTIFIER(_value) (((_value)>>22)&0x3) 68*f1d2b4d3SLarry Finger #define CHIP_BONDING_92C_1T2R 0x1 69*f1d2b4d3SLarry Finger 70*f1d2b4d3SLarry Finger #define CHIP_8723 BIT(0) 71*f1d2b4d3SLarry Finger #define NORMAL_CHIP BIT(3) 72*f1d2b4d3SLarry Finger #define RF_TYPE_1T1R (~(BIT(4)|BIT(5)|BIT(6))) 73*f1d2b4d3SLarry Finger #define RF_TYPE_1T2R BIT(4) 74*f1d2b4d3SLarry Finger #define RF_TYPE_2T2R BIT(5) 75*f1d2b4d3SLarry Finger #define CHIP_VENDOR_UMC BIT(7) 76*f1d2b4d3SLarry Finger #define B_CUT_VERSION BIT(12) 77*f1d2b4d3SLarry Finger #define C_CUT_VERSION BIT(13) 78*f1d2b4d3SLarry Finger #define D_CUT_VERSION ((BIT(12)|BIT(13))) 79*f1d2b4d3SLarry Finger #define E_CUT_VERSION BIT(14) 80*f1d2b4d3SLarry Finger #define RF_RL_ID (BIT(31)|BIT(30)|BIT(29)|BIT(28)) 81*f1d2b4d3SLarry Finger 82*f1d2b4d3SLarry Finger /* MASK */ 83*f1d2b4d3SLarry Finger #define IC_TYPE_MASK (BIT(0)|BIT(1)|BIT(2)) 84*f1d2b4d3SLarry Finger #define CHIP_TYPE_MASK BIT(3) 85*f1d2b4d3SLarry Finger #define RF_TYPE_MASK (BIT(4)|BIT(5)|BIT(6)) 86*f1d2b4d3SLarry Finger #define MANUFACTUER_MASK BIT(7) 87*f1d2b4d3SLarry Finger #define ROM_VERSION_MASK (BIT(11)|BIT(10)|BIT(9)|BIT(8)) 88*f1d2b4d3SLarry Finger #define CUT_VERSION_MASK (BIT(15)|BIT(14)|BIT(13)|BIT(12)) 89*f1d2b4d3SLarry Finger 90*f1d2b4d3SLarry Finger /* Get element */ 91*f1d2b4d3SLarry Finger #define GET_CVID_IC_TYPE(version) ((version) & IC_TYPE_MASK) 92*f1d2b4d3SLarry Finger #define GET_CVID_CHIP_TYPE(version) ((version) & CHIP_TYPE_MASK) 93*f1d2b4d3SLarry Finger #define GET_CVID_RF_TYPE(version) ((version) & RF_TYPE_MASK) 94*f1d2b4d3SLarry Finger #define GET_CVID_MANUFACTUER(version) ((version) & MANUFACTUER_MASK) 95*f1d2b4d3SLarry Finger #define GET_CVID_ROM_VERSION(version) ((version) & ROM_VERSION_MASK) 96*f1d2b4d3SLarry Finger #define GET_CVID_CUT_VERSION(version) ((version) & CUT_VERSION_MASK) 97*f1d2b4d3SLarry Finger 98*f1d2b4d3SLarry Finger #define IS_81XXC(version) ((GET_CVID_IC_TYPE(version) == 0) ?\ 99*f1d2b4d3SLarry Finger true : false) 100*f1d2b4d3SLarry Finger #define IS_8723_SERIES(version) ((GET_CVID_IC_TYPE(version) == CHIP_8723) ? \ 101*f1d2b4d3SLarry Finger true : false) 102*f1d2b4d3SLarry Finger #define IS_1T1R(version) ((GET_CVID_RF_TYPE(version)) ? false : true) 103*f1d2b4d3SLarry Finger #define IS_1T2R(version) ((GET_CVID_RF_TYPE(version) == RF_TYPE_1T2R)\ 104*f1d2b4d3SLarry Finger ? true : false) 105*f1d2b4d3SLarry Finger #define IS_2T2R(version) ((GET_CVID_RF_TYPE(version) == RF_TYPE_2T2R)\ 106*f1d2b4d3SLarry Finger ? true : false) 107*f1d2b4d3SLarry Finger #define IS_CHIP_VENDOR_UMC(version) ((GET_CVID_MANUFACTUER(version)) ? \ 108*f1d2b4d3SLarry Finger true : false) 109*f1d2b4d3SLarry Finger 110*f1d2b4d3SLarry Finger #define IS_VENDOR_UMC_A_CUT(version) ((IS_CHIP_VENDOR_UMC(version))\ 111*f1d2b4d3SLarry Finger ? ((GET_CVID_CUT_VERSION(version)) ? \ 112*f1d2b4d3SLarry Finger false : true) : false) 113*f1d2b4d3SLarry Finger #define IS_VENDOR_8723_A_CUT(version) ((IS_8723_SERIES(version))\ 114*f1d2b4d3SLarry Finger ? ((GET_CVID_CUT_VERSION(version)) ? \ 115*f1d2b4d3SLarry Finger false : true) : false) 116*f1d2b4d3SLarry Finger #define IS_VENDOR_8723A_B_CUT(version) ((IS_8723_SERIES(version))\ 117*f1d2b4d3SLarry Finger ? ((GET_CVID_CUT_VERSION(version) == \ 118*f1d2b4d3SLarry Finger B_CUT_VERSION) ? true : false) : false) 119*f1d2b4d3SLarry Finger #define IS_81xxC_VENDOR_UMC_B_CUT(version) ((IS_CHIP_VENDOR_UMC(version))\ 120*f1d2b4d3SLarry Finger ? ((GET_CVID_CUT_VERSION(version) == \ 121*f1d2b4d3SLarry Finger B_CUT_VERSION) ? true : false) : false) 122*f1d2b4d3SLarry Finger 123*f1d2b4d3SLarry Finger enum rf_optype { 124*f1d2b4d3SLarry Finger RF_OP_BY_SW_3WIRE = 0, 125*f1d2b4d3SLarry Finger RF_OP_BY_FW, 126*f1d2b4d3SLarry Finger RF_OP_MAX 127*f1d2b4d3SLarry Finger }; 128*f1d2b4d3SLarry Finger 129*f1d2b4d3SLarry Finger enum rf_power_state { 130*f1d2b4d3SLarry Finger RF_ON, 131*f1d2b4d3SLarry Finger RF_OFF, 132*f1d2b4d3SLarry Finger RF_SLEEP, 133*f1d2b4d3SLarry Finger RF_SHUT_DOWN, 134*f1d2b4d3SLarry Finger }; 135*f1d2b4d3SLarry Finger 136*f1d2b4d3SLarry Finger enum power_save_mode { 137*f1d2b4d3SLarry Finger POWER_SAVE_MODE_ACTIVE, 138*f1d2b4d3SLarry Finger POWER_SAVE_MODE_SAVE, 139*f1d2b4d3SLarry Finger }; 140*f1d2b4d3SLarry Finger 141*f1d2b4d3SLarry Finger enum power_policy_config { 142*f1d2b4d3SLarry Finger POWERCFG_MAX_POWER_SAVINGS, 143*f1d2b4d3SLarry Finger POWERCFG_GLOBAL_POWER_SAVINGS, 144*f1d2b4d3SLarry Finger POWERCFG_LOCAL_POWER_SAVINGS, 145*f1d2b4d3SLarry Finger POWERCFG_LENOVO, 146*f1d2b4d3SLarry Finger }; 147*f1d2b4d3SLarry Finger 148*f1d2b4d3SLarry Finger enum interface_select_pci { 149*f1d2b4d3SLarry Finger INTF_SEL1_MINICARD = 0, 150*f1d2b4d3SLarry Finger INTF_SEL0_PCIE = 1, 151*f1d2b4d3SLarry Finger INTF_SEL2_RSV = 2, 152*f1d2b4d3SLarry Finger INTF_SEL3_RSV = 3, 153*f1d2b4d3SLarry Finger }; 154*f1d2b4d3SLarry Finger 155*f1d2b4d3SLarry Finger enum hal_fw_c2h_cmd_id { 156*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_Read_MACREG = 0, 157*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_Read_BBREG = 1, 158*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_Read_RFREG = 2, 159*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_Read_EEPROM = 3, 160*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_Read_EFUSE = 4, 161*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_Read_CAM = 5, 162*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_Get_BasicRate = 6, 163*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_Get_DataRate = 7, 164*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_Survey = 8, 165*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_SurveyDone = 9, 166*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_JoinBss = 10, 167*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_AddSTA = 11, 168*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_DelSTA = 12, 169*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_AtimDone = 13, 170*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_TX_Report = 14, 171*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_CCX_Report = 15, 172*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_DTM_Report = 16, 173*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_TX_Rate_Statistics = 17, 174*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_C2HLBK = 18, 175*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_C2HDBG = 19, 176*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_C2HFEEDBACK = 20, 177*f1d2b4d3SLarry Finger HAL_FW_C2H_CMD_MAX 178*f1d2b4d3SLarry Finger }; 179*f1d2b4d3SLarry Finger 180*f1d2b4d3SLarry Finger enum rtl_desc_qsel { 181*f1d2b4d3SLarry Finger QSLT_BK = 0x2, 182*f1d2b4d3SLarry Finger QSLT_BE = 0x0, 183*f1d2b4d3SLarry Finger QSLT_VI = 0x5, 184*f1d2b4d3SLarry Finger QSLT_VO = 0x7, 185*f1d2b4d3SLarry Finger QSLT_BEACON = 0x10, 186*f1d2b4d3SLarry Finger QSLT_HIGH = 0x11, 187*f1d2b4d3SLarry Finger QSLT_MGNT = 0x12, 188*f1d2b4d3SLarry Finger QSLT_CMD = 0x13, 189*f1d2b4d3SLarry Finger }; 190*f1d2b4d3SLarry Finger 191*f1d2b4d3SLarry Finger enum rtl_desc8723e_rate { 192*f1d2b4d3SLarry Finger DESC92C_RATE1M = 0x00, 193*f1d2b4d3SLarry Finger DESC92C_RATE2M = 0x01, 194*f1d2b4d3SLarry Finger DESC92C_RATE5_5M = 0x02, 195*f1d2b4d3SLarry Finger DESC92C_RATE11M = 0x03, 196*f1d2b4d3SLarry Finger 197*f1d2b4d3SLarry Finger DESC92C_RATE6M = 0x04, 198*f1d2b4d3SLarry Finger DESC92C_RATE9M = 0x05, 199*f1d2b4d3SLarry Finger DESC92C_RATE12M = 0x06, 200*f1d2b4d3SLarry Finger DESC92C_RATE18M = 0x07, 201*f1d2b4d3SLarry Finger DESC92C_RATE24M = 0x08, 202*f1d2b4d3SLarry Finger DESC92C_RATE36M = 0x09, 203*f1d2b4d3SLarry Finger DESC92C_RATE48M = 0x0a, 204*f1d2b4d3SLarry Finger DESC92C_RATE54M = 0x0b, 205*f1d2b4d3SLarry Finger 206*f1d2b4d3SLarry Finger DESC92C_RATEMCS0 = 0x0c, 207*f1d2b4d3SLarry Finger DESC92C_RATEMCS1 = 0x0d, 208*f1d2b4d3SLarry Finger DESC92C_RATEMCS2 = 0x0e, 209*f1d2b4d3SLarry Finger DESC92C_RATEMCS3 = 0x0f, 210*f1d2b4d3SLarry Finger DESC92C_RATEMCS4 = 0x10, 211*f1d2b4d3SLarry Finger DESC92C_RATEMCS5 = 0x11, 212*f1d2b4d3SLarry Finger DESC92C_RATEMCS6 = 0x12, 213*f1d2b4d3SLarry Finger DESC92C_RATEMCS7 = 0x13, 214*f1d2b4d3SLarry Finger DESC92C_RATEMCS8 = 0x14, 215*f1d2b4d3SLarry Finger DESC92C_RATEMCS9 = 0x15, 216*f1d2b4d3SLarry Finger DESC92C_RATEMCS10 = 0x16, 217*f1d2b4d3SLarry Finger DESC92C_RATEMCS11 = 0x17, 218*f1d2b4d3SLarry Finger DESC92C_RATEMCS12 = 0x18, 219*f1d2b4d3SLarry Finger DESC92C_RATEMCS13 = 0x19, 220*f1d2b4d3SLarry Finger DESC92C_RATEMCS14 = 0x1a, 221*f1d2b4d3SLarry Finger DESC92C_RATEMCS15 = 0x1b, 222*f1d2b4d3SLarry Finger DESC92C_RATEMCS15_SG = 0x1c, 223*f1d2b4d3SLarry Finger DESC92C_RATEMCS32 = 0x20, 224*f1d2b4d3SLarry Finger }; 225*f1d2b4d3SLarry Finger 226*f1d2b4d3SLarry Finger struct phy_sts_cck_8723e_t { 227*f1d2b4d3SLarry Finger u8 adc_pwdb_X[4]; 228*f1d2b4d3SLarry Finger u8 sq_rpt; 229*f1d2b4d3SLarry Finger u8 cck_agc_rpt; 230*f1d2b4d3SLarry Finger }; 231*f1d2b4d3SLarry Finger 232*f1d2b4d3SLarry Finger struct h2c_cmd_8723e { 233*f1d2b4d3SLarry Finger u8 element_id; 234*f1d2b4d3SLarry Finger u32 cmd_len; 235*f1d2b4d3SLarry Finger u8 *p_cmdbuffer; 236*f1d2b4d3SLarry Finger }; 237*f1d2b4d3SLarry Finger 238*f1d2b4d3SLarry Finger #endif 239