mirror of
https://github.com/AetherDroid/android_kernel_samsung_on5xelte.git
synced 2025-09-10 09:22:44 -04:00
Fixed MTP to work with TWRP
This commit is contained in:
commit
f6dfaef42e
50820 changed files with 20846062 additions and 0 deletions
13
drivers/net/wireless/rtlwifi/rtl8192ce/Makefile
Normal file
13
drivers/net/wireless/rtlwifi/rtl8192ce/Makefile
Normal file
|
@ -0,0 +1,13 @@
|
|||
rtl8192ce-objs := \
|
||||
dm.o \
|
||||
hw.o \
|
||||
led.o \
|
||||
phy.o \
|
||||
rf.o \
|
||||
sw.o \
|
||||
table.o \
|
||||
trx.o
|
||||
|
||||
obj-$(CONFIG_RTL8192CE) += rtl8192ce.o
|
||||
|
||||
ccflags-y += -D__CHECK_ENDIAN__
|
238
drivers/net/wireless/rtlwifi/rtl8192ce/def.h
Normal file
238
drivers/net/wireless/rtlwifi/rtl8192ce/def.h
Normal file
|
@ -0,0 +1,238 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2009-2012 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
* Contact Information:
|
||||
* wlanfae <wlanfae@realtek.com>
|
||||
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
|
||||
* Hsinchu 300, Taiwan.
|
||||
*
|
||||
* Larry Finger <Larry.Finger@lwfinger.net>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __RTL92C_DEF_H__
|
||||
#define __RTL92C_DEF_H__
|
||||
|
||||
#define HAL_RETRY_LIMIT_INFRA 48
|
||||
#define HAL_RETRY_LIMIT_AP_ADHOC 7
|
||||
|
||||
#define PHY_RSSI_SLID_WIN_MAX 100
|
||||
#define PHY_LINKQUALITY_SLID_WIN_MAX 20
|
||||
#define PHY_BEACON_RSSI_SLID_WIN_MAX 10
|
||||
|
||||
#define RESET_DELAY_8185 20
|
||||
|
||||
#define RT_IBSS_INT_MASKS (IMR_BCNINT | IMR_TBDOK | IMR_TBDER)
|
||||
#define RT_AC_INT_MASKS (IMR_VIDOK | IMR_VODOK | IMR_BEDOK|IMR_BKDOK)
|
||||
|
||||
#define NUM_OF_FIRMWARE_QUEUE 10
|
||||
#define NUM_OF_PAGES_IN_FW 0x100
|
||||
#define NUM_OF_PAGE_IN_FW_QUEUE_BK 0x07
|
||||
#define NUM_OF_PAGE_IN_FW_QUEUE_BE 0x07
|
||||
#define NUM_OF_PAGE_IN_FW_QUEUE_VI 0x07
|
||||
#define NUM_OF_PAGE_IN_FW_QUEUE_VO 0x07
|
||||
#define NUM_OF_PAGE_IN_FW_QUEUE_HCCA 0x0
|
||||
#define NUM_OF_PAGE_IN_FW_QUEUE_CMD 0x0
|
||||
#define NUM_OF_PAGE_IN_FW_QUEUE_MGNT 0x02
|
||||
#define NUM_OF_PAGE_IN_FW_QUEUE_HIGH 0x02
|
||||
#define NUM_OF_PAGE_IN_FW_QUEUE_BCN 0x2
|
||||
#define NUM_OF_PAGE_IN_FW_QUEUE_PUB 0xA1
|
||||
|
||||
#define NUM_OF_PAGE_IN_FW_QUEUE_BK_DTM 0x026
|
||||
#define NUM_OF_PAGE_IN_FW_QUEUE_BE_DTM 0x048
|
||||
#define NUM_OF_PAGE_IN_FW_QUEUE_VI_DTM 0x048
|
||||
#define NUM_OF_PAGE_IN_FW_QUEUE_VO_DTM 0x026
|
||||
#define NUM_OF_PAGE_IN_FW_QUEUE_PUB_DTM 0x00
|
||||
|
||||
#define MAX_LINES_HWCONFIG_TXT 1000
|
||||
#define MAX_BYTES_LINE_HWCONFIG_TXT 256
|
||||
|
||||
#define SW_THREE_WIRE 0
|
||||
#define HW_THREE_WIRE 2
|
||||
|
||||
#define BT_DEMO_BOARD 0
|
||||
#define BT_QA_BOARD 1
|
||||
#define BT_FPGA 2
|
||||
|
||||
#define RX_SMOOTH_FACTOR 20
|
||||
|
||||
#define HAL_PRIME_CHNL_OFFSET_DONT_CARE 0
|
||||
#define HAL_PRIME_CHNL_OFFSET_LOWER 1
|
||||
#define HAL_PRIME_CHNL_OFFSET_UPPER 2
|
||||
|
||||
#define MAX_H2C_QUEUE_NUM 10
|
||||
|
||||
#define RX_MPDU_QUEUE 0
|
||||
#define RX_CMD_QUEUE 1
|
||||
#define RX_MAX_QUEUE 2
|
||||
#define AC2QUEUEID(_AC) (_AC)
|
||||
|
||||
#define C2H_RX_CMD_HDR_LEN 8
|
||||
#define GET_C2H_CMD_CMD_LEN(__prxhdr) \
|
||||
LE_BITS_TO_4BYTE((__prxhdr), 0, 16)
|
||||
#define GET_C2H_CMD_ELEMENT_ID(__prxhdr) \
|
||||
LE_BITS_TO_4BYTE((__prxhdr), 16, 8)
|
||||
#define GET_C2H_CMD_CMD_SEQ(__prxhdr) \
|
||||
LE_BITS_TO_4BYTE((__prxhdr), 24, 7)
|
||||
#define GET_C2H_CMD_CONTINUE(__prxhdr) \
|
||||
LE_BITS_TO_4BYTE((__prxhdr), 31, 1)
|
||||
#define GET_C2H_CMD_CONTENT(__prxhdr) \
|
||||
((u8 *)(__prxhdr) + C2H_RX_CMD_HDR_LEN)
|
||||
|
||||
#define GET_C2H_CMD_FEEDBACK_ELEMENT_ID(__pcmdfbhdr) \
|
||||
LE_BITS_TO_4BYTE((__pcmdfbhdr), 0, 8)
|
||||
#define GET_C2H_CMD_FEEDBACK_CCX_LEN(__pcmdfbhdr) \
|
||||
LE_BITS_TO_4BYTE((__pcmdfbhdr), 8, 8)
|
||||
#define GET_C2H_CMD_FEEDBACK_CCX_CMD_CNT(__pcmdfbhdr) \
|
||||
LE_BITS_TO_4BYTE((__pcmdfbhdr), 16, 16)
|
||||
#define GET_C2H_CMD_FEEDBACK_CCX_MAC_ID(__pcmdfbhdr) \
|
||||
LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 0, 5)
|
||||
#define GET_C2H_CMD_FEEDBACK_CCX_VALID(__pcmdfbhdr) \
|
||||
LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 7, 1)
|
||||
#define GET_C2H_CMD_FEEDBACK_CCX_RETRY_CNT(__pcmdfbhdr) \
|
||||
LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 8, 5)
|
||||
#define GET_C2H_CMD_FEEDBACK_CCX_TOK(__pcmdfbhdr) \
|
||||
LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 15, 1)
|
||||
#define GET_C2H_CMD_FEEDBACK_CCX_QSEL(__pcmdfbhdr) \
|
||||
LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 16, 4)
|
||||
#define GET_C2H_CMD_FEEDBACK_CCX_SEQ(__pcmdfbhdr) \
|
||||
LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 20, 12)
|
||||
#define GET_RX_STATUS_DESC_BUFF_ADDR(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc + 24, 0, 32)
|
||||
|
||||
#define CHIP_VER_B BIT(4)
|
||||
#define CHIP_BONDING_IDENTIFIER(_value) (((_value) >> 22) & 0x3)
|
||||
#define CHIP_BONDING_92C_1T2R 0x1
|
||||
#define RF_TYPE_1T2R BIT(1)
|
||||
#define CHIP_92C_BITMASK BIT(0)
|
||||
#define CHIP_UNKNOWN BIT(7)
|
||||
#define CHIP_92C_1T2R 0x03
|
||||
#define CHIP_92C 0x01
|
||||
#define CHIP_88C 0x00
|
||||
|
||||
enum version_8192c {
|
||||
VERSION_A_CHIP_92C = 0x01,
|
||||
VERSION_A_CHIP_88C = 0x00,
|
||||
VERSION_B_CHIP_92C = 0x11,
|
||||
VERSION_B_CHIP_88C = 0x10,
|
||||
VERSION_TEST_CHIP_88C = 0x00,
|
||||
VERSION_TEST_CHIP_92C = 0x01,
|
||||
VERSION_NORMAL_TSMC_CHIP_88C = 0x10,
|
||||
VERSION_NORMAL_TSMC_CHIP_92C = 0x11,
|
||||
VERSION_NORMAL_TSMC_CHIP_92C_1T2R = 0x13,
|
||||
VERSION_NORMAL_UMC_CHIP_88C_A_CUT = 0x30,
|
||||
VERSION_NORMAL_UMC_CHIP_92C_A_CUT = 0x31,
|
||||
VERSION_NORMAL_UMC_CHIP_92C_1T2R_A_CUT = 0x33,
|
||||
VERSION_NORMA_UMC_CHIP_8723_1T1R_A_CUT = 0x34,
|
||||
VERSION_NORMA_UMC_CHIP_8723_1T1R_B_CUT = 0x3c,
|
||||
VERSION_NORMAL_UMC_CHIP_88C_B_CUT = 0x70,
|
||||
VERSION_NORMAL_UMC_CHIP_92C_B_CUT = 0x71,
|
||||
VERSION_NORMAL_UMC_CHIP_92C_1T2R_B_CUT = 0x73,
|
||||
VERSION_UNKNOWN = 0x88,
|
||||
};
|
||||
|
||||
enum rtl819x_loopback_e {
|
||||
RTL819X_NO_LOOPBACK = 0,
|
||||
RTL819X_MAC_LOOPBACK = 1,
|
||||
RTL819X_DMA_LOOPBACK = 2,
|
||||
RTL819X_CCK_LOOPBACK = 3,
|
||||
};
|
||||
|
||||
enum rf_optype {
|
||||
RF_OP_BY_SW_3WIRE = 0,
|
||||
RF_OP_BY_FW,
|
||||
RF_OP_MAX
|
||||
};
|
||||
|
||||
enum rf_power_state {
|
||||
RF_ON,
|
||||
RF_OFF,
|
||||
RF_SLEEP,
|
||||
RF_SHUT_DOWN,
|
||||
};
|
||||
|
||||
enum power_save_mode {
|
||||
POWER_SAVE_MODE_ACTIVE,
|
||||
POWER_SAVE_MODE_SAVE,
|
||||
};
|
||||
|
||||
enum power_polocy_config {
|
||||
POWERCFG_MAX_POWER_SAVINGS,
|
||||
POWERCFG_GLOBAL_POWER_SAVINGS,
|
||||
POWERCFG_LOCAL_POWER_SAVINGS,
|
||||
POWERCFG_LENOVO,
|
||||
};
|
||||
|
||||
enum interface_select_pci {
|
||||
INTF_SEL1_MINICARD = 0,
|
||||
INTF_SEL0_PCIE = 1,
|
||||
INTF_SEL2_RSV = 2,
|
||||
INTF_SEL3_RSV = 3,
|
||||
};
|
||||
|
||||
enum hal_fw_c2h_cmd_id {
|
||||
HAL_FW_C2H_CMD_Read_MACREG = 0,
|
||||
HAL_FW_C2H_CMD_Read_BBREG = 1,
|
||||
HAL_FW_C2H_CMD_Read_RFREG = 2,
|
||||
HAL_FW_C2H_CMD_Read_EEPROM = 3,
|
||||
HAL_FW_C2H_CMD_Read_EFUSE = 4,
|
||||
HAL_FW_C2H_CMD_Read_CAM = 5,
|
||||
HAL_FW_C2H_CMD_Get_BasicRate = 6,
|
||||
HAL_FW_C2H_CMD_Get_DataRate = 7,
|
||||
HAL_FW_C2H_CMD_Survey = 8,
|
||||
HAL_FW_C2H_CMD_SurveyDone = 9,
|
||||
HAL_FW_C2H_CMD_JoinBss = 10,
|
||||
HAL_FW_C2H_CMD_AddSTA = 11,
|
||||
HAL_FW_C2H_CMD_DelSTA = 12,
|
||||
HAL_FW_C2H_CMD_AtimDone = 13,
|
||||
HAL_FW_C2H_CMD_TX_Report = 14,
|
||||
HAL_FW_C2H_CMD_CCX_Report = 15,
|
||||
HAL_FW_C2H_CMD_DTM_Report = 16,
|
||||
HAL_FW_C2H_CMD_TX_Rate_Statistics = 17,
|
||||
HAL_FW_C2H_CMD_C2HLBK = 18,
|
||||
HAL_FW_C2H_CMD_C2HDBG = 19,
|
||||
HAL_FW_C2H_CMD_C2HFEEDBACK = 20,
|
||||
HAL_FW_C2H_CMD_MAX
|
||||
};
|
||||
|
||||
enum rtl_desc_qsel {
|
||||
QSLT_BK = 0x2,
|
||||
QSLT_BE = 0x0,
|
||||
QSLT_VI = 0x5,
|
||||
QSLT_VO = 0x7,
|
||||
QSLT_BEACON = 0x10,
|
||||
QSLT_HIGH = 0x11,
|
||||
QSLT_MGNT = 0x12,
|
||||
QSLT_CMD = 0x13,
|
||||
};
|
||||
|
||||
struct phy_sts_cck_8192s_t {
|
||||
u8 adc_pwdb_X[4];
|
||||
u8 sq_rpt;
|
||||
u8 cck_agc_rpt;
|
||||
};
|
||||
|
||||
struct h2c_cmd_8192c {
|
||||
u8 element_id;
|
||||
u32 cmd_len;
|
||||
u8 *p_cmdbuffer;
|
||||
};
|
||||
|
||||
#endif
|
109
drivers/net/wireless/rtlwifi/rtl8192ce/dm.c
Normal file
109
drivers/net/wireless/rtlwifi/rtl8192ce/dm.c
Normal file
|
@ -0,0 +1,109 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2009-2012 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
* Contact Information:
|
||||
* wlanfae <wlanfae@realtek.com>
|
||||
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
|
||||
* Hsinchu 300, Taiwan.
|
||||
*
|
||||
* Larry Finger <Larry.Finger@lwfinger.net>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../wifi.h"
|
||||
#include "../base.h"
|
||||
#include "../pci.h"
|
||||
#include "reg.h"
|
||||
#include "def.h"
|
||||
#include "phy.h"
|
||||
#include "dm.h"
|
||||
#include "../rtl8192c/fw_common.h"
|
||||
|
||||
void rtl92ce_dm_dynamic_txpower(struct ieee80211_hw *hw)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_phy *rtlphy = &(rtlpriv->phy);
|
||||
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
|
||||
long undec_sm_pwdb;
|
||||
|
||||
if (!rtlpriv->dm.dynamic_txpower_enable)
|
||||
return;
|
||||
|
||||
if (rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) {
|
||||
rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((mac->link_state < MAC80211_LINKED) &&
|
||||
(rtlpriv->dm.entry_min_undec_sm_pwdb == 0)) {
|
||||
RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE,
|
||||
"Not connected to any\n");
|
||||
|
||||
rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL;
|
||||
|
||||
rtlpriv->dm.last_dtp_lvl = TXHIGHPWRLEVEL_NORMAL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mac->link_state >= MAC80211_LINKED) {
|
||||
if (mac->opmode == NL80211_IFTYPE_ADHOC) {
|
||||
undec_sm_pwdb = rtlpriv->dm.entry_min_undec_sm_pwdb;
|
||||
RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
|
||||
"AP Client PWDB = 0x%lx\n",
|
||||
undec_sm_pwdb);
|
||||
} else {
|
||||
undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb;
|
||||
RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
|
||||
"STA Default Port PWDB = 0x%lx\n",
|
||||
undec_sm_pwdb);
|
||||
}
|
||||
} else {
|
||||
undec_sm_pwdb = rtlpriv->dm.entry_min_undec_sm_pwdb;
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
|
||||
"AP Ext Port PWDB = 0x%lx\n",
|
||||
undec_sm_pwdb);
|
||||
}
|
||||
|
||||
if (undec_sm_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL2) {
|
||||
rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1;
|
||||
RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
|
||||
"TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x0)\n");
|
||||
} else if ((undec_sm_pwdb < (TX_POWER_NEAR_FIELD_THRESH_LVL2 - 3)) &&
|
||||
(undec_sm_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL1)) {
|
||||
|
||||
rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1;
|
||||
RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
|
||||
"TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x10)\n");
|
||||
} else if (undec_sm_pwdb < (TX_POWER_NEAR_FIELD_THRESH_LVL1 - 5)) {
|
||||
rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL;
|
||||
RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
|
||||
"TXHIGHPWRLEVEL_NORMAL\n");
|
||||
}
|
||||
|
||||
if ((rtlpriv->dm.dynamic_txhighpower_lvl != rtlpriv->dm.last_dtp_lvl)) {
|
||||
RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
|
||||
"PHY_SetTxPowerLevel8192S() Channel = %d\n",
|
||||
rtlphy->current_channel);
|
||||
rtl92c_phy_set_txpower_level(hw, rtlphy->current_channel);
|
||||
}
|
||||
|
||||
rtlpriv->dm.last_dtp_lvl = rtlpriv->dm.dynamic_txhighpower_lvl;
|
||||
}
|
99
drivers/net/wireless/rtlwifi/rtl8192ce/dm.h
Normal file
99
drivers/net/wireless/rtlwifi/rtl8192ce/dm.h
Normal file
|
@ -0,0 +1,99 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2009-2012 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
* Contact Information:
|
||||
* wlanfae <wlanfae@realtek.com>
|
||||
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
|
||||
* Hsinchu 300, Taiwan.
|
||||
*
|
||||
* Larry Finger <Larry.Finger@lwfinger.net>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __RTL92C_DM_H__
|
||||
#define __RTL92C_DM_H__
|
||||
|
||||
#define HAL_DM_DIG_DISABLE BIT(0)
|
||||
#define HAL_DM_HIPWR_DISABLE BIT(1)
|
||||
|
||||
#define OFDM_TABLE_LENGTH 37
|
||||
#define CCK_TABLE_LENGTH 33
|
||||
|
||||
#define OFDM_TABLE_SIZE 37
|
||||
#define CCK_TABLE_SIZE 33
|
||||
|
||||
#define BW_AUTO_SWITCH_HIGH_LOW 25
|
||||
#define BW_AUTO_SWITCH_LOW_HIGH 30
|
||||
|
||||
#define DM_DIG_THRESH_HIGH 40
|
||||
#define DM_DIG_THRESH_LOW 35
|
||||
|
||||
#define DM_FALSEALARM_THRESH_LOW 400
|
||||
#define DM_FALSEALARM_THRESH_HIGH 1000
|
||||
|
||||
#define DM_DIG_MAX 0x3e
|
||||
#define DM_DIG_MIN 0x1e
|
||||
|
||||
#define DM_DIG_FA_UPPER 0x32
|
||||
#define DM_DIG_FA_LOWER 0x20
|
||||
#define DM_DIG_FA_TH0 0x20
|
||||
#define DM_DIG_FA_TH1 0x100
|
||||
#define DM_DIG_FA_TH2 0x200
|
||||
|
||||
#define DM_DIG_BACKOFF_MAX 12
|
||||
#define DM_DIG_BACKOFF_MIN -4
|
||||
#define DM_DIG_BACKOFF_DEFAULT 10
|
||||
|
||||
#define RXPATHSELECTION_SS_TH_lOW 30
|
||||
#define RXPATHSELECTION_DIFF_TH 18
|
||||
|
||||
#define DM_RATR_STA_INIT 0
|
||||
#define DM_RATR_STA_HIGH 1
|
||||
#define DM_RATR_STA_MIDDLE 2
|
||||
#define DM_RATR_STA_LOW 3
|
||||
|
||||
#define CTS2SELF_THVAL 30
|
||||
#define REGC38_TH 20
|
||||
|
||||
#define WAIOTTHVal 25
|
||||
|
||||
#define TXHIGHPWRLEVEL_NORMAL 0
|
||||
#define TXHIGHPWRLEVEL_LEVEL1 1
|
||||
#define TXHIGHPWRLEVEL_LEVEL2 2
|
||||
#define TXHIGHPWRLEVEL_BT1 3
|
||||
#define TXHIGHPWRLEVEL_BT2 4
|
||||
|
||||
#define DM_TYPE_BYFW 0
|
||||
#define DM_TYPE_BYDRIVER 1
|
||||
|
||||
#define TX_POWER_NEAR_FIELD_THRESH_LVL2 74
|
||||
#define TX_POWER_NEAR_FIELD_THRESH_LVL1 67
|
||||
|
||||
void rtl92c_dm_init(struct ieee80211_hw *hw);
|
||||
void rtl92c_dm_watchdog(struct ieee80211_hw *hw);
|
||||
void rtl92c_dm_write_dig(struct ieee80211_hw *hw);
|
||||
void rtl92c_dm_init_edca_turbo(struct ieee80211_hw *hw);
|
||||
void rtl92c_dm_check_txpower_tracking(struct ieee80211_hw *hw);
|
||||
void rtl92c_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw);
|
||||
void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal);
|
||||
void rtl92c_dm_bt_coexist(struct ieee80211_hw *hw);
|
||||
void rtl92ce_dm_dynamic_txpower(struct ieee80211_hw *hw);
|
||||
|
||||
#endif
|
2429
drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
Normal file
2429
drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
Normal file
File diff suppressed because it is too large
Load diff
80
drivers/net/wireless/rtlwifi/rtl8192ce/hw.h
Normal file
80
drivers/net/wireless/rtlwifi/rtl8192ce/hw.h
Normal file
|
@ -0,0 +1,80 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2009-2012 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
* Contact Information:
|
||||
* wlanfae <wlanfae@realtek.com>
|
||||
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
|
||||
* Hsinchu 300, Taiwan.
|
||||
*
|
||||
* Larry Finger <Larry.Finger@lwfinger.net>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __RTL92CE_HW_H__
|
||||
#define __RTL92CE_HW_H__
|
||||
|
||||
static inline u8 rtl92c_get_chnl_group(u8 chnl)
|
||||
{
|
||||
u8 group;
|
||||
|
||||
if (chnl < 3)
|
||||
group = 0;
|
||||
else if (chnl < 9)
|
||||
group = 1;
|
||||
else
|
||||
group = 2;
|
||||
return group;
|
||||
}
|
||||
|
||||
void rtl92ce_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val);
|
||||
void rtl92ce_read_eeprom_info(struct ieee80211_hw *hw);
|
||||
void rtl92ce_interrupt_recognized(struct ieee80211_hw *hw,
|
||||
u32 *p_inta, u32 *p_intb);
|
||||
int rtl92ce_hw_init(struct ieee80211_hw *hw);
|
||||
void rtl92ce_card_disable(struct ieee80211_hw *hw);
|
||||
void rtl92ce_enable_interrupt(struct ieee80211_hw *hw);
|
||||
void rtl92ce_disable_interrupt(struct ieee80211_hw *hw);
|
||||
int rtl92ce_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type);
|
||||
void rtl92ce_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid);
|
||||
void rtl92ce_set_qos(struct ieee80211_hw *hw, int aci);
|
||||
void rtl92ce_set_beacon_related_registers(struct ieee80211_hw *hw);
|
||||
void rtl92ce_set_beacon_interval(struct ieee80211_hw *hw);
|
||||
void rtl92ce_update_interrupt_mask(struct ieee80211_hw *hw,
|
||||
u32 add_msr, u32 rm_msr);
|
||||
void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val);
|
||||
void rtl92ce_update_hal_rate_tbl(struct ieee80211_hw *hw,
|
||||
struct ieee80211_sta *sta, u8 rssi_level);
|
||||
void rtl92ce_update_hal_rate_tbl(struct ieee80211_hw *hw,
|
||||
struct ieee80211_sta *sta, u8 rssi_level);
|
||||
void rtl92ce_update_channel_access_setting(struct ieee80211_hw *hw);
|
||||
bool rtl92ce_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid);
|
||||
void rtl92ce_enable_hw_security_config(struct ieee80211_hw *hw);
|
||||
void rtl92ce_set_key(struct ieee80211_hw *hw, u32 key_index,
|
||||
u8 *p_macaddr, bool is_group, u8 enc_algo,
|
||||
bool is_wepkey, bool clear_all);
|
||||
|
||||
void rtl8192ce_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw,
|
||||
bool autoload_fail, u8 *hwinfo);
|
||||
void rtl8192ce_bt_reg_init(struct ieee80211_hw *hw);
|
||||
void rtl8192ce_bt_hw_init(struct ieee80211_hw *hw);
|
||||
void rtl92ce_suspend(struct ieee80211_hw *hw);
|
||||
void rtl92ce_resume(struct ieee80211_hw *hw);
|
||||
|
||||
#endif
|
151
drivers/net/wireless/rtlwifi/rtl8192ce/led.c
Normal file
151
drivers/net/wireless/rtlwifi/rtl8192ce/led.c
Normal file
|
@ -0,0 +1,151 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2009-2012 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
* Contact Information:
|
||||
* wlanfae <wlanfae@realtek.com>
|
||||
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
|
||||
* Hsinchu 300, Taiwan.
|
||||
*
|
||||
* Larry Finger <Larry.Finger@lwfinger.net>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../wifi.h"
|
||||
#include "../pci.h"
|
||||
#include "reg.h"
|
||||
#include "led.h"
|
||||
|
||||
static void _rtl92ce_init_led(struct ieee80211_hw *hw,
|
||||
struct rtl_led *pled, enum rtl_led_pin ledpin)
|
||||
{
|
||||
pled->hw = hw;
|
||||
pled->ledpin = ledpin;
|
||||
pled->ledon = false;
|
||||
}
|
||||
|
||||
void rtl92ce_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
|
||||
{
|
||||
u8 ledcfg;
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
|
||||
REG_LEDCFG2, pled->ledpin);
|
||||
|
||||
ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2);
|
||||
|
||||
switch (pled->ledpin) {
|
||||
case LED_PIN_GPIO0:
|
||||
break;
|
||||
case LED_PIN_LED0:
|
||||
rtl_write_byte(rtlpriv,
|
||||
REG_LEDCFG2, (ledcfg & 0xf0) | BIT(5) | BIT(6));
|
||||
break;
|
||||
case LED_PIN_LED1:
|
||||
rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg & 0x0f) | BIT(5));
|
||||
break;
|
||||
default:
|
||||
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
|
||||
"switch case not processed\n");
|
||||
break;
|
||||
}
|
||||
pled->ledon = true;
|
||||
}
|
||||
|
||||
void rtl92ce_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
|
||||
u8 ledcfg;
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
|
||||
REG_LEDCFG2, pled->ledpin);
|
||||
|
||||
ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2);
|
||||
|
||||
switch (pled->ledpin) {
|
||||
case LED_PIN_GPIO0:
|
||||
break;
|
||||
case LED_PIN_LED0:
|
||||
ledcfg &= 0xf0;
|
||||
if (pcipriv->ledctl.led_opendrain)
|
||||
rtl_write_byte(rtlpriv, REG_LEDCFG2,
|
||||
(ledcfg | BIT(1) | BIT(5) | BIT(6)));
|
||||
else
|
||||
rtl_write_byte(rtlpriv, REG_LEDCFG2,
|
||||
(ledcfg | BIT(3) | BIT(5) | BIT(6)));
|
||||
break;
|
||||
case LED_PIN_LED1:
|
||||
ledcfg &= 0x0f;
|
||||
rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg | BIT(3)));
|
||||
break;
|
||||
default:
|
||||
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
|
||||
"switch case not processed\n");
|
||||
break;
|
||||
}
|
||||
pled->ledon = false;
|
||||
}
|
||||
|
||||
void rtl92ce_init_sw_leds(struct ieee80211_hw *hw)
|
||||
{
|
||||
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
|
||||
_rtl92ce_init_led(hw, &(pcipriv->ledctl.sw_led0), LED_PIN_LED0);
|
||||
_rtl92ce_init_led(hw, &(pcipriv->ledctl.sw_led1), LED_PIN_LED1);
|
||||
}
|
||||
|
||||
static void _rtl92ce_sw_led_control(struct ieee80211_hw *hw,
|
||||
enum led_ctl_mode ledaction)
|
||||
{
|
||||
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
|
||||
struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0);
|
||||
switch (ledaction) {
|
||||
case LED_CTL_POWER_ON:
|
||||
case LED_CTL_LINK:
|
||||
case LED_CTL_NO_LINK:
|
||||
rtl92ce_sw_led_on(hw, pLed0);
|
||||
break;
|
||||
case LED_CTL_POWER_OFF:
|
||||
rtl92ce_sw_led_off(hw, pLed0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void rtl92ce_led_control(struct ieee80211_hw *hw,
|
||||
enum led_ctl_mode ledaction)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
|
||||
|
||||
if ((ppsc->rfoff_reason > RF_CHANGE_BY_PS) &&
|
||||
(ledaction == LED_CTL_TX ||
|
||||
ledaction == LED_CTL_RX ||
|
||||
ledaction == LED_CTL_SITE_SURVEY ||
|
||||
ledaction == LED_CTL_LINK ||
|
||||
ledaction == LED_CTL_NO_LINK ||
|
||||
ledaction == LED_CTL_START_TO_LINK ||
|
||||
ledaction == LED_CTL_POWER_ON)) {
|
||||
return;
|
||||
}
|
||||
RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "ledaction %d\n",
|
||||
ledaction);
|
||||
_rtl92ce_sw_led_control(hw, ledaction);
|
||||
}
|
38
drivers/net/wireless/rtlwifi/rtl8192ce/led.h
Normal file
38
drivers/net/wireless/rtlwifi/rtl8192ce/led.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2009-2012 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
* Contact Information:
|
||||
* wlanfae <wlanfae@realtek.com>
|
||||
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
|
||||
* Hsinchu 300, Taiwan.
|
||||
*
|
||||
* Larry Finger <Larry.Finger@lwfinger.net>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __RTL92CE_LED_H__
|
||||
#define __RTL92CE_LED_H__
|
||||
|
||||
void rtl92ce_init_sw_leds(struct ieee80211_hw *hw);
|
||||
void rtl92ce_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled);
|
||||
void rtl92ce_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled);
|
||||
void rtl92ce_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction);
|
||||
|
||||
#endif
|
576
drivers/net/wireless/rtlwifi/rtl8192ce/phy.c
Normal file
576
drivers/net/wireless/rtlwifi/rtl8192ce/phy.c
Normal file
|
@ -0,0 +1,576 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2009-2012 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
* Contact Information:
|
||||
* wlanfae <wlanfae@realtek.com>
|
||||
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
|
||||
* Hsinchu 300, Taiwan.
|
||||
*
|
||||
* Larry Finger <Larry.Finger@lwfinger.net>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../wifi.h"
|
||||
#include "../pci.h"
|
||||
#include "../ps.h"
|
||||
#include "../core.h"
|
||||
#include "reg.h"
|
||||
#include "def.h"
|
||||
#include "hw.h"
|
||||
#include "phy.h"
|
||||
#include "../rtl8192c/phy_common.h"
|
||||
#include "rf.h"
|
||||
#include "dm.h"
|
||||
#include "../rtl8192c/dm_common.h"
|
||||
#include "../rtl8192c/fw_common.h"
|
||||
#include "table.h"
|
||||
|
||||
static bool _rtl92c_phy_config_mac_with_headerfile(struct ieee80211_hw *hw);
|
||||
|
||||
u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw,
|
||||
enum radio_path rfpath, u32 regaddr, u32 bitmask)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
u32 original_value, readback_value, bitshift;
|
||||
struct rtl_phy *rtlphy = &(rtlpriv->phy);
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), rfpath(%#x), bitmask(%#x)\n",
|
||||
regaddr, rfpath, bitmask);
|
||||
|
||||
spin_lock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
if (rtlphy->rf_mode != RF_OP_BY_FW) {
|
||||
original_value = _rtl92c_phy_rf_serial_read(hw,
|
||||
rfpath, regaddr);
|
||||
} else {
|
||||
original_value = _rtl92c_phy_fw_rf_serial_read(hw,
|
||||
rfpath, regaddr);
|
||||
}
|
||||
|
||||
bitshift = _rtl92c_phy_calculate_bit_shift(bitmask);
|
||||
readback_value = (original_value & bitmask) >> bitshift;
|
||||
|
||||
spin_unlock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n",
|
||||
regaddr, rfpath, bitmask, original_value);
|
||||
|
||||
return readback_value;
|
||||
}
|
||||
|
||||
bool rtl92c_phy_mac_config(struct ieee80211_hw *hw)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
|
||||
bool is92c = IS_92C_SERIAL(rtlhal->version);
|
||||
bool rtstatus = _rtl92c_phy_config_mac_with_headerfile(hw);
|
||||
|
||||
if (is92c)
|
||||
rtl_write_byte(rtlpriv, 0x14, 0x71);
|
||||
else
|
||||
rtl_write_byte(rtlpriv, 0x04CA, 0x0A);
|
||||
return rtstatus;
|
||||
}
|
||||
|
||||
bool rtl92c_phy_bb_config(struct ieee80211_hw *hw)
|
||||
{
|
||||
bool rtstatus = true;
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
u16 regval;
|
||||
u32 regvaldw;
|
||||
u8 reg_hwparafile = 1;
|
||||
|
||||
_rtl92c_phy_init_bb_rf_register_definition(hw);
|
||||
regval = rtl_read_word(rtlpriv, REG_SYS_FUNC_EN);
|
||||
rtl_write_word(rtlpriv, REG_SYS_FUNC_EN,
|
||||
regval | BIT(13) | BIT(0) | BIT(1));
|
||||
rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL, 0x83);
|
||||
rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL + 1, 0xdb);
|
||||
rtl_write_byte(rtlpriv, REG_RF_CTRL, RF_EN | RF_RSTB | RF_SDMRSTB);
|
||||
rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN,
|
||||
FEN_PPLL | FEN_PCIEA | FEN_DIO_PCIE |
|
||||
FEN_BB_GLB_RSTn | FEN_BBRSTB);
|
||||
rtl_write_byte(rtlpriv, REG_AFE_XTAL_CTRL + 1, 0x80);
|
||||
regvaldw = rtl_read_dword(rtlpriv, REG_LEDCFG0);
|
||||
rtl_write_dword(rtlpriv, REG_LEDCFG0, regvaldw | BIT(23));
|
||||
if (reg_hwparafile == 1)
|
||||
rtstatus = _rtl92c_phy_bb8192c_config_parafile(hw);
|
||||
return rtstatus;
|
||||
}
|
||||
|
||||
void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw,
|
||||
enum radio_path rfpath,
|
||||
u32 regaddr, u32 bitmask, u32 data)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_phy *rtlphy = &(rtlpriv->phy);
|
||||
u32 original_value, bitshift;
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
|
||||
regaddr, bitmask, data, rfpath);
|
||||
|
||||
spin_lock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
if (rtlphy->rf_mode != RF_OP_BY_FW) {
|
||||
if (bitmask != RFREG_OFFSET_MASK) {
|
||||
original_value = _rtl92c_phy_rf_serial_read(hw,
|
||||
rfpath,
|
||||
regaddr);
|
||||
bitshift = _rtl92c_phy_calculate_bit_shift(bitmask);
|
||||
data =
|
||||
((original_value & (~bitmask)) |
|
||||
(data << bitshift));
|
||||
}
|
||||
|
||||
_rtl92c_phy_rf_serial_write(hw, rfpath, regaddr, data);
|
||||
} else {
|
||||
if (bitmask != RFREG_OFFSET_MASK) {
|
||||
original_value = _rtl92c_phy_fw_rf_serial_read(hw,
|
||||
rfpath,
|
||||
regaddr);
|
||||
bitshift = _rtl92c_phy_calculate_bit_shift(bitmask);
|
||||
data =
|
||||
((original_value & (~bitmask)) |
|
||||
(data << bitshift));
|
||||
}
|
||||
_rtl92c_phy_fw_rf_serial_write(hw, rfpath, regaddr, data);
|
||||
}
|
||||
|
||||
spin_unlock(&rtlpriv->locks.rf_lock);
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
|
||||
regaddr, bitmask, data, rfpath);
|
||||
}
|
||||
|
||||
static bool _rtl92c_phy_config_mac_with_headerfile(struct ieee80211_hw *hw)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
u32 i;
|
||||
u32 arraylength;
|
||||
u32 *ptrarray;
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Read Rtl819XMACPHY_Array\n");
|
||||
arraylength = MAC_2T_ARRAYLENGTH;
|
||||
ptrarray = RTL8192CEMAC_2T_ARRAY;
|
||||
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Img:RTL8192CEMAC_2T_ARRAY\n");
|
||||
for (i = 0; i < arraylength; i = i + 2)
|
||||
rtl_write_byte(rtlpriv, ptrarray[i], (u8) ptrarray[i + 1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool _rtl92ce_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
|
||||
u8 configtype)
|
||||
{
|
||||
int i;
|
||||
u32 *phy_regarray_table;
|
||||
u32 *agctab_array_table;
|
||||
u16 phy_reg_arraylen, agctab_arraylen;
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
|
||||
|
||||
if (IS_92C_SERIAL(rtlhal->version)) {
|
||||
agctab_arraylen = AGCTAB_2TARRAYLENGTH;
|
||||
agctab_array_table = RTL8192CEAGCTAB_2TARRAY;
|
||||
phy_reg_arraylen = PHY_REG_2TARRAY_LENGTH;
|
||||
phy_regarray_table = RTL8192CEPHY_REG_2TARRAY;
|
||||
} else {
|
||||
agctab_arraylen = AGCTAB_1TARRAYLENGTH;
|
||||
agctab_array_table = RTL8192CEAGCTAB_1TARRAY;
|
||||
phy_reg_arraylen = PHY_REG_1TARRAY_LENGTH;
|
||||
phy_regarray_table = RTL8192CEPHY_REG_1TARRAY;
|
||||
}
|
||||
if (configtype == BASEBAND_CONFIG_PHY_REG) {
|
||||
for (i = 0; i < phy_reg_arraylen; i = i + 2) {
|
||||
rtl_addr_delay(phy_regarray_table[i]);
|
||||
rtl_set_bbreg(hw, phy_regarray_table[i], MASKDWORD,
|
||||
phy_regarray_table[i + 1]);
|
||||
udelay(1);
|
||||
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
|
||||
"The phy_regarray_table[0] is %x Rtl819XPHY_REGArray[1] is %x\n",
|
||||
phy_regarray_table[i],
|
||||
phy_regarray_table[i + 1]);
|
||||
}
|
||||
} else if (configtype == BASEBAND_CONFIG_AGC_TAB) {
|
||||
for (i = 0; i < agctab_arraylen; i = i + 2) {
|
||||
rtl_set_bbreg(hw, agctab_array_table[i], MASKDWORD,
|
||||
agctab_array_table[i + 1]);
|
||||
udelay(1);
|
||||
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
|
||||
"The agctab_array_table[0] is %x Rtl819XPHY_REGArray[1] is %x\n",
|
||||
agctab_array_table[i],
|
||||
agctab_array_table[i + 1]);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool _rtl92ce_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
|
||||
u8 configtype)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
int i;
|
||||
u32 *phy_regarray_table_pg;
|
||||
u16 phy_regarray_pg_len;
|
||||
|
||||
phy_regarray_pg_len = PHY_REG_ARRAY_PGLENGTH;
|
||||
phy_regarray_table_pg = RTL8192CEPHY_REG_ARRAY_PG;
|
||||
|
||||
if (configtype == BASEBAND_CONFIG_PHY_REG) {
|
||||
for (i = 0; i < phy_regarray_pg_len; i = i + 3) {
|
||||
rtl_addr_delay(phy_regarray_table_pg[i]);
|
||||
|
||||
_rtl92c_store_pwrIndex_diffrate_offset(hw,
|
||||
phy_regarray_table_pg[i],
|
||||
phy_regarray_table_pg[i + 1],
|
||||
phy_regarray_table_pg[i + 2]);
|
||||
}
|
||||
} else {
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
|
||||
"configtype != BaseBand_Config_PHY_REG\n");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
|
||||
enum radio_path rfpath)
|
||||
{
|
||||
|
||||
int i;
|
||||
u32 *radioa_array_table;
|
||||
u32 *radiob_array_table;
|
||||
u16 radioa_arraylen, radiob_arraylen;
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
|
||||
|
||||
if (IS_92C_SERIAL(rtlhal->version)) {
|
||||
radioa_arraylen = RADIOA_2TARRAYLENGTH;
|
||||
radioa_array_table = RTL8192CERADIOA_2TARRAY;
|
||||
radiob_arraylen = RADIOB_2TARRAYLENGTH;
|
||||
radiob_array_table = RTL8192CE_RADIOB_2TARRAY;
|
||||
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
|
||||
"Radio_A:RTL8192CERADIOA_2TARRAY\n");
|
||||
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
|
||||
"Radio_B:RTL8192CE_RADIOB_2TARRAY\n");
|
||||
} else {
|
||||
radioa_arraylen = RADIOA_1TARRAYLENGTH;
|
||||
radioa_array_table = RTL8192CE_RADIOA_1TARRAY;
|
||||
radiob_arraylen = RADIOB_1TARRAYLENGTH;
|
||||
radiob_array_table = RTL8192CE_RADIOB_1TARRAY;
|
||||
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
|
||||
"Radio_A:RTL8192CE_RADIOA_1TARRAY\n");
|
||||
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
|
||||
"Radio_B:RTL8192CE_RADIOB_1TARRAY\n");
|
||||
}
|
||||
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Radio No %x\n", rfpath);
|
||||
switch (rfpath) {
|
||||
case RF90_PATH_A:
|
||||
for (i = 0; i < radioa_arraylen; i = i + 2) {
|
||||
rtl_rfreg_delay(hw, rfpath, radioa_array_table[i],
|
||||
RFREG_OFFSET_MASK,
|
||||
radioa_array_table[i + 1]);
|
||||
}
|
||||
break;
|
||||
case RF90_PATH_B:
|
||||
for (i = 0; i < radiob_arraylen; i = i + 2) {
|
||||
rtl_rfreg_delay(hw, rfpath, radiob_array_table[i],
|
||||
RFREG_OFFSET_MASK,
|
||||
radiob_array_table[i + 1]);
|
||||
}
|
||||
break;
|
||||
case RF90_PATH_C:
|
||||
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
|
||||
"switch case not processed\n");
|
||||
break;
|
||||
case RF90_PATH_D:
|
||||
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
|
||||
"switch case not processed\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
|
||||
struct rtl_phy *rtlphy = &(rtlpriv->phy);
|
||||
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
|
||||
u8 reg_bw_opmode;
|
||||
u8 reg_prsr_rsc;
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "Switch to %s bandwidth\n",
|
||||
rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ?
|
||||
"20MHz" : "40MHz");
|
||||
|
||||
if (is_hal_stop(rtlhal)) {
|
||||
rtlphy->set_bwmode_inprogress = false;
|
||||
return;
|
||||
}
|
||||
|
||||
reg_bw_opmode = rtl_read_byte(rtlpriv, REG_BWOPMODE);
|
||||
reg_prsr_rsc = rtl_read_byte(rtlpriv, REG_RRSR + 2);
|
||||
|
||||
switch (rtlphy->current_chan_bw) {
|
||||
case HT_CHANNEL_WIDTH_20:
|
||||
reg_bw_opmode |= BW_OPMODE_20MHZ;
|
||||
rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode);
|
||||
break;
|
||||
case HT_CHANNEL_WIDTH_20_40:
|
||||
reg_bw_opmode &= ~BW_OPMODE_20MHZ;
|
||||
rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode);
|
||||
reg_prsr_rsc =
|
||||
(reg_prsr_rsc & 0x90) | (mac->cur_40_prime_sc << 5);
|
||||
rtl_write_byte(rtlpriv, REG_RRSR + 2, reg_prsr_rsc);
|
||||
break;
|
||||
default:
|
||||
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
|
||||
"unknown bandwidth: %#X\n", rtlphy->current_chan_bw);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (rtlphy->current_chan_bw) {
|
||||
case HT_CHANNEL_WIDTH_20:
|
||||
rtl_set_bbreg(hw, RFPGA0_RFMOD, BRFMOD, 0x0);
|
||||
rtl_set_bbreg(hw, RFPGA1_RFMOD, BRFMOD, 0x0);
|
||||
rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10), 1);
|
||||
break;
|
||||
case HT_CHANNEL_WIDTH_20_40:
|
||||
rtl_set_bbreg(hw, RFPGA0_RFMOD, BRFMOD, 0x1);
|
||||
rtl_set_bbreg(hw, RFPGA1_RFMOD, BRFMOD, 0x1);
|
||||
|
||||
rtl_set_bbreg(hw, RCCK0_SYSTEM, BCCK_SIDEBAND,
|
||||
(mac->cur_40_prime_sc >> 1));
|
||||
rtl_set_bbreg(hw, ROFDM1_LSTF, 0xC00, mac->cur_40_prime_sc);
|
||||
rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10), 0);
|
||||
|
||||
rtl_set_bbreg(hw, 0x818, (BIT(26) | BIT(27)),
|
||||
(mac->cur_40_prime_sc ==
|
||||
HAL_PRIME_CHNL_OFFSET_LOWER) ? 2 : 1);
|
||||
break;
|
||||
default:
|
||||
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
|
||||
"unknown bandwidth: %#X\n", rtlphy->current_chan_bw);
|
||||
break;
|
||||
}
|
||||
rtl92ce_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw);
|
||||
rtlphy->set_bwmode_inprogress = false;
|
||||
RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "<==\n");
|
||||
}
|
||||
|
||||
void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t)
|
||||
{
|
||||
u8 tmpreg;
|
||||
u32 rf_a_mode = 0, rf_b_mode = 0, lc_cal;
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
|
||||
tmpreg = rtl_read_byte(rtlpriv, 0xd03);
|
||||
|
||||
if ((tmpreg & 0x70) != 0)
|
||||
rtl_write_byte(rtlpriv, 0xd03, tmpreg & 0x8F);
|
||||
else
|
||||
rtl_write_byte(rtlpriv, REG_TXPAUSE, 0xFF);
|
||||
|
||||
if ((tmpreg & 0x70) != 0) {
|
||||
rf_a_mode = rtl_get_rfreg(hw, RF90_PATH_A, 0x00, MASK12BITS);
|
||||
|
||||
if (is2t)
|
||||
rf_b_mode = rtl_get_rfreg(hw, RF90_PATH_B, 0x00,
|
||||
MASK12BITS);
|
||||
|
||||
rtl_set_rfreg(hw, RF90_PATH_A, 0x00, MASK12BITS,
|
||||
(rf_a_mode & 0x8FFFF) | 0x10000);
|
||||
|
||||
if (is2t)
|
||||
rtl_set_rfreg(hw, RF90_PATH_B, 0x00, MASK12BITS,
|
||||
(rf_b_mode & 0x8FFFF) | 0x10000);
|
||||
}
|
||||
lc_cal = rtl_get_rfreg(hw, RF90_PATH_A, 0x18, MASK12BITS);
|
||||
|
||||
rtl_set_rfreg(hw, RF90_PATH_A, 0x18, MASK12BITS, lc_cal | 0x08000);
|
||||
|
||||
mdelay(100);
|
||||
|
||||
if ((tmpreg & 0x70) != 0) {
|
||||
rtl_write_byte(rtlpriv, 0xd03, tmpreg);
|
||||
rtl_set_rfreg(hw, RF90_PATH_A, 0x00, MASK12BITS, rf_a_mode);
|
||||
|
||||
if (is2t)
|
||||
rtl_set_rfreg(hw, RF90_PATH_B, 0x00, MASK12BITS,
|
||||
rf_b_mode);
|
||||
} else {
|
||||
rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00);
|
||||
}
|
||||
}
|
||||
|
||||
static void _rtl92ce_phy_set_rf_sleep(struct ieee80211_hw *hw)
|
||||
{
|
||||
u32 u4b_tmp;
|
||||
u8 delay = 5;
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
|
||||
rtl_write_byte(rtlpriv, REG_TXPAUSE, 0xFF);
|
||||
rtl_set_rfreg(hw, RF90_PATH_A, 0x00, RFREG_OFFSET_MASK, 0x00);
|
||||
rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x40);
|
||||
u4b_tmp = rtl_get_rfreg(hw, RF90_PATH_A, 0, RFREG_OFFSET_MASK);
|
||||
while (u4b_tmp != 0 && delay > 0) {
|
||||
rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x0);
|
||||
rtl_set_rfreg(hw, RF90_PATH_A, 0x00, RFREG_OFFSET_MASK, 0x00);
|
||||
rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x40);
|
||||
u4b_tmp = rtl_get_rfreg(hw, RF90_PATH_A, 0, RFREG_OFFSET_MASK);
|
||||
delay--;
|
||||
}
|
||||
if (delay == 0) {
|
||||
rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x00);
|
||||
rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2);
|
||||
rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3);
|
||||
rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00);
|
||||
RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE,
|
||||
"Switch RF timeout !!!\n");
|
||||
return;
|
||||
}
|
||||
rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2);
|
||||
rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x22);
|
||||
}
|
||||
|
||||
static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw,
|
||||
enum rf_pwrstate rfpwr_state)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
|
||||
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
|
||||
struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
|
||||
bool bresult = true;
|
||||
u8 i, queue_id;
|
||||
struct rtl8192_tx_ring *ring = NULL;
|
||||
|
||||
switch (rfpwr_state) {
|
||||
case ERFON:{
|
||||
if ((ppsc->rfpwr_state == ERFOFF) &&
|
||||
RT_IN_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC)) {
|
||||
bool rtstatus;
|
||||
u32 InitializeCount = 0;
|
||||
do {
|
||||
InitializeCount++;
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
|
||||
"IPS Set eRf nic enable\n");
|
||||
rtstatus = rtl_ps_enable_nic(hw);
|
||||
} while (!rtstatus && (InitializeCount < 10));
|
||||
RT_CLEAR_PS_LEVEL(ppsc,
|
||||
RT_RF_OFF_LEVL_HALT_NIC);
|
||||
} else {
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
|
||||
"Set ERFON sleeped:%d ms\n",
|
||||
jiffies_to_msecs(jiffies -
|
||||
ppsc->
|
||||
last_sleep_jiffies));
|
||||
ppsc->last_awake_jiffies = jiffies;
|
||||
rtl92ce_phy_set_rf_on(hw);
|
||||
}
|
||||
if (mac->link_state == MAC80211_LINKED) {
|
||||
rtlpriv->cfg->ops->led_control(hw,
|
||||
LED_CTL_LINK);
|
||||
} else {
|
||||
rtlpriv->cfg->ops->led_control(hw,
|
||||
LED_CTL_NO_LINK);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ERFOFF:{
|
||||
if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) {
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
|
||||
"IPS Set eRf nic disable\n");
|
||||
rtl_ps_disable_nic(hw);
|
||||
RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC);
|
||||
} else {
|
||||
if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS) {
|
||||
rtlpriv->cfg->ops->led_control(hw,
|
||||
LED_CTL_NO_LINK);
|
||||
} else {
|
||||
rtlpriv->cfg->ops->led_control(hw,
|
||||
LED_CTL_POWER_OFF);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ERFSLEEP:{
|
||||
if (ppsc->rfpwr_state == ERFOFF)
|
||||
return false;
|
||||
for (queue_id = 0, i = 0;
|
||||
queue_id < RTL_PCI_MAX_TX_QUEUE_COUNT;) {
|
||||
ring = &pcipriv->dev.tx_ring[queue_id];
|
||||
if (skb_queue_len(&ring->queue) == 0) {
|
||||
queue_id++;
|
||||
continue;
|
||||
} else {
|
||||
RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
|
||||
"eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n",
|
||||
i + 1, queue_id,
|
||||
skb_queue_len(&ring->queue));
|
||||
|
||||
udelay(10);
|
||||
i++;
|
||||
}
|
||||
if (i >= MAX_DOZE_WAITING_TIMES_9x) {
|
||||
RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
|
||||
"ERFSLEEP: %d times TcbBusyQueue[%d] = %d !\n",
|
||||
MAX_DOZE_WAITING_TIMES_9x,
|
||||
queue_id,
|
||||
skb_queue_len(&ring->queue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
|
||||
"Set ERFSLEEP awaked:%d ms\n",
|
||||
jiffies_to_msecs(jiffies -
|
||||
ppsc->last_awake_jiffies));
|
||||
ppsc->last_sleep_jiffies = jiffies;
|
||||
_rtl92ce_phy_set_rf_sleep(hw);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
|
||||
"switch case not processed\n");
|
||||
bresult = false;
|
||||
break;
|
||||
}
|
||||
if (bresult)
|
||||
ppsc->rfpwr_state = rfpwr_state;
|
||||
return bresult;
|
||||
}
|
||||
|
||||
bool rtl92c_phy_set_rf_power_state(struct ieee80211_hw *hw,
|
||||
enum rf_pwrstate rfpwr_state)
|
||||
{
|
||||
struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
|
||||
|
||||
bool bresult = false;
|
||||
|
||||
if (rfpwr_state == ppsc->rfpwr_state)
|
||||
return bresult;
|
||||
bresult = _rtl92ce_phy_set_rf_power_state(hw, rfpwr_state);
|
||||
return bresult;
|
||||
}
|
143
drivers/net/wireless/rtlwifi/rtl8192ce/phy.h
Normal file
143
drivers/net/wireless/rtlwifi/rtl8192ce/phy.h
Normal file
|
@ -0,0 +1,143 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2009-2012 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
* Contact Information:
|
||||
* wlanfae <wlanfae@realtek.com>
|
||||
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
|
||||
* Hsinchu 300, Taiwan.
|
||||
*
|
||||
* Larry Finger <Larry.Finger@lwfinger.net>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __RTL92C_PHY_H__
|
||||
#define __RTL92C_PHY_H__
|
||||
|
||||
#define MAX_PRECMD_CNT 16
|
||||
#define MAX_RFDEPENDCMD_CNT 16
|
||||
#define MAX_POSTCMD_CNT 16
|
||||
|
||||
#define MAX_DOZE_WAITING_TIMES_9x 64
|
||||
|
||||
#define RT_CANNOT_IO(hw) false
|
||||
#define HIGHPOWER_RADIOA_ARRAYLEN 22
|
||||
|
||||
#define MAX_TOLERANCE 5
|
||||
|
||||
#define APK_BB_REG_NUM 5
|
||||
#define APK_AFE_REG_NUM 16
|
||||
#define APK_CURVE_REG_NUM 4
|
||||
#define PATH_NUM 2
|
||||
|
||||
#define LOOP_LIMIT 5
|
||||
#define MAX_STALL_TIME 50
|
||||
#define AntennaDiversityValue 0x80
|
||||
#define MAX_TXPWR_IDX_NMODE_92S 63
|
||||
#define Reset_Cnt_Limit 3
|
||||
|
||||
#define IQK_ADDA_REG_NUM 16
|
||||
#define IQK_MAC_REG_NUM 4
|
||||
|
||||
#define IQK_DELAY_TIME 1
|
||||
|
||||
#define RF90_PATH_MAX 2
|
||||
|
||||
#define CT_OFFSET_MAC_ADDR 0X16
|
||||
|
||||
#define CT_OFFSET_CCK_TX_PWR_IDX 0x5A
|
||||
#define CT_OFFSET_HT401S_TX_PWR_IDX 0x60
|
||||
#define CT_OFFSET_HT402S_TX_PWR_IDX_DIF 0x66
|
||||
#define CT_OFFSET_HT20_TX_PWR_IDX_DIFF 0x69
|
||||
#define CT_OFFSET_OFDM_TX_PWR_IDX_DIFF 0x6C
|
||||
|
||||
#define CT_OFFSET_HT40_MAX_PWR_OFFSET 0x6F
|
||||
#define CT_OFFSET_HT20_MAX_PWR_OFFSET 0x72
|
||||
|
||||
#define CT_OFFSET_CHANNEL_PLAH 0x75
|
||||
#define CT_OFFSET_THERMAL_METER 0x78
|
||||
#define CT_OFFSET_RF_OPTION 0x79
|
||||
#define CT_OFFSET_VERSION 0x7E
|
||||
#define CT_OFFSET_CUSTOMER_ID 0x7F
|
||||
|
||||
#define RTL92C_MAX_PATH_NUM 2
|
||||
|
||||
bool rtl92c_phy_bb_config(struct ieee80211_hw *hw);
|
||||
u32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask);
|
||||
void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask,
|
||||
u32 data);
|
||||
u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
|
||||
u32 regaddr, u32 bitmask);
|
||||
void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
|
||||
u32 regaddr, u32 bitmask, u32 data);
|
||||
bool rtl92c_phy_mac_config(struct ieee80211_hw *hw);
|
||||
bool rtl92ce_phy_bb_config(struct ieee80211_hw *hw);
|
||||
bool rtl92c_phy_rf_config(struct ieee80211_hw *hw);
|
||||
bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw,
|
||||
enum radio_path rfpath);
|
||||
void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw);
|
||||
void rtl92c_phy_get_txpower_level(struct ieee80211_hw *hw, long *powerlevel);
|
||||
void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel);
|
||||
bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw,
|
||||
long power_indbm);
|
||||
void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw,
|
||||
enum nl80211_channel_type ch_type);
|
||||
void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw);
|
||||
u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw);
|
||||
void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery);
|
||||
void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, u16 beaconinterval);
|
||||
void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta);
|
||||
void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw);
|
||||
void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t);
|
||||
void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain);
|
||||
bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
|
||||
enum radio_path rfpath);
|
||||
bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw,
|
||||
u32 rfpath);
|
||||
bool rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw,
|
||||
enum rf_pwrstate rfpwr_state);
|
||||
void rtl92ce_phy_set_rf_on(struct ieee80211_hw *hw);
|
||||
bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype);
|
||||
void rtl92c_phy_set_io(struct ieee80211_hw *hw);
|
||||
void rtl92c_bb_block_on(struct ieee80211_hw *hw);
|
||||
u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw, enum radio_path rfpath,
|
||||
u32 offset);
|
||||
u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw,
|
||||
enum radio_path rfpath, u32 offset);
|
||||
u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask);
|
||||
void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw,
|
||||
enum radio_path rfpath, u32 offset, u32 data);
|
||||
void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw,
|
||||
enum radio_path rfpath, u32 offset,
|
||||
u32 data);
|
||||
void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw,
|
||||
u32 regaddr, u32 bitmask, u32 data);
|
||||
bool _rtl92ce_phy_config_mac_with_headerfile(struct ieee80211_hw *hw);
|
||||
void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw);
|
||||
bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw);
|
||||
void _rtl92c_phy_set_rf_sleep(struct ieee80211_hw *hw);
|
||||
bool rtl92c_phy_set_rf_power_state(struct ieee80211_hw *hw,
|
||||
enum rf_pwrstate rfpwr_state);
|
||||
bool _rtl92ce_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
|
||||
u8 configtype);
|
||||
bool _rtl92ce_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
|
||||
u8 configtype);
|
||||
void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw);
|
||||
|
||||
#endif
|
2057
drivers/net/wireless/rtlwifi/rtl8192ce/reg.h
Normal file
2057
drivers/net/wireless/rtlwifi/rtl8192ce/reg.h
Normal file
File diff suppressed because it is too large
Load diff
509
drivers/net/wireless/rtlwifi/rtl8192ce/rf.c
Normal file
509
drivers/net/wireless/rtlwifi/rtl8192ce/rf.c
Normal file
|
@ -0,0 +1,509 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2009-2012 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
* Contact Information:
|
||||
* wlanfae <wlanfae@realtek.com>
|
||||
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
|
||||
* Hsinchu 300, Taiwan.
|
||||
*
|
||||
* Larry Finger <Larry.Finger@lwfinger.net>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../wifi.h"
|
||||
#include "reg.h"
|
||||
#include "def.h"
|
||||
#include "phy.h"
|
||||
#include "rf.h"
|
||||
#include "dm.h"
|
||||
|
||||
static bool _rtl92ce_phy_rf6052_config_parafile(struct ieee80211_hw *hw);
|
||||
|
||||
void rtl92ce_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_phy *rtlphy = &(rtlpriv->phy);
|
||||
|
||||
switch (bandwidth) {
|
||||
case HT_CHANNEL_WIDTH_20:
|
||||
rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] &
|
||||
0xfffff3ff) | 0x0400);
|
||||
rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK,
|
||||
rtlphy->rfreg_chnlval[0]);
|
||||
break;
|
||||
case HT_CHANNEL_WIDTH_20_40:
|
||||
rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] &
|
||||
0xfffff3ff));
|
||||
rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK,
|
||||
rtlphy->rfreg_chnlval[0]);
|
||||
break;
|
||||
default:
|
||||
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
|
||||
"unknown bandwidth: %#X\n", bandwidth);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void rtl92ce_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
|
||||
u8 *ppowerlevel)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_phy *rtlphy = &(rtlpriv->phy);
|
||||
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
|
||||
struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
|
||||
u32 tx_agc[2] = {0, 0}, tmpval;
|
||||
bool turbo_scanoff = false;
|
||||
u8 idx1, idx2;
|
||||
u8 *ptr;
|
||||
|
||||
if (rtlefuse->eeprom_regulatory != 0)
|
||||
turbo_scanoff = true;
|
||||
|
||||
if (mac->act_scanning) {
|
||||
tx_agc[RF90_PATH_A] = 0x3f3f3f3f;
|
||||
tx_agc[RF90_PATH_B] = 0x3f3f3f3f;
|
||||
|
||||
if (turbo_scanoff) {
|
||||
for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) {
|
||||
tx_agc[idx1] = ppowerlevel[idx1] |
|
||||
(ppowerlevel[idx1] << 8) |
|
||||
(ppowerlevel[idx1] << 16) |
|
||||
(ppowerlevel[idx1] << 24);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) {
|
||||
tx_agc[idx1] = ppowerlevel[idx1] |
|
||||
(ppowerlevel[idx1] << 8) |
|
||||
(ppowerlevel[idx1] << 16) |
|
||||
(ppowerlevel[idx1] << 24);
|
||||
}
|
||||
|
||||
if (rtlefuse->eeprom_regulatory == 0) {
|
||||
tmpval = (rtlphy->mcs_offset[0][6]) +
|
||||
(rtlphy->mcs_offset[0][7] << 8);
|
||||
tx_agc[RF90_PATH_A] += tmpval;
|
||||
|
||||
tmpval = (rtlphy->mcs_offset[0][14]) +
|
||||
(rtlphy->mcs_offset[0][15] << 24);
|
||||
tx_agc[RF90_PATH_B] += tmpval;
|
||||
}
|
||||
}
|
||||
|
||||
for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) {
|
||||
ptr = (u8 *) (&(tx_agc[idx1]));
|
||||
for (idx2 = 0; idx2 < 4; idx2++) {
|
||||
if (*ptr > RF6052_MAX_TX_PWR)
|
||||
*ptr = RF6052_MAX_TX_PWR;
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
|
||||
tmpval = tx_agc[RF90_PATH_A] & 0xff;
|
||||
rtl_set_bbreg(hw, RTXAGC_A_CCK1_MCS32, MASKBYTE1, tmpval);
|
||||
|
||||
RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
|
||||
"CCK PWR 1M (rf-A) = 0x%x (reg 0x%x)\n",
|
||||
tmpval, RTXAGC_A_CCK1_MCS32);
|
||||
|
||||
tmpval = tx_agc[RF90_PATH_A] >> 8;
|
||||
|
||||
tmpval = tmpval & 0xff00ffff;
|
||||
|
||||
rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval);
|
||||
|
||||
RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
|
||||
"CCK PWR 2~11M (rf-A) = 0x%x (reg 0x%x)\n",
|
||||
tmpval, RTXAGC_B_CCK11_A_CCK2_11);
|
||||
|
||||
tmpval = tx_agc[RF90_PATH_B] >> 24;
|
||||
rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, MASKBYTE0, tmpval);
|
||||
|
||||
RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
|
||||
"CCK PWR 11M (rf-B) = 0x%x (reg 0x%x)\n",
|
||||
tmpval, RTXAGC_B_CCK11_A_CCK2_11);
|
||||
|
||||
tmpval = tx_agc[RF90_PATH_B] & 0x00ffffff;
|
||||
rtl_set_bbreg(hw, RTXAGC_B_CCK1_55_MCS32, 0xffffff00, tmpval);
|
||||
|
||||
RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
|
||||
"CCK PWR 1~5.5M (rf-B) = 0x%x (reg 0x%x)\n",
|
||||
tmpval, RTXAGC_B_CCK1_55_MCS32);
|
||||
}
|
||||
|
||||
static void rtl92c_phy_get_power_base(struct ieee80211_hw *hw,
|
||||
u8 *ppowerlevel, u8 channel,
|
||||
u32 *ofdmbase, u32 *mcsbase)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_phy *rtlphy = &(rtlpriv->phy);
|
||||
struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
|
||||
u32 powerBase0, powerBase1;
|
||||
u8 legacy_pwrdiff, ht20_pwrdiff;
|
||||
u8 i, powerlevel[2];
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
powerlevel[i] = ppowerlevel[i];
|
||||
legacy_pwrdiff = rtlefuse->txpwr_legacyhtdiff[i][channel - 1];
|
||||
powerBase0 = powerlevel[i] + legacy_pwrdiff;
|
||||
|
||||
powerBase0 = (powerBase0 << 24) | (powerBase0 << 16) |
|
||||
(powerBase0 << 8) | powerBase0;
|
||||
*(ofdmbase + i) = powerBase0;
|
||||
RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
|
||||
" [OFDM power base index rf(%c) = 0x%x]\n",
|
||||
i == 0 ? 'A' : 'B', *(ofdmbase + i));
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20) {
|
||||
ht20_pwrdiff = rtlefuse->txpwr_ht20diff[i][channel - 1];
|
||||
powerlevel[i] += ht20_pwrdiff;
|
||||
}
|
||||
powerBase1 = powerlevel[i];
|
||||
powerBase1 = (powerBase1 << 24) |
|
||||
(powerBase1 << 16) | (powerBase1 << 8) | powerBase1;
|
||||
|
||||
*(mcsbase + i) = powerBase1;
|
||||
|
||||
RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
|
||||
" [MCS power base index rf(%c) = 0x%x]\n",
|
||||
i == 0 ? 'A' : 'B', *(mcsbase + i));
|
||||
}
|
||||
}
|
||||
|
||||
static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
|
||||
u8 channel, u8 index,
|
||||
u32 *powerBase0,
|
||||
u32 *powerBase1,
|
||||
u32 *p_outwriteval)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_phy *rtlphy = &(rtlpriv->phy);
|
||||
struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
|
||||
u8 i, chnlgroup = 0, pwr_diff_limit[4];
|
||||
u32 writeVal, customer_limit, rf;
|
||||
|
||||
for (rf = 0; rf < 2; rf++) {
|
||||
switch (rtlefuse->eeprom_regulatory) {
|
||||
case 0:
|
||||
chnlgroup = 0;
|
||||
|
||||
writeVal = rtlphy->mcs_offset[chnlgroup][index +
|
||||
(rf ? 8 : 0)]
|
||||
+ ((index < 2) ? powerBase0[rf] : powerBase1[rf]);
|
||||
|
||||
RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
|
||||
"RTK better performance, writeVal(%c) = 0x%x\n",
|
||||
rf == 0 ? 'A' : 'B', writeVal);
|
||||
break;
|
||||
case 1:
|
||||
if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
|
||||
writeVal = ((index < 2) ? powerBase0[rf] :
|
||||
powerBase1[rf]);
|
||||
|
||||
RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
|
||||
"Realtek regulatory, 40MHz, writeVal(%c) = 0x%x\n",
|
||||
rf == 0 ? 'A' : 'B', writeVal);
|
||||
} else {
|
||||
if (rtlphy->pwrgroup_cnt == 1)
|
||||
chnlgroup = 0;
|
||||
if (rtlphy->pwrgroup_cnt >= 3) {
|
||||
if (channel <= 3)
|
||||
chnlgroup = 0;
|
||||
else if (channel >= 4 && channel <= 9)
|
||||
chnlgroup = 1;
|
||||
else if (channel > 9)
|
||||
chnlgroup = 2;
|
||||
if (rtlphy->pwrgroup_cnt == 4)
|
||||
chnlgroup++;
|
||||
}
|
||||
|
||||
writeVal = rtlphy->mcs_offset[chnlgroup]
|
||||
[index + (rf ? 8 : 0)] + ((index < 2) ?
|
||||
powerBase0[rf] :
|
||||
powerBase1[rf]);
|
||||
|
||||
RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
|
||||
"Realtek regulatory, 20MHz, writeVal(%c) = 0x%x\n",
|
||||
rf == 0 ? 'A' : 'B', writeVal);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
writeVal =
|
||||
((index < 2) ? powerBase0[rf] : powerBase1[rf]);
|
||||
|
||||
RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
|
||||
"Better regulatory, writeVal(%c) = 0x%x\n",
|
||||
rf == 0 ? 'A' : 'B', writeVal);
|
||||
break;
|
||||
case 3:
|
||||
chnlgroup = 0;
|
||||
|
||||
if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
|
||||
RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
|
||||
"customer's limit, 40MHz rf(%c) = 0x%x\n",
|
||||
rf == 0 ? 'A' : 'B',
|
||||
rtlefuse->pwrgroup_ht40[rf][channel -
|
||||
1]);
|
||||
} else {
|
||||
RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
|
||||
"customer's limit, 20MHz rf(%c) = 0x%x\n",
|
||||
rf == 0 ? 'A' : 'B',
|
||||
rtlefuse->pwrgroup_ht20[rf][channel -
|
||||
1]);
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
pwr_diff_limit[i] = (u8) ((rtlphy->mcs_offset
|
||||
[chnlgroup][index +
|
||||
(rf ? 8 : 0)] & (0x7f << (i * 8))) >>
|
||||
(i * 8));
|
||||
|
||||
if (rtlphy->current_chan_bw ==
|
||||
HT_CHANNEL_WIDTH_20_40) {
|
||||
if (pwr_diff_limit[i] >
|
||||
rtlefuse->
|
||||
pwrgroup_ht40[rf][channel - 1])
|
||||
pwr_diff_limit[i] =
|
||||
rtlefuse->pwrgroup_ht40[rf]
|
||||
[channel - 1];
|
||||
} else {
|
||||
if (pwr_diff_limit[i] >
|
||||
rtlefuse->
|
||||
pwrgroup_ht20[rf][channel - 1])
|
||||
pwr_diff_limit[i] =
|
||||
rtlefuse->pwrgroup_ht20[rf]
|
||||
[channel - 1];
|
||||
}
|
||||
}
|
||||
|
||||
customer_limit = (pwr_diff_limit[3] << 24) |
|
||||
(pwr_diff_limit[2] << 16) |
|
||||
(pwr_diff_limit[1] << 8) | (pwr_diff_limit[0]);
|
||||
|
||||
RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
|
||||
"Customer's limit rf(%c) = 0x%x\n",
|
||||
rf == 0 ? 'A' : 'B', customer_limit);
|
||||
|
||||
writeVal = customer_limit +
|
||||
((index < 2) ? powerBase0[rf] : powerBase1[rf]);
|
||||
|
||||
RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
|
||||
"Customer, writeVal rf(%c)= 0x%x\n",
|
||||
rf == 0 ? 'A' : 'B', writeVal);
|
||||
break;
|
||||
default:
|
||||
chnlgroup = 0;
|
||||
writeVal = rtlphy->mcs_offset[chnlgroup]
|
||||
[index + (rf ? 8 : 0)]
|
||||
+ ((index < 2) ? powerBase0[rf] : powerBase1[rf]);
|
||||
|
||||
RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
|
||||
"RTK better performance, writeVal rf(%c) = 0x%x\n",
|
||||
rf == 0 ? 'A' : 'B', writeVal);
|
||||
break;
|
||||
}
|
||||
|
||||
if (rtlpriv->dm.dynamic_txhighpower_lvl == TXHIGHPWRLEVEL_BT1)
|
||||
writeVal = writeVal - 0x06060606;
|
||||
else if (rtlpriv->dm.dynamic_txhighpower_lvl ==
|
||||
TXHIGHPWRLEVEL_BT2)
|
||||
writeVal = writeVal - 0x0c0c0c0c;
|
||||
*(p_outwriteval + rf) = writeVal;
|
||||
}
|
||||
}
|
||||
|
||||
static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw,
|
||||
u8 index, u32 *pValue)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_phy *rtlphy = &(rtlpriv->phy);
|
||||
|
||||
u16 regoffset_a[6] = {
|
||||
RTXAGC_A_RATE18_06, RTXAGC_A_RATE54_24,
|
||||
RTXAGC_A_MCS03_MCS00, RTXAGC_A_MCS07_MCS04,
|
||||
RTXAGC_A_MCS11_MCS08, RTXAGC_A_MCS15_MCS12
|
||||
};
|
||||
u16 regoffset_b[6] = {
|
||||
RTXAGC_B_RATE18_06, RTXAGC_B_RATE54_24,
|
||||
RTXAGC_B_MCS03_MCS00, RTXAGC_B_MCS07_MCS04,
|
||||
RTXAGC_B_MCS11_MCS08, RTXAGC_B_MCS15_MCS12
|
||||
};
|
||||
u8 i, rf, pwr_val[4];
|
||||
u32 writeVal;
|
||||
u16 regoffset;
|
||||
|
||||
for (rf = 0; rf < 2; rf++) {
|
||||
writeVal = pValue[rf];
|
||||
for (i = 0; i < 4; i++) {
|
||||
pwr_val[i] = (u8) ((writeVal & (0x7f <<
|
||||
(i * 8))) >> (i * 8));
|
||||
|
||||
if (pwr_val[i] > RF6052_MAX_TX_PWR)
|
||||
pwr_val[i] = RF6052_MAX_TX_PWR;
|
||||
}
|
||||
writeVal = (pwr_val[3] << 24) | (pwr_val[2] << 16) |
|
||||
(pwr_val[1] << 8) | pwr_val[0];
|
||||
|
||||
if (rf == 0)
|
||||
regoffset = regoffset_a[index];
|
||||
else
|
||||
regoffset = regoffset_b[index];
|
||||
rtl_set_bbreg(hw, regoffset, MASKDWORD, writeVal);
|
||||
|
||||
RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
|
||||
"Set 0x%x = %08x\n", regoffset, writeVal);
|
||||
|
||||
if (((get_rf_type(rtlphy) == RF_2T2R) &&
|
||||
(regoffset == RTXAGC_A_MCS15_MCS12 ||
|
||||
regoffset == RTXAGC_B_MCS15_MCS12)) ||
|
||||
((get_rf_type(rtlphy) != RF_2T2R) &&
|
||||
(regoffset == RTXAGC_A_MCS07_MCS04 ||
|
||||
regoffset == RTXAGC_B_MCS07_MCS04))) {
|
||||
|
||||
writeVal = pwr_val[3];
|
||||
if (regoffset == RTXAGC_A_MCS15_MCS12 ||
|
||||
regoffset == RTXAGC_A_MCS07_MCS04)
|
||||
regoffset = 0xc90;
|
||||
if (regoffset == RTXAGC_B_MCS15_MCS12 ||
|
||||
regoffset == RTXAGC_B_MCS07_MCS04)
|
||||
regoffset = 0xc98;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
writeVal = (writeVal > 6) ? (writeVal - 6) : 0;
|
||||
rtl_write_byte(rtlpriv, (u32) (regoffset + i),
|
||||
(u8) writeVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void rtl92ce_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw,
|
||||
u8 *ppowerlevel, u8 channel)
|
||||
{
|
||||
u32 writeVal[2], powerBase0[2], powerBase1[2];
|
||||
u8 index;
|
||||
|
||||
rtl92c_phy_get_power_base(hw, ppowerlevel,
|
||||
channel, &powerBase0[0], &powerBase1[0]);
|
||||
|
||||
for (index = 0; index < 6; index++) {
|
||||
_rtl92c_get_txpower_writeval_by_regulatory(hw,
|
||||
channel, index,
|
||||
&powerBase0[0],
|
||||
&powerBase1[0],
|
||||
&writeVal[0]);
|
||||
|
||||
_rtl92c_write_ofdm_power_reg(hw, index, &writeVal[0]);
|
||||
}
|
||||
}
|
||||
|
||||
bool rtl92ce_phy_rf6052_config(struct ieee80211_hw *hw)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_phy *rtlphy = &(rtlpriv->phy);
|
||||
|
||||
if (rtlphy->rf_type == RF_1T1R)
|
||||
rtlphy->num_total_rfpath = 1;
|
||||
else
|
||||
rtlphy->num_total_rfpath = 2;
|
||||
|
||||
return _rtl92ce_phy_rf6052_config_parafile(hw);
|
||||
|
||||
}
|
||||
|
||||
static bool _rtl92ce_phy_rf6052_config_parafile(struct ieee80211_hw *hw)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_phy *rtlphy = &(rtlpriv->phy);
|
||||
u32 u4_regvalue = 0;
|
||||
u8 rfpath;
|
||||
bool rtstatus = true;
|
||||
struct bb_reg_def *pphyreg;
|
||||
|
||||
for (rfpath = 0; rfpath < rtlphy->num_total_rfpath; rfpath++) {
|
||||
|
||||
pphyreg = &rtlphy->phyreg_def[rfpath];
|
||||
|
||||
switch (rfpath) {
|
||||
case RF90_PATH_A:
|
||||
case RF90_PATH_C:
|
||||
u4_regvalue = rtl_get_bbreg(hw, pphyreg->rfintfs,
|
||||
BRFSI_RFENV);
|
||||
break;
|
||||
case RF90_PATH_B:
|
||||
case RF90_PATH_D:
|
||||
u4_regvalue = rtl_get_bbreg(hw, pphyreg->rfintfs,
|
||||
BRFSI_RFENV << 16);
|
||||
break;
|
||||
}
|
||||
|
||||
rtl_set_bbreg(hw, pphyreg->rfintfe, BRFSI_RFENV << 16, 0x1);
|
||||
udelay(1);
|
||||
|
||||
rtl_set_bbreg(hw, pphyreg->rfintfo, BRFSI_RFENV, 0x1);
|
||||
udelay(1);
|
||||
|
||||
rtl_set_bbreg(hw, pphyreg->rfhssi_para2,
|
||||
B3WIREADDREAALENGTH, 0x0);
|
||||
udelay(1);
|
||||
|
||||
rtl_set_bbreg(hw, pphyreg->rfhssi_para2, B3WIREDATALENGTH, 0x0);
|
||||
udelay(1);
|
||||
|
||||
switch (rfpath) {
|
||||
case RF90_PATH_A:
|
||||
rtstatus = rtl92c_phy_config_rf_with_headerfile(hw,
|
||||
(enum radio_path)rfpath);
|
||||
break;
|
||||
case RF90_PATH_B:
|
||||
rtstatus = rtl92c_phy_config_rf_with_headerfile(hw,
|
||||
(enum radio_path)rfpath);
|
||||
break;
|
||||
case RF90_PATH_C:
|
||||
break;
|
||||
case RF90_PATH_D:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (rfpath) {
|
||||
case RF90_PATH_A:
|
||||
case RF90_PATH_C:
|
||||
rtl_set_bbreg(hw, pphyreg->rfintfs,
|
||||
BRFSI_RFENV, u4_regvalue);
|
||||
break;
|
||||
case RF90_PATH_B:
|
||||
case RF90_PATH_D:
|
||||
rtl_set_bbreg(hw, pphyreg->rfintfs,
|
||||
BRFSI_RFENV << 16, u4_regvalue);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!rtstatus) {
|
||||
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
|
||||
"Radio[%d] Fail!!\n", rfpath);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "<---\n");
|
||||
return rtstatus;
|
||||
}
|
43
drivers/net/wireless/rtlwifi/rtl8192ce/rf.h
Normal file
43
drivers/net/wireless/rtlwifi/rtl8192ce/rf.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2009-2012 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
* Contact Information:
|
||||
* wlanfae <wlanfae@realtek.com>
|
||||
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
|
||||
* Hsinchu 300, Taiwan.
|
||||
*
|
||||
* Larry Finger <Larry.Finger@lwfinger.net>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __RTL92C_RF_H__
|
||||
#define __RTL92C_RF_H__
|
||||
|
||||
#define RF6052_MAX_TX_PWR 0x3F
|
||||
#define RF6052_MAX_REG 0x3F
|
||||
#define RF6052_MAX_PATH 2
|
||||
|
||||
void rtl92ce_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth);
|
||||
void rtl92ce_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
|
||||
u8 *ppowerlevel);
|
||||
void rtl92ce_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw,
|
||||
u8 *ppowerlevel, u8 channel);
|
||||
bool rtl92ce_phy_rf6052_config(struct ieee80211_hw *hw);
|
||||
#endif
|
394
drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
Normal file
394
drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
Normal file
|
@ -0,0 +1,394 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2009-2012 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
* Contact Information:
|
||||
* wlanfae <wlanfae@realtek.com>
|
||||
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
|
||||
* Hsinchu 300, Taiwan.
|
||||
*
|
||||
* Larry Finger <Larry.Finger@lwfinger.net>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../wifi.h"
|
||||
#include "../core.h"
|
||||
#include "../pci.h"
|
||||
#include "../base.h"
|
||||
#include "reg.h"
|
||||
#include "def.h"
|
||||
#include "phy.h"
|
||||
#include "dm.h"
|
||||
#include "../rtl8192c/dm_common.h"
|
||||
#include "../rtl8192c/fw_common.h"
|
||||
#include "../rtl8192c/phy_common.h"
|
||||
#include "hw.h"
|
||||
#include "rf.h"
|
||||
#include "sw.h"
|
||||
#include "trx.h"
|
||||
#include "led.h"
|
||||
|
||||
#include <linux/module.h>
|
||||
|
||||
static void rtl92c_init_aspm_vars(struct ieee80211_hw *hw)
|
||||
{
|
||||
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
|
||||
|
||||
/*close ASPM for AMD defaultly */
|
||||
rtlpci->const_amdpci_aspm = 0;
|
||||
|
||||
/*
|
||||
* ASPM PS mode.
|
||||
* 0 - Disable ASPM,
|
||||
* 1 - Enable ASPM without Clock Req,
|
||||
* 2 - Enable ASPM with Clock Req,
|
||||
* 3 - Alwyas Enable ASPM with Clock Req,
|
||||
* 4 - Always Enable ASPM without Clock Req.
|
||||
* set defult to RTL8192CE:3 RTL8192E:2
|
||||
* */
|
||||
rtlpci->const_pci_aspm = 3;
|
||||
|
||||
/*Setting for PCI-E device */
|
||||
rtlpci->const_devicepci_aspm_setting = 0x03;
|
||||
|
||||
/*Setting for PCI-E bridge */
|
||||
rtlpci->const_hostpci_aspm_setting = 0x02;
|
||||
|
||||
/*
|
||||
* In Hw/Sw Radio Off situation.
|
||||
* 0 - Default,
|
||||
* 1 - From ASPM setting without low Mac Pwr,
|
||||
* 2 - From ASPM setting with low Mac Pwr,
|
||||
* 3 - Bus D3
|
||||
* set default to RTL8192CE:0 RTL8192SE:2
|
||||
*/
|
||||
rtlpci->const_hwsw_rfoff_d3 = 0;
|
||||
|
||||
/*
|
||||
* This setting works for those device with
|
||||
* backdoor ASPM setting such as EPHY setting.
|
||||
* 0 - Not support ASPM,
|
||||
* 1 - Support ASPM,
|
||||
* 2 - According to chipset.
|
||||
*/
|
||||
rtlpci->const_support_pciaspm = 1;
|
||||
}
|
||||
|
||||
int rtl92c_init_sw_vars(struct ieee80211_hw *hw)
|
||||
{
|
||||
int err;
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
|
||||
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
|
||||
|
||||
rtl8192ce_bt_reg_init(hw);
|
||||
|
||||
rtlpriv->dm.dm_initialgain_enable = true;
|
||||
rtlpriv->dm.dm_flag = 0;
|
||||
rtlpriv->dm.disable_framebursting = false;
|
||||
rtlpriv->dm.thermalvalue = 0;
|
||||
rtlpci->transmit_config = CFENDFORM | BIT(12) | BIT(13);
|
||||
|
||||
/* compatible 5G band 88ce just 2.4G band & smsp */
|
||||
rtlpriv->rtlhal.current_bandtype = BAND_ON_2_4G;
|
||||
rtlpriv->rtlhal.bandset = BAND_ON_2_4G;
|
||||
rtlpriv->rtlhal.macphymode = SINGLEMAC_SINGLEPHY;
|
||||
|
||||
rtlpci->receive_config = (RCR_APPFCS |
|
||||
RCR_AMF |
|
||||
RCR_ADF |
|
||||
RCR_APP_MIC |
|
||||
RCR_APP_ICV |
|
||||
RCR_AICV |
|
||||
RCR_ACRC32 |
|
||||
RCR_AB |
|
||||
RCR_AM |
|
||||
RCR_APM |
|
||||
RCR_APP_PHYST_RXFF | RCR_HTC_LOC_CTRL | 0);
|
||||
|
||||
rtlpci->irq_mask[0] =
|
||||
(u32) (IMR_ROK |
|
||||
IMR_VODOK |
|
||||
IMR_VIDOK |
|
||||
IMR_BEDOK |
|
||||
IMR_BKDOK |
|
||||
IMR_MGNTDOK |
|
||||
IMR_HIGHDOK | IMR_BDOK | IMR_RDU | IMR_RXFOVW | 0);
|
||||
|
||||
rtlpci->irq_mask[1] = (u32) (IMR_CPWM | IMR_C2HCMD | 0);
|
||||
|
||||
/* for debug level */
|
||||
rtlpriv->dbg.global_debuglevel = rtlpriv->cfg->mod_params->debug;
|
||||
/* for LPS & IPS */
|
||||
rtlpriv->psc.inactiveps = rtlpriv->cfg->mod_params->inactiveps;
|
||||
rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps;
|
||||
rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps;
|
||||
if (!rtlpriv->psc.inactiveps)
|
||||
pr_info("rtl8192ce: Power Save off (module option)\n");
|
||||
if (!rtlpriv->psc.fwctrl_lps)
|
||||
pr_info("rtl8192ce: FW Power Save off (module option)\n");
|
||||
rtlpriv->psc.reg_fwctrl_lps = 3;
|
||||
rtlpriv->psc.reg_max_lps_awakeintvl = 5;
|
||||
/* for ASPM, you can close aspm through
|
||||
* set const_support_pciaspm = 0 */
|
||||
rtl92c_init_aspm_vars(hw);
|
||||
|
||||
if (rtlpriv->psc.reg_fwctrl_lps == 1)
|
||||
rtlpriv->psc.fwctrl_psmode = FW_PS_MIN_MODE;
|
||||
else if (rtlpriv->psc.reg_fwctrl_lps == 2)
|
||||
rtlpriv->psc.fwctrl_psmode = FW_PS_MAX_MODE;
|
||||
else if (rtlpriv->psc.reg_fwctrl_lps == 3)
|
||||
rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE;
|
||||
|
||||
/* for firmware buf */
|
||||
rtlpriv->rtlhal.pfirmware = vzalloc(0x4000);
|
||||
if (!rtlpriv->rtlhal.pfirmware) {
|
||||
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
|
||||
"Can't alloc buffer for fw\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* request fw */
|
||||
if (IS_VENDOR_UMC_A_CUT(rtlhal->version) &&
|
||||
!IS_92C_SERIAL(rtlhal->version))
|
||||
rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cfwU.bin";
|
||||
else if (IS_81XXC_VENDOR_UMC_B_CUT(rtlhal->version))
|
||||
rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cfwU_B.bin";
|
||||
|
||||
rtlpriv->max_fw_size = 0x4000;
|
||||
pr_info("Using firmware %s\n", rtlpriv->cfg->fw_name);
|
||||
err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name,
|
||||
rtlpriv->io.dev, GFP_KERNEL, hw,
|
||||
rtl_fw_cb);
|
||||
if (err) {
|
||||
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
|
||||
"Failed to request firmware!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void rtl92c_deinit_sw_vars(struct ieee80211_hw *hw)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
|
||||
if (rtlpriv->rtlhal.pfirmware) {
|
||||
vfree(rtlpriv->rtlhal.pfirmware);
|
||||
rtlpriv->rtlhal.pfirmware = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static struct rtl_hal_ops rtl8192ce_hal_ops = {
|
||||
.init_sw_vars = rtl92c_init_sw_vars,
|
||||
.deinit_sw_vars = rtl92c_deinit_sw_vars,
|
||||
.read_eeprom_info = rtl92ce_read_eeprom_info,
|
||||
.interrupt_recognized = rtl92ce_interrupt_recognized,
|
||||
.hw_init = rtl92ce_hw_init,
|
||||
.hw_disable = rtl92ce_card_disable,
|
||||
.hw_suspend = rtl92ce_suspend,
|
||||
.hw_resume = rtl92ce_resume,
|
||||
.enable_interrupt = rtl92ce_enable_interrupt,
|
||||
.disable_interrupt = rtl92ce_disable_interrupt,
|
||||
.set_network_type = rtl92ce_set_network_type,
|
||||
.set_chk_bssid = rtl92ce_set_check_bssid,
|
||||
.set_qos = rtl92ce_set_qos,
|
||||
.set_bcn_reg = rtl92ce_set_beacon_related_registers,
|
||||
.set_bcn_intv = rtl92ce_set_beacon_interval,
|
||||
.update_interrupt_mask = rtl92ce_update_interrupt_mask,
|
||||
.get_hw_reg = rtl92ce_get_hw_reg,
|
||||
.set_hw_reg = rtl92ce_set_hw_reg,
|
||||
.update_rate_tbl = rtl92ce_update_hal_rate_tbl,
|
||||
.fill_tx_desc = rtl92ce_tx_fill_desc,
|
||||
.fill_tx_cmddesc = rtl92ce_tx_fill_cmddesc,
|
||||
.query_rx_desc = rtl92ce_rx_query_desc,
|
||||
.set_channel_access = rtl92ce_update_channel_access_setting,
|
||||
.radio_onoff_checking = rtl92ce_gpio_radio_on_off_checking,
|
||||
.set_bw_mode = rtl92c_phy_set_bw_mode,
|
||||
.switch_channel = rtl92c_phy_sw_chnl,
|
||||
.dm_watchdog = rtl92c_dm_watchdog,
|
||||
.scan_operation_backup = rtl_phy_scan_operation_backup,
|
||||
.set_rf_power_state = rtl92c_phy_set_rf_power_state,
|
||||
.led_control = rtl92ce_led_control,
|
||||
.set_desc = rtl92ce_set_desc,
|
||||
.get_desc = rtl92ce_get_desc,
|
||||
.is_tx_desc_closed = rtl92ce_is_tx_desc_closed,
|
||||
.tx_polling = rtl92ce_tx_polling,
|
||||
.enable_hw_sec = rtl92ce_enable_hw_security_config,
|
||||
.set_key = rtl92ce_set_key,
|
||||
.init_sw_leds = rtl92ce_init_sw_leds,
|
||||
.get_bbreg = rtl92c_phy_query_bb_reg,
|
||||
.set_bbreg = rtl92c_phy_set_bb_reg,
|
||||
.set_rfreg = rtl92ce_phy_set_rf_reg,
|
||||
.get_rfreg = rtl92c_phy_query_rf_reg,
|
||||
.phy_rf6052_config = rtl92ce_phy_rf6052_config,
|
||||
.phy_rf6052_set_cck_txpower = rtl92ce_phy_rf6052_set_cck_txpower,
|
||||
.phy_rf6052_set_ofdm_txpower = rtl92ce_phy_rf6052_set_ofdm_txpower,
|
||||
.config_bb_with_headerfile = _rtl92ce_phy_config_bb_with_headerfile,
|
||||
.config_bb_with_pgheaderfile = _rtl92ce_phy_config_bb_with_pgheaderfile,
|
||||
.phy_lc_calibrate = _rtl92ce_phy_lc_calibrate,
|
||||
.phy_set_bw_mode_callback = rtl92ce_phy_set_bw_mode_callback,
|
||||
.dm_dynamic_txpower = rtl92ce_dm_dynamic_txpower,
|
||||
.get_btc_status = rtl_btc_status_false,
|
||||
};
|
||||
|
||||
static struct rtl_mod_params rtl92ce_mod_params = {
|
||||
.sw_crypto = false,
|
||||
.inactiveps = true,
|
||||
.swctrl_lps = false,
|
||||
.fwctrl_lps = true,
|
||||
.debug = DBG_EMERG,
|
||||
};
|
||||
|
||||
static struct rtl_hal_cfg rtl92ce_hal_cfg = {
|
||||
.bar_id = 2,
|
||||
.write_readback = true,
|
||||
.name = "rtl92c_pci",
|
||||
.fw_name = "rtlwifi/rtl8192cfw.bin",
|
||||
.ops = &rtl8192ce_hal_ops,
|
||||
.mod_params = &rtl92ce_mod_params,
|
||||
|
||||
.maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL,
|
||||
.maps[SYS_FUNC_EN] = REG_SYS_FUNC_EN,
|
||||
.maps[SYS_CLK] = REG_SYS_CLKR,
|
||||
.maps[MAC_RCR_AM] = AM,
|
||||
.maps[MAC_RCR_AB] = AB,
|
||||
.maps[MAC_RCR_ACRC32] = ACRC32,
|
||||
.maps[MAC_RCR_ACF] = ACF,
|
||||
.maps[MAC_RCR_AAP] = AAP,
|
||||
.maps[MAC_HIMR] = REG_HIMR,
|
||||
.maps[MAC_HIMRE] = REG_HIMRE,
|
||||
|
||||
.maps[EFUSE_TEST] = REG_EFUSE_TEST,
|
||||
.maps[EFUSE_CTRL] = REG_EFUSE_CTRL,
|
||||
.maps[EFUSE_CLK] = 0,
|
||||
.maps[EFUSE_CLK_CTRL] = REG_EFUSE_CTRL,
|
||||
.maps[EFUSE_PWC_EV12V] = PWC_EV12V,
|
||||
.maps[EFUSE_FEN_ELDR] = FEN_ELDR,
|
||||
.maps[EFUSE_LOADER_CLK_EN] = LOADER_CLK_EN,
|
||||
.maps[EFUSE_ANA8M] = EFUSE_ANA8M,
|
||||
.maps[EFUSE_HWSET_MAX_SIZE] = HWSET_MAX_SIZE,
|
||||
.maps[EFUSE_MAX_SECTION_MAP] = EFUSE_MAX_SECTION,
|
||||
.maps[EFUSE_REAL_CONTENT_SIZE] = EFUSE_REAL_CONTENT_LEN,
|
||||
.maps[EFUSE_OOB_PROTECT_BYTES_LEN] = EFUSE_OOB_PROTECT_BYTES,
|
||||
|
||||
.maps[RWCAM] = REG_CAMCMD,
|
||||
.maps[WCAMI] = REG_CAMWRITE,
|
||||
.maps[RCAMO] = REG_CAMREAD,
|
||||
.maps[CAMDBG] = REG_CAMDBG,
|
||||
.maps[SECR] = REG_SECCFG,
|
||||
.maps[SEC_CAM_NONE] = CAM_NONE,
|
||||
.maps[SEC_CAM_WEP40] = CAM_WEP40,
|
||||
.maps[SEC_CAM_TKIP] = CAM_TKIP,
|
||||
.maps[SEC_CAM_AES] = CAM_AES,
|
||||
.maps[SEC_CAM_WEP104] = CAM_WEP104,
|
||||
|
||||
.maps[RTL_IMR_BCNDMAINT6] = IMR_BCNDMAINT6,
|
||||
.maps[RTL_IMR_BCNDMAINT5] = IMR_BCNDMAINT5,
|
||||
.maps[RTL_IMR_BCNDMAINT4] = IMR_BCNDMAINT4,
|
||||
.maps[RTL_IMR_BCNDMAINT3] = IMR_BCNDMAINT3,
|
||||
.maps[RTL_IMR_BCNDMAINT2] = IMR_BCNDMAINT2,
|
||||
.maps[RTL_IMR_BCNDMAINT1] = IMR_BCNDMAINT1,
|
||||
.maps[RTL_IMR_BCNDOK8] = IMR_BCNDOK8,
|
||||
.maps[RTL_IMR_BCNDOK7] = IMR_BCNDOK7,
|
||||
.maps[RTL_IMR_BCNDOK6] = IMR_BCNDOK6,
|
||||
.maps[RTL_IMR_BCNDOK5] = IMR_BCNDOK5,
|
||||
.maps[RTL_IMR_BCNDOK4] = IMR_BCNDOK4,
|
||||
.maps[RTL_IMR_BCNDOK3] = IMR_BCNDOK3,
|
||||
.maps[RTL_IMR_BCNDOK2] = IMR_BCNDOK2,
|
||||
.maps[RTL_IMR_BCNDOK1] = IMR_BCNDOK1,
|
||||
.maps[RTL_IMR_TIMEOUT2] = IMR_TIMEOUT2,
|
||||
.maps[RTL_IMR_TIMEOUT1] = IMR_TIMEOUT1,
|
||||
|
||||
.maps[RTL_IMR_TXFOVW] = IMR_TXFOVW,
|
||||
.maps[RTL_IMR_PSTIMEOUT] = IMR_PSTIMEOUT,
|
||||
.maps[RTL_IMR_BCNINT] = IMR_BCNINT,
|
||||
.maps[RTL_IMR_RXFOVW] = IMR_RXFOVW,
|
||||
.maps[RTL_IMR_RDU] = IMR_RDU,
|
||||
.maps[RTL_IMR_ATIMEND] = IMR_ATIMEND,
|
||||
.maps[RTL_IMR_BDOK] = IMR_BDOK,
|
||||
.maps[RTL_IMR_MGNTDOK] = IMR_MGNTDOK,
|
||||
.maps[RTL_IMR_TBDER] = IMR_TBDER,
|
||||
.maps[RTL_IMR_HIGHDOK] = IMR_HIGHDOK,
|
||||
.maps[RTL_IMR_TBDOK] = IMR_TBDOK,
|
||||
.maps[RTL_IMR_BKDOK] = IMR_BKDOK,
|
||||
.maps[RTL_IMR_BEDOK] = IMR_BEDOK,
|
||||
.maps[RTL_IMR_VIDOK] = IMR_VIDOK,
|
||||
.maps[RTL_IMR_VODOK] = IMR_VODOK,
|
||||
.maps[RTL_IMR_ROK] = IMR_ROK,
|
||||
.maps[RTL_IBSS_INT_MASKS] = (IMR_BCNINT | IMR_TBDOK | IMR_TBDER),
|
||||
|
||||
.maps[RTL_RC_CCK_RATE1M] = DESC92_RATE1M,
|
||||
.maps[RTL_RC_CCK_RATE2M] = DESC92_RATE2M,
|
||||
.maps[RTL_RC_CCK_RATE5_5M] = DESC92_RATE5_5M,
|
||||
.maps[RTL_RC_CCK_RATE11M] = DESC92_RATE11M,
|
||||
.maps[RTL_RC_OFDM_RATE6M] = DESC92_RATE6M,
|
||||
.maps[RTL_RC_OFDM_RATE9M] = DESC92_RATE9M,
|
||||
.maps[RTL_RC_OFDM_RATE12M] = DESC92_RATE12M,
|
||||
.maps[RTL_RC_OFDM_RATE18M] = DESC92_RATE18M,
|
||||
.maps[RTL_RC_OFDM_RATE24M] = DESC92_RATE24M,
|
||||
.maps[RTL_RC_OFDM_RATE36M] = DESC92_RATE36M,
|
||||
.maps[RTL_RC_OFDM_RATE48M] = DESC92_RATE48M,
|
||||
.maps[RTL_RC_OFDM_RATE54M] = DESC92_RATE54M,
|
||||
|
||||
.maps[RTL_RC_HT_RATEMCS7] = DESC92_RATEMCS7,
|
||||
.maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15,
|
||||
};
|
||||
|
||||
static const struct pci_device_id rtl92ce_pci_ids[] = {
|
||||
{RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8191, rtl92ce_hal_cfg)},
|
||||
{RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8178, rtl92ce_hal_cfg)},
|
||||
{RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8177, rtl92ce_hal_cfg)},
|
||||
{RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8176, rtl92ce_hal_cfg)},
|
||||
{},
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, rtl92ce_pci_ids);
|
||||
|
||||
MODULE_AUTHOR("lizhaoming <chaoming_li@realsil.com.cn>");
|
||||
MODULE_AUTHOR("Realtek WlanFAE <wlanfae@realtek.com>");
|
||||
MODULE_AUTHOR("Larry Finger <Larry.Finger@lwfinger.net>");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_DESCRIPTION("Realtek 8192C/8188C 802.11n PCI wireless");
|
||||
MODULE_FIRMWARE("rtlwifi/rtl8192cfw.bin");
|
||||
MODULE_FIRMWARE("rtlwifi/rtl8192cfwU.bin");
|
||||
MODULE_FIRMWARE("rtlwifi/rtl8192cfwU_B.bin");
|
||||
|
||||
module_param_named(swenc, rtl92ce_mod_params.sw_crypto, bool, 0444);
|
||||
module_param_named(debug, rtl92ce_mod_params.debug, int, 0444);
|
||||
module_param_named(ips, rtl92ce_mod_params.inactiveps, bool, 0444);
|
||||
module_param_named(swlps, rtl92ce_mod_params.swctrl_lps, bool, 0444);
|
||||
module_param_named(fwlps, rtl92ce_mod_params.fwctrl_lps, bool, 0444);
|
||||
MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n");
|
||||
MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n");
|
||||
MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n");
|
||||
MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n");
|
||||
MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)");
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
|
||||
|
||||
static struct pci_driver rtl92ce_driver = {
|
||||
.name = KBUILD_MODNAME,
|
||||
.id_table = rtl92ce_pci_ids,
|
||||
.probe = rtl_pci_probe,
|
||||
.remove = rtl_pci_disconnect,
|
||||
.driver.pm = &rtlwifi_pm_ops,
|
||||
};
|
||||
|
||||
module_pci_driver(rtl92ce_driver);
|
41
drivers/net/wireless/rtlwifi/rtl8192ce/sw.h
Normal file
41
drivers/net/wireless/rtlwifi/rtl8192ce/sw.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2009-2012 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
* Contact Information:
|
||||
* wlanfae <wlanfae@realtek.com>
|
||||
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
|
||||
* Hsinchu 300, Taiwan.
|
||||
*
|
||||
* Larry Finger <Larry.Finger@lwfinger.net>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __RTL92CE_SW_H__
|
||||
#define __RTL92CE_SW_H__
|
||||
|
||||
int rtl92c_init_sw_vars(struct ieee80211_hw *hw);
|
||||
void rtl92c_deinit_sw_vars(struct ieee80211_hw *hw);
|
||||
void rtl92c_init_var_map(struct ieee80211_hw *hw);
|
||||
bool _rtl92ce_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
|
||||
u8 configtype);
|
||||
bool _rtl92ce_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
|
||||
u8 configtype);
|
||||
|
||||
#endif
|
1224
drivers/net/wireless/rtlwifi/rtl8192ce/table.c
Normal file
1224
drivers/net/wireless/rtlwifi/rtl8192ce/table.c
Normal file
File diff suppressed because it is too large
Load diff
58
drivers/net/wireless/rtlwifi/rtl8192ce/table.h
Normal file
58
drivers/net/wireless/rtlwifi/rtl8192ce/table.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2009-2012 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
* Contact Information:
|
||||
* wlanfae <wlanfae@realtek.com>
|
||||
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
|
||||
* Hsinchu 300, Taiwan.
|
||||
*
|
||||
* Created on 2010/ 5/18, 1:41
|
||||
*
|
||||
* Larry Finger <Larry.Finger@lwfinger.net>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __RTL92CE_TABLE__H_
|
||||
#define __RTL92CE_TABLE__H_
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#define PHY_REG_2TARRAY_LENGTH 374
|
||||
extern u32 RTL8192CEPHY_REG_2TARRAY[PHY_REG_2TARRAY_LENGTH];
|
||||
#define PHY_REG_1TARRAY_LENGTH 374
|
||||
extern u32 RTL8192CEPHY_REG_1TARRAY[PHY_REG_1TARRAY_LENGTH];
|
||||
#define PHY_REG_ARRAY_PGLENGTH 192
|
||||
extern u32 RTL8192CEPHY_REG_ARRAY_PG[PHY_REG_ARRAY_PGLENGTH];
|
||||
#define RADIOA_2TARRAYLENGTH 282
|
||||
extern u32 RTL8192CERADIOA_2TARRAY[RADIOA_2TARRAYLENGTH];
|
||||
#define RADIOB_2TARRAYLENGTH 78
|
||||
extern u32 RTL8192CE_RADIOB_2TARRAY[RADIOB_2TARRAYLENGTH];
|
||||
#define RADIOA_1TARRAYLENGTH 282
|
||||
extern u32 RTL8192CE_RADIOA_1TARRAY[RADIOA_1TARRAYLENGTH];
|
||||
#define RADIOB_1TARRAYLENGTH 1
|
||||
extern u32 RTL8192CE_RADIOB_1TARRAY[RADIOB_1TARRAYLENGTH];
|
||||
#define MAC_2T_ARRAYLENGTH 162
|
||||
extern u32 RTL8192CEMAC_2T_ARRAY[MAC_2T_ARRAYLENGTH];
|
||||
#define AGCTAB_2TARRAYLENGTH 320
|
||||
extern u32 RTL8192CEAGCTAB_2TARRAY[AGCTAB_2TARRAYLENGTH];
|
||||
#define AGCTAB_1TARRAYLENGTH 320
|
||||
extern u32 RTL8192CEAGCTAB_1TARRAY[AGCTAB_1TARRAYLENGTH];
|
||||
|
||||
#endif
|
769
drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
Normal file
769
drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
Normal file
|
@ -0,0 +1,769 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2009-2012 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
* Contact Information:
|
||||
* wlanfae <wlanfae@realtek.com>
|
||||
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
|
||||
* Hsinchu 300, Taiwan.
|
||||
*
|
||||
* Larry Finger <Larry.Finger@lwfinger.net>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../wifi.h"
|
||||
#include "../pci.h"
|
||||
#include "../base.h"
|
||||
#include "../stats.h"
|
||||
#include "reg.h"
|
||||
#include "def.h"
|
||||
#include "phy.h"
|
||||
#include "trx.h"
|
||||
#include "led.h"
|
||||
|
||||
static u8 _rtl92ce_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue)
|
||||
{
|
||||
__le16 fc = rtl_get_fc(skb);
|
||||
|
||||
if (unlikely(ieee80211_is_beacon(fc)))
|
||||
return QSLT_BEACON;
|
||||
if (ieee80211_is_mgmt(fc) || ieee80211_is_ctl(fc))
|
||||
return QSLT_MGNT;
|
||||
|
||||
return skb->priority;
|
||||
}
|
||||
|
||||
static u8 _rtl92c_query_rxpwrpercentage(char antpower)
|
||||
{
|
||||
if ((antpower <= -100) || (antpower >= 20))
|
||||
return 0;
|
||||
else if (antpower >= 0)
|
||||
return 100;
|
||||
else
|
||||
return 100 + antpower;
|
||||
}
|
||||
|
||||
static u8 _rtl92c_evm_db_to_percentage(char value)
|
||||
{
|
||||
char ret_val;
|
||||
ret_val = value;
|
||||
|
||||
if (ret_val >= 0)
|
||||
ret_val = 0;
|
||||
|
||||
if (ret_val <= -33)
|
||||
ret_val = -33;
|
||||
|
||||
ret_val = 0 - ret_val;
|
||||
ret_val *= 3;
|
||||
|
||||
if (ret_val == 99)
|
||||
ret_val = 100;
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
static long _rtl92ce_signal_scale_mapping(struct ieee80211_hw *hw,
|
||||
long currsig)
|
||||
{
|
||||
long retsig;
|
||||
|
||||
if (currsig >= 61 && currsig <= 100)
|
||||
retsig = 90 + ((currsig - 60) / 4);
|
||||
else if (currsig >= 41 && currsig <= 60)
|
||||
retsig = 78 + ((currsig - 40) / 2);
|
||||
else if (currsig >= 31 && currsig <= 40)
|
||||
retsig = 66 + (currsig - 30);
|
||||
else if (currsig >= 21 && currsig <= 30)
|
||||
retsig = 54 + (currsig - 20);
|
||||
else if (currsig >= 5 && currsig <= 20)
|
||||
retsig = 42 + (((currsig - 5) * 2) / 3);
|
||||
else if (currsig == 4)
|
||||
retsig = 36;
|
||||
else if (currsig == 3)
|
||||
retsig = 27;
|
||||
else if (currsig == 2)
|
||||
retsig = 18;
|
||||
else if (currsig == 1)
|
||||
retsig = 9;
|
||||
else
|
||||
retsig = currsig;
|
||||
|
||||
return retsig;
|
||||
}
|
||||
|
||||
static void _rtl92ce_query_rxphystatus(struct ieee80211_hw *hw,
|
||||
struct rtl_stats *pstats,
|
||||
struct rx_desc_92c *pdesc,
|
||||
struct rx_fwinfo_92c *p_drvinfo,
|
||||
bool packet_match_bssid,
|
||||
bool packet_toself,
|
||||
bool packet_beacon)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct phy_sts_cck_8192s_t *cck_buf;
|
||||
struct rtl_ps_ctl *ppsc = rtl_psc(rtlpriv);
|
||||
s8 rx_pwr_all = 0, rx_pwr[4];
|
||||
u8 evm, pwdb_all, rf_rx_num = 0;
|
||||
u8 i, max_spatial_stream;
|
||||
u32 rssi, total_rssi = 0;
|
||||
bool is_cck_rate;
|
||||
|
||||
is_cck_rate = RX_HAL_IS_CCK_RATE(pdesc->rxmcs);
|
||||
pstats->packet_matchbssid = packet_match_bssid;
|
||||
pstats->packet_toself = packet_toself;
|
||||
pstats->is_cck = is_cck_rate;
|
||||
pstats->packet_beacon = packet_beacon;
|
||||
pstats->rx_mimo_sig_qual[0] = -1;
|
||||
pstats->rx_mimo_sig_qual[1] = -1;
|
||||
|
||||
if (is_cck_rate) {
|
||||
u8 report, cck_highpwr;
|
||||
cck_buf = (struct phy_sts_cck_8192s_t *)p_drvinfo;
|
||||
|
||||
if (ppsc->rfpwr_state == ERFON)
|
||||
cck_highpwr = (u8) rtl_get_bbreg(hw,
|
||||
RFPGA0_XA_HSSIPARAMETER2,
|
||||
BIT(9));
|
||||
else
|
||||
cck_highpwr = false;
|
||||
|
||||
if (!cck_highpwr) {
|
||||
u8 cck_agc_rpt = cck_buf->cck_agc_rpt;
|
||||
report = cck_buf->cck_agc_rpt & 0xc0;
|
||||
report = report >> 6;
|
||||
switch (report) {
|
||||
case 0x3:
|
||||
rx_pwr_all = -46 - (cck_agc_rpt & 0x3e);
|
||||
break;
|
||||
case 0x2:
|
||||
rx_pwr_all = -26 - (cck_agc_rpt & 0x3e);
|
||||
break;
|
||||
case 0x1:
|
||||
rx_pwr_all = -12 - (cck_agc_rpt & 0x3e);
|
||||
break;
|
||||
case 0x0:
|
||||
rx_pwr_all = 16 - (cck_agc_rpt & 0x3e);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
u8 cck_agc_rpt = cck_buf->cck_agc_rpt;
|
||||
report = p_drvinfo->cfosho[0] & 0x60;
|
||||
report = report >> 5;
|
||||
switch (report) {
|
||||
case 0x3:
|
||||
rx_pwr_all = -46 - ((cck_agc_rpt & 0x1f) << 1);
|
||||
break;
|
||||
case 0x2:
|
||||
rx_pwr_all = -26 - ((cck_agc_rpt & 0x1f) << 1);
|
||||
break;
|
||||
case 0x1:
|
||||
rx_pwr_all = -12 - ((cck_agc_rpt & 0x1f) << 1);
|
||||
break;
|
||||
case 0x0:
|
||||
rx_pwr_all = 16 - ((cck_agc_rpt & 0x1f) << 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pwdb_all = rtl_query_rxpwrpercentage(rx_pwr_all);
|
||||
/* CCK gain is smaller than OFDM/MCS gain,
|
||||
* so we add gain diff by experiences,
|
||||
* the val is 6
|
||||
*/
|
||||
pwdb_all += 6;
|
||||
if (pwdb_all > 100)
|
||||
pwdb_all = 100;
|
||||
/* modify the offset to make the same
|
||||
* gain index with OFDM.
|
||||
*/
|
||||
if (pwdb_all > 34 && pwdb_all <= 42)
|
||||
pwdb_all -= 2;
|
||||
else if (pwdb_all > 26 && pwdb_all <= 34)
|
||||
pwdb_all -= 6;
|
||||
else if (pwdb_all > 14 && pwdb_all <= 26)
|
||||
pwdb_all -= 8;
|
||||
else if (pwdb_all > 4 && pwdb_all <= 14)
|
||||
pwdb_all -= 4;
|
||||
|
||||
pstats->rx_pwdb_all = pwdb_all;
|
||||
pstats->recvsignalpower = rx_pwr_all;
|
||||
|
||||
/* (3) Get Signal Quality (EVM) */
|
||||
if (packet_match_bssid) {
|
||||
u8 sq;
|
||||
if (pstats->rx_pwdb_all > 40)
|
||||
sq = 100;
|
||||
else {
|
||||
sq = cck_buf->sq_rpt;
|
||||
if (sq > 64)
|
||||
sq = 0;
|
||||
else if (sq < 20)
|
||||
sq = 100;
|
||||
else
|
||||
sq = ((64 - sq) * 100) / 44;
|
||||
}
|
||||
|
||||
pstats->signalquality = sq;
|
||||
pstats->rx_mimo_sig_qual[0] = sq;
|
||||
pstats->rx_mimo_sig_qual[1] = -1;
|
||||
}
|
||||
} else {
|
||||
rtlpriv->dm.rfpath_rxenable[0] =
|
||||
rtlpriv->dm.rfpath_rxenable[1] = true;
|
||||
/* (1)Get RSSI for HT rate */
|
||||
for (i = RF90_PATH_A; i < RF90_PATH_MAX; i++) {
|
||||
/* we will judge RF RX path now. */
|
||||
if (rtlpriv->dm.rfpath_rxenable[i])
|
||||
rf_rx_num++;
|
||||
|
||||
rx_pwr[i] =
|
||||
((p_drvinfo->gain_trsw[i] & 0x3f) * 2) - 110;
|
||||
/* Translate DBM to percentage. */
|
||||
rssi = _rtl92c_query_rxpwrpercentage(rx_pwr[i]);
|
||||
total_rssi += rssi;
|
||||
/* Get Rx snr value in DB */
|
||||
rtlpriv->stats.rx_snr_db[i] =
|
||||
(long)(p_drvinfo->rxsnr[i] / 2);
|
||||
|
||||
/* Record Signal Strength for next packet */
|
||||
if (packet_match_bssid)
|
||||
pstats->rx_mimo_signalstrength[i] = (u8) rssi;
|
||||
}
|
||||
|
||||
/* (2)PWDB, Average PWDB cacluated by
|
||||
* hardware (for rate adaptive)
|
||||
*/
|
||||
rx_pwr_all = ((p_drvinfo->pwdb_all >> 1) & 0x7f) - 110;
|
||||
pwdb_all = _rtl92c_query_rxpwrpercentage(rx_pwr_all);
|
||||
pstats->rx_pwdb_all = pwdb_all;
|
||||
pstats->rxpower = rx_pwr_all;
|
||||
pstats->recvsignalpower = rx_pwr_all;
|
||||
|
||||
/* (3)EVM of HT rate */
|
||||
if (pstats->is_ht && pstats->rate >= DESC92_RATEMCS8 &&
|
||||
pstats->rate <= DESC92_RATEMCS15)
|
||||
max_spatial_stream = 2;
|
||||
else
|
||||
max_spatial_stream = 1;
|
||||
|
||||
for (i = 0; i < max_spatial_stream; i++) {
|
||||
evm = _rtl92c_evm_db_to_percentage(p_drvinfo->rxevm[i]);
|
||||
|
||||
if (packet_match_bssid) {
|
||||
/* Fill value in RFD, Get the first
|
||||
* spatial stream only
|
||||
*/
|
||||
if (i == 0)
|
||||
pstats->signalquality =
|
||||
(u8) (evm & 0xff);
|
||||
pstats->rx_mimo_sig_qual[i] = (u8) (evm & 0xff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* UI BSS List signal strength(in percentage),
|
||||
* make it good looking, from 0~100.
|
||||
*/
|
||||
if (is_cck_rate)
|
||||
pstats->signalstrength =
|
||||
(u8) (_rtl92ce_signal_scale_mapping(hw, pwdb_all));
|
||||
else if (rf_rx_num != 0)
|
||||
pstats->signalstrength =
|
||||
(u8) (_rtl92ce_signal_scale_mapping
|
||||
(hw, total_rssi /= rf_rx_num));
|
||||
}
|
||||
|
||||
static void _rtl92ce_translate_rx_signal_stuff(struct ieee80211_hw *hw,
|
||||
struct sk_buff *skb,
|
||||
struct rtl_stats *pstats,
|
||||
struct rx_desc_92c *pdesc,
|
||||
struct rx_fwinfo_92c *p_drvinfo)
|
||||
{
|
||||
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
|
||||
struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
|
||||
|
||||
struct ieee80211_hdr *hdr;
|
||||
u8 *tmp_buf;
|
||||
u8 *praddr;
|
||||
__le16 fc;
|
||||
u16 type, c_fc;
|
||||
bool packet_matchbssid, packet_toself, packet_beacon = false;
|
||||
|
||||
tmp_buf = skb->data + pstats->rx_drvinfo_size + pstats->rx_bufshift;
|
||||
|
||||
hdr = (struct ieee80211_hdr *)tmp_buf;
|
||||
fc = hdr->frame_control;
|
||||
c_fc = le16_to_cpu(fc);
|
||||
type = WLAN_FC_GET_TYPE(fc);
|
||||
praddr = hdr->addr1;
|
||||
|
||||
packet_matchbssid =
|
||||
((IEEE80211_FTYPE_CTL != type) &&
|
||||
ether_addr_equal(mac->bssid,
|
||||
(c_fc & IEEE80211_FCTL_TODS) ? hdr->addr1 :
|
||||
(c_fc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 :
|
||||
hdr->addr3) &&
|
||||
(!pstats->hwerror) && (!pstats->crc) && (!pstats->icv));
|
||||
|
||||
packet_toself = packet_matchbssid &&
|
||||
ether_addr_equal(praddr, rtlefuse->dev_addr);
|
||||
|
||||
if (ieee80211_is_beacon(fc))
|
||||
packet_beacon = true;
|
||||
|
||||
_rtl92ce_query_rxphystatus(hw, pstats, pdesc, p_drvinfo,
|
||||
packet_matchbssid, packet_toself,
|
||||
packet_beacon);
|
||||
|
||||
rtl_process_phyinfo(hw, tmp_buf, pstats);
|
||||
}
|
||||
|
||||
bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw,
|
||||
struct rtl_stats *stats,
|
||||
struct ieee80211_rx_status *rx_status,
|
||||
u8 *p_desc, struct sk_buff *skb)
|
||||
{
|
||||
struct rx_fwinfo_92c *p_drvinfo;
|
||||
struct rx_desc_92c *pdesc = (struct rx_desc_92c *)p_desc;
|
||||
struct ieee80211_hdr *hdr;
|
||||
u32 phystatus = GET_RX_DESC_PHYST(pdesc);
|
||||
stats->length = (u16) GET_RX_DESC_PKT_LEN(pdesc);
|
||||
stats->rx_drvinfo_size = (u8) GET_RX_DESC_DRV_INFO_SIZE(pdesc) *
|
||||
RX_DRV_INFO_SIZE_UNIT;
|
||||
stats->rx_bufshift = (u8) (GET_RX_DESC_SHIFT(pdesc) & 0x03);
|
||||
stats->icv = (u16) GET_RX_DESC_ICV(pdesc);
|
||||
stats->crc = (u16) GET_RX_DESC_CRC32(pdesc);
|
||||
stats->hwerror = (stats->crc | stats->icv);
|
||||
stats->decrypted = !GET_RX_DESC_SWDEC(pdesc);
|
||||
stats->rate = (u8) GET_RX_DESC_RXMCS(pdesc);
|
||||
stats->shortpreamble = (u16) GET_RX_DESC_SPLCP(pdesc);
|
||||
stats->isampdu = (bool) (GET_RX_DESC_PAGGR(pdesc) == 1);
|
||||
stats->isfirst_ampdu = (bool) ((GET_RX_DESC_PAGGR(pdesc) == 1)
|
||||
&& (GET_RX_DESC_FAGGR(pdesc) == 1));
|
||||
stats->timestamp_low = GET_RX_DESC_TSFL(pdesc);
|
||||
stats->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc);
|
||||
stats->is_ht = (bool)GET_RX_DESC_RXHT(pdesc);
|
||||
|
||||
stats->is_cck = RX_HAL_IS_CCK_RATE(pdesc->rxmcs);
|
||||
|
||||
rx_status->freq = hw->conf.chandef.chan->center_freq;
|
||||
rx_status->band = hw->conf.chandef.chan->band;
|
||||
|
||||
hdr = (struct ieee80211_hdr *)(skb->data + stats->rx_drvinfo_size
|
||||
+ stats->rx_bufshift);
|
||||
|
||||
if (stats->crc)
|
||||
rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
|
||||
|
||||
if (stats->rx_is40Mhzpacket)
|
||||
rx_status->flag |= RX_FLAG_40MHZ;
|
||||
|
||||
if (stats->is_ht)
|
||||
rx_status->flag |= RX_FLAG_HT;
|
||||
|
||||
rx_status->flag |= RX_FLAG_MACTIME_START;
|
||||
|
||||
/* hw will set stats->decrypted true, if it finds the
|
||||
* frame is open data frame or mgmt frame.
|
||||
* So hw will not decryption robust managment frame
|
||||
* for IEEE80211w but still set status->decrypted
|
||||
* true, so here we should set it back to undecrypted
|
||||
* for IEEE80211w frame, and mac80211 sw will help
|
||||
* to decrypt it
|
||||
*/
|
||||
if (stats->decrypted) {
|
||||
if ((_ieee80211_is_robust_mgmt_frame(hdr)) &&
|
||||
(ieee80211_has_protected(hdr->frame_control)))
|
||||
rx_status->flag &= ~RX_FLAG_DECRYPTED;
|
||||
else
|
||||
rx_status->flag |= RX_FLAG_DECRYPTED;
|
||||
}
|
||||
/* rate_idx: index of data rate into band's
|
||||
* supported rates or MCS index if HT rates
|
||||
* are use (RX_FLAG_HT)
|
||||
* Notice: this is diff with windows define
|
||||
*/
|
||||
rx_status->rate_idx = rtlwifi_rate_mapping(hw,
|
||||
stats->is_ht, stats->rate,
|
||||
stats->isfirst_ampdu);
|
||||
|
||||
rx_status->mactime = stats->timestamp_low;
|
||||
if (phystatus) {
|
||||
p_drvinfo = (struct rx_fwinfo_92c *)(skb->data +
|
||||
stats->rx_bufshift);
|
||||
|
||||
_rtl92ce_translate_rx_signal_stuff(hw,
|
||||
skb, stats, pdesc,
|
||||
p_drvinfo);
|
||||
}
|
||||
|
||||
/*rx_status->qual = stats->signal; */
|
||||
rx_status->signal = stats->recvsignalpower + 10;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw,
|
||||
struct ieee80211_hdr *hdr, u8 *pdesc_tx,
|
||||
u8 *pbd_desc_tx, struct ieee80211_tx_info *info,
|
||||
struct ieee80211_sta *sta,
|
||||
struct sk_buff *skb,
|
||||
u8 hw_queue, struct rtl_tcb_desc *tcb_desc)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
|
||||
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
|
||||
struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
|
||||
bool defaultadapter = true;
|
||||
u8 *pdesc = pdesc_tx;
|
||||
u16 seq_number;
|
||||
__le16 fc = hdr->frame_control;
|
||||
u8 fw_qsel = _rtl92ce_map_hwqueue_to_fwqueue(skb, hw_queue);
|
||||
bool firstseg = ((hdr->seq_ctrl &
|
||||
cpu_to_le16(IEEE80211_SCTL_FRAG)) == 0);
|
||||
|
||||
bool lastseg = ((hdr->frame_control &
|
||||
cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)) == 0);
|
||||
|
||||
dma_addr_t mapping = pci_map_single(rtlpci->pdev,
|
||||
skb->data, skb->len,
|
||||
PCI_DMA_TODEVICE);
|
||||
|
||||
u8 bw_40 = 0;
|
||||
|
||||
if (pci_dma_mapping_error(rtlpci->pdev, mapping)) {
|
||||
RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
|
||||
"DMA mapping error");
|
||||
return;
|
||||
}
|
||||
rcu_read_lock();
|
||||
sta = get_sta(hw, mac->vif, mac->bssid);
|
||||
if (mac->opmode == NL80211_IFTYPE_STATION) {
|
||||
bw_40 = mac->bw_40;
|
||||
} else if (mac->opmode == NL80211_IFTYPE_AP ||
|
||||
mac->opmode == NL80211_IFTYPE_ADHOC ||
|
||||
mac->opmode == NL80211_IFTYPE_MESH_POINT) {
|
||||
if (sta)
|
||||
bw_40 = sta->bandwidth >= IEEE80211_STA_RX_BW_40;
|
||||
}
|
||||
|
||||
seq_number = (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4;
|
||||
|
||||
rtl_get_tcb_desc(hw, info, sta, skb, tcb_desc);
|
||||
|
||||
CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_92c));
|
||||
|
||||
if (ieee80211_is_nullfunc(fc) || ieee80211_is_ctl(fc)) {
|
||||
firstseg = true;
|
||||
lastseg = true;
|
||||
}
|
||||
if (firstseg) {
|
||||
SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN);
|
||||
|
||||
SET_TX_DESC_TX_RATE(pdesc, tcb_desc->hw_rate);
|
||||
|
||||
if (tcb_desc->use_shortgi || tcb_desc->use_shortpreamble)
|
||||
SET_TX_DESC_DATA_SHORTGI(pdesc, 1);
|
||||
|
||||
if (info->flags & IEEE80211_TX_CTL_AMPDU) {
|
||||
SET_TX_DESC_AGG_BREAK(pdesc, 1);
|
||||
SET_TX_DESC_MAX_AGG_NUM(pdesc, 0x14);
|
||||
}
|
||||
SET_TX_DESC_SEQ(pdesc, seq_number);
|
||||
|
||||
SET_TX_DESC_RTS_ENABLE(pdesc, ((tcb_desc->rts_enable &&
|
||||
!tcb_desc->
|
||||
cts_enable) ? 1 : 0));
|
||||
SET_TX_DESC_HW_RTS_ENABLE(pdesc,
|
||||
((tcb_desc->rts_enable
|
||||
|| tcb_desc->cts_enable) ? 1 : 0));
|
||||
SET_TX_DESC_CTS2SELF(pdesc, ((tcb_desc->cts_enable) ? 1 : 0));
|
||||
SET_TX_DESC_RTS_STBC(pdesc, ((tcb_desc->rts_stbc) ? 1 : 0));
|
||||
|
||||
SET_TX_DESC_RTS_RATE(pdesc, tcb_desc->rts_rate);
|
||||
SET_TX_DESC_RTS_BW(pdesc, 0);
|
||||
SET_TX_DESC_RTS_SC(pdesc, tcb_desc->rts_sc);
|
||||
SET_TX_DESC_RTS_SHORT(pdesc,
|
||||
((tcb_desc->rts_rate <= DESC92_RATE54M) ?
|
||||
(tcb_desc->rts_use_shortpreamble ? 1 : 0)
|
||||
: (tcb_desc->rts_use_shortgi ? 1 : 0)));
|
||||
|
||||
if (bw_40) {
|
||||
if (tcb_desc->packet_bw) {
|
||||
SET_TX_DESC_DATA_BW(pdesc, 1);
|
||||
SET_TX_DESC_TX_SUB_CARRIER(pdesc, 3);
|
||||
} else {
|
||||
SET_TX_DESC_DATA_BW(pdesc, 0);
|
||||
SET_TX_DESC_TX_SUB_CARRIER(pdesc,
|
||||
mac->cur_40_prime_sc);
|
||||
}
|
||||
} else {
|
||||
SET_TX_DESC_DATA_BW(pdesc, 0);
|
||||
SET_TX_DESC_TX_SUB_CARRIER(pdesc, 0);
|
||||
}
|
||||
|
||||
SET_TX_DESC_LINIP(pdesc, 0);
|
||||
SET_TX_DESC_PKT_SIZE(pdesc, (u16) skb->len);
|
||||
|
||||
if (sta) {
|
||||
u8 ampdu_density = sta->ht_cap.ampdu_density;
|
||||
SET_TX_DESC_AMPDU_DENSITY(pdesc, ampdu_density);
|
||||
}
|
||||
|
||||
if (info->control.hw_key) {
|
||||
struct ieee80211_key_conf *keyconf =
|
||||
info->control.hw_key;
|
||||
|
||||
switch (keyconf->cipher) {
|
||||
case WLAN_CIPHER_SUITE_WEP40:
|
||||
case WLAN_CIPHER_SUITE_WEP104:
|
||||
case WLAN_CIPHER_SUITE_TKIP:
|
||||
SET_TX_DESC_SEC_TYPE(pdesc, 0x1);
|
||||
break;
|
||||
case WLAN_CIPHER_SUITE_CCMP:
|
||||
SET_TX_DESC_SEC_TYPE(pdesc, 0x3);
|
||||
break;
|
||||
default:
|
||||
SET_TX_DESC_SEC_TYPE(pdesc, 0x0);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
SET_TX_DESC_PKT_ID(pdesc, 0);
|
||||
SET_TX_DESC_QUEUE_SEL(pdesc, fw_qsel);
|
||||
|
||||
SET_TX_DESC_DATA_RATE_FB_LIMIT(pdesc, 0x1F);
|
||||
SET_TX_DESC_RTS_RATE_FB_LIMIT(pdesc, 0xF);
|
||||
SET_TX_DESC_DISABLE_FB(pdesc, 0);
|
||||
SET_TX_DESC_USE_RATE(pdesc, tcb_desc->use_driver_rate ? 1 : 0);
|
||||
|
||||
if (ieee80211_is_data_qos(fc)) {
|
||||
if (mac->rdg_en) {
|
||||
RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
|
||||
"Enable RDG function\n");
|
||||
SET_TX_DESC_RDG_ENABLE(pdesc, 1);
|
||||
SET_TX_DESC_HTC(pdesc, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
rcu_read_unlock();
|
||||
|
||||
SET_TX_DESC_FIRST_SEG(pdesc, (firstseg ? 1 : 0));
|
||||
SET_TX_DESC_LAST_SEG(pdesc, (lastseg ? 1 : 0));
|
||||
|
||||
SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16) skb->len);
|
||||
|
||||
SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, mapping);
|
||||
|
||||
if (rtlpriv->dm.useramask) {
|
||||
SET_TX_DESC_RATE_ID(pdesc, tcb_desc->ratr_index);
|
||||
SET_TX_DESC_MACID(pdesc, tcb_desc->mac_id);
|
||||
} else {
|
||||
SET_TX_DESC_RATE_ID(pdesc, 0xC + tcb_desc->ratr_index);
|
||||
SET_TX_DESC_MACID(pdesc, tcb_desc->ratr_index);
|
||||
}
|
||||
|
||||
if ((!ieee80211_is_data_qos(fc)) && ppsc->fwctrl_lps) {
|
||||
SET_TX_DESC_HWSEQ_EN(pdesc, 1);
|
||||
SET_TX_DESC_PKT_ID(pdesc, 8);
|
||||
|
||||
if (!defaultadapter)
|
||||
SET_TX_DESC_QOS(pdesc, 1);
|
||||
}
|
||||
|
||||
SET_TX_DESC_MORE_FRAG(pdesc, (lastseg ? 0 : 1));
|
||||
|
||||
if (is_multicast_ether_addr(ieee80211_get_DA(hdr)) ||
|
||||
is_broadcast_ether_addr(ieee80211_get_DA(hdr))) {
|
||||
SET_TX_DESC_BMC(pdesc, 1);
|
||||
}
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "\n");
|
||||
}
|
||||
|
||||
void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw,
|
||||
u8 *pdesc, bool firstseg,
|
||||
bool lastseg, struct sk_buff *skb)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
|
||||
u8 fw_queue = QSLT_BEACON;
|
||||
|
||||
dma_addr_t mapping = pci_map_single(rtlpci->pdev,
|
||||
skb->data, skb->len,
|
||||
PCI_DMA_TODEVICE);
|
||||
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data);
|
||||
__le16 fc = hdr->frame_control;
|
||||
|
||||
if (pci_dma_mapping_error(rtlpci->pdev, mapping)) {
|
||||
RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
|
||||
"DMA mapping error");
|
||||
return;
|
||||
}
|
||||
CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE);
|
||||
|
||||
if (firstseg)
|
||||
SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN);
|
||||
|
||||
SET_TX_DESC_TX_RATE(pdesc, DESC92_RATE1M);
|
||||
|
||||
SET_TX_DESC_SEQ(pdesc, 0);
|
||||
|
||||
SET_TX_DESC_LINIP(pdesc, 0);
|
||||
|
||||
SET_TX_DESC_QUEUE_SEL(pdesc, fw_queue);
|
||||
|
||||
SET_TX_DESC_FIRST_SEG(pdesc, 1);
|
||||
SET_TX_DESC_LAST_SEG(pdesc, 1);
|
||||
|
||||
SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16) (skb->len));
|
||||
|
||||
SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, mapping);
|
||||
|
||||
SET_TX_DESC_RATE_ID(pdesc, 7);
|
||||
SET_TX_DESC_MACID(pdesc, 0);
|
||||
|
||||
SET_TX_DESC_OWN(pdesc, 1);
|
||||
|
||||
SET_TX_DESC_PKT_SIZE(pdesc, (u16) (skb->len));
|
||||
|
||||
SET_TX_DESC_FIRST_SEG(pdesc, 1);
|
||||
SET_TX_DESC_LAST_SEG(pdesc, 1);
|
||||
|
||||
SET_TX_DESC_OFFSET(pdesc, 0x20);
|
||||
|
||||
SET_TX_DESC_USE_RATE(pdesc, 1);
|
||||
|
||||
if (!ieee80211_is_data_qos(fc)) {
|
||||
SET_TX_DESC_HWSEQ_EN(pdesc, 1);
|
||||
SET_TX_DESC_PKT_ID(pdesc, 8);
|
||||
}
|
||||
|
||||
RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD,
|
||||
"H2C Tx Cmd Content", pdesc, TX_DESC_SIZE);
|
||||
}
|
||||
|
||||
void rtl92ce_set_desc(struct ieee80211_hw *hw, u8 *pdesc, bool istx,
|
||||
u8 desc_name, u8 *val)
|
||||
{
|
||||
if (istx) {
|
||||
switch (desc_name) {
|
||||
case HW_DESC_OWN:
|
||||
wmb();
|
||||
SET_TX_DESC_OWN(pdesc, 1);
|
||||
break;
|
||||
case HW_DESC_TX_NEXTDESC_ADDR:
|
||||
SET_TX_DESC_NEXT_DESC_ADDRESS(pdesc, *(u32 *) val);
|
||||
break;
|
||||
default:
|
||||
RT_ASSERT(false, "ERR txdesc :%d not process\n",
|
||||
desc_name);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (desc_name) {
|
||||
case HW_DESC_RXOWN:
|
||||
wmb();
|
||||
SET_RX_DESC_OWN(pdesc, 1);
|
||||
break;
|
||||
case HW_DESC_RXBUFF_ADDR:
|
||||
SET_RX_DESC_BUFF_ADDR(pdesc, *(u32 *) val);
|
||||
break;
|
||||
case HW_DESC_RXPKT_LEN:
|
||||
SET_RX_DESC_PKT_LEN(pdesc, *(u32 *) val);
|
||||
break;
|
||||
case HW_DESC_RXERO:
|
||||
SET_RX_DESC_EOR(pdesc, 1);
|
||||
break;
|
||||
default:
|
||||
RT_ASSERT(false, "ERR rxdesc :%d not process\n",
|
||||
desc_name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u32 rtl92ce_get_desc(u8 *p_desc, bool istx, u8 desc_name)
|
||||
{
|
||||
u32 ret = 0;
|
||||
|
||||
if (istx) {
|
||||
switch (desc_name) {
|
||||
case HW_DESC_OWN:
|
||||
ret = GET_TX_DESC_OWN(p_desc);
|
||||
break;
|
||||
case HW_DESC_TXBUFF_ADDR:
|
||||
ret = GET_TX_DESC_TX_BUFFER_ADDRESS(p_desc);
|
||||
break;
|
||||
default:
|
||||
RT_ASSERT(false, "ERR txdesc :%d not process\n",
|
||||
desc_name);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (desc_name) {
|
||||
case HW_DESC_OWN:
|
||||
ret = GET_RX_DESC_OWN(p_desc);
|
||||
break;
|
||||
case HW_DESC_RXPKT_LEN:
|
||||
ret = GET_RX_DESC_PKT_LEN(p_desc);
|
||||
break;
|
||||
case HW_DESC_RXBUFF_ADDR:
|
||||
ret = GET_RX_DESC_BUFF_ADDR(p_desc);
|
||||
break;
|
||||
default:
|
||||
RT_ASSERT(false, "ERR rxdesc :%d not process\n",
|
||||
desc_name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool rtl92ce_is_tx_desc_closed(struct ieee80211_hw *hw,
|
||||
u8 hw_queue, u16 index)
|
||||
{
|
||||
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
|
||||
struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[hw_queue];
|
||||
u8 *entry = (u8 *)(&ring->desc[ring->idx]);
|
||||
u8 own = (u8)rtl92ce_get_desc(entry, true, HW_DESC_OWN);
|
||||
|
||||
/*beacon packet will only use the first
|
||||
*descriptor defautly,and the own may not
|
||||
*be cleared by the hardware
|
||||
*/
|
||||
if (own)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void rtl92ce_tx_polling(struct ieee80211_hw *hw, u8 hw_queue)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
if (hw_queue == BEACON_QUEUE) {
|
||||
rtl_write_word(rtlpriv, REG_PCIE_CTRL_REG, BIT(4));
|
||||
} else {
|
||||
rtl_write_word(rtlpriv, REG_PCIE_CTRL_REG,
|
||||
BIT(0) << (hw_queue));
|
||||
}
|
||||
}
|
||||
|
732
drivers/net/wireless/rtlwifi/rtl8192ce/trx.h
Normal file
732
drivers/net/wireless/rtlwifi/rtl8192ce/trx.h
Normal file
|
@ -0,0 +1,732 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2009-2012 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
* Contact Information:
|
||||
* wlanfae <wlanfae@realtek.com>
|
||||
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
|
||||
* Hsinchu 300, Taiwan.
|
||||
*
|
||||
* Larry Finger <Larry.Finger@lwfinger.net>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __RTL92CE_TRX_H__
|
||||
#define __RTL92CE_TRX_H__
|
||||
|
||||
#define TX_DESC_SIZE 64
|
||||
#define TX_DESC_AGGR_SUBFRAME_SIZE 32
|
||||
|
||||
#define RX_DESC_SIZE 32
|
||||
#define RX_DRV_INFO_SIZE_UNIT 8
|
||||
|
||||
#define TX_DESC_NEXT_DESC_OFFSET 40
|
||||
#define USB_HWDESC_HEADER_LEN 32
|
||||
#define CRCLENGTH 4
|
||||
|
||||
/* Define a macro that takes a le32 word, converts it to host ordering,
|
||||
* right shifts by a specified count, creates a mask of the specified
|
||||
* bit count, and extracts that number of bits.
|
||||
*/
|
||||
|
||||
#define SHIFT_AND_MASK_LE(__pdesc, __shift, __mask) \
|
||||
((le32_to_cpu(*(((__le32 *)(__pdesc)))) >> (__shift)) & \
|
||||
BIT_LEN_MASK_32(__mask))
|
||||
|
||||
/* Define a macro that clears a bit field in an le32 word and
|
||||
* sets the specified value into that bit field. The resulting
|
||||
* value remains in le32 ordering; however, it is properly converted
|
||||
* to host ordering for the clear and set operations before conversion
|
||||
* back to le32.
|
||||
*/
|
||||
|
||||
#define SET_BITS_OFFSET_LE(__pdesc, __shift, __len, __val) \
|
||||
(*(__le32 *)(__pdesc) = \
|
||||
(cpu_to_le32((le32_to_cpu(*((__le32 *)(__pdesc))) & \
|
||||
(~(BIT_OFFSET_LEN_MASK_32((__shift), __len)))) | \
|
||||
(((u32)(__val) & BIT_LEN_MASK_32(__len)) << (__shift)))));
|
||||
|
||||
/* macros to read/write various fields in RX or TX descriptors */
|
||||
|
||||
#define SET_TX_DESC_PKT_SIZE(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc, 0, 16, __val)
|
||||
#define SET_TX_DESC_OFFSET(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc, 16, 8, __val)
|
||||
#define SET_TX_DESC_BMC(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc, 24, 1, __val)
|
||||
#define SET_TX_DESC_HTC(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc, 25, 1, __val)
|
||||
#define SET_TX_DESC_LAST_SEG(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc, 26, 1, __val)
|
||||
#define SET_TX_DESC_FIRST_SEG(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc, 27, 1, __val)
|
||||
#define SET_TX_DESC_LINIP(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc, 28, 1, __val)
|
||||
#define SET_TX_DESC_NO_ACM(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc, 29, 1, __val)
|
||||
#define SET_TX_DESC_GF(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc, 30, 1, __val)
|
||||
#define SET_TX_DESC_OWN(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc, 31, 1, __val)
|
||||
|
||||
#define GET_TX_DESC_PKT_SIZE(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 0, 16)
|
||||
#define GET_TX_DESC_OFFSET(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 16, 8)
|
||||
#define GET_TX_DESC_BMC(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 24, 1)
|
||||
#define GET_TX_DESC_HTC(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 25, 1)
|
||||
#define GET_TX_DESC_LAST_SEG(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 26, 1)
|
||||
#define GET_TX_DESC_FIRST_SEG(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 27, 1)
|
||||
#define GET_TX_DESC_LINIP(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 28, 1)
|
||||
#define GET_TX_DESC_NO_ACM(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 29, 1)
|
||||
#define GET_TX_DESC_GF(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 30, 1)
|
||||
#define GET_TX_DESC_OWN(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 31, 1)
|
||||
|
||||
#define SET_TX_DESC_MACID(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+4, 0, 5, __val)
|
||||
#define SET_TX_DESC_AGG_BREAK(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+4, 5, 1, __val)
|
||||
#define SET_TX_DESC_BK(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+4, 6, 1, __val)
|
||||
#define SET_TX_DESC_RDG_ENABLE(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+4, 7, 1, __val)
|
||||
#define SET_TX_DESC_QUEUE_SEL(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+4, 8, 5, __val)
|
||||
#define SET_TX_DESC_RDG_NAV_EXT(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+4, 13, 1, __val)
|
||||
#define SET_TX_DESC_LSIG_TXOP_EN(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+4, 14, 1, __val)
|
||||
#define SET_TX_DESC_PIFS(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+4, 15, 1, __val)
|
||||
#define SET_TX_DESC_RATE_ID(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+4, 16, 4, __val)
|
||||
#define SET_TX_DESC_NAV_USE_HDR(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+4, 20, 1, __val)
|
||||
#define SET_TX_DESC_EN_DESC_ID(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+4, 21, 1, __val)
|
||||
#define SET_TX_DESC_SEC_TYPE(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+4, 22, 2, __val)
|
||||
#define SET_TX_DESC_PKT_OFFSET(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+4, 24, 8, __val)
|
||||
|
||||
#define GET_TX_DESC_MACID(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 0, 5)
|
||||
#define GET_TX_DESC_AGG_ENABLE(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 5, 1)
|
||||
#define GET_TX_DESC_AGG_BREAK(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 6, 1)
|
||||
#define GET_TX_DESC_RDG_ENABLE(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 7, 1)
|
||||
#define GET_TX_DESC_QUEUE_SEL(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 8, 5)
|
||||
#define GET_TX_DESC_RDG_NAV_EXT(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 13, 1)
|
||||
#define GET_TX_DESC_LSIG_TXOP_EN(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 14, 1)
|
||||
#define GET_TX_DESC_PIFS(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 15, 1)
|
||||
#define GET_TX_DESC_RATE_ID(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 16, 4)
|
||||
#define GET_TX_DESC_NAV_USE_HDR(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 20, 1)
|
||||
#define GET_TX_DESC_EN_DESC_ID(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 21, 1)
|
||||
#define GET_TX_DESC_SEC_TYPE(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 22, 2)
|
||||
#define GET_TX_DESC_PKT_OFFSET(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 24, 8)
|
||||
|
||||
#define SET_TX_DESC_RTS_RC(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+8, 0, 6, __val)
|
||||
#define SET_TX_DESC_DATA_RC(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+8, 6, 6, __val)
|
||||
#define SET_TX_DESC_BAR_RTY_TH(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+8, 14, 2, __val)
|
||||
#define SET_TX_DESC_MORE_FRAG(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+8, 17, 1, __val)
|
||||
#define SET_TX_DESC_RAW(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+8, 18, 1, __val)
|
||||
#define SET_TX_DESC_CCX(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+8, 19, 1, __val)
|
||||
#define SET_TX_DESC_AMPDU_DENSITY(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+8, 20, 3, __val)
|
||||
#define SET_TX_DESC_ANTSEL_A(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+8, 24, 1, __val)
|
||||
#define SET_TX_DESC_ANTSEL_B(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+8, 25, 1, __val)
|
||||
#define SET_TX_DESC_TX_ANT_CCK(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+8, 26, 2, __val)
|
||||
#define SET_TX_DESC_TX_ANTL(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+8, 28, 2, __val)
|
||||
#define SET_TX_DESC_TX_ANT_HT(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+8, 30, 2, __val)
|
||||
|
||||
#define GET_TX_DESC_RTS_RC(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+8, 0, 6)
|
||||
#define GET_TX_DESC_DATA_RC(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+8, 6, 6)
|
||||
#define GET_TX_DESC_BAR_RTY_TH(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+8, 14, 2)
|
||||
#define GET_TX_DESC_MORE_FRAG(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+8, 17, 1)
|
||||
#define GET_TX_DESC_RAW(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+8, 18, 1)
|
||||
#define GET_TX_DESC_CCX(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+8, 19, 1)
|
||||
#define GET_TX_DESC_AMPDU_DENSITY(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+8, 20, 3)
|
||||
#define GET_TX_DESC_ANTSEL_A(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+8, 24, 1)
|
||||
#define GET_TX_DESC_ANTSEL_B(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+8, 25, 1)
|
||||
#define GET_TX_DESC_TX_ANT_CCK(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+8, 26, 2)
|
||||
#define GET_TX_DESC_TX_ANTL(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+8, 28, 2)
|
||||
#define GET_TX_DESC_TX_ANT_HT(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+8, 30, 2)
|
||||
|
||||
#define SET_TX_DESC_NEXT_HEAP_PAGE(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+12, 0, 8, __val)
|
||||
#define SET_TX_DESC_TAIL_PAGE(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+12, 8, 8, __val)
|
||||
#define SET_TX_DESC_SEQ(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+12, 16, 12, __val)
|
||||
#define SET_TX_DESC_PKT_ID(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+12, 28, 4, __val)
|
||||
|
||||
#define GET_TX_DESC_NEXT_HEAP_PAGE(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+12, 0, 8)
|
||||
#define GET_TX_DESC_TAIL_PAGE(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+12, 8, 8)
|
||||
#define GET_TX_DESC_SEQ(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+12, 16, 12)
|
||||
#define GET_TX_DESC_PKT_ID(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+12, 28, 4)
|
||||
|
||||
#define SET_TX_DESC_RTS_RATE(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 0, 5, __val)
|
||||
#define SET_TX_DESC_AP_DCFE(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 5, 1, __val)
|
||||
#define SET_TX_DESC_QOS(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 6, 1, __val)
|
||||
#define SET_TX_DESC_HWSEQ_EN(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 7, 1, __val)
|
||||
#define SET_TX_DESC_USE_RATE(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 8, 1, __val)
|
||||
#define SET_TX_DESC_DISABLE_RTS_FB(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 9, 1, __val)
|
||||
#define SET_TX_DESC_DISABLE_FB(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 10, 1, __val)
|
||||
#define SET_TX_DESC_CTS2SELF(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 11, 1, __val)
|
||||
#define SET_TX_DESC_RTS_ENABLE(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 12, 1, __val)
|
||||
#define SET_TX_DESC_HW_RTS_ENABLE(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 13, 1, __val)
|
||||
#define SET_TX_DESC_PORT_ID(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 14, 1, __val)
|
||||
#define SET_TX_DESC_WAIT_DCTS(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 18, 1, __val)
|
||||
#define SET_TX_DESC_CTS2AP_EN(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 19, 1, __val)
|
||||
#define SET_TX_DESC_TX_SUB_CARRIER(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 20, 2, __val)
|
||||
#define SET_TX_DESC_TX_STBC(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 22, 2, __val)
|
||||
#define SET_TX_DESC_DATA_SHORT(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 24, 1, __val)
|
||||
#define SET_TX_DESC_DATA_BW(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 25, 1, __val)
|
||||
#define SET_TX_DESC_RTS_SHORT(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 26, 1, __val)
|
||||
#define SET_TX_DESC_RTS_BW(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 27, 1, __val)
|
||||
#define SET_TX_DESC_RTS_SC(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 28, 2, __val)
|
||||
#define SET_TX_DESC_RTS_STBC(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+16, 30, 2, __val)
|
||||
|
||||
#define GET_TX_DESC_RTS_RATE(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 0, 5)
|
||||
#define GET_TX_DESC_AP_DCFE(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 5, 1)
|
||||
#define GET_TX_DESC_QOS(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 6, 1)
|
||||
#define GET_TX_DESC_HWSEQ_EN(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 7, 1)
|
||||
#define GET_TX_DESC_USE_RATE(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 8, 1)
|
||||
#define GET_TX_DESC_DISABLE_RTS_FB(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 9, 1)
|
||||
#define GET_TX_DESC_DISABLE_FB(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 10, 1)
|
||||
#define GET_TX_DESC_CTS2SELF(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 11, 1)
|
||||
#define GET_TX_DESC_RTS_ENABLE(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 12, 1)
|
||||
#define GET_TX_DESC_HW_RTS_ENABLE(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 13, 1)
|
||||
#define GET_TX_DESC_PORT_ID(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 14, 1)
|
||||
#define GET_TX_DESC_WAIT_DCTS(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 18, 1)
|
||||
#define GET_TX_DESC_CTS2AP_EN(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 19, 1)
|
||||
#define GET_TX_DESC_TX_SUB_CARRIER(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 20, 2)
|
||||
#define GET_TX_DESC_TX_STBC(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 22, 2)
|
||||
#define GET_TX_DESC_DATA_SHORT(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 24, 1)
|
||||
#define GET_TX_DESC_DATA_BW(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 25, 1)
|
||||
#define GET_TX_DESC_RTS_SHORT(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 26, 1)
|
||||
#define GET_TX_DESC_RTS_BW(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 27, 1)
|
||||
#define GET_TX_DESC_RTS_SC(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 28, 2)
|
||||
#define GET_TX_DESC_RTS_STBC(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 30, 2)
|
||||
|
||||
#define SET_TX_DESC_TX_RATE(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+20, 0, 6, __val)
|
||||
#define SET_TX_DESC_DATA_SHORTGI(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+20, 6, 1, __val)
|
||||
#define SET_TX_DESC_CCX_TAG(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+20, 7, 1, __val)
|
||||
#define SET_TX_DESC_DATA_RATE_FB_LIMIT(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+20, 8, 5, __val)
|
||||
#define SET_TX_DESC_RTS_RATE_FB_LIMIT(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+20, 13, 4, __val)
|
||||
#define SET_TX_DESC_RETRY_LIMIT_ENABLE(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+20, 17, 1, __val)
|
||||
#define SET_TX_DESC_DATA_RETRY_LIMIT(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+20, 18, 6, __val)
|
||||
#define SET_TX_DESC_USB_TXAGG_NUM(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+20, 24, 8, __val)
|
||||
|
||||
#define GET_TX_DESC_TX_RATE(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+20, 0, 6)
|
||||
#define GET_TX_DESC_DATA_SHORTGI(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+20, 6, 1)
|
||||
#define GET_TX_DESC_CCX_TAG(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+20, 7, 1)
|
||||
#define GET_TX_DESC_DATA_RATE_FB_LIMIT(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+20, 8, 5)
|
||||
#define GET_TX_DESC_RTS_RATE_FB_LIMIT(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+20, 13, 4)
|
||||
#define GET_TX_DESC_RETRY_LIMIT_ENABLE(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+20, 17, 1)
|
||||
#define GET_TX_DESC_DATA_RETRY_LIMIT(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+20, 18, 6)
|
||||
#define GET_TX_DESC_USB_TXAGG_NUM(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+20, 24, 8)
|
||||
|
||||
#define SET_TX_DESC_TXAGC_A(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+24, 0, 5, __val)
|
||||
#define SET_TX_DESC_TXAGC_B(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+24, 5, 5, __val)
|
||||
#define SET_TX_DESC_USE_MAX_LEN(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+24, 10, 1, __val)
|
||||
#define SET_TX_DESC_MAX_AGG_NUM(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+24, 11, 5, __val)
|
||||
#define SET_TX_DESC_MCSG1_MAX_LEN(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+24, 16, 4, __val)
|
||||
#define SET_TX_DESC_MCSG2_MAX_LEN(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+24, 20, 4, __val)
|
||||
#define SET_TX_DESC_MCSG3_MAX_LEN(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+24, 24, 4, __val)
|
||||
#define SET_TX_DESC_MCS7_SGI_MAX_LEN(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+24, 28, 4, __val)
|
||||
|
||||
#define GET_TX_DESC_TXAGC_A(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+24, 0, 5)
|
||||
#define GET_TX_DESC_TXAGC_B(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+24, 5, 5)
|
||||
#define GET_TX_DESC_USE_MAX_LEN(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+24, 10, 1)
|
||||
#define GET_TX_DESC_MAX_AGG_NUM(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+24, 11, 5)
|
||||
#define GET_TX_DESC_MCSG1_MAX_LEN(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+24, 16, 4)
|
||||
#define GET_TX_DESC_MCSG2_MAX_LEN(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+24, 20, 4)
|
||||
#define GET_TX_DESC_MCSG3_MAX_LEN(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+24, 24, 4)
|
||||
#define GET_TX_DESC_MCS7_SGI_MAX_LEN(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+24, 28, 4)
|
||||
|
||||
#define SET_TX_DESC_TX_BUFFER_SIZE(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+28, 0, 16, __val)
|
||||
#define SET_TX_DESC_MCSG4_MAX_LEN(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+28, 16, 4, __val)
|
||||
#define SET_TX_DESC_MCSG5_MAX_LEN(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+28, 20, 4, __val)
|
||||
#define SET_TX_DESC_MCSG6_MAX_LEN(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+28, 24, 4, __val)
|
||||
#define SET_TX_DESC_MCS15_SGI_MAX_LEN(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+28, 28, 4, __val)
|
||||
|
||||
#define GET_TX_DESC_TX_BUFFER_SIZE(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+28, 0, 16)
|
||||
#define GET_TX_DESC_MCSG4_MAX_LEN(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+28, 16, 4)
|
||||
#define GET_TX_DESC_MCSG5_MAX_LEN(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+28, 20, 4)
|
||||
#define GET_TX_DESC_MCSG6_MAX_LEN(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+28, 24, 4)
|
||||
#define GET_TX_DESC_MCS15_SGI_MAX_LEN(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+28, 28, 4)
|
||||
|
||||
#define SET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+32, 0, 32, __val)
|
||||
#define SET_TX_DESC_TX_BUFFER_ADDRESS64(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+36, 0, 32, __val)
|
||||
|
||||
#define GET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+32, 0, 32)
|
||||
#define GET_TX_DESC_TX_BUFFER_ADDRESS64(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+36, 0, 32)
|
||||
|
||||
#define SET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+40, 0, 32, __val)
|
||||
#define SET_TX_DESC_NEXT_DESC_ADDRESS64(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+44, 0, 32, __val)
|
||||
|
||||
#define GET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+40, 0, 32)
|
||||
#define GET_TX_DESC_NEXT_DESC_ADDRESS64(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+44, 0, 32)
|
||||
|
||||
#define GET_RX_DESC_PKT_LEN(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 0, 14)
|
||||
#define GET_RX_DESC_CRC32(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 14, 1)
|
||||
#define GET_RX_DESC_ICV(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 15, 1)
|
||||
#define GET_RX_DESC_DRV_INFO_SIZE(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 16, 4)
|
||||
#define GET_RX_DESC_SECURITY(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 20, 3)
|
||||
#define GET_RX_DESC_QOS(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 23, 1)
|
||||
#define GET_RX_DESC_SHIFT(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 24, 2)
|
||||
#define GET_RX_DESC_PHYST(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 26, 1)
|
||||
#define GET_RX_DESC_SWDEC(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 27, 1)
|
||||
#define GET_RX_DESC_LS(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 28, 1)
|
||||
#define GET_RX_DESC_FS(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 29, 1)
|
||||
#define GET_RX_DESC_EOR(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 30, 1)
|
||||
#define GET_RX_DESC_OWN(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc, 31, 1)
|
||||
|
||||
#define SET_RX_DESC_PKT_LEN(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc, 0, 14, __val)
|
||||
#define SET_RX_DESC_EOR(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc, 30, 1, __val)
|
||||
#define SET_RX_DESC_OWN(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc, 31, 1, __val)
|
||||
|
||||
#define GET_RX_DESC_MACID(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 0, 5)
|
||||
#define GET_RX_DESC_TID(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 5, 4)
|
||||
#define GET_RX_DESC_HWRSVD(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 9, 5)
|
||||
#define GET_RX_DESC_PAGGR(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 14, 1)
|
||||
#define GET_RX_DESC_FAGGR(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 15, 1)
|
||||
#define GET_RX_DESC_A1_FIT(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 16, 4)
|
||||
#define GET_RX_DESC_A2_FIT(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 20, 4)
|
||||
#define GET_RX_DESC_PAM(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 24, 1)
|
||||
#define GET_RX_DESC_PWR(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 25, 1)
|
||||
#define GET_RX_DESC_MD(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 26, 1)
|
||||
#define GET_RX_DESC_MF(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 27, 1)
|
||||
#define GET_RX_DESC_TYPE(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 28, 2)
|
||||
#define GET_RX_DESC_MC(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 30, 1)
|
||||
#define GET_RX_DESC_BC(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+4, 31, 1)
|
||||
#define GET_RX_DESC_SEQ(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+8, 0, 12)
|
||||
#define GET_RX_DESC_FRAG(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+8, 12, 4)
|
||||
#define GET_RX_DESC_NEXT_PKT_LEN(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+8, 16, 14)
|
||||
#define GET_RX_DESC_NEXT_IND(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+8, 30, 1)
|
||||
#define GET_RX_DESC_RSVD(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+8, 31, 1)
|
||||
|
||||
#define GET_RX_DESC_RXMCS(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+12, 0, 6)
|
||||
#define GET_RX_DESC_RXHT(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+12, 6, 1)
|
||||
#define GET_RX_DESC_SPLCP(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+12, 8, 1)
|
||||
#define GET_RX_DESC_BW(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+12, 9, 1)
|
||||
#define GET_RX_DESC_HTC(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+12, 10, 1)
|
||||
#define GET_RX_DESC_HWPC_ERR(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+12, 14, 1)
|
||||
#define GET_RX_DESC_HWPC_IND(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+12, 15, 1)
|
||||
#define GET_RX_DESC_IV0(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+12, 16, 16)
|
||||
|
||||
#define GET_RX_DESC_IV1(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+16, 0, 32)
|
||||
#define GET_RX_DESC_TSFL(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+20, 0, 32)
|
||||
|
||||
#define GET_RX_DESC_BUFF_ADDR(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+24, 0, 32)
|
||||
#define GET_RX_DESC_BUFF_ADDR64(__pdesc) \
|
||||
SHIFT_AND_MASK_LE(__pdesc+28, 0, 32)
|
||||
|
||||
#define SET_RX_DESC_BUFF_ADDR(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+24, 0, 32, __val)
|
||||
#define SET_RX_DESC_BUFF_ADDR64(__pdesc, __val) \
|
||||
SET_BITS_OFFSET_LE(__pdesc+28, 0, 32, __val)
|
||||
|
||||
#define CLEAR_PCI_TX_DESC_CONTENT(__pdesc, _size) \
|
||||
memset(__pdesc, 0, min_t(size_t, _size, TX_DESC_NEXT_DESC_OFFSET))
|
||||
|
||||
struct rx_fwinfo_92c {
|
||||
u8 gain_trsw[4];
|
||||
u8 pwdb_all;
|
||||
u8 cfosho[4];
|
||||
u8 cfotail[4];
|
||||
char rxevm[2];
|
||||
char rxsnr[4];
|
||||
u8 pdsnr[2];
|
||||
u8 csi_current[2];
|
||||
u8 csi_target[2];
|
||||
u8 sigevm;
|
||||
u8 max_ex_pwr;
|
||||
u8 ex_intf_flag:1;
|
||||
u8 sgi_en:1;
|
||||
u8 rxsc:2;
|
||||
u8 reserve:4;
|
||||
} __packed;
|
||||
|
||||
struct tx_desc_92c {
|
||||
u32 pktsize:16;
|
||||
u32 offset:8;
|
||||
u32 bmc:1;
|
||||
u32 htc:1;
|
||||
u32 lastseg:1;
|
||||
u32 firstseg:1;
|
||||
u32 linip:1;
|
||||
u32 noacm:1;
|
||||
u32 gf:1;
|
||||
u32 own:1;
|
||||
|
||||
u32 macid:5;
|
||||
u32 agg_en:1;
|
||||
u32 bk:1;
|
||||
u32 rdg_en:1;
|
||||
u32 queuesel:5;
|
||||
u32 rd_nav_ext:1;
|
||||
u32 lsig_txop_en:1;
|
||||
u32 pifs:1;
|
||||
u32 rateid:4;
|
||||
u32 nav_usehdr:1;
|
||||
u32 en_descid:1;
|
||||
u32 sectype:2;
|
||||
u32 pktoffset:8;
|
||||
|
||||
u32 rts_rc:6;
|
||||
u32 data_rc:6;
|
||||
u32 rsvd0:2;
|
||||
u32 bar_retryht:2;
|
||||
u32 rsvd1:1;
|
||||
u32 morefrag:1;
|
||||
u32 raw:1;
|
||||
u32 ccx:1;
|
||||
u32 ampdudensity:3;
|
||||
u32 rsvd2:1;
|
||||
u32 ant_sela:1;
|
||||
u32 ant_selb:1;
|
||||
u32 txant_cck:2;
|
||||
u32 txant_l:2;
|
||||
u32 txant_ht:2;
|
||||
|
||||
u32 nextheadpage:8;
|
||||
u32 tailpage:8;
|
||||
u32 seq:12;
|
||||
u32 pktid:4;
|
||||
|
||||
u32 rtsrate:5;
|
||||
u32 apdcfe:1;
|
||||
u32 qos:1;
|
||||
u32 hwseq_enable:1;
|
||||
u32 userrate:1;
|
||||
u32 dis_rtsfb:1;
|
||||
u32 dis_datafb:1;
|
||||
u32 cts2self:1;
|
||||
u32 rts_en:1;
|
||||
u32 hwrts_en:1;
|
||||
u32 portid:1;
|
||||
u32 rsvd3:3;
|
||||
u32 waitdcts:1;
|
||||
u32 cts2ap_en:1;
|
||||
u32 txsc:2;
|
||||
u32 stbc:2;
|
||||
u32 txshort:1;
|
||||
u32 txbw:1;
|
||||
u32 rtsshort:1;
|
||||
u32 rtsbw:1;
|
||||
u32 rtssc:2;
|
||||
u32 rtsstbc:2;
|
||||
|
||||
u32 txrate:6;
|
||||
u32 shortgi:1;
|
||||
u32 ccxt:1;
|
||||
u32 txrate_fb_lmt:5;
|
||||
u32 rtsrate_fb_lmt:4;
|
||||
u32 retrylmt_en:1;
|
||||
u32 txretrylmt:6;
|
||||
u32 usb_txaggnum:8;
|
||||
|
||||
u32 txagca:5;
|
||||
u32 txagcb:5;
|
||||
u32 usemaxlen:1;
|
||||
u32 maxaggnum:5;
|
||||
u32 mcsg1maxlen:4;
|
||||
u32 mcsg2maxlen:4;
|
||||
u32 mcsg3maxlen:4;
|
||||
u32 mcs7sgimaxlen:4;
|
||||
|
||||
u32 txbuffersize:16;
|
||||
u32 mcsg4maxlen:4;
|
||||
u32 mcsg5maxlen:4;
|
||||
u32 mcsg6maxlen:4;
|
||||
u32 mcsg15sgimaxlen:4;
|
||||
|
||||
u32 txbuffaddr;
|
||||
u32 txbufferaddr64;
|
||||
u32 nextdescaddress;
|
||||
u32 nextdescaddress64;
|
||||
|
||||
u32 reserve_pass_pcie_mm_limit[4];
|
||||
} __packed;
|
||||
|
||||
struct rx_desc_92c {
|
||||
u32 length:14;
|
||||
u32 crc32:1;
|
||||
u32 icverror:1;
|
||||
u32 drv_infosize:4;
|
||||
u32 security:3;
|
||||
u32 qos:1;
|
||||
u32 shift:2;
|
||||
u32 phystatus:1;
|
||||
u32 swdec:1;
|
||||
u32 lastseg:1;
|
||||
u32 firstseg:1;
|
||||
u32 eor:1;
|
||||
u32 own:1;
|
||||
|
||||
u32 macid:5;
|
||||
u32 tid:4;
|
||||
u32 hwrsvd:5;
|
||||
u32 paggr:1;
|
||||
u32 faggr:1;
|
||||
u32 a1_fit:4;
|
||||
u32 a2_fit:4;
|
||||
u32 pam:1;
|
||||
u32 pwr:1;
|
||||
u32 moredata:1;
|
||||
u32 morefrag:1;
|
||||
u32 type:2;
|
||||
u32 mc:1;
|
||||
u32 bc:1;
|
||||
|
||||
u32 seq:12;
|
||||
u32 frag:4;
|
||||
u32 nextpktlen:14;
|
||||
u32 nextind:1;
|
||||
u32 rsvd:1;
|
||||
|
||||
u32 rxmcs:6;
|
||||
u32 rxht:1;
|
||||
u32 amsdu:1;
|
||||
u32 splcp:1;
|
||||
u32 bandwidth:1;
|
||||
u32 htc:1;
|
||||
u32 tcpchk_rpt:1;
|
||||
u32 ipcchk_rpt:1;
|
||||
u32 tcpchk_valid:1;
|
||||
u32 hwpcerr:1;
|
||||
u32 hwpcind:1;
|
||||
u32 iv0:16;
|
||||
|
||||
u32 iv1;
|
||||
|
||||
u32 tsfl;
|
||||
|
||||
u32 bufferaddress;
|
||||
u32 bufferaddress64;
|
||||
|
||||
} __packed;
|
||||
|
||||
void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw,
|
||||
struct ieee80211_hdr *hdr, u8 *pdesc,
|
||||
u8 *pbd_desc_tx, struct ieee80211_tx_info *info,
|
||||
struct ieee80211_sta *sta,
|
||||
struct sk_buff *skb, u8 hw_queue,
|
||||
struct rtl_tcb_desc *ptcb_desc);
|
||||
bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw,
|
||||
struct rtl_stats *stats,
|
||||
struct ieee80211_rx_status *rx_status,
|
||||
u8 *pdesc, struct sk_buff *skb);
|
||||
void rtl92ce_set_desc(struct ieee80211_hw *hw, u8 *pdesc, bool istx,
|
||||
u8 desc_name, u8 *val);
|
||||
u32 rtl92ce_get_desc(u8 *pdesc, bool istx, u8 desc_name);
|
||||
bool rtl92ce_is_tx_desc_closed(struct ieee80211_hw *hw,
|
||||
u8 hw_queue, u16 index);
|
||||
void rtl92ce_tx_polling(struct ieee80211_hw *hw, u8 hw_queue);
|
||||
void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
|
||||
bool b_firstseg, bool b_lastseg,
|
||||
struct sk_buff *skb);
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue