2013-05-08 21:45:39 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
2014-12-19 06:59:46 +00:00
|
|
|
*
|
2013-05-08 21:45:39 +00:00
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
#define _HCI_HAL_INIT_C_
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#include <drv_conf.h>
|
2013-05-08 21:45:39 +00:00
|
|
|
#include <osdep_service.h>
|
|
|
|
#include <drv_types.h>
|
|
|
|
#include <rtw_efuse.h>
|
|
|
|
|
|
|
|
#include <rtl8188e_hal.h>
|
|
|
|
#include <rtl8188e_led.h>
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_IOL
|
2013-05-08 21:45:39 +00:00
|
|
|
#include <rtw_iol.h>
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
#include <usb_ops.h>
|
|
|
|
#include <usb_hal.h>
|
|
|
|
#include <usb_osintf.h>
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_EFUSE_CONFIG_FILE
|
|
|
|
#include <linux/fs.h>
|
|
|
|
#include <asm/uaccess.h>
|
|
|
|
#endif //CONFIG_EFUSE_CONFIG_FILE
|
|
|
|
|
|
|
|
#if DISABLE_BB_RF
|
|
|
|
#define HAL_MAC_ENABLE 0
|
|
|
|
#define HAL_BB_ENABLE 0
|
|
|
|
#define HAL_RF_ENABLE 0
|
|
|
|
#else
|
|
|
|
#define HAL_MAC_ENABLE 1
|
|
|
|
#define HAL_BB_ENABLE 1
|
|
|
|
#define HAL_RF_ENABLE 1
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_ConfigNormalChipOutEP_8188E(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *pAdapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
IN u8 NumOutPipe
|
|
|
|
)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
|
|
|
|
|
|
|
|
switch(NumOutPipe){
|
2014-12-19 06:59:46 +00:00
|
|
|
case 3:
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData->OutEpQueueSel=TX_SELE_HQ| TX_SELE_LQ|TX_SELE_NQ;
|
|
|
|
pHalData->OutEpNumber=3;
|
|
|
|
break;
|
2014-12-19 06:59:46 +00:00
|
|
|
case 2:
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData->OutEpQueueSel=TX_SELE_HQ| TX_SELE_NQ;
|
|
|
|
pHalData->OutEpNumber=2;
|
|
|
|
break;
|
2014-12-19 06:59:46 +00:00
|
|
|
case 1:
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData->OutEpQueueSel=TX_SELE_HQ;
|
|
|
|
pHalData->OutEpNumber=1;
|
|
|
|
break;
|
2014-12-19 06:59:46 +00:00
|
|
|
default:
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_871X("%s OutEpQueueSel(0x%02x), OutEpNumber(%d) \n",__FUNCTION__,pHalData->OutEpQueueSel,pHalData->OutEpNumber );
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
static BOOLEAN HalUsbSetQueuePipeMapping8188EUsb(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *pAdapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
IN u8 NumInPipe,
|
|
|
|
IN u8 NumOutPipe
|
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
|
2014-12-29 02:13:24 +00:00
|
|
|
BOOLEAN result = false;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
_ConfigNormalChipOutEP_8188E(pAdapter, NumOutPipe);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// Normal chip with one IN and one OUT doesn't have interrupt IN EP.
|
|
|
|
if(1 == pHalData->OutEpNumber){
|
|
|
|
if(1 != NumInPipe){
|
2013-05-08 21:45:39 +00:00
|
|
|
return result;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// All config other than above support one Bulk IN and one Interrupt IN.
|
|
|
|
//if(2 != NumInPipe){
|
|
|
|
// return result;
|
|
|
|
//}
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
result = Hal_MappingOutPipe(pAdapter, NumOutPipe);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return result;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtl8188eu_interface_configure(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
|
|
|
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if (pdvobjpriv->ishighspeed == true)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
pHalData->UsbBulkOutSize = USB_HIGH_SPEED_BULK_SIZE;//512 bytes
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
pHalData->UsbBulkOutSize = USB_FULL_SPEED_BULK_SIZE;//64 bytes
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData->interfaceIndex = pdvobjpriv->InterfaceNumber;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_USB_TX_AGGREGATION
|
|
|
|
pHalData->UsbTxAggMode = 1;
|
|
|
|
pHalData->UsbTxAggDescNum = 0x6; // only 4 bits
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_USB_RX_AGGREGATION
|
|
|
|
pHalData->UsbRxAggMode = USB_RX_AGG_DMA;// USB_RX_AGG_DMA;
|
|
|
|
pHalData->UsbRxAggBlockCount = 8; //unit : 512b
|
|
|
|
pHalData->UsbRxAggBlockTimeout = 0x6;
|
|
|
|
pHalData->UsbRxAggPageCount = 48; //uint :128 b //0x0A; // 10 = MAX_RX_DMA_BUFFER_SIZE/2/pHalData->UsbBulkOutSize
|
|
|
|
pHalData->UsbRxAggPageTimeout = 0x4; //6, absolute time = 34ms/(2^6)
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
HalUsbSetQueuePipeMapping8188EUsb(padapter,
|
2013-05-08 21:45:39 +00:00
|
|
|
pdvobjpriv->RtNumInPipes, pdvobjpriv->RtNumOutPipes);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static u32 InitPowerOn_rtl8188eu(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
u16 value16;
|
2014-12-29 02:13:24 +00:00
|
|
|
u8 bMacPwrCtrlOn=false;
|
2014-12-17 04:09:56 +00:00
|
|
|
// HW Power on sequence
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn);
|
2014-12-29 02:13:24 +00:00
|
|
|
if(bMacPwrCtrlOn == true)
|
2014-12-17 04:09:56 +00:00
|
|
|
return _SUCCESS;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if(!HalPwrSeqCmdParsing(padapter, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, Rtl8188E_NIC_PWR_ON_FLOW))
|
|
|
|
{
|
|
|
|
DBG_871X(KERN_ERR "%s: run power on flow fail\n", __func__);
|
2014-12-19 06:59:46 +00:00
|
|
|
return _FAIL;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// Enable MAC DMA/WMAC/SCHEDULE/SEC block
|
|
|
|
// Set CR bit10 to enable 32k calibration. Suggested by SD1 Gimmy. Added by tynli. 2011.08.31.
|
|
|
|
rtw_write16(padapter, REG_CR, 0x00); //suggseted by zhouzhou, by page, 20111230
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
// Enable MAC DMA/WMAC/SCHEDULE/SEC block
|
|
|
|
value16 = rtw_read16(padapter, REG_CR);
|
2013-05-08 21:45:39 +00:00
|
|
|
value16 |= (HCI_TXDMA_EN | HCI_RXDMA_EN | TXDMA_EN | RXDMA_EN
|
|
|
|
| PROTOCOL_EN | SCHEDULE_EN | ENSEC | CALTMR_EN);
|
2014-12-17 04:09:56 +00:00
|
|
|
// for SDIO - Set CR bit10 to enable 32k calibration. Suggested by SD1 Gimmy. Added by tynli. 2011.08.31.
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write16(padapter, REG_CR, value16);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
bMacPwrCtrlOn = true;
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_hal_set_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return _SUCCESS;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void _dbg_dump_macreg(struct adapter *padapter)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
u32 offset = 0;
|
|
|
|
u32 val32 = 0;
|
|
|
|
u32 index =0 ;
|
|
|
|
for(index=0;index<64;index++)
|
|
|
|
{
|
|
|
|
offset = index*4;
|
|
|
|
val32 = rtw_read32(padapter,offset);
|
|
|
|
DBG_8192C("offset : 0x%02x ,val:0x%08x\n",offset,val32);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void _InitPABias(struct adapter *padapter)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
|
|
|
u8 pa_setting;
|
|
|
|
BOOLEAN is92C = IS_92C_SERIAL(pHalData->VersionID);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//FIXED PA current issue
|
|
|
|
//efuse_one_byte_read(padapter, 0x1FA, &pa_setting);
|
|
|
|
pa_setting = EFUSE_Read1Byte(padapter, 0x1FA);
|
|
|
|
|
|
|
|
//RT_TRACE(COMP_INIT, DBG_LOUD, ("_InitPABias 0x1FA 0x%x \n",pa_setting));
|
|
|
|
|
|
|
|
if(!(pa_setting & BIT0))
|
|
|
|
{
|
|
|
|
PHY_SetRFReg(padapter, RF_PATH_A, 0x15, 0x0FFFFF, 0x0F406);
|
2014-12-19 06:59:46 +00:00
|
|
|
PHY_SetRFReg(padapter, RF_PATH_A, 0x15, 0x0FFFFF, 0x4F406);
|
|
|
|
PHY_SetRFReg(padapter, RF_PATH_A, 0x15, 0x0FFFFF, 0x8F406);
|
|
|
|
PHY_SetRFReg(padapter, RF_PATH_A, 0x15, 0x0FFFFF, 0xCF406);
|
2014-12-17 04:09:56 +00:00
|
|
|
//RT_TRACE(COMP_INIT, DBG_LOUD, ("PA BIAS path A\n"));
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
if(!(pa_setting & BIT1) && is92C)
|
|
|
|
{
|
|
|
|
PHY_SetRFReg(padapter,RF_PATH_B, 0x15, 0x0FFFFF, 0x0F406);
|
|
|
|
PHY_SetRFReg(padapter,RF_PATH_B, 0x15, 0x0FFFFF, 0x4F406);
|
|
|
|
PHY_SetRFReg(padapter,RF_PATH_B, 0x15, 0x0FFFFF, 0x8F406);
|
|
|
|
PHY_SetRFReg(padapter,RF_PATH_B, 0x15, 0x0FFFFF, 0xCF406);
|
|
|
|
//RT_TRACE(COMP_INIT, DBG_LOUD, ("PA BIAS path B\n"));
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!(pa_setting & BIT4))
|
|
|
|
{
|
|
|
|
pa_setting = rtw_read8(padapter, 0x16);
|
|
|
|
pa_setting &= 0x0F;
|
|
|
|
rtw_write8(padapter, 0x16, pa_setting | 0x80);
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(padapter, 0x16, pa_setting | 0x90);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#ifdef CONFIG_BT_COEXIST
|
2014-12-17 23:13:53 +00:00
|
|
|
static void _InitBTCoexist(struct adapter *padapter)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
|
|
|
struct btcoexist_priv *pbtpriv = &(pHalData->bt_coexist);
|
|
|
|
u8 u1Tmp;
|
|
|
|
|
|
|
|
if(pbtpriv->BT_Coexist && pbtpriv->BT_CoexistType == BT_CSR_BC4)
|
|
|
|
{
|
|
|
|
|
|
|
|
//#if MP_DRIVER != 1
|
|
|
|
if (padapter->registrypriv.mp_mode == 0)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
if(pbtpriv->BT_Ant_isolation)
|
|
|
|
{
|
|
|
|
rtw_write8( padapter,REG_GPIO_MUXCFG, 0xa0);
|
|
|
|
DBG_8192C("BT write 0x%x = 0x%x\n", REG_GPIO_MUXCFG, 0xa0);
|
|
|
|
}
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
//#endif
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
u1Tmp = rtw_read8(padapter, 0x4fd) & BIT0;
|
2014-12-19 06:59:46 +00:00
|
|
|
u1Tmp = u1Tmp |
|
|
|
|
((pbtpriv->BT_Ant_isolation==1)?0:BIT1) |
|
2014-12-17 04:09:56 +00:00
|
|
|
((pbtpriv->BT_Service==BT_SCO)?0:BIT2);
|
|
|
|
rtw_write8( padapter, 0x4fd, u1Tmp);
|
|
|
|
DBG_8192C("BT write 0x%x = 0x%x for non-isolation\n", 0x4fd, u1Tmp);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write32(padapter, REG_BT_COEX_TABLE+4, 0xaaaa9aaa);
|
|
|
|
DBG_8192C("BT write 0x%x = 0x%x\n", REG_BT_COEX_TABLE+4, 0xaaaa9aaa);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write32(padapter, REG_BT_COEX_TABLE+8, 0xffbd0040);
|
|
|
|
DBG_8192C("BT write 0x%x = 0x%x\n", REG_BT_COEX_TABLE+8, 0xffbd0040);
|
|
|
|
|
|
|
|
rtw_write32(padapter, REG_BT_COEX_TABLE+0xc, 0x40000010);
|
|
|
|
DBG_8192C("BT write 0x%x = 0x%x\n", REG_BT_COEX_TABLE+0xc, 0x40000010);
|
|
|
|
|
|
|
|
//Config to 1T1R
|
|
|
|
u1Tmp = rtw_read8(padapter,rOFDM0_TRxPathEnable);
|
|
|
|
u1Tmp &= ~(BIT1);
|
|
|
|
rtw_write8( padapter, rOFDM0_TRxPathEnable, u1Tmp);
|
|
|
|
DBG_8192C("BT write 0xC04 = 0x%x\n", u1Tmp);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
u1Tmp = rtw_read8(padapter, rOFDM1_TRxPathEnable);
|
|
|
|
u1Tmp &= ~(BIT1);
|
|
|
|
rtw_write8( padapter, rOFDM1_TRxPathEnable, u1Tmp);
|
|
|
|
DBG_8192C("BT write 0xD04 = 0x%x\n", u1Tmp);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// MAC init functions
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_SetMacID(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter, u8* MacID
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
u32 i;
|
|
|
|
for(i=0 ; i< MAC_ADDR_LEN ; i++){
|
2014-12-19 06:59:46 +00:00
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
2014-12-17 04:09:56 +00:00
|
|
|
if(Adapter->iface_type == IFACE_PORT1)
|
|
|
|
rtw_write32(Adapter, REG_MACID1+i, MacID[i]);
|
|
|
|
else
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write32(Adapter, REG_MACID+i, MacID[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_SetBSSID(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter, u8* BSSID
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
u32 i;
|
|
|
|
for(i=0 ; i< MAC_ADDR_LEN ; i++){
|
2014-12-19 06:59:46 +00:00
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
2014-12-17 04:09:56 +00:00
|
|
|
if(Adapter->iface_type == IFACE_PORT1)
|
|
|
|
rtw_write32(Adapter, REG_BSSID1+i, BSSID[i]);
|
|
|
|
else
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write32(Adapter, REG_BSSID+i, BSSID[i]);
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
// Shall USB interface init this?
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitInterrupt(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u32 imr,imr_ex;
|
2013-05-08 21:45:39 +00:00
|
|
|
u8 usb_opt;
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//HISR write one to clear
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write32(Adapter, REG_HISR_88E, 0xFFFFFFFF);
|
2014-12-19 06:59:46 +00:00
|
|
|
// HIMR -
|
|
|
|
imr = IMR_PSTIMEOUT_88E | IMR_TBDER_88E | IMR_CPWM_88E | IMR_CPWM2_88E ;
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write32(Adapter, REG_HIMR_88E, imr);
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData->IntrMask[0]=imr;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
imr_ex = IMR_TXERR_88E | IMR_RXERR_88E | IMR_TXFOVW_88E |IMR_RXFOVW_88E;
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write32(Adapter, REG_HIMRE_88E, imr_ex);
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData->IntrMask[1]=imr_ex;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_SUPPORT_USB_INT
|
|
|
|
// REG_USB_SPECIAL_OPTION - BIT(4)
|
|
|
|
// 0; Use interrupt endpoint to upload interrupt pkt
|
2014-12-19 06:59:46 +00:00
|
|
|
// 1; Use bulk endpoint to upload interrupt pkt,
|
2013-05-08 21:45:39 +00:00
|
|
|
usb_opt = rtw_read8(Adapter, REG_USB_SPECIAL_OPTION);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
if(!adapter_to_dvobj(Adapter)->ishighspeed
|
|
|
|
#ifdef CONFIG_USB_INTERRUPT_IN_PIPE
|
|
|
|
|| pHalData->RtIntInPipe == 0x05
|
|
|
|
#endif
|
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
usb_opt = usb_opt & (~INT_BULK_SEL);
|
2014-12-19 06:59:46 +00:00
|
|
|
else
|
2013-05-08 21:45:39 +00:00
|
|
|
usb_opt = usb_opt | (INT_BULK_SEL);
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(Adapter, REG_USB_SPECIAL_OPTION, usb_opt );
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
#endif//CONFIG_SUPPORT_USB_INT
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitQueueReservedPage(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
struct registry_priv *pregistrypriv = &Adapter->registrypriv;
|
2014-12-17 04:09:56 +00:00
|
|
|
u32 outEPNum = (u32)pHalData->OutEpNumber;
|
|
|
|
u32 numHQ = 0;
|
|
|
|
u32 numLQ = 0;
|
|
|
|
u32 numNQ = 0;
|
|
|
|
u32 numPubQ;
|
|
|
|
u32 value32;
|
|
|
|
u8 value8;
|
|
|
|
BOOLEAN bWiFiConfig = pregistrypriv->wifi_spec;
|
|
|
|
|
|
|
|
if((bWiFiConfig)|| (pregistrypriv->qos_opt_enable))
|
|
|
|
{
|
|
|
|
if (pHalData->OutEpQueueSel & TX_SELE_HQ)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
numHQ = 0x29;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if (pHalData->OutEpQueueSel & TX_SELE_LQ)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
numLQ = 0x1C;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// NOTE: This step shall be proceed before writting REG_RQPN.
|
|
|
|
if (pHalData->OutEpQueueSel & TX_SELE_NQ) {
|
2013-05-08 21:45:39 +00:00
|
|
|
numNQ = 0x1C;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
value8 = (u8)_NPQ(numNQ);
|
|
|
|
rtw_write8(Adapter, REG_RQPN_NPQ, value8);
|
|
|
|
|
|
|
|
numPubQ = 0xA8 - numHQ - numLQ - numNQ;
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// TX DMA
|
2013-05-08 21:45:39 +00:00
|
|
|
value32 = _HPQ(numHQ) | _LPQ(numLQ) | _PUBQ(numPubQ) | LD_RQPN;
|
|
|
|
rtw_write32(Adapter, REG_RQPN, value32);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rtw_write16(Adapter,REG_RQPN_NPQ, 0x0000);//Just follow MP Team,??? Georgia 03/28
|
|
|
|
rtw_write16(Adapter,REG_RQPN_NPQ, 0x0d);
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write32(Adapter,REG_RQPN, 0x808E000d);//reserve 7 page for LPS
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitTxBufferBoundary(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
IN u8 txpktbuf_bndy
|
|
|
|
)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
struct registry_priv *pregistrypriv = &Adapter->registrypriv;
|
|
|
|
//HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
|
|
|
|
|
|
|
//u16 txdmactrl;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(Adapter, REG_TXPKTBUF_BCNQ_BDNY, txpktbuf_bndy);
|
|
|
|
rtw_write8(Adapter, REG_TXPKTBUF_MGQ_BDNY, txpktbuf_bndy);
|
|
|
|
rtw_write8(Adapter, REG_TXPKTBUF_WMAC_LBK_BF_HD, txpktbuf_bndy);
|
|
|
|
rtw_write8(Adapter, REG_TRXFF_BNDY, txpktbuf_bndy);
|
|
|
|
rtw_write8(Adapter, REG_TDECTRL+1, txpktbuf_bndy);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitPageBoundary(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
// RX Page Boundary
|
|
|
|
//
|
2013-05-08 21:45:39 +00:00
|
|
|
u16 rxff_bndy = MAX_RX_DMA_BUFFER_SIZE_88E-1;
|
|
|
|
|
|
|
|
rtw_write16(Adapter, (REG_TRXFF_BNDY + 2), rxff_bndy);
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitNormalChipRegPriority(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
IN u16 beQ,
|
|
|
|
IN u16 bkQ,
|
|
|
|
IN u16 viQ,
|
|
|
|
IN u16 voQ,
|
|
|
|
IN u16 mgtQ,
|
|
|
|
IN u16 hiQ
|
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
u16 value16 = (rtw_read16(Adapter, REG_TRXDMA_CTRL) & 0x7);
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
value16 |= _TXDMA_BEQ_MAP(beQ) | _TXDMA_BKQ_MAP(bkQ) |
|
|
|
|
_TXDMA_VIQ_MAP(viQ) | _TXDMA_VOQ_MAP(voQ) |
|
2014-12-17 04:09:56 +00:00
|
|
|
_TXDMA_MGQ_MAP(mgtQ)| _TXDMA_HIQ_MAP(hiQ);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write16(Adapter, REG_TRXDMA_CTRL, value16);
|
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitNormalChipOneOutEpPriority(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
|
|
|
|
|
|
|
u16 value = 0;
|
|
|
|
switch(pHalData->OutEpQueueSel)
|
|
|
|
{
|
|
|
|
case TX_SELE_HQ:
|
|
|
|
value = QUEUE_HIGH;
|
|
|
|
break;
|
|
|
|
case TX_SELE_LQ:
|
|
|
|
value = QUEUE_LOW;
|
|
|
|
break;
|
|
|
|
case TX_SELE_NQ:
|
|
|
|
value = QUEUE_NORMAL;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
//RT_ASSERT(FALSE,("Shall not reach here!\n"));
|
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitNormalChipRegPriority(Adapter,
|
|
|
|
value,
|
|
|
|
value,
|
|
|
|
value,
|
|
|
|
value,
|
|
|
|
value,
|
|
|
|
value
|
|
|
|
);
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitNormalChipTwoOutEpPriority(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
struct registry_priv *pregistrypriv = &Adapter->registrypriv;
|
2014-12-17 04:09:56 +00:00
|
|
|
u16 beQ,bkQ,viQ,voQ,mgtQ,hiQ;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
u16 valueHi = 0;
|
|
|
|
u16 valueLow = 0;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
switch(pHalData->OutEpQueueSel)
|
|
|
|
{
|
|
|
|
case (TX_SELE_HQ | TX_SELE_LQ):
|
|
|
|
valueHi = QUEUE_HIGH;
|
|
|
|
valueLow = QUEUE_LOW;
|
|
|
|
break;
|
|
|
|
case (TX_SELE_NQ | TX_SELE_LQ):
|
|
|
|
valueHi = QUEUE_NORMAL;
|
|
|
|
valueLow = QUEUE_LOW;
|
|
|
|
break;
|
|
|
|
case (TX_SELE_HQ | TX_SELE_NQ):
|
|
|
|
valueHi = QUEUE_HIGH;
|
|
|
|
valueLow = QUEUE_NORMAL;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
//RT_ASSERT(FALSE,("Shall not reach here!\n"));
|
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if(!pregistrypriv->wifi_spec ){
|
|
|
|
beQ = valueLow;
|
|
|
|
bkQ = valueLow;
|
|
|
|
viQ = valueHi;
|
|
|
|
voQ = valueHi;
|
2014-12-19 06:59:46 +00:00
|
|
|
mgtQ = valueHi;
|
|
|
|
hiQ = valueHi;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else{//for WMM ,CONFIG_OUT_EP_WIFI_MODE
|
|
|
|
beQ = valueLow;
|
2014-12-19 06:59:46 +00:00
|
|
|
bkQ = valueHi;
|
2014-12-17 04:09:56 +00:00
|
|
|
viQ = valueHi;
|
|
|
|
voQ = valueLow;
|
2013-05-08 21:45:39 +00:00
|
|
|
mgtQ = valueHi;
|
2014-12-19 06:59:46 +00:00
|
|
|
hiQ = valueHi;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
_InitNormalChipRegPriority(Adapter,beQ,bkQ,viQ,voQ,mgtQ,hiQ);
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitNormalChipThreeOutEpPriority(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct registry_priv *pregistrypriv = &Adapter->registrypriv;
|
2014-12-17 04:09:56 +00:00
|
|
|
u16 beQ,bkQ,viQ,voQ,mgtQ,hiQ;
|
|
|
|
|
|
|
|
if(!pregistrypriv->wifi_spec ){// typical setting
|
|
|
|
beQ = QUEUE_LOW;
|
2014-12-19 06:59:46 +00:00
|
|
|
bkQ = QUEUE_LOW;
|
|
|
|
viQ = QUEUE_NORMAL;
|
|
|
|
voQ = QUEUE_HIGH;
|
|
|
|
mgtQ = QUEUE_HIGH;
|
|
|
|
hiQ = QUEUE_HIGH;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
else{// for WMM
|
|
|
|
beQ = QUEUE_LOW;
|
2014-12-19 06:59:46 +00:00
|
|
|
bkQ = QUEUE_NORMAL;
|
|
|
|
viQ = QUEUE_NORMAL;
|
|
|
|
voQ = QUEUE_HIGH;
|
|
|
|
mgtQ = QUEUE_HIGH;
|
|
|
|
hiQ = QUEUE_HIGH;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
_InitNormalChipRegPriority(Adapter,beQ,bkQ,viQ,voQ,mgtQ,hiQ);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitQueuePriority(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
|
|
|
|
|
|
|
switch(pHalData->OutEpNumber)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
_InitNormalChipOneOutEpPriority(Adapter);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
_InitNormalChipTwoOutEpPriority(Adapter);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
_InitNormalChipThreeOutEpPriority(Adapter);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
//RT_ASSERT(FALSE,("Shall not reach here!\n"));
|
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitHardwareDropIncorrectBulkOut(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
#ifdef ENABLE_USB_DROP_INCORRECT_OUT
|
|
|
|
u32 value32 = rtw_read32(Adapter, REG_TXDMA_OFFSET_CHK);
|
|
|
|
value32 |= DROP_DATA_EN;
|
|
|
|
rtw_write32(Adapter, REG_TXDMA_OFFSET_CHK, value32);
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitNetworkType(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u32 value32;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
value32 = rtw_read32(Adapter, REG_CR);
|
2014-12-17 04:09:56 +00:00
|
|
|
// TODO: use the other function to set network type
|
2013-05-08 21:45:39 +00:00
|
|
|
value32 = (value32 & ~MASK_NETTYPE) | _NETTYPE(NT_LINK_AP);
|
|
|
|
|
|
|
|
rtw_write32(Adapter, REG_CR, value32);
|
2014-12-17 04:09:56 +00:00
|
|
|
// RASSERT(pIoBase->rtw_read8(REG_CR + 2) == 0x2);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitTransferPageSize(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
// Tx page size is always 128.
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 value8;
|
2013-05-08 21:45:39 +00:00
|
|
|
value8 = _PSRX(PBP_128) | _PSTX(PBP_128);
|
|
|
|
rtw_write8(Adapter, REG_PBP, value8);
|
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitDriverInfoSize(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
IN u8 drvInfoSize
|
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write8(Adapter,REG_RX_DRVINFO_SZ, drvInfoSize);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitWMACSetting(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-30 22:55:10 +00:00
|
|
|
//u32 value32;
|
2014-12-17 04:09:56 +00:00
|
|
|
//u16 value16;
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
|
|
|
|
|
|
|
//pHalData->ReceiveConfig = AAP | APM | AM | AB | APP_ICV | ADF | AMF | APP_FCS | HTC_LOC_CTRL | APP_MIC | APP_PHYSTS;
|
2014-12-19 06:59:46 +00:00
|
|
|
//pHalData->ReceiveConfig =
|
|
|
|
//RCR_AAP | RCR_APM | RCR_AM | RCR_AB |RCR_CBSSID_DATA| RCR_CBSSID_BCN| RCR_APP_ICV | RCR_AMF | RCR_HTC_LOC_CTRL | RCR_APP_MIC | RCR_APP_PHYSTS;
|
2014-12-17 04:09:56 +00:00
|
|
|
// don't turn on AAP, it will allow all packets to driver
|
2014-12-19 06:59:46 +00:00
|
|
|
pHalData->ReceiveConfig = RCR_APM | RCR_AM | RCR_AB |RCR_CBSSID_DATA| RCR_CBSSID_BCN| RCR_APP_ICV | RCR_AMF | RCR_HTC_LOC_CTRL | RCR_APP_MIC | RCR_APP_PHYSTS;
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#if (1 == RTL8188E_RX_PACKET_INCLUDE_CRC)
|
|
|
|
pHalData->ReceiveConfig |= ACRC32;
|
|
|
|
#endif
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// some REG_RCR will be modified later by phy_ConfigMACWithHeaderFile()
|
|
|
|
rtw_write32(Adapter, REG_RCR, pHalData->ReceiveConfig);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// Accept all multicast address
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write32(Adapter, REG_MAR, 0xFFFFFFFF);
|
|
|
|
rtw_write32(Adapter, REG_MAR + 4, 0xFFFFFFFF);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Accept all data frames
|
|
|
|
//value16 = 0xFFFF;
|
|
|
|
//rtw_write16(Adapter, REG_RXFLTMAP2, value16);
|
|
|
|
|
|
|
|
// 2010.09.08 hpfan
|
|
|
|
// Since ADF is removed from RCR, ps-poll will not be indicate to driver,
|
|
|
|
// RxFilterMap should mask ps-poll to gurantee AP mode can rx ps-poll.
|
|
|
|
//value16 = 0x400;
|
|
|
|
//rtw_write16(Adapter, REG_RXFLTMAP1, value16);
|
|
|
|
|
|
|
|
// Accept all management frames
|
|
|
|
//value16 = 0xFFFF;
|
|
|
|
//rtw_write16(Adapter, REG_RXFLTMAP0, value16);
|
|
|
|
|
|
|
|
//enable RX_SHIFT bits
|
2014-12-19 06:59:46 +00:00
|
|
|
//rtw_write8(Adapter, REG_TRXDMA_CTRL, rtw_read8(Adapter, REG_TRXDMA_CTRL)|BIT(1));
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitAdaptiveCtrl(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u16 value16;
|
|
|
|
u32 value32;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// Response Rate Set
|
2013-05-08 21:45:39 +00:00
|
|
|
value32 = rtw_read32(Adapter, REG_RRSR);
|
|
|
|
value32 &= ~RATE_BITMAP_ALL;
|
|
|
|
value32 |= RATE_RRSR_CCK_ONLY_1M;
|
|
|
|
rtw_write32(Adapter, REG_RRSR, value32);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// CF-END Threshold
|
|
|
|
//m_spIoBase->rtw_write8(REG_CFEND_TH, 0x1);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// SIFS (used in NAV)
|
2013-05-08 21:45:39 +00:00
|
|
|
value16 = _SPEC_SIFS_CCK(0x10) | _SPEC_SIFS_OFDM(0x10);
|
|
|
|
rtw_write16(Adapter, REG_SPEC_SIFS, value16);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// Retry Limit
|
2013-05-08 21:45:39 +00:00
|
|
|
value16 = _LRL(0x30) | _SRL(0x30);
|
|
|
|
rtw_write16(Adapter, REG_RL, value16);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitRateFallback(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
// Set Data Auto Rate Fallback Retry Count register.
|
|
|
|
rtw_write32(Adapter, REG_DARFRC, 0x00000000);
|
|
|
|
rtw_write32(Adapter, REG_DARFRC+4, 0x10080404);
|
|
|
|
rtw_write32(Adapter, REG_RARFRC, 0x04030201);
|
|
|
|
rtw_write32(Adapter, REG_RARFRC+4, 0x08070605);
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitEDCA(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
// Set Spec SIFS (used in NAV)
|
|
|
|
rtw_write16(Adapter,REG_SPEC_SIFS, 0x100a);
|
|
|
|
rtw_write16(Adapter,REG_MAC_SPEC_SIFS, 0x100a);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// Set SIFS for CCK
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write16(Adapter,REG_SIFS_CTX, 0x100a);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// Set SIFS for OFDM
|
|
|
|
rtw_write16(Adapter,REG_SIFS_TRX, 0x100a);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// TXOP
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write32(Adapter, REG_EDCA_BE_PARAM, 0x005EA42B);
|
|
|
|
rtw_write32(Adapter, REG_EDCA_BK_PARAM, 0x0000A44F);
|
|
|
|
rtw_write32(Adapter, REG_EDCA_VI_PARAM, 0x005EA324);
|
|
|
|
rtw_write32(Adapter, REG_EDCA_VO_PARAM, 0x002FA226);
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitBeaconMaxError(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
IN BOOLEAN InfraMode
|
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_LED
|
2014-12-17 23:13:53 +00:00
|
|
|
static void _InitHWLed(struct adapter *Adapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct led_priv *pledpriv = &(Adapter->ledpriv);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if( pledpriv->LedStrategy != HW_LED)
|
2013-05-08 21:45:39 +00:00
|
|
|
return;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// HW led control
|
2014-12-19 06:59:46 +00:00
|
|
|
// to do ....
|
2014-12-17 04:09:56 +00:00
|
|
|
//must consider cases of antenna diversity/ commbo card/solo card/mini card
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif //CONFIG_LED
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitRDGSetting(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write8(Adapter,REG_RD_CTRL,0xFF);
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write16(Adapter, REG_RD_NAV_NXT, 0x200);
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write8(Adapter,REG_RD_RESP_PKT_TH,0x05);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitRxSetting(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
rtw_write32(Adapter, REG_MACID, 0x87654321);
|
|
|
|
rtw_write32(Adapter, 0x0700, 0x87654321);
|
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitRetryFunction(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 value8;
|
2013-05-08 21:45:39 +00:00
|
|
|
value8 = rtw_read8(Adapter, REG_FWHW_TXQ_CTRL);
|
|
|
|
value8 |= EN_AMPDU_RTY_NEW;
|
|
|
|
rtw_write8(Adapter, REG_FWHW_TXQ_CTRL, value8);
|
2014-12-17 04:09:56 +00:00
|
|
|
// Set ACK timeout
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(Adapter, REG_ACKTO, 0x40);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
|
|
* Function: usb_AggSettingTxUpdate()
|
|
|
|
*
|
2014-12-19 06:59:46 +00:00
|
|
|
* Overview: Seperate TX/RX parameters update independent for TP detection and
|
2013-05-08 21:45:39 +00:00
|
|
|
* dynamic TX/RX aggreagtion parameters update.
|
|
|
|
*
|
2014-12-17 04:09:56 +00:00
|
|
|
* Input: PADAPTER
|
2013-05-08 21:45:39 +00:00
|
|
|
*
|
|
|
|
* Output/Return: NONE
|
|
|
|
*
|
|
|
|
* Revised History:
|
|
|
|
* When Who Remark
|
2014-12-17 04:09:56 +00:00
|
|
|
* 12/10/2010 MHC Seperate to smaller function.
|
2013-05-08 21:45:39 +00:00
|
|
|
*
|
|
|
|
*---------------------------------------------------------------------------*/
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
usb_AggSettingTxUpdate(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter * Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_USB_TX_AGGREGATION
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
//PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo);
|
2014-12-17 04:09:56 +00:00
|
|
|
u32 value32;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if(Adapter->registrypriv.wifi_spec)
|
2014-12-29 02:13:24 +00:00
|
|
|
pHalData->UsbTxAggMode = false;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if(pHalData->UsbTxAggMode){
|
2013-05-08 21:45:39 +00:00
|
|
|
value32 = rtw_read32(Adapter, REG_TDECTRL);
|
|
|
|
value32 = value32 & ~(BLK_DESC_NUM_MASK << BLK_DESC_NUM_SHIFT);
|
2014-12-17 04:09:56 +00:00
|
|
|
value32 |= ((pHalData->UsbTxAggDescNum & BLK_DESC_NUM_MASK) << BLK_DESC_NUM_SHIFT);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write32(Adapter, REG_TDECTRL, value32);
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif
|
|
|
|
} // usb_AggSettingTxUpdate
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
|
|
* Function: usb_AggSettingRxUpdate()
|
|
|
|
*
|
2014-12-19 06:59:46 +00:00
|
|
|
* Overview: Seperate TX/RX parameters update independent for TP detection and
|
2013-05-08 21:45:39 +00:00
|
|
|
* dynamic TX/RX aggreagtion parameters update.
|
|
|
|
*
|
2014-12-17 04:09:56 +00:00
|
|
|
* Input: PADAPTER
|
2013-05-08 21:45:39 +00:00
|
|
|
*
|
|
|
|
* Output/Return: NONE
|
|
|
|
*
|
|
|
|
* Revised History:
|
|
|
|
* When Who Remark
|
2014-12-17 04:09:56 +00:00
|
|
|
* 12/10/2010 MHC Seperate to smaller function.
|
2013-05-08 21:45:39 +00:00
|
|
|
*
|
|
|
|
*---------------------------------------------------------------------------*/
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2013-05-08 21:45:39 +00:00
|
|
|
usb_AggSettingRxUpdate(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter * Adapter
|
2013-05-08 21:45:39 +00:00
|
|
|
)
|
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_USB_RX_AGGREGATION
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
|
|
|
//PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo);
|
|
|
|
u8 valueDMA;
|
|
|
|
u8 valueUSB;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
valueDMA = rtw_read8(Adapter, REG_TRXDMA_CTRL);
|
|
|
|
valueUSB = rtw_read8(Adapter, REG_USB_SPECIAL_OPTION);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
switch(pHalData->UsbRxAggMode)
|
|
|
|
{
|
|
|
|
case USB_RX_AGG_DMA:
|
|
|
|
valueDMA |= RXDMA_AGG_EN;
|
|
|
|
valueUSB &= ~USB_AGG_EN;
|
|
|
|
break;
|
|
|
|
case USB_RX_AGG_USB:
|
|
|
|
valueDMA &= ~RXDMA_AGG_EN;
|
|
|
|
valueUSB |= USB_AGG_EN;
|
|
|
|
break;
|
|
|
|
case USB_RX_AGG_MIX:
|
|
|
|
valueDMA |= RXDMA_AGG_EN;
|
|
|
|
valueUSB |= USB_AGG_EN;
|
|
|
|
break;
|
|
|
|
case USB_RX_AGG_DISABLE:
|
|
|
|
default:
|
|
|
|
valueDMA &= ~RXDMA_AGG_EN;
|
|
|
|
valueUSB &= ~USB_AGG_EN;
|
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rtw_write8(Adapter, REG_TRXDMA_CTRL, valueDMA);
|
|
|
|
rtw_write8(Adapter, REG_USB_SPECIAL_OPTION, valueUSB);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
switch(pHalData->UsbRxAggMode)
|
|
|
|
{
|
|
|
|
case USB_RX_AGG_DMA:
|
|
|
|
rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH, pHalData->UsbRxAggPageCount);
|
|
|
|
rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH+1, pHalData->UsbRxAggPageTimeout);
|
|
|
|
break;
|
|
|
|
case USB_RX_AGG_USB:
|
|
|
|
rtw_write8(Adapter, REG_USB_AGG_TH, pHalData->UsbRxAggBlockCount);
|
|
|
|
rtw_write8(Adapter, REG_USB_AGG_TO, pHalData->UsbRxAggBlockTimeout);
|
|
|
|
break;
|
|
|
|
case USB_RX_AGG_MIX:
|
|
|
|
rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH, pHalData->UsbRxAggPageCount);
|
|
|
|
rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH+1, (pHalData->UsbRxAggPageTimeout& 0x1F));//0x280[12:8]
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write8(Adapter, REG_USB_AGG_TH, pHalData->UsbRxAggBlockCount);
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(Adapter, REG_USB_AGG_TO, pHalData->UsbRxAggBlockTimeout);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
|
|
|
case USB_RX_AGG_DISABLE:
|
|
|
|
default:
|
2014-12-19 06:59:46 +00:00
|
|
|
// TODO:
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
switch(PBP_128)
|
|
|
|
{
|
|
|
|
case PBP_128:
|
|
|
|
pHalData->HwRxPageSize = 128;
|
|
|
|
break;
|
|
|
|
case PBP_64:
|
|
|
|
pHalData->HwRxPageSize = 64;
|
|
|
|
break;
|
|
|
|
case PBP_256:
|
|
|
|
pHalData->HwRxPageSize = 256;
|
|
|
|
break;
|
|
|
|
case PBP_512:
|
|
|
|
pHalData->HwRxPageSize = 512;
|
|
|
|
break;
|
|
|
|
case PBP_1024:
|
|
|
|
pHalData->HwRxPageSize = 1024;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
//RT_ASSERT(FALSE, ("RX_PAGE_SIZE_REG_VALUE definition is incorrect!\n"));
|
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif
|
|
|
|
} // usb_AggSettingRxUpdate
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
InitUsbAggregationSetting(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// Tx aggregation setting
|
2013-05-08 21:45:39 +00:00
|
|
|
usb_AggSettingTxUpdate(Adapter);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// Rx aggregation setting
|
2013-05-08 21:45:39 +00:00
|
|
|
usb_AggSettingRxUpdate(Adapter);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// 201/12/10 MH Add for USB agg mode dynamic switch.
|
2014-12-29 02:13:24 +00:00
|
|
|
pHalData->UsbRxHighSpeedMode = false;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2014-12-29 02:06:17 +00:00
|
|
|
void
|
2014-12-17 04:09:56 +00:00
|
|
|
HalRxAggr8188EUsb(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
IN BOOLEAN Value
|
|
|
|
)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
/*-----------------------------------------------------------------------------
|
|
|
|
* Function: USB_AggModeSwitch()
|
|
|
|
*
|
|
|
|
* Overview: When RX traffic is more than 40M, we need to adjust some parameters to increase
|
|
|
|
* RX speed by increasing batch indication size. This will decrease TCP ACK speed, we
|
|
|
|
* need to monitor the influence of FTP/network share.
|
|
|
|
* For TX mode, we are still ubder investigation.
|
|
|
|
*
|
|
|
|
* Input: PADAPTER
|
|
|
|
*
|
|
|
|
* Output: NONE
|
|
|
|
*
|
|
|
|
* Return: NONE
|
|
|
|
*
|
|
|
|
* Revised History:
|
|
|
|
* When Who Remark
|
2014-12-19 06:59:46 +00:00
|
|
|
* 12/10/2010 MHC Create Version 0.
|
2014-12-17 04:09:56 +00:00
|
|
|
*
|
|
|
|
*---------------------------------------------------------------------------*/
|
2014-12-29 02:06:17 +00:00
|
|
|
void
|
2014-12-17 04:09:56 +00:00
|
|
|
USB_AggModeSwitch(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter * Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
} // USB_AggModeSwitch
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitOperationMode(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter * Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitBeaconParameters(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
rtw_write16(Adapter, REG_BCN_CTRL, 0x1010);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// TODO: Remove these magic number
|
|
|
|
rtw_write16(Adapter, REG_TBTT_PROHIBIT,0x6404);// ms
|
|
|
|
rtw_write8(Adapter, REG_DRVERLYINT, DRIVER_EARLY_INT_TIME);// 5ms
|
|
|
|
rtw_write8(Adapter, REG_BCNDMATIM, BCN_DMA_ATIME_INT_TIME); // 2ms
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// Suggested by designer timchen. Change beacon AIFS to the largest number
|
|
|
|
// beacause test chip does not contension before sending beacon. by tynli. 2009.11.03
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write16(Adapter, REG_BCNTCFG, 0x660F);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData->RegBcnCtrlVal = rtw_read8(Adapter, REG_BCN_CTRL);
|
2014-12-19 06:59:46 +00:00
|
|
|
pHalData->RegTxPause = rtw_read8(Adapter, REG_TXPAUSE);
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData->RegFwHwTxQCtrl = rtw_read8(Adapter, REG_FWHW_TXQ_CTRL+2);
|
|
|
|
pHalData->RegReg542 = rtw_read8(Adapter, REG_TBTT_PROHIBIT+2);
|
|
|
|
pHalData->RegCR_1 = rtw_read8(Adapter, REG_CR+1);
|
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitRFType(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
struct registry_priv *pregpriv = &Adapter->registrypriv;
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
|
|
|
BOOLEAN is92CU = IS_92C_SERIAL(pHalData->VersionID);
|
|
|
|
|
|
|
|
#if DISABLE_BB_RF
|
|
|
|
pHalData->rf_chip = RF_PSEUDO_11N;
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
pHalData->rf_chip = RF_6052;
|
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if(false == is92CU){
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData->rf_type = RF_1T1R;
|
|
|
|
DBG_8192C("Set RF Chip ID to RF_6052 and RF type to 1T1R.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: Consider that EEPROM set 92CU to 1T1R later.
|
|
|
|
// Force to overwrite setting according to chip version. Ignore EEPROM setting.
|
|
|
|
//pHalData->RF_Type = is92CU ? RF_2T2R : RF_1T1R;
|
|
|
|
MSG_8192C("Set RF Chip ID to RF_6052 and RF type to %d.\n", pHalData->rf_type);
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_BeaconFunctionEnable(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter * Adapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
IN BOOLEAN Enable,
|
|
|
|
IN BOOLEAN Linked
|
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, (BIT4 | BIT3 | BIT1));
|
2014-12-17 04:09:56 +00:00
|
|
|
//SetBcnCtrlReg(Adapter, (BIT4 | BIT3 | BIT1), 0x00);
|
2014-12-19 06:59:46 +00:00
|
|
|
//RT_TRACE(COMP_BEACON, DBG_LOUD, ("_BeaconFunctionEnable 0x550 0x%x\n", PlatformEFIORead1Byte(Adapter, 0x550)));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(Adapter, REG_RD_CTRL+1, 0x6F);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
// Set CCK and OFDM Block "ON"
|
2014-12-29 02:06:17 +00:00
|
|
|
static void _BBTurnOnBlock(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter * Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
#if (DISABLE_BB_RF)
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
PHY_SetBBReg(Adapter, rFPGA0_RFMOD, bCCKEn, 0x1);
|
|
|
|
PHY_SetBBReg(Adapter, rFPGA0_RFMOD, bOFDMEn, 0x1);
|
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void _RfPowerSave(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter * Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
enum {
|
|
|
|
Antenna_Lfet = 1,
|
2014-12-19 06:59:46 +00:00
|
|
|
Antenna_Right = 2,
|
2013-05-08 21:45:39 +00:00
|
|
|
};
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 23:13:53 +00:00
|
|
|
_InitAntenna_Selection(IN struct adapter *Adapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if(pHalData->AntDivCfg==0)
|
|
|
|
return;
|
2014-12-19 06:59:46 +00:00
|
|
|
DBG_8192C("==> %s ....\n",__FUNCTION__);
|
|
|
|
|
|
|
|
rtw_write32(Adapter, REG_LEDCFG0, rtw_read32(Adapter, REG_LEDCFG0)|BIT23);
|
2013-05-08 21:45:39 +00:00
|
|
|
PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, BIT13, 0x01);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if(PHY_QueryBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300) == Antenna_A)
|
|
|
|
pHalData->CurAntenna = Antenna_A;
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData->CurAntenna = Antenna_B;
|
|
|
|
DBG_8192C("%s,Cur_ant:(%x)%s\n",__FUNCTION__,pHalData->CurAntenna,(pHalData->CurAntenna == Antenna_A)?"Antenna_A":"Antenna_B");
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//
|
|
|
|
// 2010/08/26 MH Add for selective suspend mode check.
|
|
|
|
// If Efuse 0x0e bit1 is not enabled, we can not support selective suspend for Minicard and
|
|
|
|
// slim card.
|
|
|
|
//
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
HalDetectSelectiveSuspendMode(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter * Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
} // HalDetectSelectiveSuspendMode
|
2013-05-08 21:45:39 +00:00
|
|
|
/*-----------------------------------------------------------------------------
|
|
|
|
* Function: HwSuspendModeEnable92Cu()
|
|
|
|
*
|
|
|
|
* Overview: HW suspend mode switch.
|
|
|
|
*
|
|
|
|
* Input: NONE
|
|
|
|
*
|
|
|
|
* Output: NONE
|
|
|
|
*
|
|
|
|
* Return: NONE
|
|
|
|
*
|
|
|
|
* Revised History:
|
|
|
|
* When Who Remark
|
|
|
|
* 08/23/2010 MHC HW suspend mode switch test..
|
|
|
|
*---------------------------------------------------------------------------*/
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
HwSuspendModeEnable_88eu(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *pAdapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
IN u8 Type
|
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
//PRT_USB_DEVICE pDevice = GET_RT_USB_DEVICE(pAdapter);
|
|
|
|
u16 reg = rtw_read16(pAdapter, REG_GPIO_MUXCFG);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//if (!pDevice->RegUsbSS)
|
|
|
|
{
|
|
|
|
return;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//
|
|
|
|
// 2010/08/23 MH According to Alfred's suggestion, we need to to prevent HW
|
2014-12-19 06:59:46 +00:00
|
|
|
// to enter suspend mode automatically. Otherwise, it will shut down major power
|
2014-12-17 04:09:56 +00:00
|
|
|
// domain and 8051 will stop. When we try to enter selective suspend mode, we
|
|
|
|
// need to prevent HW to enter D2 mode aumotmatically. Another way, Host will
|
|
|
|
// issue a S10 signal to power domain. Then it will cleat SIC setting(from Yngli).
|
2014-12-19 06:59:46 +00:00
|
|
|
// We need to enable HW suspend mode when enter S3/S4 or disable. We need
|
2014-12-17 04:09:56 +00:00
|
|
|
// to disable HW suspend mode for IPS/radio_off.
|
|
|
|
//
|
|
|
|
//RT_TRACE(COMP_RF, DBG_LOUD, ("HwSuspendModeEnable92Cu = %d\n", Type));
|
2014-12-29 02:13:24 +00:00
|
|
|
if (Type == false)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
reg |= BIT14;
|
|
|
|
//RT_TRACE(COMP_RF, DBG_LOUD, ("REG_GPIO_MUXCFG = %x\n", reg));
|
|
|
|
rtw_write16(pAdapter, REG_GPIO_MUXCFG, reg);
|
|
|
|
reg |= BIT12;
|
|
|
|
//RT_TRACE(COMP_RF, DBG_LOUD, ("REG_GPIO_MUXCFG = %x\n", reg));
|
|
|
|
rtw_write16(pAdapter, REG_GPIO_MUXCFG, reg);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
reg &= (~BIT12);
|
|
|
|
rtw_write16(pAdapter, REG_GPIO_MUXCFG, reg);
|
|
|
|
reg &= (~BIT14);
|
|
|
|
rtw_write16(pAdapter, REG_GPIO_MUXCFG, reg);
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
} // HwSuspendModeEnable92Cu
|
2014-12-17 23:13:53 +00:00
|
|
|
rt_rf_power_state RfOnOffDetect(IN struct adapter *pAdapter )
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
|
|
|
|
u8 val8;
|
|
|
|
rt_rf_power_state rfpowerstate = rf_off;
|
|
|
|
|
|
|
|
if(adapter_to_pwrctl(pAdapter)->bHWPowerdown)
|
|
|
|
{
|
|
|
|
val8 = rtw_read8(pAdapter, REG_HSISR);
|
|
|
|
DBG_8192C("pwrdown, 0x5c(BIT7)=%02x\n", val8);
|
2014-12-19 06:59:46 +00:00
|
|
|
rfpowerstate = (val8 & BIT7) ? rf_off: rf_on;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else // rf on/off
|
|
|
|
{
|
|
|
|
rtw_write8( pAdapter, REG_MAC_PINMUX_CFG,rtw_read8(pAdapter, REG_MAC_PINMUX_CFG)&~(BIT3));
|
|
|
|
val8 = rtw_read8(pAdapter, REG_GPIO_IO_SEL);
|
|
|
|
DBG_8192C("GPIO_IN=%02x\n", val8);
|
2014-12-19 06:59:46 +00:00
|
|
|
rfpowerstate = (val8 & BIT3) ? rf_on : rf_off;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
return rfpowerstate;
|
|
|
|
} // HalDetectPwrDownMode
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void _ps_open_RF(struct adapter *padapter);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u32 rtl8188eu_hal_init(struct adapter *Adapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 value8 = 0;
|
2013-05-08 21:45:39 +00:00
|
|
|
u16 value16;
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 txpktbuf_bndy;
|
|
|
|
u32 status = _SUCCESS;
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
|
|
|
struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(Adapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
struct registry_priv *pregistrypriv = &Adapter->registrypriv;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
rt_rf_power_state eRfPowerStateToSet;
|
|
|
|
#ifdef CONFIG_BT_COEXIST
|
|
|
|
struct btcoexist_priv *pbtpriv = &(pHalData->bt_coexist);
|
|
|
|
#endif
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
u32 init_start_time = rtw_get_current_time();
|
|
|
|
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef DBG_HAL_INIT_PROFILING
|
|
|
|
|
|
|
|
enum HAL_INIT_STAGES {
|
|
|
|
HAL_INIT_STAGES_BEGIN = 0,
|
|
|
|
HAL_INIT_STAGES_INIT_PW_ON,
|
|
|
|
HAL_INIT_STAGES_MISC01,
|
|
|
|
HAL_INIT_STAGES_DOWNLOAD_FW,
|
|
|
|
HAL_INIT_STAGES_MAC,
|
|
|
|
HAL_INIT_STAGES_BB,
|
2014-12-19 06:59:46 +00:00
|
|
|
HAL_INIT_STAGES_RF,
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_INIT_STAGES_EFUSE_PATCH,
|
2014-12-19 06:59:46 +00:00
|
|
|
HAL_INIT_STAGES_INIT_LLTT,
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_INIT_STAGES_MISC02,
|
|
|
|
HAL_INIT_STAGES_TURN_ON_BLOCK,
|
|
|
|
HAL_INIT_STAGES_INIT_SECURITY,
|
|
|
|
HAL_INIT_STAGES_MISC11,
|
|
|
|
HAL_INIT_STAGES_INIT_HAL_DM,
|
|
|
|
//HAL_INIT_STAGES_RF_PS,
|
|
|
|
HAL_INIT_STAGES_IQK,
|
|
|
|
HAL_INIT_STAGES_PW_TRACK,
|
|
|
|
HAL_INIT_STAGES_LCK,
|
|
|
|
//HAL_INIT_STAGES_MISC21,
|
|
|
|
//HAL_INIT_STAGES_INIT_PABIAS,
|
|
|
|
#ifdef CONFIG_BT_COEXIST
|
|
|
|
HAL_INIT_STAGES_BT_COEXIST,
|
|
|
|
#endif
|
|
|
|
//HAL_INIT_STAGES_ANTENNA_SEL,
|
|
|
|
//HAL_INIT_STAGES_MISC31,
|
|
|
|
HAL_INIT_STAGES_END,
|
|
|
|
HAL_INIT_STAGES_NUM
|
|
|
|
};
|
|
|
|
|
|
|
|
char * hal_init_stages_str[] = {
|
|
|
|
"HAL_INIT_STAGES_BEGIN",
|
|
|
|
"HAL_INIT_STAGES_INIT_PW_ON",
|
|
|
|
"HAL_INIT_STAGES_MISC01",
|
2014-12-19 06:59:46 +00:00
|
|
|
"HAL_INIT_STAGES_DOWNLOAD_FW",
|
|
|
|
"HAL_INIT_STAGES_MAC",
|
2014-12-17 04:09:56 +00:00
|
|
|
"HAL_INIT_STAGES_BB",
|
|
|
|
"HAL_INIT_STAGES_RF",
|
|
|
|
"HAL_INIT_STAGES_EFUSE_PATCH",
|
|
|
|
"HAL_INIT_STAGES_INIT_LLTT",
|
2014-12-19 06:59:46 +00:00
|
|
|
"HAL_INIT_STAGES_MISC02",
|
2014-12-17 04:09:56 +00:00
|
|
|
"HAL_INIT_STAGES_TURN_ON_BLOCK",
|
|
|
|
"HAL_INIT_STAGES_INIT_SECURITY",
|
|
|
|
"HAL_INIT_STAGES_MISC11",
|
|
|
|
"HAL_INIT_STAGES_INIT_HAL_DM",
|
|
|
|
//"HAL_INIT_STAGES_RF_PS",
|
|
|
|
"HAL_INIT_STAGES_IQK",
|
|
|
|
"HAL_INIT_STAGES_PW_TRACK",
|
|
|
|
"HAL_INIT_STAGES_LCK",
|
|
|
|
//"HAL_INIT_STAGES_MISC21",
|
|
|
|
#ifdef CONFIG_BT_COEXIST
|
|
|
|
"HAL_INIT_STAGES_BT_COEXIST",
|
|
|
|
#endif
|
|
|
|
//"HAL_INIT_STAGES_ANTENNA_SEL",
|
|
|
|
//"HAL_INIT_STAGES_MISC31",
|
|
|
|
"HAL_INIT_STAGES_END",
|
|
|
|
};
|
|
|
|
|
|
|
|
int hal_init_profiling_i;
|
|
|
|
u32 hal_init_stages_timestamp[HAL_INIT_STAGES_NUM]; //used to record the time of each stage's starting point
|
|
|
|
|
|
|
|
for(hal_init_profiling_i=0;hal_init_profiling_i<HAL_INIT_STAGES_NUM;hal_init_profiling_i++)
|
|
|
|
hal_init_stages_timestamp[hal_init_profiling_i]=0;
|
|
|
|
|
|
|
|
#define HAL_INIT_PROFILE_TAG(stage) hal_init_stages_timestamp[(stage)]=rtw_get_current_time();
|
|
|
|
#else
|
|
|
|
#define HAL_INIT_PROFILE_TAG(stage) do {} while(0)
|
|
|
|
#endif //DBG_HAL_INIT_PROFILING
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_BEGIN);
|
|
|
|
|
|
|
|
#ifdef CONFIG_WOWLAN
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
pwrctrlpriv->wowlan_wake_reason = rtw_read8(Adapter, REG_WOWLAN_WAKE_REASON);
|
2014-12-19 06:59:46 +00:00
|
|
|
DBG_8192C("%s wowlan_wake_reason: 0x%02x\n",
|
2014-12-17 04:09:56 +00:00
|
|
|
__func__, pwrctrlpriv->wowlan_wake_reason);
|
|
|
|
|
|
|
|
if(rtw_read8(Adapter, REG_MCUFWDL)&BIT7){ /*&&
|
|
|
|
(pwrctrlpriv->wowlan_wake_reason & FWDecisionDisconnect)) {*/
|
|
|
|
u8 reg_val=0;
|
|
|
|
DBG_8192C("+Reset Entry+\n");
|
|
|
|
rtw_write8(Adapter, REG_MCUFWDL, 0x00);
|
|
|
|
_8051Reset88E(Adapter);
|
|
|
|
//reset BB
|
|
|
|
reg_val = rtw_read8(Adapter, REG_SYS_FUNC_EN);
|
|
|
|
reg_val &= ~(BIT(0) | BIT(1));
|
|
|
|
rtw_write8(Adapter, REG_SYS_FUNC_EN, reg_val);
|
|
|
|
//reset RF
|
|
|
|
rtw_write8(Adapter, REG_RF_CTRL, 0);
|
|
|
|
//reset TRX path
|
|
|
|
rtw_write16(Adapter, REG_CR, 0);
|
|
|
|
//reset MAC, Digital Core
|
|
|
|
reg_val = rtw_read8(Adapter, REG_SYS_FUNC_EN+1);
|
|
|
|
reg_val &= ~(BIT(4) | BIT(7));
|
|
|
|
rtw_write8(Adapter, REG_SYS_FUNC_EN+1, reg_val);
|
|
|
|
reg_val = rtw_read8(Adapter, REG_SYS_FUNC_EN+1);
|
|
|
|
reg_val |= BIT(4) | BIT(7);
|
|
|
|
rtw_write8(Adapter, REG_SYS_FUNC_EN+1, reg_val);
|
|
|
|
DBG_8192C("-Reset Entry-\n");
|
|
|
|
}
|
|
|
|
#endif //CONFIG_WOWLAN
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if(pwrctrlpriv->bkeepfwalive)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
_ps_open_RF(Adapter);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if(pHalData->odmpriv.RFCalibrateInfo.bIQKInitialized){
|
2014-12-29 02:13:24 +00:00
|
|
|
// PHY_IQCalibrate(padapter, true);
|
|
|
|
PHY_IQCalibrate_8188E(Adapter,true);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
// PHY_IQCalibrate(padapter, false);
|
|
|
|
PHY_IQCalibrate_8188E(Adapter,false);
|
|
|
|
pHalData->odmpriv.RFCalibrateInfo.bIQKInitialized = true;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// dm_CheckTXPowerTracking(padapter);
|
|
|
|
// PHY_LCCalibrate(padapter);
|
|
|
|
ODM_TXPowerTrackingCheck(&pHalData->odmpriv );
|
2013-05-08 21:45:39 +00:00
|
|
|
PHY_LCCalibrate_8188E(Adapter);
|
|
|
|
|
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_PW_ON);
|
|
|
|
status = InitPowerOn_rtl8188eu(Adapter);
|
|
|
|
if(status == _FAIL){
|
2013-05-08 21:45:39 +00:00
|
|
|
RT_TRACE(_module_hci_hal_init_c_, _drv_err_, ("Failed to init power on!\n"));
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// Save target channel
|
|
|
|
pHalData->CurrentChannel = 6;//default set to 6
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if(pwrctrlpriv->reg_rfoff == true){
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrctrlpriv->rf_pwrstate = rf_off;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// 2010/08/09 MH We need to check if we need to turnon or off RF after detecting
|
|
|
|
// HW GPIO pin. Before PHY_RFConfig8192C.
|
|
|
|
//HalDetectPwrDownMode(Adapter);
|
|
|
|
// 2010/08/26 MH If Efuse does not support sective suspend then disable the function.
|
|
|
|
//HalDetectSelectiveSuspendMode(Adapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
if (!pregistrypriv->wifi_spec) {
|
|
|
|
txpktbuf_bndy = TX_PAGE_BOUNDARY_88E;
|
|
|
|
} else {
|
2014-12-17 04:09:56 +00:00
|
|
|
// for WMM
|
2013-05-08 21:45:39 +00:00
|
|
|
txpktbuf_bndy = WMM_NORMAL_TX_PAGE_BOUNDARY_88E;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC01);
|
2014-12-19 06:59:46 +00:00
|
|
|
_InitQueueReservedPage(Adapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
_InitQueuePriority(Adapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
_InitPageBoundary(Adapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
_InitTransferPageSize(Adapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_IOL_IOREG_CFG
|
2014-12-19 06:59:46 +00:00
|
|
|
_InitTxBufferBoundary(Adapter, 0);
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif
|
|
|
|
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_DOWNLOAD_FW);
|
|
|
|
#if (MP_DRIVER == 1)
|
|
|
|
if (Adapter->registrypriv.mp_mode == 1)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
_InitRxSetting(Adapter);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
#endif //MP_DRIVER == 1
|
|
|
|
{
|
|
|
|
|
|
|
|
#ifdef CONFIG_WOWLAN
|
2014-12-29 02:13:24 +00:00
|
|
|
status = rtl8188e_FirmwareDownload(Adapter, false);
|
2014-12-17 04:09:56 +00:00
|
|
|
#else
|
2013-05-08 21:45:39 +00:00
|
|
|
status = rtl8188e_FirmwareDownload(Adapter);
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif //CONFIG_WOWLAN
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
if (status != _SUCCESS) {
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_871X("%s: Download Firmware failed!!\n", __FUNCTION__);
|
2014-12-29 02:13:24 +00:00
|
|
|
Adapter->bFWReady = false;
|
|
|
|
pHalData->fw_ractrl = false;
|
2013-05-08 21:45:39 +00:00
|
|
|
return status;
|
|
|
|
} else {
|
2014-12-17 04:09:56 +00:00
|
|
|
RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("Initializepadapter8192CSdio(): Download Firmware Success!!\n"));
|
2014-12-29 02:13:24 +00:00
|
|
|
Adapter->bFWReady = true;
|
|
|
|
pHalData->fw_ractrl = false;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtl8188e_InitializeFirmwareVars(Adapter);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MAC);
|
2013-05-08 21:45:39 +00:00
|
|
|
#if (HAL_MAC_ENABLE == 1)
|
|
|
|
status = PHY_MACConfig8188E(Adapter);
|
2014-12-17 04:09:56 +00:00
|
|
|
if(status == _FAIL)
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
DBG_871X(" ### Failed to init MAC ...... \n ");
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//
|
|
|
|
//d. Initialize BB related configurations.
|
|
|
|
//
|
|
|
|
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_BB);
|
2013-05-08 21:45:39 +00:00
|
|
|
#if (HAL_BB_ENABLE == 1)
|
|
|
|
status = PHY_BBConfig8188E(Adapter);
|
2014-12-17 04:09:56 +00:00
|
|
|
if(status == _FAIL)
|
|
|
|
{
|
|
|
|
DBG_871X(" ### Failed to init BB ...... \n ");
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_RF);
|
2013-05-08 21:45:39 +00:00
|
|
|
#if (HAL_RF_ENABLE == 1)
|
2014-12-19 06:59:46 +00:00
|
|
|
status = PHY_RFConfig8188E(Adapter);
|
2014-12-17 04:09:56 +00:00
|
|
|
if(status == _FAIL)
|
|
|
|
{
|
|
|
|
DBG_871X(" ### Failed to init RF ...... \n ");
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_EFUSE_PATCH);
|
2014-12-19 06:59:46 +00:00
|
|
|
#if defined(CONFIG_IOL_EFUSE_PATCH)
|
2013-05-08 21:45:39 +00:00
|
|
|
status = rtl8188e_iol_efuse_patch(Adapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
if(status == _FAIL){
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_871X("%s rtl8188e_iol_efuse_patch failed \n",__FUNCTION__);
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
_InitTxBufferBoundary(Adapter, txpktbuf_bndy);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_LLTT);
|
2013-05-08 21:45:39 +00:00
|
|
|
status = InitLLTTable(Adapter, txpktbuf_bndy);
|
2014-12-17 04:09:56 +00:00
|
|
|
if(status == _FAIL){
|
2013-05-08 21:45:39 +00:00
|
|
|
RT_TRACE(_module_hci_hal_init_c_, _drv_err_, ("Failed to init LLT table\n"));
|
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC02);
|
|
|
|
// Get Rx PHY status in order to report RSSI and others.
|
2013-05-08 21:45:39 +00:00
|
|
|
_InitDriverInfoSize(Adapter, DRVINFO_SZ);
|
|
|
|
|
|
|
|
_InitInterrupt(Adapter);
|
2014-12-17 04:09:56 +00:00
|
|
|
hal_init_macaddr(Adapter);//set mac_address
|
2014-12-19 06:59:46 +00:00
|
|
|
_InitNetworkType(Adapter);//set msr
|
2013-05-08 21:45:39 +00:00
|
|
|
_InitWMACSetting(Adapter);
|
|
|
|
_InitAdaptiveCtrl(Adapter);
|
|
|
|
_InitEDCA(Adapter);
|
2014-12-17 04:09:56 +00:00
|
|
|
//_InitRateFallback(Adapter);//just follow MP Team ???Georgia
|
2013-05-08 21:45:39 +00:00
|
|
|
_InitRetryFunction(Adapter);
|
|
|
|
InitUsbAggregationSetting(Adapter);
|
2014-12-17 04:09:56 +00:00
|
|
|
_InitOperationMode(Adapter);//todo
|
2013-05-08 21:45:39 +00:00
|
|
|
_InitBeaconParameters(Adapter);
|
2014-12-29 02:13:24 +00:00
|
|
|
_InitBeaconMaxError(Adapter, true);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//
|
|
|
|
// Init CR MACTXEN, MACRXEN after setting RxFF boundary REG_TRXFF_BNDY to patch
|
2014-12-19 06:59:46 +00:00
|
|
|
// Hw bug which Hw initials RxFF boundry size to a value which is larger than the real Rx buffer size in 88E.
|
2014-12-17 04:09:56 +00:00
|
|
|
//
|
|
|
|
// Enable MACTXEN/MACRXEN block
|
2013-05-08 21:45:39 +00:00
|
|
|
value16 = rtw_read16(Adapter, REG_CR);
|
|
|
|
value16 |= (MACTXEN | MACRXEN);
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(Adapter, REG_CR, value16);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
_InitHardwareDropIncorrectBulkOut(Adapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
if(pHalData->bRDGEnable){
|
2013-05-08 21:45:39 +00:00
|
|
|
_InitRDGSetting(Adapter);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if (RATE_ADAPTIVE_SUPPORT==1)
|
|
|
|
{//Enable TX Report
|
2014-12-19 06:59:46 +00:00
|
|
|
//Enable Tx Report Timer
|
2014-12-17 04:09:56 +00:00
|
|
|
value8 = rtw_read8(Adapter, REG_TX_RPT_CTRL);
|
|
|
|
rtw_write8(Adapter, REG_TX_RPT_CTRL, (value8|BIT1|BIT0));
|
|
|
|
//Set MAX RPT MACID
|
|
|
|
rtw_write8(Adapter, REG_TX_RPT_CTRL+1, 2);//FOR sta mode ,0: bc/mc ,1:AP
|
|
|
|
//Tx RPT Timer. Unit: 32us
|
|
|
|
rtw_write16(Adapter, REG_TX_RPT_TIME, 0xCdf0);
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
#ifdef CONFIG_TX_EARLY_MODE
|
2014-12-17 04:09:56 +00:00
|
|
|
if( pHalData->bEarlyModeEnable)
|
|
|
|
{
|
|
|
|
RT_TRACE(_module_hci_hal_init_c_, _drv_info_,("EarlyMode Enabled!!!\n"));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
value8 = rtw_read8(Adapter, REG_EARLY_MODE_CONTROL);
|
|
|
|
#if RTL8188E_EARLY_MODE_PKT_NUM_10 == 1
|
|
|
|
value8 = value8|0x1f;
|
|
|
|
#else
|
|
|
|
value8 = value8|0xf;
|
|
|
|
#endif
|
|
|
|
rtw_write8(Adapter, REG_EARLY_MODE_CONTROL, value8);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write8(Adapter, REG_EARLY_MODE_CONTROL+3, 0x80);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
value8 = rtw_read8(Adapter, REG_TCR+1);
|
|
|
|
value8 = value8|0x40;
|
|
|
|
rtw_write8(Adapter,REG_TCR+1, value8);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
rtw_write8(Adapter, REG_EARLY_MODE_CONTROL, 0);
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write32(Adapter,REG_MACID_NO_LINK_0,0xFFFFFFFF);
|
|
|
|
rtw_write32(Adapter,REG_MACID_NO_LINK_1,0xFFFFFFFF);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#if defined(CONFIG_CONCURRENT_MODE) || defined(CONFIG_TX_MCAST2UNI)
|
|
|
|
|
|
|
|
#ifdef CONFIG_CHECK_AC_LIFETIME
|
|
|
|
// Enable lifetime check for the four ACs
|
|
|
|
rtw_write8(Adapter, REG_LIFETIME_EN, 0x0F);
|
|
|
|
#endif // CONFIG_CHECK_AC_LIFETIME
|
|
|
|
|
|
|
|
#ifdef CONFIG_TX_MCAST2UNI
|
|
|
|
rtw_write16(Adapter, REG_PKT_VO_VI_LIFE_TIME, 0x0400); // unit: 256us. 256ms
|
|
|
|
rtw_write16(Adapter, REG_PKT_BE_BK_LIFE_TIME, 0x0400); // unit: 256us. 256ms
|
|
|
|
#else // CONFIG_TX_MCAST2UNI
|
|
|
|
rtw_write16(Adapter, REG_PKT_VO_VI_LIFE_TIME, 0x3000); // unit: 256us. 3s
|
|
|
|
rtw_write16(Adapter, REG_PKT_BE_BK_LIFE_TIME, 0x3000); // unit: 256us. 3s
|
|
|
|
#endif // CONFIG_TX_MCAST2UNI
|
|
|
|
#endif // CONFIG_CONCURRENT_MODE || CONFIG_TX_MCAST2UNI
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_LED
|
2013-05-08 21:45:39 +00:00
|
|
|
_InitHWLed(Adapter);
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif //CONFIG_LED
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//
|
|
|
|
// Joseph Note: Keep RfRegChnlVal for later use.
|
|
|
|
//
|
|
|
|
pHalData->RfRegChnlVal[0] = PHY_QueryRFReg(Adapter, (RF_RADIO_PATH_E)0, RF_CHNLBW, bRFRegOffsetMask);
|
|
|
|
pHalData->RfRegChnlVal[1] = PHY_QueryRFReg(Adapter, (RF_RADIO_PATH_E)1, RF_CHNLBW, bRFRegOffsetMask);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_TURN_ON_BLOCK);
|
|
|
|
_BBTurnOnBlock(Adapter);
|
2014-12-17 04:09:56 +00:00
|
|
|
//NicIFSetMacAddress(padapter, padapter->PermanentAddress);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_SECURITY);
|
|
|
|
invalidate_cam_all(Adapter);
|
|
|
|
|
|
|
|
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC11);
|
2014-12-17 04:09:56 +00:00
|
|
|
// 2010/12/17 MH We need to set TX power according to EFUSE content at first.
|
|
|
|
PHY_SetTxPowerLevel8188E(Adapter, pHalData->CurrentChannel);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
// Move by Neo for USB SS to below setp
|
2014-12-17 04:09:56 +00:00
|
|
|
//_RfPowerSave(Adapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
_InitAntenna_Selection(Adapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
//
|
2014-12-17 04:09:56 +00:00
|
|
|
// Disable BAR, suggested by Scott
|
|
|
|
// 2010.04.09 add by hpfan
|
|
|
|
//
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write32(Adapter, REG_BAR_MODE_CTRL, 0x0201ffff);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// HW SEQ CTRL
|
|
|
|
//set 0x0 to 0xFF by tynli. Default enable HW SEQ NUM.
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(Adapter,REG_HWSEQ_CTRL, 0xFF);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if(pregistrypriv->wifi_spec)
|
|
|
|
rtw_write16(Adapter,REG_FAST_EDCA_CTRL ,0);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//Nav limit , suggest by scott
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(Adapter, 0x652, 0x0);
|
|
|
|
|
|
|
|
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_HAL_DM);
|
|
|
|
rtl8188e_InitHalDm(Adapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#if (MP_DRIVER == 1)
|
|
|
|
if (Adapter->registrypriv.mp_mode == 1)
|
|
|
|
{
|
|
|
|
Adapter->mppriv.channel = pHalData->CurrentChannel;
|
2013-05-08 21:45:39 +00:00
|
|
|
MPT_InitializeAdapter(Adapter, Adapter->mppriv.channel);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif //#if (MP_DRIVER == 1)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
// 2010/08/11 MH Merge from 8192SE for Minicard init. We need to confirm current radio status
|
2014-12-19 06:59:46 +00:00
|
|
|
// and then decide to enable RF or not.!!!??? For Selective suspend mode. We may not
|
2014-12-17 04:09:56 +00:00
|
|
|
// call init_adapter. May cause some problem??
|
|
|
|
//
|
2014-12-19 06:59:46 +00:00
|
|
|
// Fix the bug that Hw/Sw radio off before S3/S4, the RF off action will not be executed
|
|
|
|
// in MgntActSet_RF_State() after wake up, because the value of pHalData->eRFPowerState
|
2014-12-17 04:09:56 +00:00
|
|
|
// is the same as eRfOff, we should change it to eRfOn after we config RF parameters.
|
|
|
|
// Added by tynli. 2010.03.30.
|
|
|
|
pwrctrlpriv->rf_pwrstate = rf_on;
|
|
|
|
|
|
|
|
// enable Tx report.
|
|
|
|
rtw_write8(Adapter, REG_FWHW_TXQ_CTRL+1, 0x0F);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// Suggested by SD1 pisa. Added by tynli. 2011.10.21.
|
|
|
|
rtw_write8(Adapter, REG_EARLY_MODE_CONTROL+3, 0x01);//Pretx_en, for WEP/TKIP SEC
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//tynli_test_tx_report.
|
|
|
|
rtw_write16(Adapter, REG_TX_RPT_TIME, 0x3DF0);
|
|
|
|
//RT_TRACE(COMP_INIT, DBG_TRACE, ("InitializeAdapter8188EUsb() <====\n"));
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//enable tx DMA to drop the redundate data of packet
|
|
|
|
rtw_write16(Adapter,REG_TXDMA_OFFSET_CHK, (rtw_read16(Adapter,REG_TXDMA_OFFSET_CHK) | DROP_DATA_EN));
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_IQK);
|
|
|
|
// 2010/08/26 MH Merge from 8192CE.
|
|
|
|
if(pwrctrlpriv->rf_pwrstate == rf_on)
|
|
|
|
{
|
|
|
|
if(pHalData->odmpriv.RFCalibrateInfo.bIQKInitialized){
|
2014-12-29 02:13:24 +00:00
|
|
|
PHY_IQCalibrate_8188E(Adapter,true);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
PHY_IQCalibrate_8188E(Adapter,false);
|
|
|
|
pHalData->odmpriv.RFCalibrateInfo.bIQKInitialized = true;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_PW_TRACK);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
ODM_TXPowerTrackingCheck(&pHalData->odmpriv );
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_LCK);
|
2014-12-17 04:09:56 +00:00
|
|
|
PHY_LCCalibrate_8188E(Adapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_PABIAS);
|
|
|
|
// _InitPABias(Adapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(Adapter, REG_USB_HRPWM, 0);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_XMIT_ACK
|
|
|
|
//ack for xmit mgmt frames.
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write32(Adapter, REG_FWHW_TXQ_CTRL, rtw_read32(Adapter, REG_FWHW_TXQ_CTRL)|BIT(12));
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif //CONFIG_XMIT_ACK
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
exit:
|
|
|
|
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_END);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_871X("%s in %dms\n", __FUNCTION__, rtw_get_passing_time_ms(init_start_time));
|
|
|
|
|
|
|
|
#ifdef DBG_HAL_INIT_PROFILING
|
|
|
|
hal_init_stages_timestamp[HAL_INIT_STAGES_END]=rtw_get_current_time();
|
|
|
|
|
|
|
|
for(hal_init_profiling_i=0;hal_init_profiling_i<HAL_INIT_STAGES_NUM-1;hal_init_profiling_i++) {
|
|
|
|
DBG_871X("DBG_HAL_INIT_PROFILING: %35s, %u, %5u, %5u\n"
|
|
|
|
, hal_init_stages_str[hal_init_profiling_i]
|
|
|
|
, hal_init_stages_timestamp[hal_init_profiling_i]
|
|
|
|
, (hal_init_stages_timestamp[hal_init_profiling_i+1]-hal_init_stages_timestamp[hal_init_profiling_i])
|
|
|
|
, rtw_get_time_interval_ms(hal_init_stages_timestamp[hal_init_profiling_i], hal_init_stages_timestamp[hal_init_profiling_i+1])
|
|
|
|
);
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void _ps_open_RF(struct adapter *padapter) {
|
2014-12-17 04:09:56 +00:00
|
|
|
//here call with bRegSSPwrLvl 1, bRegSSPwrLvl 2 needs to be verified
|
|
|
|
//phy_SsPwrSwitch92CU(padapter, rf_on, 1);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void _ps_close_RF(struct adapter *padapter){
|
2014-12-17 04:09:56 +00:00
|
|
|
//here call with bRegSSPwrLvl 1, bRegSSPwrLvl 2 needs to be verified
|
|
|
|
//phy_SsPwrSwitch92CU(padapter, rf_off, 1);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
void hal_poweroff_rtl8188eu(
|
2014-12-19 06:59:46 +00:00
|
|
|
IN struct adapter * Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
// PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo);
|
2014-12-19 06:59:46 +00:00
|
|
|
u8 val8;
|
2014-12-17 04:09:56 +00:00
|
|
|
u16 val16;
|
|
|
|
u32 val32;
|
2014-12-29 02:13:24 +00:00
|
|
|
u8 bMacPwrCtrlOn=false;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_hal_get_hwreg(Adapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn);
|
2014-12-29 02:13:24 +00:00
|
|
|
if(bMacPwrCtrlOn == false)
|
2014-12-17 04:09:56 +00:00
|
|
|
return ;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
RT_TRACE(COMP_INIT, DBG_LOUD, ("%s\n",__FUNCTION__));
|
|
|
|
|
|
|
|
//Stop Tx Report Timer. 0x4EC[Bit1]=b'0
|
2013-05-08 21:45:39 +00:00
|
|
|
val8 = rtw_read8(Adapter, REG_TX_RPT_CTRL);
|
|
|
|
rtw_write8(Adapter, REG_TX_RPT_CTRL, val8&(~BIT1));
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
// stop rx
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(Adapter, REG_CR, 0x0);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// Run LPS WL RFOFF flow
|
2013-05-08 21:45:39 +00:00
|
|
|
HalPwrSeqCmdParsing(Adapter, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, Rtl8188E_NIC_LPS_ENTER_FLOW);
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// 2. 0x1F[7:0] = 0 // turn off RF
|
|
|
|
//rtw_write8(Adapter, REG_RF_CTRL, 0x00);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
val8 = rtw_read8(Adapter, REG_MCUFWDL);
|
2014-12-17 04:09:56 +00:00
|
|
|
if ((val8 & RAM_DL_SEL) && Adapter->bFWReady) //8051 RAM code
|
|
|
|
{
|
|
|
|
//rtl8723a_FirmwareSelfReset(padapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
//_8051Reset88E(padapter);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// Reset MCU 0x2[10]=0.
|
2013-05-08 21:45:39 +00:00
|
|
|
val8 = rtw_read8(Adapter, REG_SYS_FUNC_EN+1);
|
2014-12-17 04:09:56 +00:00
|
|
|
val8 &= ~BIT(2); // 0x2[10], FEN_CPUEN
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(Adapter, REG_SYS_FUNC_EN+1, val8);
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
//val8 = rtw_read8(Adapter, REG_SYS_FUNC_EN+1);
|
|
|
|
//val8 &= ~BIT(2); // 0x2[10], FEN_CPUEN
|
|
|
|
//rtw_write8(Adapter, REG_SYS_FUNC_EN+1, val8);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// MCUFWDL 0x80[1:0]=0
|
|
|
|
// reset MCU ready status
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(Adapter, REG_MCUFWDL, 0);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//YJ,add,111212
|
|
|
|
//Disable 32k
|
2013-05-08 21:45:39 +00:00
|
|
|
val8 = rtw_read8(Adapter, REG_32K_CTRL);
|
|
|
|
rtw_write8(Adapter, REG_32K_CTRL, val8&(~BIT0));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// Card disable power action flow
|
2014-12-19 06:59:46 +00:00
|
|
|
HalPwrSeqCmdParsing(Adapter, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, Rtl8188E_NIC_DISABLE_FLOW);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// Reset MCU IO Wrapper
|
2013-05-08 21:45:39 +00:00
|
|
|
val8 = rtw_read8(Adapter, REG_RSV_CTRL+1);
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(Adapter, REG_RSV_CTRL+1, (val8&(~BIT3)));
|
2013-05-08 21:45:39 +00:00
|
|
|
val8 = rtw_read8(Adapter, REG_RSV_CTRL+1);
|
|
|
|
rtw_write8(Adapter, REG_RSV_CTRL+1, val8|BIT3);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//YJ,test add, 111207. For Power Consumption.
|
2013-05-08 21:45:39 +00:00
|
|
|
val8 = rtw_read8(Adapter, GPIO_IN);
|
|
|
|
rtw_write8(Adapter, GPIO_OUT, val8);
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write8(Adapter, GPIO_IO_SEL, 0xFF);//Reg0x46
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
val8 = rtw_read8(Adapter, REG_GPIO_IO_SEL);
|
2014-12-17 04:09:56 +00:00
|
|
|
//rtw_write8(Adapter, REG_GPIO_IO_SEL, (val8<<4)|val8);
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(Adapter, REG_GPIO_IO_SEL, (val8<<4));
|
|
|
|
val8 = rtw_read8(Adapter, REG_GPIO_IO_SEL+1);
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write8(Adapter, REG_GPIO_IO_SEL+1, val8|0x0F);//Reg0x43
|
|
|
|
rtw_write32(Adapter, REG_BB_PAD_CTRL, 0x00080808);//set LNA ,TRSW,EX_PA Pin to output mode
|
2014-12-29 02:13:24 +00:00
|
|
|
bMacPwrCtrlOn = false;
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_hal_set_hwreg(Adapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn);
|
2014-12-29 02:13:24 +00:00
|
|
|
Adapter->bFWReady = false;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-29 02:00:11 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void rtl8188eu_hw_power_down(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
// 2010/-8/09 MH For power down module, we need to enable register block contrl reg at 0x1c.
|
|
|
|
// Then enable power down control bit of register 0x04 BIT4 and BIT15 as 1.
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// Enable register area 0x0-0xc.
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(padapter,REG_RSV_CTRL, 0x0);
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write16(padapter, REG_APS_FSMCO, 0x8812);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u32 rtl8188eu_hal_deinit(struct adapter *Adapter)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(Adapter);
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
DBG_8192C("==> %s \n",__FUNCTION__);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_SUPPORT_USB_INT
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write32(Adapter, REG_HIMR_88E, IMR_DISABLED_88E);
|
|
|
|
rtw_write32(Adapter, REG_HIMRE_88E, IMR_DISABLED_88E);
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef SUPPORT_HW_RFOFF_DETECTED
|
2014-12-19 06:59:46 +00:00
|
|
|
DBG_8192C("bkeepfwalive(%x)\n", pwrctl->bkeepfwalive);
|
|
|
|
if(pwrctl->bkeepfwalive)
|
|
|
|
{
|
|
|
|
_ps_close_RF(Adapter);
|
|
|
|
if((pwrctl->bHWPwrPindetect) && (pwrctl->bHWPowerdown))
|
2014-12-17 04:09:56 +00:00
|
|
|
rtl8188eu_hw_power_down(Adapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
if(Adapter->hw_init_completed == true){
|
2014-12-17 04:09:56 +00:00
|
|
|
hal_poweroff_rtl8188eu(Adapter);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
if((pwrctl->bHWPwrPindetect ) && (pwrctl->bHWPowerdown))
|
2014-12-17 04:09:56 +00:00
|
|
|
rtl8188eu_hw_power_down(Adapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
return _SUCCESS;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
unsigned int rtl8188eu_inirp_init(struct adapter *Adapter)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
|
|
|
u8 i;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct recv_buf *precvbuf;
|
|
|
|
uint status;
|
2014-12-17 04:09:56 +00:00
|
|
|
struct dvobj_priv *pdev= adapter_to_dvobj(Adapter);
|
|
|
|
struct intf_hdl * pintfhdl=&Adapter->iopriv.intf;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct recv_priv *precvpriv = &(Adapter->recvpriv);
|
2013-05-08 21:45:39 +00:00
|
|
|
u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_USB_INTERRUPT_IN_PIPE
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
|
|
|
u32 (*_read_interrupt)(struct intf_hdl *pintfhdl, u32 addr);
|
|
|
|
#endif
|
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
_read_port = pintfhdl->io_ops._read_port;
|
|
|
|
|
|
|
|
status = _SUCCESS;
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
RT_TRACE(_module_hci_hal_init_c_,_drv_info_,("===> usb_inirp_init \n"));
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
precvpriv->ff_hwaddr = RECV_BULK_IN_ADDR;
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
//issue Rx irp to receive data
|
|
|
|
precvbuf = (struct recv_buf *)precvpriv->precv_buf;
|
2014-12-17 04:09:56 +00:00
|
|
|
for(i=0; i<NR_RECVBUFF; i++)
|
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
if(_read_port(pintfhdl, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf) == false )
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
RT_TRACE(_module_hci_hal_init_c_,_drv_err_,("usb_rx_init: usb_read_port error \n"));
|
2013-05-08 21:45:39 +00:00
|
|
|
status = _FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
precvbuf++;
|
2013-05-08 21:45:39 +00:00
|
|
|
precvpriv->free_recv_buf_queue_cnt--;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_USB_INTERRUPT_IN_PIPE
|
|
|
|
if(pHalData->RtIntInPipe != 0x05)
|
|
|
|
{
|
|
|
|
status = _FAIL;
|
|
|
|
DBG_871X("%s =>Warning !! Have not USB Int-IN pipe, pHalData->RtIntInPipe(%d)!!!\n",__FUNCTION__,pHalData->RtIntInPipe);
|
|
|
|
goto exit;
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
_read_interrupt = pintfhdl->io_ops._read_interrupt;
|
2014-12-29 02:13:24 +00:00
|
|
|
if(_read_interrupt(pintfhdl, RECV_INT_IN_ADDR) == false )
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
RT_TRACE(_module_hci_hal_init_c_,_drv_err_,("usb_rx_init: usb_read_interrupt error \n"));
|
|
|
|
status = _FAIL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
RT_TRACE(_module_hci_hal_init_c_,_drv_info_,("<=== usb_inirp_init \n"));
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return status;
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
unsigned int rtl8188eu_inirp_deinit(struct adapter *Adapter)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
RT_TRACE(_module_hci_hal_init_c_,_drv_info_,("\n ===> usb_rx_deinit \n"));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_read_port_cancel(Adapter);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
RT_TRACE(_module_hci_hal_init_c_,_drv_info_,("\n <=== usb_rx_deinit \n"));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return _SUCCESS;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//-------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// EEPROM/EFUSE Content Parsing
|
|
|
|
//
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
static void
|
|
|
|
_ReadIDs(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
IN u8* PROMContent,
|
|
|
|
IN BOOLEAN AutoloadFail
|
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_ReadMACAddress(
|
2014-12-19 06:59:46 +00:00
|
|
|
IN struct adapter *Adapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
IN u8* PROMContent,
|
|
|
|
IN BOOLEAN AutoloadFail
|
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_ReadBoardType(
|
2014-12-19 06:59:46 +00:00
|
|
|
IN struct adapter *Adapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
IN u8* PROMContent,
|
|
|
|
IN BOOLEAN AutoloadFail
|
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_ReadLEDSetting(
|
2014-12-19 06:59:46 +00:00
|
|
|
IN struct adapter *Adapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
IN u8* PROMContent,
|
|
|
|
IN BOOLEAN AutoloadFail
|
|
|
|
)
|
|
|
|
{
|
|
|
|
struct led_priv *pledpriv = &(Adapter->ledpriv);
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
|
|
|
#ifdef CONFIG_SW_LED
|
2014-12-29 02:13:24 +00:00
|
|
|
pledpriv->bRegUseLed = true;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
switch(pHalData->CustomerID)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
pledpriv->LedStrategy = SW_LED_MODE1;
|
|
|
|
break;
|
|
|
|
}
|
2014-12-29 02:13:24 +00:00
|
|
|
pHalData->bLedOpenDrain = true;// Support Open-drain arrangement for controlling the LED. Added by Roger, 2009.10.16.
|
2014-12-17 04:09:56 +00:00
|
|
|
#else // HW LED
|
|
|
|
pledpriv->LedStrategy = HW_LED;
|
|
|
|
#endif //CONFIG_SW_LED
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2013-05-27 22:32:24 +00:00
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_ReadThermalMeter(
|
2014-12-19 06:59:46 +00:00
|
|
|
IN struct adapter *Adapter,
|
|
|
|
IN u8* PROMContent,
|
|
|
|
IN BOOLEAN AutoloadFail
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_ReadRFSetting(
|
2014-12-19 06:59:46 +00:00
|
|
|
IN struct adapter *Adapter,
|
|
|
|
IN u8* PROMContent,
|
|
|
|
IN BOOLEAN AutoloadFail
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
static void
|
|
|
|
_ReadPROMVersion(
|
2014-12-19 06:59:46 +00:00
|
|
|
IN struct adapter *Adapter,
|
|
|
|
IN u8* PROMContent,
|
|
|
|
IN BOOLEAN AutoloadFail
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
readAntennaDiversity(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *pAdapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
IN u8 *hwinfo,
|
|
|
|
IN BOOLEAN AutoLoadFail
|
|
|
|
)
|
|
|
|
{
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
|
|
|
|
struct registry_priv *registry_par = &pAdapter->registrypriv;
|
|
|
|
|
|
|
|
pHalData->AntDivCfg = registry_par->antdiv_cfg ; // 0:OFF , 1:ON,
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
hal_InitPGData(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *pAdapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
IN OUT u8 *PROMContent
|
|
|
|
)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static void
|
|
|
|
Hal_EfuseParsePIDVID_8188EU(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter * pAdapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
IN u8* hwinfo,
|
|
|
|
IN BOOLEAN AutoLoadFail
|
|
|
|
)
|
|
|
|
{
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if( !AutoLoadFail )
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
// VID, PID
|
2015-01-28 05:14:58 +00:00
|
|
|
pHalData->EEPROMVID = EF2BYTE(*(__le16 *)&hwinfo[EEPROM_VID_88EU]);
|
|
|
|
pHalData->EEPROMPID = EF2BYTE(*(__le16 *)&hwinfo[EEPROM_PID_88EU]);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
// Customer ID, 0x00 and 0xff are reserved for Realtek.
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData->EEPROMCustomerID = *(u8 *)&hwinfo[EEPROM_CUSTOMERID_88E];
|
|
|
|
pHalData->EEPROMSubCustomerID = EEPROM_Default_SubCustomerID;
|
2015-01-28 05:14:58 +00:00
|
|
|
} else {
|
2014-12-19 06:59:46 +00:00
|
|
|
pHalData->EEPROMVID = EEPROM_Default_VID;
|
|
|
|
pHalData->EEPROMPID = EEPROM_Default_PID;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
// Customer ID, 0x00 and 0xff are reserved for Realtek.
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData->EEPROMCustomerID = EEPROM_Default_CustomerID;
|
|
|
|
pHalData->EEPROMSubCustomerID = EEPROM_Default_SubCustomerID;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
DBG_871X("VID = 0x%04X, PID = 0x%04X\n", pHalData->EEPROMVID, pHalData->EEPROMPID);
|
|
|
|
DBG_871X("Customer ID: 0x%02X, SubCustomer ID: 0x%02X\n", pHalData->EEPROMCustomerID, pHalData->EEPROMSubCustomerID);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
static void
|
|
|
|
Hal_EfuseParseMACAddr_8188EU(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter * padapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
IN u8* hwinfo,
|
|
|
|
IN BOOLEAN AutoLoadFail
|
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u16 i, usValue;
|
|
|
|
u8 sMacAddr[6] = {0x00, 0xE0, 0x4C, 0x81, 0x88, 0x02};
|
|
|
|
EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
|
|
|
|
|
|
|
|
if (AutoLoadFail)
|
|
|
|
{
|
2014-12-30 23:50:44 +00:00
|
|
|
// sMacAddr[5] = (u8)GetRandomNumber(1, 254);
|
2014-12-17 04:09:56 +00:00
|
|
|
for (i=0; i<6; i++)
|
|
|
|
pEEPROM->mac_addr[i] = sMacAddr[i];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//Read Permanent MAC address
|
|
|
|
_rtw_memcpy(pEEPROM->mac_addr, &hwinfo[EEPROM_MAC_ADDR_88EU], ETH_ALEN);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
// NicIFSetMacAddress(pAdapter, pAdapter->PermanentAddress);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
RT_TRACE(_module_hci_hal_init_c_, _drv_notice_,
|
|
|
|
("Hal_EfuseParseMACAddr_8188EU: Permanent Address = %02x-%02x-%02x-%02x-%02x-%02x\n",
|
|
|
|
pEEPROM->mac_addr[0], pEEPROM->mac_addr[1],
|
|
|
|
pEEPROM->mac_addr[2], pEEPROM->mac_addr[3],
|
|
|
|
pEEPROM->mac_addr[4], pEEPROM->mac_addr[5]));
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
Hal_CustomizeByCustomerID_8188EU(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter * padapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
// Read HW power down mode selection
|
2014-12-17 23:13:53 +00:00
|
|
|
static void _ReadPSSetting(IN struct adapter *Adapter,IN u8*PROMContent,IN u8 AutoloadFail)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_EFUSE_CONFIG_FILE
|
|
|
|
static u32 Hal_readPGDataFromConfigFile(
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *padapter)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
u32 i;
|
|
|
|
struct file *fp;
|
|
|
|
mm_segment_t fs;
|
|
|
|
u8 temp[3];
|
|
|
|
loff_t pos = 0;
|
|
|
|
EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
|
|
|
|
u8 *PROMContent = pEEPROM->efuse_eeprom_data;
|
|
|
|
|
|
|
|
|
|
|
|
temp[2] = 0; // add end of string '\0'
|
|
|
|
|
|
|
|
fp = filp_open("/system/etc/wifi/wifi_efuse.map", O_RDWR, 0644);
|
|
|
|
if (IS_ERR(fp)) {
|
2014-12-29 02:13:24 +00:00
|
|
|
pEEPROM->bloadfile_fail_flag = true;
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_871X("Error, Efuse configure file doesn't exist.\n");
|
|
|
|
return _FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
fs = get_fs();
|
|
|
|
set_fs(KERNEL_DS);
|
|
|
|
|
|
|
|
DBG_871X("Efuse configure file:\n");
|
|
|
|
for (i=0; i<HWSET_MAX_SIZE_88E; i++) {
|
|
|
|
vfs_read(fp, temp, 2, &pos);
|
|
|
|
PROMContent[i] = simple_strtoul(temp, NULL, 16 );
|
|
|
|
pos += 1; // Filter the space character
|
|
|
|
DBG_871X("%02X \n", PROMContent[i]);
|
|
|
|
}
|
|
|
|
DBG_871X("\n");
|
|
|
|
set_fs(fs);
|
|
|
|
|
|
|
|
filp_close(fp, NULL);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
pEEPROM->bloadfile_fail_flag = false;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
return _SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
Hal_ReadMACAddrFromFile_8188EU(
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter * padapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
u32 i;
|
|
|
|
struct file *fp;
|
|
|
|
mm_segment_t fs;
|
|
|
|
u8 source_addr[18];
|
|
|
|
loff_t pos = 0;
|
|
|
|
u32 curtime = rtw_get_current_time();
|
|
|
|
EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
|
|
|
|
u8 *head, *end;
|
|
|
|
|
|
|
|
u8 null_mac_addr[ETH_ALEN] = {0, 0, 0,0, 0, 0};
|
|
|
|
u8 multi_mac_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
_rtw_memset(source_addr, 0, 18);
|
|
|
|
_rtw_memset(pEEPROM->mac_addr, 0, ETH_ALEN);
|
|
|
|
|
|
|
|
fp = filp_open("/data/wifimac.txt", O_RDWR, 0644);
|
|
|
|
if (IS_ERR(fp)) {
|
2014-12-29 02:13:24 +00:00
|
|
|
pEEPROM->bloadmac_fail_flag = true;
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_871X("Error, wifi mac address file doesn't exist.\n");
|
|
|
|
} else {
|
|
|
|
fs = get_fs();
|
|
|
|
set_fs(KERNEL_DS);
|
|
|
|
|
|
|
|
DBG_871X("wifi mac address:\n");
|
|
|
|
vfs_read(fp, source_addr, 18, &pos);
|
|
|
|
source_addr[17] = ':';
|
|
|
|
|
|
|
|
head = end = source_addr;
|
|
|
|
for (i=0; i<ETH_ALEN; i++) {
|
|
|
|
while (end && (*end != ':') )
|
|
|
|
end++;
|
|
|
|
|
|
|
|
if (end && (*end == ':') )
|
|
|
|
*end = '\0';
|
|
|
|
|
|
|
|
pEEPROM->mac_addr[i] = simple_strtoul(head, NULL, 16 );
|
|
|
|
|
|
|
|
if (end) {
|
|
|
|
end++;
|
|
|
|
head = end;
|
|
|
|
}
|
|
|
|
DBG_871X("%02x \n", pEEPROM->mac_addr[i]);
|
|
|
|
}
|
|
|
|
DBG_871X("\n");
|
|
|
|
set_fs(fs);
|
2014-12-29 02:13:24 +00:00
|
|
|
pEEPROM->bloadmac_fail_flag = false;
|
2014-12-17 04:09:56 +00:00
|
|
|
filp_close(fp, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( (_rtw_memcmp(pEEPROM->mac_addr, null_mac_addr, ETH_ALEN)) ||
|
|
|
|
(_rtw_memcmp(pEEPROM->mac_addr, multi_mac_addr, ETH_ALEN)) ) {
|
|
|
|
pEEPROM->mac_addr[0] = 0x00;
|
|
|
|
pEEPROM->mac_addr[1] = 0xe0;
|
|
|
|
pEEPROM->mac_addr[2] = 0x4c;
|
|
|
|
pEEPROM->mac_addr[3] = (u8)(curtime & 0xff) ;
|
|
|
|
pEEPROM->mac_addr[4] = (u8)((curtime>>8) & 0xff) ;
|
|
|
|
pEEPROM->mac_addr[5] = (u8)((curtime>>16) & 0xff) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
DBG_871X("Hal_ReadMACAddrFromFile_8188ES: Permanent Address = %02x-%02x-%02x-%02x-%02x-%02x\n",
|
|
|
|
pEEPROM->mac_addr[0], pEEPROM->mac_addr[1],
|
|
|
|
pEEPROM->mac_addr[2], pEEPROM->mac_addr[3],
|
|
|
|
pEEPROM->mac_addr[4], pEEPROM->mac_addr[5]);
|
|
|
|
}
|
|
|
|
#endif //CONFIG_EFUSE_CONFIG_FILE
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
readAdapterInfo_8188EU(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *padapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
|
|
|
|
|
|
|
|
/* parse the eeprom/efuse content */
|
|
|
|
Hal_EfuseParseIDCode88E(padapter, pEEPROM->efuse_eeprom_data);
|
|
|
|
Hal_EfuseParsePIDVID_8188EU(padapter, pEEPROM->efuse_eeprom_data, pEEPROM->bautoload_fail_flag);
|
|
|
|
#ifdef CONFIG_EFUSE_CONFIG_FILE
|
|
|
|
Hal_ReadMACAddrFromFile_8188EU(padapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
#else //CONFIG_EFUSE_CONFIG_FILE
|
2014-12-17 04:09:56 +00:00
|
|
|
Hal_EfuseParseMACAddr_8188EU(padapter, pEEPROM->efuse_eeprom_data, pEEPROM->bautoload_fail_flag);
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif //CONFIG_EFUSE_CONFIG_FILE
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
Hal_ReadPowerSavingMode88E(padapter, pEEPROM->efuse_eeprom_data, pEEPROM->bautoload_fail_flag);
|
2014-12-19 06:59:46 +00:00
|
|
|
Hal_ReadTxPowerInfo88E(padapter, pEEPROM->efuse_eeprom_data, pEEPROM->bautoload_fail_flag);
|
2014-12-17 04:09:56 +00:00
|
|
|
Hal_EfuseParseEEPROMVer88E(padapter, pEEPROM->efuse_eeprom_data, pEEPROM->bautoload_fail_flag);
|
|
|
|
rtl8188e_EfuseParseChnlPlan(padapter, pEEPROM->efuse_eeprom_data, pEEPROM->bautoload_fail_flag);
|
|
|
|
Hal_EfuseParseXtal_8188E(padapter, pEEPROM->efuse_eeprom_data, pEEPROM->bautoload_fail_flag);
|
|
|
|
Hal_EfuseParseCustomerID88E(padapter, pEEPROM->efuse_eeprom_data, pEEPROM->bautoload_fail_flag);
|
|
|
|
Hal_ReadAntennaDiversity88E(padapter, pEEPROM->efuse_eeprom_data, pEEPROM->bautoload_fail_flag);
|
|
|
|
Hal_EfuseParseBoardType88E(padapter, pEEPROM->efuse_eeprom_data, pEEPROM->bautoload_fail_flag);
|
|
|
|
Hal_ReadThermalMeter_88E(padapter, pEEPROM->efuse_eeprom_data, pEEPROM->bautoload_fail_flag);
|
|
|
|
|
|
|
|
//
|
|
|
|
// The following part initialize some vars by PG info.
|
|
|
|
//
|
|
|
|
Hal_InitChannelPlan(padapter);
|
|
|
|
Hal_CustomizeByCustomerID_8188EU(padapter);
|
|
|
|
|
|
|
|
_ReadLEDSetting(padapter, pEEPROM->efuse_eeprom_data, pEEPROM->bautoload_fail_flag);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _ReadPROMContent(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter * Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(Adapter);
|
|
|
|
u8 eeValue;
|
|
|
|
|
|
|
|
/* check system boot selection */
|
|
|
|
eeValue = rtw_read8(Adapter, REG_9346CR);
|
2014-12-29 02:13:24 +00:00
|
|
|
pEEPROM->EepromOrEfuse = (eeValue & BOOT_FROM_EEPROM) ? true : false;
|
|
|
|
pEEPROM->bautoload_fail_flag = (eeValue & EEPROM_EN) ? false : true;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
DBG_8192C("Boot from %s, Autoload %s !\n", (pEEPROM->EepromOrEfuse ? "EEPROM" : "EFUSE"),
|
|
|
|
(pEEPROM->bautoload_fail_flag ? "Fail" : "OK") );
|
|
|
|
|
|
|
|
//pHalData->EEType = IS_BOOT_FROM_EEPROM(Adapter) ? EEPROM_93C46 : EEPROM_BOOT_EFUSE;
|
|
|
|
#ifdef CONFIG_EFUSE_CONFIG_FILE
|
|
|
|
Hal_readPGDataFromConfigFile(Adapter);
|
|
|
|
#else //CONFIG_EFUSE_CONFIG_FILE
|
|
|
|
Hal_InitPGData88E(Adapter);
|
|
|
|
#endif //CONFIG_EFUSE_CONFIG_FILE
|
|
|
|
readAdapterInfo_8188EU(Adapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_ReadRFType(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter *Adapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
|
|
|
|
|
|
|
#if DISABLE_BB_RF
|
|
|
|
pHalData->rf_chip = RF_PSEUDO_11N;
|
|
|
|
#else
|
|
|
|
pHalData->rf_chip = RF_6052;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static int _ReadAdapterInfo8188EU(struct adapter *Adapter)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
//HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
|
|
|
u32 start=rtw_get_current_time();
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
MSG_8192C("====> %s\n", __FUNCTION__);
|
|
|
|
|
|
|
|
//Efuse_InitSomeVar(Adapter);
|
|
|
|
|
|
|
|
//if(IS_HARDWARE_TYPE_8723A(Adapter))
|
|
|
|
// _EfuseCellSel(Adapter);
|
|
|
|
|
|
|
|
_ReadRFType(Adapter);//rf_chip -> _InitRFType()
|
|
|
|
_ReadPROMContent(Adapter);
|
|
|
|
|
|
|
|
//MSG_8192C("%s()(done), rf_chip=0x%x, rf_type=0x%x\n", __FUNCTION__, pHalData->rf_chip, pHalData->rf_type);
|
|
|
|
|
|
|
|
MSG_8192C("<==== %s in %d ms\n", __FUNCTION__, rtw_get_passing_time_ms(start));
|
|
|
|
|
|
|
|
return _SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void ReadAdapterInfo8188EU(struct adapter *Adapter)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
// Read EEPROM size before call any EEPROM function
|
2014-12-17 04:09:56 +00:00
|
|
|
Adapter->EepromAddressSize = GetEEPROMSize8188E(Adapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
_ReadAdapterInfo8188EU(Adapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define GPIO_DEBUG_PORT_NUM 0
|
2014-12-17 23:13:53 +00:00
|
|
|
static void rtl8192cu_trigger_gpio_0(struct adapter *padapter)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
#ifdef CONFIG_USB_SUPPORT_ASYNC_VDN_REQ
|
2014-12-17 04:09:56 +00:00
|
|
|
u32 gpioctrl;
|
|
|
|
DBG_8192C("==> trigger_gpio_0...\n");
|
|
|
|
rtw_write16_async(padapter,REG_GPIO_PIN_CTRL,0);
|
|
|
|
rtw_write8_async(padapter,REG_GPIO_PIN_CTRL+2,0xFF);
|
|
|
|
gpioctrl = (BIT(GPIO_DEBUG_PORT_NUM)<<24 )|(BIT(GPIO_DEBUG_PORT_NUM)<<16);
|
|
|
|
rtw_write32_async(padapter,REG_GPIO_PIN_CTRL,gpioctrl);
|
|
|
|
gpioctrl |= (BIT(GPIO_DEBUG_PORT_NUM)<<8);
|
|
|
|
rtw_write32_async(padapter,REG_GPIO_PIN_CTRL,gpioctrl);
|
|
|
|
DBG_8192C("<=== trigger_gpio_0...\n");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void ResumeTxBeacon(struct adapter *padapter)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
HAL_DATA_TYPE* pHalData = GET_HAL_DATA(padapter);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
// 2010.03.01. Marked by tynli. No need to call workitem beacause we record the value
|
|
|
|
// which should be read from register to a global variable.
|
|
|
|
|
|
|
|
rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, (pHalData->RegFwHwTxQCtrl) | BIT6);
|
|
|
|
pHalData->RegFwHwTxQCtrl |= BIT6;
|
|
|
|
rtw_write8(padapter, REG_TBTT_PROHIBIT+1, 0xff);
|
|
|
|
pHalData->RegReg542 |= BIT0;
|
|
|
|
rtw_write8(padapter, REG_TBTT_PROHIBIT+2, pHalData->RegReg542);
|
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
void UpdateInterruptMask8188EU(struct adapter *padapter,u8 bHIMR0 ,u32 AddMSR, u32 RemoveMSR)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
HAL_DATA_TYPE *pHalData;
|
|
|
|
|
|
|
|
u32 *himr;
|
|
|
|
pHalData = GET_HAL_DATA(padapter);
|
|
|
|
|
|
|
|
if(bHIMR0)
|
|
|
|
himr = &(pHalData->IntrMask[0]);
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
himr = &(pHalData->IntrMask[1]);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if (AddMSR)
|
|
|
|
*himr |= AddMSR;
|
|
|
|
|
|
|
|
if (RemoveMSR)
|
|
|
|
*himr &= (~RemoveMSR);
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
if(bHIMR0)
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write32(padapter, REG_HIMR_88E, *himr);
|
|
|
|
else
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write32(padapter, REG_HIMRE_88E, *himr);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void StopTxBeacon(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE* pHalData = GET_HAL_DATA(padapter);
|
2014-12-01 22:31:15 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// 2010.03.01. Marked by tynli. No need to call workitem beacause we record the value
|
|
|
|
// which should be read from register to a global variable.
|
|
|
|
|
|
|
|
rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, (pHalData->RegFwHwTxQCtrl) & (~BIT6));
|
|
|
|
pHalData->RegFwHwTxQCtrl &= (~BIT6);
|
|
|
|
rtw_write8(padapter, REG_TBTT_PROHIBIT+1, 0x64);
|
|
|
|
pHalData->RegReg542 &= ~(BIT0);
|
|
|
|
rtw_write8(padapter, REG_TBTT_PROHIBIT+2, pHalData->RegReg542);
|
|
|
|
|
|
|
|
//todo: CheckFwRsvdPageContent(Adapter); // 2010.06.23. Added by tynli.
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void hw_var_set_opmode(struct adapter *Adapter, u8 variable, u8* val)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
u8 val8;
|
|
|
|
u8 mode = *((u8 *)val);
|
|
|
|
//HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
|
|
|
|
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
|
|
|
if(Adapter->iface_type == IFACE_PORT1)
|
|
|
|
{
|
|
|
|
// disable Port1 TSF update
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(4));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// set net_type
|
|
|
|
val8 = rtw_read8(Adapter, MSR)&0x03;
|
|
|
|
val8 |= (mode<<2);
|
|
|
|
rtw_write8(Adapter, MSR, val8);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_871X("%s()-%d mode = %d\n", __FUNCTION__, __LINE__, mode);
|
|
|
|
|
|
|
|
if((mode == _HW_STATE_STATION_) || (mode == _HW_STATE_NOLINK_))
|
2013-08-09 03:23:49 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
if(!check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
#ifdef CONFIG_INTERRUPT_BASED_TXBCN
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
#ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write8(Adapter, REG_DRVERLYINT, 0x05);//restore early int time to 5ms
|
2014-12-29 02:13:24 +00:00
|
|
|
UpdateInterruptMask8188EU(Adapter,true, 0, IMR_BCNDMAINT0_88E);
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif // CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
|
2014-12-29 02:13:24 +00:00
|
|
|
UpdateInterruptMask8188EU(Adapter,true ,0, (IMR_TBDER_88E|IMR_TBDOK_88E));
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif// CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
#endif //CONFIG_INTERRUPT_BASED_TXBCN
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
StopTxBeacon(Adapter);
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write8(Adapter,REG_BCN_CTRL_1, 0x11);//disable atim wnd and disable beacon function
|
|
|
|
//rtw_write8(Adapter,REG_BCN_CTRL_1, 0x18);
|
2013-08-09 03:23:49 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
else if((mode == _HW_STATE_ADHOC_) /*|| (mode == _HW_STATE_AP_)*/)
|
2013-08-09 03:23:49 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
ResumeTxBeacon(Adapter);
|
|
|
|
rtw_write8(Adapter,REG_BCN_CTRL_1, 0x1a);
|
|
|
|
//BIT4 - If set 0, hw will clr bcnq when tx becon ok/fail or port 1
|
|
|
|
rtw_write8(Adapter, REG_MBID_NUM, rtw_read8(Adapter, REG_MBID_NUM)|BIT(3)|BIT(4));
|
2013-08-09 03:23:49 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
else if(mode == _HW_STATE_AP_)
|
2013-08-09 03:23:49 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
#ifdef CONFIG_INTERRUPT_BASED_TXBCN
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
|
2014-12-29 02:13:24 +00:00
|
|
|
UpdateInterruptMask8188EU(Adapter,true ,IMR_BCNDMAINT0_88E, 0);
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif//CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
#ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
|
2014-12-29 02:13:24 +00:00
|
|
|
UpdateInterruptMask8188EU(Adapter,true ,(IMR_TBDER_88E|IMR_TBDOK_88E), 0);
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif//CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif //CONFIG_INTERRUPT_BASED_TXBCN
|
|
|
|
|
|
|
|
ResumeTxBeacon(Adapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL_1, 0x12);
|
|
|
|
|
|
|
|
//Set RCR
|
|
|
|
//rtw_write32(padapter, REG_RCR, 0x70002a8e);//CBSSID_DATA must set to 0
|
|
|
|
//rtw_write32(Adapter, REG_RCR, 0x7000228e);//CBSSID_DATA must set to 0
|
|
|
|
rtw_write32(Adapter, REG_RCR, 0x7000208e);//CBSSID_DATA must set to 0,reject ICV_ERR packet
|
2014-12-19 06:59:46 +00:00
|
|
|
//enable to rx data frame
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write16(Adapter, REG_RXFLTMAP2, 0xFFFF);
|
|
|
|
//enable to rx ps-poll
|
|
|
|
rtw_write16(Adapter, REG_RXFLTMAP1, 0x0400);
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
//Beacon Control related register for first time
|
|
|
|
rtw_write8(Adapter, REG_BCNDMATIM, 0x02); // 2ms
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
//rtw_write8(Adapter, REG_BCN_MAX_ERR, 0xFF);
|
|
|
|
rtw_write8(Adapter, REG_ATIMWND_1, 0x0a); // 10ms for port1
|
|
|
|
rtw_write16(Adapter, REG_BCNTCFG, 0x00);
|
|
|
|
rtw_write16(Adapter, REG_TBTT_PROHIBIT, 0xff04);
|
|
|
|
rtw_write16(Adapter, REG_TSFTR_SYN_OFFSET, 0x7fff);// +32767 (~32ms)
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
//reset TSF2
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1));
|
|
|
|
|
|
|
|
|
|
|
|
//BIT4 - If set 0, hw will clr bcnq when tx becon ok/fail or port 1
|
|
|
|
rtw_write8(Adapter, REG_MBID_NUM, rtw_read8(Adapter, REG_MBID_NUM)|BIT(3)|BIT(4));
|
2014-12-19 06:59:46 +00:00
|
|
|
//enable BCN1 Function for if2
|
2014-12-17 04:09:56 +00:00
|
|
|
//don't enable update TSF1 for if2 (due to TSF update when beacon/probe rsp are received)
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL_1, (DIS_TSF_UDT0_NORMAL_CHIP|EN_BCN_FUNCTION | EN_TXBCN_RPT|BIT(1)));
|
|
|
|
|
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
|
|
|
if(check_buddy_fwstate(Adapter, WIFI_FW_NULL_STATE))
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL,
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_read8(Adapter, REG_BCN_CTRL) & ~EN_BCN_FUNCTION);
|
|
|
|
#endif
|
|
|
|
//BCN1 TSF will sync to BCN0 TSF with offset(0x518) if if1_sta linked
|
|
|
|
//rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(5));
|
|
|
|
//rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(3));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//dis BCN0 ATIM WND if if1 is station
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(0));
|
|
|
|
|
|
|
|
#ifdef CONFIG_TSF_RESET_OFFLOAD
|
|
|
|
// Reset TSF for STA+AP concurrent mode
|
|
|
|
if ( check_buddy_fwstate(Adapter, (WIFI_STATION_STATE|WIFI_ASOC_STATE)) ) {
|
2014-12-29 02:13:24 +00:00
|
|
|
if (reset_tsf(Adapter, IFACE_PORT1) == false)
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_871X("ERROR! %s()-%d: Reset port1 TSF fail\n",
|
|
|
|
__FUNCTION__, __LINE__);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif // CONFIG_TSF_RESET_OFFLOAD
|
2013-08-09 03:23:49 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif //CONFIG_CONCURRENT_MODE
|
|
|
|
{
|
|
|
|
// disable Port0 TSF update
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(4));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// set net_type
|
|
|
|
val8 = rtw_read8(Adapter, MSR)&0x0c;
|
|
|
|
val8 |= mode;
|
|
|
|
rtw_write8(Adapter, MSR, val8);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_871X("%s()-%d mode = %d\n", __FUNCTION__, __LINE__, mode);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if((mode == _HW_STATE_STATION_) || (mode == _HW_STATE_NOLINK_))
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
2014-12-19 06:59:46 +00:00
|
|
|
if(!check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE))
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif //CONFIG_CONCURRENT_MODE
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
#ifdef CONFIG_INTERRUPT_BASED_TXBCN
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(Adapter, REG_DRVERLYINT, 0x05);//restore early int time to 5ms
|
2014-12-29 02:13:24 +00:00
|
|
|
UpdateInterruptMask8188EU(Adapter,true, 0, IMR_BCNDMAINT0_88E);
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif//CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
|
2014-12-29 02:13:24 +00:00
|
|
|
UpdateInterruptMask8188EU(Adapter,true ,0, (IMR_TBDER_88E|IMR_TBDOK_88E));
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif //CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
#endif //CONFIG_INTERRUPT_BASED_TXBCN
|
2014-12-17 04:09:56 +00:00
|
|
|
StopTxBeacon(Adapter);
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write8(Adapter,REG_BCN_CTRL, 0x19);//disable atim wnd
|
|
|
|
//rtw_write8(Adapter,REG_BCN_CTRL, 0x18);
|
|
|
|
}
|
|
|
|
else if((mode == _HW_STATE_ADHOC_) /*|| (mode == _HW_STATE_AP_)*/)
|
|
|
|
{
|
|
|
|
ResumeTxBeacon(Adapter);
|
|
|
|
rtw_write8(Adapter,REG_BCN_CTRL, 0x1a);
|
|
|
|
//BIT3 - If set 0, hw will clr bcnq when tx becon ok/fail or port 0
|
|
|
|
rtw_write8(Adapter, REG_MBID_NUM, rtw_read8(Adapter, REG_MBID_NUM)|BIT(3)|BIT(4));
|
|
|
|
}
|
|
|
|
else if(mode == _HW_STATE_AP_)
|
2013-08-09 03:23:49 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
#ifdef CONFIG_INTERRUPT_BASED_TXBCN
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
|
2014-12-29 02:13:24 +00:00
|
|
|
UpdateInterruptMask8188EU(Adapter,true ,IMR_BCNDMAINT0_88E, 0);
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif//CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
#ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
|
2014-12-29 02:13:24 +00:00
|
|
|
UpdateInterruptMask8188EU(Adapter,true ,(IMR_TBDER_88E|IMR_TBDOK_88E), 0);
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif//CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif //CONFIG_INTERRUPT_BASED_TXBCN
|
|
|
|
|
|
|
|
|
|
|
|
ResumeTxBeacon(Adapter);
|
|
|
|
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, 0x12);
|
|
|
|
|
|
|
|
//Set RCR
|
|
|
|
//rtw_write32(padapter, REG_RCR, 0x70002a8e);//CBSSID_DATA must set to 0
|
|
|
|
//rtw_write32(Adapter, REG_RCR, 0x7000228e);//CBSSID_DATA must set to 0
|
|
|
|
rtw_write32(Adapter, REG_RCR, 0x7000208e);//CBSSID_DATA must set to 0,reject ICV_ERR packet
|
|
|
|
//enable to rx data frame
|
|
|
|
rtw_write16(Adapter, REG_RXFLTMAP2, 0xFFFF);
|
|
|
|
//enable to rx ps-poll
|
|
|
|
rtw_write16(Adapter, REG_RXFLTMAP1, 0x0400);
|
|
|
|
|
|
|
|
//Beacon Control related register for first time
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(Adapter, REG_BCNDMATIM, 0x02); // 2ms
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//rtw_write8(Adapter, REG_BCN_MAX_ERR, 0xFF);
|
|
|
|
rtw_write8(Adapter, REG_ATIMWND, 0x0a); // 10ms
|
|
|
|
rtw_write16(Adapter, REG_BCNTCFG, 0x00);
|
|
|
|
rtw_write16(Adapter, REG_TBTT_PROHIBIT, 0xff04);
|
|
|
|
rtw_write16(Adapter, REG_TSFTR_SYN_OFFSET, 0x7fff);// +32767 (~32ms)
|
|
|
|
|
|
|
|
//reset TSF
|
|
|
|
rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(0));
|
|
|
|
|
|
|
|
//BIT3 - If set 0, hw will clr bcnq when tx becon ok/fail or port 0
|
|
|
|
rtw_write8(Adapter, REG_MBID_NUM, rtw_read8(Adapter, REG_MBID_NUM)|BIT(3)|BIT(4));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//enable BCN0 Function for if1
|
|
|
|
//don't enable update TSF0 for if1 (due to TSF update when beacon/probe rsp are received)
|
|
|
|
#if defined(CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR)
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, (DIS_TSF_UDT0_NORMAL_CHIP|EN_BCN_FUNCTION | EN_TXBCN_RPT|BIT(1)));
|
|
|
|
#else
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, (DIS_TSF_UDT0_NORMAL_CHIP|EN_BCN_FUNCTION |BIT(1)));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
|
|
|
if(check_buddy_fwstate(Adapter, WIFI_FW_NULL_STATE))
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL_1,
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_read8(Adapter, REG_BCN_CTRL_1) & ~EN_BCN_FUNCTION);
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//dis BCN1 ATIM WND if if2 is station
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(0));
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_TSF_RESET_OFFLOAD
|
|
|
|
// Reset TSF for STA+AP concurrent mode
|
|
|
|
if ( check_buddy_fwstate(Adapter, (WIFI_STATION_STATE|WIFI_ASOC_STATE)) ) {
|
2014-12-29 02:13:24 +00:00
|
|
|
if (reset_tsf(Adapter, IFACE_PORT0) == false)
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_871X("ERROR! %s()-%d: Reset port0 TSF fail\n",
|
|
|
|
__FUNCTION__, __LINE__);
|
|
|
|
}
|
|
|
|
#endif // CONFIG_TSF_RESET_OFFLOAD
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void hw_var_set_macaddr(struct adapter *Adapter, u8 variable, u8* val)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
u8 idx = 0;
|
|
|
|
u32 reg_macid;
|
|
|
|
|
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
|
|
|
if(Adapter->iface_type == IFACE_PORT1)
|
|
|
|
{
|
|
|
|
reg_macid = REG_MACID1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
reg_macid = REG_MACID;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(idx = 0 ; idx < 6; idx++)
|
|
|
|
{
|
|
|
|
rtw_write8(Adapter, (reg_macid+idx), val[idx]);
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void hw_var_set_bssid(struct adapter *Adapter, u8 variable, u8* val)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
u8 idx = 0;
|
|
|
|
u32 reg_bssid;
|
|
|
|
|
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
|
|
|
if(Adapter->iface_type == IFACE_PORT1)
|
|
|
|
{
|
|
|
|
reg_bssid = REG_BSSID1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
reg_bssid = REG_BSSID;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(idx = 0 ; idx < 6; idx++)
|
|
|
|
{
|
|
|
|
rtw_write8(Adapter, (reg_bssid+idx), val[idx]);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void hw_var_set_bcn_func(struct adapter *Adapter, u8 variable, u8* val)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
u32 bcn_ctrl_reg;
|
|
|
|
|
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
|
|
|
if(Adapter->iface_type == IFACE_PORT1)
|
|
|
|
{
|
|
|
|
bcn_ctrl_reg = REG_BCN_CTRL_1;
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
else
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif
|
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
bcn_ctrl_reg = REG_BCN_CTRL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(*((u8 *)val))
|
|
|
|
{
|
|
|
|
rtw_write8(Adapter, bcn_ctrl_reg, (EN_BCN_FUNCTION | EN_TXBCN_RPT));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rtw_write8(Adapter, bcn_ctrl_reg, rtw_read8(Adapter, bcn_ctrl_reg)&(~(EN_BCN_FUNCTION | EN_TXBCN_RPT)));
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void hw_var_set_correct_tsf(struct adapter *Adapter, u8 variable, u8* val)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
|
|
|
u64 tsf;
|
|
|
|
struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
|
|
|
|
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *pbuddy_adapter = Adapter->pbuddy_adapter;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
//tsf = pmlmeext->TSFValue - ((u32)pmlmeext->TSFValue % (pmlmeinfo->bcn_interval*1024)) -1024; //us
|
|
|
|
tsf = pmlmeext->TSFValue - rtw_modular64(pmlmeext->TSFValue, (pmlmeinfo->bcn_interval*1024)) -1024; //us
|
|
|
|
|
|
|
|
if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE))
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
//pHalData->RegTxPause |= STOP_BCNQ;BIT(6)
|
|
|
|
//rtw_write8(Adapter, REG_TXPAUSE, (rtw_read8(Adapter, REG_TXPAUSE)|BIT(6)));
|
|
|
|
StopTxBeacon(Adapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(Adapter->iface_type == IFACE_PORT1)
|
|
|
|
{
|
|
|
|
//disable related TSF function
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(3)));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write32(Adapter, REG_TSFTR1, tsf);
|
|
|
|
rtw_write32(Adapter, REG_TSFTR1+4, tsf>>32);
|
|
|
|
|
|
|
|
|
|
|
|
//enable related TSF function
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(3));
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
// Update buddy port's TSF if it is SoftAP for beacon TX issue!
|
|
|
|
if ( (pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE
|
|
|
|
&& check_buddy_fwstate(Adapter, WIFI_AP_STATE)
|
2014-12-19 06:59:46 +00:00
|
|
|
) {
|
2014-12-17 04:09:56 +00:00
|
|
|
//disable related TSF function
|
2013-08-09 03:23:49 +00:00
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(3)));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-09 03:23:49 +00:00
|
|
|
rtw_write32(Adapter, REG_TSFTR, tsf);
|
|
|
|
rtw_write32(Adapter, REG_TSFTR+4, tsf>>32);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//enable related TSF function
|
2013-08-09 03:23:49 +00:00
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(3));
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_TSF_RESET_OFFLOAD
|
|
|
|
// Update buddy port's TSF(TBTT) if it is SoftAP for beacon TX issue!
|
2014-12-29 02:13:24 +00:00
|
|
|
if (reset_tsf(Adapter, IFACE_PORT0) == false)
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_871X("ERROR! %s()-%d: Reset port0 TSF fail\n",
|
|
|
|
__FUNCTION__, __LINE__);
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif // CONFIG_TSF_RESET_OFFLOAD
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//disable related TSF function
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(3)));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write32(Adapter, REG_TSFTR, tsf);
|
|
|
|
rtw_write32(Adapter, REG_TSFTR+4, tsf>>32);
|
|
|
|
|
|
|
|
//enable related TSF function
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(3));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// Update buddy port's TSF if it is SoftAP for beacon TX issue!
|
|
|
|
if ( (pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE
|
|
|
|
&& check_buddy_fwstate(Adapter, WIFI_AP_STATE)
|
2014-12-19 06:59:46 +00:00
|
|
|
) {
|
2014-12-17 04:09:56 +00:00
|
|
|
//disable related TSF function
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(3)));
|
|
|
|
|
|
|
|
rtw_write32(Adapter, REG_TSFTR1, tsf);
|
|
|
|
rtw_write32(Adapter, REG_TSFTR1+4, tsf>>32);
|
|
|
|
|
|
|
|
//enable related TSF function
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(3));
|
|
|
|
#ifdef CONFIG_TSF_RESET_OFFLOAD
|
|
|
|
// Update buddy port's TSF if it is SoftAP for beacon TX issue!
|
2014-12-29 02:13:24 +00:00
|
|
|
if (reset_tsf(Adapter, IFACE_PORT1) == false)
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_871X("ERROR! %s()-%d: Reset port1 TSF fail\n",
|
|
|
|
__FUNCTION__, __LINE__);
|
|
|
|
#endif // CONFIG_TSF_RESET_OFFLOAD
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE))
|
|
|
|
{
|
|
|
|
//pHalData->RegTxPause &= (~STOP_BCNQ);
|
|
|
|
//rtw_write8(Adapter, REG_TXPAUSE, (rtw_read8(Adapter, REG_TXPAUSE)&(~BIT(6))));
|
|
|
|
ResumeTxBeacon(Adapter);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void hw_var_set_mlme_disconnect(struct adapter *Adapter, u8 variable, u8* val)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
|
|
|
//HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *pbuddy_adapter = Adapter->pbuddy_adapter;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
if(check_buddy_mlmeinfo_state(Adapter, _HW_STATE_NOLINK_))
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write16(Adapter, REG_RXFLTMAP2, 0x00);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
if(Adapter->iface_type == IFACE_PORT1)
|
|
|
|
{
|
|
|
|
//reset TSF1
|
|
|
|
rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1));
|
|
|
|
|
|
|
|
//disable update TSF1
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(4));
|
|
|
|
|
|
|
|
// disable Port1's beacon function
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(3)));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//reset TSF
|
|
|
|
rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(0));
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//disable update TSF
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(4));
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void hw_var_set_mlme_sitesurvey(struct adapter *Adapter, u8 variable, u8* val)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
|
|
|
|
|
|
|
struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
|
|
|
|
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
|
|
|
|
|
|
|
if(*((u8 *)val))//under sitesurvey
|
|
|
|
{
|
|
|
|
//config RCR to receive different BSSID & not to receive data frame
|
|
|
|
u32 v = rtw_read32(Adapter, REG_RCR);
|
|
|
|
v &= ~(RCR_CBSSID_BCN);
|
|
|
|
rtw_write32(Adapter, REG_RCR, v);
|
|
|
|
|
|
|
|
//disable update TSF
|
|
|
|
if((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE)
|
|
|
|
{
|
|
|
|
if(Adapter->iface_type == IFACE_PORT1)
|
|
|
|
{
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)|BIT(4));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(4));
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2013-08-09 03:23:49 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) &&
|
2014-12-19 06:59:46 +00:00
|
|
|
check_buddy_fwstate(Adapter, _FW_LINKED))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
StopTxBeacon(Adapter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else//sitesurvey done
|
|
|
|
{
|
|
|
|
//enable to rx data frame
|
|
|
|
//write32(Adapter, REG_RCR, read32(padapter, REG_RCR)|RCR_ADF);
|
|
|
|
rtw_write16(Adapter, REG_RXFLTMAP2,0xFFFF);
|
|
|
|
|
|
|
|
//enable update TSF
|
|
|
|
if(Adapter->iface_type == IFACE_PORT1)
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(4)));
|
|
|
|
else
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(4)));
|
|
|
|
|
|
|
|
rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_BCN);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) &&
|
|
|
|
check_buddy_fwstate(Adapter, _FW_LINKED))
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
ResumeTxBeacon(Adapter);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void hw_var_set_mlme_join(struct adapter *Adapter, u8 variable, u8* val)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
|
|
|
u8 RetryLimit = 0x30;
|
|
|
|
u8 type = *((u8 *)val);
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
|
|
|
struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
|
|
|
|
|
|
|
|
if(type == 0) // prepare to join
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) &&
|
2014-12-19 06:59:46 +00:00
|
|
|
check_buddy_fwstate(Adapter, _FW_LINKED))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
StopTxBeacon(Adapter);
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//enable to rx data frame.Accept all data frame
|
|
|
|
//rtw_write32(padapter, REG_RCR, rtw_read32(padapter, REG_RCR)|RCR_ADF);
|
|
|
|
rtw_write16(Adapter, REG_RXFLTMAP2,0xFFFF);
|
|
|
|
|
|
|
|
if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE))
|
|
|
|
rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_BCN);
|
|
|
|
else
|
2013-08-09 03:23:49 +00:00
|
|
|
rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_DATA|RCR_CBSSID_BCN);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
RetryLimit = (pHalData->CustomerID == RT_CID_CCX) ? 7 : 48;
|
|
|
|
}
|
|
|
|
else // Ad-hoc Mode
|
|
|
|
{
|
|
|
|
RetryLimit = 0x7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(type == 1) //joinbss_event call back when join res < 0
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
|
|
|
if(check_buddy_mlmeinfo_state(Adapter, _HW_STATE_NOLINK_))
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write16(Adapter, REG_RXFLTMAP2,0x00);
|
|
|
|
|
|
|
|
if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) &&
|
|
|
|
check_buddy_fwstate(Adapter, _FW_LINKED))
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
ResumeTxBeacon(Adapter);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//reset TSF 1/2 after ResumeTxBeacon
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1)|BIT(0));
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(type == 2) //sta add event call back
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//enable update TSF
|
|
|
|
if(Adapter->iface_type == IFACE_PORT1)
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(4)));
|
|
|
|
else
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(4)));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE))
|
|
|
|
{
|
|
|
|
//fixed beacon issue for 8191su...........
|
|
|
|
rtw_write8(Adapter,0x542 ,0x02);
|
|
|
|
RetryLimit = 0x7;
|
|
|
|
}
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) &&
|
|
|
|
check_buddy_fwstate(Adapter, _FW_LINKED))
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
ResumeTxBeacon(Adapter);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//reset TSF 1/2 after ResumeTxBeacon
|
|
|
|
rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1)|BIT(0));
|
2013-08-09 03:23:49 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write16(Adapter, REG_RL, RetryLimit << RETRY_LIMIT_SHORT_SHIFT | RetryLimit << RETRY_LIMIT_LONG_SHIFT);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
|
|
|
struct dm_priv *pdmpriv = &pHalData->dmpriv;
|
2014-12-19 06:59:46 +00:00
|
|
|
DM_ODM_T *podmpriv = &pHalData->odmpriv;
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
switch(variable)
|
|
|
|
{
|
|
|
|
case HW_VAR_MEDIA_STATUS:
|
|
|
|
{
|
|
|
|
u8 val8;
|
|
|
|
|
|
|
|
val8 = rtw_read8(Adapter, MSR)&0x0c;
|
|
|
|
val8 |= *((u8 *)val);
|
|
|
|
rtw_write8(Adapter, MSR, val8);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HW_VAR_MEDIA_STATUS1:
|
|
|
|
{
|
|
|
|
u8 val8;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
val8 = rtw_read8(Adapter, MSR)&0x03;
|
|
|
|
val8 |= *((u8 *)val) <<2;
|
|
|
|
rtw_write8(Adapter, MSR, val8);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HW_VAR_SET_OPMODE:
|
|
|
|
hw_var_set_opmode(Adapter, variable, val);
|
|
|
|
break;
|
|
|
|
case HW_VAR_MAC_ADDR:
|
2014-12-19 06:59:46 +00:00
|
|
|
hw_var_set_macaddr(Adapter, variable, val);
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
|
|
|
case HW_VAR_BSSID:
|
|
|
|
hw_var_set_bssid(Adapter, variable, val);
|
|
|
|
break;
|
|
|
|
case HW_VAR_BASIC_RATE:
|
|
|
|
{
|
|
|
|
u16 BrateCfg = 0;
|
|
|
|
u8 RateIndex = 0;
|
|
|
|
|
|
|
|
// 2007.01.16, by Emily
|
|
|
|
// Select RRSR (in Legacy-OFDM and CCK)
|
|
|
|
// For 8190, we select only 24M, 12M, 6M, 11M, 5.5M, 2M, and 1M from the Basic rate.
|
|
|
|
// We do not use other rates.
|
|
|
|
HalSetBrateCfg( Adapter, val, &BrateCfg );
|
|
|
|
DBG_8192C("HW_VAR_BASIC_RATE: BrateCfg(%#x)\n", BrateCfg);
|
|
|
|
|
|
|
|
//2011.03.30 add by Luke Lee
|
|
|
|
//CCK 2M ACK should be disabled for some BCM and Atheros AP IOT
|
|
|
|
//because CCK 2M has poor TXEVM
|
|
|
|
//CCK 5.5M & 11M ACK should be enabled for better performance
|
|
|
|
|
|
|
|
pHalData->BasicRateSet = BrateCfg = (BrateCfg |0xd) & 0x15d;
|
|
|
|
|
|
|
|
BrateCfg |= 0x01; // default enable 1M ACK rate
|
|
|
|
// Set RRSR rate table.
|
|
|
|
rtw_write8(Adapter, REG_RRSR, BrateCfg&0xff);
|
|
|
|
rtw_write8(Adapter, REG_RRSR+1, (BrateCfg>>8)&0xff);
|
|
|
|
rtw_write8(Adapter, REG_RRSR+2, rtw_read8(Adapter, REG_RRSR+2)&0xf0);
|
|
|
|
|
|
|
|
// Set RTS initial rate
|
|
|
|
while(BrateCfg > 0x1)
|
|
|
|
{
|
|
|
|
BrateCfg = (BrateCfg>> 1);
|
|
|
|
RateIndex++;
|
|
|
|
}
|
|
|
|
// Ziv - Check
|
|
|
|
rtw_write8(Adapter, REG_INIRTS_RATE_SEL, RateIndex);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HW_VAR_TXPAUSE:
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(Adapter, REG_TXPAUSE, *((u8 *)val));
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
|
|
|
case HW_VAR_BCN_FUNC:
|
|
|
|
hw_var_set_bcn_func(Adapter, variable, val);
|
|
|
|
break;
|
|
|
|
case HW_VAR_CORRECT_TSF:
|
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
|
|
|
hw_var_set_correct_tsf(Adapter, variable, val);
|
2014-12-19 06:59:46 +00:00
|
|
|
#else
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
u64 tsf;
|
|
|
|
struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
|
|
|
|
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
|
|
|
|
|
|
|
//tsf = pmlmeext->TSFValue - ((u32)pmlmeext->TSFValue % (pmlmeinfo->bcn_interval*1024)) -1024; //us
|
|
|
|
tsf = pmlmeext->TSFValue - rtw_modular64(pmlmeext->TSFValue, (pmlmeinfo->bcn_interval*1024)) -1024; //us
|
|
|
|
|
|
|
|
if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE))
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
//pHalData->RegTxPause |= STOP_BCNQ;BIT(6)
|
|
|
|
//rtw_write8(Adapter, REG_TXPAUSE, (rtw_read8(Adapter, REG_TXPAUSE)|BIT(6)));
|
|
|
|
StopTxBeacon(Adapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
//disable related TSF function
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(3)));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write32(Adapter, REG_TSFTR, tsf);
|
|
|
|
rtw_write32(Adapter, REG_TSFTR+4, tsf>>32);
|
|
|
|
|
|
|
|
//enable related TSF function
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(3));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE))
|
|
|
|
{
|
|
|
|
//pHalData->RegTxPause &= (~STOP_BCNQ);
|
|
|
|
//rtw_write8(Adapter, REG_TXPAUSE, (rtw_read8(Adapter, REG_TXPAUSE)&(~BIT(6))));
|
|
|
|
ResumeTxBeacon(Adapter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case HW_VAR_CHECK_BSSID:
|
|
|
|
if(*((u8 *)val))
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
|
|
|
rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_DATA|RCR_CBSSID_BCN);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
u32 val32;
|
|
|
|
|
|
|
|
val32 = rtw_read32(Adapter, REG_RCR);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
val32 &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN);
|
|
|
|
|
|
|
|
rtw_write32(Adapter, REG_RCR, val32);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HW_VAR_MLME_DISCONNECT:
|
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
|
|
|
hw_var_set_mlme_disconnect(Adapter, variable, val);
|
|
|
|
#else
|
|
|
|
{
|
|
|
|
//Set RCR to not to receive data frame when NO LINK state
|
|
|
|
//rtw_write32(Adapter, REG_RCR, rtw_read32(padapter, REG_RCR) & ~RCR_ADF);
|
|
|
|
//reject all data frames
|
|
|
|
rtw_write16(Adapter, REG_RXFLTMAP2,0x00);
|
|
|
|
|
|
|
|
//reset TSF
|
|
|
|
rtw_write8(Adapter, REG_DUAL_TSF_RST, (BIT(0)|BIT(1)));
|
|
|
|
|
|
|
|
//disable update TSF
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(4));
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case HW_VAR_MLME_SITESURVEY:
|
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
|
|
|
hw_var_set_mlme_sitesurvey(Adapter, variable, val);
|
|
|
|
#else
|
|
|
|
if(*((u8 *)val))//under sitesurvey
|
|
|
|
{
|
|
|
|
//config RCR to receive different BSSID & not to receive data frame
|
|
|
|
u32 v = rtw_read32(Adapter, REG_RCR);
|
|
|
|
v &= ~(RCR_CBSSID_BCN);
|
|
|
|
rtw_write32(Adapter, REG_RCR, v);
|
|
|
|
//reject all data frame
|
|
|
|
rtw_write16(Adapter, REG_RXFLTMAP2,0x00);
|
|
|
|
|
|
|
|
//disable update TSF
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(4));
|
|
|
|
}
|
|
|
|
else//sitesurvey done
|
|
|
|
{
|
|
|
|
struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
|
|
|
|
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if ((is_client_associated_to_ap(Adapter) == true) ||
|
2014-12-17 04:09:56 +00:00
|
|
|
((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) )
|
|
|
|
{
|
|
|
|
//enable to rx data frame
|
|
|
|
//rtw_write32(Adapter, REG_RCR, rtw_read32(padapter, REG_RCR)|RCR_ADF);
|
|
|
|
rtw_write16(Adapter, REG_RXFLTMAP2,0xFFFF);
|
|
|
|
|
|
|
|
//enable update TSF
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(4)));
|
|
|
|
}
|
|
|
|
else if((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)
|
|
|
|
{
|
|
|
|
//rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_ADF);
|
|
|
|
rtw_write16(Adapter, REG_RXFLTMAP2,0xFFFF);
|
|
|
|
|
|
|
|
//enable update TSF
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(4)));
|
|
|
|
}
|
|
|
|
|
|
|
|
if((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)
|
|
|
|
rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_BCN);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(Adapter->in_cta_test)
|
|
|
|
{
|
|
|
|
u32 v = rtw_read32(Adapter, REG_RCR);
|
|
|
|
v &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN );//| RCR_ADF
|
|
|
|
rtw_write32(Adapter, REG_RCR, v);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_BCN);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
|
|
|
case HW_VAR_MLME_JOIN:
|
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
|
|
|
hw_var_set_mlme_join(Adapter, variable, val);
|
|
|
|
#else
|
|
|
|
{
|
|
|
|
u8 RetryLimit = 0x30;
|
|
|
|
u8 type = *((u8 *)val);
|
|
|
|
struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if(type == 0) // prepare to join
|
|
|
|
{
|
|
|
|
//enable to rx data frame.Accept all data frame
|
|
|
|
//rtw_write32(padapter, REG_RCR, rtw_read32(padapter, REG_RCR)|RCR_ADF);
|
|
|
|
rtw_write16(Adapter, REG_RXFLTMAP2,0xFFFF);
|
|
|
|
|
|
|
|
if(Adapter->in_cta_test)
|
|
|
|
{
|
|
|
|
u32 v = rtw_read32(Adapter, REG_RCR);
|
|
|
|
v &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN );//| RCR_ADF
|
|
|
|
rtw_write32(Adapter, REG_RCR, v);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_DATA|RCR_CBSSID_BCN);
|
|
|
|
}
|
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
RetryLimit = (pHalData->CustomerID == RT_CID_CCX) ? 7 : 48;
|
|
|
|
}
|
|
|
|
else // Ad-hoc Mode
|
|
|
|
{
|
|
|
|
RetryLimit = 0x7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(type == 1) //joinbss_event call back when join res < 0
|
|
|
|
{
|
|
|
|
rtw_write16(Adapter, REG_RXFLTMAP2,0x00);
|
|
|
|
}
|
|
|
|
else if(type == 2) //sta add event call back
|
|
|
|
{
|
|
|
|
//enable update TSF
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(4)));
|
|
|
|
|
|
|
|
if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE))
|
|
|
|
{
|
|
|
|
RetryLimit = 0x7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rtw_write16(Adapter, REG_RL, RetryLimit << RETRY_LIMIT_SHORT_SHIFT | RetryLimit << RETRY_LIMIT_LONG_SHIFT);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case HW_VAR_ON_RCR_AM:
|
|
|
|
rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_AM);
|
|
|
|
DBG_871X("%s, %d, RCR= %x \n", __FUNCTION__,__LINE__, rtw_read32(Adapter, REG_RCR));
|
|
|
|
break;
|
|
|
|
case HW_VAR_OFF_RCR_AM:
|
|
|
|
rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)& (~RCR_AM));
|
|
|
|
DBG_871X("%s, %d, RCR= %x \n", __FUNCTION__,__LINE__, rtw_read32(Adapter, REG_RCR));
|
|
|
|
break;
|
|
|
|
case HW_VAR_BEACON_INTERVAL:
|
|
|
|
rtw_write16(Adapter, REG_BCN_INTERVAL, *((u16 *)val));
|
|
|
|
#ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
|
|
|
|
{
|
|
|
|
struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
|
|
|
|
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
2014-12-19 06:59:46 +00:00
|
|
|
u16 bcn_interval = *((u16 *)val);
|
2014-12-17 04:09:56 +00:00
|
|
|
if((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE){
|
|
|
|
DBG_8192C("%s==> bcn_interval:%d, eraly_int:%d \n",__FUNCTION__,bcn_interval,bcn_interval>>1);
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(Adapter, REG_DRVERLYINT, bcn_interval>>1);// 50ms for sdio
|
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
#endif//CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
|
|
|
|
|
|
|
|
break;
|
|
|
|
case HW_VAR_SLOT_TIME:
|
|
|
|
{
|
|
|
|
u8 u1bAIFS, aSifsTime;
|
|
|
|
struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
|
|
|
|
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write8(Adapter, REG_SLOT, val[0]);
|
|
|
|
|
|
|
|
if(pmlmeinfo->WMM_enable == 0)
|
|
|
|
{
|
|
|
|
if( pmlmeext->cur_wireless_mode == WIRELESS_11B)
|
|
|
|
aSifsTime = 10;
|
|
|
|
else
|
|
|
|
aSifsTime = 16;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
u1bAIFS = aSifsTime + (2 * pmlmeinfo->slotTime);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// <Roger_EXP> Temporary removed, 2008.06.20.
|
|
|
|
rtw_write8(Adapter, REG_EDCA_VO_PARAM, u1bAIFS);
|
|
|
|
rtw_write8(Adapter, REG_EDCA_VI_PARAM, u1bAIFS);
|
|
|
|
rtw_write8(Adapter, REG_EDCA_BE_PARAM, u1bAIFS);
|
|
|
|
rtw_write8(Adapter, REG_EDCA_BK_PARAM, u1bAIFS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HW_VAR_RESP_SIFS:
|
2014-12-29 02:00:11 +00:00
|
|
|
//SIFS_Timer = 0x0a0a0808;
|
|
|
|
//RESP_SIFS for CCK
|
|
|
|
rtw_write8(Adapter, REG_R2T_SIFS, val[0]); // SIFS_T2T_CCK (0x08)
|
|
|
|
rtw_write8(Adapter, REG_R2T_SIFS+1, val[1]); //SIFS_R2T_CCK(0x08)
|
|
|
|
//RESP_SIFS for OFDM
|
|
|
|
rtw_write8(Adapter, REG_T2T_SIFS, val[2]); //SIFS_T2T_OFDM (0x0a)
|
|
|
|
rtw_write8(Adapter, REG_T2T_SIFS+1, val[3]); //SIFS_R2T_OFDM(0x0a)
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
|
|
|
case HW_VAR_ACK_PREAMBLE:
|
|
|
|
{
|
|
|
|
u8 regTmp;
|
|
|
|
u8 bShortPreamble = *( (PBOOLEAN)val );
|
|
|
|
// Joseph marked out for Netgear 3500 TKIP channel 7 issue.(Temporarily)
|
|
|
|
regTmp = (pHalData->nCur40MhzPrimeSC)<<5;
|
|
|
|
//regTmp = 0;
|
|
|
|
if(bShortPreamble)
|
|
|
|
regTmp |= 0x80;
|
|
|
|
|
|
|
|
rtw_write8(Adapter, REG_RRSR+2, regTmp);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HW_VAR_SEC_CFG:
|
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(Adapter, REG_SECCFG, 0x0c|BIT(5));// enable tx enc and rx dec engine, and no key search for MC/BC
|
2014-12-17 04:09:56 +00:00
|
|
|
#else
|
|
|
|
rtw_write8(Adapter, REG_SECCFG, *((u8 *)val));
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case HW_VAR_DM_FLAG:
|
|
|
|
podmpriv->SupportAbility = *((u8 *)val);
|
|
|
|
//DBG_871X("HW_VAR_DM_FLAG ==> SupportAbility:0x%08x \n",podmpriv->SupportAbility );
|
|
|
|
break;
|
|
|
|
case HW_VAR_DM_FUNC_OP:
|
|
|
|
if(val[0])
|
|
|
|
{// save dm flag
|
2014-12-19 06:59:46 +00:00
|
|
|
podmpriv->BK_SupportAbility = podmpriv->SupportAbility;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{// restore dm flag
|
|
|
|
podmpriv->SupportAbility = podmpriv->BK_SupportAbility;
|
|
|
|
}
|
|
|
|
//DBG_871X("HW_VAR_DM_FUNC_OP ==> %s SupportAbility:0x%08x \n",
|
|
|
|
// (val[0]==1)?"Save":"Restore",
|
|
|
|
// podmpriv->SupportAbility
|
|
|
|
// );
|
|
|
|
break;
|
|
|
|
case HW_VAR_DM_FUNC_SET:
|
|
|
|
if(*((u32 *)val) == DYNAMIC_ALL_FUNC_ENABLE){
|
|
|
|
pdmpriv->DMFlag = pdmpriv->InitDMFlag;
|
2014-12-19 06:59:46 +00:00
|
|
|
podmpriv->SupportAbility = pdmpriv->InitODMFlag;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else{
|
|
|
|
podmpriv->SupportAbility |= *((u32 *)val);
|
|
|
|
}
|
|
|
|
//DBG_871X("HW_VAR_DM_FUNC_SET ==> SupportAbility:0x%08x \n",podmpriv->SupportAbility );
|
|
|
|
break;
|
|
|
|
case HW_VAR_DM_FUNC_CLR:
|
|
|
|
podmpriv->SupportAbility &= *((u32 *)val);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HW_VAR_CAM_EMPTY_ENTRY:
|
|
|
|
{
|
|
|
|
u8 ucIndex = *((u8 *)val);
|
|
|
|
u8 i;
|
|
|
|
u32 ulCommand=0;
|
|
|
|
u32 ulContent=0;
|
|
|
|
u32 ulEncAlgo=CAM_AES;
|
|
|
|
|
|
|
|
for(i=0;i<CAM_CONTENT_COUNT;i++)
|
|
|
|
{
|
|
|
|
// filled id in CAM config 2 byte
|
|
|
|
if( i == 0)
|
|
|
|
{
|
|
|
|
ulContent |=(ucIndex & 0x03) | ((u16)(ulEncAlgo)<<2);
|
|
|
|
//ulContent |= CAM_VALID;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ulContent = 0;
|
|
|
|
}
|
|
|
|
// polling bit, and No Write enable, and address
|
|
|
|
ulCommand= CAM_CONTENT_COUNT*ucIndex+i;
|
|
|
|
ulCommand= ulCommand | CAM_POLLINIG|CAM_WRITE;
|
|
|
|
// write content 0 is equall to mark invalid
|
|
|
|
rtw_write32(Adapter, WCAMI, ulContent); //delay_ms(40);
|
|
|
|
//RT_TRACE(COMP_SEC, DBG_LOUD, ("CAM_empty_entry(): WRITE A4: %lx \n",ulContent));
|
|
|
|
rtw_write32(Adapter, RWCAM, ulCommand); //delay_ms(40);
|
|
|
|
//RT_TRACE(COMP_SEC, DBG_LOUD, ("CAM_empty_entry(): WRITE A0: %lx \n",ulCommand));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HW_VAR_CAM_INVALID_ALL:
|
|
|
|
rtw_write32(Adapter, RWCAM, BIT(31)|BIT(30));
|
|
|
|
break;
|
|
|
|
case HW_VAR_CAM_WRITE:
|
|
|
|
{
|
|
|
|
u32 cmd;
|
|
|
|
u32 *cam_val = (u32 *)val;
|
|
|
|
rtw_write32(Adapter, WCAMI, cam_val[0]);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
cmd = CAM_POLLINIG | CAM_WRITE | cam_val[1];
|
|
|
|
rtw_write32(Adapter, RWCAM, cmd);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HW_VAR_AC_PARAM_VO:
|
|
|
|
rtw_write32(Adapter, REG_EDCA_VO_PARAM, ((u32 *)(val))[0]);
|
|
|
|
break;
|
|
|
|
case HW_VAR_AC_PARAM_VI:
|
|
|
|
rtw_write32(Adapter, REG_EDCA_VI_PARAM, ((u32 *)(val))[0]);
|
|
|
|
break;
|
|
|
|
case HW_VAR_AC_PARAM_BE:
|
|
|
|
pHalData->AcParam_BE = ((u32 *)(val))[0];
|
|
|
|
rtw_write32(Adapter, REG_EDCA_BE_PARAM, ((u32 *)(val))[0]);
|
|
|
|
break;
|
|
|
|
case HW_VAR_AC_PARAM_BK:
|
|
|
|
rtw_write32(Adapter, REG_EDCA_BK_PARAM, ((u32 *)(val))[0]);
|
|
|
|
break;
|
|
|
|
case HW_VAR_ACM_CTRL:
|
|
|
|
{
|
|
|
|
u8 acm_ctrl = *((u8 *)val);
|
|
|
|
u8 AcmCtrl = rtw_read8( Adapter, REG_ACMHWCTRL);
|
|
|
|
|
|
|
|
if(acm_ctrl > 1)
|
|
|
|
AcmCtrl = AcmCtrl | 0x1;
|
|
|
|
|
|
|
|
if(acm_ctrl & BIT(3))
|
|
|
|
AcmCtrl |= AcmHw_VoqEn;
|
|
|
|
else
|
|
|
|
AcmCtrl &= (~AcmHw_VoqEn);
|
|
|
|
|
|
|
|
if(acm_ctrl & BIT(2))
|
|
|
|
AcmCtrl |= AcmHw_ViqEn;
|
|
|
|
else
|
|
|
|
AcmCtrl &= (~AcmHw_ViqEn);
|
|
|
|
|
|
|
|
if(acm_ctrl & BIT(1))
|
|
|
|
AcmCtrl |= AcmHw_BeqEn;
|
|
|
|
else
|
|
|
|
AcmCtrl &= (~AcmHw_BeqEn);
|
|
|
|
|
|
|
|
DBG_871X("[HW_VAR_ACM_CTRL] Write 0x%X\n", AcmCtrl );
|
|
|
|
rtw_write8(Adapter, REG_ACMHWCTRL, AcmCtrl );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HW_VAR_AMPDU_MIN_SPACE:
|
|
|
|
{
|
|
|
|
u8 MinSpacingToSet;
|
|
|
|
u8 SecMinSpace;
|
|
|
|
|
|
|
|
MinSpacingToSet = *((u8 *)val);
|
|
|
|
if(MinSpacingToSet <= 7)
|
|
|
|
{
|
|
|
|
switch(Adapter->securitypriv.dot11PrivacyAlgrthm)
|
|
|
|
{
|
|
|
|
case _NO_PRIVACY_:
|
|
|
|
case _AES_:
|
|
|
|
SecMinSpace = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case _WEP40_:
|
|
|
|
case _WEP104_:
|
|
|
|
case _TKIP_:
|
|
|
|
case _TKIP_WTMIC_:
|
|
|
|
SecMinSpace = 6;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
SecMinSpace = 7;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(MinSpacingToSet < SecMinSpace){
|
|
|
|
MinSpacingToSet = SecMinSpace;
|
|
|
|
}
|
|
|
|
|
|
|
|
//RT_TRACE(COMP_MLME, DBG_LOUD, ("Set HW_VAR_AMPDU_MIN_SPACE: %#x\n", Adapter->MgntInfo.MinSpaceCfg));
|
|
|
|
rtw_write8(Adapter, REG_AMPDU_MIN_SPACE, (rtw_read8(Adapter, REG_AMPDU_MIN_SPACE) & 0xf8) | MinSpacingToSet);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HW_VAR_AMPDU_FACTOR:
|
|
|
|
{
|
|
|
|
u8 RegToSet_Normal[4]={0x41,0xa8,0x72, 0xb9};
|
|
|
|
u8 RegToSet_BT[4]={0x31,0x74,0x42, 0x97};
|
|
|
|
u8 FactorToSet;
|
|
|
|
u8 *pRegToSet;
|
|
|
|
u8 index = 0;
|
|
|
|
|
|
|
|
#ifdef CONFIG_BT_COEXIST
|
|
|
|
if( (pHalData->bt_coexist.BT_Coexist) &&
|
|
|
|
(pHalData->bt_coexist.BT_CoexistType == BT_CSR_BC4) )
|
|
|
|
pRegToSet = RegToSet_BT; // 0x97427431;
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
pRegToSet = RegToSet_Normal; // 0xb972a841;
|
|
|
|
|
|
|
|
FactorToSet = *((u8 *)val);
|
|
|
|
if(FactorToSet <= 3)
|
|
|
|
{
|
|
|
|
FactorToSet = (1<<(FactorToSet + 2));
|
|
|
|
if(FactorToSet>0xf)
|
|
|
|
FactorToSet = 0xf;
|
|
|
|
|
|
|
|
for(index=0; index<4; index++)
|
|
|
|
{
|
|
|
|
if((pRegToSet[index] & 0xf0) > (FactorToSet<<4))
|
|
|
|
pRegToSet[index] = (pRegToSet[index] & 0x0f) | (FactorToSet<<4);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if((pRegToSet[index] & 0x0f) > FactorToSet)
|
|
|
|
pRegToSet[index] = (pRegToSet[index] & 0xf0) | (FactorToSet);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write8(Adapter, (REG_AGGLEN_LMT+index), pRegToSet[index]);
|
|
|
|
}
|
|
|
|
|
|
|
|
//RT_TRACE(COMP_MLME, DBG_LOUD, ("Set HW_VAR_AMPDU_FACTOR: %#x\n", FactorToSet));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HW_VAR_RXDMA_AGG_PG_TH:
|
|
|
|
#ifdef CONFIG_USB_RX_AGGREGATION
|
|
|
|
{
|
|
|
|
u8 threshold = *((u8 *)val);
|
|
|
|
if( threshold == 0)
|
|
|
|
{
|
|
|
|
threshold = pHalData->UsbRxAggPageCount;
|
|
|
|
}
|
|
|
|
rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH, threshold);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case HW_VAR_SET_RPWM:
|
|
|
|
#ifdef CONFIG_LPS_LCLK
|
|
|
|
{
|
|
|
|
u8 ps_state = *((u8 *)val);
|
|
|
|
//rpwm value only use BIT0(clock bit) ,BIT6(Ack bit), and BIT7(Toggle bit) for 88e.
|
|
|
|
//BIT0 value - 1: 32k, 0:40MHz.
|
|
|
|
//BIT6 value - 1: report cpwm value after success set, 0:do not report.
|
|
|
|
//BIT7 value - Toggle bit change.
|
|
|
|
//modify by Thomas. 2012/4/2.
|
|
|
|
ps_state = ps_state & 0xC1;
|
|
|
|
//DBG_871X("##### Change RPWM value to = %x for switch clk #####\n",ps_state);
|
|
|
|
rtw_write8(Adapter, REG_USB_HRPWM, ps_state);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case HW_VAR_H2C_FW_PWRMODE:
|
|
|
|
{
|
|
|
|
u8 psmode = (*(u8 *)val);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// Forece leave RF low power mode for 1T1R to prevent conficting setting in Fw power
|
|
|
|
// saving sequence. 2010.06.07. Added by tynli. Suggested by SD3 yschang.
|
|
|
|
if( (psmode != PS_MODE_ACTIVE) && (!IS_92C_SERIAL(pHalData->VersionID)))
|
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
ODM_RF_Saving(podmpriv, true);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
rtl8188e_set_FwPwrMode_cmd(Adapter, psmode);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HW_VAR_H2C_FW_JOINBSSRPT:
|
|
|
|
{
|
|
|
|
u8 mstatus = (*(u8 *)val);
|
|
|
|
rtl8188e_set_FwJoinBssReport_cmd(Adapter, mstatus);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
#ifdef CONFIG_P2P_PS
|
|
|
|
case HW_VAR_H2C_FW_P2P_PS_OFFLOAD:
|
|
|
|
{
|
|
|
|
u8 p2p_ps_state = (*(u8 *)val);
|
|
|
|
rtl8188e_set_p2p_ps_offload_cmd(Adapter, p2p_ps_state);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
#endif //CONFIG_P2P_PS
|
|
|
|
#ifdef CONFIG_TDLS
|
|
|
|
case HW_VAR_TDLS_WRCR:
|
|
|
|
rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)&(~RCR_CBSSID_DATA ));
|
|
|
|
break;
|
|
|
|
case HW_VAR_TDLS_INIT_CH_SEN:
|
|
|
|
{
|
|
|
|
rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)&(~ RCR_CBSSID_DATA )&(~RCR_CBSSID_BCN ));
|
|
|
|
rtw_write16(Adapter, REG_RXFLTMAP2,0xffff);
|
|
|
|
|
|
|
|
//disable update TSF
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(4));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HW_VAR_TDLS_DONE_CH_SEN:
|
|
|
|
{
|
|
|
|
//enable update TSF
|
|
|
|
rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~ BIT(4)));
|
|
|
|
rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|(RCR_CBSSID_BCN ));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HW_VAR_TDLS_RS_RCR:
|
|
|
|
rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|(RCR_CBSSID_DATA));
|
|
|
|
break;
|
|
|
|
#endif //CONFIG_TDLS
|
|
|
|
case HW_VAR_INITIAL_GAIN:
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
DIG_T *pDigTable = &podmpriv->DM_DigTable;
|
|
|
|
u32 rx_gain = ((u32 *)(val))[0];
|
|
|
|
|
|
|
|
if(rx_gain == 0xff){//restore rx gain
|
2014-12-17 04:09:56 +00:00
|
|
|
ODM_Write_DIG(podmpriv,pDigTable->BackupIGValue);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
pDigTable->BackupIGValue = pDigTable->CurIGValue;
|
|
|
|
ODM_Write_DIG(podmpriv,rx_gain);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HW_VAR_TRIGGER_GPIO_0:
|
|
|
|
rtl8192cu_trigger_gpio_0(Adapter);
|
|
|
|
break;
|
|
|
|
#ifdef CONFIG_BT_COEXIST
|
|
|
|
case HW_VAR_BT_SET_COEXIST:
|
|
|
|
{
|
|
|
|
u8 bStart = (*(u8 *)val);
|
|
|
|
rtl8192c_set_dm_bt_coexist(Adapter, bStart);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HW_VAR_BT_ISSUE_DELBA:
|
|
|
|
{
|
|
|
|
u8 dir = (*(u8 *)val);
|
|
|
|
rtl8192c_issue_delete_ba(Adapter, dir);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#if (RATE_ADAPTIVE_SUPPORT==1)
|
|
|
|
case HW_VAR_RPT_TIMER_SETTING:
|
|
|
|
{
|
|
|
|
u16 min_rpt_time = (*(u16 *)val);
|
2014-12-19 06:59:46 +00:00
|
|
|
ODM_RA_Set_TxRPT_Time(podmpriv,min_rpt_time);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_SW_ANTENNA_DIVERSITY
|
|
|
|
|
|
|
|
case HW_VAR_ANTENNA_DIVERSITY_LINK:
|
|
|
|
//odm_SwAntDivRestAfterLink8192C(Adapter);
|
|
|
|
ODM_SwAntDivRestAfterLink(podmpriv);
|
|
|
|
break;
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_ANTENNA_DIVERSITY
|
|
|
|
case HW_VAR_ANTENNA_DIVERSITY_SELECT:
|
|
|
|
{
|
|
|
|
u8 Optimum_antenna = (*(u8 *)val);
|
2014-12-19 06:59:46 +00:00
|
|
|
u8 Ant ;
|
2014-12-17 04:09:56 +00:00
|
|
|
//switch antenna to Optimum_antenna
|
|
|
|
//DBG_8192C("==> HW_VAR_ANTENNA_DIVERSITY_SELECT , Ant_(%s)\n",(Optimum_antenna==2)?"A":"B");
|
2014-12-19 06:59:46 +00:00
|
|
|
if(pHalData->CurAntenna != Optimum_antenna)
|
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
Ant = (Optimum_antenna==2)?MAIN_ANT:AUX_ANT;
|
|
|
|
ODM_UpdateRxIdleAnt_88E(&pHalData->odmpriv, Ant);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData->CurAntenna = Optimum_antenna ;
|
|
|
|
//DBG_8192C("==> HW_VAR_ANTENNA_DIVERSITY_SELECT , Ant_(%s)\n",(Optimum_antenna==2)?"A":"B");
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
case HW_VAR_EFUSE_BYTES: // To set EFUE total used bytes, added by Roger, 2008.12.22.
|
2014-12-19 06:59:46 +00:00
|
|
|
pHalData->EfuseUsedBytes = *((u16 *)val);
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
|
|
|
case HW_VAR_FIFO_CLEARN_UP:
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(Adapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
u8 trycnt = 100;
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//pause tx
|
|
|
|
rtw_write8(Adapter,REG_TXPAUSE,0xff);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//keep sn
|
|
|
|
Adapter->xmitpriv.nqos_ssn = rtw_read16(Adapter,REG_NQOS_SEQ);
|
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if(pwrpriv->bkeepfwalive != true)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
//RX DMA stop
|
|
|
|
rtw_write32(Adapter,REG_RXPKT_NUM,(rtw_read32(Adapter,REG_RXPKT_NUM)|RW_RELEASE_EN));
|
|
|
|
do{
|
|
|
|
if(!(rtw_read32(Adapter,REG_RXPKT_NUM)&RXDMA_IDLE))
|
|
|
|
break;
|
|
|
|
}while(trycnt--);
|
|
|
|
if(trycnt ==0)
|
|
|
|
DBG_8192C("Stop RX DMA failed...... \n");
|
|
|
|
|
|
|
|
//RQPN Load 0
|
|
|
|
rtw_write16(Adapter,REG_RQPN_NPQ,0x0);
|
|
|
|
rtw_write32(Adapter,REG_RQPN,0x80000000);
|
|
|
|
rtw_mdelay_os(10);
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
|
|
|
case HW_VAR_CHECK_TXBUF:
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
int i;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-29 02:00:11 +00:00
|
|
|
for(i=0;i<1000;i++) {
|
|
|
|
if(rtw_read32(Adapter, 0x200) != rtw_read32(Adapter, 0x204)) {
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_msleep_os(10);
|
2014-12-29 02:00:11 +00:00
|
|
|
} else {
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_871X("no packet in tx packet buffer (%d)\n", i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case HW_VAR_APFM_ON_MAC:
|
|
|
|
pHalData->bMacPwrCtrlOn = *val;
|
|
|
|
DBG_871X("%s: bMacPwrCtrlOn=%d\n", __func__, pHalData->bMacPwrCtrlOn);
|
|
|
|
break;
|
2013-08-09 03:23:49 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_WOWLAN
|
|
|
|
case HW_VAR_WOWLAN:
|
2013-08-09 03:23:49 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
struct wowlan_ioctl_param *poidparam;
|
|
|
|
struct recv_buf *precvbuf;
|
|
|
|
int res, i;
|
|
|
|
u32 tmp;
|
|
|
|
u16 len = 0;
|
|
|
|
u8 mstatus = (*(u8 *)val);
|
|
|
|
u8 trycnt = 100;
|
|
|
|
u8 data[4];
|
|
|
|
|
|
|
|
poidparam = (struct wowlan_ioctl_param *)val;
|
|
|
|
switch (poidparam->subcode){
|
2015-01-28 05:14:58 +00:00
|
|
|
case WOWLAN_ENABLE:
|
|
|
|
DBG_871X_LEVEL(_drv_always_, "WOWLAN_ENABLE\n");
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-01-28 05:14:58 +00:00
|
|
|
SetFwRelatedForWoWLAN8188ES(Adapter, true);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-01-28 05:14:58 +00:00
|
|
|
//Set Pattern
|
|
|
|
//if(adapter_to_pwrctl(Adapter)->wowlan_pattern==true)
|
|
|
|
// rtw_wowlan_reload_pattern(Adapter);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-01-28 05:14:58 +00:00
|
|
|
//RX DMA stop
|
|
|
|
DBG_871X_LEVEL(_drv_always_, "Pause DMA\n");
|
|
|
|
rtw_write32(Adapter,REG_RXPKT_NUM,(rtw_read32(Adapter,REG_RXPKT_NUM)|RW_RELEASE_EN));
|
|
|
|
do{
|
|
|
|
if((rtw_read32(Adapter, REG_RXPKT_NUM)&RXDMA_IDLE)) {
|
|
|
|
DBG_871X_LEVEL(_drv_always_, "RX_DMA_IDLE is true\n");
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
// If RX_DMA is not idle, receive one pkt from DMA
|
|
|
|
DBG_871X_LEVEL(_drv_always_, "RX_DMA_IDLE is not true\n");
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2015-01-28 05:14:58 +00:00
|
|
|
}while(trycnt--);
|
|
|
|
if(trycnt ==0)
|
|
|
|
DBG_871X_LEVEL(_drv_always_, "Stop RX DMA failed...... \n");
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-01-28 05:14:58 +00:00
|
|
|
//Set WOWLAN H2C command.
|
|
|
|
DBG_871X_LEVEL(_drv_always_, "Set WOWLan cmd\n");
|
|
|
|
rtl8188es_set_wowlan_cmd(Adapter, 1);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-01-28 05:14:58 +00:00
|
|
|
mstatus = rtw_read8(Adapter, REG_WOW_CTRL);
|
|
|
|
trycnt = 10;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-01-28 05:14:58 +00:00
|
|
|
while(!(mstatus&BIT1) && trycnt>1) {
|
2014-12-17 04:09:56 +00:00
|
|
|
mstatus = rtw_read8(Adapter, REG_WOW_CTRL);
|
2015-01-28 05:14:58 +00:00
|
|
|
DBG_871X_LEVEL(_drv_always_, "Loop index: %d :0x%02x\n", trycnt, mstatus);
|
|
|
|
trycnt --;
|
|
|
|
rtw_msleep_os(2);
|
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-01-28 05:14:58 +00:00
|
|
|
adapter_to_pwrctl(Adapter)->wowlan_wake_reason = rtw_read8(Adapter, REG_WOWLAN_WAKE_REASON);
|
|
|
|
DBG_871X_LEVEL(_drv_always_, "wowlan_wake_reason: 0x%02x\n",
|
|
|
|
adapter_to_pwrctl(Adapter)->wowlan_wake_reason);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-01-28 05:14:58 +00:00
|
|
|
/* Invoid SE0 reset signal during suspending*/
|
|
|
|
rtw_write8(Adapter, REG_RSV_CTRL, 0x20);
|
|
|
|
rtw_write8(Adapter, REG_RSV_CTRL, 0x60);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-01-28 05:14:58 +00:00
|
|
|
//rtw_msleep_os(10);
|
|
|
|
break;
|
|
|
|
case WOWLAN_DISABLE:
|
|
|
|
DBG_871X_LEVEL(_drv_always_, "WOWLAN_DISABLE\n");
|
|
|
|
trycnt = 10;
|
|
|
|
rtl8188es_set_wowlan_cmd(Adapter, 0);
|
|
|
|
mstatus = rtw_read8(Adapter, REG_WOW_CTRL);
|
|
|
|
DBG_871X_LEVEL(_drv_info_, "%s mstatus:0x%02x\n", __func__, mstatus);
|
|
|
|
|
|
|
|
while(mstatus&BIT1 && trycnt>1) {
|
|
|
|
mstatus = rtw_read8(Adapter, REG_WOW_CTRL);
|
|
|
|
DBG_871X_LEVEL(_drv_always_, "Loop index: %d :0x%02x\n", trycnt, mstatus);
|
|
|
|
trycnt --;
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_msleep_os(2);
|
2015-01-28 05:14:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (mstatus & BIT1)
|
|
|
|
printk("System did not release RX_DMA\n");
|
|
|
|
else
|
|
|
|
SetFwRelatedForWoWLAN8188ES(Adapter, false);
|
|
|
|
|
|
|
|
rtw_msleep_os(2);
|
|
|
|
if(!(adapter_to_pwrctl(Adapter)->wowlan_wake_reason & FWDecisionDisconnect))
|
|
|
|
rtl8188e_set_FwJoinBssReport_cmd(Adapter, 1);
|
|
|
|
//rtw_msleep_os(10);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2013-08-09 03:23:49 +00:00
|
|
|
}
|
|
|
|
break;
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif //CONFIG_WOWLAN
|
2013-08-09 03:23:49 +00:00
|
|
|
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#if (RATE_ADAPTIVE_SUPPORT == 1)
|
|
|
|
case HW_VAR_TX_RPT_MAX_MACID:
|
|
|
|
{
|
|
|
|
u8 maxMacid = *val;
|
|
|
|
DBG_871X("### MacID(%d),Set Max Tx RPT MID(%d)\n",maxMacid,maxMacid+1);
|
|
|
|
rtw_write8(Adapter, REG_TX_RPT_CTRL+1, maxMacid+1);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif
|
2014-12-17 04:09:56 +00:00
|
|
|
case HW_VAR_H2C_MEDIA_STATUS_RPT:
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2015-01-28 05:14:58 +00:00
|
|
|
rtl8188e_set_FwMediaStatus_cmd(Adapter, (*(__le16 *)val));
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HW_VAR_BCN_VALID:
|
|
|
|
//BCN_VALID, BIT16 of REG_TDECTRL = BIT0 of REG_TDECTRL+2, write 1 to clear, Clear by sw
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(Adapter, REG_TDECTRL+2, rtw_read8(Adapter, REG_TDECTRL+2) | BIT0);
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
|
|
|
default:
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
2013-08-09 03:23:49 +00:00
|
|
|
}
|
2014-12-01 22:31:15 +00:00
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void GetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
DM_ODM_T *podmpriv = &pHalData->odmpriv;
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
switch(variable)
|
|
|
|
{
|
|
|
|
case HW_VAR_BASIC_RATE:
|
|
|
|
*((u16 *)(val)) = pHalData->BasicRateSet;
|
|
|
|
case HW_VAR_TXPAUSE:
|
|
|
|
val[0] = rtw_read8(Adapter, REG_TXPAUSE);
|
|
|
|
break;
|
|
|
|
case HW_VAR_BCN_VALID:
|
|
|
|
//BCN_VALID, BIT16 of REG_TDECTRL = BIT0 of REG_TDECTRL+2
|
2014-12-29 02:13:24 +00:00
|
|
|
val[0] = (BIT0 & rtw_read8(Adapter, REG_TDECTRL+2))?true:false;
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
|
|
|
case HW_VAR_DM_FLAG:
|
|
|
|
val[0] = podmpriv->SupportAbility;
|
|
|
|
break;
|
|
|
|
case HW_VAR_RF_TYPE:
|
|
|
|
val[0] = pHalData->rf_type;
|
|
|
|
break;
|
|
|
|
case HW_VAR_FWLPS_RF_ON:
|
|
|
|
{
|
|
|
|
//When we halt NIC, we should check if FW LPS is leave.
|
|
|
|
if(adapter_to_pwrctl(Adapter)->rf_pwrstate == rf_off)
|
|
|
|
{
|
|
|
|
// If it is in HW/SW Radio OFF or IPS state, we do not check Fw LPS Leave,
|
|
|
|
// because Fw is unload.
|
2014-12-29 02:13:24 +00:00
|
|
|
val[0] = true;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
u32 valRCR;
|
|
|
|
valRCR = rtw_read32(Adapter, REG_RCR);
|
|
|
|
valRCR &= 0x00070000;
|
|
|
|
if(valRCR)
|
2014-12-29 02:13:24 +00:00
|
|
|
val[0] = false;
|
2014-12-17 04:09:56 +00:00
|
|
|
else
|
2014-12-29 02:13:24 +00:00
|
|
|
val[0] = true;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
|
|
|
#ifdef CONFIG_ANTENNA_DIVERSITY
|
|
|
|
case HW_VAR_CURRENT_ANTENNA:
|
|
|
|
val[0] = pHalData->CurAntenna;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
case HW_VAR_EFUSE_BYTES: // To get EFUE total used bytes, added by Roger, 2008.12.22.
|
2014-12-19 06:59:46 +00:00
|
|
|
*((u16 *)(val)) = pHalData->EfuseUsedBytes;
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
|
|
|
case HW_VAR_APFM_ON_MAC:
|
|
|
|
*val = pHalData->bMacPwrCtrlOn;
|
|
|
|
break;
|
|
|
|
case HW_VAR_CHK_HI_QUEUE_EMPTY:
|
2014-12-29 02:13:24 +00:00
|
|
|
*val = ((rtw_read32(Adapter, REG_HGQ_INFORMATION)&0x0000ff00)==0) ? true:false;
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HW_VAR_READ_LLT_TAB:
|
|
|
|
{
|
|
|
|
Read_LLT_Tab(Adapter);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HW_VAR_GET_CPWM:
|
|
|
|
#ifdef CONFIG_LPS_LCLK
|
|
|
|
{
|
|
|
|
*val = rtw_read8(Adapter, REG_USB_HCPWM);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case HW_VAR_C2HEVT_CLEAR:
|
|
|
|
*val = rtw_read8(Adapter, REG_C2HEVT_CLEAR);
|
|
|
|
break;
|
|
|
|
case HW_VAR_C2HEVT_MSG_NORMAL:
|
|
|
|
*val = rtw_read8(Adapter, REG_C2HEVT_MSG_NORMAL);
|
|
|
|
break;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
default:
|
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//
|
2014-12-19 06:59:46 +00:00
|
|
|
// Description:
|
2014-12-17 04:09:56 +00:00
|
|
|
// Query setting of specified variable.
|
|
|
|
//
|
|
|
|
u8
|
2013-05-08 21:45:39 +00:00
|
|
|
GetHalDefVar8188EUsb(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter * Adapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
IN HAL_DEF_VARIABLE eVariable,
|
2014-12-29 02:06:17 +00:00
|
|
|
IN void * pValue
|
2013-05-08 21:45:39 +00:00
|
|
|
)
|
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
|
|
|
struct dm_priv *pdmpriv = &pHalData->dmpriv;
|
2014-12-19 06:59:46 +00:00
|
|
|
DM_ODM_T *podmpriv = &pHalData->odmpriv;
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 bResult = _SUCCESS;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
switch(eVariable)
|
|
|
|
{
|
|
|
|
case HAL_DEF_UNDERCORATEDSMOOTHEDPWDB:
|
|
|
|
#if 1 //trunk
|
|
|
|
{
|
|
|
|
struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
|
|
|
|
struct sta_priv * pstapriv = &Adapter->stapriv;
|
|
|
|
struct sta_info * psta;
|
|
|
|
psta = rtw_get_stainfo(pstapriv, pmlmepriv->cur_network.network.MacAddress);
|
|
|
|
if(psta)
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
*((int *)pValue) = psta->rssi_stat.UndecoratedSmoothedPWDB;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#else //V4 branch
|
2014-12-29 02:13:24 +00:00
|
|
|
if(check_fwstate(&Adapter->mlmepriv, WIFI_STATION_STATE) == true){
|
2014-12-17 04:09:56 +00:00
|
|
|
*((int *)pValue) = pHalData->dmpriv.UndecoratedSmoothedPWDB;
|
|
|
|
}
|
|
|
|
else{
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case HAL_DEF_IS_SUPPORT_ANT_DIV:
|
|
|
|
#ifdef CONFIG_ANTENNA_DIVERSITY
|
2014-12-29 02:13:24 +00:00
|
|
|
*((u8 *)pValue) = (pHalData->AntDivCfg==0)?false:true;
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif
|
2014-12-19 06:59:46 +00:00
|
|
|
break;
|
2014-12-17 04:09:56 +00:00
|
|
|
case HAL_DEF_CURRENT_ANTENNA:
|
|
|
|
#ifdef CONFIG_ANTENNA_DIVERSITY
|
2014-12-19 06:59:46 +00:00
|
|
|
*(( u8*)pValue) = pHalData->CurAntenna;
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case HAL_DEF_DRVINFO_SZ:
|
|
|
|
*(( u32*)pValue) = DRVINFO_SZ;
|
|
|
|
break;
|
|
|
|
case HAL_DEF_MAX_RECVBUF_SZ:
|
|
|
|
*(( u32*)pValue) = MAX_RECVBUF_SZ;
|
|
|
|
break;
|
|
|
|
case HAL_DEF_RX_PACKET_OFFSET:
|
|
|
|
*(( u32*)pValue) = RXDESC_SIZE + DRVINFO_SZ;
|
|
|
|
break;
|
|
|
|
#if (RATE_ADAPTIVE_SUPPORT == 1)
|
|
|
|
case HAL_DEF_RA_DECISION_RATE:
|
|
|
|
{
|
|
|
|
u8 MacID = *((u8*)pValue);
|
|
|
|
*((u8*)pValue) = ODM_RA_GetDecisionRate_8188E(podmpriv, MacID);
|
|
|
|
}
|
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
case HAL_DEF_RA_SGI:
|
|
|
|
{
|
|
|
|
u8 MacID = *((u8*)pValue);
|
|
|
|
*((u8*)pValue) = ODM_RA_GetShortGI_8188E(podmpriv, MacID);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
break;
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
case HAL_DEF_PT_PWR_STATUS:
|
|
|
|
#if(POWER_TRAINING_ACTIVE==1)
|
|
|
|
{
|
|
|
|
u8 MacID = *((u8*)pValue);
|
|
|
|
*((u8*)pValue) = ODM_RA_GetHwPwrStatus_8188E(podmpriv, MacID);
|
|
|
|
}
|
|
|
|
#endif//(POWER_TRAINING_ACTIVE==1)
|
2014-12-19 06:59:46 +00:00
|
|
|
break;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
case HW_VAR_MAX_RX_AMPDU_FACTOR:
|
|
|
|
*(( u32*)pValue) = MAX_AMPDU_FACTOR_64K;
|
|
|
|
break;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
case HW_DEF_RA_INFO_DUMP:
|
2014-12-19 06:59:46 +00:00
|
|
|
#if (RATE_ADAPTIVE_SUPPORT == 1)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
u8 entry_id = *((u8*)pValue);
|
|
|
|
u8 i;
|
2014-12-29 02:13:24 +00:00
|
|
|
u8 bLinked = false;
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *pbuddy_adapter = Adapter->pbuddy_adapter;
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif //CONFIG_CONCURRENT_MODE
|
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
//if(check_fwstate(&Adapter->mlmepriv, _FW_LINKED)== true)
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
if(rtw_linked_check(Adapter))
|
2014-12-29 02:13:24 +00:00
|
|
|
bLinked = true;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
|
|
|
if(pbuddy_adapter && rtw_linked_check(pbuddy_adapter))
|
2014-12-29 02:13:24 +00:00
|
|
|
bLinked = true;
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if(bLinked){
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_871X("============ RA status check ===================\n");
|
|
|
|
if(Adapter->bRxRSSIDisplay >30)
|
|
|
|
Adapter->bRxRSSIDisplay = 1;
|
|
|
|
for(i=0;i< Adapter->bRxRSSIDisplay;i++){
|
|
|
|
DBG_8192C("Mac_id:%d ,RSSI:%d,RateID = %d,RAUseRate = 0x%08x,RateSGI = %d, DecisionRate = 0x%02x ,PTStage = %d, RetryOver drop:%d, LifeTimeOver drop:%d\n",
|
|
|
|
i,
|
|
|
|
podmpriv->RAInfo[i].RssiStaRA,
|
|
|
|
podmpriv->RAInfo[i].RateID,
|
|
|
|
podmpriv->RAInfo[i].RAUseRate,
|
|
|
|
podmpriv->RAInfo[i].RateSGI,
|
|
|
|
podmpriv->RAInfo[i].DecisionRate,
|
|
|
|
podmpriv->RAInfo[i].PTStage,
|
|
|
|
podmpriv->RAInfo[i].DROP,
|
|
|
|
podmpriv->RAInfo[i].DROP1
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif //(RATE_ADAPTIVE_SUPPORT == 1)
|
|
|
|
break;
|
|
|
|
case HAL_DEF_DBG_DUMP_RXPKT:
|
|
|
|
*(( u8*)pValue) = pHalData->bDumpRxPkt;
|
|
|
|
break;
|
|
|
|
case HAL_DEF_DBG_DUMP_TXPKT:
|
|
|
|
*(( u8*)pValue) = pHalData->bDumpTxPkt;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
bResult = GetHalDefVar(Adapter, eVariable, pValue);
|
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return bResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Description:
|
|
|
|
// Change default setting of specified variable.
|
|
|
|
//
|
|
|
|
u8
|
|
|
|
SetHalDefVar8188EUsb(
|
2014-12-17 23:13:53 +00:00
|
|
|
IN struct adapter * Adapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
IN HAL_DEF_VARIABLE eVariable,
|
2014-12-29 02:06:17 +00:00
|
|
|
IN void * pValue
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
|
|
|
struct dm_priv *pdmpriv = &pHalData->dmpriv;
|
2014-12-19 06:59:46 +00:00
|
|
|
DM_ODM_T *podmpriv = &pHalData->odmpriv;
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 bResult = _SUCCESS;
|
|
|
|
|
|
|
|
switch(eVariable)
|
|
|
|
{
|
|
|
|
case HAL_DEF_DBG_DM_FUNC:
|
|
|
|
{
|
|
|
|
u8 dm_func = *(( u8*)pValue);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if(dm_func == 0){ //disable all dynamic func
|
|
|
|
podmpriv->SupportAbility = DYNAMIC_FUNC_DISABLE;
|
|
|
|
DBG_8192C("==> Disable all dynamic function...\n");
|
|
|
|
}
|
|
|
|
else if(dm_func == 1){//disable DIG
|
|
|
|
podmpriv->SupportAbility &= (~DYNAMIC_BB_DIG);
|
|
|
|
DBG_8192C("==> Disable DIG...\n");
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
else if(dm_func == 2){//disable High power
|
|
|
|
podmpriv->SupportAbility &= (~DYNAMIC_BB_DYNAMIC_TXPWR);
|
|
|
|
}
|
|
|
|
else if(dm_func == 3){//disable tx power tracking
|
|
|
|
podmpriv->SupportAbility &= (~DYNAMIC_RF_CALIBRATION);
|
|
|
|
DBG_8192C("==> Disable tx power tracking...\n");
|
|
|
|
}
|
|
|
|
//else if(dm_func == 4){//disable BT coexistence
|
|
|
|
// pdmpriv->DMFlag &= (~DYNAMIC_FUNC_BT);
|
|
|
|
//}
|
|
|
|
else if(dm_func == 5){//disable antenna diversity
|
|
|
|
podmpriv->SupportAbility &= (~DYNAMIC_BB_ANT_DIV);
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
else if(dm_func == 6){//turn on all dynamic func
|
|
|
|
if(!(podmpriv->SupportAbility & DYNAMIC_BB_DIG))
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
DIG_T *pDigTable = &podmpriv->DM_DigTable;
|
2014-12-19 06:59:46 +00:00
|
|
|
pDigTable->CurIGValue= rtw_read8(Adapter,0xc50);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
//pdmpriv->DMFlag |= DYNAMIC_FUNC_BT;
|
|
|
|
podmpriv->SupportAbility = DYNAMIC_ALL_FUNC_ENABLE;
|
|
|
|
DBG_8192C("==> Turn on all dynamic function...\n");
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
|
|
|
case HAL_DEF_DBG_DUMP_RXPKT:
|
|
|
|
pHalData->bDumpRxPkt = *(( u8*)pValue);
|
|
|
|
break;
|
|
|
|
case HAL_DEF_DBG_DUMP_TXPKT:
|
|
|
|
pHalData->bDumpTxPkt = *(( u8*)pValue);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
bResult = SetHalDefVar(Adapter, eVariable, pValue);
|
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return bResult;
|
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
/*
|
2014-12-17 23:13:53 +00:00
|
|
|
u32 _update_92cu_basic_rate(struct adapter *padapter, unsigned int mask)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
|
|
|
#ifdef CONFIG_BT_COEXIST
|
|
|
|
struct btcoexist_priv *pbtpriv = &(pHalData->bt_coexist);
|
|
|
|
#endif
|
|
|
|
unsigned int BrateCfg = 0;
|
|
|
|
|
|
|
|
#ifdef CONFIG_BT_COEXIST
|
|
|
|
if( (pbtpriv->BT_Coexist) && (pbtpriv->BT_CoexistType == BT_CSR_BC4) )
|
|
|
|
{
|
|
|
|
BrateCfg = mask & 0x151;
|
|
|
|
//DBG_8192C("BT temp disable cck 2/5.5/11M, (0x%x = 0x%x)\n", REG_RRSR, BrateCfg & 0x151);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
//if(pHalData->VersionID != VERSION_TEST_CHIP_88C)
|
|
|
|
BrateCfg = mask & 0x15F;
|
|
|
|
//else //for 88CU 46PING setting, Disable CCK 2M, 5.5M, Others must tuning
|
|
|
|
// BrateCfg = mask & 0x159;
|
|
|
|
}
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
BrateCfg |= 0x01; // default enable 1M ACK rate
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
return BrateCfg;
|
|
|
|
}
|
|
|
|
*/
|
2014-12-17 23:13:53 +00:00
|
|
|
void _update_response_rate(struct adapter *padapter,unsigned int mask)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
u8 RateIndex = 0;
|
|
|
|
// Set RRSR rate table.
|
|
|
|
rtw_write8(padapter, REG_RRSR, mask&0xff);
|
|
|
|
rtw_write8(padapter,REG_RRSR+1, (mask>>8)&0xff);
|
|
|
|
|
|
|
|
// Set RTS initial rate
|
|
|
|
while(mask > 0x1)
|
|
|
|
{
|
|
|
|
mask = (mask>> 1);
|
|
|
|
RateIndex++;
|
|
|
|
}
|
|
|
|
rtw_write8(padapter, REG_INIRTS_RATE_SEL, RateIndex);
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void UpdateHalRAMask8188EUsb(struct adapter *padapter, u32 mac_id, u8 rssi_level)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
//volatile unsigned int result;
|
|
|
|
u8 init_rate=0;
|
2014-12-19 06:59:46 +00:00
|
|
|
u8 networkType, raid;
|
2014-12-17 04:09:56 +00:00
|
|
|
u32 mask,rate_bitmap;
|
2014-12-29 02:13:24 +00:00
|
|
|
u8 shortGIrate = false;
|
2013-05-08 21:45:39 +00:00
|
|
|
int supportRateNum = 0;
|
|
|
|
struct sta_info *psta;
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
|
|
|
//struct dm_priv *pdmpriv = &pHalData->dmpriv;
|
|
|
|
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
2014-12-19 06:59:46 +00:00
|
|
|
WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if (mac_id >= NUM_STA) //CAM_SIZE
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
return;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
psta = pmlmeinfo->FW_sta_info[mac_id].psta;
|
2014-12-17 04:09:56 +00:00
|
|
|
if(psta == NULL)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
return;
|
|
|
|
}
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
switch (mac_id)
|
|
|
|
{
|
|
|
|
case 0:// for infra mode
|
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
|
|
|
case 2:// first station uses macid=0, second station uses macid=2
|
|
|
|
#endif
|
|
|
|
supportRateNum = rtw_get_rateset_len(cur_network->SupportedRates);
|
|
|
|
networkType = judge_network_type(padapter, cur_network->SupportedRates, supportRateNum) & 0xf;
|
|
|
|
//pmlmeext->cur_wireless_mode = networkType;
|
|
|
|
raid = networktype_to_raid(networkType);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
mask = update_supported_rate(cur_network->SupportedRates, supportRateNum);
|
|
|
|
mask |= (pmlmeinfo->HT_enable)? update_MSC_rate(&(pmlmeinfo->HT_caps)): 0;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if (support_short_GI(padapter, &(pmlmeinfo->HT_caps)))
|
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
shortGIrate = true;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
case 1://for broadcast/multicast
|
|
|
|
supportRateNum = rtw_get_rateset_len(pmlmeinfo->FW_sta_info[mac_id].SupportedRates);
|
|
|
|
if(pmlmeext->cur_wireless_mode & WIRELESS_11B)
|
|
|
|
networkType = WIRELESS_11B;
|
|
|
|
else
|
|
|
|
networkType = WIRELESS_11G;
|
|
|
|
raid = networktype_to_raid(networkType);
|
|
|
|
mask = update_basic_rate(cur_network->SupportedRates, supportRateNum);
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: //for each sta in IBSS
|
|
|
|
supportRateNum = rtw_get_rateset_len(pmlmeinfo->FW_sta_info[mac_id].SupportedRates);
|
|
|
|
networkType = judge_network_type(padapter, pmlmeinfo->FW_sta_info[mac_id].SupportedRates, supportRateNum) & 0xf;
|
|
|
|
//pmlmeext->cur_wireless_mode = networkType;
|
2014-12-19 06:59:46 +00:00
|
|
|
raid = networktype_to_raid(networkType);
|
2014-12-17 04:09:56 +00:00
|
|
|
mask = update_supported_rate(cur_network->SupportedRates, supportRateNum);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//todo: support HT in IBSS
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//mask &=0x0fffffff;
|
2014-12-19 06:59:46 +00:00
|
|
|
rate_bitmap = 0x0fffffff;
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef CONFIG_ODM_REFRESH_RAMASK
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
rate_bitmap = ODM_Get_Rate_Bitmap(&pHalData->odmpriv,mac_id,mask,rssi_level);
|
|
|
|
printk("%s => mac_id:%d, networkType:0x%02x, mask:0x%08x\n\t ==> rssi_level:%d, rate_bitmap:0x%08x\n",
|
|
|
|
__FUNCTION__,mac_id,networkType,mask,rssi_level,rate_bitmap);
|
|
|
|
}
|
|
|
|
#endif
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
mask &= rate_bitmap;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
init_rate = get_highest_rate_idx(mask)&0x3f;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if(pHalData->fw_ractrl == true)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
u8 arg = 0;
|
|
|
|
|
|
|
|
//arg = (cam_idx-4)&0x1f;//MACID
|
|
|
|
arg = mac_id&0x1f;//MACID
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
arg |= BIT(7);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if (shortGIrate==true)
|
2013-05-08 21:45:39 +00:00
|
|
|
arg |= BIT(5);
|
2014-12-17 04:09:56 +00:00
|
|
|
mask |= ((raid<<28)&0xf0000000);
|
|
|
|
DBG_871X("update raid entry, mask=0x%x, arg=0x%x\n", mask, arg);
|
|
|
|
psta->ra_mask=mask;
|
|
|
|
#ifdef CONFIG_INTEL_PROXIM
|
2014-12-29 02:13:24 +00:00
|
|
|
if(padapter->proximity.proxim_on ==true){
|
2014-12-17 04:09:56 +00:00
|
|
|
arg &= ~BIT(6);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
arg |= BIT(6);
|
|
|
|
}
|
|
|
|
#endif //CONFIG_INTEL_PROXIM
|
|
|
|
mask |= ((raid<<28)&0xf0000000);
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
//to do
|
2014-12-17 04:09:56 +00:00
|
|
|
/*
|
2014-12-30 22:55:10 +00:00
|
|
|
*(u32 *)&RateMask=EF4Byte((ratr_bitmap&0x0fffffff) | (ratr_index<<28));
|
2014-12-17 04:09:56 +00:00
|
|
|
RateMask[4] = macId | (bShortGI?0x20:0x00) | 0x80;
|
2014-12-19 06:59:46 +00:00
|
|
|
*/
|
|
|
|
rtl8188e_set_raid_cmd(padapter, mask);
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
#if(RATE_ADAPTIVE_SUPPORT == 1)
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
ODM_RA_UpdateRateInfo_8188E(
|
|
|
|
&(pHalData->odmpriv),
|
2013-05-08 21:45:39 +00:00
|
|
|
mac_id,
|
2014-12-19 06:59:46 +00:00
|
|
|
raid,
|
2013-05-08 21:45:39 +00:00
|
|
|
mask,
|
|
|
|
shortGIrate
|
|
|
|
);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
//set ra_id
|
2013-05-08 21:45:39 +00:00
|
|
|
psta->raid = raid;
|
|
|
|
psta->init_rate = init_rate;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void SetBeaconRelatedRegisters8188EUsb(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u32 value32;
|
|
|
|
//HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
|
|
|
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
|
2013-05-08 21:45:39 +00:00
|
|
|
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
2014-12-19 06:59:46 +00:00
|
|
|
u32 bcn_ctrl_reg = REG_BCN_CTRL;
|
|
|
|
//reset TSF, enable update TSF, correcting TSF On Beacon
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//REG_BCN_INTERVAL
|
|
|
|
//REG_BCNDMATIM
|
|
|
|
//REG_ATIMWND
|
|
|
|
//REG_TBTT_PROHIBIT
|
|
|
|
//REG_DRVERLYINT
|
2014-12-19 06:59:46 +00:00
|
|
|
//REG_BCN_MAX_ERR
|
2014-12-17 04:09:56 +00:00
|
|
|
//REG_BCNTCFG //(0x510)
|
|
|
|
//REG_DUAL_TSF_RST
|
2014-12-19 06:59:46 +00:00
|
|
|
//REG_BCN_CTRL //(0x550)
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
//BCN interval
|
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
2014-12-19 06:59:46 +00:00
|
|
|
if (padapter->iface_type == IFACE_PORT1){
|
2014-12-17 04:09:56 +00:00
|
|
|
bcn_ctrl_reg = REG_BCN_CTRL_1;
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
|
|
|
#endif
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write16(padapter, REG_BCN_INTERVAL, pmlmeinfo->bcn_interval);
|
|
|
|
rtw_write8(padapter, REG_ATIMWND, 0x02);// 2ms
|
|
|
|
|
|
|
|
_InitBeaconParameters(padapter);
|
|
|
|
|
|
|
|
rtw_write8(padapter, REG_SLOT, 0x09);
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
value32 =rtw_read32(padapter, REG_TCR);
|
2014-12-17 04:09:56 +00:00
|
|
|
value32 &= ~TSFRST;
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write32(padapter, REG_TCR, value32);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
value32 |= TSFRST;
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write32(padapter, REG_TCR, value32);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
// NOTE: Fix test chip's bug (about contention windows's randomness)
|
|
|
|
rtw_write8(padapter, REG_RXTSF_OFFSET_CCK, 0x50);
|
|
|
|
rtw_write8(padapter, REG_RXTSF_OFFSET_OFDM, 0x50);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
_BeaconFunctionEnable(padapter, true, true);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
ResumeTxBeacon(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//rtw_write8(padapter, 0x422, rtw_read8(padapter, 0x422)|BIT(6));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//rtw_write8(padapter, 0x541, 0xff);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//rtw_write8(padapter, 0x542, rtw_read8(padapter, 0x541)|BIT(0));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write8(padapter, bcn_ctrl_reg, rtw_read8(padapter, bcn_ctrl_reg)|BIT(1));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void rtl8188eu_init_default_value(struct adapter * padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
PHAL_DATA_TYPE pHalData;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct pwrctrl_priv *pwrctrlpriv;
|
2014-12-17 04:09:56 +00:00
|
|
|
struct dm_priv *pdmpriv;
|
2013-05-08 21:45:39 +00:00
|
|
|
u8 i;
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData = GET_HAL_DATA(padapter);
|
|
|
|
pwrctrlpriv = adapter_to_pwrctl(padapter);
|
|
|
|
pdmpriv = &pHalData->dmpriv;
|
|
|
|
|
|
|
|
|
|
|
|
//init default value
|
2014-12-29 02:13:24 +00:00
|
|
|
pHalData->fw_ractrl = false;
|
2014-12-17 04:09:56 +00:00
|
|
|
if(!pwrctrlpriv->bkeepfwalive)
|
2014-12-19 06:59:46 +00:00
|
|
|
pHalData->LastHMEBoxNum = 0;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
//init dm default value
|
2014-12-29 02:13:24 +00:00
|
|
|
pHalData->odmpriv.RFCalibrateInfo.bIQKInitialized = false;
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData->odmpriv.RFCalibrateInfo.TM_Trigger = 0;//for IQK
|
2014-12-29 02:13:24 +00:00
|
|
|
//pdmpriv->binitialized = false;
|
2014-12-17 04:09:56 +00:00
|
|
|
// pdmpriv->prv_traffic_idx = 3;
|
|
|
|
// pdmpriv->initialize = 0;
|
|
|
|
pHalData->pwrGroupCnt = 0;
|
|
|
|
pHalData->PGMaxGroup= 13;
|
|
|
|
pHalData->odmpriv.RFCalibrateInfo.ThermalValue_HP_index = 0;
|
|
|
|
for(i = 0; i < HP_THERMAL_NUM; i++)
|
|
|
|
pHalData->odmpriv.RFCalibrateInfo.ThermalValue_HP[i] = 0;
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static u8 rtl8188eu_ps_func(struct adapter *Adapter,HAL_INTF_PS_FUNC efunc_id, u8 *val)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
u8 bResult = true;
|
2014-12-17 04:09:56 +00:00
|
|
|
switch(efunc_id){
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#if defined(CONFIG_AUTOSUSPEND) && defined(SUPPORT_HW_RFOFF_DETECTED)
|
|
|
|
case HAL_USB_SELECT_SUSPEND:
|
|
|
|
{
|
|
|
|
u8 bfwpoll = *(( u8*)val);
|
|
|
|
//rtl8188e_set_FwSelectSuspend_cmd(Adapter,bfwpoll ,500);//note fw to support hw power down ping detect
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
#endif //CONFIG_AUTOSUSPEND && SUPPORT_HW_RFOFF_DETECTED
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
return bResult;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtl8188eu_set_hal_ops(struct adapter * padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
struct hal_ops *pHalFunc = &padapter->HalFunc;
|
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_CONCURRENT_MODE
|
|
|
|
if(padapter->isprimary)
|
|
|
|
#endif //CONFIG_CONCURRENT_MODE
|
|
|
|
{
|
|
|
|
padapter->HalData = rtw_zmalloc(sizeof(HAL_DATA_TYPE));
|
|
|
|
if(padapter->HalData == NULL){
|
|
|
|
DBG_8192C("cant not alloc memory for HAL DATA \n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//_rtw_memset(padapter->HalData, 0, sizeof(HAL_DATA_TYPE));
|
|
|
|
padapter->hal_data_sz = sizeof(HAL_DATA_TYPE);
|
|
|
|
|
|
|
|
pHalFunc->hal_power_on = InitPowerOn_rtl8188eu;
|
|
|
|
pHalFunc->hal_power_off = hal_poweroff_rtl8188eu;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalFunc->hal_init = &rtl8188eu_hal_init;
|
|
|
|
pHalFunc->hal_deinit = &rtl8188eu_hal_deinit;
|
|
|
|
|
|
|
|
//pHalFunc->free_hal_data = &rtl8192c_free_hal_data;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalFunc->inirp_init = &rtl8188eu_inirp_init;
|
|
|
|
pHalFunc->inirp_deinit = &rtl8188eu_inirp_deinit;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalFunc->init_xmit_priv = &rtl8188eu_init_xmit_priv;
|
|
|
|
pHalFunc->free_xmit_priv = &rtl8188eu_free_xmit_priv;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalFunc->init_recv_priv = &rtl8188eu_init_recv_priv;
|
|
|
|
pHalFunc->free_recv_priv = &rtl8188eu_free_recv_priv;
|
|
|
|
#ifdef CONFIG_SW_LED
|
|
|
|
pHalFunc->InitSwLeds = &rtl8188eu_InitSwLeds;
|
|
|
|
pHalFunc->DeInitSwLeds = &rtl8188eu_DeInitSwLeds;
|
|
|
|
#else //case of hw led or no led
|
|
|
|
pHalFunc->InitSwLeds = NULL;
|
2014-12-19 06:59:46 +00:00
|
|
|
pHalFunc->DeInitSwLeds = NULL;
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif//CONFIG_SW_LED
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalFunc->init_default_value = &rtl8188eu_init_default_value;
|
|
|
|
pHalFunc->intf_chip_configure = &rtl8188eu_interface_configure;
|
|
|
|
pHalFunc->read_adapter_info = &ReadAdapterInfo8188EU;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//pHalFunc->set_bwmode_handler = &PHY_SetBWMode8192C;
|
|
|
|
//pHalFunc->set_channel_handler = &PHY_SwChnl8192C;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//pHalFunc->hal_dm_watchdog = &rtl8192c_HalDmWatchDog;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalFunc->SetHwRegHandler = &SetHwReg8188EU;
|
|
|
|
pHalFunc->GetHwRegHandler = &GetHwReg8188EU;
|
2014-12-19 06:59:46 +00:00
|
|
|
pHalFunc->GetHalDefVarHandler = &GetHalDefVar8188EUsb;
|
|
|
|
pHalFunc->SetHalDefVarHandler = &SetHalDefVar8188EUsb;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalFunc->UpdateRAMaskHandler = &UpdateHalRAMask8188EUsb;
|
|
|
|
pHalFunc->SetBeaconRelatedRegistersHandler = &SetBeaconRelatedRegisters8188EUsb;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
//pHalFunc->Add_RateATid = &rtl8192c_Add_RateATid;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalFunc->hal_xmit = &rtl8188eu_hal_xmit;
|
|
|
|
pHalFunc->mgnt_xmit = &rtl8188eu_mgnt_xmit;
|
|
|
|
pHalFunc->hal_xmitframe_enqueue = &rtl8188eu_hal_xmitframe_enqueue;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_HOSTAPD_MLME
|
|
|
|
pHalFunc->hostap_mgnt_xmit_entry = &rtl8188eu_hostap_mgnt_xmit_entry;
|
|
|
|
#endif
|
|
|
|
pHalFunc->interface_ps_func = &rtl8188eu_ps_func;
|
|
|
|
|
|
|
|
rtl8188e_set_hal_ops(pHalFunc);
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-01 22:31:15 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|