2013-05-08 21:45:39 +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 _HAL_INIT_C_
|
|
|
|
|
2013-10-19 21:23:12 +00:00
|
|
|
#include <linux/firmware.h>
|
2014-11-16 00:18:30 +00:00
|
|
|
#include <linux/vmalloc.h>
|
2013-05-08 21:45:39 +00:00
|
|
|
#include <drv_types.h>
|
|
|
|
#include <rtw_efuse.h>
|
2014-11-16 00:18:30 +00:00
|
|
|
#include <phy.h>
|
|
|
|
#include <rtl8188e_hal.h>
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
#include <rtw_iol.h>
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
void iol_mode_enable(struct adapter *padapter, u8 enable)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-11-16 00:18:30 +00:00
|
|
|
u8 reg_0xf0 = 0;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
if (enable) {
|
|
|
|
/* Enable initial offload */
|
|
|
|
reg_0xf0 = usb_read8(padapter, REG_SYS_CFG);
|
|
|
|
usb_write8(padapter, REG_SYS_CFG, reg_0xf0|SW_OFFLOAD_EN);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
if (!padapter->bFWReady) {
|
|
|
|
DBG_88E("bFWReady == false call reset 8051...\n");
|
|
|
|
_8051Reset88E(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
} else {
|
2014-11-16 00:18:30 +00:00
|
|
|
/* disable initial offload */
|
|
|
|
reg_0xf0 = usb_read8(padapter, REG_SYS_CFG);
|
|
|
|
usb_write8(padapter, REG_SYS_CFG, reg_0xf0 & ~SW_OFFLOAD_EN);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
s32 iol_execute(struct adapter *padapter, u8 control)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-11-16 00:18:30 +00:00
|
|
|
s32 status = _FAIL;
|
|
|
|
u8 reg_0x88 = 0;
|
|
|
|
u32 start = 0, passing_time = 0;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
control = control&0x0f;
|
|
|
|
reg_0x88 = usb_read8(padapter, REG_HMEBOX_E0);
|
|
|
|
usb_write8(padapter, REG_HMEBOX_E0, reg_0x88|control);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
start = jiffies;
|
|
|
|
while ((reg_0x88 = usb_read8(padapter, REG_HMEBOX_E0)) & control &&
|
|
|
|
(passing_time = rtw_get_passing_time_ms(start)) < 1000) {
|
|
|
|
;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
reg_0x88 = usb_read8(padapter, REG_HMEBOX_E0);
|
|
|
|
status = (reg_0x88 & control) ? _FAIL : _SUCCESS;
|
|
|
|
if (reg_0x88 & control<<4)
|
|
|
|
status = _FAIL;
|
|
|
|
return status;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
static s32 iol_InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-11-16 00:18:30 +00:00
|
|
|
s32 rst = _SUCCESS;
|
|
|
|
iol_mode_enable(padapter, 1);
|
|
|
|
usb_write8(padapter, REG_TDECTRL+1, txpktbuf_bndy);
|
|
|
|
rst = iol_execute(padapter, CMD_INIT_LLT);
|
|
|
|
iol_mode_enable(padapter, 0);
|
|
|
|
return rst;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
s32 rtl8188e_iol_efuse_patch(struct adapter *padapter)
|
2013-08-08 05:41:21 +00:00
|
|
|
{
|
2014-11-16 00:18:30 +00:00
|
|
|
s32 result = _SUCCESS;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
DBG_88E("==> %s\n", __func__);
|
|
|
|
if (rtw_IOL_applied(padapter)) {
|
|
|
|
iol_mode_enable(padapter, 1);
|
|
|
|
result = iol_execute(padapter, CMD_READ_EFUSE_MAP);
|
|
|
|
if (result == _SUCCESS)
|
|
|
|
result = iol_execute(padapter, CMD_EFUSE_PATCH);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
iol_mode_enable(padapter, 0);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-11-16 00:18:30 +00:00
|
|
|
return result;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
#define MAX_REG_BOLCK_SIZE 196
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
void _8051Reset88E(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-11-16 00:18:30 +00:00
|
|
|
u8 u1bTmp;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
u1bTmp = usb_read8(padapter, REG_SYS_FUNC_EN+1);
|
|
|
|
usb_write8(padapter, REG_SYS_FUNC_EN+1, u1bTmp&(~BIT2));
|
|
|
|
usb_write8(padapter, REG_SYS_FUNC_EN+1, u1bTmp|(BIT2));
|
|
|
|
DBG_88E("=====> _8051Reset88E(): 8051 reset success .\n");
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
void rtl8188e_InitializeFirmwareVars(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-11-16 00:18:30 +00:00
|
|
|
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
/* Init Fw LPS related. */
|
|
|
|
padapter->pwrctrlpriv.bFwCurrentInPSMode = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
/* Init H2C counter. by tynli. 2009.12.09. */
|
|
|
|
pHalData->LastHMEBoxNum = 0;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
static void rtl8188e_free_hal_data(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-11-16 00:18:30 +00:00
|
|
|
kfree(padapter->HalData);
|
|
|
|
padapter->HalData = NULL;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
static struct HAL_VERSION ReadChipVersion8188E(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
u32 value32;
|
2013-07-22 22:43:38 +00:00
|
|
|
struct HAL_VERSION ChipVersion;
|
2013-07-22 23:18:19 +00:00
|
|
|
struct hal_data_8188e *pHalData;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
pHalData = GET_HAL_DATA(padapter);
|
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
value32 = usb_read32(padapter, REG_SYS_CFG);
|
2013-05-26 17:17:22 +00:00
|
|
|
ChipVersion.ICType = CHIP_8188E;
|
2013-05-08 21:45:39 +00:00
|
|
|
ChipVersion.ChipType = ((value32 & RTL_ID) ? TEST_CHIP : NORMAL_CHIP);
|
|
|
|
|
|
|
|
ChipVersion.RFType = RF_TYPE_1T1R;
|
|
|
|
ChipVersion.VendorType = ((value32 & VENDOR_ID) ? CHIP_VENDOR_UMC : CHIP_VENDOR_TSMC);
|
2013-07-10 18:25:07 +00:00
|
|
|
ChipVersion.CUTVersion = (value32 & CHIP_VER_RTL_MASK)>>CHIP_VER_RTL_SHIFT; /* IC version (CUT) */
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* For regulator mode. by tynli. 2011.01.14 */
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->RegulatorMode = ((value32 & TRP_BT_EN) ? RT_LDO_REGULATOR : RT_SWITCHING_REGULATOR);
|
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
ChipVersion.ROMVer = 0; /* ROM code version. */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
dump_chip_info(ChipVersion);
|
|
|
|
|
|
|
|
pHalData->VersionID = ChipVersion;
|
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
if (IS_1T2R(ChipVersion)) {
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->rf_type = RF_1T2R;
|
|
|
|
pHalData->NumTotalRFPath = 2;
|
2013-08-08 05:41:21 +00:00
|
|
|
} else if (IS_2T2R(ChipVersion)) {
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->rf_type = RF_2T2R;
|
|
|
|
pHalData->NumTotalRFPath = 2;
|
2013-05-26 17:17:22 +00:00
|
|
|
} else{
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->rf_type = RF_1T1R;
|
|
|
|
pHalData->NumTotalRFPath = 1;
|
|
|
|
}
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-25 23:35:42 +00:00
|
|
|
MSG_88E("RF_Type is %x!!\n", pHalData->rf_type);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return ChipVersion;
|
|
|
|
}
|
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
static void rtl8188e_read_chip_version(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-05-19 04:28:07 +00:00
|
|
|
ReadChipVersion8188E(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2013-05-26 17:17:22 +00:00
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
static void rtl8188e_SetHalODMVar(struct adapter *Adapter, enum hal_odm_variable eVariable, void *pValue1, bool bSet)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-07-22 23:18:19 +00:00
|
|
|
struct hal_data_8188e *pHalData = GET_HAL_DATA(Adapter);
|
2013-07-26 16:20:42 +00:00
|
|
|
struct odm_dm_struct *podmpriv = &pHalData->odmpriv;
|
2013-08-08 05:41:21 +00:00
|
|
|
switch (eVariable) {
|
|
|
|
case HAL_ODM_STA_INFO:
|
|
|
|
{
|
2014-11-28 17:08:37 +00:00
|
|
|
struct sta_info *psta = (struct sta_info *)pValue1;
|
2013-08-08 05:41:21 +00:00
|
|
|
if (bSet) {
|
|
|
|
DBG_88E("### Set STA_(%d) info\n", psta->mac_id);
|
|
|
|
ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, psta);
|
|
|
|
ODM_RAInfo_Init(podmpriv, psta->mac_id);
|
|
|
|
} else {
|
|
|
|
DBG_88E("### Clean STA_(%d) info\n", psta->mac_id);
|
|
|
|
ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HAL_ODM_P2P_STATE:
|
|
|
|
ODM_CmnInfoUpdate(podmpriv, ODM_CMNINFO_WIFI_DIRECT, bSet);
|
|
|
|
break;
|
|
|
|
case HAL_ODM_WIFI_DISPLAY_STATE:
|
|
|
|
ODM_CmnInfoUpdate(podmpriv, ODM_CMNINFO_WIFI_DISPLAY, bSet);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
static void hal_notch_filter_8188e(struct adapter *adapter, bool enable)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
if (enable) {
|
2013-05-25 23:35:42 +00:00
|
|
|
DBG_88E("Enable notch filter\n");
|
2014-11-16 00:18:30 +00:00
|
|
|
usb_write8(adapter, rOFDM0_RxDSP+1, usb_read8(adapter, rOFDM0_RxDSP+1) | BIT1);
|
2013-05-08 21:45:39 +00:00
|
|
|
} else {
|
2013-05-25 23:35:42 +00:00
|
|
|
DBG_88E("Disable notch filter\n");
|
2014-11-16 00:18:30 +00:00
|
|
|
usb_write8(adapter, rOFDM0_RxDSP+1, usb_read8(adapter, rOFDM0_RxDSP+1) & ~BIT1);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
void rtl8188e_set_hal_ops(struct hal_ops *pHalFunc)
|
|
|
|
{
|
|
|
|
pHalFunc->free_hal_data = &rtl8188e_free_hal_data;
|
|
|
|
|
|
|
|
pHalFunc->dm_init = &rtl8188e_init_dm_priv;
|
|
|
|
|
|
|
|
pHalFunc->read_chip_version = &rtl8188e_read_chip_version;
|
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
pHalFunc->set_bwmode_handler = &phy_set_bw_mode;
|
|
|
|
pHalFunc->set_channel_handler = &phy_sw_chnl;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
pHalFunc->hal_dm_watchdog = &rtl8188e_HalDmWatchDog;
|
|
|
|
|
|
|
|
pHalFunc->Add_RateATid = &rtl8188e_Add_RateATid;
|
|
|
|
|
|
|
|
pHalFunc->AntDivBeforeLinkHandler = &AntDivBeforeLink8188E;
|
|
|
|
pHalFunc->AntDivCompareHandler = &AntDivCompare8188E;
|
2014-11-16 00:18:30 +00:00
|
|
|
pHalFunc->read_rfreg = &phy_query_rf_reg;
|
|
|
|
pHalFunc->write_rfreg = &phy_set_rf_reg;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
pHalFunc->sreset_init_value = &sreset_init_value;
|
|
|
|
pHalFunc->sreset_get_wifi_status = &sreset_get_wifi_status;
|
|
|
|
|
|
|
|
pHalFunc->SetHalODMVarHandler = &rtl8188e_SetHalODMVar;
|
|
|
|
|
|
|
|
pHalFunc->hal_notch_filter = &hal_notch_filter_8188e;
|
|
|
|
}
|
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
u8 GetEEPROMSize8188E(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
u8 size = 0;
|
|
|
|
u32 cr;
|
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
cr = usb_read16(padapter, REG_9346CR);
|
2013-07-10 18:25:07 +00:00
|
|
|
/* 6: EEPROM used is 93C46, 4: boot from E-Fuse. */
|
2013-05-08 21:45:39 +00:00
|
|
|
size = (cr & BOOT_FROM_EEPROM) ? 6 : 4;
|
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
MSG_88E("EEPROM type is %s\n", size == 4 ? "E-FUSE" : "93C46");
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* LLT R/W/Init function */
|
|
|
|
/* */
|
|
|
|
/* */
|
2013-08-08 05:41:21 +00:00
|
|
|
static s32 _LLTWrite(struct adapter *padapter, u32 address, u32 data)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
s32 status = _SUCCESS;
|
|
|
|
s32 count = 0;
|
|
|
|
u32 value = _LLT_INIT_ADDR(address) | _LLT_INIT_DATA(data) | _LLT_OP(_LLT_WRITE_ACCESS);
|
|
|
|
u16 LLTReg = REG_LLT_INIT;
|
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
usb_write32(padapter, LLTReg, value);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* polling */
|
2013-05-08 21:45:39 +00:00
|
|
|
do {
|
2014-11-16 00:18:30 +00:00
|
|
|
value = usb_read32(padapter, LLTReg);
|
2013-08-08 05:41:21 +00:00
|
|
|
if (_LLT_NO_ACTIVE == _LLT_OP_VALUE(value))
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
if (count > POLLING_LLT_THRESHOLD) {
|
|
|
|
RT_TRACE(_module_hal_init_c_, _drv_err_, ("Failed to polling write LLT done at address %d!\n", address));
|
|
|
|
status = _FAIL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} while (count++);
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
s32 status = _FAIL;
|
|
|
|
u32 i;
|
2013-07-10 18:25:07 +00:00
|
|
|
u32 Last_Entry_Of_TxPktBuf = LAST_ENTRY_OF_TX_PKT_BUFFER;/* 176, 22k */
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-07-14 16:21:05 +00:00
|
|
|
if (rtw_IOL_applied(padapter)) {
|
2013-05-19 04:28:07 +00:00
|
|
|
status = iol_InitLLTTable(padapter, txpktbuf_bndy);
|
2013-07-14 16:21:05 +00:00
|
|
|
} else {
|
2013-05-08 21:45:39 +00:00
|
|
|
for (i = 0; i < (txpktbuf_bndy - 1); i++) {
|
|
|
|
status = _LLTWrite(padapter, i, i + 1);
|
2013-08-08 05:41:21 +00:00
|
|
|
if (_SUCCESS != status)
|
2013-05-08 21:45:39 +00:00
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* end of list */
|
2013-05-08 21:45:39 +00:00
|
|
|
status = _LLTWrite(padapter, (txpktbuf_bndy - 1), 0xFF);
|
2013-08-08 05:41:21 +00:00
|
|
|
if (_SUCCESS != status)
|
2013-05-08 21:45:39 +00:00
|
|
|
return status;
|
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* Make the other pages as ring buffer */
|
|
|
|
/* This ring buffer is used as beacon buffer if we config this MAC as two MAC transfer. */
|
|
|
|
/* Otherwise used as local loopback buffer. */
|
2013-05-08 21:45:39 +00:00
|
|
|
for (i = txpktbuf_bndy; i < Last_Entry_Of_TxPktBuf; i++) {
|
|
|
|
status = _LLTWrite(padapter, i, (i + 1));
|
2013-08-08 05:41:21 +00:00
|
|
|
if (_SUCCESS != status)
|
2013-05-08 21:45:39 +00:00
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* Let last entry point to the start entry of ring buffer */
|
2013-05-08 21:45:39 +00:00
|
|
|
status = _LLTWrite(padapter, Last_Entry_Of_TxPktBuf, txpktbuf_bndy);
|
|
|
|
if (_SUCCESS != status) {
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-08-08 05:41:21 +00:00
|
|
|
Hal_InitPGData88E(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-07-26 23:04:37 +00:00
|
|
|
struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
if (!pEEPROM->bautoload_fail_flag) { /* autoload OK. */
|
2013-07-10 18:25:07 +00:00
|
|
|
if (!is_boot_from_eeprom(padapter)) {
|
|
|
|
/* Read EFUSE real map to shadow. */
|
2014-11-16 00:18:30 +00:00
|
|
|
EFUSE_ShadowMapUpdate(padapter, EFUSE_WIFI);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2013-07-10 18:25:07 +00:00
|
|
|
} else {/* autoload fail */
|
2013-05-08 21:45:39 +00:00
|
|
|
RT_TRACE(_module_hci_hal_init_c_, _drv_notice_, ("AutoLoad Fail reported from CR9346!!\n"));
|
2013-07-10 18:25:07 +00:00
|
|
|
/* update to default value 0xFF */
|
2013-05-08 21:45:39 +00:00
|
|
|
if (!is_boot_from_eeprom(padapter))
|
2014-11-16 00:18:30 +00:00
|
|
|
EFUSE_ShadowMapUpdate(padapter, EFUSE_WIFI);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Hal_EfuseParseIDCode88E(
|
2013-08-08 05:41:21 +00:00
|
|
|
struct adapter *padapter,
|
|
|
|
u8 *hwinfo
|
2013-05-08 21:45:39 +00:00
|
|
|
)
|
|
|
|
{
|
2013-07-26 23:04:37 +00:00
|
|
|
struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
u16 EEPROMId;
|
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
/* Checl 0x8129 again for making sure autoload status!! */
|
2013-07-09 22:40:50 +00:00
|
|
|
EEPROMId = le16_to_cpu(*((__le16 *)hwinfo));
|
2013-08-08 05:41:21 +00:00
|
|
|
if (EEPROMId != RTL_EEPROM_ID) {
|
2014-11-16 00:18:30 +00:00
|
|
|
DBG_88E("EEPROM ID(%#x) is invalid!!\n", EEPROMId);
|
2013-05-26 03:02:10 +00:00
|
|
|
pEEPROM->bautoload_fail_flag = true;
|
2013-08-08 05:41:21 +00:00
|
|
|
} else {
|
2013-05-26 03:02:10 +00:00
|
|
|
pEEPROM->bautoload_fail_flag = false;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
DBG_88E("EEPROM ID = 0x%04x\n", EEPROMId);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
static void Hal_ReadPowerValueFromPROM_8188E(struct txpowerinfo24g *pwrInfo24G, u8 *PROMContent, bool AutoLoadFail)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-08-08 05:41:21 +00:00
|
|
|
u32 rfPath, eeAddr = EEPROM_TX_PWR_INX_88E, group, TxCount = 0;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
memset(pwrInfo24G, 0, sizeof(struct txpowerinfo24g));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
if (AutoLoadFail) {
|
|
|
|
for (rfPath = 0; rfPath < MAX_RF_PATH; rfPath++) {
|
2013-07-10 18:25:07 +00:00
|
|
|
/* 2.4G default value */
|
2013-08-08 05:41:21 +00:00
|
|
|
for (group = 0; group < MAX_CHNL_GROUP_24G; group++) {
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrInfo24G->IndexCCK_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX;
|
|
|
|
pwrInfo24G->IndexBW40_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX;
|
|
|
|
}
|
2013-08-08 05:41:21 +00:00
|
|
|
for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) {
|
|
|
|
if (TxCount == 0) {
|
|
|
|
pwrInfo24G->BW20_Diff[rfPath][0] = EEPROM_DEFAULT_24G_HT20_DIFF;
|
|
|
|
pwrInfo24G->OFDM_Diff[rfPath][0] = EEPROM_DEFAULT_24G_OFDM_DIFF;
|
|
|
|
} else {
|
|
|
|
pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
|
|
|
|
pwrInfo24G->BW40_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrInfo24G->CCK_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
|
2013-08-08 05:41:21 +00:00
|
|
|
pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
return;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
for (rfPath = 0; rfPath < MAX_RF_PATH; rfPath++) {
|
2013-07-10 18:25:07 +00:00
|
|
|
/* 2.4G default value */
|
2013-08-08 05:41:21 +00:00
|
|
|
for (group = 0; group < MAX_CHNL_GROUP_24G; group++) {
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrInfo24G->IndexCCK_Base[rfPath][group] = PROMContent[eeAddr++];
|
2013-05-09 04:04:25 +00:00
|
|
|
if (pwrInfo24G->IndexCCK_Base[rfPath][group] == 0xFF)
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrInfo24G->IndexCCK_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX;
|
|
|
|
}
|
2013-08-08 05:41:21 +00:00
|
|
|
for (group = 0; group < MAX_CHNL_GROUP_24G-1; group++) {
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrInfo24G->IndexBW40_Base[rfPath][group] = PROMContent[eeAddr++];
|
2013-05-09 04:04:25 +00:00
|
|
|
if (pwrInfo24G->IndexBW40_Base[rfPath][group] == 0xFF)
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrInfo24G->IndexBW40_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2013-08-08 05:41:21 +00:00
|
|
|
for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) {
|
|
|
|
if (TxCount == 0) {
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrInfo24G->BW40_Diff[rfPath][TxCount] = 0;
|
2013-08-08 05:41:21 +00:00
|
|
|
if (PROMContent[eeAddr] == 0xFF) {
|
|
|
|
pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_24G_HT20_DIFF;
|
|
|
|
} else {
|
|
|
|
pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4;
|
2013-07-10 18:25:07 +00:00
|
|
|
if (pwrInfo24G->BW20_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrInfo24G->BW20_Diff[rfPath][TxCount] |= 0xF0;
|
|
|
|
}
|
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
if (PROMContent[eeAddr] == 0xFF) {
|
2013-05-19 04:28:07 +00:00
|
|
|
pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_24G_OFDM_DIFF;
|
2013-08-08 05:41:21 +00:00
|
|
|
} else {
|
2013-05-19 04:28:07 +00:00
|
|
|
pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f);
|
2013-07-10 18:25:07 +00:00
|
|
|
if (pwrInfo24G->OFDM_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrInfo24G->OFDM_Diff[rfPath][TxCount] |= 0xF0;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrInfo24G->CCK_Diff[rfPath][TxCount] = 0;
|
|
|
|
eeAddr++;
|
2013-08-08 05:41:21 +00:00
|
|
|
} else {
|
|
|
|
if (PROMContent[eeAddr] == 0xFF) {
|
2013-05-19 04:28:07 +00:00
|
|
|
pwrInfo24G->BW40_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
|
2013-08-08 05:41:21 +00:00
|
|
|
} else {
|
2013-05-19 04:28:07 +00:00
|
|
|
pwrInfo24G->BW40_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4;
|
2013-07-10 18:25:07 +00:00
|
|
|
if (pwrInfo24G->BW40_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrInfo24G->BW40_Diff[rfPath][TxCount] |= 0xF0;
|
|
|
|
}
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
if (PROMContent[eeAddr] == 0xFF) {
|
2013-05-19 04:28:07 +00:00
|
|
|
pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
|
2013-08-08 05:41:21 +00:00
|
|
|
} else {
|
2013-05-19 04:28:07 +00:00
|
|
|
pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f);
|
2013-07-10 18:25:07 +00:00
|
|
|
if (pwrInfo24G->BW20_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrInfo24G->BW20_Diff[rfPath][TxCount] |= 0xF0;
|
|
|
|
}
|
|
|
|
eeAddr++;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
if (PROMContent[eeAddr] == 0xFF) {
|
|
|
|
pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
|
|
|
|
} else {
|
2013-05-19 04:28:07 +00:00
|
|
|
pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4;
|
2013-07-10 18:25:07 +00:00
|
|
|
if (pwrInfo24G->OFDM_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrInfo24G->OFDM_Diff[rfPath][TxCount] |= 0xF0;
|
|
|
|
}
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
if (PROMContent[eeAddr] == 0xFF) {
|
2013-05-19 04:28:07 +00:00
|
|
|
pwrInfo24G->CCK_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
|
2013-08-08 05:41:21 +00:00
|
|
|
} else {
|
2013-05-19 04:28:07 +00:00
|
|
|
pwrInfo24G->CCK_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f);
|
2013-07-10 18:25:07 +00:00
|
|
|
if (pwrInfo24G->CCK_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrInfo24G->CCK_Diff[rfPath][TxCount] |= 0xF0;
|
|
|
|
}
|
|
|
|
eeAddr++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-27 03:51:56 +00:00
|
|
|
static u8 Hal_GetChnlGroup88E(u8 chnl, u8 *pGroup)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-08-08 05:41:21 +00:00
|
|
|
u8 bIn24G = true;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
if (chnl <= 14) {
|
|
|
|
bIn24G = true;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-11-29 22:10:20 +00:00
|
|
|
if (chnl < 3) /* Channel 1-2 */
|
2013-05-08 21:45:39 +00:00
|
|
|
*pGroup = 0;
|
2013-07-10 18:25:07 +00:00
|
|
|
else if (chnl < 6) /* Channel 3-5 */
|
2013-05-08 21:45:39 +00:00
|
|
|
*pGroup = 1;
|
2013-08-08 05:41:21 +00:00
|
|
|
else if (chnl < 9) /* Channel 6-8 */
|
2013-05-08 21:45:39 +00:00
|
|
|
*pGroup = 2;
|
2013-08-08 05:41:21 +00:00
|
|
|
else if (chnl < 12) /* Channel 9-11 */
|
2013-05-08 21:45:39 +00:00
|
|
|
*pGroup = 3;
|
2013-08-08 05:41:21 +00:00
|
|
|
else if (chnl < 14) /* Channel 12-13 */
|
2013-05-08 21:45:39 +00:00
|
|
|
*pGroup = 4;
|
2013-08-08 05:41:21 +00:00
|
|
|
else if (chnl == 14) /* Channel 14 */
|
2013-05-19 04:28:07 +00:00
|
|
|
*pGroup = 5;
|
2013-05-27 03:51:56 +00:00
|
|
|
} else {
|
2013-08-08 05:41:21 +00:00
|
|
|
bIn24G = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
if (chnl <= 40)
|
2013-05-08 21:45:39 +00:00
|
|
|
*pGroup = 0;
|
2013-08-08 05:41:21 +00:00
|
|
|
else if (chnl <= 48)
|
2013-05-08 21:45:39 +00:00
|
|
|
*pGroup = 1;
|
2013-08-08 05:41:21 +00:00
|
|
|
else if (chnl <= 56)
|
2013-05-08 21:45:39 +00:00
|
|
|
*pGroup = 2;
|
2013-08-08 05:41:21 +00:00
|
|
|
else if (chnl <= 64)
|
2013-05-08 21:45:39 +00:00
|
|
|
*pGroup = 3;
|
2013-08-08 05:41:21 +00:00
|
|
|
else if (chnl <= 104)
|
2013-05-08 21:45:39 +00:00
|
|
|
*pGroup = 4;
|
2013-08-08 05:41:21 +00:00
|
|
|
else if (chnl <= 112)
|
2013-05-19 04:28:07 +00:00
|
|
|
*pGroup = 5;
|
2013-08-08 05:41:21 +00:00
|
|
|
else if (chnl <= 120)
|
2013-05-19 04:28:07 +00:00
|
|
|
*pGroup = 5;
|
2013-08-08 05:41:21 +00:00
|
|
|
else if (chnl <= 128)
|
2013-05-19 04:28:07 +00:00
|
|
|
*pGroup = 6;
|
2013-08-08 05:41:21 +00:00
|
|
|
else if (chnl <= 136)
|
2013-05-19 04:28:07 +00:00
|
|
|
*pGroup = 7;
|
2013-08-08 05:41:21 +00:00
|
|
|
else if (chnl <= 144)
|
2013-05-19 04:28:07 +00:00
|
|
|
*pGroup = 8;
|
2013-08-08 05:41:21 +00:00
|
|
|
else if (chnl <= 153)
|
2013-05-19 04:28:07 +00:00
|
|
|
*pGroup = 9;
|
2013-08-08 05:41:21 +00:00
|
|
|
else if (chnl <= 161)
|
2013-05-19 04:28:07 +00:00
|
|
|
*pGroup = 10;
|
2013-08-08 05:41:21 +00:00
|
|
|
else if (chnl <= 177)
|
2013-05-19 04:28:07 +00:00
|
|
|
*pGroup = 11;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
return bIn24G;
|
|
|
|
}
|
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
void Hal_ReadPowerSavingMode88E(struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-08-08 05:41:21 +00:00
|
|
|
if (AutoLoadFail) {
|
2013-05-26 03:02:10 +00:00
|
|
|
padapter->pwrctrlpriv.bHWPowerdown = false;
|
|
|
|
padapter->pwrctrlpriv.bSupportRemoteWakeup = false;
|
2013-08-08 05:41:21 +00:00
|
|
|
} else {
|
2013-07-10 18:25:07 +00:00
|
|
|
/* hw power down mode selection , 0:rf-off / 1:power down */
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
if (padapter->registrypriv.hwpdn_mode == 2)
|
2013-05-08 21:45:39 +00:00
|
|
|
padapter->pwrctrlpriv.bHWPowerdown = (hwinfo[EEPROM_RF_FEATURE_OPTION_88E] & BIT4);
|
|
|
|
else
|
|
|
|
padapter->pwrctrlpriv.bHWPowerdown = padapter->registrypriv.hwpdn_mode;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* decide hw if support remote wakeup function */
|
2013-08-08 05:41:21 +00:00
|
|
|
/* if hw supported, 8051 (SIE) will generate WeakUP signal(D+/D- toggle) when autoresume */
|
|
|
|
padapter->pwrctrlpriv.bSupportRemoteWakeup = (hwinfo[EEPROM_USB_OPTIONAL_FUNCTION0] & BIT1) ? true : false;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
DBG_88E("%s...bHWPwrPindetect(%x)-bHWPowerdown(%x) , bSupportRemoteWakeup(%x)\n", __func__,
|
|
|
|
padapter->pwrctrlpriv.bHWPwrPindetect, padapter->pwrctrlpriv.bHWPowerdown , padapter->pwrctrlpriv.bSupportRemoteWakeup);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
DBG_88E("### PS params => power_mgnt(%x), usbss_enable(%x) ###\n", padapter->registrypriv.power_mgnt, padapter->registrypriv.usbss_enable);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
void Hal_ReadTxPowerInfo88E(struct adapter *padapter, u8 *PROMContent, bool AutoLoadFail)
|
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-07-26 20:54:27 +00:00
|
|
|
struct txpowerinfo24g pwrInfo24G;
|
2013-09-27 19:41:36 +00:00
|
|
|
u8 rfPath, ch, group;
|
|
|
|
u8 bIn24G, TxCount;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
Hal_ReadPowerValueFromPROM_8188E(&pwrInfo24G, PROMContent, AutoLoadFail);
|
|
|
|
|
2013-05-09 04:04:25 +00:00
|
|
|
if (!AutoLoadFail)
|
2013-05-27 22:32:24 +00:00
|
|
|
pHalData->bTXPowerDataReadFromEEPORM = true;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
for (rfPath = 0; rfPath < pHalData->NumTotalRFPath; rfPath++) {
|
2013-11-29 22:10:20 +00:00
|
|
|
for (ch = 0; ch < CHANNEL_MAX_NUMBER; ch++) {
|
2013-08-08 05:41:21 +00:00
|
|
|
bIn24G = Hal_GetChnlGroup88E(ch, &group);
|
|
|
|
if (bIn24G) {
|
|
|
|
pHalData->Index24G_CCK_Base[rfPath][ch] = pwrInfo24G.IndexCCK_Base[rfPath][group];
|
|
|
|
if (ch == 14)
|
|
|
|
pHalData->Index24G_BW40_Base[rfPath][ch] = pwrInfo24G.IndexBW40_Base[rfPath][4];
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2013-08-08 05:41:21 +00:00
|
|
|
pHalData->Index24G_BW40_Base[rfPath][ch] = pwrInfo24G.IndexBW40_Base[rfPath][group];
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2013-08-08 05:41:21 +00:00
|
|
|
if (bIn24G) {
|
|
|
|
DBG_88E("======= Path %d, Channel %d =======\n", rfPath, ch);
|
|
|
|
DBG_88E("Index24G_CCK_Base[%d][%d] = 0x%x\n", rfPath, ch , pHalData->Index24G_CCK_Base[rfPath][ch]);
|
|
|
|
DBG_88E("Index24G_BW40_Base[%d][%d] = 0x%x\n", rfPath, ch , pHalData->Index24G_BW40_Base[rfPath][ch]);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
}
|
2013-08-08 05:41:21 +00:00
|
|
|
for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) {
|
|
|
|
pHalData->CCK_24G_Diff[rfPath][TxCount] = pwrInfo24G.CCK_Diff[rfPath][TxCount];
|
|
|
|
pHalData->OFDM_24G_Diff[rfPath][TxCount] = pwrInfo24G.OFDM_Diff[rfPath][TxCount];
|
|
|
|
pHalData->BW20_24G_Diff[rfPath][TxCount] = pwrInfo24G.BW20_Diff[rfPath][TxCount];
|
|
|
|
pHalData->BW40_24G_Diff[rfPath][TxCount] = pwrInfo24G.BW40_Diff[rfPath][TxCount];
|
|
|
|
DBG_88E("======= TxCount %d =======\n", TxCount);
|
|
|
|
DBG_88E("CCK_24G_Diff[%d][%d] = %d\n", rfPath, TxCount, pHalData->CCK_24G_Diff[rfPath][TxCount]);
|
|
|
|
DBG_88E("OFDM_24G_Diff[%d][%d] = %d\n", rfPath, TxCount, pHalData->OFDM_24G_Diff[rfPath][TxCount]);
|
|
|
|
DBG_88E("BW20_24G_Diff[%d][%d] = %d\n", rfPath, TxCount, pHalData->BW20_24G_Diff[rfPath][TxCount]);
|
|
|
|
DBG_88E("BW40_24G_Diff[%d][%d] = %d\n", rfPath, TxCount, pHalData->BW40_24G_Diff[rfPath][TxCount]);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* 2010/10/19 MH Add Regulator recognize for CU. */
|
2013-08-08 05:41:21 +00:00
|
|
|
if (!AutoLoadFail) {
|
2013-07-10 18:25:07 +00:00
|
|
|
pHalData->EEPROMRegulatory = (PROMContent[EEPROM_RF_BOARD_OPTION_88E]&0x7); /* bit0~2 */
|
2013-05-09 04:04:25 +00:00
|
|
|
if (PROMContent[EEPROM_RF_BOARD_OPTION_88E] == 0xFF)
|
2013-07-10 18:25:07 +00:00
|
|
|
pHalData->EEPROMRegulatory = (EEPROM_DEFAULT_BOARD_OPTION&0x7); /* bit0~2 */
|
2013-08-08 05:41:21 +00:00
|
|
|
} else {
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->EEPROMRegulatory = 0;
|
|
|
|
}
|
2013-05-25 23:35:42 +00:00
|
|
|
DBG_88E("EEPROMRegulatory = 0x%x\n", pHalData->EEPROMRegulatory);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
void Hal_EfuseParseXtal_8188E(struct adapter *pAdapter, u8 *hwinfo, bool AutoLoadFail)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-07-22 23:18:19 +00:00
|
|
|
struct hal_data_8188e *pHalData = GET_HAL_DATA(pAdapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
if (!AutoLoadFail) {
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->CrystalCap = hwinfo[EEPROM_XTAL_88E];
|
2013-05-09 04:04:25 +00:00
|
|
|
if (pHalData->CrystalCap == 0xFF)
|
2013-05-19 04:28:07 +00:00
|
|
|
pHalData->CrystalCap = EEPROM_Default_CrystalCap_88E;
|
2013-08-08 05:41:21 +00:00
|
|
|
} else {
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->CrystalCap = EEPROM_Default_CrystalCap_88E;
|
|
|
|
}
|
2013-05-25 23:35:42 +00:00
|
|
|
DBG_88E("CrystalCap: 0x%2x\n", pHalData->CrystalCap);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
void Hal_EfuseParseBoardType88E(struct adapter *pAdapter, u8 *hwinfo, bool AutoLoadFail)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-08-08 05:41:21 +00:00
|
|
|
struct hal_data_8188e *pHalData = GET_HAL_DATA(pAdapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
if (!AutoLoadFail)
|
|
|
|
pHalData->BoardType = ((hwinfo[EEPROM_RF_BOARD_OPTION_88E]&0xE0)>>5);
|
|
|
|
else
|
|
|
|
pHalData->BoardType = 0;
|
2013-05-25 23:35:42 +00:00
|
|
|
DBG_88E("Board Type: 0x%2x\n", pHalData->BoardType);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
void Hal_EfuseParseEEPROMVer88E(struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-08-08 05:41:21 +00:00
|
|
|
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
if (!AutoLoadFail) {
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->EEPROMVersion = hwinfo[EEPROM_VERSION_88E];
|
2013-05-09 04:04:25 +00:00
|
|
|
if (pHalData->EEPROMVersion == 0xFF)
|
2013-05-19 04:28:07 +00:00
|
|
|
pHalData->EEPROMVersion = EEPROM_Default_Version;
|
2013-08-08 05:41:21 +00:00
|
|
|
} else {
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->EEPROMVersion = 1;
|
|
|
|
}
|
2013-08-08 05:41:21 +00:00
|
|
|
RT_TRACE(_module_hci_hal_init_c_, _drv_info_,
|
|
|
|
("Hal_EfuseParseEEPROMVer(), EEVer = %d\n",
|
|
|
|
pHalData->EEPROMVersion));
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
void rtl8188e_EfuseParseChnlPlan(struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-08-08 05:41:21 +00:00
|
|
|
padapter->mlmepriv.ChannelPlan =
|
|
|
|
hal_com_get_channel_plan(padapter,
|
|
|
|
hwinfo ? hwinfo[EEPROM_ChannelPlan_88E] : 0xFF,
|
|
|
|
padapter->registrypriv.channel_plan,
|
|
|
|
RT_CHANNEL_DOMAIN_WORLD_WIDE_13, AutoLoadFail);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-05-25 23:35:42 +00:00
|
|
|
DBG_88E("mlmepriv.ChannelPlan = 0x%02x\n", padapter->mlmepriv.ChannelPlan);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
void Hal_EfuseParseCustomerID88E(struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-07-22 23:18:19 +00:00
|
|
|
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
if (!AutoLoadFail) {
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->EEPROMCustomerID = hwinfo[EEPROM_CUSTOMERID_88E];
|
2013-08-08 05:41:21 +00:00
|
|
|
} else {
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->EEPROMCustomerID = 0;
|
|
|
|
pHalData->EEPROMSubCustomerID = 0;
|
|
|
|
}
|
2013-05-25 23:35:42 +00:00
|
|
|
DBG_88E("EEPROM Customer ID: 0x%2x\n", pHalData->EEPROMCustomerID);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
void Hal_ReadAntennaDiversity88E(struct adapter *pAdapter, u8 *PROMContent, bool AutoLoadFail)
|
2013-05-08 21:45:39 +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 registry_priv *registry_par = &pAdapter->registrypriv;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
if (!AutoLoadFail) {
|
2013-07-10 18:25:07 +00:00
|
|
|
/* Antenna Diversity setting. */
|
2013-08-08 05:41:21 +00:00
|
|
|
if (registry_par->antdiv_cfg == 2) { /* 2:By EFUSE */
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->AntDivCfg = (PROMContent[EEPROM_RF_BOARD_OPTION_88E]&0x18)>>3;
|
2013-05-19 04:28:07 +00:00
|
|
|
if (PROMContent[EEPROM_RF_BOARD_OPTION_88E] == 0xFF)
|
2014-11-16 00:18:30 +00:00
|
|
|
pHalData->AntDivCfg = (EEPROM_DEFAULT_BOARD_OPTION&0x18)>>3;
|
2013-08-08 05:41:21 +00:00
|
|
|
} else {
|
|
|
|
pHalData->AntDivCfg = registry_par->antdiv_cfg; /* 0:OFF , 1:ON, 2:By EFUSE */
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
if (registry_par->antdiv_type == 0) {
|
|
|
|
/* If TRxAntDivType is AUTO in advanced setting, use EFUSE value instead. */
|
2013-05-19 04:28:07 +00:00
|
|
|
pHalData->TRxAntDivType = PROMContent[EEPROM_RF_ANTENNA_OPT_88E];
|
|
|
|
if (pHalData->TRxAntDivType == 0xFF)
|
2013-07-10 18:25:07 +00:00
|
|
|
pHalData->TRxAntDivType = CG_TRX_HW_ANTDIV; /* For 88EE, 1Tx and 1RxCG are fixed.(1Ant, Tx and RxCG are both on aux port) */
|
2013-08-08 05:41:21 +00:00
|
|
|
} else {
|
|
|
|
pHalData->TRxAntDivType = registry_par->antdiv_type;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
if (pHalData->TRxAntDivType == CG_TRX_HW_ANTDIV || pHalData->TRxAntDivType == CGCS_RX_HW_ANTDIV)
|
2013-07-10 18:25:07 +00:00
|
|
|
pHalData->AntDivCfg = 1; /* 0xC1[3] is ignored. */
|
2013-08-08 05:41:21 +00:00
|
|
|
} else {
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->AntDivCfg = 0;
|
2013-07-10 18:25:07 +00:00
|
|
|
pHalData->TRxAntDivType = pHalData->TRxAntDivType; /* The value in the driver setting of device manager. */
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2013-08-08 05:41:21 +00:00
|
|
|
DBG_88E("EEPROM : AntDivCfg = %x, TRxAntDivType = %x\n", pHalData->AntDivCfg, pHalData->TRxAntDivType);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
void Hal_ReadThermalMeter_88E(struct adapter *Adapter, u8 *PROMContent, bool AutoloadFail)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-07-22 23:18:19 +00:00
|
|
|
struct hal_data_8188e *pHalData = GET_HAL_DATA(Adapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
/* ThermalMeter from EEPROM */
|
2013-05-19 04:28:07 +00:00
|
|
|
if (!AutoloadFail)
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->EEPROMThermalMeter = PROMContent[EEPROM_THERMAL_METER_88E];
|
|
|
|
else
|
|
|
|
pHalData->EEPROMThermalMeter = EEPROM_Default_ThermalMeter_88E;
|
|
|
|
|
2013-08-08 05:41:21 +00:00
|
|
|
if (pHalData->EEPROMThermalMeter == 0xff || AutoloadFail) {
|
2013-05-26 03:02:10 +00:00
|
|
|
pHalData->bAPKThermalMeterIgnore = true;
|
2013-05-19 04:28:07 +00:00
|
|
|
pHalData->EEPROMThermalMeter = EEPROM_Default_ThermalMeter_88E;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2013-05-25 23:35:42 +00:00
|
|
|
DBG_88E("ThermalMeter = 0x%x\n", pHalData->EEPROMThermalMeter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|