Ejemplo n.º 1
0
void rtl8723a_off_rcr_am(struct rtw_adapter *padapter)
{
	rtl8723au_write32(padapter, REG_RCR,
		    rtl8723au_read32(padapter, REG_RCR) & (~RCR_AM));
	DBG_8723A("%s, %d, RCR = %x\n", __func__, __LINE__,
		  rtl8723au_read32(padapter, REG_RCR));
}
Ejemplo n.º 2
0
bool rtl8723a_chk_hi_queue_empty(struct rtw_adapter *padapter)
{
	u32 hgq;

	hgq = rtl8723au_read32(padapter, REG_HGQ_INFORMATION);

	return ((hgq & 0x0000ff00) == 0) ? true : false;
}
Ejemplo n.º 3
0
int ips_leave23a(struct rtw_adapter *padapter)
{
	struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
	struct security_priv *psecuritypriv = &padapter->securitypriv;
	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
	int result = _SUCCESS;
	int keyid;

	down(&pwrpriv->lock);

	if (pwrpriv->rf_pwrstate == rf_off && !pwrpriv->bips_processing) {
		pwrpriv->bips_processing = true;
		pwrpriv->change_rfpwrstate = rf_on;
		pwrpriv->ips_leave23a_cnts++;
		DBG_8723A("==>ips_leave23a cnts:%d\n",
			  pwrpriv->ips_leave23a_cnts);

		result = rtw_ips_pwr_up23a(padapter);
		if (result == _SUCCESS)
			pwrpriv->rf_pwrstate = rf_on;

		DBG_8723A_LEVEL(_drv_always_, "nolinked power save leave\n");

		if (psecuritypriv->dot11PrivacyAlgrthm ==
		    WLAN_CIPHER_SUITE_WEP40 ||
		    psecuritypriv->dot11PrivacyAlgrthm ==
		    WLAN_CIPHER_SUITE_WEP104) {
			DBG_8723A("==>%s, channel(%d), processing(%x)\n",
				  __func__, padapter->mlmeextpriv.cur_channel,
				  pwrpriv->bips_processing);
			set_channel_bwmode23a(padapter,
					      padapter->mlmeextpriv.cur_channel,
					      HAL_PRIME_CHNL_OFFSET_DONT_CARE,
					      HT_CHANNEL_WIDTH_20);
			for (keyid = 0; keyid < 4; keyid++) {
				if (pmlmepriv->key_mask & BIT(keyid)) {
					if (keyid ==
					    psecuritypriv->dot11PrivacyKeyIndex)
						result = rtw_set_key23a(padapter, psecuritypriv, keyid, 1);
					else
						result = rtw_set_key23a(padapter, psecuritypriv, keyid, 0);
				}
			}
		}

		DBG_8723A("==> ips_leave23a.....LED(0x%08x)...\n",
			  rtl8723au_read32(padapter, 0x4c));
		pwrpriv->bips_processing = false;

		pwrpriv->bkeepfwalive = false;
		pwrpriv->bpower_saving = false;
	}

	up(&pwrpriv->lock);

	return result;
}
Ejemplo n.º 4
0
void rtl8723a_check_bssid(struct rtw_adapter *padapter, u8 val)
{
	u32 val32;

	val32 = rtl8723au_read32(padapter, REG_RCR);
	if (val)
		val32 |= RCR_CBSSID_DATA | RCR_CBSSID_BCN;
	else
		val32 &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN);
	rtl8723au_write32(padapter, REG_RCR, val32);
}
Ejemplo n.º 5
0
void rtl8723a_mlme_sitesurvey(struct rtw_adapter *padapter, u8 flag)
{
	if (flag) {	/* under sitesurvey */
		u32 v32;

		/*  config RCR to receive different BSSID & not
		    to receive data frame */
		v32 = rtl8723au_read32(padapter, REG_RCR);
		v32 &= ~(RCR_CBSSID_BCN);
		rtl8723au_write32(padapter, REG_RCR, v32);
		/*  reject all data frame */
		rtl8723au_write16(padapter, REG_RXFLTMAP2, 0);

		/*  disable update TSF */
		SetBcnCtrlReg23a(padapter, DIS_TSF_UDT, 0);
	} else {	/* sitesurvey done */

		struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
		struct mlme_ext_info *pmlmeinfo;
		u32 v32;

		pmlmeinfo = &pmlmeext->mlmext_info;

		if ((is_client_associated_to_ap23a(padapter) == true) ||
		    ((pmlmeinfo->state & 0x03) == MSR_ADHOC) ||
		    ((pmlmeinfo->state & 0x03) == MSR_AP)) {
			/*  enable to rx data frame */
			rtl8723au_write16(padapter, REG_RXFLTMAP2, 0xFFFF);

			/*  enable update TSF */
			SetBcnCtrlReg23a(padapter, 0, DIS_TSF_UDT);
		}

		v32 = rtl8723au_read32(padapter, REG_RCR);
		v32 |= RCR_CBSSID_BCN;
		rtl8723au_write32(padapter, REG_RCR, v32);
	}

	rtl8723a_BT_wifiscan_notify(padapter, flag ? true : false);
}
Ejemplo n.º 6
0
void rtl8723a_fifo_cleanup(struct rtw_adapter *padapter)
{
#define RW_RELEASE_EN		BIT(18)
#define RXDMA_IDLE		BIT(17)

	struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
	u8 trycnt = 100;

	/*  pause tx */
	rtl8723au_write8(padapter, REG_TXPAUSE, 0xff);

	/*  keep sn */
	padapter->xmitpriv.nqos_ssn = rtl8723au_read8(padapter, REG_NQOS_SEQ);

	if (pwrpriv->bkeepfwalive != true) {
		u32 v32;

		/*  RX DMA stop */
		v32 = rtl8723au_read32(padapter, REG_RXPKT_NUM);
		v32 |= RW_RELEASE_EN;
		rtl8723au_write32(padapter, REG_RXPKT_NUM, v32);
		do {
			v32 = rtl8723au_read32(padapter,
					       REG_RXPKT_NUM) & RXDMA_IDLE;
			if (!v32)
				break;
		} while (trycnt--);
		if (trycnt == 0)
			DBG_8723A("Stop RX DMA failed......\n");

		/*  RQPN Load 0 */
		rtl8723au_write16(padapter, REG_RQPN_NPQ, 0);
		rtl8723au_write32(padapter, REG_RQPN, 0x80000000);
		mdelay(10);
	}
}
Ejemplo n.º 7
0
void rtl8723a_sreset_xmit_status_check(struct rtw_adapter *padapter)
{
	struct hal_data_8723a	*pHalData = GET_HAL_DATA(padapter);
	struct sreset_priv *psrtpriv = &pHalData->srestpriv;

	unsigned long current_time;
	struct xmit_priv	*pxmitpriv = &padapter->xmitpriv;
	unsigned int diff_time;
	u32 txdma_status;

	txdma_status = rtl8723au_read32(padapter, REG_TXDMA_STATUS);
	if (txdma_status != 0) {
		DBG_8723A("%s REG_TXDMA_STATUS:0x%08x\n", __func__, txdma_status);
		rtw_sreset_reset(padapter);
	}

	current_time = jiffies;

	if (0 == pxmitpriv->free_xmitbuf_cnt || 0 == pxmitpriv->free_xmit_extbuf_cnt) {

		diff_time = jiffies_to_msecs(jiffies - psrtpriv->last_tx_time);

		if (diff_time > 2000) {
			if (psrtpriv->last_tx_complete_time == 0) {
				psrtpriv->last_tx_complete_time = current_time;
			} else {
				diff_time = jiffies_to_msecs(jiffies - psrtpriv->last_tx_complete_time);
				if (diff_time > 4000) {
					/* padapter->Wifi_Error_Status = WIFI_TX_HANG; */
					DBG_8723A("%s tx hang\n", __func__);
					rtw_sreset_reset(padapter);
				}
			}
		}
	}

	if (psrtpriv->dbg_trigger_point == SRESET_TGP_XMIT_STATUS) {
		psrtpriv->dbg_trigger_point = SRESET_TGP_NULL;
		rtw_sreset_reset(padapter);
		return;
	}
}
Ejemplo n.º 8
0
bool rtl8723a_get_fwlps_rf_on(struct rtw_adapter *padapter)
{
	bool retval;
	u32 valRCR;

	/*  When we halt NIC, we should check if FW LPS is leave. */

	if ((padapter->bSurpriseRemoved == true) ||
	    (padapter->pwrctrlpriv.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. */
		retval = true;
	} else {
		valRCR = rtl8723au_read32(padapter, REG_RCR);
		if (valRCR & 0x00070000)
			retval = false;
		else
			retval = true;
	}

	return retval;
}