diff --git a/Makefile b/Makefile index 80b651a..5214651 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,7 @@ CONFIG_USB_AUTOSUSPEND = n CONFIG_HW_PWRP_DETECTION = n CONFIG_WIFI_TEST = n CONFIG_BT_COEXIST = n +CONFIG_RTL8192CU_REDEFINE_1X1 = n CONFIG_INTEL_WIDI = n CONFIG_WAPI_SUPPORT = n CONFIG_EFUSE_CONFIG_FILE = n @@ -44,6 +45,7 @@ OUTSRC_FILES := hal/odm_debug.o \ hal/odm.o\ hal/HalPhyRf.o +ifeq ($(CONFIG_RTL8188E), y) RTL871X = rtl8188e HAL_COMM_FILES := hal/rtl8188e_xmit.o\ @@ -60,15 +62,19 @@ OUTSRC_FILES += hal/HalHWImg8188E_MAC.o\ hal/Hal8188ERateAdaptive.o\ hal/odm_RTL8188E.o +ifeq ($(CONFIG_RTL8188E), y) ifeq ($(CONFIG_WOWLAN), y) OUTSRC_FILES += hal/HalHWImg8188E_FW.o endif +endif PWRSEQ_FILES := hal/HalPwrSeqCmd.o \ hal/Hal8188EPwrSeq.o CHIP_FILES += $(HAL_COMM_FILES) $(OUTSRC_FILES) $(PWRSEQ_FILES) +endif + HCI_NAME = usb _OS_INTFS_FILES := os_dep/osdep_service.o \ @@ -135,6 +141,10 @@ ifeq ($(CONFIG_BT_COEXIST), y) EXTRA_CFLAGS += -DCONFIG_BT_COEXIST endif +ifeq ($(CONFIG_RTL8192CU_REDEFINE_1X1), y) +EXTRA_CFLAGS += -DRTL8192C_RECONFIG_TO_1T1R +endif + ifeq ($(CONFIG_INTEL_WIDI), y) EXTRA_CFLAGS += -DCONFIG_INTEL_WIDI endif @@ -155,13 +165,17 @@ ifeq ($(CONFIG_FTP_PROTECT), y) EXTRA_CFLAGS += -DCONFIG_FTP_PROTECT endif +ifeq ($(CONFIG_RTL8188E), y) ifeq ($(CONFIG_WOWLAN), y) EXTRA_CFLAGS += -DCONFIG_WOWLAN endif +endif +ifeq ($(CONFIG_RTL8188E), y) ifeq ($(CONFIG_EFUSE_CONFIG_FILE), y) EXTRA_CFLAGS += -DCONFIG_RF_GAIN_OFFSET endif +endif SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ | sed -e s/ppc/powerpc/) @@ -441,7 +455,12 @@ $(MODULE_NAME)-y += $(_OS_INTFS_FILES) $(MODULE_NAME)-$(CONFIG_MP_INCLUDED) += core/rtw_mp.o \ core/rtw_mp_ioctl.o -obj-y := $(MODULE_NAME).o +ifeq ($(CONFIG_RTL8723A), y) + +$(MODULE_NAME)-$(CONFIG_MP_INCLUDED)+= core/rtw_bt_mp.o +endif + +obj-$(CONFIG_RTL8188EU) := $(MODULE_NAME).o else diff --git a/core/rtw_mlme.c b/core/rtw_mlme.c index e44e996..6f4b2de 100644 --- a/core/rtw_mlme.c +++ b/core/rtw_mlme.c @@ -2138,6 +2138,11 @@ _func_enter_; mlmeext_sta_add_event_callback(adapter, psta); +#ifdef CONFIG_RTL8711 + //submit SetStaKey_cmd to tell fw, fw will allocate an CAM entry for this sta + rtw_setstakey_cmd(adapter, (unsigned char*)psta, false); +#endif + exit: _func_exit_; @@ -3442,6 +3447,14 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui AMPDU_para [4:2]:Min MPDU Start Spacing */ + /* + #if defined(CONFIG_RTL8188E )&& defined (CONFIG_SDIO_HCI) + ht_capie.ampdu_params_info = 2; + #else + ht_capie.ampdu_params_info = (IEEE80211_HT_CAP_AMPDU_FACTOR&0x03); + #endif + */ + rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor); ht_capie.ampdu_params_info = (max_rx_ampdu_factor&0x03); @@ -3453,10 +3466,17 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui pframe = rtw_set_ie(out_ie+out_len, _HT_CAPABILITY_IE_, sizeof(struct rtw_ieee80211_ht_cap), (unsigned char*)&ht_capie, pout_len); + + + //_rtw_memcpy(out_ie+out_len, p, ielen+2);//gtest + //*pout_len = *pout_len + (ielen+2); + + phtpriv->ht_option = true; p = rtw_get_ie(in_ie+12, _HT_ADD_INFO_IE_, &ielen, in_len-12); - if (p && (ielen==sizeof(struct ieee80211_ht_addt_info))) { + if (p && (ielen==sizeof(struct ieee80211_ht_addt_info))) + { out_len = *pout_len; pframe = rtw_set_ie(out_ie+out_len, _HT_ADD_INFO_IE_, ielen, p+2 , pout_len); } diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index 2cd682f..f069db0 100644 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -8089,16 +8089,24 @@ void issue_action_BA(_adapter *padapter, unsigned char *raddr, unsigned char act else #endif { + #if defined(CONFIG_RTL8188E) && defined(CONFIG_SDIO_HCI) + BA_para_set = (0x0802 | ((status & 0xf) << 2)); //immediate ack & 16 buffer size + #else BA_para_set = (0x1002 | ((status & 0xf) << 2)); //immediate ack & 64 buffer size + #endif } + //sys_mib.BA_para_set = 0x0802; //immediate ack & 32 buffer size BA_para_set = cpu_to_le16(BA_para_set); pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_para_set)), &(pattrib->pktlen)); + //BA_timeout_value = 0xffff;//max: 65535 TUs(~ 65 ms) BA_timeout_value = 5000;//~ 5ms BA_timeout_value = cpu_to_le16(BA_timeout_value); pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_timeout_value)), &(pattrib->pktlen)); - if ((psta = rtw_get_stainfo(pstapriv, raddr)) != NULL) { + //if ((psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.MacAddress)) != NULL) + if ((psta = rtw_get_stainfo(pstapriv, raddr)) != NULL) + { start_seq = (psta->sta_xmitpriv.txseq_tid[status & 0x07]&0xfff) + 1; DBG_88E("BA_starting_seqctrl = %d for TID=%d\n", start_seq, status & 0x07); @@ -8115,6 +8123,14 @@ void issue_action_BA(_adapter *padapter, unsigned char *raddr, unsigned char act case 1: //ADDBA rsp pframe = rtw_set_fixed_ie(pframe, 1, &(pmlmeinfo->ADDBA_req.dialog_token), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&status), &(pattrib->pktlen)); + /* + //BA_para_set = cpu_to_le16((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); //64 buffer size + #if defined(CONFIG_RTL8188E )&& defined (CONFIG_SDIO_HCI) + BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x0800); //32buffer size + #else + BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); //64 buffer size + #endif + */ rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor); if (MAX_AMPDU_FACTOR_64K == max_rx_ampdu_factor) BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); //64 buffer size diff --git a/core/rtw_mp.c b/core/rtw_mp.c index 3b1f687..6ee4974 100644 --- a/core/rtw_mp.c +++ b/core/rtw_mp.c @@ -25,8 +25,23 @@ #include /* for RFHIGHPID */ #endif +#ifdef CONFIG_RTL8712 +#include +#endif +#ifdef CONFIG_RTL8192C +#include +#endif +#ifdef CONFIG_RTL8192D +#include +#endif +#ifdef CONFIG_RTL8723A +#include +#include "rtw_bt_mp.h" +#endif +#ifdef CONFIG_RTL8188E #include "odm_precomp.h" #include "rtl8188e_hal.h" +#endif #ifdef CONFIG_MP_INCLUDED @@ -322,9 +337,25 @@ void free_mp_priv(struct mp_priv *pmp_priv) pmp_priv->pmp_xmtframe_buf = NULL; } +#if defined (CONFIG_RTL8192C) || defined (CONFIG_RTL8723A) +#define PHY_IQCalibrate(a,b) rtl8192c_PHY_IQCalibrate(a,b) +#define PHY_LCCalibrate(a) rtl8192c_PHY_LCCalibrate(a) +//#define dm_CheckTXPowerTracking(a) rtl8192c_odm_CheckTXPowerTracking(a) +#define PHY_SetRFPathSwitch(a,b) rtl8192c_PHY_SetRFPathSwitch(a,b) +#endif + +#ifdef CONFIG_RTL8192D +#define PHY_IQCalibrate(a,b) rtl8192d_PHY_IQCalibrate(a) +#define PHY_LCCalibrate(a) rtl8192d_PHY_LCCalibrate(a) +//#define dm_CheckTXPowerTracking(a) rtl8192d_odm_CheckTXPowerTracking(a) +#define PHY_SetRFPathSwitch(a,b) rtl8192d_PHY_SetRFPathSwitch(a,b) +#endif + +#ifdef CONFIG_RTL8188E #define PHY_IQCalibrate(a,b) PHY_IQCalibrate_8188E(a,b) #define PHY_LCCalibrate(a) PHY_LCCalibrate_8188E(a) #define PHY_SetRFPathSwitch(a,b) PHY_SetRFPathSwitch_8188E(a,b) +#endif s32 MPT_InitializeAdapter( @@ -349,28 +380,66 @@ MPT_InitializeAdapter( pMptCtx->bMptIndexEven = true; //default gain index is -6.0db pMptCtx->h2cReqNum = 0x0; /* Init mpt event. */ + //init for BT MP +#ifdef CONFIG_RTL8723A + pMptCtx->bMPh2c_timeout = false; + pMptCtx->MptH2cRspEvent = false; + pMptCtx->MptBtC2hEvent = false; + + _rtw_init_sema(&pMptCtx->MPh2c_Sema, 0); + _init_timer( &pMptCtx->MPh2c_timeout_timer, pAdapter->pnetdev, MPh2c_timeout_handle, pAdapter ); +#endif pMptCtx->bMptWorkItemInProgress = false; pMptCtx->CurrMptAct = NULL; //------------------------------------------------------------------------- +#if 1 // Don't accept any packets rtw_write32(pAdapter, REG_RCR, 0); +#else + // Accept CRC error and destination address + //pHalData->ReceiveConfig |= (RCR_ACRC32|RCR_AAP); + //rtw_write32(pAdapter, REG_RCR, pHalData->ReceiveConfig); + rtw_write32(pAdapter, REG_RCR, 0x70000101); +#endif if (IS_HARDWARE_TYPE_8192DU(pAdapter)) + { rtw_write32(pAdapter, REG_LEDCFG0, 0x8888); + } else + { + //rtw_write32(pAdapter, REG_LEDCFG0, 0x08080); ledsetting = rtw_read32(pAdapter, REG_LEDCFG0); + #if defined (CONFIG_RTL8192C) || defined( CONFIG_RTL8192D ) + rtw_write32(pAdapter, REG_LEDCFG0, ledsetting & ~LED0DIS); + #endif + } + PHY_IQCalibrate(pAdapter, false); dm_CheckTXPowerTracking(&pHalData->odmpriv); //trigger thermal meter PHY_LCCalibrate(pAdapter); +#ifdef CONFIG_PCI_HCI + PHY_SetRFPathSwitch(pAdapter, 1/*pHalData->bDefaultAntenna*/); //Wifi default use Main +#else + +#ifdef CONFIG_RTL8192C + if (pHalData->BoardType == BOARD_MINICARD) + PHY_SetRFPathSwitch(pAdapter, 1/*pHalData->bDefaultAntenna*/); //default use Main +#endif + +#endif + pMptCtx->backup0xc50 = (u1Byte)PHY_QueryBBReg(pAdapter, rOFDM0_XAAGCCore1, bMaskByte0); pMptCtx->backup0xc58 = (u1Byte)PHY_QueryBBReg(pAdapter, rOFDM0_XBAGCCore1, bMaskByte0); pMptCtx->backup0xc30 = (u1Byte)PHY_QueryBBReg(pAdapter, rOFDM0_RxDetector1, bMaskByte0); +#ifdef CONFIG_RTL8188E pMptCtx->backup0x52_RF_A = (u1Byte)PHY_QueryRFReg(pAdapter, RF_PATH_A, RF_0x52, 0x000F0); pMptCtx->backup0x52_RF_B = (u1Byte)PHY_QueryRFReg(pAdapter, RF_PATH_A, RF_0x52, 0x000F0); +#endif //set ant to wifi side in mp mode rtw_write16(pAdapter, 0x870, 0x300); @@ -407,6 +476,10 @@ MPT_DeInitAdapter( PMPT_CONTEXT pMptCtx = &pAdapter->mppriv.MptCtx; pMptCtx->bMptDrvUnload = true; + #ifdef CONFIG_RTL8723A + _rtw_free_sema(&(pMptCtx->MPh2c_Sema)); + _cancel_timer_ex( &pMptCtx->MPh2c_timeout_timer); + #endif } static u8 mpt_ProStartTest(PADAPTER padapter) @@ -441,15 +514,22 @@ void GetPowerTracking(PADAPTER padapter, u8 *enable) static void disable_dm(PADAPTER padapter) { +#ifndef CONFIG_RTL8723A u8 v8; +#endif HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; + //3 1. disable firmware dynamic mechanism // disable Power Training, Rate Adaptive +#ifdef CONFIG_RTL8723A + SetBcnCtrlReg(padapter, 0, EN_BCN_FUNCTION); +#else v8 = rtw_read8(padapter, REG_BCN_CTRL); v8 &= ~EN_BCN_FUNCTION; rtw_write8(padapter, REG_BCN_CTRL, v8); +#endif //3 2. disable driver dynamic mechanism // disable Dynamic Initial Gain @@ -458,6 +538,9 @@ static void disable_dm(PADAPTER padapter) Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, false); // enable APK, LCK and IQK but disable power tracking +#ifndef CONFIG_RTL8188E + pdmpriv->TxPowerTrackControl = false; +#endif Switch_DM_Func(padapter, DYNAMIC_RF_CALIBRATION, true); } @@ -569,10 +652,24 @@ end_of_mp_start_test: if (res == _SUCCESS) { // set MSR to WIFI_FW_ADHOC_STATE +#if !defined (CONFIG_RTL8712) val8 = rtw_read8(padapter, MSR) & 0xFC; // 0x0102 val8 |= WIFI_FW_ADHOC_STATE; rtw_write8(padapter, MSR, val8); // Link in ad hoc network +#endif +#if defined (CONFIG_RTL8712) + rtw_write8(padapter, MSR, 1); // Link in ad hoc network + rtw_write8(padapter, RCR, 0); // RCR : disable all pkt, 0x10250048 + rtw_write8(padapter, RCR+2, 0x57); // RCR disable Check BSSID, 0x1025004a + + // disable RX filter map , mgt frames will put in RX FIFO 0 + rtw_write16(padapter, RXFLTMAP0, 0x0); // 0x10250116 + + val8 = rtw_read8(padapter, EE_9346CR); // 0x1025000A + if (!(val8 & _9356SEL))//boot from EFUSE + efuse_change_max_size(padapter); +#endif } return res; @@ -726,6 +823,27 @@ void MP_PHY_SetRFPathSwitch(PADAPTER pAdapter ,bool bMain) } +#if defined (CONFIG_RTL8712) +/*------------------------------Define structure----------------------------*/ +typedef struct _R_ANTENNA_SELECT_OFDM { + u32 r_tx_antenna:4; + u32 r_ant_l:4; + u32 r_ant_non_ht:4; + u32 r_ant_ht1:4; + u32 r_ant_ht2:4; + u32 r_ant_ht_s1:4; + u32 r_ant_non_ht_s1:4; + u32 OFDM_TXSC:2; + u32 Reserved:2; +}R_ANTENNA_SELECT_OFDM; + +typedef struct _R_ANTENNA_SELECT_CCK { + u8 r_cckrx_enable_2:2; + u8 r_cckrx_enable:2; + u8 r_ccktx_enable:4; +}R_ANTENNA_SELECT_CCK; +#endif + s32 SetThermalMeter(PADAPTER pAdapter, u8 target_ther) { return Hal_SetThermalMeter( pAdapter, target_ther); @@ -788,7 +906,15 @@ void PhySetTxPowerLevel(PADAPTER pAdapter) struct mp_priv *pmp_priv = &pAdapter->mppriv; if (pmp_priv->bSetTxPower==0) // for NO manually set power index + { +#ifdef CONFIG_RTL8188E PHY_SetTxPowerLevel8188E(pAdapter,pmp_priv->channel); +#elif defined(CONFIG_RTL8192D) + PHY_SetTxPowerLevel8192D(pAdapter,pmp_priv->channel); +#else + PHY_SetTxPowerLevel8192C(pAdapter,pmp_priv->channel); +#endif + } } //------------------------------------------------------------------------------ @@ -945,24 +1071,44 @@ void SetPacketTx(PADAPTER padapter) //3 3. init TX descriptor // offset 0 +#if defined(CONFIG_RTL8188E) && !defined(CONFIG_RTL8188E_SDIO) desc->txdw0 |= cpu_to_le32(OWN | FSG | LSG); desc->txdw0 |= cpu_to_le32(pkt_size & 0x0000FFFF); // packet size desc->txdw0 |= cpu_to_le32(((TXDESC_SIZE + OFFSET_SZ) << OFFSET_SHT) & 0x00FF0000); //32 bytes for TX Desc if (bmcast) desc->txdw0 |= cpu_to_le32(BMC); // broadcast packet desc->txdw1 |= cpu_to_le32((0x01 << 26) & 0xff000000); +#endif // offset 4 + #ifndef CONFIG_RTL8188E + desc->txdw1 |= cpu_to_le32(BK); // don't aggregate(AMPDU) + desc->txdw1 |= cpu_to_le32((pattrib->mac_id) & 0x1F); //CAM_ID(MAC_ID) + #else desc->txdw1 |= cpu_to_le32((pattrib->mac_id) & 0x3F); //CAM_ID(MAC_ID) + #endif desc->txdw1 |= cpu_to_le32((pattrib->qsel << QSEL_SHT) & 0x00001F00); // Queue Select, TID + #ifdef CONFIG_RTL8188E desc->txdw1 |= cpu_to_le32((pattrib->raid << RATE_ID_SHT) & 0x000F0000); // Rate Adaptive ID + #else + desc->txdw1 |= cpu_to_le32((pattrib->raid << Rate_ID_SHT) & 0x000F0000); // Rate Adaptive ID + + #endif // offset 8 + // desc->txdw2 |= cpu_to_le32(AGG_BK);//AGG BK // offset 12 desc->txdw3 |= cpu_to_le32((pattrib->seqnum<<16)&0x0fff0000); +// desc->txdw3 |= cpu_to_le32((pattrib->seqnum & 0xFFF) << SEQ_SHT); + //desc->txdw3 |= cpu_to_le32((pattrib->seqnum << SEQ_SHT) & 0xffff0000); // offset 16 - desc->txdw4 |= cpu_to_le32(HW_SSN); + //desc->txdw4 |= cpu_to_le32(QoS) + #ifdef CONFIG_RTL8188E + desc->txdw4 |= cpu_to_le32(HW_SSN); + #else + desc->txdw4 |= cpu_to_le32(HW_SEQ_EN); + #endif desc->txdw4 |= cpu_to_le32(USERATE); desc->txdw4 |= cpu_to_le32(DISDATAFB); @@ -980,8 +1126,12 @@ void SetPacketTx(PADAPTER padapter) if (pmp_priv->rateidx > MPT_RATE_54M) desc->txdw5 |= cpu_to_le32(SGI); // MCS Short Guard Interval } - desc->txdw5 |= cpu_to_le32(RTY_LMT_EN); // retry limit enable - desc->txdw5 |= cpu_to_le32(0x00180000); // DATA/RTS Rate Fallback Limit + #ifdef CONFIG_RTL8188E + desc->txdw5 |= cpu_to_le32(RTY_LMT_EN); // retry limit enable + desc->txdw5 |= cpu_to_le32(0x00180000); // DATA/RTS Rate Fallback Limit + #else + desc->txdw5 |= cpu_to_le32(0x0001FF00); // DATA/RTS Rate Fallback Limit + #endif //3 4. make wlan header, make_wlanhdr() hdr = (struct rtw_ieee80211_hdr *)pkt_start; @@ -1036,8 +1186,11 @@ void SetPacketRx(PADAPTER pAdapter, u8 bStartRx) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - if (bStartRx) { + if (bStartRx) + { // Accept CRC error and destination address +#if 1 +//ndef CONFIG_RTL8723A pHalData->ReceiveConfig = AAP | APM | AM | AB | APP_ICV | ADF | AMF | HTC_LOC_CTRL | APP_MIC | APP_PHYSTS; pHalData->ReceiveConfig |= ACRC32; @@ -1046,7 +1199,12 @@ void SetPacketRx(PADAPTER pAdapter, u8 bStartRx) // Accept all data frames rtw_write16(pAdapter, REG_RXFLTMAP2, 0xFFFF); - } else { +#else + rtw_write32(pAdapter, REG_RCR, 0x70000101); +#endif + } + else + { rtw_write32(pAdapter, REG_RCR, 0); } } diff --git a/core/rtw_pwrctrl.c b/core/rtw_pwrctrl.c index 446443e..c65fc5b 100644 --- a/core/rtw_pwrctrl.c +++ b/core/rtw_pwrctrl.c @@ -811,7 +811,18 @@ _func_enter_; adapter_to_dvobj(Adapter)->pusbdev->autosuspend_disabled = Adapter->bDisableAutosuspend;//autosuspend disabled by the user #endif } + else #endif + { +#if defined(CONFIG_PLATFORM_SPRD) && defined(CONFIG_RTL8188E) + #ifdef CONFIG_IPS + if (false == ips_leave(Adapter)) + { + DBG_88E("======> ips_leave fail.............\n"); + } + #endif +#endif //CONFIG_PLATFORM_SPRD && CONFIG_RTL8188E + } } } diff --git a/hal/hal_com.c b/hal/hal_com.c index f0c1447..8d4d2d0 100644 --- a/hal/hal_com.c +++ b/hal/hal_com.c @@ -24,7 +24,18 @@ #include #include +#ifdef CONFIG_RTL8192C +#include +#endif +#ifdef CONFIG_RTL8192D +#include +#endif +#ifdef CONFIG_RTL8723A +#include +#endif +#ifdef CONFIG_RTL8188E #include +#endif #define _HAL_INIT_C_ @@ -35,37 +46,43 @@ void dump_chip_info(HAL_VERSION ChipVersion) if (IS_81XXC(ChipVersion)){ cnt += sprintf((buf+cnt), "Chip Version Info: %s_", IS_92C_SERIAL(ChipVersion)?"CHIP_8192C":"CHIP_8188C"); - } - else if (IS_92D(ChipVersion)){ + } else if (IS_92D(ChipVersion)){ cnt += sprintf((buf+cnt), "Chip Version Info: CHIP_8192D_"); - } - else if (IS_8723_SERIES(ChipVersion)){ + } else if (IS_8723_SERIES(ChipVersion)){ cnt += sprintf((buf+cnt), "Chip Version Info: CHIP_8723A_"); - } - else if (IS_8188E(ChipVersion)){ + } else if (IS_8188E(ChipVersion)){ cnt += sprintf((buf+cnt), "Chip Version Info: CHIP_8188E_"); } cnt += sprintf((buf+cnt), "%s_", IS_NORMAL_CHIP(ChipVersion)?"Normal_Chip":"Test_Chip"); cnt += sprintf((buf+cnt), "%s_", IS_CHIP_VENDOR_TSMC(ChipVersion)?"TSMC":"UMC"); - if (IS_A_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "A_CUT_"); - else if (IS_B_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "B_CUT_"); - else if (IS_C_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "C_CUT_"); - else if (IS_D_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "D_CUT_"); - else if (IS_E_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "E_CUT_"); - else cnt += sprintf((buf+cnt), "UNKNOWN_CUT(%d)_", ChipVersion.CUTVersion); + if (IS_A_CUT(ChipVersion)) + cnt += sprintf((buf+cnt), "A_CUT_"); + else if (IS_B_CUT(ChipVersion)) + cnt += sprintf((buf+cnt), "B_CUT_"); + else if (IS_C_CUT(ChipVersion)) + cnt += sprintf((buf+cnt), "C_CUT_"); + else if (IS_D_CUT(ChipVersion)) + cnt += sprintf((buf+cnt), "D_CUT_"); + else if (IS_E_CUT(ChipVersion)) + cnt += sprintf((buf+cnt), "E_CUT_"); + else + cnt += sprintf((buf+cnt), "UNKNOWN_CUT(%d)_", ChipVersion.CUTVersion); - if (IS_1T1R(ChipVersion)) cnt += sprintf((buf+cnt), "1T1R_"); - else if (IS_1T2R(ChipVersion)) cnt += sprintf((buf+cnt), "1T2R_"); - else if (IS_2T2R(ChipVersion)) cnt += sprintf((buf+cnt), "2T2R_"); - else cnt += sprintf((buf+cnt), "UNKNOWN_RFTYPE(%d)_", ChipVersion.RFType); + if (IS_1T1R(ChipVersion)) + cnt += sprintf((buf+cnt), "1T1R_"); + else if (IS_1T2R(ChipVersion)) + cnt += sprintf((buf+cnt), "1T2R_"); + else if (IS_2T2R(ChipVersion)) + cnt += sprintf((buf+cnt), "2T2R_"); + else + cnt += sprintf((buf+cnt), "UNKNOWN_RFTYPE(%d)_", ChipVersion.RFType); cnt += sprintf((buf+cnt), "RomVer(%d)\n", ChipVersion.ROMVer); - DBG_88E("%s", buf); + pr_info("%s", buf); } - #define EEPROM_CHANNEL_PLAN_BY_HW_MASK 0x80 u8 //return the final channel plan decision diff --git a/hal/odm.c b/hal/odm.c index 609799f..4106e70 100644 --- a/hal/odm.c +++ b/hal/odm.c @@ -4431,6 +4431,7 @@ odm_TXPowerTrackingThermalMeterInit( #endif//#if (MP_DRIVER != 1) ODM_RT_TRACE(pDM_Odm,COMP_POWER_TRACKING, DBG_LOUD, ("pMgntInfo->bTXPowerTracking = %d\n", pMgntInfo->bTXPowerTracking)); #elif (DM_ODM_SUPPORT_TYPE == ODM_CE) + #ifdef CONFIG_RTL8188E { pDM_Odm->RFCalibrateInfo.bTXPowerTracking = true; pDM_Odm->RFCalibrateInfo.TXPowercount = 0; @@ -4441,13 +4442,36 @@ odm_TXPowerTrackingThermalMeterInit( //#endif//#if (MP_DRIVER != 1) MSG_88E("pDM_Odm TxPowerTrackControl = %d\n", pDM_Odm->RFCalibrateInfo.TxPowerTrackControl); } + #else + { + PADAPTER Adapter = pDM_Odm->Adapter; + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + + //if (IS_HARDWARE_TYPE_8192C(pHalData)) + { + pdmpriv->bTXPowerTracking = true; + pdmpriv->TXPowercount = 0; + pdmpriv->bTXPowerTrackingInit = false; + //#if (MP_DRIVER != 1) //for mp driver, turn off txpwrtracking as default + + if (*(pDM_Odm->mp_mode) != 1) + pdmpriv->TxPowerTrackControl = true; + //#endif//#if (MP_DRIVER != 1) + } + MSG_88E("pdmpriv->TxPowerTrackControl = %d\n", pdmpriv->TxPowerTrackControl); + + } + #endif//endif (CONFIG_RTL8188E==1) #elif (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) + #ifdef RTL8188E_SUPPORT { pDM_Odm->RFCalibrateInfo.bTXPowerTracking = true; pDM_Odm->RFCalibrateInfo.TXPowercount = 0; pDM_Odm->RFCalibrateInfo.bTXPowerTrackingInit = false; pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = true; } + #endif #endif pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = TRUE; @@ -4466,6 +4490,9 @@ ODM_TXPowerTrackingCheck( PADAPTER pAdapter = pDM_Odm->Adapter; prtl8192cd_priv priv = pDM_Odm->priv; + //if (!(pDM_Odm->SupportAbility & ODM_RF_TX_PWR_TRACK)) + //return; + // // 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate // at the same time. In the stage2/3, we need to prive universal interface and merge all diff --git a/hal/rtl8188e_hal_init.c b/hal/rtl8188e_hal_init.c index 75d07a3..a206f67 100644 --- a/hal/rtl8188e_hal_init.c +++ b/hal/rtl8188e_hal_init.c @@ -2465,10 +2465,7 @@ rtl8188e_Efuse_PgPacketWrite( PADAPTER pAdapter, return ret; } -static HAL_VERSION -ReadChipVersion8188E( - PADAPTER padapter - ) +static HAL_VERSION ReadChipVersion8188E(PADAPTER padapter) { u32 value32; HAL_VERSION ChipVersion; @@ -2478,7 +2475,7 @@ ReadChipVersion8188E( pHalData = GET_HAL_DATA(padapter); value32 = rtw_read32(padapter, REG_SYS_CFG); - ChipVersion.ICType = CHIP_8188E ; + ChipVersion.ICType = CHIP_8188E; ChipVersion.ChipType = ((value32 & RTL_ID) ? TEST_CHIP : NORMAL_CHIP); ChipVersion.RFType = RF_TYPE_1T1R; @@ -2492,10 +2489,7 @@ ReadChipVersion8188E( pHalData->MultiFunc = RT_MULTI_FUNC_NONE; -//#if DBG -#if 1 dump_chip_info(ChipVersion); -#endif pHalData->VersionID = ChipVersion; @@ -2506,8 +2500,7 @@ ReadChipVersion8188E( else if (IS_2T2R(ChipVersion)){ pHalData->rf_type = RF_2T2R; pHalData->NumTotalRFPath = 2; - } - else{ + } else{ pHalData->rf_type = RF_1T1R; pHalData->NumTotalRFPath = 1; } @@ -2521,6 +2514,7 @@ static void rtl8188e_read_chip_version(PADAPTER padapter) { ReadChipVersion8188E(padapter); } + void rtl8188e_GetHalODMVar( PADAPTER Adapter, HAL_ODM_VARIABLE eVariable, diff --git a/include/rtw_efuse.h b/include/rtw_efuse.h index 90de744..474d276 100644 --- a/include/rtw_efuse.h +++ b/include/rtw_efuse.h @@ -51,8 +51,24 @@ enum _EFUSE_DEF_TYPE { }; /* E-Fuse */ +#ifdef CONFIG_RTL8192D +#define EFUSE_MAP_SIZE 256 +#endif +#ifdef CONFIG_RTL8192C +#define EFUSE_MAP_SIZE 128 +#endif +#ifdef CONFIG_RTL8723A +#define EFUSE_MAP_SIZE 256 +#endif +#ifdef CONFIG_RTL8188E #define EFUSE_MAP_SIZE 512 +#endif + +#ifdef CONFIG_RTL8188E #define EFUSE_MAX_SIZE 256 +#else +#define EFUSE_MAX_SIZE 512 +#endif /* end of E-Fuse */ #define EFUSE_MAX_MAP_LEN 256 diff --git a/include/rtw_mp.h b/include/rtw_mp.h index d993795..61f9b22 100644 --- a/include/rtw_mp.h +++ b/include/rtw_mp.h @@ -182,7 +182,19 @@ struct mp_tx _thread_hdl_ PktTxThread; }; +#if defined(CONFIG_RTL8192C) || defined(CONFIG_RTL8192D) || defined(CONFIG_RTL8723A) || defined(CONFIG_RTL8188E) +#ifdef CONFIG_RTL8192C +#include +#endif +#ifdef CONFIG_RTL8192D +#include +#endif +#ifdef CONFIG_RTL8723A +#include +#endif +#ifdef CONFIG_RTL8188E #include +#endif #define MP_MAX_LINES 1000 #define MP_MAX_LINES_BYTES 256 @@ -323,6 +335,8 @@ typedef struct _MPT_CONTEXT u1Byte mptOutBuf[100]; }MPT_CONTEXT, *PMPT_CONTEXT; +#endif +//#endif //#define RTPRIV_IOCTL_MP ( SIOCIWFIRSTPRIV + 0x17) enum { diff --git a/include/rtw_sreset.h b/include/rtw_sreset.h index 0558c5a..67714f7 100644 --- a/include/rtw_sreset.h +++ b/include/rtw_sreset.h @@ -32,7 +32,18 @@ struct sreset_priv { unsigned long last_tx_complete_time; }; +#ifdef CONFIG_RTL8192C +#include +#endif +#ifdef CONFIG_RTL8192D +#include +#endif +#ifdef CONFIG_RTL8723A +#include +#endif +#ifdef CONFIG_RTL8188E #include +#endif #define WIFI_STATUS_SUCCESS 0 #define USB_VEN_REQ_CMD_FAIL BIT0 diff --git a/include/usb_hal.h b/include/usb_hal.h index 87d87e9..a17a395 100644 --- a/include/usb_hal.h +++ b/include/usb_hal.h @@ -20,11 +20,27 @@ #ifndef __USB_HAL_H__ #define __USB_HAL_H__ +#ifdef CONFIG_RTL8192C +void rtl8192cu_set_hal_ops(_adapter * padapter); +#define hal_set_hal_ops rtl8192cu_set_hal_ops +#endif + +#ifdef CONFIG_RTL8192D +void rtl8192du_set_hal_ops(_adapter * padapter); +#define hal_set_hal_ops rtl8192du_set_hal_ops +#endif + +#ifdef CONFIG_RTL8723A +void rtl8723au_set_hal_ops(_adapter * padapter); +#define hal_set_hal_ops rtl8723au_set_hal_ops +#endif + +#ifdef CONFIG_RTL8188E void rtl8188eu_set_hal_ops(_adapter * padapter); #define hal_set_hal_ops rtl8188eu_set_hal_ops +#endif #ifdef CONFIG_INTEL_PROXIM extern _adapter *rtw_usb_get_sw_pointer(void); #endif //CONFIG_INTEL_PROXIM - #endif //__USB_HAL_H__ diff --git a/include/usb_ops.h b/include/usb_ops.h index 92fc5ab..f46ae69 100644 --- a/include/usb_ops.h +++ b/include/usb_ops.h @@ -55,10 +55,53 @@ enum{ #include #endif //PLATFORM_LINUX +#ifdef CONFIG_RTL8192C +void rtl8192cu_set_hw_type(_adapter *padapter); +#define hal_set_hw_type rtl8192cu_set_hw_type + +void rtl8192cu_set_intf_ops(struct _io_ops *pops); +#define usb_set_intf_ops rtl8192cu_set_intf_ops + +void rtl8192cu_recv_tasklet(void *priv); + +void rtl8192cu_xmit_tasklet(void *priv); +#endif + +#ifdef CONFIG_RTL8723A +void rtl8723au_set_hw_type(_adapter *padapter); +#define hal_set_hw_type rtl8723au_set_hw_type + +void rtl8723au_set_intf_ops(struct _io_ops *pops); +#define usb_set_intf_ops rtl8723au_set_intf_ops + +void rtl8192cu_recv_tasklet(void *priv); + +void rtl8192cu_xmit_tasklet(void *priv); +#endif + +#ifdef CONFIG_RTL8192D +void rtl8192du_set_hw_type(_adapter *padapter); +#define hal_set_hw_type rtl8192du_set_hw_type +void rtl8192du_set_intf_ops(struct _io_ops *pops); +#define usb_set_intf_ops rtl8192du_set_intf_ops +#ifndef PLATFORM_FREEBSD +void rtl8192du_recv_tasklet(void *priv); +#else // PLATFORM_FREEBSD +void rtl8192du_recv_tasklet(void *priv, int npending); +#ifdef CONFIG_RX_INDICATE_QUEUE +void rtw_rx_indicate_tasklet(void *priv, int npending); +#endif // CONFIG_RX_INDICATE_QUEUE +#endif // PLATFORM_FREEBSD + +void rtl8192du_xmit_tasklet(void *priv); +#endif + +#ifdef CONFIG_RTL8188E void rtl8188eu_set_hw_type(_adapter *padapter); #define hal_set_hw_type rtl8188eu_set_hw_type void rtl8188eu_set_intf_ops(struct _io_ops *pops); #define usb_set_intf_ops rtl8188eu_set_intf_ops +#endif /* * Increase and check if the continual_urb_error of this @param dvobjprive is larger than MAX_CONTINUAL_URB_ERR diff --git a/os_dep/ioctl_linux.c b/os_dep/ioctl_linux.c index cc65a32..abd2f00 100644 --- a/os_dep/ioctl_linux.c +++ b/os_dep/ioctl_linux.c @@ -43,7 +43,24 @@ #ifdef CONFIG_MP_INCLUDED #include #endif //#ifdef CONFIG_MP_INCLUDED +#ifdef CONFIG_RTL8192C +#include +#endif +#ifdef CONFIG_RTL8192D +#include +#endif +#ifdef CONFIG_RTL8723A +#include +#include +#include +#endif +#ifdef CONFIG_RTL8188E #include +#endif +#ifdef CONFIG_GSPI_HCI +#include +#endif + #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) #define iwe_stream_add_event(a, b, c, d, e) iwe_stream_add_event(b, c, d, e) @@ -8733,25 +8750,53 @@ static int rtw_mp_efuse_get(struct net_device *dev, { addr = 0; mapLen = EFUSE_MAX_SIZE; - if (rtw_efuse_access(padapter, false, addr, mapLen, rawdata) == _FAIL) { + if (rtw_efuse_access(padapter, false, addr, mapLen, rawdata) == _FAIL) + { DBG_88E("%s: rtw_efuse_access Fail!!\n", __func__); err = -EFAULT; goto exit; } +// DBG_88E("%s: realraw={\n", __func__); sprintf(extra, "\n"); - for (i=0; i max_available_size) { + if ((addr + cnts) > max_available_size) + { DBG_88E("%s: addr(0x%02x)+cnts(%d) parameter error!\n", __func__, addr, cnts); err = -EFAULT; goto exit; } - if (rtw_efuse_map_read(padapter, addr, cnts, data) == _FAIL) { + if (rtw_efuse_map_read(padapter, addr, cnts, data) == _FAIL) + { DBG_88E("%s: rtw_efuse_access error!!\n", __func__); err = -EFAULT; goto exit; } +// DBG_88E("%s: {VID,PID}={", __func__); *extra = 0; - for (i=0; iBTEfuseInitMap) == _FAIL) { + if (rtw_BT_efuse_map_read(padapter, 0, mapLen, pEfuseHal->BTEfuseInitMap) == _FAIL) + { DBG_88E("%s: rtw_BT_efuse_map_read Fail!!\n", __func__); err = -EFAULT; goto exit; } +// DBG_88E("OFFSET\tVALUE(hex)\n"); sprintf(extra, "\n"); - for (i=0; i<512; i+=16) { // set 512 because the iwpriv's extra size have limit 0x7FF + for (i=0; i<512; i+=16) // set 512 because the iwpriv's extra size have limit 0x7FF + { +// DBG_88E("0x%03x\t", i); sprintf(extra, "%s0x%03x\t", extra, i); - for (j=0; j<8; j++) + for (j=0; j<8; j++) { +// DBG_88E("%02X ", pEfuseHal->BTEfuseInitMap[i+j]); sprintf(extra, "%s%02X ", extra, pEfuseHal->BTEfuseInitMap[i+j]); + } +// DBG_88E("\t"); sprintf(extra,"%s\t",extra); - for (; j<16; j++) + for (; j<16; j++) { +// DBG_88E("%02X ", pEfuseHal->BTEfuseInitMap[i+j]); sprintf(extra, "%s%02X ", extra, pEfuseHal->BTEfuseInitMap[i+j]); + } +// DBG_88E("\n"); sprintf(extra, "%s\n", extra); } - } else if (strcmp(tmp[0],"btbmap") == 0) { +// DBG_88E("\n"); + } + else if (strcmp(tmp[0],"btbmap") == 0) + { mapLen = EFUSE_BT_MAX_MAP_LEN; - if (rtw_BT_efuse_map_read(padapter, 0, mapLen, pEfuseHal->BTEfuseInitMap) == _FAIL) { + if (rtw_BT_efuse_map_read(padapter, 0, mapLen, pEfuseHal->BTEfuseInitMap) == _FAIL) + { DBG_88E("%s: rtw_BT_efuse_map_read Fail!!\n", __func__); err = -EFAULT; goto exit; } +// DBG_88E("OFFSET\tVALUE(hex)\n"); sprintf(extra, "\n"); - for (i=512; i<1024 ; i+=16) { + for (i=512; i<1024 ; i+=16) + { +// DBG_88E("0x%03x\t", i); sprintf(extra, "%s0x%03x\t", extra, i); for (j=0; j<8; j++) + { +// DBG_88E("%02X ", data[i+j]); sprintf(extra, "%s%02X ", extra, pEfuseHal->BTEfuseInitMap[i+j]); + } +// DBG_88E("\t"); sprintf(extra,"%s\t",extra); - for (; j<16; j++) + for (; j<16; j++) { +// DBG_88E("%02X ", data[i+j]); sprintf(extra, "%s%02X ", extra, pEfuseHal->BTEfuseInitMap[i+j]); + } +// DBG_88E("\n"); sprintf(extra, "%s\n", extra); } - } else if (strcmp(tmp[0],"btrmap") == 0) { - if ((tmp[1]==NULL) || (tmp[2]==NULL)) { +// DBG_88E("\n"); + } + else if (strcmp(tmp[0],"btrmap") == 0) + { + if ((tmp[1]==NULL) || (tmp[2]==NULL)) + { err = -EINVAL; goto exit; } @@ -8845,7 +8950,8 @@ static int rtw_mp_efuse_get(struct net_device *dev, DBG_88E("%s: addr=0x%X\n", __func__, addr); cnts = simple_strtoul(tmp[2], &ptmp, 10); - if (cnts == 0) { + if (cnts == 0) + { DBG_88E("%s: btrmap Fail!! cnts error!\n", __func__); err = -EINVAL; goto exit; @@ -9077,21 +9183,30 @@ static int rtw_mp_efuse_set(struct net_device *dev, { setdata[jj] = key_2char2num(tmp[2][kk], tmp[2][kk+1]); } +#ifndef CONFIG_RTL8188E + EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (void *)&max_available_size, false); +#else //Change to check TYPE_EFUSE_MAP_LEN ,beacuse 8188E raw 256,logic map over 256. EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_EFUSE_MAP_LEN, (void *)&max_available_size, false); - if ((addr+cnts) > max_available_size) { +#endif + if ((addr+cnts) > max_available_size) + { DBG_88E("%s: addr(0x%X)+cnts(%d) parameter error!\n", __func__, addr, cnts); err = -EFAULT; goto exit; } - if (rtw_efuse_map_write(padapter, addr, cnts, setdata) == _FAIL) { + if (rtw_efuse_map_write(padapter, addr, cnts, setdata) == _FAIL) + { DBG_88E("%s: rtw_efuse_map_write error!!\n", __func__); err = -EFAULT; goto exit; } - } else if (strcmp(tmp[0], "wraw") == 0) { - if ((tmp[1]==NULL) || (tmp[2]==NULL)) { + } + else if (strcmp(tmp[0], "wraw") == 0) + { + if ((tmp[1]==NULL) || (tmp[2]==NULL)) + { err = -EINVAL; goto exit; } @@ -9100,12 +9215,14 @@ static int rtw_mp_efuse_set(struct net_device *dev, addr &= 0xFFF; cnts = strlen(tmp[2]); - if (cnts%2) { + if (cnts%2) + { err = -EINVAL; goto exit; } cnts /= 2; - if (cnts == 0) { + if (cnts == 0) + { err = -EINVAL; goto exit; } @@ -9114,7 +9231,8 @@ static int rtw_mp_efuse_set(struct net_device *dev, DBG_88E("%s: cnts=%d\n", __func__, cnts); DBG_88E("%s: raw data=%s\n", __func__, tmp[2]); - for (jj=0, kk=0; jj 6) { + if (cnts > 6) + { DBG_88E("%s: error data for mac addr=\"%s\"\n", __func__, tmp[1]); err = -EFAULT; goto exit; @@ -9160,9 +9308,14 @@ static int rtw_mp_efuse_set(struct net_device *dev, { setdata[jj] = key_2char2num(tmp[1][kk], tmp[1][kk+1]); } +#ifndef CONFIG_RTL8188E + EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (void *)&max_available_size, false); +#else //Change to check TYPE_EFUSE_MAP_LEN ,beacuse 8188E raw 256,logic map over 256. EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_EFUSE_MAP_LEN, (void *)&max_available_size, false); - if ((addr+cnts) > max_available_size) { +#endif + if ((addr+cnts) > max_available_size) + { DBG_88E("%s: addr(0x%X)+cnts(%d) parameter error!\n", __func__, addr, cnts); err = -EFAULT; goto exit; @@ -9184,7 +9337,23 @@ static int rtw_mp_efuse_set(struct net_device *dev, } // pidvid,da0b7881 - addr = EEPROM_VID_88EE; + #ifdef CONFIG_RTL8192C + addr = 0x0a; + #endif + #ifdef CONFIG_RTL8192D + addr = 0x0c; + #endif + #ifdef CONFIG_RTL8723A + addr = EEPROM_VID_8723AU; + #endif + #ifdef CONFIG_RTL8188E + #ifdef CONFIG_USB_HCI + addr = EEPROM_VID_88EE; + #endif + #ifdef CONFIG_PCI_HCI + addr = EEPROM_VID_88EE; + #endif + #endif //#ifdef CONFIG_RTL8188E cnts = strlen(tmp[1]); if (cnts%2) { @@ -9736,7 +9905,13 @@ static int rtw_mp_start(struct net_device *dev, u8 val8; PADAPTER padapter = rtw_netdev_priv(dev); - if (padapter->registrypriv.mp_mode ==0) { + if (padapter->registrypriv.mp_mode ==0) + { + #ifdef CONFIG_RTL8723A + DBG_88E("_rtw_mp_xmit_priv for Download BT patch FW\n"); + _rtw_mp_xmit_priv(&padapter->xmitpriv); + #endif + padapter->registrypriv.mp_mode =1; rtw_pm_set_ips(padapter,IPS_NONE); @@ -9763,7 +9938,13 @@ static int rtw_mp_stop(struct net_device *dev, { PADAPTER padapter = rtw_netdev_priv(dev); - if (padapter->registrypriv.mp_mode ==1) { + if (padapter->registrypriv.mp_mode ==1) + { + #ifdef CONFIG_RTL8723A + DBG_88E("_rtw_mp_xmit_priv reinit for normal mode\n"); + _rtw_mp_xmit_priv(&padapter->xmitpriv); + #endif + MPT_DeInitAdapter(padapter); padapter->registrypriv.mp_mode=0; } @@ -10259,7 +10440,15 @@ static int rtw_mp_thermal(struct net_device *dev, u8 val; u16 bwrite=1; - u16 addr=EEPROM_THERMAL_METER_88E; + #if defined(CONFIG_RTL8192C) || defined(CONFIG_RTL8192D) + u16 addr=EEPROM_THERMAL_METER; + #endif + #ifdef CONFIG_RTL8723A + u16 addr=EEPROM_THERMAL_METER_8723A; + #endif + #if defined(CONFIG_RTL8188E) + u16 addr=EEPROM_THERMAL_METER_88E; + #endif u16 cnt=1; u16 max_available_size=0; @@ -10268,11 +10457,15 @@ static int rtw_mp_thermal(struct net_device *dev, if (copy_from_user(extra, wrqu->pointer, wrqu->length)) return -EFAULT; + //DBG_88E("print extra %s\n",extra); + bwrite = strncmp(extra, "write", 6); // strncmp TRUE is 0 Hal_GetThermalMeter(padapter, &val); - if (bwrite == 0) { + if (bwrite == 0) + { + //DBG_88E("to write val:%d",val); EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (void *)&max_available_size, false); if (2 > max_available_size) { @@ -10363,14 +10556,19 @@ static int rtw_mp_dump(struct net_device *dev, else path_nums = 2; - for (path=0;pathlength = strlen(extra) + 1; - return 0; +return 0; + } static int rtw_mp_SetRFPath(struct net_device *dev, @@ -10470,6 +10673,161 @@ static int rtw_mp_antBdiff(struct net_device *dev, return 0; } + +#ifdef CONFIG_RTL8723A + +/* update Tx AGC offset */ +static int rtw_mp_SetBT(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + PADAPTER padapter = rtw_netdev_priv(dev); + BT_REQ_CMD BtReq; + PMPT_CONTEXT pMptCtx=&(padapter->mppriv.MptCtx); + PBT_RSP_CMD pBtRsp=(PBT_RSP_CMD)&pMptCtx->mptOutBuf[0]; + char input[128]; + char *pch, *ptmp, *token, *tmp[2]={0x00,0x00}; + u8 setdata[100]; + + u16 testmode=1,ready=1,trxparam=1,setgen=1,getgen=1,testctrl=1,testbt=1; + u32 i,ii,jj,kk,cnts,status; + + if (copy_from_user(extra, wrqu->data.pointer, wrqu->data.length)) + return -EFAULT; + if (strlen(extra)<1) return -EFAULT; + + DBG_88E("%s:iwpriv in=%s\n", __func__, extra); + ready = strncmp(extra, "ready", 5); + testmode = strncmp(extra, "testmode", 8); // strncmp TRUE is 0 + trxparam = strncmp(extra, "trxparam", 8); + setgen = strncmp(extra, "setgen", 6); + getgen = strncmp(extra, "getgen", 6); + testctrl = strncmp(extra, "testctrl", 8); + testbt = strncmp(extra, "testbt", 6); + + if (strncmp(extra, "dlfw", 4) == 0) + { + status = rtl8723a_FirmwareDownload(padapter); + if (status==_SUCCESS) + { + _rtw_memset(extra,'\0', wrqu->data.length); + DBG_88E("%s: download FW %s\n", __func__, (_FAIL==status) ? "FAIL!":"OK."); + sprintf(extra, "download FW %s", (_FAIL==status) ? "FAIL!":"OK."); + wrqu->data.length = strlen(extra) + 1; + } + goto exit; + } + if (testbt==0) + { + BtReq.opCodeVer=1; + BtReq.OpCode=6; + BtReq.paraLength=cnts/2; + goto todo; + } + if (ready==0) + { + BtReq.opCodeVer=1; + BtReq.OpCode=0; + BtReq.paraLength=0; + goto todo; + } + + DBG_88E("%s:after strncmp\n", __func__); + pch = extra; + i = 0; + while ((token = strsep(&pch, ",")) != NULL) + { + if (i > 1) break; + tmp[i] = token; + i++; + } + + if ((tmp[0]==NULL) && (tmp[1]==NULL)) + { + return -EFAULT; + } + else + { + cnts = strlen(tmp[1]); + if (cnts<1) return -EFAULT; + + DBG_88E("%s: cnts=%d\n", __func__, cnts); + DBG_88E("%s: data=%s\n", __func__, tmp[1]); + + for (jj=0, kk=0; jjdata.length); + + mptbt_BtControlProcess(padapter,&BtReq); + + for (i=4; imptOutLen; i++) + { + DBG_88E("0x%x ", pMptCtx->mptOutBuf[i]); + sprintf(extra, "%s 0x%x ", extra, pMptCtx->mptOutBuf[i]); + } + +exit: + wrqu->data.length = strlen(extra) + 1; + +return status; + +} + +#endif //#ifdef CONFIG_RTL8723A + static int rtw_mp_set(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wdata, char *extra) @@ -10644,10 +11002,17 @@ static int rtw_mp_get(struct net_device *dev, DBG_88E("set case efuse set\n"); rtw_mp_efuse_set (dev,info,wdata,extra); break; +#ifdef CONFIG_RTL8723A + case MP_SetBT: + DBG_88E("set MP_SetBT\n"); + rtw_mp_SetBT (dev,info,wdata,extra); + break; +#endif + } rtw_msleep_os(10); //delay 5ms for sending pkt before exit adb shell operation - return 0; +return 0; } #endif //#if defined(CONFIG_MP_INCLUDED) && defined(CONFIG_MP_IWPRIV_SUPPORT) @@ -11337,11 +11702,29 @@ static int rtw_widi_set_probe_request(struct net_device *dev, } #endif // CONFIG_INTEL_WIDI +#ifdef CONFIG_RTL8723A +#include +//extern u8 _InitPowerOn(PADAPTER padapter); +//extern s32 rtl8723a_FirmwareDownload(PADAPTER padapter); +extern s32 FillH2CCmd(PADAPTER padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer); +#endif + #ifdef CONFIG_MAC_LOOPBACK_DRIVER +#ifdef CONFIG_RTL8723A +extern void rtl8723a_cal_txdesc_chksum(struct tx_desc *ptxdesc); +#define cal_txdesc_chksum rtl8723a_cal_txdesc_chksum +extern void rtl8723a_fill_default_txdesc(struct xmit_frame *pxmitframe, u8 *pbuf); +#define fill_default_txdesc rtl8723a_fill_default_txdesc +#elif defined(CONFIG_RTL8188E) #include extern void rtl8188e_cal_txdesc_chksum(struct tx_desc *ptxdesc); #define cal_txdesc_chksum rtl8188e_cal_txdesc_chksum +#ifdef CONFIG_SDIO_HCI +extern void rtl8188es_fill_default_txdesc(struct xmit_frame *pxmitframe, u8 *pbuf); +#define fill_default_txdesc rtl8188es_fill_default_txdesc +#endif // CONFIG_SDIO_HCI +#endif // CONFIG_RTL8188E static s32 initLoopback(PADAPTER padapter) { @@ -11919,6 +12302,88 @@ static int rtw_test( } #endif +#ifdef CONFIG_RTL8723A + +#ifdef CONFIG_BT_COEXIST +#define GET_BT_INFO(padapter) (&GET_HAL_DATA(padapter)->BtInfo) + + if (strcmp(pch, "btdbg") == 0) + { + DBG_88E("===== BT debug information Start =====\n"); + DBG_88E("WIFI status=\n"); + DBG_88E("BT status=\n"); + DBG_88E("BT profile=\n"); + DBG_88E("WIFI RSSI=%d\n", GET_HAL_DATA(padapter)->dmpriv.UndecoratedSmoothedPWDB); + DBG_88E("BT RSSI=\n"); + DBG_88E("coex mechanism=\n"); + DBG_88E("BT counter TX/RX=/\n"); + DBG_88E("0x880=0x%08x\n", rtw_read32(padapter, 0x880)); + DBG_88E("0x6c0=0x%08x\n", rtw_read32(padapter, 0x6c0)); + DBG_88E("0x6c4=0x%08x\n", rtw_read32(padapter, 0x6c4)); + DBG_88E("0x6c8=0x%08x\n", rtw_read32(padapter, 0x6c8)); + DBG_88E("0x6cc=0x%08x\n", rtw_read32(padapter, 0x6cc)); + DBG_88E("0x778=0x%08x\n", rtw_read32(padapter, 0x778)); + DBG_88E("0xc50=0x%08x\n", rtw_read32(padapter, 0xc50)); + BT_DisplayBtCoexInfo(padapter); + DBG_88E("===== BT debug information End =====\n"); + } + + if (strcmp(pch, "bton") == 0) + { + PBT30Info pBTInfo = GET_BT_INFO(padapter); + PBT_MGNT pBtMgnt = &pBTInfo->BtMgnt; + + pBtMgnt->ExtConfig.bManualControl = false; + } + + if (strcmp(pch, "btoff") == 0) + { + PBT30Info pBTInfo = GET_BT_INFO(padapter); + PBT_MGNT pBtMgnt = &pBTInfo->BtMgnt; + + pBtMgnt->ExtConfig.bManualControl = true; + } +#endif // CONFIG_BT_COEXIST + + if (strcmp(pch, "h2c") == 0) + { + u8 param[6]; + u8 count = 0; + u32 tmp; + u8 i; + u32 pos; + s32 ret; + + + do { + pch = strsep(&ptmp, delim); + if ((pch == NULL) || (strlen(pch) == 0)) + break; + + sscanf(pch, "%x", &tmp); + param[count++] = (u8)tmp; + } while (count < 6); + + if (count == 0) { + rtw_mfree(pbuf, len); + DBG_88E("%s: parameter error(level 2)!\n", __func__); + return -EFAULT; + } + + ret = FillH2CCmd(padapter, param[0], count-1, ¶m[1]); + + pos = sprintf(extra, "H2C ID=%x content=", param[0]); + for (i=0; idata.length = strlen(extra) + 1; + } +#endif // CONFIG_RTL8723A + rtw_mfree(pbuf, len); return 0; } @@ -12122,6 +12587,9 @@ static const struct iw_priv_args rtw_private_args[] = { { MP_QueryDrvStats, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_drvquery" }, { MP_IOCTL, IW_PRIV_TYPE_CHAR | 1024, 0, "mp_ioctl"}, // mp_ioctl { MP_SetRFPathSwh, IW_PRIV_TYPE_CHAR | 1024, 0, "mp_setrfpath" }, +#ifdef CONFIG_RTL8723A + { MP_SetBT, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "mp_setbt" }, +#endif { CTA_TEST, IW_PRIV_TYPE_CHAR | 1024, 0, "cta_test"}, }; diff --git a/os_dep/os_intfs.c b/os_dep/os_intfs.c index 4e7b866..4ba41c3 100644 --- a/os_dep/os_intfs.c +++ b/os_dep/os_intfs.c @@ -1593,9 +1593,10 @@ _adapter *rtw_drv_if2_init(_adapter *primary_padapter, char *name, //step init_io_priv if ((rtw_init_io_priv(padapter, set_intf_ops)) == _FAIL) { - RT_TRACE(_module_hci_intfs_c_,_drv_err_,("\n Can't init io_reqs\n")); + RT_TRACE(_module_hci_intfs_c_,_drv_always_,("\n Can't init io_reqs\n")); } + pr_info("rtl8188eu - Driver version "DRIVERVERSION"\n"); //step read_chip_version rtw_hal_read_chip_version(padapter); diff --git a/os_dep/usb_intf.c b/os_dep/usb_intf.c index e9682d4..bd6aa97 100644 --- a/os_dep/usb_intf.c +++ b/os_dep/usb_intf.c @@ -251,12 +251,22 @@ static void rtw_dev_remove(struct usb_interface *pusb_intf); /****** 8188EUS ********/ \ {USB_DEVICE(0x8179, 0x07B8)}, /* Abocom - Abocom */ +#ifndef CONFIG_RTL8192C #undef RTL8192C_USB_IDS #define RTL8192C_USB_IDS +#endif +#ifndef CONFIG_RTL8192D #undef RTL8192D_USB_IDS #define RTL8192D_USB_IDS +#endif +#ifndef CONFIG_RTL8723A #undef RTL8723A_USB_IDS #define RTL8723A_USB_IDS +#endif +#ifndef CONFIG_RTL8188E + #undef RTL8188E_USB_IDS + #define RTL8188E_USB_IDS +#endif static struct usb_device_id rtw_usb_id_tbl[] ={ RTL8192C_USB_IDS @@ -295,6 +305,78 @@ struct rtw_usb_drv { #endif }; +#ifdef CONFIG_RTL8192C +static struct usb_device_id rtl8192c_usb_id_tbl[] ={ + RTL8192C_USB_IDS + {} /* Terminating entry */ +}; + +struct rtw_usb_drv rtl8192c_usb_drv = { + .usbdrv.name = (char*)"rtl8192cu", + .usbdrv.probe = rtw_drv_init, + .usbdrv.disconnect = rtw_dev_remove, + .usbdrv.id_table = rtl8192c_usb_id_tbl, + .usbdrv.suspend = rtw_suspend, + .usbdrv.resume = rtw_resume, + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22)) + .usbdrv.reset_resume = rtw_resume, + #endif + #ifdef CONFIG_AUTOSUSPEND + .usbdrv.supports_autosuspend = 1, + #endif +}; + +static struct rtw_usb_drv *usb_drv = &rtl8192c_usb_drv; +#endif /* CONFIG_RTL8192C */ + +#ifdef CONFIG_RTL8192D +static struct usb_device_id rtl8192d_usb_id_tbl[] ={ + RTL8192D_USB_IDS + {} /* Terminating entry */ +}; + +struct rtw_usb_drv rtl8192d_usb_drv = { + .usbdrv.name = (char*)"rtl8192du", + .usbdrv.probe = rtw_drv_init, + .usbdrv.disconnect = rtw_dev_remove, + .usbdrv.id_table = rtl8192d_usb_id_tbl, + .usbdrv.suspend = rtw_suspend, + .usbdrv.resume = rtw_resume, + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22)) + .usbdrv.reset_resume = rtw_resume, + #endif + #ifdef CONFIG_AUTOSUSPEND + .usbdrv.supports_autosuspend = 1, + #endif +}; +static struct rtw_usb_drv *usb_drv = &rtl8192d_usb_drv; +#endif /* CONFIG_RTL8192D */ + +#ifdef CONFIG_RTL8723A +static struct usb_device_id rtl8723a_usb_id_tbl[] ={ + RTL8723A_USB_IDS + {} /* Terminating entry */ +}; + +struct rtw_usb_drv rtl8723a_usb_drv = { + .usbdrv.name = (char*)"rtl8723au", + .usbdrv.probe = rtw_drv_init, + .usbdrv.disconnect = rtw_dev_remove, + .usbdrv.id_table = rtl8723a_usb_id_tbl, + .usbdrv.suspend = rtw_suspend, + .usbdrv.resume = rtw_resume, + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22)) + .usbdrv.reset_resume = rtw_resume, + #endif + #ifdef CONFIG_AUTOSUSPEND + .usbdrv.supports_autosuspend = 1, + #endif +}; + +static struct rtw_usb_drv *usb_drv = &rtl8723a_usb_drv; +#endif /* CONFIG_RTL8723A */ + +#ifdef CONFIG_RTL8188E static struct usb_device_id rtl8188e_usb_id_tbl[] ={ RTL8188E_USB_IDS {} /* Terminating entry */ @@ -316,6 +398,7 @@ struct rtw_usb_drv rtl8188e_usb_drv = { }; static struct rtw_usb_drv *usb_drv = &rtl8188e_usb_drv; +#endif /* CONFIG_RTL8188E */ static inline int RT_usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd) { @@ -1730,6 +1813,7 @@ static int __init rtw_drv_entry(void) writel(tmp,(volatile unsigned int*)0xb801a608);//write dummy register for 1055 #endif #ifdef CONFIG_PLATFORM_ARM_SUNxI +#ifndef CONFIG_RTL8723A int ret = 0; /* ----------get usb_wifi_usbc_num------------- */ ret = script_parser_fetch("usb_wifi_para", "usb_wifi_usbc_num", (int *)&usb_wifi_host, 64); @@ -1740,6 +1824,7 @@ static int __init rtw_drv_entry(void) } DBG_88E("sw_usb_enable_hcd: usbc_num = %d\n", usb_wifi_host); sw_usb_enable_hcd(usb_wifi_host); +#endif //CONFIG_RTL8723A #endif //CONFIG_PLATFORM_ARM_SUNxI @@ -1783,8 +1868,10 @@ static void __exit rtw_drv_halt(void) _rtw_mutex_free(&usb_drv->setbw_mutex); #endif #ifdef CONFIG_PLATFORM_ARM_SUNxI +#ifndef CONFIG_RTL8723A DBG_88E("sw_usb_disable_hcd: usbc_num = %d\n", usb_wifi_host); sw_usb_disable_hcd(usb_wifi_host); +#endif //ifndef CONFIG_RTL8723A #endif //CONFIG_PLATFORM_ARM_SUNxI DBG_88E("-rtw_drv_halt\n");