1 /******************************************************************************
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 ******************************************************************************/
17 #include <linux/firmware.h>
18 #include <linux/vmalloc.h>
19 #include <drv_types.h>
20 #include <rtw_efuse.h>
22 #include <rtl8188e_hal.h>
26 void iol_mode_enable(struct adapter *padapter, u8 enable)
31 /* Enable initial offload */
32 reg_0xf0 = usb_read8(padapter, REG_SYS_CFG);
33 usb_write8(padapter, REG_SYS_CFG, reg_0xf0|SW_OFFLOAD_EN);
35 if (!padapter->bFWReady) {
36 DBG_88E("bFWReady == false call reset 8051...\n");
37 _8051Reset88E(padapter);
41 /* disable initial offload */
42 reg_0xf0 = usb_read8(padapter, REG_SYS_CFG);
43 usb_write8(padapter, REG_SYS_CFG, reg_0xf0 & ~SW_OFFLOAD_EN);
47 s32 iol_execute(struct adapter *padapter, u8 control)
51 unsigned long start = 0;
53 control = control&0x0f;
54 reg_0x88 = usb_read8(padapter, REG_HMEBOX_E0);
55 usb_write8(padapter, REG_HMEBOX_E0, reg_0x88|control);
58 while ((reg_0x88 = usb_read8(padapter, REG_HMEBOX_E0)) & control &&
59 jiffies_to_msecs(jiffies - start) < 1000) {
63 reg_0x88 = usb_read8(padapter, REG_HMEBOX_E0);
64 status = (reg_0x88 & control) ? _FAIL : _SUCCESS;
65 if (reg_0x88 & control<<4)
70 static s32 iol_InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy)
74 iol_mode_enable(padapter, 1);
75 usb_write8(padapter, REG_TDECTRL+1, txpktbuf_bndy);
76 rst = iol_execute(padapter, CMD_INIT_LLT);
77 iol_mode_enable(padapter, 0);
82 s32 rtl8188e_iol_efuse_patch(struct adapter *padapter)
84 s32 result = _SUCCESS;
86 DBG_88E("==> %s\n", __func__);
87 if (rtw_IOL_applied(padapter)) {
88 iol_mode_enable(padapter, 1);
89 result = iol_execute(padapter, CMD_READ_EFUSE_MAP);
90 if (result == _SUCCESS)
91 result = iol_execute(padapter, CMD_EFUSE_PATCH);
93 iol_mode_enable(padapter, 0);
98 #define MAX_REG_BOLCK_SIZE 196
100 void _8051Reset88E(struct adapter *padapter)
104 u1bTmp = usb_read8(padapter, REG_SYS_FUNC_EN+1);
105 usb_write8(padapter, REG_SYS_FUNC_EN+1, u1bTmp&(~BIT(2)));
106 usb_write8(padapter, REG_SYS_FUNC_EN+1, u1bTmp|(BIT(2)));
107 DBG_88E("=====> _8051Reset88E(): 8051 reset success .\n");
110 void rtl8188e_InitializeFirmwareVars(struct adapter *padapter)
112 /* Init Fw LPS related. */
113 padapter->pwrctrlpriv.bFwCurrentInPSMode = false;
115 /* Init H2C counter. by tynli. 2009.12.09. */
116 padapter->HalData->LastHMEBoxNum = 0;
119 void rtw_hal_free_data(struct adapter *padapter)
121 kfree(padapter->HalData);
122 padapter->HalData = NULL;
125 void rtw_hal_read_chip_version(struct adapter *padapter)
128 struct HAL_VERSION ChipVersion;
129 struct hal_data_8188e *pHalData = padapter->HalData;
131 value32 = usb_read32(padapter, REG_SYS_CFG);
132 ChipVersion.ChipType = ((value32 & RTL_ID) ? TEST_CHIP : NORMAL_CHIP);
133 ChipVersion.VendorType = ((value32 & VENDOR_ID) ? CHIP_VENDOR_UMC : CHIP_VENDOR_TSMC);
134 ChipVersion.CUTVersion = (value32 & CHIP_VER_RTL_MASK)>>CHIP_VER_RTL_SHIFT; /* IC version (CUT) */
136 dump_chip_info(ChipVersion);
138 pHalData->VersionID = ChipVersion;
141 void rtw_hal_set_odm_var(struct adapter *Adapter, enum hal_odm_variable eVariable, void *pValue1, bool bSet)
143 struct odm_dm_struct *podmpriv = &Adapter->HalData->odmpriv;
146 case HAL_ODM_STA_INFO:
148 struct sta_info *psta = pValue1;
151 DBG_88E("### Set STA_(%d) info\n", psta->mac_id);
152 ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, psta);
153 ODM_RAInfo_Init(podmpriv, psta->mac_id);
155 DBG_88E("### Clean STA_(%d) info\n", psta->mac_id);
156 ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, NULL);
160 case HAL_ODM_P2P_STATE:
161 podmpriv->bWIFI_Direct = bSet;
163 case HAL_ODM_WIFI_DISPLAY_STATE:
164 podmpriv->bWIFI_Display = bSet;
171 void rtw_hal_notch_filter(struct adapter *adapter, bool enable)
174 DBG_88E("Enable notch filter\n");
175 usb_write8(adapter, rOFDM0_RxDSP+1, usb_read8(adapter, rOFDM0_RxDSP+1) | BIT(1));
177 DBG_88E("Disable notch filter\n");
178 usb_write8(adapter, rOFDM0_RxDSP+1, usb_read8(adapter, rOFDM0_RxDSP+1) & ~BIT(1));
184 /* LLT R/W/Init function */
187 static s32 _LLTWrite(struct adapter *padapter, u32 address, u32 data)
189 s32 status = _SUCCESS;
191 u32 value = _LLT_INIT_ADDR(address) | _LLT_INIT_DATA(data) | _LLT_OP(_LLT_WRITE_ACCESS);
192 u16 LLTReg = REG_LLT_INIT;
194 usb_write32(padapter, LLTReg, value);
198 value = usb_read32(padapter, LLTReg);
199 if (_LLT_NO_ACTIVE == _LLT_OP_VALUE(value))
202 if (count > POLLING_LLT_THRESHOLD) {
203 RT_TRACE(_module_hal_init_c_, _drv_err_, ("Failed to polling write LLT done at address %d!\n", address));
213 s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy)
217 u32 Last_Entry_Of_TxPktBuf = LAST_ENTRY_OF_TX_PKT_BUFFER;/* 176, 22k */
219 if (rtw_IOL_applied(padapter)) {
220 status = iol_InitLLTTable(padapter, txpktbuf_bndy);
222 for (i = 0; i < (txpktbuf_bndy - 1); i++) {
223 status = _LLTWrite(padapter, i, i + 1);
224 if (_SUCCESS != status)
229 status = _LLTWrite(padapter, (txpktbuf_bndy - 1), 0xFF);
230 if (_SUCCESS != status)
233 /* Make the other pages as ring buffer */
234 /* This ring buffer is used as beacon buffer if we config this MAC as two MAC transfer. */
235 /* Otherwise used as local loopback buffer. */
236 for (i = txpktbuf_bndy; i < Last_Entry_Of_TxPktBuf; i++) {
237 status = _LLTWrite(padapter, i, (i + 1));
238 if (_SUCCESS != status)
242 /* Let last entry point to the start entry of ring buffer */
243 status = _LLTWrite(padapter, Last_Entry_Of_TxPktBuf, txpktbuf_bndy);
244 if (_SUCCESS != status) {
253 Hal_InitPGData88E(struct adapter *padapter)
255 struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
257 if (!pEEPROM->bautoload_fail_flag) { /* autoload OK. */
258 if (!is_boot_from_eeprom(padapter)) {
259 /* Read EFUSE real map to shadow. */
260 EFUSE_ShadowMapUpdate(padapter, EFUSE_WIFI);
262 } else {/* autoload fail */
263 RT_TRACE(_module_hci_hal_init_c_, _drv_notice_, ("AutoLoad Fail reported from CR9346!!\n"));
264 /* update to default value 0xFF */
265 if (!is_boot_from_eeprom(padapter))
266 EFUSE_ShadowMapUpdate(padapter, EFUSE_WIFI);
271 Hal_EfuseParseIDCode88E(
272 struct adapter *padapter,
276 struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
279 /* Checl 0x8129 again for making sure autoload status!! */
280 EEPROMId = le16_to_cpu(*((__le16 *)hwinfo));
281 if (EEPROMId != RTL_EEPROM_ID) {
282 DBG_88E("EEPROM ID(%#x) is invalid!!\n", EEPROMId);
283 pEEPROM->bautoload_fail_flag = true;
285 pEEPROM->bautoload_fail_flag = false;
288 DBG_88E("EEPROM ID = 0x%04x\n", EEPROMId);
291 static void Hal_ReadPowerValueFromPROM_8188E(struct txpowerinfo24g *pwrInfo24G, u8 *PROMContent, bool AutoLoadFail)
293 u32 rfPath, eeAddr = EEPROM_TX_PWR_INX_88E, group, TxCount = 0;
295 memset(pwrInfo24G, 0, sizeof(struct txpowerinfo24g));
298 for (rfPath = 0; rfPath < MAX_RF_PATH; rfPath++) {
299 /* 2.4G default value */
300 for (group = 0; group < MAX_CHNL_GROUP_24G; group++) {
301 pwrInfo24G->IndexCCK_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX;
302 pwrInfo24G->IndexBW40_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX;
304 for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) {
306 pwrInfo24G->BW20_Diff[rfPath][0] = EEPROM_DEFAULT_24G_HT20_DIFF;
307 pwrInfo24G->OFDM_Diff[rfPath][0] = EEPROM_DEFAULT_24G_OFDM_DIFF;
309 pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
310 pwrInfo24G->BW40_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
311 pwrInfo24G->CCK_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
312 pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
319 for (rfPath = 0; rfPath < MAX_RF_PATH; rfPath++) {
320 /* 2.4G default value */
321 for (group = 0; group < MAX_CHNL_GROUP_24G; group++) {
322 pwrInfo24G->IndexCCK_Base[rfPath][group] = PROMContent[eeAddr++];
323 if (pwrInfo24G->IndexCCK_Base[rfPath][group] == 0xFF)
324 pwrInfo24G->IndexCCK_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX;
326 for (group = 0; group < MAX_CHNL_GROUP_24G-1; group++) {
327 pwrInfo24G->IndexBW40_Base[rfPath][group] = PROMContent[eeAddr++];
328 if (pwrInfo24G->IndexBW40_Base[rfPath][group] == 0xFF)
329 pwrInfo24G->IndexBW40_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX;
331 for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) {
333 pwrInfo24G->BW40_Diff[rfPath][TxCount] = 0;
334 if (PROMContent[eeAddr] == 0xFF) {
335 pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_24G_HT20_DIFF;
337 pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4;
338 if (pwrInfo24G->BW20_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */
339 pwrInfo24G->BW20_Diff[rfPath][TxCount] |= 0xF0;
342 if (PROMContent[eeAddr] == 0xFF) {
343 pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_24G_OFDM_DIFF;
345 pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f);
346 if (pwrInfo24G->OFDM_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */
347 pwrInfo24G->OFDM_Diff[rfPath][TxCount] |= 0xF0;
349 pwrInfo24G->CCK_Diff[rfPath][TxCount] = 0;
352 if (PROMContent[eeAddr] == 0xFF) {
353 pwrInfo24G->BW40_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
355 pwrInfo24G->BW40_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4;
356 if (pwrInfo24G->BW40_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */
357 pwrInfo24G->BW40_Diff[rfPath][TxCount] |= 0xF0;
360 if (PROMContent[eeAddr] == 0xFF) {
361 pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
363 pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f);
364 if (pwrInfo24G->BW20_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */
365 pwrInfo24G->BW20_Diff[rfPath][TxCount] |= 0xF0;
369 if (PROMContent[eeAddr] == 0xFF) {
370 pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
372 pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4;
373 if (pwrInfo24G->OFDM_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */
374 pwrInfo24G->OFDM_Diff[rfPath][TxCount] |= 0xF0;
377 if (PROMContent[eeAddr] == 0xFF) {
378 pwrInfo24G->CCK_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
380 pwrInfo24G->CCK_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f);
381 if (pwrInfo24G->CCK_Diff[rfPath][TxCount] & BIT(3)) /* 4bit sign number to 8 bit sign number */
382 pwrInfo24G->CCK_Diff[rfPath][TxCount] |= 0xF0;
390 static u8 Hal_GetChnlGroup88E(u8 chnl, u8 *pGroup)
397 if (chnl < 3) /* Channel 1-2 */
399 else if (chnl < 6) /* Channel 3-5 */
401 else if (chnl < 9) /* Channel 6-8 */
403 else if (chnl < 12) /* Channel 9-11 */
405 else if (chnl < 14) /* Channel 12-13 */
407 else if (chnl == 14) /* Channel 14 */
411 /* probably, this branch is suitable only for 5 GHz */
423 else if (chnl <= 104)
425 else if (chnl <= 112)
427 else if (chnl <= 120)
429 else if (chnl <= 128)
431 else if (chnl <= 136)
433 else if (chnl <= 144)
435 else if (chnl <= 153)
437 else if (chnl <= 161)
439 else if (chnl <= 177)
445 void Hal_ReadPowerSavingMode88E(struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail)
448 padapter->pwrctrlpriv.bHWPowerdown = false;
449 padapter->pwrctrlpriv.bSupportRemoteWakeup = false;
451 /* hw power down mode selection , 0:rf-off / 1:power down */
453 if (padapter->registrypriv.hwpdn_mode == 2)
454 padapter->pwrctrlpriv.bHWPowerdown = (hwinfo[EEPROM_RF_FEATURE_OPTION_88E] & BIT(4));
456 padapter->pwrctrlpriv.bHWPowerdown = padapter->registrypriv.hwpdn_mode;
458 /* decide hw if support remote wakeup function */
459 /* if hw supported, 8051 (SIE) will generate WeakUP signal(D+/D- toggle) when autoresume */
460 padapter->pwrctrlpriv.bSupportRemoteWakeup = (hwinfo[EEPROM_USB_OPTIONAL_FUNCTION0] & BIT(1)) ? true : false;
462 DBG_88E("%s...bHWPwrPindetect(%x)-bHWPowerdown(%x) , bSupportRemoteWakeup(%x)\n", __func__,
463 padapter->pwrctrlpriv.bHWPwrPindetect, padapter->pwrctrlpriv.bHWPowerdown, padapter->pwrctrlpriv.bSupportRemoteWakeup);
465 DBG_88E("### PS params => power_mgnt(%x), usbss_enable(%x) ###\n", padapter->registrypriv.power_mgnt, padapter->registrypriv.usbss_enable);
469 void Hal_ReadTxPowerInfo88E(struct adapter *padapter, u8 *PROMContent, bool AutoLoadFail)
471 struct hal_data_8188e *pHalData = padapter->HalData;
472 struct txpowerinfo24g pwrInfo24G;
476 Hal_ReadPowerValueFromPROM_8188E(&pwrInfo24G, PROMContent, AutoLoadFail);
479 pHalData->bTXPowerDataReadFromEEPORM = true;
481 for (ch = 0; ch < CHANNEL_MAX_NUMBER; ch++) {
482 bIn24G = Hal_GetChnlGroup88E(ch, &group);
484 pHalData->Index24G_CCK_Base[0][ch] = pwrInfo24G.IndexCCK_Base[0][group];
486 pHalData->Index24G_BW40_Base[0][ch] = pwrInfo24G.IndexBW40_Base[0][4];
488 pHalData->Index24G_BW40_Base[0][ch] = pwrInfo24G.IndexBW40_Base[0][group];
491 DBG_88E("======= Path %d, Channel %d =======\n", 0, ch);
492 DBG_88E("Index24G_CCK_Base[%d][%d] = 0x%x\n", 0, ch, pHalData->Index24G_CCK_Base[0][ch]);
493 DBG_88E("Index24G_BW40_Base[%d][%d] = 0x%x\n", 0, ch, pHalData->Index24G_BW40_Base[0][ch]);
496 for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) {
497 pHalData->CCK_24G_Diff[0][TxCount] = pwrInfo24G.CCK_Diff[0][TxCount];
498 pHalData->OFDM_24G_Diff[0][TxCount] = pwrInfo24G.OFDM_Diff[0][TxCount];
499 pHalData->BW20_24G_Diff[0][TxCount] = pwrInfo24G.BW20_Diff[0][TxCount];
500 pHalData->BW40_24G_Diff[0][TxCount] = pwrInfo24G.BW40_Diff[0][TxCount];
501 DBG_88E("======= TxCount %d =======\n", TxCount);
502 DBG_88E("CCK_24G_Diff[%d][%d] = %d\n", 0, TxCount, pHalData->CCK_24G_Diff[0][TxCount]);
503 DBG_88E("OFDM_24G_Diff[%d][%d] = %d\n", 0, TxCount, pHalData->OFDM_24G_Diff[0][TxCount]);
504 DBG_88E("BW20_24G_Diff[%d][%d] = %d\n", 0, TxCount, pHalData->BW20_24G_Diff[0][TxCount]);
505 DBG_88E("BW40_24G_Diff[%d][%d] = %d\n", 0, TxCount, pHalData->BW40_24G_Diff[0][TxCount]);
508 /* 2010/10/19 MH Add Regulator recognize for CU. */
510 pHalData->EEPROMRegulatory = (PROMContent[EEPROM_RF_BOARD_OPTION_88E]&0x7); /* bit0~2 */
511 if (PROMContent[EEPROM_RF_BOARD_OPTION_88E] == 0xFF)
512 pHalData->EEPROMRegulatory = (EEPROM_DEFAULT_BOARD_OPTION&0x7); /* bit0~2 */
514 pHalData->EEPROMRegulatory = 0;
516 DBG_88E("EEPROMRegulatory = 0x%x\n", pHalData->EEPROMRegulatory);
519 void Hal_EfuseParseXtal_8188E(struct adapter *pAdapter, u8 *hwinfo, bool AutoLoadFail)
521 struct hal_data_8188e *pHalData = pAdapter->HalData;
524 pHalData->CrystalCap = hwinfo[EEPROM_XTAL_88E];
525 if (pHalData->CrystalCap == 0xFF)
526 pHalData->CrystalCap = EEPROM_Default_CrystalCap_88E;
528 pHalData->CrystalCap = EEPROM_Default_CrystalCap_88E;
530 DBG_88E("CrystalCap: 0x%2x\n", pHalData->CrystalCap);
533 void Hal_EfuseParseBoardType88E(struct adapter *pAdapter, u8 *hwinfo, bool AutoLoadFail)
535 struct hal_data_8188e *pHalData = pAdapter->HalData;
538 pHalData->BoardType = (hwinfo[EEPROM_RF_BOARD_OPTION_88E]
541 pHalData->BoardType = 0;
542 DBG_88E("Board Type: 0x%2x\n", pHalData->BoardType);
545 void Hal_EfuseParseEEPROMVer88E(struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail)
547 struct hal_data_8188e *pHalData = padapter->HalData;
550 pHalData->EEPROMVersion = hwinfo[EEPROM_VERSION_88E];
551 if (pHalData->EEPROMVersion == 0xFF)
552 pHalData->EEPROMVersion = EEPROM_Default_Version;
554 pHalData->EEPROMVersion = 1;
556 RT_TRACE(_module_hci_hal_init_c_, _drv_info_,
557 ("Hal_EfuseParseEEPROMVer(), EEVer = %d\n",
558 pHalData->EEPROMVersion));
561 void rtl8188e_EfuseParseChnlPlan(struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail)
563 padapter->mlmepriv.ChannelPlan =
564 hal_com_get_channel_plan(padapter,
565 hwinfo ? hwinfo[EEPROM_ChannelPlan_88E] : 0xFF,
566 padapter->registrypriv.channel_plan,
567 RT_CHANNEL_DOMAIN_WORLD_WIDE_13, AutoLoadFail);
569 DBG_88E("mlmepriv.ChannelPlan = 0x%02x\n", padapter->mlmepriv.ChannelPlan);
572 void Hal_EfuseParseCustomerID88E(struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail)
574 struct hal_data_8188e *pHalData = padapter->HalData;
577 pHalData->EEPROMCustomerID = hwinfo[EEPROM_CUSTOMERID_88E];
579 pHalData->EEPROMCustomerID = 0;
580 pHalData->EEPROMSubCustomerID = 0;
582 DBG_88E("EEPROM Customer ID: 0x%2x\n", pHalData->EEPROMCustomerID);
585 void Hal_ReadAntennaDiversity88E(struct adapter *pAdapter, u8 *PROMContent, bool AutoLoadFail)
587 struct hal_data_8188e *pHalData = pAdapter->HalData;
588 struct registry_priv *registry_par = &pAdapter->registrypriv;
591 /* Antenna Diversity setting. */
592 if (registry_par->antdiv_cfg == 2) { /* 2:By EFUSE */
593 pHalData->AntDivCfg = (PROMContent[EEPROM_RF_BOARD_OPTION_88E]&0x18)>>3;
594 if (PROMContent[EEPROM_RF_BOARD_OPTION_88E] == 0xFF)
595 pHalData->AntDivCfg = (EEPROM_DEFAULT_BOARD_OPTION&0x18)>>3;
597 pHalData->AntDivCfg = registry_par->antdiv_cfg; /* 0:OFF , 1:ON, 2:By EFUSE */
600 if (registry_par->antdiv_type == 0) {
601 /* If TRxAntDivType is AUTO in advanced setting, use EFUSE value instead. */
602 pHalData->TRxAntDivType = PROMContent[EEPROM_RF_ANTENNA_OPT_88E];
603 if (pHalData->TRxAntDivType == 0xFF)
604 pHalData->TRxAntDivType = CG_TRX_HW_ANTDIV; /* For 88EE, 1Tx and 1RxCG are fixed.(1Ant, Tx and RxCG are both on aux port) */
606 pHalData->TRxAntDivType = registry_par->antdiv_type;
609 if (pHalData->TRxAntDivType == CG_TRX_HW_ANTDIV || pHalData->TRxAntDivType == CGCS_RX_HW_ANTDIV)
610 pHalData->AntDivCfg = 1; /* 0xC1[3] is ignored. */
612 pHalData->AntDivCfg = 0;
613 pHalData->TRxAntDivType = pHalData->TRxAntDivType; /* The value in the driver setting of device manager. */
615 DBG_88E("EEPROM : AntDivCfg = %x, TRxAntDivType = %x\n", pHalData->AntDivCfg, pHalData->TRxAntDivType);
618 void Hal_ReadThermalMeter_88E(struct adapter *Adapter, u8 *PROMContent, bool AutoloadFail)
620 struct hal_data_8188e *pHalData = Adapter->HalData;
622 /* ThermalMeter from EEPROM */
624 pHalData->EEPROMThermalMeter = PROMContent[EEPROM_THERMAL_METER_88E];
626 pHalData->EEPROMThermalMeter = EEPROM_Default_ThermalMeter_88E;
628 if (pHalData->EEPROMThermalMeter == 0xff || AutoloadFail) {
629 pHalData->bAPKThermalMeterIgnore = true;
630 pHalData->EEPROMThermalMeter = EEPROM_Default_ThermalMeter_88E;
632 DBG_88E("ThermalMeter = 0x%x\n", pHalData->EEPROMThermalMeter);