diff options
Diffstat (limited to 'drivers/staging/rtl8723au/hal/usb_halinit.c')
-rw-r--r-- | drivers/staging/rtl8723au/hal/usb_halinit.c | 147 |
1 files changed, 53 insertions, 94 deletions
diff --git a/drivers/staging/rtl8723au/hal/usb_halinit.c b/drivers/staging/rtl8723au/hal/usb_halinit.c index adbf1c2dd383..42ae29d26302 100644 --- a/drivers/staging/rtl8723au/hal/usb_halinit.c +++ b/drivers/staging/rtl8723au/hal/usb_halinit.c @@ -447,22 +447,8 @@ static void _InitRetryFunction(struct rtw_adapter *Adapter) static void _InitRFType(struct rtw_adapter *Adapter) { struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); - bool is92CU = IS_92C_SERIAL(pHalData->VersionID); - pHalData->rf_chip = RF_6052; - - if (!is92CU) { - pHalData->rf_type = RF_1T1R; - DBG_8723A("Set RF Chip ID to RF_6052 and RF type to 1T1R.\n"); - return; - } - - /* TODO: Consider that EEPROM set 92CU to 1T1R later. */ - /* Force to overwrite setting according to chip version. Ignore - EEPROM setting. */ - /* pHalData->RF_Type = is92CU ? RF_2T2R : RF_1T1R; */ - MSG_8723A("Set RF Chip ID to RF_6052 and RF type to %d.\n", - pHalData->rf_type); + pHalData->rf_type = RF_1T1R; } /* Set CCK and OFDM Block "ON" */ @@ -530,7 +516,7 @@ int rtl8723au_hal_init(struct rtw_adapter *Adapter) /* Check if MAC has already power on. by tynli. 2011.05.27. */ val8 = rtl8723au_read8(Adapter, REG_CR); RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("%s: REG_CR 0x100 = 0x%02x\n", __func__, val8)); + "%s: REG_CR 0x100 = 0x%02x\n", __func__, val8); /* Fix 92DU-VC S3 hang with the reason is that secondary mac is not initialized. */ /* 0x100 value of first mac is 0xEA while 0x100 value of secondary @@ -540,13 +526,13 @@ int rtl8723au_hal_init(struct rtw_adapter *Adapter) } else { mac_on = true; RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("%s: MAC has already power on\n", __func__)); + "%s: MAC has already power on\n", __func__); } status = _InitPowerOn(Adapter); if (status == _FAIL) { RT_TRACE(_module_hci_hal_init_c_, _drv_err_, - ("Failed to init power on!\n")); + "Failed to init power on!\n"); goto exit; } @@ -561,7 +547,7 @@ int rtl8723au_hal_init(struct rtw_adapter *Adapter) status = InitLLTTable23a(Adapter, boundary); if (status == _FAIL) { RT_TRACE(_module_hci_hal_init_c_, _drv_err_, - ("Failed to init LLT table\n")); + "Failed to init LLT table\n"); goto exit; } } @@ -572,12 +558,10 @@ int rtl8723au_hal_init(struct rtw_adapter *Adapter) status = rtl8723a_FirmwareDownload(Adapter); if (status != _SUCCESS) { Adapter->bFWReady = false; - pHalData->fw_ractrl = false; DBG_8723A("fw download fail!\n"); goto exit; } else { Adapter->bFWReady = true; - pHalData->fw_ractrl = true; DBG_8723A("fw download ok!\n"); } @@ -625,17 +609,22 @@ int rtl8723au_hal_init(struct rtw_adapter *Adapter) } /* reducing 80M spur */ - PHY_SetBBReg(Adapter, REG_AFE_XTAL_CTRL, bMaskDWord, 0x0381808d); - PHY_SetBBReg(Adapter, REG_AFE_PLL_CTRL, bMaskDWord, 0xf0ffff83); - PHY_SetBBReg(Adapter, REG_AFE_PLL_CTRL, bMaskDWord, 0xf0ffff82); - PHY_SetBBReg(Adapter, REG_AFE_PLL_CTRL, bMaskDWord, 0xf0ffff83); + rtl8723au_write32(Adapter, REG_AFE_XTAL_CTRL, 0x0381808d); + rtl8723au_write32(Adapter, REG_AFE_PLL_CTRL, 0xf0ffff83); + rtl8723au_write32(Adapter, REG_AFE_PLL_CTRL, 0xf0ffff82); + rtl8723au_write32(Adapter, REG_AFE_PLL_CTRL, 0xf0ffff83); /* RFSW Control */ - PHY_SetBBReg(Adapter, rFPGA0_TxInfo, bMaskDWord, 0x00000003); /* 0x804[14]= 0 */ - PHY_SetBBReg(Adapter, rFPGA0_XAB_RFInterfaceSW, bMaskDWord, 0x07000760); /* 0x870[6:5]= b'11 */ - PHY_SetBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, bMaskDWord, 0x66F60210); /* 0x860[6:5]= b'00 */ + /* 0x804[14]= 0 */ + rtl8723au_write32(Adapter, rFPGA0_TxInfo, 0x00000003); + /* 0x870[6:5]= b'11 */ + rtl8723au_write32(Adapter, rFPGA0_XAB_RFInterfaceSW, 0x07000760); + /* 0x860[6:5]= b'00 */ + rtl8723au_write32(Adapter, rFPGA0_XA_RFInterfaceOE, 0x66F60210); - RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("%s: 0x870 = value 0x%x\n", __func__, PHY_QueryBBReg(Adapter, 0x870, bMaskDWord))); + RT_TRACE(_module_hci_hal_init_c_, _drv_info_, + "%s: 0x870 = value 0x%x\n", __func__, + rtl8723au_read32(Adapter, 0x870)); /* */ /* Joseph Note: Keep RfRegChnlVal for later use. */ @@ -747,15 +736,16 @@ int rtl8723au_hal_init(struct rtw_adapter *Adapter) rtl8723a_InitHalDm(Adapter); - val8 = ((WiFiNavUpperUs + HAL_8723A_NAV_UPPER_UNIT - 1) / - HAL_8723A_NAV_UPPER_UNIT); + val8 = (WiFiNavUpperUs + HAL_8723A_NAV_UPPER_UNIT - 1) / + HAL_8723A_NAV_UPPER_UNIT; rtl8723au_write8(Adapter, REG_NAV_UPPER, val8); /* 2011/03/09 MH debug only, UMC-B cut pass 2500 S5 test, but we need to fin root cause. */ if (((rtl8723au_read32(Adapter, rFPGA0_RFMOD) & 0xFF000000) != 0x83000000)) { PHY_SetBBReg(Adapter, rFPGA0_RFMOD, BIT(24), 1); - RT_TRACE(_module_hci_hal_init_c_, _drv_err_, ("%s: IQK fail recorver\n", __func__)); + RT_TRACE(_module_hci_hal_init_c_, _drv_err_, + "%s: IQK fail recover\n", __func__); } /* ack for xmit mgmt frames. */ @@ -806,19 +796,18 @@ static void phy_SsPwrSwitch92CU(struct rtw_adapter *Adapter, /* AFE */ if (pHalData->rf_type == RF_2T2R) - PHY_SetBBReg(Adapter, rRx_Wait_CCA, bMaskDWord, - 0x63DB25A0); + rtl8723au_write32(Adapter, rRx_Wait_CCA, 0x63DB25A0); else if (pHalData->rf_type == RF_1T1R) - PHY_SetBBReg(Adapter, rRx_Wait_CCA, bMaskDWord, - 0x631B25A0); + rtl8723au_write32(Adapter, rRx_Wait_CCA, 0x631B25A0); /* 4. issue 3-wire command that RF set to Rx idle mode. This is used to re-write the RX idle mode. */ /* We can only prvide a usual value instead and then HW will modify the value by itself. */ - PHY_SetRFReg(Adapter, RF_PATH_A, 0, bRFRegOffsetMask, 0x32D95); + PHY_SetRFReg(Adapter, RF_PATH_A, RF_AC, + bRFRegOffsetMask, 0x32D95); if (pHalData->rf_type == RF_2T2R) { - PHY_SetRFReg(Adapter, RF_PATH_B, 0, + PHY_SetRFReg(Adapter, RF_PATH_B, RF_AC, bRFRegOffsetMask, 0x32D95); } break; @@ -829,7 +818,7 @@ static void phy_SsPwrSwitch92CU(struct rtw_adapter *Adapter, else sps0 &= ~(BIT(0) | BIT(3)); - RT_TRACE(_module_hal_init_c_, _drv_err_, ("SS LVL1\n")); + RT_TRACE(_module_hal_init_c_, _drv_err_, "SS LVL1\n"); /* Disable RF and BB only for SelectSuspend. */ /* 1. Set BB/RF to shutdown. */ @@ -840,13 +829,11 @@ static void phy_SsPwrSwitch92CU(struct rtw_adapter *Adapter, for packet detection */ /* (4) Reg800[1] = 1 enable preamble power saving */ Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_RF0] = - PHY_QueryBBReg(Adapter, rFPGA0_XAB_RFParameter, - bMaskDWord); + rtl8723au_read32(Adapter, rFPGA0_XAB_RFParameter); Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_RF1] = - PHY_QueryBBReg(Adapter, rOFDM0_TRxPathEnable, - bMaskDWord); + rtl8723au_read32(Adapter, rOFDM0_TRxPathEnable); Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_RF2] = - PHY_QueryBBReg(Adapter, rFPGA0_RFMOD, bMaskDWord); + rtl8723au_read32(Adapter, rFPGA0_RFMOD); if (pHalData->rf_type == RF_2T2R) { PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, 0x380038, 0); @@ -858,18 +845,16 @@ static void phy_SsPwrSwitch92CU(struct rtw_adapter *Adapter, /* 2 .AFE control register to power down. bit[30:22] */ Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_AFE0] = - PHY_QueryBBReg(Adapter, rRx_Wait_CCA, bMaskDWord); + rtl8723au_read32(Adapter, rRx_Wait_CCA); if (pHalData->rf_type == RF_2T2R) - PHY_SetBBReg(Adapter, rRx_Wait_CCA, bMaskDWord, - 0x00DB25A0); + rtl8723au_write32(Adapter, rRx_Wait_CCA, 0x00DB25A0); else if (pHalData->rf_type == RF_1T1R) - PHY_SetBBReg(Adapter, rRx_Wait_CCA, bMaskDWord, - 0x001B25A0); + rtl8723au_write32(Adapter, rRx_Wait_CCA, 0x001B25A0); /* 3. issue 3-wire command that RF set to power down.*/ - PHY_SetRFReg(Adapter, RF_PATH_A, 0, bRFRegOffsetMask, 0); + PHY_SetRFReg(Adapter, RF_PATH_A, RF_AC, bRFRegOffsetMask, 0); if (pHalData->rf_type == RF_2T2R) - PHY_SetRFReg(Adapter, RF_PATH_B, 0, + PHY_SetRFReg(Adapter, RF_PATH_B, RF_AC, bRFRegOffsetMask, 0); /* 4. Force PFM , disable SPS18_LDO_Marco_Block */ @@ -949,14 +934,14 @@ int rtl8723au_inirp_init(struct rtw_adapter *Adapter) status = _SUCCESS; - RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("===> usb_inirp_init\n")); + RT_TRACE(_module_hci_hal_init_c_, _drv_info_, "===> usb_inirp_init\n"); /* issue Rx irp to receive data */ precvbuf = (struct recv_buf *)precvpriv->precv_buf; for (i = 0; i < NR_RECVBUFF; i++) { if (rtl8723au_read_port(Adapter, 0, precvbuf) == _FAIL) { RT_TRACE(_module_hci_hal_init_c_, _drv_err_, - ("usb_rx_init: usb_read_port error\n")); + "usb_rx_init: usb_read_port error\n"); status = _FAIL; goto exit; } @@ -964,7 +949,7 @@ int rtl8723au_inirp_init(struct rtw_adapter *Adapter) } if (rtl8723au_read_interrupt(Adapter) == _FAIL) { RT_TRACE(_module_hci_hal_init_c_, _drv_err_, - ("%s: usb_read_interrupt error\n", __func__)); + "%s: usb_read_interrupt error\n", __func__); status = _FAIL; } pHalData->IntrMask[0] = rtl8723au_read32(Adapter, REG_USB_HIMR); @@ -973,7 +958,7 @@ int rtl8723au_inirp_init(struct rtw_adapter *Adapter) rtl8723au_write32(Adapter, REG_USB_HIMR, pHalData->IntrMask[0]); exit: RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("<=== usb_inirp_init\n")); + "<=== usb_inirp_init\n"); return status; } @@ -982,7 +967,7 @@ int rtl8723au_inirp_deinit(struct rtw_adapter *Adapter) struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("\n ===> usb_rx_deinit\n")); + "===> usb_rx_deinit\n"); rtl8723au_read_port_cancel(Adapter); pHalData->IntrMask[0] = rtl8723au_read32(Adapter, REG_USB_HIMR); MSG_8723A("%s pHalData->IntrMask = 0x%04x\n", __func__, @@ -990,7 +975,7 @@ int rtl8723au_inirp_deinit(struct rtw_adapter *Adapter) pHalData->IntrMask[0] = 0x0; rtl8723au_write32(Adapter, REG_USB_HIMR, pHalData->IntrMask[0]); RT_TRACE(_module_hci_hal_init_c_, _drv_info_, - ("\n <=== usb_rx_deinit\n")); + "<=== usb_rx_deinit\n"); return _SUCCESS; } @@ -1037,11 +1022,10 @@ static void Hal_EfuseParseMACAddr_8723AU(struct rtw_adapter *padapter, } RT_TRACE(_module_hci_hal_init_c_, _drv_notice_, - ("Hal_EfuseParseMACAddr_8723AU: Permanent Address =%02x:%02x:" - "%02x:%02x:%02x:%02x\n", - pEEPROM->mac_addr[0], pEEPROM->mac_addr[1], - pEEPROM->mac_addr[2], pEEPROM->mac_addr[3], - pEEPROM->mac_addr[4], pEEPROM->mac_addr[5])); + "Hal_EfuseParseMACAddr_8723AU: Permanent Address =%02x:%02x:%02x:%02x:%02x:%02x\n", + pEEPROM->mac_addr[0], pEEPROM->mac_addr[1], + pEEPROM->mac_addr[2], pEEPROM->mac_addr[3], + pEEPROM->mac_addr[4], pEEPROM->mac_addr[5]); } static void readAdapterInfo(struct rtw_adapter *padapter) @@ -1102,13 +1086,6 @@ static void _ReadPROMContent(struct rtw_adapter *Adapter) readAdapterInfo(Adapter); } -static void _ReadRFType(struct rtw_adapter *Adapter) -{ - struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); - - pHalData->rf_chip = RF_6052; -} - /* */ /* Description: */ /* We should set Efuse cell selection to WiFi cell in default. */ @@ -1138,12 +1115,8 @@ void rtl8723a_read_adapter_info(struct rtw_adapter *Adapter) hal_EfuseCellSel(Adapter); - _ReadRFType(Adapter);/* rf_chip -> _InitRFType() */ _ReadPROMContent(Adapter); - /* MSG_8723A("%s()(done), rf_chip = 0x%x, rf_type = 0x%x\n", - __func__, pHalData->rf_chip, pHalData->rf_type); */ - MSG_8723A("<==== _ReadAdapterInfo8723AU in %d ms\n", jiffies_to_msecs(jiffies - start)); } @@ -1192,8 +1165,6 @@ int GetHalDefVar8192CUsb(struct rtw_adapter *Adapter, } break; default: - /* RT_TRACE(COMP_INIT, DBG_WARNING, ("GetHalDefVar8192CUsb(): " - "Unkown variable: %d!\n", eVariable)); */ bResult = _FAIL; break; } @@ -1211,7 +1182,7 @@ void rtl8723a_update_ramask(struct rtw_adapter *padapter, struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct wlan_bssid_ex *cur_network = &pmlmeinfo->network; - u8 init_rate, networkType, raid; + u8 init_rate, networkType, raid, arg; u32 mask, rate_bitmap; u8 shortGIrate = false; int supportRateNum; @@ -1283,27 +1254,15 @@ void rtl8723a_update_ramask(struct rtw_adapter *padapter, init_rate = get_highest_rate_idx23a(mask) & 0x3f; - if (pHalData->fw_ractrl == true) { - u8 arg = 0; - - arg = mac_id & 0x1f;/* MACID */ + arg = mac_id & 0x1f;/* MACID */ + arg |= BIT(7); - arg |= BIT(7); + if (shortGIrate == true) + arg |= BIT(5); - if (shortGIrate == true) - arg |= BIT(5); + DBG_8723A("update raid entry, mask = 0x%x, arg = 0x%x\n", mask, arg); - DBG_8723A("update raid entry, mask = 0x%x, arg = 0x%x\n", - mask, arg); - - rtl8723a_set_raid_cmd(padapter, mask, arg); - } else { - if (shortGIrate == true) - init_rate |= BIT(6); - - rtl8723au_write8(padapter, (REG_INIDATA_RATE_SEL + mac_id), - init_rate); - } + rtl8723a_set_raid_cmd(padapter, mask, arg); /* set ra_id */ psta->raid = raid; |