2013-05-19 04:28:07 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
|
|
|
*
|
|
|
|
* 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 _RTL8188E_SRESET_C_
|
|
|
|
|
|
|
|
#include <rtl8188e_sreset.h>
|
|
|
|
#include <rtl8188e_hal.h>
|
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
static void _restore_security_setting(struct adapter *padapter)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
u8 EntryId = 0;
|
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2013-08-09 03:23:49 +00:00
|
|
|
struct sta_priv *pstapriv = &padapter->stapriv;
|
2013-05-19 04:28:07 +00:00
|
|
|
struct sta_info *psta;
|
2013-08-09 03:23:49 +00:00
|
|
|
struct security_priv *psecuritypriv = &(padapter->securitypriv);
|
2013-05-19 04:28:07 +00:00
|
|
|
struct mlme_ext_info *pmlmeinfo = &padapter->mlmeextpriv.mlmext_info;
|
|
|
|
|
2013-08-09 03:23:49 +00:00
|
|
|
(pmlmeinfo->auth_algo == dot11AuthAlgrthm_8021X) ?
|
|
|
|
rtw_write8(padapter, REG_SECCFG, 0xcc) :
|
|
|
|
rtw_write8(padapter, REG_SECCFG, 0xcf);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-08-09 03:23:49 +00:00
|
|
|
if ((padapter->securitypriv.dot11PrivacyAlgrthm == _WEP40_) ||
|
|
|
|
(padapter->securitypriv.dot11PrivacyAlgrthm == _WEP104_)) {
|
|
|
|
for (EntryId = 0; EntryId < 4; EntryId++) {
|
2013-05-19 04:28:07 +00:00
|
|
|
if (EntryId == psecuritypriv->dot11PrivacyKeyIndex)
|
2013-08-09 03:23:49 +00:00
|
|
|
rtw_set_key(padapter, &padapter->securitypriv, EntryId, 1);
|
2013-05-19 04:28:07 +00:00
|
|
|
else
|
2013-08-09 03:23:49 +00:00
|
|
|
rtw_set_key(padapter, &padapter->securitypriv, EntryId, 0);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2013-08-09 03:23:49 +00:00
|
|
|
} else if ((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
|
|
|
|
(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) {
|
2013-05-19 04:28:07 +00:00
|
|
|
psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv));
|
2013-07-10 18:25:07 +00:00
|
|
|
if (psta) {
|
|
|
|
/* pairwise key */
|
2013-05-26 03:02:10 +00:00
|
|
|
rtw_setstakey_cmd(padapter, (unsigned char *)psta, true);
|
2013-07-10 18:25:07 +00:00
|
|
|
/* group key */
|
2013-08-09 03:23:49 +00:00
|
|
|
rtw_set_key(padapter, &padapter->securitypriv, padapter->securitypriv.dot118021XGrpKeyid, 0);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
static void _restore_network_status(struct adapter *padapter)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-22 23:18:19 +00:00
|
|
|
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
|
2013-05-19 04:28:07 +00:00
|
|
|
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
|
|
|
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
2013-08-09 03:23:49 +00:00
|
|
|
struct wlan_bssid_ex *pnetwork = (struct wlan_bssid_ex *)(&(pmlmeinfo->network));
|
2013-05-19 04:28:07 +00:00
|
|
|
unsigned short caps;
|
|
|
|
u8 join_type;
|
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* */
|
|
|
|
/* reset related register of Beacon control */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* set MSR to nolink */
|
2013-05-19 04:28:07 +00:00
|
|
|
Set_MSR(padapter, _HW_STATE_NOLINK_);
|
2013-07-10 18:25:07 +00:00
|
|
|
/* reject all data frame */
|
2013-08-09 03:23:49 +00:00
|
|
|
rtw_write16(padapter, REG_RXFLTMAP2, 0x00);
|
2013-07-10 18:25:07 +00:00
|
|
|
/* reset TSF */
|
2013-05-19 04:28:07 +00:00
|
|
|
rtw_write8(padapter, REG_DUAL_TSF_RST, (BIT(0)|BIT(1)));
|
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* disable update TSF */
|
2013-05-19 04:28:07 +00:00
|
|
|
SetBcnCtrlReg(padapter, BIT(4), 0);
|
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* */
|
2013-05-19 04:28:07 +00:00
|
|
|
rtw_joinbss_reset(padapter);
|
|
|
|
set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
|
|
|
|
|
|
|
|
if (padapter->registrypriv.wifi_spec) {
|
2013-07-10 18:25:07 +00:00
|
|
|
/* for WiFi test, follow WMM test plan spec */
|
2013-05-19 04:28:07 +00:00
|
|
|
rtw_write32(padapter, REG_EDCA_VO_PARAM, 0x002F431C);
|
|
|
|
rtw_write32(padapter, REG_EDCA_VI_PARAM, 0x005E541C);
|
|
|
|
rtw_write32(padapter, REG_EDCA_BE_PARAM, 0x0000A525);
|
|
|
|
rtw_write32(padapter, REG_EDCA_BK_PARAM, 0x0000A549);
|
2013-07-10 18:25:07 +00:00
|
|
|
/* for WiFi test, mixed mode with intel STA under bg mode throughput issue */
|
2013-05-19 04:28:07 +00:00
|
|
|
if (padapter->mlmepriv.htpriv.ht_option == 0)
|
|
|
|
rtw_write32(padapter, REG_EDCA_BE_PARAM, 0x00004320);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
rtw_write32(padapter, REG_EDCA_VO_PARAM, 0x002F3217);
|
|
|
|
rtw_write32(padapter, REG_EDCA_VI_PARAM, 0x005E4317);
|
|
|
|
rtw_write32(padapter, REG_EDCA_BE_PARAM, 0x00105320);
|
|
|
|
rtw_write32(padapter, REG_EDCA_BK_PARAM, 0x0000A444);
|
|
|
|
}
|
|
|
|
|
|
|
|
rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, pmlmeinfo->network.MacAddress);
|
|
|
|
join_type = 0;
|
|
|
|
rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
|
|
|
|
|
|
|
|
Set_MSR(padapter, (pmlmeinfo->state & 0x3));
|
|
|
|
|
|
|
|
mlmeext_joinbss_event_callback(padapter, 1);
|
2013-07-10 18:25:07 +00:00
|
|
|
/* restore Sequence No. */
|
2013-08-09 03:23:49 +00:00
|
|
|
rtw_write8(padapter, 0x4dc, padapter->xmitpriv.nqos_ssn);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
void rtl8188e_silentreset_for_specific_platform(struct adapter *padapter)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
void rtl8188e_sreset_xmit_status_check(struct adapter *padapter)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-22 23:18:19 +00:00
|
|
|
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
|
2013-05-19 04:28:07 +00:00
|
|
|
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
|
|
|
|
|
|
|
|
unsigned long current_time;
|
|
|
|
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
|
|
|
unsigned int diff_time;
|
|
|
|
u32 txdma_status;
|
|
|
|
|
2013-08-09 03:23:49 +00:00
|
|
|
txdma_status = rtw_read32(padapter, REG_TXDMA_STATUS);
|
|
|
|
if (txdma_status != 0x00) {
|
2013-05-25 23:35:42 +00:00
|
|
|
DBG_88E("%s REG_TXDMA_STATUS:0x%08x\n", __func__, txdma_status);
|
2013-08-09 03:23:49 +00:00
|
|
|
rtw_write32(padapter, REG_TXDMA_STATUS, txdma_status);
|
2013-05-19 04:28:07 +00:00
|
|
|
rtl8188e_silentreset_for_specific_platform(padapter);
|
|
|
|
}
|
2013-07-10 18:25:07 +00:00
|
|
|
/* total xmit irp = 4 */
|
2013-05-19 04:28:07 +00:00
|
|
|
current_time = rtw_get_current_time();
|
2013-08-09 03:23:49 +00:00
|
|
|
if (0 == pxmitpriv->free_xmitbuf_cnt) {
|
2013-05-19 04:28:07 +00:00
|
|
|
diff_time = jiffies_to_msecs(current_time - psrtpriv->last_tx_time);
|
|
|
|
|
2013-08-09 03:23:49 +00:00
|
|
|
if (diff_time > 2000) {
|
|
|
|
if (psrtpriv->last_tx_complete_time == 0) {
|
2013-05-19 04:28:07 +00:00
|
|
|
psrtpriv->last_tx_complete_time = current_time;
|
2013-08-09 03:23:49 +00:00
|
|
|
} else {
|
2013-05-19 04:28:07 +00:00
|
|
|
diff_time = jiffies_to_msecs(current_time - psrtpriv->last_tx_complete_time);
|
2013-08-09 03:23:49 +00:00
|
|
|
if (diff_time > 4000) {
|
2013-05-25 23:35:42 +00:00
|
|
|
DBG_88E("%s tx hang\n", __func__);
|
2013-05-19 04:28:07 +00:00
|
|
|
rtl8188e_silentreset_for_specific_platform(padapter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
void rtl8188e_sreset_linked_status_check(struct adapter *padapter)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
u32 rx_dma_status = 0;
|
2013-08-09 03:23:49 +00:00
|
|
|
u8 fw_status = 0;
|
|
|
|
rx_dma_status = rtw_read32(padapter, REG_RXDMA_STATUS);
|
|
|
|
if (rx_dma_status != 0x00) {
|
|
|
|
DBG_88E("%s REG_RXDMA_STATUS:0x%08x\n", __func__, rx_dma_status);
|
|
|
|
rtw_write32(padapter, REG_RXDMA_STATUS, rx_dma_status);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2013-08-09 03:23:49 +00:00
|
|
|
fw_status = rtw_read8(padapter, REG_FMETHR);
|
|
|
|
if (fw_status != 0x00) {
|
2013-05-19 04:28:07 +00:00
|
|
|
if (fw_status == 1)
|
2013-08-09 03:23:49 +00:00
|
|
|
DBG_88E("%s REG_FW_STATUS (0x%02x), Read_Efuse_Fail !!\n", __func__, fw_status);
|
2013-05-19 04:28:07 +00:00
|
|
|
else if (fw_status == 2)
|
2013-08-09 03:23:49 +00:00
|
|
|
DBG_88E("%s REG_FW_STATUS (0x%02x), Condition_No_Match !!\n", __func__, fw_status);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
}
|