1
0
mirror of https://github.com/aircrack-ng/rtl8812au.git synced 2025-01-06 06:06:09 +00:00

Cleanup some code in rtl8814au HAL init

This commit is contained in:
kimocoder 2019-08-24 06:10:41 +02:00
parent 0bb520cbfa
commit 6cde25e625

View File

@ -5381,29 +5381,24 @@ static void hw_var_set_mlme_join(PADAPTER Adapter, u8 variable, u8* val)
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
if(type == 0) // prepare to join if(type == 0) { // prepare to join
{
if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) && if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) &&
check_buddy_fwstate(Adapter, _FW_LINKED)) check_buddy_fwstate(Adapter, _FW_LINKED))
{ {
StopTxBeacon(Adapter); StopTxBeacon(Adapter);
} }
//enable to rx data frame.Accept all data frame //enable to rx data frame.Accept all data frame
//rtw_write32(padapter, REG_RCR, rtw_read32(padapter, REG_RCR)|RCR_ADF); //rtw_write32(padapter, REG_RCR, rtw_read32(padapter, REG_RCR)|RCR_ADF);
rtw_write16(Adapter, REG_RXFLTMAP2,0xFFFF); rtw_write16(Adapter, REG_RXFLTMAP2,0xFFFF);
if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE)) if (check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE)) {
{ rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_BCN);
rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_BCN); } else {
}
else
{
rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_DATA|RCR_CBSSID_BCN); rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_DATA|RCR_CBSSID_BCN);
} }
if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE) if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE) {
{
RetryLimit = (pHalData->CustomerID == RT_CID_CCX) ? 7 : 48; RetryLimit = (pHalData->CustomerID == RT_CID_CCX) ? 7 : 48;
} }
else // Ad-hoc Mode else // Ad-hoc Mode
@ -5411,52 +5406,49 @@ static void hw_var_set_mlme_join(PADAPTER Adapter, u8 variable, u8* val)
RetryLimit = 0x7; RetryLimit = 0x7;
} }
} }
else if(type == 1) //joinbss_event call back when join res < 0 else if (type == 1) { //joinbss_event call back when join res < 0
{ if (check_buddy_mlmeinfo_state(Adapter, _HW_STATE_NOLINK_))
if(check_buddy_mlmeinfo_state(Adapter, _HW_STATE_NOLINK_))
rtw_write16(Adapter, REG_RXFLTMAP2,0x00); rtw_write16(Adapter, REG_RXFLTMAP2,0x00);
if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) && if (check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) &&
check_buddy_fwstate(Adapter, _FW_LINKED)) check_buddy_fwstate(Adapter, _FW_LINKED))
{ {
ResumeTxBeacon(Adapter); ResumeTxBeacon(Adapter);
//reset TSF 1/2 after ResumeTxBeacon //reset TSF 1/2 after ResumeTxBeacon
rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1)|BIT(0)); rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1)|BIT(0));
} }
} }
else if(type == 2) //sta add event call back else if (type == 2) //sta add event call back
{ {
//enable update TSF //enable update TSF
if(Adapter->iface_type == IFACE_PORT1) if (Adapter->iface_type == IFACE_PORT1)
rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(4))); rtw_write8(Adapter, REG_BCN_CTRL_1, rtw_read8(Adapter, REG_BCN_CTRL_1)&(~BIT(4)));
else else
rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(4))); 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)) {
if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE))
{
//fixed beacon issue for 8191su........... //fixed beacon issue for 8191su...........
rtw_write8(Adapter,0x542 ,0x02); rtw_write8(Adapter,0x542 ,0x02);
RetryLimit = 0x7; RetryLimit = 0x7;
} }
if(check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) && if (check_buddy_mlmeinfo_state(Adapter, WIFI_FW_AP_STATE) &&
check_buddy_fwstate(Adapter, _FW_LINKED)) check_buddy_fwstate(Adapter, _FW_LINKED))
{ {
ResumeTxBeacon(Adapter); ResumeTxBeacon(Adapter);
//reset TSF 1/2 after ResumeTxBeacon //reset TSF 1/2 after ResumeTxBeacon
rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1)|BIT(0)); rtw_write8(Adapter, REG_DUAL_TSF_RST, BIT(1)|BIT(0));
} }
} }
rtw_write16(Adapter, REG_RETRY_LIMIT, BIT_SRL(RetryLimit) | BIT_LRL(RetryLimit)); rtw_write16(Adapter, REG_RETRY_LIMIT, BIT_SRL(RetryLimit) | BIT_LRL(RetryLimit));
#endif //CONFIG_CONCURRENT_MODE #endif //CONFIG_CONCURRENT_MODE
} }
@ -5471,7 +5463,7 @@ static void rtw_store_all_sta_hwseq(_adapter *padapter)
struct sta_priv *pstapriv = &padapter->stapriv; struct sta_priv *pstapriv = &padapter->stapriv;
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj); struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj);
/* save each HW sequence of mac id from report fifo */ /* save each HW sequence of mac id from report fifo */
for (index = 0; index < macid_ctl->num && index < NUM_STA; index++) { for (index = 0; index < macid_ctl->num && index < NUM_STA; index++) {
if (rtw_macid_is_used(macid_ctl, index)) { if (rtw_macid_is_used(macid_ctl, index)) {
@ -5482,14 +5474,14 @@ static void rtw_store_all_sta_hwseq(_adapter *padapter)
/* RTW_INFO("mac_id:%d is used, hw_seq[index]=%d\n", index, hw_seq[index]); */ /* RTW_INFO("mac_id:%d is used, hw_seq[index]=%d\n", index, hw_seq[index]); */
} }
} }
_enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL);
for (index = 0; index < NUM_STA; index++) { for (index = 0; index < NUM_STA; index++) {
psta = NULL; psta = NULL;
phead = &(pstapriv->sta_hash[index]); phead = &(pstapriv->sta_hash[index]);
plist = get_next(phead); plist = get_next(phead);
while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) {
psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
plist = get_next(plist); plist = get_next(plist);
@ -5500,7 +5492,7 @@ static void rtw_store_all_sta_hwseq(_adapter *padapter)
} }
_exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
} }
static void rtw_restore_all_sta_hwseq(_adapter *padapter) static void rtw_restore_all_sta_hwseq(_adapter *padapter)
@ -5514,25 +5506,25 @@ static void rtw_restore_all_sta_hwseq(_adapter *padapter)
struct sta_priv *pstapriv = &padapter->stapriv; struct sta_priv *pstapriv = &padapter->stapriv;
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj); struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj);
_enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL);
for (index = 0; index < NUM_STA; index++) { for (index = 0; index < NUM_STA; index++) {
psta = NULL; psta = NULL;
phead = &(pstapriv->sta_hash[index]); phead = &(pstapriv->sta_hash[index]);
plist = get_next(phead); plist = get_next(phead);
while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) { while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) {
psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
plist = get_next(plist); plist = get_next(plist);
hw_seq[psta->cmn.mac_id] = psta->hwseq; hw_seq[psta->cmn.mac_id] = psta->hwseq;
/* RTW_INFO(" psta->cmn.mac_id=%d, psta->hwseq=%d\n", psta->cmn.mac_id, psta->hwseq); */ /* RTW_INFO(" psta->cmn.mac_id=%d, psta->hwseq=%d\n", psta->cmn.mac_id, psta->hwseq); */
} }
} }
_exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
/* restore each HW sequence of mac id to report fifo */ /* restore each HW sequence of mac id to report fifo */
for (index = 0; index < macid_ctl->num && index < NUM_STA; index++) { for (index = 0; index < macid_ctl->num && index < NUM_STA; index++) {
if (rtw_macid_is_used(macid_ctl, index)) { if (rtw_macid_is_used(macid_ctl, index)) {
@ -5543,19 +5535,19 @@ static void rtw_restore_all_sta_hwseq(_adapter *padapter)
/* RTW_INFO("mac_id:%d is used, hw_seq[index]=%d\n", index, hw_seq[index]); */ /* RTW_INFO("mac_id:%d is used, hw_seq[index]=%d\n", index, hw_seq[index]); */
} }
} }
} }
u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval) u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
{ {
PHAL_DATA_TYPE pHalData; PHAL_DATA_TYPE pHalData;
struct dm_struct* podmpriv; struct dm_struct* podmpriv;
u8 ret = _SUCCESS; u8 ret = _SUCCESS;
u8 val8; u8 val8;
u16 val16; u16 val16;
u32 val32; u32 val32;
pHalData = GET_HAL_DATA(padapter); pHalData = GET_HAL_DATA(padapter);
podmpriv = &pHalData->odmpriv; podmpriv = &pHalData->odmpriv;
switch (variable) switch (variable)
@ -5591,13 +5583,10 @@ u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
input_b = BrateCfg; input_b = BrateCfg;
/* apply force and allow mask */ /* apply force and allow mask */
if(pHalData->current_band_type == BAND_ON_2_4G) if(pHalData->current_band_type == BAND_ON_2_4G) {
{
BrateCfg |= rrsr_2g_force_mask; BrateCfg |= rrsr_2g_force_mask;
BrateCfg &= rrsr_2g_allow_mask; BrateCfg &= rrsr_2g_allow_mask;
} } else { // 5G
else // 5G
{
BrateCfg |= rrsr_5g_force_mask; BrateCfg |= rrsr_5g_force_mask;
BrateCfg &= rrsr_5g_allow_mask; BrateCfg &= rrsr_5g_allow_mask;
} }
@ -5641,8 +5630,7 @@ u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
//tsf = pmlmeext->TSFValue - ((u32)pmlmeext->TSFValue % (pmlmeinfo->bcn_interval*1024)) -1024; //us //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 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)) if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) {
{
//pHalData->RegTxPause |= STOP_BCNQ;BIT(6) //pHalData->RegTxPause |= STOP_BCNQ;BIT(6)
//rtw_write8(padapter, REG_TXPAUSE, (rtw_read8(padapter, REG_TXPAUSE)|BIT(6))); //rtw_write8(padapter, REG_TXPAUSE, (rtw_read8(padapter, REG_TXPAUSE)|BIT(6)));
StopTxBeacon(padapter); StopTxBeacon(padapter);
@ -5657,10 +5645,8 @@ u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
//enable related TSF function //enable related TSF function
rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)|BIT(3)); rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)|BIT(3));
if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) {
if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE))
{
//pHalData->RegTxPause &= (~STOP_BCNQ); //pHalData->RegTxPause &= (~STOP_BCNQ);
//rtw_write8(padapter, REG_TXPAUSE, (rtw_read8(padapter, REG_TXPAUSE)&(~BIT(6)))); //rtw_write8(padapter, REG_TXPAUSE, (rtw_read8(padapter, REG_TXPAUSE)&(~BIT(6))));
ResumeTxBeacon(padapter); ResumeTxBeacon(padapter);
@ -5711,18 +5697,14 @@ u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
u8 RetryLimit = RL_VAL_AP; u8 RetryLimit = RL_VAL_AP;
u8 type = *(u8*)pval; u8 type = *(u8*)pval;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
if (type == 0) // prepare to join if (type == 0) { // prepare to join
{
//enable to rx data frame.Accept all data frame //enable to rx data frame.Accept all data frame
rtw_write16(padapter, REG_RXFLTMAP2, 0xFFFF); rtw_write16(padapter, REG_RXFLTMAP2, 0xFFFF);
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE) if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE) {
{
RetryLimit = (pHalData->CustomerID == RT_CID_CCX) ? 7 : 48; RetryLimit = (pHalData->CustomerID == RT_CID_CCX) ? 7 : 48;
} } else { // Ad-hoc Mode
else // Ad-hoc Mode
{
RetryLimit = RL_VAL_AP; RetryLimit = RL_VAL_AP;
} }
} }
@ -5737,8 +5719,7 @@ u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
val8 &= ~BIT(4); val8 &= ~BIT(4);
rtw_write8(padapter, REG_BCN_CTRL, val8); rtw_write8(padapter, REG_BCN_CTRL, val8);
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE)) if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE)) {
{
RetryLimit = RL_VAL_AP; RetryLimit = RL_VAL_AP;
} }
} }
@ -5749,8 +5730,7 @@ u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
#endif // !CONFIG_CONCURRENT_MODE #endif // !CONFIG_CONCURRENT_MODE
#ifdef CONFIG_BT_COEXIST #ifdef CONFIG_BT_COEXIST
if (_TRUE == pHalData->EEPROMBluetoothCoexist) if (_TRUE == pHalData->EEPROMBluetoothCoexist) {
{
switch (*pval) switch (*pval)
{ {
case 0: case 0:
@ -5765,12 +5745,11 @@ u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
// sta add event callback // sta add event callback
// rtw_btcoex_MediaStatusNotify(padapter, RT_MEDIA_CONNECT); // rtw_btcoex_MediaStatusNotify(padapter, RT_MEDIA_CONNECT);
break; break;
} }
} }
#endif #endif
break; break;
case HW_VAR_BEACON_INTERVAL: case HW_VAR_BEACON_INTERVAL:
rtw_write16(padapter, REG_BCN_INTERVAL, *(u16*)pval); rtw_write16(padapter, REG_BCN_INTERVAL, *(u16*)pval);
#ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT #ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
@ -5783,8 +5762,7 @@ u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
pmlmeinfo = &pmlmeext->mlmext_info; pmlmeinfo = &pmlmeext->mlmext_info;
bcn_interval = *((u16*)pval); bcn_interval = *((u16*)pval);
if ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) if ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) {
{
RTW_INFO("%s==> bcn_interval:%d, eraly_int:%d\n", __FUNCTION__, bcn_interval, bcn_interval>>1); RTW_INFO("%s==> bcn_interval:%d, eraly_int:%d\n", __FUNCTION__, bcn_interval, bcn_interval>>1);
rtw_write8(padapter, REG_DRVERLYINT, bcn_interval>>1);// 50ms for sdio rtw_write8(padapter, REG_DRVERLYINT, bcn_interval>>1);// 50ms for sdio
} }
@ -5826,16 +5804,12 @@ u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
u32 ulContent = 0; u32 ulContent = 0;
u32 ulEncAlgo = CAM_AES; u32 ulEncAlgo = CAM_AES;
for (i=0; i<CAM_CONTENT_COUNT; i++) for (i=0; i<CAM_CONTENT_COUNT; i++) {
{
// filled id in CAM config 2 byte // filled id in CAM config 2 byte
if (i == 0) if (i == 0) {
{
ulContent |= (ucIndex & 0x03) | ((u16)(ulEncAlgo)<<2); ulContent |= (ucIndex & 0x03) | ((u16)(ulEncAlgo)<<2);
//ulContent |= CAM_VALID; //ulContent |= CAM_VALID;
} } else {
else
{
ulContent = 0; ulContent = 0;
} }
// polling bit, and No Write enable, and address // polling bit, and No Write enable, and address
@ -5981,7 +5955,7 @@ u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
case HW_VAR_FIFO_CLEARN_UP: case HW_VAR_FIFO_CLEARN_UP:
{ {
struct pwrctrl_priv *pwrpriv; struct pwrctrl_priv *pwrpriv;
u8 trycnt = 100; u8 trycnt = 100;
pwrpriv = adapter_to_pwrctl(padapter); pwrpriv = adapter_to_pwrctl(padapter);
@ -5991,8 +5965,7 @@ u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
// keep sn // keep sn
rtw_store_all_sta_hwseq(padapter); rtw_store_all_sta_hwseq(padapter);
if (pwrpriv->bkeepfwalive != _TRUE) if (pwrpriv->bkeepfwalive != _TRUE) {
{
// RX DMA stop // RX DMA stop
val32 = rtw_read32(padapter, REG_RXPKT_NUM); val32 = rtw_read32(padapter, REG_RXPKT_NUM);
val32 |= RW_RELEASE_EN; val32 |= RW_RELEASE_EN;
@ -6003,8 +5976,7 @@ u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
if (val32) if (val32)
break; break;
} while (--trycnt); } while (--trycnt);
if (trycnt == 0) if (trycnt == 0) {
{
RTW_INFO("[HW_VAR_FIFO_CLEARN_UP] Stop RX DMA failed......\n"); RTW_INFO("[HW_VAR_FIFO_CLEARN_UP] Stop RX DMA failed......\n");
} }
@ -6015,7 +5987,7 @@ u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
} }
} }
break; break;
case HW_VAR_RESTORE_HW_SEQ: case HW_VAR_RESTORE_HW_SEQ:
rtw_restore_all_sta_hwseq(padapter); rtw_restore_all_sta_hwseq(padapter);
break; break;
@ -6095,8 +6067,7 @@ u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
{ {
u32 usNavUpper = *((u32*)pval); u32 usNavUpper = *((u32*)pval);
if (usNavUpper > HAL_NAV_UPPER_UNIT * 0xFF) if (usNavUpper > HAL_NAV_UPPER_UNIT * 0xFF) {
{
RTW_INFO("%s: [HW_VAR_NAV_UPPER] set value(0x%08X us) is larger than (%d * 0xFF)!\n", RTW_INFO("%s: [HW_VAR_NAV_UPPER] set value(0x%08X us) is larger than (%d * 0xFF)!\n",
__FUNCTION__, usNavUpper, HAL_NAV_UPPER_UNIT); __FUNCTION__, usNavUpper, HAL_NAV_UPPER_UNIT);
break; break;
@ -6111,8 +6082,7 @@ u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
case HW_VAR_BCN_VALID: case HW_VAR_BCN_VALID:
#ifdef CONFIG_CONCURRENT_MODE #ifdef CONFIG_CONCURRENT_MODE
if (padapter->iface_type == IFACE_PORT1) if (padapter->iface_type == IFACE_PORT1) {
{
/* BCN_VALID, BIT31 of REG_FIFOPAGE_CTRL_2_8814A, write 1 to clear, Clear by sw */ /* BCN_VALID, BIT31 of REG_FIFOPAGE_CTRL_2_8814A, write 1 to clear, Clear by sw */
val8 = rtw_read8(padapter, REG_FIFOPAGE_CTRL_2_8814A+3); val8 = rtw_read8(padapter, REG_FIFOPAGE_CTRL_2_8814A+3);
val8 |= BIT(7); val8 |= BIT(7);
@ -6131,8 +6101,7 @@ u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
case HW_VAR_DL_BCN_SEL: case HW_VAR_DL_BCN_SEL:
#if 0 /* for MBSSID, so far we don't need this */ #if 0 /* for MBSSID, so far we don't need this */
#ifdef CONFIG_CONCURRENT_MODE #ifdef CONFIG_CONCURRENT_MODE
if (IS_HARDWARE_TYPE_8821(padapter) && padapter->iface_type == IFACE_PORT1) if (IS_HARDWARE_TYPE_8821(padapter) && padapter->iface_type == IFACE_PORT1) {
{
// SW_BCN_SEL - Port1 // SW_BCN_SEL - Port1
val8 = rtw_read8(padapter, REG_AUTO_LLT_8814A); val8 = rtw_read8(padapter, REG_AUTO_LLT_8814A);
val8 |= BIT(2); val8 |= BIT(2);
@ -6166,7 +6135,7 @@ u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
rtw_write8(padapter, REG_SIFS_CTX+1, SIFS_Timer); rtw_write8(padapter, REG_SIFS_CTX+1, SIFS_Timer);
// SIFS for OFDM consecutive tx like CTS data! // SIFS for OFDM consecutive tx like CTS data!
rtw_write8(padapter, REG_SIFS_TRX+1, SIFS_Timer); rtw_write8(padapter, REG_SIFS_TRX+1, SIFS_Timer);
rtw_write8(padapter,REG_SPEC_SIFS+1, SIFS_Timer); rtw_write8(padapter,REG_SPEC_SIFS+1, SIFS_Timer);
rtw_write8(padapter,REG_MAC_SPEC_SIFS+1, SIFS_Timer); rtw_write8(padapter,REG_MAC_SPEC_SIFS+1, SIFS_Timer);
@ -6182,11 +6151,11 @@ u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
R2T_SIFS = 0xa; R2T_SIFS = 0xa;
#ifdef CONFIG_80211AC_VHT #ifdef CONFIG_80211AC_VHT
if (wireless_mode & WIRELESS_11_5AC && if (wireless_mode & WIRELESS_11_5AC &&
//MgntLinkStatusQuery(Adapter) && //MgntLinkStatusQuery(Adapter) &&
TEST_FLAG(pmlmepriv->vhtpriv.ldpc_cap, LDPC_VHT_ENABLE_RX) && TEST_FLAG(pmlmepriv->vhtpriv.ldpc_cap, LDPC_VHT_ENABLE_RX) &&
TEST_FLAG(pmlmepriv->vhtpriv.stbc_cap, STBC_VHT_ENABLE_RX)) TEST_FLAG(pmlmepriv->vhtpriv.stbc_cap, STBC_VHT_ENABLE_RX))
{ {
if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_ATHEROS) if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_ATHEROS)
R2T_SIFS = 0x8; R2T_SIFS = 0x8;
else else
R2T_SIFS = 0xa; R2T_SIFS = 0xa;
@ -6202,10 +6171,8 @@ u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
break; break;
case HW_VAR_DL_RSVD_PAGE: case HW_VAR_DL_RSVD_PAGE:
#ifdef CONFIG_BT_COEXIST #ifdef CONFIG_BT_COEXIST
if (pHalData->EEPROMBluetoothCoexist == 1) if (pHalData->EEPROMBluetoothCoexist == 1) {
{ if (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == _TRUE) {
if (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == _TRUE)
{
rtl8814a_download_BTCoex_AP_mode_rsvd_page(padapter); rtl8814a_download_BTCoex_AP_mode_rsvd_page(padapter);
} }
} }
@ -6216,52 +6183,51 @@ u8 SetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
case HW_VAR_HW_REG_TIMER_INIT: case HW_VAR_HW_REG_TIMER_INIT:
{ {
HAL_HW_TIMER_TYPE TimerType = (*(PHAL_HW_TIMER_TYPE)pval)>>16; HAL_HW_TIMER_TYPE TimerType = (*(PHAL_HW_TIMER_TYPE)pval)>>16;
rtw_write8(padapter, 0x164, 1); rtw_write8(padapter, 0x164, 1);
if (TimerType == HAL_TIMER_TXBF) if (TimerType == HAL_TIMER_TXBF)
rtw_write32(padapter, 0x15C, (*(pu2Byte)pval)); rtw_write32(padapter, 0x15C, (*(pu2Byte)pval));
else if (TimerType == HAL_TIMER_EARLYMODE) else if (TimerType == HAL_TIMER_EARLYMODE)
rtw_write32(padapter, 0x160, 0x05000190); rtw_write32(padapter, 0x160, 0x05000190);
break; break;
} }
case HW_VAR_HW_REG_TIMER_START: case HW_VAR_HW_REG_TIMER_START:
{ {
HAL_HW_TIMER_TYPE TimerType = *(PHAL_HW_TIMER_TYPE)pval; HAL_HW_TIMER_TYPE TimerType = *(PHAL_HW_TIMER_TYPE)pval;
if (TimerType == HAL_TIMER_TXBF) if (TimerType == HAL_TIMER_TXBF)
rtw_write8(padapter, 0x15F, 0x5); rtw_write8(padapter, 0x15F, 0x5);
else if (TimerType == HAL_TIMER_EARLYMODE) else if (TimerType == HAL_TIMER_EARLYMODE)
rtw_write8(padapter, 0x163, 0x5); rtw_write8(padapter, 0x163, 0x5);
break; break;
} }
case HW_VAR_HW_REG_TIMER_RESTART: case HW_VAR_HW_REG_TIMER_RESTART:
{ {
HAL_HW_TIMER_TYPE TimerType = *(PHAL_HW_TIMER_TYPE)pval; HAL_HW_TIMER_TYPE TimerType = *(PHAL_HW_TIMER_TYPE)pval;
if (TimerType == HAL_TIMER_TXBF) { if (TimerType == HAL_TIMER_TXBF) {
rtw_write8(padapter, 0x15F, 0x0); rtw_write8(padapter, 0x15F, 0x0);
rtw_write8(padapter, 0x15F, 0x5); rtw_write8(padapter, 0x15F, 0x5);
} else if (TimerType == HAL_TIMER_EARLYMODE) { } else if (TimerType == HAL_TIMER_EARLYMODE) {
rtw_write8(padapter, 0x163, 0x0); rtw_write8(padapter, 0x163, 0x0);
rtw_write8(padapter, 0x163, 0x5); rtw_write8(padapter, 0x163, 0x5);
} }
break; break;
} }
case HW_VAR_HW_REG_TIMER_STOP: case HW_VAR_HW_REG_TIMER_STOP:
{ {
HAL_HW_TIMER_TYPE TimerType = *(PHAL_HW_TIMER_TYPE)pval; HAL_HW_TIMER_TYPE TimerType = *(PHAL_HW_TIMER_TYPE)pval;
if (TimerType == HAL_TIMER_TXBF) if (TimerType == HAL_TIMER_TXBF)
rtw_write8(padapter, 0x15F, 0); rtw_write8(padapter, 0x15F, 0);
else if (TimerType == HAL_TIMER_EARLYMODE) else if (TimerType == HAL_TIMER_EARLYMODE)
rtw_write8(padapter, 0x163, 0x0); rtw_write8(padapter, 0x163, 0x0);
break; break;
} }
#endif/*#if (BEAMFORMING_SUPPORT == 1) - for PHYDM TxBF*/ #endif/*#if (BEAMFORMING_SUPPORT == 1) - for PHYDM TxBF*/
#endif/*#ifdef CONFIG_BEAMFORMING*/ #endif/*#ifdef CONFIG_BEAMFORMING*/
#ifdef CONFIG_GPIO_WAKEUP #ifdef CONFIG_GPIO_WAKEUP
case HW_SET_GPIO_WL_CTRL: case HW_SET_GPIO_WL_CTRL:
{ {
@ -6366,16 +6332,14 @@ void GetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
pHalData = GET_HAL_DATA(padapter); pHalData = GET_HAL_DATA(padapter);
podmpriv = &pHalData->odmpriv; podmpriv = &pHalData->odmpriv;
switch (variable) switch (variable) {
{
case HW_VAR_TXPAUSE: case HW_VAR_TXPAUSE:
*pval = rtw_read8(padapter, REG_TXPAUSE); *pval = rtw_read8(padapter, REG_TXPAUSE);
break; break;
case HW_VAR_BCN_VALID: case HW_VAR_BCN_VALID:
#ifdef CONFIG_CONCURRENT_MODE #ifdef CONFIG_CONCURRENT_MODE
if (padapter->iface_type == IFACE_PORT1) if (padapter->iface_type == IFACE_PORT1) {
{
/* BCN_VALID, BIT31 of REG_FIFOPAGE_CTRL_2_8814A, write 1 to clear */ /* BCN_VALID, BIT31 of REG_FIFOPAGE_CTRL_2_8814A, write 1 to clear */
val8 = rtw_read8(padapter, REG_FIFOPAGE_CTRL_2_8814A+3); val8 = rtw_read8(padapter, REG_FIFOPAGE_CTRL_2_8814A+3);
*pval = (BIT(7) & val8) ? _TRUE:_FALSE; *pval = (BIT(7) & val8) ? _TRUE:_FALSE;
@ -6391,23 +6355,21 @@ void GetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
case HW_VAR_FWLPS_RF_ON: case HW_VAR_FWLPS_RF_ON:
//When we halt NIC, we should check if FW LPS is leave. //When we halt NIC, we should check if FW LPS is leave.
if(adapter_to_pwrctl(padapter)->rf_pwrstate == rf_off) if (adapter_to_pwrctl(padapter)->rf_pwrstate == rf_off) {
{
// If it is in HW/SW Radio OFF or IPS state, we do not check Fw LPS Leave, // If it is in HW/SW Radio OFF or IPS state, we do not check Fw LPS Leave,
// because Fw is unload. // because Fw is unload.
*pval = _TRUE; *pval = _TRUE;
} } else {
else
{
u32 valRCR; u32 valRCR;
valRCR = rtw_read32(padapter, REG_RCR); valRCR = rtw_read32(padapter, REG_RCR);
valRCR &= 0x00070000; valRCR &= 0x00070000;
if(valRCR) if (valRCR) {
*pval = _FALSE; *pval = _FALSE;
else } else {
*pval = _TRUE; *pval = _TRUE;
}
} }
break; break;
#ifdef CONFIG_ANTENNA_DIVERSITY #ifdef CONFIG_ANTENNA_DIVERSITY
@ -6417,7 +6379,7 @@ void GetHwReg8814A(PADAPTER padapter, u8 variable, u8 *pval)
#endif //CONFIG_ANTENNA_DIVERSITY #endif //CONFIG_ANTENNA_DIVERSITY
case HW_VAR_EFUSE_BYTES: // To get EFUE total used bytes, added by Roger, 2008.12.22. case HW_VAR_EFUSE_BYTES: // To get EFUE total used bytes, added by Roger, 2008.12.22.
*(u16*)pval = pHalData->EfuseUsedBytes; *(u16*)pval = pHalData->EfuseUsedBytes;
break; break;
case HW_VAR_APFM_ON_MAC: case HW_VAR_APFM_ON_MAC:
@ -6449,17 +6411,15 @@ u8 SetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval)
PHAL_DATA_TYPE pHalData; PHAL_DATA_TYPE pHalData;
u8 bResult; u8 bResult;
pHalData = GET_HAL_DATA(padapter); pHalData = GET_HAL_DATA(padapter);
bResult = _SUCCESS; bResult = _SUCCESS;
switch (variable) switch (variable) {
{
case HAL_DEF_EFUSE_BYTES: case HAL_DEF_EFUSE_BYTES:
pHalData->EfuseUsedBytes = *((u16*)pval); pHalData->EfuseUsedBytes = *((u16*)pval);
break; break;
case HAL_DEF_EFUSE_USAGE: case HAL_DEF_EFUSE_USAGE:
pHalData->EfuseUsedPercentage = *((u8*)pval); pHalData->EfuseUsedPercentage = *((u8*)pval);
break; break;
default: default:
bResult = SetHalDefVar(padapter, variable, pval); bResult = SetHalDefVar(padapter, variable, pval);
@ -6470,7 +6430,7 @@ u8 SetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval)
} }
/* /*
* Description: * Description:
* Query setting of specified variable. * Query setting of specified variable.
*/ */
u8 GetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval) u8 GetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval)
@ -6478,13 +6438,10 @@ u8 GetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval)
PHAL_DATA_TYPE pHalData; PHAL_DATA_TYPE pHalData;
u8 bResult; u8 bResult;
pHalData = GET_HAL_DATA(padapter); pHalData = GET_HAL_DATA(padapter);
bResult = _SUCCESS; bResult = _SUCCESS;
switch (variable) switch (variable) {
{
#ifdef CONFIG_ANTENNA_DIVERSITY #ifdef CONFIG_ANTENNA_DIVERSITY
case HAL_DEF_IS_SUPPORT_ANT_DIV: case HAL_DEF_IS_SUPPORT_ANT_DIV:
@ -6542,7 +6499,7 @@ u8 GetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval)
*((PBOOLEAN)pval) = _TRUE; *((PBOOLEAN)pval) = _TRUE;
else else
*((PBOOLEAN)pval) = _FALSE; *((PBOOLEAN)pval) = _FALSE;
break; break;
case HAL_DEF_EXPLICIT_BEAMFORMEE: case HAL_DEF_EXPLICIT_BEAMFORMEE:
*((PBOOLEAN)pval) = _TRUE; *((PBOOLEAN)pval) = _TRUE;
break; break;
@ -6554,8 +6511,8 @@ u8 GetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval)
u32 cmd ; u32 cmd ;
u32 ra_info1, ra_info2; u32 ra_info1, ra_info2;
u32 rate_mask1, rate_mask2; u32 rate_mask1, rate_mask2;
u8 curr_tx_rate,curr_tx_sgi,hight_rate,lowest_rate; u8 curr_tx_rate,curr_tx_sgi,hight_rate,lowest_rate;
RTW_INFO("============ RA status check Mac_id:%d ===================\n", mac_id); RTW_INFO("============ RA status check Mac_id:%d ===================\n", mac_id);
cmd = 0x40000100 |mac_id; cmd = 0x40000100 |mac_id;
@ -6565,7 +6522,7 @@ u8 GetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval)
curr_tx_rate = ra_info1&0x7F; curr_tx_rate = ra_info1&0x7F;
curr_tx_sgi = (ra_info1>>7)&0x01; curr_tx_sgi = (ra_info1>>7)&0x01;
RTW_INFO("[ ra_info1:0x%08x ] =>cur_tx_rate= %s,cur_sgi:%d, PWRSTS = 0x%02x \n", RTW_INFO("[ ra_info1:0x%08x ] =>cur_tx_rate= %s,cur_sgi:%d, PWRSTS = 0x%02x \n",
ra_info1, ra_info1,
HDATA_RATE(curr_tx_rate), HDATA_RATE(curr_tx_rate),
curr_tx_sgi, curr_tx_sgi,
(ra_info1>>8) & 0x07); (ra_info1>>8) & 0x07);
@ -6578,14 +6535,14 @@ u8 GetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval)
rate_mask1 = rtw_read32(padapter,REG_RSVD7_8812); rate_mask1 = rtw_read32(padapter,REG_RSVD7_8812);
rate_mask2 = rtw_read32(padapter,REG_RSVD8_8812); rate_mask2 = rtw_read32(padapter,REG_RSVD8_8812);
hight_rate = ra_info2&0xFF; hight_rate = ra_info2&0xFF;
lowest_rate = (ra_info2>>8) & 0xFF; lowest_rate = (ra_info2>>8) & 0xFF;
RTW_INFO("[ ra_info1:0x%08x ] =>RSSI=%d, BW_setting=0x%02x, DISRA=0x%02x, VHT_EN=0x%02x\n", RTW_INFO("[ ra_info1:0x%08x ] =>RSSI=%d, BW_setting=0x%02x, DISRA=0x%02x, VHT_EN=0x%02x\n",
ra_info1, ra_info1,
ra_info1&0xFF, ra_info1&0xFF,
(ra_info1>>8) & 0xFF, (ra_info1>>8) & 0xFF,
(ra_info1>>16) & 0xFF, (ra_info1>>16) & 0xFF,
(ra_info1>>24) & 0xFF); (ra_info1>>24) & 0xFF);
RTW_INFO("[ ra_info2:0x%08x ] =>hight_rate=%s, lowest_rate=%s, SGI=0x%02x, RateID=%d\n", RTW_INFO("[ ra_info2:0x%08x ] =>hight_rate=%s, lowest_rate=%s, SGI=0x%02x, RateID=%d\n",
ra_info2, ra_info2,
HDATA_RATE(hight_rate), HDATA_RATE(hight_rate),
@ -6604,12 +6561,9 @@ u8 GetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval)
break; break;
case HAL_DEF_TX_PAGE_BOUNDARY: case HAL_DEF_TX_PAGE_BOUNDARY:
if (!padapter->registrypriv.wifi_spec) if (!padapter->registrypriv.wifi_spec) {
{
*(u16*)pval = TX_PAGE_BOUNDARY_8814A; *(u16*)pval = TX_PAGE_BOUNDARY_8814A;
} } else {
else
{
*(u16*)pval = WMM_NORMAL_TX_PAGE_BOUNDARY_8814A; *(u16*)pval = WMM_NORMAL_TX_PAGE_BOUNDARY_8814A;
} }
break; break;
@ -6641,7 +6595,6 @@ u8 GetHalDefVar8814A(PADAPTER padapter, HAL_DEF_VARIABLE variable, void *pval)
return bResult; return bResult;
} }
#ifdef CONFIG_BT_COEXIST #ifdef CONFIG_BT_COEXIST
void rtl8812a_combo_card_WifiOnlyHwInit(PADAPTER pdapter) void rtl8812a_combo_card_WifiOnlyHwInit(PADAPTER pdapter)
{ {
@ -6666,7 +6619,7 @@ void rtl8812a_combo_card_WifiOnlyHwInit(PADAPTER pdapter)
// coex parameters // coex parameters
//pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x3); //pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x778, 0x3);
rtw_write8(pdapter,0x778,0x3); rtw_write8(pdapter,0x778,0x3);
// enable counter statistics // enable counter statistics
//pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc); //pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc);
rtw_write8(pdapter,0x76e,0xc); rtw_write8(pdapter,0x76e,0xc);
@ -6692,7 +6645,6 @@ void rtl8812a_combo_card_WifiOnlyHwInit(PADAPTER pdapter)
rtw_write8(pdapter,0x7, u1Tmp); rtw_write8(pdapter,0x7, u1Tmp);
} }
} }
#endif //CONFIG_BT_COEXIST #endif //CONFIG_BT_COEXIST
@ -6731,7 +6683,6 @@ void rtl8814_set_hal_ops(struct hal_ops *pHalFunc)
pHalFunc->read_rfreg = &PHY_QueryRFReg8814A; pHalFunc->read_rfreg = &PHY_QueryRFReg8814A;
pHalFunc->write_rfreg = &PHY_SetRFReg8814A; pHalFunc->write_rfreg = &PHY_SetRFReg8814A;
// Efuse related function // Efuse related function
pHalFunc->EfusePowerSwitch = &rtl8814_EfusePowerSwitch; pHalFunc->EfusePowerSwitch = &rtl8814_EfusePowerSwitch;
pHalFunc->ReadEFuse = &rtl8814_ReadEFuse; pHalFunc->ReadEFuse = &rtl8814_ReadEFuse;
@ -6765,5 +6716,3 @@ void rtl8814_set_hal_ops(struct hal_ops *pHalFunc)
pHalFunc->fw_dl = &FirmwareDownload8814A; pHalFunc->fw_dl = &FirmwareDownload8814A;
pHalFunc->hal_get_tx_buff_rsvd_page_num = &GetTxBufferRsvdPageNum8814; pHalFunc->hal_get_tx_buff_rsvd_page_num = &GetTxBufferRsvdPageNum8814;
} }