rtl8188eu: Revert part of 76e49ee

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2013-05-26 12:17:22 -05:00
parent 76e49eeec2
commit eac0a699d8
16 changed files with 1004 additions and 86 deletions

View file

@ -2138,6 +2138,11 @@ _func_enter_;
mlmeext_sta_add_event_callback(adapter, psta);
#ifdef CONFIG_RTL8711
//submit SetStaKey_cmd to tell fw, fw will allocate an CAM entry for this sta
rtw_setstakey_cmd(adapter, (unsigned char*)psta, false);
#endif
exit:
_func_exit_;
@ -3442,6 +3447,14 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui
AMPDU_para [4:2]:Min MPDU Start Spacing
*/
/*
#if defined(CONFIG_RTL8188E )&& defined (CONFIG_SDIO_HCI)
ht_capie.ampdu_params_info = 2;
#else
ht_capie.ampdu_params_info = (IEEE80211_HT_CAP_AMPDU_FACTOR&0x03);
#endif
*/
rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor);
ht_capie.ampdu_params_info = (max_rx_ampdu_factor&0x03);
@ -3453,10 +3466,17 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui
pframe = rtw_set_ie(out_ie+out_len, _HT_CAPABILITY_IE_,
sizeof(struct rtw_ieee80211_ht_cap), (unsigned char*)&ht_capie, pout_len);
//_rtw_memcpy(out_ie+out_len, p, ielen+2);//gtest
//*pout_len = *pout_len + (ielen+2);
phtpriv->ht_option = true;
p = rtw_get_ie(in_ie+12, _HT_ADD_INFO_IE_, &ielen, in_len-12);
if (p && (ielen==sizeof(struct ieee80211_ht_addt_info))) {
if (p && (ielen==sizeof(struct ieee80211_ht_addt_info)))
{
out_len = *pout_len;
pframe = rtw_set_ie(out_ie+out_len, _HT_ADD_INFO_IE_, ielen, p+2 , pout_len);
}

View file

@ -8089,16 +8089,24 @@ void issue_action_BA(_adapter *padapter, unsigned char *raddr, unsigned char act
else
#endif
{
#if defined(CONFIG_RTL8188E) && defined(CONFIG_SDIO_HCI)
BA_para_set = (0x0802 | ((status & 0xf) << 2)); //immediate ack & 16 buffer size
#else
BA_para_set = (0x1002 | ((status & 0xf) << 2)); //immediate ack & 64 buffer size
#endif
}
//sys_mib.BA_para_set = 0x0802; //immediate ack & 32 buffer size
BA_para_set = cpu_to_le16(BA_para_set);
pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_para_set)), &(pattrib->pktlen));
//BA_timeout_value = 0xffff;//max: 65535 TUs(~ 65 ms)
BA_timeout_value = 5000;//~ 5ms
BA_timeout_value = cpu_to_le16(BA_timeout_value);
pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_timeout_value)), &(pattrib->pktlen));
if ((psta = rtw_get_stainfo(pstapriv, raddr)) != NULL) {
//if ((psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.MacAddress)) != NULL)
if ((psta = rtw_get_stainfo(pstapriv, raddr)) != NULL)
{
start_seq = (psta->sta_xmitpriv.txseq_tid[status & 0x07]&0xfff) + 1;
DBG_88E("BA_starting_seqctrl = %d for TID=%d\n", start_seq, status & 0x07);
@ -8115,6 +8123,14 @@ void issue_action_BA(_adapter *padapter, unsigned char *raddr, unsigned char act
case 1: //ADDBA rsp
pframe = rtw_set_fixed_ie(pframe, 1, &(pmlmeinfo->ADDBA_req.dialog_token), &(pattrib->pktlen));
pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&status), &(pattrib->pktlen));
/*
//BA_para_set = cpu_to_le16((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); //64 buffer size
#if defined(CONFIG_RTL8188E )&& defined (CONFIG_SDIO_HCI)
BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x0800); //32buffer size
#else
BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); //64 buffer size
#endif
*/
rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor);
if (MAX_AMPDU_FACTOR_64K == max_rx_ampdu_factor)
BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); //64 buffer size

View file

@ -25,8 +25,23 @@
#include <sys/unistd.h> /* for RFHIGHPID */
#endif
#ifdef CONFIG_RTL8712
#include <rtw_mp_phy_regdef.h>
#endif
#ifdef CONFIG_RTL8192C
#include <rtl8192c_hal.h>
#endif
#ifdef CONFIG_RTL8192D
#include <rtl8192d_hal.h>
#endif
#ifdef CONFIG_RTL8723A
#include <rtl8723a_hal.h>
#include "rtw_bt_mp.h"
#endif
#ifdef CONFIG_RTL8188E
#include "odm_precomp.h"
#include "rtl8188e_hal.h"
#endif
#ifdef CONFIG_MP_INCLUDED
@ -322,9 +337,25 @@ void free_mp_priv(struct mp_priv *pmp_priv)
pmp_priv->pmp_xmtframe_buf = NULL;
}
#if defined (CONFIG_RTL8192C) || defined (CONFIG_RTL8723A)
#define PHY_IQCalibrate(a,b) rtl8192c_PHY_IQCalibrate(a,b)
#define PHY_LCCalibrate(a) rtl8192c_PHY_LCCalibrate(a)
//#define dm_CheckTXPowerTracking(a) rtl8192c_odm_CheckTXPowerTracking(a)
#define PHY_SetRFPathSwitch(a,b) rtl8192c_PHY_SetRFPathSwitch(a,b)
#endif
#ifdef CONFIG_RTL8192D
#define PHY_IQCalibrate(a,b) rtl8192d_PHY_IQCalibrate(a)
#define PHY_LCCalibrate(a) rtl8192d_PHY_LCCalibrate(a)
//#define dm_CheckTXPowerTracking(a) rtl8192d_odm_CheckTXPowerTracking(a)
#define PHY_SetRFPathSwitch(a,b) rtl8192d_PHY_SetRFPathSwitch(a,b)
#endif
#ifdef CONFIG_RTL8188E
#define PHY_IQCalibrate(a,b) PHY_IQCalibrate_8188E(a,b)
#define PHY_LCCalibrate(a) PHY_LCCalibrate_8188E(a)
#define PHY_SetRFPathSwitch(a,b) PHY_SetRFPathSwitch_8188E(a,b)
#endif
s32
MPT_InitializeAdapter(
@ -349,28 +380,66 @@ MPT_InitializeAdapter(
pMptCtx->bMptIndexEven = true; //default gain index is -6.0db
pMptCtx->h2cReqNum = 0x0;
/* Init mpt event. */
//init for BT MP
#ifdef CONFIG_RTL8723A
pMptCtx->bMPh2c_timeout = false;
pMptCtx->MptH2cRspEvent = false;
pMptCtx->MptBtC2hEvent = false;
_rtw_init_sema(&pMptCtx->MPh2c_Sema, 0);
_init_timer( &pMptCtx->MPh2c_timeout_timer, pAdapter->pnetdev, MPh2c_timeout_handle, pAdapter );
#endif
pMptCtx->bMptWorkItemInProgress = false;
pMptCtx->CurrMptAct = NULL;
//-------------------------------------------------------------------------
#if 1
// Don't accept any packets
rtw_write32(pAdapter, REG_RCR, 0);
#else
// Accept CRC error and destination address
//pHalData->ReceiveConfig |= (RCR_ACRC32|RCR_AAP);
//rtw_write32(pAdapter, REG_RCR, pHalData->ReceiveConfig);
rtw_write32(pAdapter, REG_RCR, 0x70000101);
#endif
if (IS_HARDWARE_TYPE_8192DU(pAdapter))
{
rtw_write32(pAdapter, REG_LEDCFG0, 0x8888);
}
else
{
//rtw_write32(pAdapter, REG_LEDCFG0, 0x08080);
ledsetting = rtw_read32(pAdapter, REG_LEDCFG0);
#if defined (CONFIG_RTL8192C) || defined( CONFIG_RTL8192D )
rtw_write32(pAdapter, REG_LEDCFG0, ledsetting & ~LED0DIS);
#endif
}
PHY_IQCalibrate(pAdapter, false);
dm_CheckTXPowerTracking(&pHalData->odmpriv); //trigger thermal meter
PHY_LCCalibrate(pAdapter);
#ifdef CONFIG_PCI_HCI
PHY_SetRFPathSwitch(pAdapter, 1/*pHalData->bDefaultAntenna*/); //Wifi default use Main
#else
#ifdef CONFIG_RTL8192C
if (pHalData->BoardType == BOARD_MINICARD)
PHY_SetRFPathSwitch(pAdapter, 1/*pHalData->bDefaultAntenna*/); //default use Main
#endif
#endif
pMptCtx->backup0xc50 = (u1Byte)PHY_QueryBBReg(pAdapter, rOFDM0_XAAGCCore1, bMaskByte0);
pMptCtx->backup0xc58 = (u1Byte)PHY_QueryBBReg(pAdapter, rOFDM0_XBAGCCore1, bMaskByte0);
pMptCtx->backup0xc30 = (u1Byte)PHY_QueryBBReg(pAdapter, rOFDM0_RxDetector1, bMaskByte0);
#ifdef CONFIG_RTL8188E
pMptCtx->backup0x52_RF_A = (u1Byte)PHY_QueryRFReg(pAdapter, RF_PATH_A, RF_0x52, 0x000F0);
pMptCtx->backup0x52_RF_B = (u1Byte)PHY_QueryRFReg(pAdapter, RF_PATH_A, RF_0x52, 0x000F0);
#endif
//set ant to wifi side in mp mode
rtw_write16(pAdapter, 0x870, 0x300);
@ -407,6 +476,10 @@ MPT_DeInitAdapter(
PMPT_CONTEXT pMptCtx = &pAdapter->mppriv.MptCtx;
pMptCtx->bMptDrvUnload = true;
#ifdef CONFIG_RTL8723A
_rtw_free_sema(&(pMptCtx->MPh2c_Sema));
_cancel_timer_ex( &pMptCtx->MPh2c_timeout_timer);
#endif
}
static u8 mpt_ProStartTest(PADAPTER padapter)
@ -441,15 +514,22 @@ void GetPowerTracking(PADAPTER padapter, u8 *enable)
static void disable_dm(PADAPTER padapter)
{
#ifndef CONFIG_RTL8723A
u8 v8;
#endif
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
struct dm_priv *pdmpriv = &pHalData->dmpriv;
//3 1. disable firmware dynamic mechanism
// disable Power Training, Rate Adaptive
#ifdef CONFIG_RTL8723A
SetBcnCtrlReg(padapter, 0, EN_BCN_FUNCTION);
#else
v8 = rtw_read8(padapter, REG_BCN_CTRL);
v8 &= ~EN_BCN_FUNCTION;
rtw_write8(padapter, REG_BCN_CTRL, v8);
#endif
//3 2. disable driver dynamic mechanism
// disable Dynamic Initial Gain
@ -458,6 +538,9 @@ static void disable_dm(PADAPTER padapter)
Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, false);
// enable APK, LCK and IQK but disable power tracking
#ifndef CONFIG_RTL8188E
pdmpriv->TxPowerTrackControl = false;
#endif
Switch_DM_Func(padapter, DYNAMIC_RF_CALIBRATION, true);
}
@ -569,10 +652,24 @@ end_of_mp_start_test:
if (res == _SUCCESS)
{
// set MSR to WIFI_FW_ADHOC_STATE
#if !defined (CONFIG_RTL8712)
val8 = rtw_read8(padapter, MSR) & 0xFC; // 0x0102
val8 |= WIFI_FW_ADHOC_STATE;
rtw_write8(padapter, MSR, val8); // Link in ad hoc network
#endif
#if defined (CONFIG_RTL8712)
rtw_write8(padapter, MSR, 1); // Link in ad hoc network
rtw_write8(padapter, RCR, 0); // RCR : disable all pkt, 0x10250048
rtw_write8(padapter, RCR+2, 0x57); // RCR disable Check BSSID, 0x1025004a
// disable RX filter map , mgt frames will put in RX FIFO 0
rtw_write16(padapter, RXFLTMAP0, 0x0); // 0x10250116
val8 = rtw_read8(padapter, EE_9346CR); // 0x1025000A
if (!(val8 & _9356SEL))//boot from EFUSE
efuse_change_max_size(padapter);
#endif
}
return res;
@ -726,6 +823,27 @@ void MP_PHY_SetRFPathSwitch(PADAPTER pAdapter ,bool bMain)
}
#if defined (CONFIG_RTL8712)
/*------------------------------Define structure----------------------------*/
typedef struct _R_ANTENNA_SELECT_OFDM {
u32 r_tx_antenna:4;
u32 r_ant_l:4;
u32 r_ant_non_ht:4;
u32 r_ant_ht1:4;
u32 r_ant_ht2:4;
u32 r_ant_ht_s1:4;
u32 r_ant_non_ht_s1:4;
u32 OFDM_TXSC:2;
u32 Reserved:2;
}R_ANTENNA_SELECT_OFDM;
typedef struct _R_ANTENNA_SELECT_CCK {
u8 r_cckrx_enable_2:2;
u8 r_cckrx_enable:2;
u8 r_ccktx_enable:4;
}R_ANTENNA_SELECT_CCK;
#endif
s32 SetThermalMeter(PADAPTER pAdapter, u8 target_ther)
{
return Hal_SetThermalMeter( pAdapter, target_ther);
@ -788,7 +906,15 @@ void PhySetTxPowerLevel(PADAPTER pAdapter)
struct mp_priv *pmp_priv = &pAdapter->mppriv;
if (pmp_priv->bSetTxPower==0) // for NO manually set power index
{
#ifdef CONFIG_RTL8188E
PHY_SetTxPowerLevel8188E(pAdapter,pmp_priv->channel);
#elif defined(CONFIG_RTL8192D)
PHY_SetTxPowerLevel8192D(pAdapter,pmp_priv->channel);
#else
PHY_SetTxPowerLevel8192C(pAdapter,pmp_priv->channel);
#endif
}
}
//------------------------------------------------------------------------------
@ -945,24 +1071,44 @@ void SetPacketTx(PADAPTER padapter)
//3 3. init TX descriptor
// offset 0
#if defined(CONFIG_RTL8188E) && !defined(CONFIG_RTL8188E_SDIO)
desc->txdw0 |= cpu_to_le32(OWN | FSG | LSG);
desc->txdw0 |= cpu_to_le32(pkt_size & 0x0000FFFF); // packet size
desc->txdw0 |= cpu_to_le32(((TXDESC_SIZE + OFFSET_SZ) << OFFSET_SHT) & 0x00FF0000); //32 bytes for TX Desc
if (bmcast) desc->txdw0 |= cpu_to_le32(BMC); // broadcast packet
desc->txdw1 |= cpu_to_le32((0x01 << 26) & 0xff000000);
#endif
// offset 4
#ifndef CONFIG_RTL8188E
desc->txdw1 |= cpu_to_le32(BK); // don't aggregate(AMPDU)
desc->txdw1 |= cpu_to_le32((pattrib->mac_id) & 0x1F); //CAM_ID(MAC_ID)
#else
desc->txdw1 |= cpu_to_le32((pattrib->mac_id) & 0x3F); //CAM_ID(MAC_ID)
#endif
desc->txdw1 |= cpu_to_le32((pattrib->qsel << QSEL_SHT) & 0x00001F00); // Queue Select, TID
#ifdef CONFIG_RTL8188E
desc->txdw1 |= cpu_to_le32((pattrib->raid << RATE_ID_SHT) & 0x000F0000); // Rate Adaptive ID
#else
desc->txdw1 |= cpu_to_le32((pattrib->raid << Rate_ID_SHT) & 0x000F0000); // Rate Adaptive ID
#endif
// offset 8
// desc->txdw2 |= cpu_to_le32(AGG_BK);//AGG BK
// offset 12
desc->txdw3 |= cpu_to_le32((pattrib->seqnum<<16)&0x0fff0000);
// desc->txdw3 |= cpu_to_le32((pattrib->seqnum & 0xFFF) << SEQ_SHT);
//desc->txdw3 |= cpu_to_le32((pattrib->seqnum << SEQ_SHT) & 0xffff0000);
// offset 16
desc->txdw4 |= cpu_to_le32(HW_SSN);
//desc->txdw4 |= cpu_to_le32(QoS)
#ifdef CONFIG_RTL8188E
desc->txdw4 |= cpu_to_le32(HW_SSN);
#else
desc->txdw4 |= cpu_to_le32(HW_SEQ_EN);
#endif
desc->txdw4 |= cpu_to_le32(USERATE);
desc->txdw4 |= cpu_to_le32(DISDATAFB);
@ -980,8 +1126,12 @@ void SetPacketTx(PADAPTER padapter)
if (pmp_priv->rateidx > MPT_RATE_54M)
desc->txdw5 |= cpu_to_le32(SGI); // MCS Short Guard Interval
}
desc->txdw5 |= cpu_to_le32(RTY_LMT_EN); // retry limit enable
desc->txdw5 |= cpu_to_le32(0x00180000); // DATA/RTS Rate Fallback Limit
#ifdef CONFIG_RTL8188E
desc->txdw5 |= cpu_to_le32(RTY_LMT_EN); // retry limit enable
desc->txdw5 |= cpu_to_le32(0x00180000); // DATA/RTS Rate Fallback Limit
#else
desc->txdw5 |= cpu_to_le32(0x0001FF00); // DATA/RTS Rate Fallback Limit
#endif
//3 4. make wlan header, make_wlanhdr()
hdr = (struct rtw_ieee80211_hdr *)pkt_start;
@ -1036,8 +1186,11 @@ void SetPacketRx(PADAPTER pAdapter, u8 bStartRx)
{
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
if (bStartRx) {
if (bStartRx)
{
// Accept CRC error and destination address
#if 1
//ndef CONFIG_RTL8723A
pHalData->ReceiveConfig = AAP | APM | AM | AB | APP_ICV | ADF | AMF | HTC_LOC_CTRL | APP_MIC | APP_PHYSTS;
pHalData->ReceiveConfig |= ACRC32;
@ -1046,7 +1199,12 @@ void SetPacketRx(PADAPTER pAdapter, u8 bStartRx)
// Accept all data frames
rtw_write16(pAdapter, REG_RXFLTMAP2, 0xFFFF);
} else {
#else
rtw_write32(pAdapter, REG_RCR, 0x70000101);
#endif
}
else
{
rtw_write32(pAdapter, REG_RCR, 0);
}
}

View file

@ -811,7 +811,18 @@ _func_enter_;
adapter_to_dvobj(Adapter)->pusbdev->autosuspend_disabled = Adapter->bDisableAutosuspend;//autosuspend disabled by the user
#endif
}
else
#endif
{
#if defined(CONFIG_PLATFORM_SPRD) && defined(CONFIG_RTL8188E)
#ifdef CONFIG_IPS
if (false == ips_leave(Adapter))
{
DBG_88E("======> ips_leave fail.............\n");
}
#endif
#endif //CONFIG_PLATFORM_SPRD && CONFIG_RTL8188E
}
}
}