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_
|
|
|
|
|
2015-03-13 02:01:49 +00:00
|
|
|
#include <linux/firmware.h>
|
2013-05-08 21:45:39 +00:00
|
|
|
#include <drv_types.h>
|
|
|
|
#include <rtw_efuse.h>
|
|
|
|
|
|
|
|
#include <rtl8188e_hal.h>
|
|
|
|
|
|
|
|
#include <rtw_iol.h>
|
|
|
|
|
|
|
|
#include <usb_ops.h>
|
2014-12-28 17:13:03 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void iol_mode_enable(struct adapter *padapter, u8 enable)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
u8 reg_0xf0 = 0;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (enable)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Enable initial offload */
|
2013-05-08 21:45:39 +00:00
|
|
|
reg_0xf0 = rtw_read8(padapter, REG_SYS_CFG);
|
2015-08-15 21:38:30 +00:00
|
|
|
/* DBG_88E("%s reg_0xf0:0x%02x, write 0x%02x\n", __FUNCTION__, reg_0xf0, reg_0xf0|SW_OFFLOAD_EN); */
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(padapter, REG_SYS_CFG, reg_0xf0|SW_OFFLOAD_EN);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (padapter->bFWReady == false)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
printk("bFWReady == false call reset 8051...\n");
|
2013-05-08 21:45:39 +00:00
|
|
|
_8051Reset88E(padapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* disable initial offload */
|
2013-05-08 21:45:39 +00:00
|
|
|
reg_0xf0 = rtw_read8(padapter, REG_SYS_CFG);
|
2015-08-15 21:38:30 +00:00
|
|
|
/* DBG_88E("%s reg_0xf0:0x%02x, write 0x%02x\n", __FUNCTION__, reg_0xf0, reg_0xf0& ~SW_OFFLOAD_EN); */
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(padapter, REG_SYS_CFG, reg_0xf0 & ~SW_OFFLOAD_EN);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static s32 iol_execute(struct adapter *padapter, u8 control)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
s32 status = _FAIL;
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 reg_0x88 = 0,reg_1c7=0;
|
2013-05-08 21:45:39 +00:00
|
|
|
u32 start = 0, passing_time = 0;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
u32 t1,t2;
|
2013-05-08 21:45:39 +00:00
|
|
|
control = control&0x0f;
|
|
|
|
reg_0x88 = rtw_read8(padapter, REG_HMEBOX_E0);
|
2015-08-15 21:38:30 +00:00
|
|
|
/* DBG_88E("%s reg_0x88:0x%02x, write 0x%02x\n", __FUNCTION__, reg_0x88, reg_0x88|control); */
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(padapter, REG_HMEBOX_E0, reg_0x88|control);
|
|
|
|
|
2015-08-15 21:34:17 +00:00
|
|
|
t1 = start = jiffies;
|
2015-08-15 18:04:12 +00:00
|
|
|
while (
|
2015-02-20 00:51:33 +00:00
|
|
|
/* reg_1c7 = rtw_read8(padapter, 0x1c7) >1) && */
|
2014-12-17 04:09:56 +00:00
|
|
|
(reg_0x88=rtw_read8(padapter, REG_HMEBOX_E0)) & control
|
|
|
|
&& (passing_time=rtw_get_passing_time_ms(start))<1000
|
|
|
|
) {
|
2015-08-15 21:38:30 +00:00
|
|
|
/* DBG_88E("%s polling reg_0x88:0x%02x,reg_0x1c7:0x%02x\n", __FUNCTION__, reg_0x88,rtw_read8(padapter, 0x1c7) ); */
|
2015-02-20 00:51:33 +00:00
|
|
|
/* rtw_udelay_os(100); */
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
reg_0x88 = rtw_read8(padapter, REG_HMEBOX_E0);
|
2014-12-17 04:09:56 +00:00
|
|
|
status = (reg_0x88 & control)?_FAIL:_SUCCESS;
|
2015-08-15 18:02:34 +00:00
|
|
|
if (reg_0x88 & control<<4)
|
2013-05-08 21:45:39 +00:00
|
|
|
status = _FAIL;
|
2015-08-15 21:34:17 +00:00
|
|
|
t2= jiffies;
|
2015-02-20 00:51:33 +00:00
|
|
|
/* printk("==> step iol_execute : %5u reg-0x1c0= 0x%02x\n",rtw_get_time_interval_ms(t1,t2),rtw_read8(padapter, 0x1c0)); */
|
2015-08-15 21:38:30 +00:00
|
|
|
/* DBG_88E("%s in %u ms, reg_0x88:0x%02x\n", __FUNCTION__, passing_time, reg_0x88); */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
static s32 iol_InitLLTTable(
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *padapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 txpktbuf_bndy
|
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
s32 rst = _SUCCESS;
|
2013-05-08 21:45:39 +00:00
|
|
|
iol_mode_enable(padapter, 1);
|
2015-08-15 21:38:30 +00:00
|
|
|
/* DBG_88E("%s txpktbuf_bndy:%u\n", __FUNCTION__, txpktbuf_bndy); */
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(padapter, REG_TDECTRL+1, txpktbuf_bndy);
|
|
|
|
rst = iol_execute(padapter, CMD_INIT_LLT);
|
|
|
|
iol_mode_enable(padapter, 0);
|
|
|
|
return rst;
|
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
efuse_phymap_to_logical(u8 * phymap, u16 _offset, u16 _size_byte, u8 *pbuf)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 *efuseTbl = NULL;
|
|
|
|
u8 rtemp8;
|
2013-05-08 21:45:39 +00:00
|
|
|
u16 eFuse_Addr = 0;
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 offset, wren;
|
2013-05-08 21:45:39 +00:00
|
|
|
u16 i, j;
|
|
|
|
u16 **eFuseWord = NULL;
|
|
|
|
u16 efuse_utilized = 0;
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 efuse_usage = 0;
|
|
|
|
u8 u1temp = 0;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
efuseTbl = (u8*)rtw_zmalloc(EFUSE_MAP_LEN_88E);
|
2015-08-15 18:02:34 +00:00
|
|
|
if (efuseTbl == NULL)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("%s: alloc efuseTbl fail!\n", __FUNCTION__);
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
eFuseWord= (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16));
|
2015-08-15 18:02:34 +00:00
|
|
|
if (eFuseWord == NULL)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("%s: alloc eFuseWord fail!\n", __FUNCTION__);
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* 0. Refresh efuse init map as all oxFF. */
|
2013-05-08 21:45:39 +00:00
|
|
|
for (i = 0; i < EFUSE_MAX_SECTION_88E; i++)
|
|
|
|
for (j = 0; j < EFUSE_MAX_WORD_UNIT; j++)
|
|
|
|
eFuseWord[i][j] = 0xFFFF;
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* */
|
|
|
|
/* 1. Read the first byte to check if efuse is empty!!! */
|
|
|
|
/* */
|
|
|
|
/* */
|
2013-05-08 21:45:39 +00:00
|
|
|
rtemp8 = *(phymap+eFuse_Addr);
|
2015-08-15 18:02:34 +00:00
|
|
|
if (rtemp8 != 0xFF)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_utilized++;
|
2015-02-20 00:51:33 +00:00
|
|
|
/* printk("efuse_Addr-%d efuse_data=%x\n", eFuse_Addr, *rtemp8); */
|
2013-05-08 21:45:39 +00:00
|
|
|
eFuse_Addr++;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("EFUSE is empty efuse_Addr-%d efuse_data=%x\n", eFuse_Addr, rtemp8);
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* */
|
|
|
|
/* 2. Read real efuse content. Filter PG header and every section data. */
|
|
|
|
/* */
|
2015-08-15 18:04:12 +00:00
|
|
|
while ((rtemp8 != 0xFF) && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("efuse_Addr-%d efuse_data=%x\n", eFuse_Addr-1, *rtemp8)); */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Check PG header for section num. */
|
2015-08-15 18:02:34 +00:00
|
|
|
if ((rtemp8 & 0x1F ) == 0x0F) /* extended header */
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u1temp =( (rtemp8 & 0xE0) >> 5);
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("extended header u1temp=%x *rtemp&0xE0 0x%x\n", u1temp, *rtemp8 & 0xE0)); */
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-08-15 18:00:19 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("extended header u1temp=%x\n", u1temp)); */
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtemp8 = *(phymap+eFuse_Addr);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("extended header efuse_Addr-%d efuse_data=%x\n", eFuse_Addr, *rtemp8)); */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if ((rtemp8 & 0x0F) == 0x0F)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
eFuse_Addr++;
|
2014-12-17 04:09:56 +00:00
|
|
|
rtemp8 = *(phymap+eFuse_Addr);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (rtemp8 != 0xFF && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
eFuse_Addr++;
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
continue;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
offset = ((rtemp8 & 0xF0) >> 1) | u1temp;
|
|
|
|
wren = (rtemp8 & 0x0F);
|
2014-12-19 06:59:46 +00:00
|
|
|
eFuse_Addr++;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
offset = ((rtemp8 >> 4) & 0x0f);
|
2014-12-19 06:59:46 +00:00
|
|
|
wren = (rtemp8 & 0x0f);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (offset < EFUSE_MAX_SECTION_88E)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Get word enable value from PG header */
|
|
|
|
/* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Offset-%d Worden=%x\n", offset, wren)); */
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-08-15 18:06:32 +00:00
|
|
|
for (i=0; i<EFUSE_MAX_WORD_UNIT; i++)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Check word enable condition in the section */
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!(wren & 0x01))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:00:19 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Addr=%d\n", eFuse_Addr)); */
|
2013-05-08 21:45:39 +00:00
|
|
|
rtemp8 = *(phymap+eFuse_Addr);
|
|
|
|
eFuse_Addr++;
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Data=0x%x\n", *rtemp8)); */
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_utilized++;
|
|
|
|
eFuseWord[offset][i] = (rtemp8 & 0xff);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_88E)
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Addr=%d", eFuse_Addr)); */
|
2013-05-08 21:45:39 +00:00
|
|
|
rtemp8 = *(phymap+eFuse_Addr);
|
|
|
|
eFuse_Addr++;
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Data=0x%x\n", *rtemp8)); */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_utilized++;
|
2014-12-30 22:52:58 +00:00
|
|
|
eFuseWord[offset][i] |= (((u16)rtemp8 << 8) & 0xff00);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_88E)
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
wren >>= 1;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Read next PG header */
|
2014-12-17 04:09:56 +00:00
|
|
|
rtemp8 = *(phymap+eFuse_Addr);
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Addr=%d rtemp 0x%x\n", eFuse_Addr, *rtemp8)); */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (rtemp8 != 0xFF && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_utilized++;
|
|
|
|
eFuse_Addr++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* */
|
|
|
|
/* 3. Collect 16 sections and 4 word unit into Efuse map. */
|
|
|
|
/* */
|
2015-08-15 18:06:32 +00:00
|
|
|
for (i=0; i<EFUSE_MAX_SECTION_88E; i++)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:06:32 +00:00
|
|
|
for (j=0; j<EFUSE_MAX_WORD_UNIT; j++)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
efuseTbl[(i*8)+(j*2)]=(eFuseWord[i][j] & 0xff);
|
|
|
|
efuseTbl[(i*8)+((j*2)+1)]=((eFuseWord[i][j] >> 8) & 0xff);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* */
|
|
|
|
/* 4. Copy from Efuse map to output pointer memory!!! */
|
|
|
|
/* */
|
2015-08-15 18:06:32 +00:00
|
|
|
for (i=0; i<_size_byte; i++)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
pbuf[i] = efuseTbl[_offset+i];
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* */
|
|
|
|
/* 5. Calculate Efuse utilization. */
|
|
|
|
/* */
|
2014-12-30 23:50:44 +00:00
|
|
|
efuse_usage = (u8)((efuse_utilized*100)/EFUSE_REAL_CONTENT_LEN_88E);
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Adapter->HalFunc.SetHwRegHandler(Adapter, HW_VAR_EFUSE_BYTES, (u8 *)&efuse_utilized); */
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
exit:
|
2015-08-15 18:02:34 +00:00
|
|
|
if (efuseTbl)
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_mfree(efuseTbl, EFUSE_MAP_LEN_88E);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (eFuseWord)
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_mfree2d((void *)eFuseWord, EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16));
|
|
|
|
}
|
|
|
|
|
2015-01-30 03:41:53 +00:00
|
|
|
static void efuse_read_phymap_from_txpktbuf(
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *adapter,
|
2015-02-20 00:51:33 +00:00
|
|
|
int bcnhead, /* beacon head, where FW store len(2-byte) and efuse physical map. */
|
|
|
|
u8 *content, /* buffer to store efuse physical map */
|
|
|
|
u16 *size /* for efuse content: the max byte to read. will update to byte read */
|
2013-05-08 21:45:39 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
u16 dbg_addr = 0;
|
|
|
|
u32 start = 0, passing_time = 0;
|
|
|
|
u8 reg_0x143 = 0;
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 reg_0x106 = 0;
|
2015-01-27 03:14:34 +00:00
|
|
|
__le32 lo32 = 0, hi32 = 0;
|
2013-05-08 21:45:39 +00:00
|
|
|
u16 len = 0, count = 0;
|
|
|
|
int i = 0;
|
|
|
|
u16 limit = *size;
|
|
|
|
|
|
|
|
u8 *pos = content;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (bcnhead<0) /* if not valid */
|
2013-05-08 21:45:39 +00:00
|
|
|
bcnhead = rtw_read8(adapter, REG_TDECTRL+1);
|
|
|
|
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("%s bcnhead:%d\n", __FUNCTION__, bcnhead);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* reg_0x106 = rtw_read8(adapter, REG_PKT_BUFF_ACCESS_CTRL); */
|
2015-08-15 21:38:30 +00:00
|
|
|
/* DBG_88E("%s reg_0x106:0x%02x, write 0x%02x\n", __FUNCTION__, reg_0x106, 0x69); */
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(adapter, REG_PKT_BUFF_ACCESS_CTRL, TXPKT_BUF_SELECT);
|
2015-08-15 21:38:30 +00:00
|
|
|
/* DBG_88E("%s reg_0x106:0x%02x\n", __FUNCTION__, rtw_read8(adapter, 0x106)); */
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
dbg_addr = bcnhead*128/8; /* 8-bytes addressing */
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:04:12 +00:00
|
|
|
while (1)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 21:38:30 +00:00
|
|
|
/* DBG_88E("%s dbg_addr:0x%x\n", __FUNCTION__, dbg_addr+i); */
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write16(adapter, REG_PKTBUF_DBG_ADDR, dbg_addr+i);
|
|
|
|
|
2015-08-15 21:38:30 +00:00
|
|
|
/* DBG_88E("%s write reg_0x143:0x00\n", __FUNCTION__); */
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(adapter, REG_TXPKTBUF_DBG, 0);
|
2015-08-15 21:34:17 +00:00
|
|
|
start = jiffies;
|
2015-08-15 18:04:12 +00:00
|
|
|
while (!(reg_0x143=rtw_read8(adapter, REG_TXPKTBUF_DBG))/* dbg */
|
|
|
|
/* while (rtw_read8(adapter, REG_TXPKTBUF_DBG) & BIT0 */
|
2014-12-17 04:09:56 +00:00
|
|
|
&& (passing_time=rtw_get_passing_time_ms(start))<1000
|
|
|
|
) {
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("%s polling reg_0x143:0x%02x, reg_0x106:0x%02x\n", __FUNCTION__, reg_0x143, rtw_read8(adapter, 0x106));
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_usleep_os(100);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-01-27 03:14:34 +00:00
|
|
|
/* data from EEPROM needs to be in LE */
|
|
|
|
lo32 = cpu_to_le32(rtw_read32(adapter, REG_PKTBUF_DBG_DATA_L));
|
|
|
|
hi32 = cpu_to_le32(rtw_read32(adapter, REG_PKTBUF_DBG_DATA_H));
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-01-27 03:14:34 +00:00
|
|
|
if (i == 0) {
|
|
|
|
/* Although lenc is only used in a debug statement,
|
|
|
|
* do not remove it as the rtw_read16() call consumes
|
|
|
|
* 2 bytes from the EEPROM source.
|
|
|
|
*/
|
|
|
|
u16 lenc = rtw_read16(adapter, REG_PKTBUF_DBG_DATA_L);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-01-27 03:14:34 +00:00
|
|
|
len = le32_to_cpu(lo32) & 0x0000ffff;
|
|
|
|
limit = (len - 2 < limit) ? len - 2 : limit;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("%s len:%u, lenc:%u\n", __func__, len, lenc);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-01-27 03:14:34 +00:00
|
|
|
memcpy(pos, ((u8*)&lo32)+2, (limit>=count+2)?2:limit-count);
|
2014-12-17 04:09:56 +00:00
|
|
|
count+= (limit>=count+2)?2:limit-count;
|
|
|
|
pos=content+count;
|
2015-01-27 03:14:34 +00:00
|
|
|
} else {
|
|
|
|
memcpy(pos, ((u8*)&lo32), (limit>=count+4)?4:limit-count);
|
2014-12-17 04:09:56 +00:00
|
|
|
count+=(limit>=count+4)?4:limit-count;
|
|
|
|
pos=content+count;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (limit>count && len-2>count) {
|
2015-01-27 03:14:34 +00:00
|
|
|
memcpy(pos, (u8*)&hi32, (limit>=count+4)?4:limit-count);
|
2014-12-17 04:09:56 +00:00
|
|
|
count+=(limit>=count+4)?4:limit-count;
|
|
|
|
pos=content+count;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (limit<=count || len-2<=count)
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
|
|
|
i++;
|
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(adapter, REG_PKT_BUFF_ACCESS_CTRL, DISABLE_TRXPKT_BUF_ACCESS);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("%s read count:%u\n", __FUNCTION__, count);
|
2013-05-08 21:45:39 +00:00
|
|
|
*size = count;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
static s32 iol_read_efuse(
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *padapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 txpktbuf_bndy,
|
|
|
|
u16 offset,
|
|
|
|
u16 size_byte,
|
|
|
|
u8 *logical_map
|
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
s32 status = _FAIL;
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 reg_0x106 = 0;
|
2013-05-08 21:45:39 +00:00
|
|
|
u8 physical_map[512];
|
|
|
|
u16 size = 512;
|
2014-12-17 04:09:56 +00:00
|
|
|
int i;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
rtw_write8(padapter, REG_TDECTRL+1, txpktbuf_bndy);
|
2015-02-19 20:58:09 +00:00
|
|
|
memset(physical_map, 0xFF, 512);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* reg_0x106 = rtw_read8(padapter, REG_PKT_BUFF_ACCESS_CTRL); */
|
2015-08-15 21:38:30 +00:00
|
|
|
/* DBG_88E("%s reg_0x106:0x%02x, write 0x%02x\n", __FUNCTION__, reg_0x106, 0x69); */
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(padapter, REG_PKT_BUFF_ACCESS_CTRL, TXPKT_BUF_SELECT);
|
2015-08-15 21:38:30 +00:00
|
|
|
/* DBG_88E("%s reg_0x106:0x%02x\n", __FUNCTION__, rtw_read8(padapter, 0x106)); */
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
status = iol_execute(padapter, CMD_READ_EFUSE_MAP);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (status == _SUCCESS)
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_read_phymap_from_txpktbuf(padapter, txpktbuf_bndy, physical_map, &size);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_phymap_to_logical(physical_map, offset, size_byte, logical_map);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
s32 rtl8188e_iol_efuse_patch(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
s32 result = _SUCCESS;
|
2015-08-15 18:00:19 +00:00
|
|
|
printk("==> %s\n",__FUNCTION__);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:24:16 +00:00
|
|
|
if (rtw_IOL_applied(padapter)) {
|
2013-05-08 21:45:39 +00:00
|
|
|
iol_mode_enable(padapter, 1);
|
|
|
|
result = iol_execute(padapter, CMD_READ_EFUSE_MAP);
|
2015-08-15 18:02:34 +00:00
|
|
|
if (result == _SUCCESS)
|
2013-05-08 21:45:39 +00:00
|
|
|
result = iol_execute(padapter, CMD_EFUSE_PATCH);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
iol_mode_enable(padapter, 0);
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
static s32 iol_ioconfig(
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *padapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 iocfg_bndy
|
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
s32 rst = _SUCCESS;
|
|
|
|
|
2015-08-15 21:38:30 +00:00
|
|
|
/* DBG_88E("%s iocfg_bndy:%u\n", __FUNCTION__, iocfg_bndy); */
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(padapter, REG_TDECTRL+1, iocfg_bndy);
|
|
|
|
rst = iol_execute(padapter, CMD_IOCONFIG);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return rst;
|
|
|
|
}
|
|
|
|
|
2015-01-30 03:41:53 +00:00
|
|
|
static int rtl8188e_IOL_exec_cmds_sync(struct adapter *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms,u32 bndy_cnt)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 21:34:17 +00:00
|
|
|
u32 start_time = jiffies;
|
2014-12-17 04:09:56 +00:00
|
|
|
u32 passing_time_ms;
|
|
|
|
u8 polling_ret,i;
|
2013-05-08 21:45:39 +00:00
|
|
|
int ret = _FAIL;
|
2014-12-17 04:09:56 +00:00
|
|
|
u32 t1,t2;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:00:19 +00:00
|
|
|
/* printk("===> %s ,bndy_cnt = %d\n",__FUNCTION__,bndy_cnt); */
|
2013-05-08 21:45:39 +00:00
|
|
|
if (rtw_IOL_append_END_cmd(xmit_frame) != _SUCCESS)
|
|
|
|
goto exit;
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
struct pkt_attrib *pattrib = &xmit_frame->attrib;
|
2015-08-15 18:02:34 +00:00
|
|
|
if (rtw_usb_bulk_size_boundary(adapter,TXDESC_SIZE+pattrib->last_txcmdsz))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
if (rtw_IOL_append_END_cmd(xmit_frame) != _SUCCESS)
|
|
|
|
goto exit;
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
dump_mgntframe_and_wait(adapter, xmit_frame, max_wating_ms);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 21:34:17 +00:00
|
|
|
t1= jiffies;
|
2013-05-08 21:45:39 +00:00
|
|
|
iol_mode_enable(adapter, 1);
|
2015-08-15 18:24:16 +00:00
|
|
|
for (i=0;i<bndy_cnt;i++) {
|
2013-05-08 21:45:39 +00:00
|
|
|
u8 page_no = 0;
|
2014-12-17 04:09:56 +00:00
|
|
|
page_no = i*2 ;
|
2015-08-15 18:00:19 +00:00
|
|
|
/* printk(" i = %d, page_no = %d\n",i,page_no); */
|
2015-08-15 18:02:34 +00:00
|
|
|
if ( (ret = iol_ioconfig(adapter, page_no)) != _SUCCESS)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
iol_mode_enable(adapter, 0);
|
2015-08-15 21:34:17 +00:00
|
|
|
t2 = jiffies;
|
2015-02-20 00:51:33 +00:00
|
|
|
/* printk("==> %s : %5u\n",__FUNCTION__,rtw_get_time_interval_ms(t1,t2)); */
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
2015-02-20 00:51:33 +00:00
|
|
|
/* restore BCN_HEAD */
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_write8(adapter, REG_TDECTRL+1, 0);
|
2013-05-08 21:45:39 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_IOL_cmd_tx_pkt_buf_dump(struct adapter *Adapter,int data_len)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u32 fifo_data,reg_140;
|
|
|
|
u32 addr,rstatus,loop=0;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
u16 data_cnts = (data_len/8)+1;
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 *pbuf =rtw_zvmalloc(data_len+10);
|
|
|
|
printk("###### %s ######\n",__FUNCTION__);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(Adapter, REG_PKT_BUFF_ACCESS_CTRL, TXPKT_BUF_SELECT);
|
2015-08-15 18:24:16 +00:00
|
|
|
if (pbuf) {
|
|
|
|
for (addr=0;addr< data_cnts;addr++) {
|
2015-02-20 00:51:33 +00:00
|
|
|
/* printk("==> addr:0x%02x\n",addr); */
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write32(Adapter,0x140,addr);
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_usleep_os(2);
|
2014-12-17 04:09:56 +00:00
|
|
|
loop=0;
|
|
|
|
do{
|
2014-12-19 06:59:46 +00:00
|
|
|
rstatus=(reg_140=rtw_read32(Adapter,REG_PKTBUF_DBG_CTRL)&BIT24);
|
2015-02-20 00:51:33 +00:00
|
|
|
/* printk("rstatus = %02x, reg_140:0x%08x\n",rstatus,reg_140); */
|
2015-08-15 18:24:16 +00:00
|
|
|
if (rstatus) {
|
2014-12-17 04:09:56 +00:00
|
|
|
fifo_data = rtw_read32(Adapter,REG_PKTBUF_DBG_DATA_L);
|
2015-02-20 00:51:33 +00:00
|
|
|
/* printk("fifo_data_144:0x%08x\n",fifo_data); */
|
2015-02-19 20:50:04 +00:00
|
|
|
memcpy(pbuf+(addr*8),&fifo_data , 4);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
fifo_data = rtw_read32(Adapter,REG_PKTBUF_DBG_DATA_H);
|
2015-02-20 00:51:33 +00:00
|
|
|
/* printk("fifo_data_148:0x%08x\n",fifo_data); */
|
2015-02-19 20:50:04 +00:00
|
|
|
memcpy(pbuf+(addr*8+4), &fifo_data, 4);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
rtw_usleep_os(2);
|
2015-08-15 18:04:12 +00:00
|
|
|
}while ( !rstatus && (loop++ <10));
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_IOL_cmd_buf_dump(Adapter,data_len,pbuf);
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_vmfree(pbuf, data_len+10);
|
|
|
|
|
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
printk("###### %s ######\n",__FUNCTION__);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_FWDownloadEnable(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * padapter,
|
|
|
|
bool enable
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 tmp;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (enable)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* MCU firmware download enable. */
|
2013-05-08 21:45:39 +00:00
|
|
|
tmp = rtw_read8(padapter, REG_MCUFWDL);
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_write8(padapter, REG_MCUFWDL, tmp|0x01);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* 8051 reset */
|
2013-05-08 21:45:39 +00:00
|
|
|
tmp = rtw_read8(padapter, REG_MCUFWDL+2);
|
|
|
|
rtw_write8(padapter, REG_MCUFWDL+2, tmp&0xf7);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* MCU firmware download disable. */
|
2013-05-08 21:45:39 +00:00
|
|
|
tmp = rtw_read8(padapter, REG_MCUFWDL);
|
|
|
|
rtw_write8(padapter, REG_MCUFWDL, tmp&0xfe);
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Reserved for fw extension. */
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(padapter, REG_MCUFWDL+1, 0x00);
|
|
|
|
}
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
#define MAX_REG_BOLCK_SIZE 196
|
2014-12-17 04:09:56 +00:00
|
|
|
static int
|
|
|
|
_BlockWrite(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * padapter,
|
|
|
|
void * buffer,
|
|
|
|
u32 buffSize
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
int ret = _SUCCESS;
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
u32 blockSize_p1 = 4; /* (Default) Phase #1 : PCI muse use 4-byte write to download FW */
|
|
|
|
u32 blockSize_p2 = 8; /* Phase #2 : Use 8-byte, if Phase#1 use big size to write FW. */
|
|
|
|
u32 blockSize_p3 = 1; /* Phase #3 : Use 1-byte, the remnant of FW image. */
|
2014-12-17 04:09:56 +00:00
|
|
|
u32 blockCount_p1 = 0, blockCount_p2 = 0, blockCount_p3 = 0;
|
|
|
|
u32 remainSize_p1 = 0, remainSize_p2 = 0;
|
|
|
|
u8 *bufferPtr = (u8*)buffer;
|
|
|
|
u32 i=0, offset=0;
|
2013-05-08 21:45:39 +00:00
|
|
|
blockSize_p1 = MAX_REG_BOLCK_SIZE;
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* 3 Phase #1 */
|
2013-05-08 21:45:39 +00:00
|
|
|
blockCount_p1 = buffSize / blockSize_p1;
|
|
|
|
remainSize_p1 = buffSize % blockSize_p1;
|
|
|
|
|
|
|
|
if (blockCount_p1) {
|
|
|
|
RT_TRACE(_module_hal_init_c_, _drv_notice_,
|
2014-12-17 04:09:56 +00:00
|
|
|
("_BlockWrite: [P1] buffSize(%d) blockSize_p1(%d) blockCount_p1(%d) remainSize_p1(%d)\n",
|
|
|
|
buffSize, blockSize_p1, blockCount_p1, remainSize_p1));
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
for (i = 0; i < blockCount_p1; i++)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
ret = rtw_writeN(padapter, (FW_8188E_START_ADDRESS + i * blockSize_p1), blockSize_p1, (bufferPtr + i * blockSize_p1));
|
2015-08-15 18:02:34 +00:00
|
|
|
if (ret == _FAIL)
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* 3 Phase #2 */
|
2014-12-17 04:09:56 +00:00
|
|
|
if (remainSize_p1)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
offset = blockCount_p1 * blockSize_p1;
|
|
|
|
|
|
|
|
blockCount_p2 = remainSize_p1/blockSize_p2;
|
|
|
|
remainSize_p2 = remainSize_p1%blockSize_p2;
|
|
|
|
|
|
|
|
if (blockCount_p2) {
|
|
|
|
RT_TRACE(_module_hal_init_c_, _drv_notice_,
|
2014-12-17 04:09:56 +00:00
|
|
|
("_BlockWrite: [P2] buffSize_p2(%d) blockSize_p2(%d) blockCount_p2(%d) remainSize_p2(%d)\n",
|
|
|
|
(buffSize-offset), blockSize_p2 ,blockCount_p2, remainSize_p2));
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < blockCount_p2; i++) {
|
|
|
|
ret = rtw_writeN(padapter, (FW_8188E_START_ADDRESS + offset + i*blockSize_p2), blockSize_p2, (bufferPtr + offset + i*blockSize_p2));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (ret == _FAIL)
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* 3 Phase #3 */
|
2014-12-17 04:09:56 +00:00
|
|
|
if (remainSize_p2)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
offset = (blockCount_p1 * blockSize_p1) + (blockCount_p2 * blockSize_p2);
|
|
|
|
|
|
|
|
blockCount_p3 = remainSize_p2 / blockSize_p3;
|
|
|
|
|
|
|
|
RT_TRACE(_module_hal_init_c_, _drv_notice_,
|
2014-12-17 04:09:56 +00:00
|
|
|
("_BlockWrite: [P3] buffSize_p3(%d) blockSize_p3(%d) blockCount_p3(%d)\n",
|
|
|
|
(buffSize-offset), blockSize_p3, blockCount_p3));
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2015-08-15 18:24:16 +00:00
|
|
|
for (i = 0 ; i < blockCount_p3 ; i++) {
|
2014-12-17 04:09:56 +00:00
|
|
|
ret =rtw_write8(padapter, (FW_8188E_START_ADDRESS + offset + i), *(bufferPtr + offset + i));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (ret == _FAIL)
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
static int
|
|
|
|
_PageWrite(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter *padapter,
|
|
|
|
u32 page,
|
|
|
|
void * buffer,
|
|
|
|
u32 size
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
u8 value8;
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 u8Page = (u8) (page & 0x07) ;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
value8 = (rtw_read8(padapter, REG_MCUFWDL+2) & 0xF8) | u8Page ;
|
|
|
|
rtw_write8(padapter, REG_MCUFWDL+2,value8);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
return _BlockWrite(padapter,buffer,size);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
_FillDummy(
|
|
|
|
u8* pFwBuf,
|
|
|
|
u32* pFwLen
|
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u32 FwLen = *pFwLen;
|
|
|
|
u8 remain = (u8)(FwLen%4);
|
2015-08-15 18:22:58 +00:00
|
|
|
remain = (remain== 0)?0:(4-remain);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-08-15 18:04:12 +00:00
|
|
|
while (remain>0)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
pFwBuf[FwLen] = 0;
|
|
|
|
FwLen++;
|
|
|
|
remain--;
|
|
|
|
}
|
|
|
|
|
|
|
|
*pFwLen = FwLen;
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
static int
|
|
|
|
_WriteFW(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * padapter,
|
|
|
|
void * buffer,
|
|
|
|
u32 size
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Since we need dynamic decide method of dwonload fw, so we call this function to get chip version. */
|
|
|
|
/* We can remove _ReadChipVersion from ReadpadapterInfo8192C later. */
|
2014-12-17 04:09:56 +00:00
|
|
|
int ret = _SUCCESS;
|
2014-12-19 06:59:46 +00:00
|
|
|
u32 pageNums,remainSize ;
|
|
|
|
u32 page, offset;
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 *bufferPtr = (u8*)buffer;
|
|
|
|
|
|
|
|
pageNums = size / MAX_PAGE_SIZE ;
|
2013-05-08 21:45:39 +00:00
|
|
|
remainSize = size % MAX_PAGE_SIZE;
|
|
|
|
|
|
|
|
for (page = 0; page < pageNums; page++) {
|
|
|
|
offset = page * MAX_PAGE_SIZE;
|
|
|
|
ret = _PageWrite(padapter, page, bufferPtr+offset, MAX_PAGE_SIZE);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (ret == _FAIL)
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
if (remainSize) {
|
|
|
|
offset = pageNums * MAX_PAGE_SIZE;
|
|
|
|
page = pageNums;
|
|
|
|
ret = _PageWrite(padapter, page, bufferPtr+offset, remainSize);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (ret == _FAIL)
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
RT_TRACE(_module_hal_init_c_, _drv_info_, ("_WriteFW Done- for Normal chip.\n"));
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-01-30 03:41:53 +00:00
|
|
|
static void _MCUIO_Reset88E(struct adapter *padapter,u8 bReset)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
u8 u1bTmp;
|
|
|
|
|
2015-08-15 18:24:16 +00:00
|
|
|
if (bReset==true) {
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Reset MCU IO Wrapper- sugggest by SD1-Gimmy */
|
2014-12-17 04:09:56 +00:00
|
|
|
u1bTmp = rtw_read8(padapter, REG_RSV_CTRL+1);
|
|
|
|
rtw_write8(padapter,REG_RSV_CTRL+1, (u1bTmp&(~BIT3)));
|
2015-08-15 18:27:00 +00:00
|
|
|
} else {
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Enable MCU IO Wrapper */
|
2014-12-17 04:09:56 +00:00
|
|
|
u1bTmp = rtw_read8(padapter, REG_RSV_CTRL+1);
|
|
|
|
rtw_write8(padapter, REG_RSV_CTRL+1, u1bTmp|BIT3);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
void _8051Reset88E(struct adapter *padapter)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
u8 u1bTmp;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
_MCUIO_Reset88E(padapter,true);
|
2013-05-08 21:45:39 +00:00
|
|
|
u1bTmp = rtw_read8(padapter, REG_SYS_FUNC_EN+1);
|
|
|
|
rtw_write8(padapter, REG_SYS_FUNC_EN+1, u1bTmp&(~BIT2));
|
2014-12-29 02:13:24 +00:00
|
|
|
_MCUIO_Reset88E(padapter,false);
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(padapter, REG_SYS_FUNC_EN+1, u1bTmp|(BIT2));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("=====> _8051Reset88E(): 8051 reset success .\n");
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static s32 _FWFreeToGo(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
u32 counter = 0;
|
|
|
|
u32 value32;
|
2014-12-19 06:59:46 +00:00
|
|
|
u8 value8;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* polling CheckSum report */
|
2013-05-08 21:45:39 +00:00
|
|
|
do {
|
|
|
|
value32 = rtw_read32(padapter, REG_MCUFWDL);
|
2014-12-17 04:09:56 +00:00
|
|
|
if (value32 & FWDL_ChkSum_rpt) break;
|
2013-05-08 21:45:39 +00:00
|
|
|
} while (counter++ < POLLING_READY_TIMEOUT_COUNT);
|
|
|
|
|
|
|
|
if (counter >= POLLING_READY_TIMEOUT_COUNT) {
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("%s: chksum report fail! REG_MCUFWDL:0x%08x\n", __FUNCTION__, value32);
|
2013-05-08 21:45:39 +00:00
|
|
|
return _FAIL;
|
|
|
|
}
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("%s: Checksum report OK! REG_MCUFWDL:0x%08x\n", __FUNCTION__, value32);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
value32 = rtw_read32(padapter, REG_MCUFWDL);
|
|
|
|
value32 |= MCUFWDL_RDY;
|
|
|
|
value32 &= ~WINTINI_RDY;
|
|
|
|
rtw_write32(padapter, REG_MCUFWDL, value32);
|
|
|
|
|
|
|
|
_8051Reset88E(padapter);
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* polling for FW ready */
|
2013-05-08 21:45:39 +00:00
|
|
|
counter = 0;
|
|
|
|
do {
|
|
|
|
value32 = rtw_read32(padapter, REG_MCUFWDL);
|
|
|
|
if (value32 & WINTINI_RDY) {
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("%s: Polling FW ready success!! REG_MCUFWDL:0x%08x\n", __FUNCTION__, value32);
|
2013-05-08 21:45:39 +00:00
|
|
|
return _SUCCESS;
|
|
|
|
}
|
|
|
|
rtw_udelay_os(5);
|
|
|
|
} while (counter++ < POLLING_READY_TIMEOUT_COUNT);
|
|
|
|
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E ("%s: Polling FW ready fail!! REG_MCUFWDL:0x%08x\n", __FUNCTION__, value32);
|
2013-05-08 21:45:39 +00:00
|
|
|
return _FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define IS_FW_81xxC(padapter) (((GET_HAL_DATA(padapter))->FirmwareSignature & 0xFFF0) == 0x88C0)
|
|
|
|
|
2015-03-13 02:01:49 +00:00
|
|
|
static int load_firmware(struct rt_firmware *pFirmware, struct device *device, const char *fw_name)
|
|
|
|
{
|
|
|
|
s32 rtStatus = _SUCCESS;
|
|
|
|
const struct firmware *fw;
|
|
|
|
int err = request_firmware(&fw, fw_name, device);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-03-13 02:01:49 +00:00
|
|
|
if (err) {
|
|
|
|
pr_err("Request firmware failed with error 0x%x\n", err);
|
|
|
|
rtStatus = _FAIL;
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
if (!fw) {
|
|
|
|
pr_err("Firmware %s not available\n", fw_name);
|
|
|
|
rtStatus = _FAIL;
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
if (fw->size > FW_8188E_SIZE) {
|
|
|
|
rtStatus = _FAIL;
|
|
|
|
RT_TRACE(_module_hal_init_c_, _drv_err_, ("Firmware size exceed 0x%X. Check it.\n", FW_8188E_SIZE));
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
pFirmware->szFwBuffer = kzalloc(FW_8188E_SIZE, GFP_KERNEL);
|
|
|
|
if (!pFirmware->szFwBuffer) {
|
|
|
|
pr_err("Failed to allocate pFirmware->szFwBuffer\n");
|
|
|
|
rtStatus = _FAIL;
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
memcpy(pFirmware->szFwBuffer, fw->data, fw->size);
|
|
|
|
pFirmware->ulFwLength = fw->size;
|
|
|
|
release_firmware(fw);
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E_LEVEL(_drv_info_, "+%s: !bUsedWoWLANFw, FmrmwareLen:%d+\n", __func__, pFirmware->ulFwLength);
|
2015-03-13 02:01:49 +00:00
|
|
|
|
|
|
|
Exit:
|
|
|
|
return rtStatus;
|
|
|
|
}
|
2015-03-02 23:03:18 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Description: */
|
|
|
|
/* Download 8192C firmware code. */
|
2014-12-17 23:13:53 +00:00
|
|
|
s32 rtl8188e_FirmwareDownload(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
s32 rtStatus = _SUCCESS;
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 writeFW_retry = 0;
|
|
|
|
u32 fwdl_start_time;
|
2014-12-19 06:59:46 +00:00
|
|
|
PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter);
|
2015-03-13 02:01:49 +00:00
|
|
|
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
|
|
|
|
struct device *device = dvobj_to_dev(dvobj);
|
|
|
|
struct rt_firmware_hdr *pFwHdr = NULL;
|
|
|
|
u8 *pFirmwareBuf;
|
|
|
|
u32 FirmwareLen;
|
|
|
|
const char *fw_name = "rtlwifi/rtl8188eufw.bin";
|
|
|
|
static int log_version;
|
|
|
|
|
|
|
|
RT_TRACE(_module_hal_init_c_, _drv_info_, ("+%s\n", __func__));
|
|
|
|
if (!dvobj->firmware.szFwBuffer)
|
|
|
|
rtStatus = load_firmware(&dvobj->firmware, device, fw_name);
|
|
|
|
if (rtStatus == _FAIL) {
|
|
|
|
dvobj->firmware.szFwBuffer = NULL;
|
2013-10-19 21:23:12 +00:00
|
|
|
goto Exit;
|
|
|
|
}
|
2015-03-13 02:01:49 +00:00
|
|
|
pFirmwareBuf = dvobj->firmware.szFwBuffer;
|
|
|
|
FirmwareLen = dvobj->firmware.ulFwLength;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* To Check Fw header. Added by tynli. 2009.12.04. */
|
2015-03-13 02:01:49 +00:00
|
|
|
pFwHdr = (struct rt_firmware_hdr *)dvobj->firmware.szFwBuffer;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
pHalData->FirmwareVersion = le16_to_cpu(pFwHdr->Version);
|
|
|
|
pHalData->FirmwareSubVersion = pFwHdr->Subversion;
|
|
|
|
pHalData->FirmwareSignature = le16_to_cpu(pFwHdr->Signature);
|
|
|
|
|
2015-03-13 02:01:49 +00:00
|
|
|
if (!log_version++) {
|
|
|
|
pr_info("%sLoaded firmware file %s\n", DRIVER_PREFIX, fw_name);
|
|
|
|
pr_info("%sFirmware Version %d, SubVersion %d, Signature 0x%x\n",
|
|
|
|
DRIVER_PREFIX, pHalData->FirmwareVersion,
|
|
|
|
pHalData->FirmwareSubVersion, pHalData->FirmwareSignature);
|
|
|
|
}
|
|
|
|
if (IS_FW_HEADER_EXIST(pFwHdr)) {
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Shift 32 bytes for FW header */
|
2013-05-08 21:45:39 +00:00
|
|
|
pFirmwareBuf = pFirmwareBuf + 32;
|
|
|
|
FirmwareLen = FirmwareLen - 32;
|
|
|
|
}
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Suggested by Filen. If 8051 is running in RAM code, driver should inform Fw to reset by itself, */
|
|
|
|
/* or it will cause download Fw fail. 2010.02.01. by tynli. */
|
2015-03-13 02:01:49 +00:00
|
|
|
if (rtw_read8(padapter, REG_MCUFWDL) & RAM_DL_SEL) { /* 8051 RAM code */
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(padapter, REG_MCUFWDL, 0x00);
|
2014-12-19 06:59:46 +00:00
|
|
|
_8051Reset88E(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
_FWDownloadEnable(padapter, true);
|
2015-03-13 02:01:49 +00:00
|
|
|
fwdl_start_time = jiffies;
|
|
|
|
while (1) {
|
2015-02-20 00:51:33 +00:00
|
|
|
/* reset the FWDL chksum */
|
2015-03-13 02:01:49 +00:00
|
|
|
rtw_write8(padapter, REG_MCUFWDL, rtw_read8(padapter, REG_MCUFWDL) | FWDL_ChkSum_rpt);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtStatus = _WriteFW(padapter, pFirmwareBuf, FirmwareLen);
|
|
|
|
|
2015-03-13 02:01:49 +00:00
|
|
|
if (rtStatus == _SUCCESS ||
|
|
|
|
(rtw_get_passing_time_ms(fwdl_start_time) > 500 && writeFW_retry++ >= 3))
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
2015-03-13 02:01:49 +00:00
|
|
|
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("%s writeFW_retry:%u, time after fwdl_start_time:%ums\n",
|
2015-03-13 02:01:49 +00:00
|
|
|
__func__, writeFW_retry, rtw_get_passing_time_ms(fwdl_start_time)
|
|
|
|
);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-29 02:13:24 +00:00
|
|
|
_FWDownloadEnable(padapter, false);
|
2015-03-13 02:01:49 +00:00
|
|
|
if (_SUCCESS != rtStatus) {
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("DL Firmware failed!\n");
|
2013-05-08 21:45:39 +00:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
rtStatus = _FWFreeToGo(padapter);
|
|
|
|
if (_SUCCESS != rtStatus) {
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("DL Firmware failed!\n");
|
2013-05-08 21:45:39 +00:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
RT_TRACE(_module_hal_init_c_, _drv_info_, ("Firmware is ready to run!\n"));
|
|
|
|
|
2014-02-14 16:17:29 +00:00
|
|
|
Exit:
|
2013-05-08 21:45:39 +00:00
|
|
|
return rtStatus;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtl8188e_InitializeFirmwareVars(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter);
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Init Fw LPS related. */
|
2014-12-29 02:13:24 +00:00
|
|
|
adapter_to_pwrctl(padapter)->bFwCurrentInPSMode = false;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Init H2C counter. by tynli. 2009.12.09. */
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData->LastHMEBoxNum = 0;
|
|
|
|
}
|
2014-12-01 22:31:15 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void rtl8188e_free_hal_data(struct adapter *padapter)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (padapter->HalData) {
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_mfree(padapter->HalData, sizeof(HAL_DATA_TYPE));
|
|
|
|
padapter->HalData = NULL;
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Efuse related code */
|
2013-05-08 21:45:39 +00:00
|
|
|
enum{
|
|
|
|
VOLTAGE_V25 = 0x03,
|
|
|
|
LDOE25_SHIFT = 28 ,
|
|
|
|
};
|
|
|
|
|
2015-03-02 23:21:23 +00:00
|
|
|
static bool
|
2013-05-08 21:45:39 +00:00
|
|
|
hal_EfusePgPacketWrite2ByteHeader(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * pAdapter,
|
|
|
|
u8 efuseType,
|
|
|
|
u16 *pAddr,
|
|
|
|
PPGPKT_STRUCT pTargetPkt,
|
|
|
|
bool bPseudoTest);
|
2015-03-02 23:21:23 +00:00
|
|
|
static bool
|
2013-05-08 21:45:39 +00:00
|
|
|
hal_EfusePgPacketWrite1ByteHeader(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * pAdapter,
|
|
|
|
u8 efuseType,
|
|
|
|
u16 *pAddr,
|
|
|
|
PPGPKT_STRUCT pTargetPkt,
|
|
|
|
bool bPseudoTest);
|
2015-03-02 23:21:23 +00:00
|
|
|
static bool
|
2013-05-08 21:45:39 +00:00
|
|
|
hal_EfusePgPacketWriteData(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * pAdapter,
|
|
|
|
u8 efuseType,
|
|
|
|
u16 *pAddr,
|
|
|
|
PPGPKT_STRUCT pTargetPkt,
|
|
|
|
bool bPseudoTest);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2013-05-08 21:45:39 +00:00
|
|
|
hal_EfusePowerSwitch_RTL8188E(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter *pAdapter,
|
|
|
|
u8 bWrite,
|
|
|
|
u8 PwrState)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 tempval;
|
2013-05-08 21:45:39 +00:00
|
|
|
u16 tmpV16;
|
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if (PwrState == true)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(pAdapter, REG_EFUSE_ACCESS, EFUSE_ACCESS_ON);
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* 1.2V Power: From VDDON with Power Cut(0x0000h[15]), defualt valid */
|
2014-12-17 04:09:56 +00:00
|
|
|
tmpV16 = rtw_read16(pAdapter,REG_SYS_ISO_CTRL);
|
2015-08-15 18:24:16 +00:00
|
|
|
if ( ! (tmpV16 & PWC_EV12V ) ) {
|
2014-12-17 04:09:56 +00:00
|
|
|
tmpV16 |= PWC_EV12V ;
|
|
|
|
rtw_write16(pAdapter,REG_SYS_ISO_CTRL,tmpV16);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Reset: 0x0000h[28], default valid */
|
2014-12-17 04:09:56 +00:00
|
|
|
tmpV16 = rtw_read16(pAdapter,REG_SYS_FUNC_EN);
|
2015-08-15 18:24:16 +00:00
|
|
|
if ( !(tmpV16 & FEN_ELDR) ) {
|
2014-12-17 04:09:56 +00:00
|
|
|
tmpV16 |= FEN_ELDR ;
|
|
|
|
rtw_write16(pAdapter,REG_SYS_FUNC_EN,tmpV16);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Clock: Gated(0x0008h[5]) 8M(0x0008h[1]) clock from ANA, default valid */
|
2014-12-17 04:09:56 +00:00
|
|
|
tmpV16 = rtw_read16(pAdapter,REG_SYS_CLKR);
|
2015-08-15 18:24:16 +00:00
|
|
|
if ( (!(tmpV16 & LOADER_CLK_EN) ) ||(!(tmpV16 & ANA8M) ) ) {
|
2014-12-17 04:09:56 +00:00
|
|
|
tmpV16 |= (LOADER_CLK_EN |ANA8M ) ;
|
|
|
|
rtw_write16(pAdapter,REG_SYS_CLKR,tmpV16);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (bWrite == true)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Enable LDO 2.5V before read/write action */
|
2013-05-08 21:45:39 +00:00
|
|
|
tempval = rtw_read8(pAdapter, EFUSE_TEST+3);
|
|
|
|
tempval &= 0x0F;
|
|
|
|
tempval |= (VOLTAGE_V25 << 4);
|
|
|
|
rtw_write8(pAdapter, EFUSE_TEST+3, (tempval | 0x80));
|
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(pAdapter, REG_EFUSE_ACCESS, EFUSE_ACCESS_OFF);
|
|
|
|
|
2015-08-15 18:24:16 +00:00
|
|
|
if (bWrite == true) {
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Disable LDO 2.5V after read/write action */
|
2013-05-08 21:45:39 +00:00
|
|
|
tempval = rtw_read8(pAdapter, EFUSE_TEST+3);
|
|
|
|
rtw_write8(pAdapter, EFUSE_TEST+3, (tempval & 0x7F));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2013-05-08 21:45:39 +00:00
|
|
|
rtl8188e_EfusePowerSwitch(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter *pAdapter,
|
|
|
|
u8 bWrite,
|
|
|
|
u8 PwrState)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
hal_EfusePowerSwitch_RTL8188E(pAdapter, bWrite, PwrState);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static bool efuse_read_phymap(
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *Adapter,
|
2015-02-20 00:51:33 +00:00
|
|
|
u8 *pbuf, /* buffer to store efuse physical map */
|
|
|
|
u16 *size /* the max byte to read. will update to byte read */
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 *pos = pbuf;
|
|
|
|
u16 limit = *size;
|
|
|
|
u16 addr = 0;
|
2014-12-29 02:13:24 +00:00
|
|
|
bool reach_end = false;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* */
|
|
|
|
/* Refresh efuse init map as all 0xFF. */
|
|
|
|
/* */
|
2015-02-19 20:58:09 +00:00
|
|
|
memset(pbuf, 0xFF, limit);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* */
|
|
|
|
/* Read physical efuse content. */
|
|
|
|
/* */
|
2015-08-15 18:04:12 +00:00
|
|
|
while (addr < limit)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
ReadEFuseByte(Adapter, addr, pos, false);
|
2015-08-15 18:02:34 +00:00
|
|
|
if (*pos != 0xFF)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
pos++;
|
|
|
|
addr++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
reach_end = true;
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*size = addr;
|
|
|
|
|
|
|
|
return reach_end;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
Hal_EfuseReadEFuse88E(
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter * Adapter,
|
2013-05-08 21:45:39 +00:00
|
|
|
u16 _offset,
|
2014-12-19 06:59:46 +00:00
|
|
|
u16 _size_byte,
|
|
|
|
u8 *pbuf,
|
2015-03-13 17:06:38 +00:00
|
|
|
bool bPseudoTest
|
2013-05-08 21:45:39 +00:00
|
|
|
)
|
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* u8 efuseTbl[EFUSE_MAP_LEN_88E]; */
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 *efuseTbl = NULL;
|
|
|
|
u8 rtemp8[1];
|
2013-05-08 21:45:39 +00:00
|
|
|
u16 eFuse_Addr = 0;
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 offset, wren;
|
2013-05-08 21:45:39 +00:00
|
|
|
u16 i, j;
|
2015-02-20 00:51:33 +00:00
|
|
|
/* u16 eFuseWord[EFUSE_MAX_SECTION_88E][EFUSE_MAX_WORD_UNIT]; */
|
2013-05-08 21:45:39 +00:00
|
|
|
u16 **eFuseWord = NULL;
|
|
|
|
u16 efuse_utilized = 0;
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 efuse_usage = 0;
|
|
|
|
u8 u1temp = 0;
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* */
|
|
|
|
/* Do NOT excess total size of EFuse table. Added by Roger, 2008.11.10. */
|
|
|
|
/* */
|
2015-08-15 18:02:34 +00:00
|
|
|
if ((_offset + _size_byte)>EFUSE_MAP_LEN_88E)
|
2015-02-20 00:51:33 +00:00
|
|
|
{/* total E-Fuse table is 512bytes */
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_8192C("Hal_EfuseReadEFuse88E(): Invalid offset(%#x) with read bytes(%#x)!!\n",_offset, _size_byte);
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
efuseTbl = (u8*)rtw_zmalloc(EFUSE_MAP_LEN_88E);
|
2015-08-15 18:02:34 +00:00
|
|
|
if (efuseTbl == NULL)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("%s: alloc efuseTbl fail!\n", __FUNCTION__);
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
eFuseWord= (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16));
|
2015-08-15 18:02:34 +00:00
|
|
|
if (eFuseWord == NULL)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("%s: alloc eFuseWord fail!\n", __FUNCTION__);
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* 0. Refresh efuse init map as all oxFF. */
|
2013-05-08 21:45:39 +00:00
|
|
|
for (i = 0; i < EFUSE_MAX_SECTION_88E; i++)
|
|
|
|
for (j = 0; j < EFUSE_MAX_WORD_UNIT; j++)
|
|
|
|
eFuseWord[i][j] = 0xFFFF;
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* */
|
|
|
|
/* 1. Read the first byte to check if efuse is empty!!! */
|
|
|
|
/* */
|
|
|
|
/* */
|
2014-12-19 06:59:46 +00:00
|
|
|
ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest);
|
2015-08-15 18:02:34 +00:00
|
|
|
if (*rtemp8 != 0xFF)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_utilized++;
|
2015-02-20 00:51:33 +00:00
|
|
|
/* DBG_8192C("efuse_Addr-%d efuse_data=%x\n", eFuse_Addr, *rtemp8); */
|
2013-05-08 21:45:39 +00:00
|
|
|
eFuse_Addr++;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("EFUSE is empty efuse_Addr-%d efuse_data=%x\n", eFuse_Addr, *rtemp8);
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* */
|
|
|
|
/* 2. Read real efuse content. Filter PG header and every section data. */
|
|
|
|
/* */
|
2015-08-15 18:04:12 +00:00
|
|
|
while ((*rtemp8 != 0xFF) && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("efuse_Addr-%d efuse_data=%x\n", eFuse_Addr-1, *rtemp8)); */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Check PG header for section num. */
|
2015-08-15 18:02:34 +00:00
|
|
|
if ((*rtemp8 & 0x1F ) == 0x0F) /* extended header */
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u1temp =( (*rtemp8 & 0xE0) >> 5);
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("extended header u1temp=%x *rtemp&0xE0 0x%x\n", u1temp, *rtemp8 & 0xE0)); */
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-08-15 18:00:19 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("extended header u1temp=%x\n", u1temp)); */
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest);
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("extended header efuse_Addr-%d efuse_data=%x\n", eFuse_Addr, *rtemp8)); */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if ((*rtemp8 & 0x0F) == 0x0F)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
eFuse_Addr++;
|
|
|
|
ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest);
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (*rtemp8 != 0xFF && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
eFuse_Addr++;
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
continue;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
offset = ((*rtemp8 & 0xF0) >> 1) | u1temp;
|
|
|
|
wren = (*rtemp8 & 0x0F);
|
2014-12-19 06:59:46 +00:00
|
|
|
eFuse_Addr++;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
offset = ((*rtemp8 >> 4) & 0x0f);
|
2014-12-19 06:59:46 +00:00
|
|
|
wren = (*rtemp8 & 0x0f);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (offset < EFUSE_MAX_SECTION_88E)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Get word enable value from PG header */
|
|
|
|
/* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Offset-%d Worden=%x\n", offset, wren)); */
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-08-15 18:06:32 +00:00
|
|
|
for (i=0; i<EFUSE_MAX_WORD_UNIT; i++)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Check word enable condition in the section */
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!(wren & 0x01))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:00:19 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Addr=%d\n", eFuse_Addr)); */
|
2014-12-19 06:59:46 +00:00
|
|
|
ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest);
|
2013-05-08 21:45:39 +00:00
|
|
|
eFuse_Addr++;
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Data=0x%x\n", *rtemp8)); */
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_utilized++;
|
|
|
|
eFuseWord[offset][i] = (*rtemp8 & 0xff);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_88E)
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Addr=%d", eFuse_Addr)); */
|
2014-12-19 06:59:46 +00:00
|
|
|
ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest);
|
2013-05-08 21:45:39 +00:00
|
|
|
eFuse_Addr++;
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Data=0x%x\n", *rtemp8)); */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_utilized++;
|
2014-12-30 22:52:58 +00:00
|
|
|
eFuseWord[offset][i] |= (((u16)*rtemp8 << 8) & 0xff00);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_88E)
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
wren >>= 1;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Read next PG header */
|
2014-12-19 06:59:46 +00:00
|
|
|
ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest);
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Addr=%d rtemp 0x%x\n", eFuse_Addr, *rtemp8)); */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (*rtemp8 != 0xFF && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_utilized++;
|
|
|
|
eFuse_Addr++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* */
|
|
|
|
/* 3. Collect 16 sections and 4 word unit into Efuse map. */
|
|
|
|
/* */
|
2015-08-15 18:06:32 +00:00
|
|
|
for (i=0; i<EFUSE_MAX_SECTION_88E; i++)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:06:32 +00:00
|
|
|
for (j=0; j<EFUSE_MAX_WORD_UNIT; j++)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
efuseTbl[(i*8)+(j*2)]=(eFuseWord[i][j] & 0xff);
|
|
|
|
efuseTbl[(i*8)+((j*2)+1)]=((eFuseWord[i][j] >> 8) & 0xff);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* */
|
|
|
|
/* 4. Copy from Efuse map to output pointer memory!!! */
|
|
|
|
/* */
|
2015-08-15 18:06:32 +00:00
|
|
|
for (i=0; i<_size_byte; i++)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
pbuf[i] = efuseTbl[_offset+i];
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* */
|
|
|
|
/* 5. Calculate Efuse utilization. */
|
|
|
|
/* */
|
2014-12-30 23:50:44 +00:00
|
|
|
efuse_usage = (u8)((eFuse_Addr*100)/EFUSE_REAL_CONTENT_LEN_88E);
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_hal_set_hwreg(Adapter, HW_VAR_EFUSE_BYTES, (u8 *)&eFuse_Addr);
|
|
|
|
|
|
|
|
exit:
|
2015-08-15 18:02:34 +00:00
|
|
|
if (efuseTbl)
|
2014-12-17 04:09:56 +00:00
|
|
|
rtw_mfree(efuseTbl, EFUSE_MAP_LEN_88E);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (eFuseWord)
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_mfree2d((void *)eFuseWord, EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16));
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-03-02 23:21:23 +00:00
|
|
|
static bool
|
2014-12-17 04:09:56 +00:00
|
|
|
Hal_EfuseSwitchToBank(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter *pAdapter,
|
|
|
|
u8 bank,
|
|
|
|
bool bPseudoTest
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
|
|
|
{
|
2015-03-02 23:21:23 +00:00
|
|
|
bool bRet = false;
|
2014-12-17 04:09:56 +00:00
|
|
|
u32 value32=0;
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("Efuse switch bank to %d\n", bank)); */
|
2015-08-15 18:02:34 +00:00
|
|
|
if (bPseudoTest)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
fakeEfuseBank = bank;
|
2014-12-29 02:13:24 +00:00
|
|
|
bRet = true;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (IS_HARDWARE_TYPE_8723A(pAdapter) &&
|
2014-12-17 04:09:56 +00:00
|
|
|
INCLUDE_MULTI_FUNC_BT(pAdapter))
|
|
|
|
{
|
|
|
|
value32 = rtw_read32(pAdapter, EFUSE_TEST);
|
2014-12-29 02:13:24 +00:00
|
|
|
bRet = true;
|
2015-08-15 18:05:44 +00:00
|
|
|
switch (bank)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_WIFI_SEL_0);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_BT_SEL_0);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_BT_SEL_1);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_BT_SEL_2);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_WIFI_SEL_0);
|
2014-12-29 02:13:24 +00:00
|
|
|
bRet = false;
|
2014-12-17 04:09:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
rtw_write32(pAdapter, EFUSE_TEST, value32);
|
|
|
|
}
|
|
|
|
else
|
2014-12-29 02:13:24 +00:00
|
|
|
bRet = true;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
ReadEFuseByIC(
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *Adapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 efuseType,
|
|
|
|
u16 _offset,
|
2014-12-19 06:59:46 +00:00
|
|
|
u16 _size_byte,
|
|
|
|
u8 *pbuf,
|
2015-03-13 17:06:38 +00:00
|
|
|
bool bPseudoTest
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef DBG_IOL_READ_EFUSE_MAP
|
|
|
|
u8 logical_map[512];
|
|
|
|
#endif
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!bPseudoTest )/* rtw_IOL_applied(Adapter)) */
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
int ret = _FAIL;
|
2015-08-15 18:02:34 +00:00
|
|
|
if (rtw_IOL_applied(Adapter))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_hal_power_on(Adapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
iol_mode_enable(Adapter, 1);
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef DBG_IOL_READ_EFUSE_MAP
|
|
|
|
iol_read_efuse(Adapter, 0, _offset, _size_byte, logical_map);
|
|
|
|
#else
|
2013-05-08 21:45:39 +00:00
|
|
|
ret = iol_read_efuse(Adapter, 0, _offset, _size_byte, pbuf);
|
2014-12-17 04:09:56 +00:00
|
|
|
#endif
|
2014-12-19 06:59:46 +00:00
|
|
|
iol_mode_enable(Adapter, 0);
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (_SUCCESS == ret)
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Hal_EfuseReadEFuse88E(Adapter, _offset, _size_byte, pbuf, bPseudoTest);
|
|
|
|
|
|
|
|
exit:
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
#ifdef DBG_IOL_READ_EFUSE_MAP
|
2015-08-15 18:02:34 +00:00
|
|
|
if (_rtw_memcmp(logical_map, Adapter->eeprompriv.efuse_eeprom_data, 0x130) == false)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
int i;
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("%s compare first 0x130 byte fail\n", __FUNCTION__);
|
2015-08-15 18:06:32 +00:00
|
|
|
for (i=0;i<512;i++)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:22:58 +00:00
|
|
|
if (i%16== 0)
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("0x%03x: ", i);
|
|
|
|
DBG_88E("%02x ", logical_map[i]);
|
2015-08-15 18:02:34 +00:00
|
|
|
if (i%16==15)
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("\n");
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("\n");
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
return;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
ReadEFuse_Pseudo(
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *Adapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 efuseType,
|
|
|
|
u16 _offset,
|
2014-12-19 06:59:46 +00:00
|
|
|
u16 _size_byte,
|
|
|
|
u8 *pbuf,
|
2015-03-13 17:06:38 +00:00
|
|
|
bool bPseudoTest
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
Hal_EfuseReadEFuse88E(Adapter, _offset, _size_byte, pbuf, bPseudoTest);
|
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
rtl8188e_ReadEFuse(
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *Adapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 efuseType,
|
|
|
|
u16 _offset,
|
2014-12-19 06:59:46 +00:00
|
|
|
u16 _size_byte,
|
|
|
|
u8 *pbuf,
|
2015-03-13 17:06:38 +00:00
|
|
|
bool bPseudoTest
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (bPseudoTest)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
ReadEFuse_Pseudo(Adapter, efuseType, _offset, _size_byte, pbuf, bPseudoTest);
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
ReadEFuseByIC(Adapter, efuseType, _offset, _size_byte, pbuf, bPseudoTest);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Do not support BT */
|
2015-01-30 03:41:53 +00:00
|
|
|
static void Hal_EFUSEGetEfuseDefinition88E(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter *pAdapter,
|
|
|
|
u8 efuseType,
|
|
|
|
u8 type,
|
|
|
|
void * pOut
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2015-08-15 18:05:44 +00:00
|
|
|
switch (type) {
|
2015-01-30 03:41:53 +00:00
|
|
|
case TYPE_EFUSE_MAX_SECTION:
|
|
|
|
{
|
|
|
|
u8* pMax_section;
|
|
|
|
pMax_section = (u8*)pOut;
|
|
|
|
*pMax_section = EFUSE_MAX_SECTION_88E;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_EFUSE_REAL_CONTENT_LEN:
|
|
|
|
{
|
|
|
|
u16* pu2Tmp;
|
|
|
|
pu2Tmp = (u16*)pOut;
|
|
|
|
*pu2Tmp = EFUSE_REAL_CONTENT_LEN_88E;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_EFUSE_CONTENT_LEN_BANK:
|
|
|
|
{
|
|
|
|
u16* pu2Tmp;
|
|
|
|
pu2Tmp = (u16*)pOut;
|
|
|
|
*pu2Tmp = EFUSE_REAL_CONTENT_LEN_88E;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_AVAILABLE_EFUSE_BYTES_BANK:
|
|
|
|
{
|
|
|
|
u16* pu2Tmp;
|
|
|
|
pu2Tmp = (u16*)pOut;
|
|
|
|
*pu2Tmp = (u16)(EFUSE_REAL_CONTENT_LEN_88E-EFUSE_OOB_PROTECT_BYTES_88E);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_AVAILABLE_EFUSE_BYTES_TOTAL:
|
|
|
|
{
|
|
|
|
u16* pu2Tmp;
|
|
|
|
pu2Tmp = (u16*)pOut;
|
|
|
|
*pu2Tmp = (u16)(EFUSE_REAL_CONTENT_LEN_88E-EFUSE_OOB_PROTECT_BYTES_88E);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_EFUSE_MAP_LEN:
|
|
|
|
{
|
|
|
|
u16* pu2Tmp;
|
|
|
|
pu2Tmp = (u16*)pOut;
|
|
|
|
*pu2Tmp = (u16)EFUSE_MAP_LEN_88E;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_EFUSE_PROTECT_BYTES_BANK:
|
|
|
|
{
|
|
|
|
u8* pu1Tmp;
|
|
|
|
pu1Tmp = (u8*)pOut;
|
|
|
|
*pu1Tmp = (u8)(EFUSE_OOB_PROTECT_BYTES_88E);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
u8* pu1Tmp;
|
|
|
|
pu1Tmp = (u8*)pOut;
|
|
|
|
*pu1Tmp = 0;
|
|
|
|
}
|
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
2015-01-30 03:41:53 +00:00
|
|
|
|
|
|
|
static void Hal_EFUSEGetEfuseDefinition_Pseudo88E(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter *pAdapter,
|
|
|
|
u8 efuseType,
|
|
|
|
u8 type,
|
|
|
|
void * pOut
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2015-08-15 18:05:44 +00:00
|
|
|
switch (type)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
case TYPE_EFUSE_MAX_SECTION:
|
|
|
|
{
|
|
|
|
u8* pMax_section;
|
2014-12-30 23:50:44 +00:00
|
|
|
pMax_section = (u8 *)pOut;
|
2014-12-17 04:09:56 +00:00
|
|
|
*pMax_section = EFUSE_MAX_SECTION_88E;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_EFUSE_REAL_CONTENT_LEN:
|
|
|
|
{
|
|
|
|
u16* pu2Tmp;
|
2014-12-30 22:52:58 +00:00
|
|
|
pu2Tmp = (u16 *)pOut;
|
2014-12-17 04:09:56 +00:00
|
|
|
*pu2Tmp = EFUSE_REAL_CONTENT_LEN_88E;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_EFUSE_CONTENT_LEN_BANK:
|
|
|
|
{
|
|
|
|
u16* pu2Tmp;
|
2014-12-30 22:52:58 +00:00
|
|
|
pu2Tmp = (u16 *)pOut;
|
2014-12-17 04:09:56 +00:00
|
|
|
*pu2Tmp = EFUSE_REAL_CONTENT_LEN_88E;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_AVAILABLE_EFUSE_BYTES_BANK:
|
|
|
|
{
|
|
|
|
u16* pu2Tmp;
|
2014-12-30 22:52:58 +00:00
|
|
|
pu2Tmp = (u16 *)pOut;
|
|
|
|
*pu2Tmp = (u16)(EFUSE_REAL_CONTENT_LEN_88E-EFUSE_OOB_PROTECT_BYTES_88E);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_AVAILABLE_EFUSE_BYTES_TOTAL:
|
|
|
|
{
|
|
|
|
u16* pu2Tmp;
|
2014-12-30 22:52:58 +00:00
|
|
|
pu2Tmp = (u16 *)pOut;
|
|
|
|
*pu2Tmp = (u16)(EFUSE_REAL_CONTENT_LEN_88E-EFUSE_OOB_PROTECT_BYTES_88E);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_EFUSE_MAP_LEN:
|
|
|
|
{
|
|
|
|
u16* pu2Tmp;
|
2014-12-30 22:52:58 +00:00
|
|
|
pu2Tmp = (u16 *)pOut;
|
|
|
|
*pu2Tmp = (u16)EFUSE_MAP_LEN_88E;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_EFUSE_PROTECT_BYTES_BANK:
|
|
|
|
{
|
|
|
|
u8* pu1Tmp;
|
|
|
|
pu1Tmp = (u8*)pOut;
|
|
|
|
*pu1Tmp = (u8)(EFUSE_OOB_PROTECT_BYTES_88E);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
u8* pu1Tmp;
|
|
|
|
pu1Tmp = (u8*)pOut;
|
|
|
|
*pu1Tmp = 0;
|
|
|
|
}
|
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
rtl8188e_EFUSE_GetEfuseDefinition(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter *pAdapter,
|
|
|
|
u8 efuseType,
|
|
|
|
u8 type,
|
|
|
|
void *pOut,
|
|
|
|
bool bPseudoTest
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (bPseudoTest)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
Hal_EFUSEGetEfuseDefinition_Pseudo88E(pAdapter, efuseType, type, pOut);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
Hal_EFUSEGetEfuseDefinition88E(pAdapter, efuseType, type, pOut);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
static u8
|
2015-03-13 17:06:38 +00:00
|
|
|
Hal_EfuseWordEnableDataWrite(struct adapter *pAdapter,
|
|
|
|
u16 efuse_addr,
|
|
|
|
u8 word_en,
|
|
|
|
u8 *data,
|
|
|
|
bool bPseudoTest)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
u16 tmpaddr = 0;
|
|
|
|
u16 start_addr = efuse_addr;
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 badworden = 0x0F;
|
|
|
|
u8 tmpdata[8];
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-19 20:58:09 +00:00
|
|
|
memset((void *)tmpdata, 0xff, PGPKT_DATA_SIZE);
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RT_TRACE(COMP_EFUSE, DBG_LOUD, ("word_en = %x efuse_addr=%x\n", word_en, efuse_addr)); */
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!(word_en&BIT0))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
tmpaddr = start_addr;
|
2014-12-17 04:09:56 +00:00
|
|
|
efuse_OneByteWrite(pAdapter,start_addr++, data[0], bPseudoTest);
|
|
|
|
efuse_OneByteWrite(pAdapter,start_addr++, data[1], bPseudoTest);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
efuse_OneByteRead(pAdapter,tmpaddr, &tmpdata[0], bPseudoTest);
|
|
|
|
efuse_OneByteRead(pAdapter,tmpaddr+1, &tmpdata[1], bPseudoTest);
|
2015-08-15 18:24:16 +00:00
|
|
|
if ((data[0]!=tmpdata[0])||(data[1]!=tmpdata[1])) {
|
2013-05-08 21:45:39 +00:00
|
|
|
badworden &= (~BIT0);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!(word_en&BIT1))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
tmpaddr = start_addr;
|
2014-12-17 04:09:56 +00:00
|
|
|
efuse_OneByteWrite(pAdapter,start_addr++, data[2], bPseudoTest);
|
|
|
|
efuse_OneByteWrite(pAdapter,start_addr++, data[3], bPseudoTest);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
efuse_OneByteRead(pAdapter,tmpaddr , &tmpdata[2], bPseudoTest);
|
|
|
|
efuse_OneByteRead(pAdapter,tmpaddr+1, &tmpdata[3], bPseudoTest);
|
2015-08-15 18:24:16 +00:00
|
|
|
if ((data[2]!=tmpdata[2])||(data[3]!=tmpdata[3])) {
|
2014-12-17 04:09:56 +00:00
|
|
|
badworden &=( ~BIT1);
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!(word_en&BIT2))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
tmpaddr = start_addr;
|
2014-12-17 04:09:56 +00:00
|
|
|
efuse_OneByteWrite(pAdapter,start_addr++, data[4], bPseudoTest);
|
|
|
|
efuse_OneByteWrite(pAdapter,start_addr++, data[5], bPseudoTest);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
efuse_OneByteRead(pAdapter,tmpaddr, &tmpdata[4], bPseudoTest);
|
|
|
|
efuse_OneByteRead(pAdapter,tmpaddr+1, &tmpdata[5], bPseudoTest);
|
2015-08-15 18:24:16 +00:00
|
|
|
if ((data[4]!=tmpdata[4])||(data[5]!=tmpdata[5])) {
|
2014-12-17 04:09:56 +00:00
|
|
|
badworden &=( ~BIT2);
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!(word_en&BIT3))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
tmpaddr = start_addr;
|
2014-12-17 04:09:56 +00:00
|
|
|
efuse_OneByteWrite(pAdapter,start_addr++, data[6], bPseudoTest);
|
|
|
|
efuse_OneByteWrite(pAdapter,start_addr++, data[7], bPseudoTest);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
efuse_OneByteRead(pAdapter,tmpaddr, &tmpdata[6], bPseudoTest);
|
|
|
|
efuse_OneByteRead(pAdapter,tmpaddr+1, &tmpdata[7], bPseudoTest);
|
2015-08-15 18:24:16 +00:00
|
|
|
if ((data[6]!=tmpdata[6])||(data[7]!=tmpdata[7])) {
|
2014-12-17 04:09:56 +00:00
|
|
|
badworden &=( ~BIT3);
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
return badworden;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
static u8
|
2015-03-13 17:06:38 +00:00
|
|
|
Hal_EfuseWordEnableDataWrite_Pseudo(struct adapter *pAdapter,
|
|
|
|
u16 efuse_addr,
|
|
|
|
u8 word_en,
|
|
|
|
u8 *data,
|
|
|
|
bool bPseudoTest)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 ret=0;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
ret = Hal_EfuseWordEnableDataWrite(pAdapter, efuse_addr, word_en, data, bPseudoTest);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
static u8
|
2015-03-13 17:06:38 +00:00
|
|
|
rtl8188e_Efuse_WordEnableDataWrite(struct adapter *pAdapter,
|
|
|
|
u16 efuse_addr,
|
|
|
|
u8 word_en,
|
|
|
|
u8 *data,
|
|
|
|
bool bPseudoTest)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 ret=0;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (bPseudoTest)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
ret = Hal_EfuseWordEnableDataWrite_Pseudo(pAdapter, efuse_addr, word_en, data, bPseudoTest);
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
ret = Hal_EfuseWordEnableDataWrite(pAdapter, efuse_addr, word_en, data, bPseudoTest);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
static u16
|
2015-03-13 17:06:38 +00:00
|
|
|
hal_EfuseGetCurrentSize_8188e(struct adapter *pAdapter,
|
|
|
|
bool bPseudoTest)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
int bContinual = true;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
u16 efuse_addr = 0;
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 hoffset=0,hworden=0;
|
|
|
|
u8 efuse_data,word_cnts=0;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (bPseudoTest)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_addr = (u16)(fakeEfuseUsedBytes);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_hal_get_hwreg(pAdapter, HW_VAR_EFUSE_BYTES, (u8 *)&efuse_addr);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("hal_EfuseGetCurrentSize_8723A(), start_efuse_addr = %d\n", efuse_addr)); */
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
while ( bContinual &&
|
|
|
|
efuse_OneByteRead(pAdapter, efuse_addr ,&efuse_data, bPseudoTest) &&
|
|
|
|
AVAILABLE_EFUSE_ADDR(efuse_addr))
|
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (efuse_data!=0xFF)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if ((efuse_data&0x1F) == 0x0F) /* extended header */
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
hoffset = efuse_data;
|
|
|
|
efuse_addr++;
|
2014-12-17 04:09:56 +00:00
|
|
|
efuse_OneByteRead(pAdapter, efuse_addr ,&efuse_data, bPseudoTest);
|
2015-08-15 18:02:34 +00:00
|
|
|
if ((efuse_data & 0x0F) == 0x0F)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_addr++;
|
|
|
|
continue;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
hoffset = ((hoffset & 0xE0) >> 5) | ((efuse_data & 0xF0) >> 1);
|
|
|
|
hworden = efuse_data & 0x0F;
|
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
hoffset = (efuse_data>>4) & 0x0F;
|
|
|
|
hworden = efuse_data & 0x0F;
|
|
|
|
}
|
|
|
|
word_cnts = Efuse_CalculateWordCnts(hworden);
|
2015-02-20 00:51:33 +00:00
|
|
|
/* read next header */
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_addr = efuse_addr + (word_cnts*2)+1;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
bContinual = false ;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (bPseudoTest)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
fakeEfuseUsedBytes = efuse_addr;
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("hal_EfuseGetCurrentSize_8723A(), return %d\n", fakeEfuseUsedBytes)); */
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_hal_set_hwreg(pAdapter, HW_VAR_EFUSE_BYTES, (u8 *)&efuse_addr);
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("hal_EfuseGetCurrentSize_8723A(), return %d\n", efuse_addr)); */
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return efuse_addr;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
static u16
|
2015-03-13 17:06:38 +00:00
|
|
|
Hal_EfuseGetCurrentSize_Pseudo(struct adapter *pAdapter,
|
|
|
|
bool bPseudoTest)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u16 ret=0;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
ret = hal_EfuseGetCurrentSize_8188e(pAdapter, bPseudoTest);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
static u16
|
|
|
|
rtl8188e_EfuseGetCurrentSize(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter *pAdapter,
|
|
|
|
u8 efuseType,
|
|
|
|
bool bPseudoTest)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u16 ret=0;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (bPseudoTest)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-08-08 05:41:21 +00:00
|
|
|
ret = Hal_EfuseGetCurrentSize_Pseudo(pAdapter, bPseudoTest);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
ret = hal_EfuseGetCurrentSize_8188e(pAdapter, bPseudoTest);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
hal_EfusePgPacketRead_8188e(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter *pAdapter,
|
|
|
|
u8 offset,
|
|
|
|
u8 *data,
|
|
|
|
bool bPseudoTest)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 ReadState = PG_STATE_HEADER;
|
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
int bContinual = true;
|
|
|
|
int bDataEmpty = true ;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
u8 efuse_data,word_cnts = 0;
|
2013-05-08 21:45:39 +00:00
|
|
|
u16 efuse_addr = 0;
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 hoffset = 0,hworden = 0;
|
|
|
|
u8 tmpidx = 0;
|
|
|
|
u8 tmpdata[8];
|
|
|
|
u8 max_section = 0;
|
|
|
|
u8 tmp_header = 0;
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
EFUSE_GetEfuseDefinition(pAdapter, EFUSE_WIFI, TYPE_EFUSE_MAX_SECTION, (void *)&max_section, bPseudoTest);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-08-15 18:22:58 +00:00
|
|
|
if (data== NULL)
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2015-08-15 18:02:34 +00:00
|
|
|
if (offset>max_section)
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-02-19 20:58:09 +00:00
|
|
|
memset((void *)data, 0xff, sizeof(u8)*PGPKT_DATA_SIZE);
|
|
|
|
memset((void *)tmpdata, 0xff, sizeof(u8)*PGPKT_DATA_SIZE);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* */
|
|
|
|
/* <Roger_TODO> Efuse has been pre-programmed dummy 5Bytes at the end of Efuse by CP. */
|
|
|
|
/* Skip dummy parts to prevent unexpected data read from Efuse. */
|
|
|
|
/* By pass right now. 2009.02.19. */
|
|
|
|
/* */
|
2015-08-15 18:04:12 +00:00
|
|
|
while (bContinual && AVAILABLE_EFUSE_ADDR(efuse_addr) )
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Header Read ------------- */
|
2015-08-15 18:02:34 +00:00
|
|
|
if (ReadState & PG_STATE_HEADER)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (efuse_OneByteRead(pAdapter, efuse_addr ,&efuse_data, bPseudoTest)&&(efuse_data!=0xFF))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (EXT_HEADER(efuse_data))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
tmp_header = efuse_data;
|
|
|
|
efuse_addr++;
|
2014-12-17 04:09:56 +00:00
|
|
|
efuse_OneByteRead(pAdapter, efuse_addr ,&efuse_data, bPseudoTest);
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!ALL_WORDS_DISABLED(efuse_data))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
hoffset = ((tmp_header & 0xE0) >> 5) | ((efuse_data & 0xF0) >> 1);
|
|
|
|
hworden = efuse_data & 0x0F;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DBG_8192C("Error, All words disabled\n");
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_addr++;
|
|
|
|
continue;
|
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
hoffset = (efuse_data>>4) & 0x0F;
|
|
|
|
hworden = efuse_data & 0x0F;
|
|
|
|
}
|
|
|
|
word_cnts = Efuse_CalculateWordCnts(hworden);
|
2014-12-29 02:13:24 +00:00
|
|
|
bDataEmpty = true ;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (hoffset==offset)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:06:32 +00:00
|
|
|
for (tmpidx = 0;tmpidx< word_cnts*2 ;tmpidx++)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (efuse_OneByteRead(pAdapter, efuse_addr+1+tmpidx ,&efuse_data, bPseudoTest) )
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
tmpdata[tmpidx] = efuse_data;
|
2015-08-15 18:02:34 +00:00
|
|
|
if (efuse_data!=0xff)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
bDataEmpty = false;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
2015-08-15 18:24:16 +00:00
|
|
|
if (bDataEmpty==false) {
|
2013-05-08 21:45:39 +00:00
|
|
|
ReadState = PG_STATE_DATA;
|
2015-08-15 18:27:00 +00:00
|
|
|
} else {/* read next header */
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_addr = efuse_addr + (word_cnts*2)+1;
|
|
|
|
ReadState = PG_STATE_HEADER;
|
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2015-08-15 18:27:00 +00:00
|
|
|
else {/* read next header */
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_addr = efuse_addr + (word_cnts*2)+1;
|
|
|
|
ReadState = PG_STATE_HEADER;
|
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2015-08-15 18:27:00 +00:00
|
|
|
else {
|
2014-12-29 02:13:24 +00:00
|
|
|
bContinual = false ;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
}
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Data section Read ------------- */
|
2015-08-15 18:02:34 +00:00
|
|
|
else if (ReadState & PG_STATE_DATA)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
efuse_WordEnableDataRead(hworden,tmpdata,data);
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_addr = efuse_addr + (word_cnts*2)+1;
|
|
|
|
ReadState = PG_STATE_HEADER;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-08-15 18:22:58 +00:00
|
|
|
if ( (data[0]== 0xff) &&(data[1]== 0xff) && (data[2]== 0xff) && (data[3]== 0xff) &&
|
|
|
|
(data[4]== 0xff) &&(data[5]== 0xff) && (data[6]== 0xff) && (data[7]== 0xff))
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-29 02:13:24 +00:00
|
|
|
return true;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
static int
|
2015-03-13 17:06:38 +00:00
|
|
|
Hal_EfusePgPacketRead( struct adapter *pAdapter,
|
|
|
|
u8 offset,
|
|
|
|
u8 *data,
|
|
|
|
bool bPseudoTest)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
int ret=0;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
ret = hal_EfusePgPacketRead_8188e(pAdapter, offset, data, bPseudoTest);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
static int
|
2015-03-13 17:06:38 +00:00
|
|
|
Hal_EfusePgPacketRead_Pseudo( struct adapter *pAdapter,
|
|
|
|
u8 offset,
|
|
|
|
u8 *data,
|
|
|
|
bool bPseudoTest)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
int ret=0;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
ret = hal_EfusePgPacketRead_8188e(pAdapter, offset, data, bPseudoTest);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
static int
|
2015-03-13 17:06:38 +00:00
|
|
|
rtl8188e_Efuse_PgPacketRead( struct adapter *pAdapter,
|
|
|
|
u8 offset,
|
|
|
|
u8 *data,
|
|
|
|
bool bPseudoTest)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
int ret=0;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (bPseudoTest)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
ret = Hal_EfusePgPacketRead_Pseudo(pAdapter, offset, data, bPseudoTest);
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
ret = Hal_EfusePgPacketRead(pAdapter, offset, data, bPseudoTest);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-03-02 23:21:23 +00:00
|
|
|
static bool
|
2014-12-17 04:09:56 +00:00
|
|
|
hal_EfuseFixHeaderProcess(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * pAdapter,
|
|
|
|
u8 efuseType,
|
|
|
|
PPGPKT_STRUCT pFixPkt,
|
|
|
|
u16 *pAddr,
|
|
|
|
bool bPseudoTest
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 originaldata[8], badworden=0;
|
|
|
|
u16 efuse_addr=*pAddr;
|
|
|
|
u32 PgWriteSuccess=0;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-19 20:58:09 +00:00
|
|
|
memset((void *)originaldata, 0xff, 8);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (Efuse_PgPacketRead(pAdapter, pFixPkt->offset, originaldata, bPseudoTest))
|
2015-02-20 00:51:33 +00:00
|
|
|
{ /* check if data exist */
|
2013-05-08 21:45:39 +00:00
|
|
|
badworden = Efuse_WordEnableDataWrite(pAdapter, efuse_addr+1, pFixPkt->word_en, originaldata, bPseudoTest);
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (badworden != 0xf) /* write fail */
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
PgWriteSuccess = Efuse_PgPacketWrite(pAdapter, pFixPkt->offset, badworden, originaldata, bPseudoTest);
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!PgWriteSuccess)
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
|
|
|
efuse_addr = Efuse_GetCurrentSize(pAdapter, efuseType, bPseudoTest);
|
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
efuse_addr = efuse_addr + (pFixPkt->word_cnts*2) +1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
efuse_addr = efuse_addr + (pFixPkt->word_cnts*2) +1;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
*pAddr = efuse_addr;
|
2014-12-29 02:13:24 +00:00
|
|
|
return true;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2015-03-02 23:21:23 +00:00
|
|
|
static bool
|
2014-12-17 04:09:56 +00:00
|
|
|
hal_EfusePgPacketWrite2ByteHeader(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * pAdapter,
|
|
|
|
u8 efuseType,
|
|
|
|
u16 *pAddr,
|
|
|
|
PPGPKT_STRUCT pTargetPkt,
|
|
|
|
bool bPseudoTest)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-03-02 23:21:23 +00:00
|
|
|
bool bRet=false, bContinual=true;
|
2014-12-17 04:09:56 +00:00
|
|
|
u16 efuse_addr=*pAddr, efuse_max_available_len=0;
|
|
|
|
u8 pg_header=0, tmp_header=0, pg_header_temp=0;
|
|
|
|
u8 repeatcnt=0;
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("Wirte 2byte header\n")); */
|
2014-12-29 02:06:17 +00:00
|
|
|
EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_AVAILABLE_EFUSE_BYTES_BANK, (void *)&efuse_max_available_len, bPseudoTest);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-08-15 18:04:12 +00:00
|
|
|
while (efuse_addr < efuse_max_available_len)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
pg_header = ((pTargetPkt->offset & 0x07) << 5) | 0x0F;
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("pg_header = 0x%x\n", pg_header)); */
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_OneByteWrite(pAdapter, efuse_addr, pg_header, bPseudoTest);
|
|
|
|
efuse_OneByteRead(pAdapter, efuse_addr, &tmp_header, bPseudoTest);
|
|
|
|
|
2015-08-15 18:04:12 +00:00
|
|
|
while (tmp_header == 0xFF)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("Repeat over limit for pg_header!!\n")); */
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
efuse_OneByteWrite(pAdapter, efuse_addr, pg_header, bPseudoTest);
|
|
|
|
efuse_OneByteRead(pAdapter, efuse_addr, &tmp_header, bPseudoTest);
|
|
|
|
}
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* to write ext_header */
|
2015-08-15 18:02:34 +00:00
|
|
|
if (tmp_header == pg_header)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_addr++;
|
|
|
|
pg_header_temp = pg_header;
|
|
|
|
pg_header = ((pTargetPkt->offset & 0x78) << 1) | pTargetPkt->word_en;
|
|
|
|
|
|
|
|
efuse_OneByteWrite(pAdapter, efuse_addr, pg_header, bPseudoTest);
|
|
|
|
efuse_OneByteRead(pAdapter, efuse_addr, &tmp_header, bPseudoTest);
|
|
|
|
|
2015-08-15 18:04:12 +00:00
|
|
|
while (tmp_header == 0xFF)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("Repeat over limit for ext_header!!\n")); */
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
efuse_OneByteWrite(pAdapter, efuse_addr, pg_header, bPseudoTest);
|
|
|
|
efuse_OneByteRead(pAdapter, efuse_addr, &tmp_header, bPseudoTest);
|
|
|
|
}
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if ((tmp_header & 0x0F) == 0x0F) /* word_en PG fail */
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("Repeat over limit for word_en!!\n")); */
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_addr++;
|
|
|
|
continue;
|
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2015-08-15 18:02:34 +00:00
|
|
|
else if (pg_header != tmp_header) /* offset PG fail */
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
PGPKT_STRUCT fixPkt;
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("Error condition for offset PG fail, need to cover the existed data\n")); */
|
2013-05-08 21:45:39 +00:00
|
|
|
fixPkt.offset = ((pg_header_temp & 0xE0) >> 5) | ((tmp_header & 0xF0) >> 1);
|
|
|
|
fixPkt.word_en = tmp_header & 0x0F;
|
|
|
|
fixPkt.word_cnts = Efuse_CalculateWordCnts(fixPkt.word_en);
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!hal_EfuseFixHeaderProcess(pAdapter, efuseType, &fixPkt, &efuse_addr, bPseudoTest))
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
bRet = true;
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2015-02-20 00:51:33 +00:00
|
|
|
else if ((tmp_header & 0x1F) == 0x0F) /* wrong extended header */
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
efuse_addr+=2;
|
2013-05-08 21:45:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*pAddr = efuse_addr;
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2015-03-02 23:21:23 +00:00
|
|
|
static bool
|
2014-12-17 04:09:56 +00:00
|
|
|
hal_EfusePgPacketWrite1ByteHeader(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * pAdapter,
|
|
|
|
u8 efuseType,
|
|
|
|
u16 *pAddr,
|
|
|
|
PPGPKT_STRUCT pTargetPkt,
|
|
|
|
bool bPseudoTest)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2015-03-02 23:21:23 +00:00
|
|
|
bool bRet=false;
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 pg_header=0, tmp_header=0;
|
|
|
|
u16 efuse_addr=*pAddr;
|
|
|
|
u8 repeatcnt=0;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("Wirte 1byte header\n")); */
|
2014-12-17 04:09:56 +00:00
|
|
|
pg_header = ((pTargetPkt->offset << 4) & 0xf0) |pTargetPkt->word_en;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
efuse_OneByteWrite(pAdapter, efuse_addr, pg_header, bPseudoTest);
|
|
|
|
efuse_OneByteRead(pAdapter, efuse_addr, &tmp_header, bPseudoTest);
|
|
|
|
|
2015-08-15 18:04:12 +00:00
|
|
|
while (tmp_header == 0xFF)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
efuse_OneByteWrite(pAdapter,efuse_addr, pg_header, bPseudoTest);
|
|
|
|
efuse_OneByteRead(pAdapter,efuse_addr, &tmp_header, bPseudoTest);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (pg_header == tmp_header)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
bRet = true;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PGPKT_STRUCT fixPkt;
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("Error condition for fixed PG packet, need to cover the existed data\n")); */
|
2013-05-08 21:45:39 +00:00
|
|
|
fixPkt.offset = (tmp_header>>4) & 0x0F;
|
|
|
|
fixPkt.word_en = tmp_header & 0x0F;
|
|
|
|
fixPkt.word_cnts = Efuse_CalculateWordCnts(fixPkt.word_en);
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!hal_EfuseFixHeaderProcess(pAdapter, efuseType, &fixPkt, &efuse_addr, bPseudoTest))
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
*pAddr = efuse_addr;
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2015-03-02 23:21:23 +00:00
|
|
|
static bool
|
2014-12-17 04:09:56 +00:00
|
|
|
hal_EfusePgPacketWriteData(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * pAdapter,
|
|
|
|
u8 efuseType,
|
|
|
|
u16 *pAddr,
|
|
|
|
PPGPKT_STRUCT pTargetPkt,
|
|
|
|
bool bPseudoTest)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2015-03-02 23:21:23 +00:00
|
|
|
bool bRet=false;
|
2014-12-17 04:09:56 +00:00
|
|
|
u16 efuse_addr=*pAddr;
|
|
|
|
u8 badworden=0;
|
|
|
|
u32 PgWriteSuccess=0;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
badworden = 0x0f;
|
|
|
|
badworden = Efuse_WordEnableDataWrite(pAdapter, efuse_addr+1, pTargetPkt->word_en, pTargetPkt->data, bPseudoTest);
|
2015-08-15 18:02:34 +00:00
|
|
|
if (badworden == 0x0F)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* write ok */
|
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("hal_EfusePgPacketWriteData ok!!\n")); */
|
2014-12-29 02:13:24 +00:00
|
|
|
return true;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("hal_EfusePgPacketWriteData Fail!!\n")); */
|
|
|
|
/* reorganize other pg packet */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
PgWriteSuccess = Efuse_PgPacketWrite(pAdapter, pTargetPkt->offset, badworden, pTargetPkt->data, bPseudoTest);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!PgWriteSuccess)
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-29 02:13:24 +00:00
|
|
|
return true;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
return bRet;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2015-03-02 23:21:23 +00:00
|
|
|
static bool
|
2013-05-08 21:45:39 +00:00
|
|
|
hal_EfusePgPacketWriteHeader(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * pAdapter,
|
|
|
|
u8 efuseType,
|
|
|
|
u16 *pAddr,
|
|
|
|
PPGPKT_STRUCT pTargetPkt,
|
|
|
|
bool bPseudoTest)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2015-03-02 23:21:23 +00:00
|
|
|
bool bRet=false;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (pTargetPkt->offset >= EFUSE_MAX_SECTION_BASE)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
bRet = hal_EfusePgPacketWrite2ByteHeader(pAdapter, efuseType, pAddr, pTargetPkt, bPseudoTest);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
bRet = hal_EfusePgPacketWrite1ByteHeader(pAdapter, efuseType, pAddr, pTargetPkt, bPseudoTest);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2015-03-02 23:21:23 +00:00
|
|
|
static bool
|
2014-12-17 04:09:56 +00:00
|
|
|
wordEnMatched(
|
2015-03-13 17:06:38 +00:00
|
|
|
PPGPKT_STRUCT pTargetPkt,
|
|
|
|
PPGPKT_STRUCT pCurPkt,
|
|
|
|
u8 *pWden
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
u8 match_word_en = 0x0F; /* default all words are disabled */
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 i;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* check if the same words are enabled both target and current PG packet */
|
2015-08-15 18:02:34 +00:00
|
|
|
if ( ((pTargetPkt->word_en & BIT0) == 0) &&
|
2014-12-17 04:09:56 +00:00
|
|
|
((pCurPkt->word_en & BIT0) == 0) )
|
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
match_word_en &= ~BIT0; /* enable word 0 */
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2015-08-15 18:02:34 +00:00
|
|
|
if ( ((pTargetPkt->word_en & BIT1) == 0) &&
|
2014-12-17 04:09:56 +00:00
|
|
|
((pCurPkt->word_en & BIT1) == 0) )
|
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
match_word_en &= ~BIT1; /* enable word 1 */
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2015-08-15 18:02:34 +00:00
|
|
|
if ( ((pTargetPkt->word_en & BIT2) == 0) &&
|
2014-12-17 04:09:56 +00:00
|
|
|
((pCurPkt->word_en & BIT2) == 0) )
|
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
match_word_en &= ~BIT2; /* enable word 2 */
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2015-08-15 18:02:34 +00:00
|
|
|
if ( ((pTargetPkt->word_en & BIT3) == 0) &&
|
2014-12-17 04:09:56 +00:00
|
|
|
((pCurPkt->word_en & BIT3) == 0) )
|
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
match_word_en &= ~BIT3; /* enable word 3 */
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
*pWden = match_word_en;
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (match_word_en != 0xf)
|
2014-12-29 02:13:24 +00:00
|
|
|
return true;
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2015-03-02 23:21:23 +00:00
|
|
|
static bool
|
2014-12-17 04:09:56 +00:00
|
|
|
hal_EfuseCheckIfDatafollowed(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * pAdapter,
|
|
|
|
u8 word_cnts,
|
|
|
|
u16 startAddr,
|
|
|
|
bool bPseudoTest
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2015-03-02 23:21:23 +00:00
|
|
|
bool bRet=false;
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 i, efuse_data;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:06:32 +00:00
|
|
|
for (i=0; i<(word_cnts*2) ; i++)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (efuse_OneByteRead(pAdapter, (startAddr+i) ,&efuse_data, bPseudoTest)&&(efuse_data != 0xFF))
|
2014-12-29 02:13:24 +00:00
|
|
|
bRet = true;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2015-03-02 23:21:23 +00:00
|
|
|
static bool
|
2014-12-17 04:09:56 +00:00
|
|
|
hal_EfusePartialWriteCheck(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * pAdapter,
|
|
|
|
u8 efuseType,
|
|
|
|
u16 *pAddr,
|
|
|
|
PPGPKT_STRUCT pTargetPkt,
|
|
|
|
bool bPseudoTest
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-08-08 05:41:21 +00:00
|
|
|
{
|
2015-03-02 23:21:23 +00:00
|
|
|
bool bRet=false;
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 i, efuse_data=0, cur_header=0;
|
|
|
|
u8 new_wden=0, matched_wden=0, badworden=0;
|
|
|
|
u16 startAddr=0, efuse_max_available_len=0, efuse_max=0;
|
|
|
|
PGPKT_STRUCT curPkt;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_AVAILABLE_EFUSE_BYTES_BANK, (void *)&efuse_max_available_len, bPseudoTest);
|
|
|
|
EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_EFUSE_REAL_CONTENT_LEN, (void *)&efuse_max, bPseudoTest);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (efuseType == EFUSE_WIFI)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (bPseudoTest)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
startAddr = (u16)(fakeEfuseUsedBytes%EFUSE_REAL_CONTENT_LEN);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_hal_get_hwreg(pAdapter, HW_VAR_EFUSE_BYTES, (u8 *)&startAddr);
|
2014-12-17 04:09:56 +00:00
|
|
|
startAddr%=EFUSE_REAL_CONTENT_LEN;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (bPseudoTest)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
startAddr = (u16)(fakeBTEfuseUsedBytes%EFUSE_REAL_CONTENT_LEN);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
startAddr = (u16)(BTEfuseUsedBytes%EFUSE_REAL_CONTENT_LEN);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("hal_EfusePartialWriteCheck(), startAddr=%d\n", startAddr)); */
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:04:12 +00:00
|
|
|
while (1)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (startAddr >= efuse_max_available_len)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
bRet = false;
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (efuse_OneByteRead(pAdapter, startAddr, &efuse_data, bPseudoTest) && (efuse_data!=0xFF))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (EXT_HEADER(efuse_data))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
cur_header = efuse_data;
|
|
|
|
startAddr++;
|
|
|
|
efuse_OneByteRead(pAdapter, startAddr, &efuse_data, bPseudoTest);
|
2015-08-15 18:02:34 +00:00
|
|
|
if (ALL_WORDS_DISABLED(efuse_data))
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("Error condition, all words disabled")); */
|
2014-12-29 02:13:24 +00:00
|
|
|
bRet = false;
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
curPkt.offset = ((cur_header & 0xE0) >> 5) | ((efuse_data & 0xF0) >> 1);
|
|
|
|
curPkt.word_en = efuse_data & 0x0F;
|
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
cur_header = efuse_data;
|
|
|
|
curPkt.offset = (cur_header>>4) & 0x0F;
|
|
|
|
curPkt.word_en = cur_header & 0x0F;
|
|
|
|
}
|
|
|
|
|
|
|
|
curPkt.word_cnts = Efuse_CalculateWordCnts(curPkt.word_en);
|
2015-02-20 00:51:33 +00:00
|
|
|
/* if same header is found but no data followed */
|
|
|
|
/* write some part of data followed by the header. */
|
2015-08-15 18:02:34 +00:00
|
|
|
if ( (curPkt.offset == pTargetPkt->offset) &&
|
2014-12-17 04:09:56 +00:00
|
|
|
(!hal_EfuseCheckIfDatafollowed(pAdapter, curPkt.word_cnts, startAddr+1, bPseudoTest)) &&
|
|
|
|
wordEnMatched(pTargetPkt, &curPkt, &matched_wden) )
|
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("Need to partial write data by the previous wrote header\n")); */
|
|
|
|
/* Here to write partial data */
|
2013-05-08 21:45:39 +00:00
|
|
|
badworden = Efuse_WordEnableDataWrite(pAdapter, startAddr+1, matched_wden, pTargetPkt->data, bPseudoTest);
|
2015-08-15 18:02:34 +00:00
|
|
|
if (badworden != 0x0F)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
u32 PgWriteSuccess=0;
|
2015-02-20 00:51:33 +00:00
|
|
|
/* if write fail on some words, write these bad words again */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
PgWriteSuccess = Efuse_PgPacketWrite(pAdapter, pTargetPkt->offset, badworden, pTargetPkt->data, bPseudoTest);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!PgWriteSuccess)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
bRet = false; /* write fail, return */
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2015-02-20 00:51:33 +00:00
|
|
|
/* partial write ok, update the target packet for later use */
|
2015-08-15 18:06:32 +00:00
|
|
|
for (i=0; i<4; i++)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if ((matched_wden & (0x1<<i)) == 0) /* this word has been written */
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
pTargetPkt->word_en |= (0x1<<i); /* disable the word */
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
pTargetPkt->word_cnts = Efuse_CalculateWordCnts(pTargetPkt->word_en);
|
|
|
|
}
|
2015-02-20 00:51:33 +00:00
|
|
|
/* read from next header */
|
2014-12-17 04:09:56 +00:00
|
|
|
startAddr = startAddr + (curPkt.word_cnts*2) +1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* not used header, 0xff */
|
2013-05-08 21:45:39 +00:00
|
|
|
*pAddr = startAddr;
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("Started from unused header offset=%d\n", startAddr)); */
|
2014-12-29 02:13:24 +00:00
|
|
|
bRet = true;
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2015-03-02 23:21:23 +00:00
|
|
|
static bool
|
2013-05-08 21:45:39 +00:00
|
|
|
hal_EfusePgCheckAvailableAddr(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter *pAdapter,
|
|
|
|
u8 efuseType,
|
|
|
|
bool bPseudoTest
|
2013-05-08 21:45:39 +00:00
|
|
|
)
|
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u16 efuse_max_available_len=0;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Change to check TYPE_EFUSE_MAP_LEN ,beacuse 8188E raw 256,logic map over 256. */
|
2014-12-29 02:13:24 +00:00
|
|
|
EFUSE_GetEfuseDefinition(pAdapter, EFUSE_WIFI, TYPE_EFUSE_MAP_LEN, (void *)&efuse_max_available_len, false);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (void *)&efuse_max_available_len, bPseudoTest); */
|
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("efuse_max_available_len = %d\n", efuse_max_available_len)); */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (Efuse_GetCurrentSize(pAdapter, efuseType, bPseudoTest) >= efuse_max_available_len)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("hal_EfusePgCheckAvailableAddr error!!\n")); */
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2014-12-29 02:13:24 +00:00
|
|
|
return true;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-17 04:09:56 +00:00
|
|
|
hal_EfuseConstructPGPkt(
|
2015-03-13 17:06:38 +00:00
|
|
|
u8 offset,
|
|
|
|
u8 word_en,
|
|
|
|
u8 *pData,
|
|
|
|
PPGPKT_STRUCT pTargetPkt
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2015-02-19 20:58:09 +00:00
|
|
|
memset((void *)pTargetPkt->data, 0xFF, sizeof(u8)*8);
|
2013-05-08 21:45:39 +00:00
|
|
|
pTargetPkt->offset = offset;
|
2014-12-17 04:09:56 +00:00
|
|
|
pTargetPkt->word_en= word_en;
|
2013-05-08 21:45:39 +00:00
|
|
|
efuse_WordEnableDataRead(word_en, pData, pTargetPkt->data);
|
|
|
|
pTargetPkt->word_cnts = Efuse_CalculateWordCnts(pTargetPkt->word_en);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RTPRINT(FEEPROM, EFUSE_PG, ("hal_EfuseConstructPGPkt(), targetPkt, offset=%d, word_en=0x%x, word_cnts=%d\n", pTargetPkt->offset, pTargetPkt->word_en, pTargetPkt->word_cnts)); */
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
|
2015-03-02 23:21:23 +00:00
|
|
|
static bool
|
2014-12-17 04:09:56 +00:00
|
|
|
hal_EfusePgPacketWrite_BT(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter *pAdapter,
|
|
|
|
u8 offset,
|
|
|
|
u8 word_en,
|
|
|
|
u8 *pData,
|
|
|
|
bool bPseudoTest
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
PGPKT_STRUCT targetPkt;
|
2014-12-17 04:09:56 +00:00
|
|
|
u16 startAddr=0;
|
|
|
|
u8 efuseType=EFUSE_BT;
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!hal_EfusePgCheckAvailableAddr(pAdapter, efuseType, bPseudoTest))
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
hal_EfuseConstructPGPkt(offset, word_en, pData, &targetPkt);
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!hal_EfusePartialWriteCheck(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest))
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!hal_EfusePgPacketWriteHeader(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest))
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!hal_EfusePgPacketWriteData(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest))
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
return true;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2015-03-02 23:21:23 +00:00
|
|
|
static bool
|
2014-12-17 04:09:56 +00:00
|
|
|
hal_EfusePgPacketWrite_8188e(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * pAdapter,
|
|
|
|
u8 offset,
|
|
|
|
u8 word_en,
|
|
|
|
u8 *pData,
|
|
|
|
bool bPseudoTest
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
PGPKT_STRUCT targetPkt;
|
2014-12-17 04:09:56 +00:00
|
|
|
u16 startAddr=0;
|
|
|
|
u8 efuseType=EFUSE_WIFI;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!hal_EfusePgCheckAvailableAddr(pAdapter, efuseType, bPseudoTest))
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
hal_EfuseConstructPGPkt(offset, word_en, pData, &targetPkt);
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!hal_EfusePartialWriteCheck(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest))
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!hal_EfusePgPacketWriteHeader(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest))
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!hal_EfusePgPacketWriteData(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest))
|
2014-12-29 02:13:24 +00:00
|
|
|
return false;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
return true;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
static int
|
2015-03-13 17:06:38 +00:00
|
|
|
Hal_EfusePgPacketWrite_Pseudo(struct adapter *pAdapter,
|
|
|
|
u8 offset,
|
|
|
|
u8 word_en,
|
|
|
|
u8 *data,
|
|
|
|
bool bPseudoTest)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = hal_EfusePgPacketWrite_8188e(pAdapter, offset, word_en, data, bPseudoTest);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
static int
|
2015-03-13 17:06:38 +00:00
|
|
|
Hal_EfusePgPacketWrite(struct adapter *pAdapter,
|
|
|
|
u8 offset,
|
|
|
|
u8 word_en,
|
|
|
|
u8 *data,
|
|
|
|
bool bPseudoTest)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
int ret=0;
|
2013-05-08 21:45:39 +00:00
|
|
|
ret = hal_EfusePgPacketWrite_8188e(pAdapter, offset, word_en, data, bPseudoTest);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
static int
|
2015-03-13 17:06:38 +00:00
|
|
|
rtl8188e_Efuse_PgPacketWrite(struct adapter *pAdapter,
|
|
|
|
u8 offset,
|
|
|
|
u8 word_en,
|
|
|
|
u8 *data,
|
|
|
|
bool bPseudoTest)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (bPseudoTest)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
ret = Hal_EfusePgPacketWrite_Pseudo(pAdapter, offset, word_en, data, bPseudoTest);
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
ret = Hal_EfusePgPacketWrite(pAdapter, offset, word_en, data, bPseudoTest);
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-03-17 14:57:29 +00:00
|
|
|
static struct hal_version
|
|
|
|
ReadChipVersion8188E(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
u32 value32;
|
2015-03-17 14:57:29 +00:00
|
|
|
struct hal_version ChipVersion;
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
pHalData = GET_HAL_DATA(padapter);
|
|
|
|
|
|
|
|
value32 = rtw_read32(padapter, REG_SYS_CFG);
|
2014-12-17 04:09:56 +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);
|
2015-02-20 00:51:33 +00:00
|
|
|
ChipVersion.CUTVersion = (value32 & CHIP_VER_RTL_MASK)>>CHIP_VER_RTL_SHIFT; /* IC version (CUT) */
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 00:51:33 +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);
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
ChipVersion.ROMVer = 0; /* ROM code version. */
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->MultiFunc = RT_MULTI_FUNC_NONE;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* if DBG */
|
2013-05-08 21:45:39 +00:00
|
|
|
dump_chip_info(ChipVersion);
|
|
|
|
|
|
|
|
pHalData->VersionID = ChipVersion;
|
|
|
|
|
2015-08-15 18:24:16 +00:00
|
|
|
if (IS_1T2R(ChipVersion)) {
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->rf_type = RF_1T2R;
|
|
|
|
pHalData->NumTotalRFPath = 2;
|
2015-08-15 18:24:16 +00:00
|
|
|
} else if (IS_2T2R(ChipVersion)) {
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->rf_type = RF_2T2R;
|
|
|
|
pHalData->NumTotalRFPath = 2;
|
2015-08-15 18:27:00 +00:00
|
|
|
} else {
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->rf_type = RF_1T1R;
|
|
|
|
pHalData->NumTotalRFPath = 1;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
MSG_8192C("RF_Type is %x!!\n", pHalData->rf_type);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return ChipVersion;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void rtl8188e_read_chip_version(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
ReadChipVersion8188E(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2015-01-30 03:41:53 +00:00
|
|
|
|
|
|
|
static void rtl8188e_GetHalODMVar(
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter * Adapter,
|
2015-03-17 15:31:25 +00:00
|
|
|
enum HAL_ODM_VARIABLE eVariable,
|
2014-12-29 02:06:17 +00:00
|
|
|
void * pValue1,
|
2015-03-02 23:21:23 +00:00
|
|
|
bool bSet)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
|
|
|
PDM_ODM_T podmpriv = &pHalData->odmpriv;
|
2015-08-15 18:24:16 +00:00
|
|
|
switch (eVariable) {
|
2014-12-17 04:09:56 +00:00
|
|
|
case HAL_ODM_STA_INFO:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2015-01-30 03:41:53 +00:00
|
|
|
|
|
|
|
static void rtl8188e_SetHalODMVar(
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter * Adapter,
|
2015-03-17 15:31:25 +00:00
|
|
|
enum HAL_ODM_VARIABLE eVariable,
|
2014-12-29 02:06:17 +00:00
|
|
|
void * pValue1,
|
2015-03-02 23:21:23 +00:00
|
|
|
bool bSet)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
|
|
|
PDM_ODM_T podmpriv = &pHalData->odmpriv;
|
2015-02-20 00:51:33 +00:00
|
|
|
/* _irqL irqL; */
|
2015-08-15 18:24:16 +00:00
|
|
|
switch (eVariable) {
|
2014-12-17 04:09:56 +00:00
|
|
|
case HAL_ODM_STA_INFO:
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
|
|
|
struct sta_info *psta = (struct sta_info *)pValue1;
|
2015-08-15 18:24:16 +00:00
|
|
|
if (bSet) {
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_8192C("### Set STA_(%d) info\n",psta->mac_id);
|
|
|
|
ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS,psta->mac_id,psta);
|
2015-08-15 18:02:34 +00:00
|
|
|
#if (RATE_ADAPTIVE_SUPPORT==1)
|
2014-12-17 04:09:56 +00:00
|
|
|
ODM_RAInfo_Init(podmpriv,psta->mac_id);
|
|
|
|
#endif
|
|
|
|
}
|
2015-08-15 18:27:00 +00:00
|
|
|
else {
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_8192C("### Clean STA_(%d) info\n",psta->mac_id);
|
|
|
|
ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS,psta->mac_id,NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2014-12-19 06:59:46 +00:00
|
|
|
case HAL_ODM_P2P_STATE:
|
2014-12-17 04:09:56 +00:00
|
|
|
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;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtl8188e_start_thread(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtl8188e_stop_thread(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2014-12-28 17:13:03 +00:00
|
|
|
|
2015-01-30 03:41:53 +00:00
|
|
|
static void hal_notch_filter_8188e(struct adapter *adapter, bool enable)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
if (enable) {
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("Enable notch filter\n");
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(adapter, rOFDM0_RxDSP+1, rtw_read8(adapter, rOFDM0_RxDSP+1) | BIT1);
|
|
|
|
} else {
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("Disable notch filter\n");
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write8(adapter, rOFDM0_RxDSP+1, rtw_read8(adapter, rOFDM0_RxDSP+1) & ~BIT1);
|
|
|
|
}
|
|
|
|
}
|
2015-01-30 03:41:53 +00:00
|
|
|
|
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->dm_deinit = &rtl8188e_deinit_dm_priv;
|
|
|
|
|
|
|
|
pHalFunc->read_chip_version = &rtl8188e_read_chip_version;
|
|
|
|
|
|
|
|
pHalFunc->set_bwmode_handler = &PHY_SetBWMode8188E;
|
|
|
|
pHalFunc->set_channel_handler = &PHY_SwChnl8188E;
|
|
|
|
|
|
|
|
pHalFunc->hal_dm_watchdog = &rtl8188e_HalDmWatchDog;
|
|
|
|
|
|
|
|
pHalFunc->Add_RateATid = &rtl8188e_Add_RateATid;
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalFunc->run_thread= &rtl8188e_start_thread;
|
|
|
|
pHalFunc->cancel_thread= &rtl8188e_stop_thread;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalFunc->AntDivBeforeLinkHandler = &AntDivBeforeLink8188E;
|
|
|
|
pHalFunc->AntDivCompareHandler = &AntDivCompare8188E;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalFunc->read_bbreg = &rtl8188e_PHY_QueryBBReg;
|
|
|
|
pHalFunc->write_bbreg = &rtl8188e_PHY_SetBBReg;
|
|
|
|
pHalFunc->read_rfreg = &rtl8188e_PHY_QueryRFReg;
|
|
|
|
pHalFunc->write_rfreg = &rtl8188e_PHY_SetRFReg;
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Efuse related function */
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalFunc->EfusePowerSwitch = &rtl8188e_EfusePowerSwitch;
|
|
|
|
pHalFunc->ReadEFuse = &rtl8188e_ReadEFuse;
|
|
|
|
pHalFunc->EFUSEGetEfuseDefinition = &rtl8188e_EFUSE_GetEfuseDefinition;
|
|
|
|
pHalFunc->EfuseGetCurrentSize = &rtl8188e_EfuseGetCurrentSize;
|
|
|
|
pHalFunc->Efuse_PgPacketRead = &rtl8188e_Efuse_PgPacketRead;
|
|
|
|
pHalFunc->Efuse_PgPacketWrite = &rtl8188e_Efuse_PgPacketWrite;
|
|
|
|
pHalFunc->Efuse_WordEnableDataWrite = &rtl8188e_Efuse_WordEnableDataWrite;
|
|
|
|
pHalFunc->sreset_init_value = &sreset_init_value;
|
|
|
|
pHalFunc->sreset_reset_value = &sreset_reset_value;
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalFunc->silentreset = &sreset_reset;
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalFunc->sreset_xmit_status_check = &rtl8188e_sreset_xmit_status_check;
|
|
|
|
pHalFunc->sreset_linked_status_check = &rtl8188e_sreset_linked_status_check;
|
|
|
|
pHalFunc->sreset_get_wifi_status = &sreset_get_wifi_status;
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalFunc->sreset_inprogress= &sreset_inprogress;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
pHalFunc->GetHalODMVarHandler = &rtl8188e_GetHalODMVar;
|
|
|
|
pHalFunc->SetHalODMVarHandler = &rtl8188e_SetHalODMVar;
|
|
|
|
|
|
|
|
pHalFunc->IOL_exec_cmds_sync = &rtl8188e_IOL_exec_cmds_sync;
|
|
|
|
|
|
|
|
pHalFunc->hal_notch_filter = &hal_notch_filter_8188e;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
u8 GetEEPROMSize8188E(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
u8 size = 0;
|
|
|
|
u32 cr;
|
|
|
|
|
|
|
|
cr = rtw_read16(padapter, REG_9346CR);
|
2015-02-20 00:51:33 +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;
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
MSG_8192C("EEPROM type is %s\n", size==4 ? "E-FUSE" : "93C46");
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* LLT R/W/Init function */
|
|
|
|
/* */
|
|
|
|
/* */
|
2015-01-30 03:41:53 +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-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write32(padapter, LLTReg, value);
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* polling */
|
2013-05-08 21:45:39 +00:00
|
|
|
do {
|
|
|
|
value = rtw_read32(padapter, LLTReg);
|
2014-12-17 04:09:56 +00:00
|
|
|
if (_LLT_NO_ACTIVE == _LLT_OP_VALUE(value)) {
|
2013-05-08 21:45:39 +00:00
|
|
|
break;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2015-01-30 03:41:53 +00:00
|
|
|
static u8 _LLTRead(struct adapter *padapter, u32 address)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
s32 count = 0;
|
|
|
|
u32 value = _LLT_INIT_ADDR(address) | _LLT_OP(_LLT_READ_ACCESS);
|
|
|
|
u16 LLTReg = REG_LLT_INIT;
|
|
|
|
|
|
|
|
|
|
|
|
rtw_write32(padapter, LLTReg, value);
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* polling and get value */
|
2014-12-17 04:09:56 +00:00
|
|
|
do {
|
|
|
|
value = rtw_read32(padapter, LLTReg);
|
|
|
|
if (_LLT_NO_ACTIVE == _LLT_OP_VALUE(value)) {
|
|
|
|
return (u8)value;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (count > POLLING_LLT_THRESHOLD) {
|
|
|
|
RT_TRACE(_module_hal_init_c_, _drv_err_, ("Failed to polling read LLT done at address %d!\n", address));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} while (count++);
|
|
|
|
|
|
|
|
return 0xFF;
|
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
void Read_LLT_Tab(struct adapter *padapter)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
u32 addr,next_addr;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-03-10 16:18:03 +00:00
|
|
|
printk("############### %s ###################\n",__FUNCTION__);
|
2015-08-15 18:06:32 +00:00
|
|
|
for (addr=0;addr<176;addr++) {
|
2015-03-10 16:18:03 +00:00
|
|
|
next_addr = _LLTRead(padapter,addr);
|
|
|
|
printk("%d->",next_addr);
|
2015-08-15 18:22:58 +00:00
|
|
|
if (((addr+1) %8) == 0)
|
2015-03-10 16:18:03 +00:00
|
|
|
printk("\n");
|
|
|
|
}
|
|
|
|
printk("\n##################################\n");
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
s32 status = _FAIL;
|
|
|
|
u32 i;
|
2015-02-20 00:51:33 +00:00
|
|
|
u32 Last_Entry_Of_TxPktBuf = LAST_ENTRY_OF_TX_PKT_BUFFER;/* 176, 22k */
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-03-01 16:38:32 +00:00
|
|
|
for (i = 0; i < (txpktbuf_bndy - 1); i++) {
|
|
|
|
status = _LLTWrite(padapter, i, i + 1);
|
2014-12-17 04:09:56 +00:00
|
|
|
if (_SUCCESS != status) {
|
2013-05-08 21:45:39 +00:00
|
|
|
return status;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2015-03-01 16:38:32 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-03-01 16:38:32 +00:00
|
|
|
/* end of list */
|
|
|
|
status = _LLTWrite(padapter, (txpktbuf_bndy - 1), 0xFF);
|
|
|
|
if (_SUCCESS != status) {
|
|
|
|
return status;
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-03-01 16:38:32 +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. */
|
|
|
|
for (i = txpktbuf_bndy; i < Last_Entry_Of_TxPktBuf; i++) {
|
|
|
|
status = _LLTWrite(padapter, i, (i + 1));
|
2013-05-08 21:45:39 +00:00
|
|
|
if (_SUCCESS != status) {
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-01 16:38:32 +00:00
|
|
|
/* Let last entry point to the start entry of ring buffer */
|
|
|
|
status = _LLTWrite(padapter, Last_Entry_Of_TxPktBuf, txpktbuf_bndy);
|
|
|
|
if (_SUCCESS != status) {
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-12-17 23:13:53 +00:00
|
|
|
Hal_InitPGData88E(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2015-03-17 15:31:25 +00:00
|
|
|
struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
|
2015-02-20 00:51:33 +00:00
|
|
|
/* HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); */
|
2014-12-17 04:09:56 +00:00
|
|
|
u32 i;
|
|
|
|
u16 value16;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (false == pEEPROM->bautoload_fail_flag)
|
2015-02-20 00:51:33 +00:00
|
|
|
{ /* autoload OK. */
|
2014-12-17 04:09:56 +00:00
|
|
|
if (is_boot_from_eeprom(padapter))
|
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Read all Content from EEPROM or EFUSE. */
|
2015-08-15 18:06:32 +00:00
|
|
|
for (i = 0; i < HWSET_MAX_SIZE_88E; i += 2)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* value16 = EF2Byte(ReadEEprom(pAdapter, (u16) (i>>1))); */
|
|
|
|
/* *((u16*)(&PROMContent[i])) = value16; */
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Read EFUSE real map to shadow. */
|
2014-12-29 02:13:24 +00:00
|
|
|
EFUSE_ShadowMapUpdate(padapter, EFUSE_WIFI, false);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
2015-02-20 00:51:33 +00:00
|
|
|
{/* 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"));
|
2015-02-20 00:51:33 +00:00
|
|
|
/* pHalData->AutoloadFailFlag = true; */
|
|
|
|
/* update to default value 0xFF */
|
2013-05-08 21:45:39 +00:00
|
|
|
if (!is_boot_from_eeprom(padapter))
|
2014-12-29 02:13:24 +00:00
|
|
|
EFUSE_ShadowMapUpdate(padapter, EFUSE_WIFI, false);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Hal_EfuseParseIDCode88E(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter *padapter,
|
|
|
|
u8 *hwinfo
|
2013-05-08 21:45:39 +00:00
|
|
|
)
|
|
|
|
{
|
2015-03-17 15:31:25 +00:00
|
|
|
struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
|
2015-02-20 00:51:33 +00:00
|
|
|
/* HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); */
|
2013-05-08 21:45:39 +00:00
|
|
|
u16 EEPROMId;
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Checl 0x8129 again for making sure autoload status!! */
|
2015-01-28 05:14:58 +00:00
|
|
|
EEPROMId = le16_to_cpu(*((__le16*)hwinfo));
|
|
|
|
if (EEPROMId != RTL_EEPROM_ID) {
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_8192C("EEPROM ID(%#x) is invalid!!\n", EEPROMId);
|
2014-12-29 02:13:24 +00:00
|
|
|
pEEPROM->bautoload_fail_flag = true;
|
2015-01-28 05:14:58 +00:00
|
|
|
} else {
|
2014-12-29 02:13:24 +00:00
|
|
|
pEEPROM->bautoload_fail_flag = false;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("EEPROM ID=0x%04x\n", EEPROMId);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
static void
|
|
|
|
Hal_EEValueCheck(
|
2015-03-13 17:06:38 +00:00
|
|
|
u8 EEType,
|
|
|
|
void * pInValue,
|
|
|
|
void * pOutValue
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2015-08-15 18:05:44 +00:00
|
|
|
switch (EEType)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
case EETYPE_TX_PWR:
|
|
|
|
{
|
|
|
|
u8 *pIn, *pOut;
|
|
|
|
pIn = (u8*)pInValue;
|
|
|
|
pOut = (u8*)pOutValue;
|
2015-08-15 18:02:34 +00:00
|
|
|
if (*pIn >= 0 && *pIn <= 63)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
*pOut = *pIn;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RT_TRACE(_module_hci_hal_init_c_, _drv_err_, ("EETYPE_TX_PWR, value=%d is invalid, set to default=0x%x\n",
|
|
|
|
*pIn, EEPROM_Default_TxPowerLevel));
|
|
|
|
*pOut = EEPROM_Default_TxPowerLevel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
static void
|
|
|
|
Hal_ReadPowerValueFromPROM_8188E(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * padapter,
|
|
|
|
PTxPowerInfo24G pwrInfo24G,
|
|
|
|
u8* PROMContent,
|
|
|
|
bool AutoLoadFail
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
u32 rfPath, eeAddr=EEPROM_TX_PWR_INX_88E, group,TxCount=0;
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-19 20:58:09 +00:00
|
|
|
memset(pwrInfo24G, 0, sizeof(TxPowerInfo24G));
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (AutoLoadFail)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2015-08-15 18:06:32 +00:00
|
|
|
for (rfPath = 0 ; rfPath < pHalData->NumTotalRFPath ; rfPath++)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* 2.4G default value */
|
2015-08-15 18:06:32 +00:00
|
|
|
for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
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;
|
|
|
|
}
|
2015-08-15 18:06:32 +00:00
|
|
|
for (TxCount=0;TxCount<MAX_TX_COUNT;TxCount++)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:22:58 +00:00
|
|
|
if (TxCount== 0)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
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;
|
2014-12-17 04:09:56 +00:00
|
|
|
pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-03-02 23:25:27 +00:00
|
|
|
/* pHalData->bNOPG = true; */
|
2013-05-08 21:45:39 +00:00
|
|
|
return;
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:06:32 +00:00
|
|
|
for (rfPath = 0 ; rfPath < pHalData->NumTotalRFPath ; rfPath++)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* 2.4G default value */
|
2015-08-15 18:06:32 +00:00
|
|
|
for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* printk(" IndexCCK_Base rfPath:%d group:%d,eeAddr:0x%02x ",rfPath,group,eeAddr); */
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrInfo24G->IndexCCK_Base[rfPath][group] = PROMContent[eeAddr++];
|
2015-08-15 18:00:19 +00:00
|
|
|
/* printk(" IndexCCK_Base:%02x\n",pwrInfo24G->IndexCCK_Base[rfPath][group] ); */
|
2015-08-15 18:02:34 +00:00
|
|
|
if (pwrInfo24G->IndexCCK_Base[rfPath][group] == 0xFF)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrInfo24G->IndexCCK_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX;
|
2015-03-02 23:25:27 +00:00
|
|
|
/* pHalData->bNOPG = true; */
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2015-08-15 18:06:32 +00:00
|
|
|
for (group = 0 ; group < MAX_CHNL_GROUP_24G-1; group++)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* printk(" IndexBW40_Base rfPath:%d group:%d,eeAddr:0x%02x ",rfPath,group,eeAddr); */
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrInfo24G->IndexBW40_Base[rfPath][group] = PROMContent[eeAddr++];
|
2015-08-15 18:00:19 +00:00
|
|
|
/* printk(" IndexBW40_Base: %02x\n",pwrInfo24G->IndexBW40_Base[rfPath][group] ); */
|
2015-08-15 18:02:34 +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;
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2015-08-15 18:06:32 +00:00
|
|
|
for (TxCount=0;TxCount<MAX_TX_COUNT;TxCount++)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 18:22:58 +00:00
|
|
|
if (TxCount== 0)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrInfo24G->BW40_Diff[rfPath][TxCount] = 0;
|
2015-08-15 18:02:34 +00:00
|
|
|
if (PROMContent[eeAddr] == 0xFF)
|
2014-12-17 04:09:56 +00:00
|
|
|
pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_24G_HT20_DIFF;
|
|
|
|
else
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4;
|
2015-08-15 18:02:34 +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;
|
|
|
|
}
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (PROMContent[eeAddr] == 0xFF)
|
2014-12-19 06:59:46 +00:00
|
|
|
pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_24G_OFDM_DIFF;
|
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f);
|
2015-08-15 18:02:34 +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;
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrInfo24G->CCK_Diff[rfPath][TxCount] = 0;
|
|
|
|
eeAddr++;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (PROMContent[eeAddr] == 0xFF)
|
2014-12-19 06:59:46 +00:00
|
|
|
pwrInfo24G->BW40_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
|
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
pwrInfo24G->BW40_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4;
|
2015-08-15 18:02:34 +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;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (PROMContent[eeAddr] == 0xFF)
|
2014-12-19 06:59:46 +00:00
|
|
|
pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
|
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f);
|
2015-08-15 18:02:34 +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++;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (PROMContent[eeAddr] == 0xFF)
|
2014-12-19 06:59:46 +00:00
|
|
|
pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
|
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4;
|
2015-08-15 18:02:34 +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;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (PROMContent[eeAddr] == 0xFF)
|
2014-12-19 06:59:46 +00:00
|
|
|
pwrInfo24G->CCK_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF;
|
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
pwrInfo24G->CCK_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f);
|
2015-08-15 18:02:34 +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++;
|
|
|
|
}
|
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
static u8
|
|
|
|
Hal_GetChnlGroup(
|
2015-03-13 17:06:38 +00:00
|
|
|
u8 chnl
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
u8 group=0;
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
if (chnl < 3) /* Cjanel 1-3 */
|
2014-12-17 04:09:56 +00:00
|
|
|
group = 0;
|
2015-02-20 00:51:33 +00:00
|
|
|
else if (chnl < 9) /* Channel 4-9 */
|
2014-12-17 04:09:56 +00:00
|
|
|
group = 1;
|
2015-02-20 00:51:33 +00:00
|
|
|
else /* Channel 10-14 */
|
2014-12-17 04:09:56 +00:00
|
|
|
group = 2;
|
|
|
|
|
|
|
|
return group;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
static u8
|
2014-12-17 04:09:56 +00:00
|
|
|
Hal_GetChnlGroup88E(
|
2015-03-13 17:06:38 +00:00
|
|
|
u8 chnl,
|
|
|
|
u8* pGroup
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
u8 bIn24G=true;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (chnl<=14)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
bIn24G=true;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
if (chnl < 3) /* Chanel 1-2 */
|
2013-05-08 21:45:39 +00:00
|
|
|
*pGroup = 0;
|
2015-02-20 00:51:33 +00:00
|
|
|
else if (chnl < 6) /* Channel 3-5 */
|
2013-05-08 21:45:39 +00:00
|
|
|
*pGroup = 1;
|
2015-08-15 18:02:34 +00:00
|
|
|
else if (chnl <9) /* Channel 6-8 */
|
2013-05-08 21:45:39 +00:00
|
|
|
*pGroup = 2;
|
2015-08-15 18:02:34 +00:00
|
|
|
else if (chnl <12) /* Channel 9-11 */
|
2013-05-08 21:45:39 +00:00
|
|
|
*pGroup = 3;
|
2015-08-15 18:02:34 +00:00
|
|
|
else if (chnl <14) /* Channel 12-13 */
|
2013-05-08 21:45:39 +00:00
|
|
|
*pGroup = 4;
|
2015-08-15 18:02:34 +00:00
|
|
|
else if (chnl ==14) /* Channel 14 */
|
2014-12-19 06:59:46 +00:00
|
|
|
*pGroup = 5;
|
2014-12-17 04:09:56 +00:00
|
|
|
else
|
|
|
|
{
|
2015-08-15 18:00:19 +00:00
|
|
|
/* RT_TRACE(COMP_EFUSE,DBG_LOUD,("==>Hal_GetChnlGroup88E in 2.4 G, but Channel %d in Group not found\n",chnl)); */
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
bIn24G=false;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
if (chnl <=40)
|
2013-05-08 21:45:39 +00:00
|
|
|
*pGroup = 0;
|
2014-12-17 04:09:56 +00:00
|
|
|
else if (chnl <=48)
|
2013-05-08 21:45:39 +00:00
|
|
|
*pGroup = 1;
|
2015-08-15 18:02:34 +00:00
|
|
|
else if (chnl <=56)
|
2013-05-08 21:45:39 +00:00
|
|
|
*pGroup = 2;
|
2015-08-15 18:02:34 +00:00
|
|
|
else if (chnl <=64)
|
2013-05-08 21:45:39 +00:00
|
|
|
*pGroup = 3;
|
2015-08-15 18:02:34 +00:00
|
|
|
else if (chnl <=104)
|
2013-05-08 21:45:39 +00:00
|
|
|
*pGroup = 4;
|
2015-08-15 18:02:34 +00:00
|
|
|
else if (chnl <=112)
|
2014-12-19 06:59:46 +00:00
|
|
|
*pGroup = 5;
|
2015-08-15 18:02:34 +00:00
|
|
|
else if (chnl <=120)
|
2014-12-19 06:59:46 +00:00
|
|
|
*pGroup = 5;
|
2015-08-15 18:02:34 +00:00
|
|
|
else if (chnl <=128)
|
2014-12-19 06:59:46 +00:00
|
|
|
*pGroup = 6;
|
2015-08-15 18:02:34 +00:00
|
|
|
else if (chnl <=136)
|
2014-12-19 06:59:46 +00:00
|
|
|
*pGroup = 7;
|
2015-08-15 18:02:34 +00:00
|
|
|
else if (chnl <=144)
|
2014-12-19 06:59:46 +00:00
|
|
|
*pGroup = 8;
|
2015-08-15 18:02:34 +00:00
|
|
|
else if (chnl <=153)
|
2014-12-19 06:59:46 +00:00
|
|
|
*pGroup = 9;
|
2015-08-15 18:02:34 +00:00
|
|
|
else if (chnl <=161)
|
2014-12-19 06:59:46 +00:00
|
|
|
*pGroup = 10;
|
2015-08-15 18:02:34 +00:00
|
|
|
else if (chnl <=177)
|
2014-12-19 06:59:46 +00:00
|
|
|
*pGroup = 11;
|
2014-12-17 04:09:56 +00:00
|
|
|
else
|
|
|
|
{
|
2015-08-15 18:00:19 +00:00
|
|
|
/* RT_TRACE(COMP_EFUSE,DBG_LOUD,("==>Hal_GetChnlGroup88E in 5G, but Channel %d in Group not found\n",chnl)); */
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2015-02-20 00:51:33 +00:00
|
|
|
/* RT_TRACE(COMP_EFUSE,DBG_LOUD,("<==Hal_GetChnlGroup88E, Channel = %d, bIn24G =%d,\n",chnl,bIn24G)); */
|
2013-05-08 21:45:39 +00:00
|
|
|
return bIn24G;
|
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
void Hal_ReadPowerSavingMode88E(
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter * padapter,
|
2015-03-13 17:06:38 +00:00
|
|
|
u8* hwinfo,
|
|
|
|
bool AutoLoadFail
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
|
|
|
struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter);
|
|
|
|
u8 tmpvalue;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:24:16 +00:00
|
|
|
if (AutoLoadFail) {
|
2014-12-29 02:13:24 +00:00
|
|
|
pwrctl->bHWPowerdown = false;
|
|
|
|
pwrctl->bSupportRemoteWakeup = false;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
else {
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* hw power down mode selection , 0:rf-off / 1:power down */
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (padapter->registrypriv.hwpdn_mode==2)
|
2014-12-29 02:13:24 +00:00
|
|
|
pwrctl->bHWPowerdown = (hwinfo[EEPROM_RF_FEATURE_OPTION_88E] & BIT4)?true:false;
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
pwrctl->bHWPowerdown = padapter->registrypriv.hwpdn_mode;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
pwrctl->bHWPwrPindetect = padapter->registrypriv.hwpwrp_detect;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* decide hw if support remote wakeup function */
|
|
|
|
/* if hw supported, 8051 (SIE) will generate WeakUP signal( D+/D- toggle) when autoresume */
|
2014-12-29 02:13:24 +00:00
|
|
|
pwrctl->bSupportRemoteWakeup = (hwinfo[EEPROM_USB_OPTIONAL_FUNCTION0] & BIT1)?true :false;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_8192C("%s...bHWPwrPindetect(%x)-bHWPowerdown(%x) ,bSupportRemoteWakeup(%x)\n",__FUNCTION__,
|
|
|
|
pwrctl->bHWPwrPindetect, pwrctl->bHWPowerdown, pwrctl->bSupportRemoteWakeup);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_8192C("### PS params=> power_mgnt(%x),usbss_enable(%x) ###\n",padapter->registrypriv.power_mgnt,padapter->registrypriv.usbss_enable);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
void
|
|
|
|
Hal_ReadTxPowerInfo88E(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * padapter,
|
|
|
|
u8* PROMContent,
|
|
|
|
bool AutoLoadFail
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
|
|
|
TxPowerInfo24G pwrInfo24G;
|
|
|
|
u8 rfPath, ch, group, rfPathMax=1;
|
|
|
|
u8 pwr, diff,bIn24G,TxCount;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
Hal_ReadPowerValueFromPROM_8188E(padapter,&pwrInfo24G, PROMContent, AutoLoadFail);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!AutoLoadFail)
|
2015-03-02 23:25:27 +00:00
|
|
|
pHalData->bTXPowerDataReadFromEEPORM = true;
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2016-02-15 01:39:28 +00:00
|
|
|
for (rfPath = 0 ; rfPath < pHalData->NumTotalRFPath ; rfPath++) {
|
|
|
|
for (ch = 0 ; ch < CHANNEL_MAX_NUMBER ; ch++) {
|
2014-12-17 04:09:56 +00:00
|
|
|
bIn24G = Hal_GetChnlGroup88E(ch+1,&group);
|
2016-02-15 01:39:28 +00:00
|
|
|
if (bIn24G) {
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData->Index24G_CCK_Base[rfPath][ch]=pwrInfo24G.IndexCCK_Base[rfPath][group];
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (ch==(14-1))
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData->Index24G_BW40_Base[rfPath][ch]=pwrInfo24G.IndexBW40_Base[rfPath][4];
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData->Index24G_BW40_Base[rfPath][ch]=pwrInfo24G.IndexBW40_Base[rfPath][group];
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (bIn24G)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("======= Path %d, Channel %d =======\n",rfPath,ch+1 );
|
|
|
|
DBG_88E("Index24G_CCK_Base[%d][%d] = 0x%x\n",rfPath,ch+1 ,pHalData->Index24G_CCK_Base[rfPath][ch]);
|
|
|
|
DBG_88E("Index24G_BW40_Base[%d][%d] = 0x%x\n",rfPath,ch+1 ,pHalData->Index24G_BW40_Base[rfPath][ch]);
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-08-15 18:06:32 +00:00
|
|
|
for (TxCount=0;TxCount<MAX_TX_COUNT;TxCount++)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
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];
|
2014-12-19 06:59:46 +00:00
|
|
|
#if DBG
|
2015-08-15 21:38:30 +00:00
|
|
|
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]);
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* 2010/10/19 MH Add Regulator recognize for EU. */
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!AutoLoadFail)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
|
|
|
struct registry_priv *registry_par = &padapter->registrypriv;
|
2015-08-15 18:24:16 +00:00
|
|
|
if ( registry_par->regulatory_tid == 0xff) {
|
2015-08-15 18:02:34 +00:00
|
|
|
if (PROMContent[EEPROM_RF_BOARD_OPTION_88E] == 0xFF)
|
2015-02-20 00:51:33 +00:00
|
|
|
pHalData->EEPROMRegulatory = (EEPROM_DEFAULT_BOARD_OPTION&0x7); /* bit0~2 */
|
2014-12-17 04:09:56 +00:00
|
|
|
else
|
2015-02-20 00:51:33 +00:00
|
|
|
pHalData->EEPROMRegulatory = (PROMContent[EEPROM_RF_BOARD_OPTION_88E]&0x7); /* bit0~2 */
|
2015-08-15 18:27:00 +00:00
|
|
|
} else {
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData->EEPROMRegulatory = registry_par->regulatory_tid;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->EEPROMRegulatory = 0;
|
|
|
|
}
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("EEPROMRegulatory = 0x%x\n", pHalData->EEPROMRegulatory);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
void
|
2014-12-17 04:09:56 +00:00
|
|
|
Hal_EfuseParseXtal_8188E(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * pAdapter,
|
|
|
|
u8* hwinfo,
|
|
|
|
bool AutoLoadFail
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!AutoLoadFail)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->CrystalCap = hwinfo[EEPROM_XTAL_88E];
|
2015-08-15 18:02:34 +00:00
|
|
|
if (pHalData->CrystalCap == 0xFF)
|
2014-12-19 06:59:46 +00:00
|
|
|
pHalData->CrystalCap = EEPROM_Default_CrystalCap_88E;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->CrystalCap = EEPROM_Default_CrystalCap_88E;
|
|
|
|
}
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("CrystalCap: 0x%2x\n", pHalData->CrystalCap);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
void
|
|
|
|
Hal_EfuseParseBoardType88E(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * pAdapter,
|
|
|
|
u8* hwinfo,
|
|
|
|
bool AutoLoadFail
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *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;
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("Board Type: 0x%2x\n", pHalData->BoardType);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
void
|
|
|
|
Hal_EfuseParseEEPROMVer88E(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * padapter,
|
|
|
|
u8* hwinfo,
|
|
|
|
bool AutoLoadFail
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:24:16 +00:00
|
|
|
if (!AutoLoadFail) {
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->EEPROMVersion = hwinfo[EEPROM_VERSION_88E];
|
2015-08-15 18:02:34 +00:00
|
|
|
if (pHalData->EEPROMVersion == 0xFF)
|
2014-12-19 06:59:46 +00:00
|
|
|
pHalData->EEPROMVersion = EEPROM_Default_Version;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2015-08-15 18:27:00 +00:00
|
|
|
else {
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->EEPROMVersion = 1;
|
|
|
|
}
|
2014-12-17 04:09:56 +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
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
void
|
|
|
|
rtl8188e_EfuseParseChnlPlan(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * padapter,
|
|
|
|
u8* hwinfo,
|
|
|
|
bool AutoLoadFail
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +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
|
|
|
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("mlmepriv.ChannelPlan = 0x%02x\n", padapter->mlmepriv.ChannelPlan);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
void
|
|
|
|
Hal_EfuseParseCustomerID88E(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * padapter,
|
|
|
|
u8* hwinfo,
|
|
|
|
bool AutoLoadFail
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
if (!AutoLoadFail)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->EEPROMCustomerID = hwinfo[EEPROM_CUSTOMERID_88E];
|
2015-02-20 00:51:33 +00:00
|
|
|
/* pHalData->EEPROMSubCustomerID = hwinfo[EEPROM_CUSTOMERID_88E]; */
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->EEPROMCustomerID = 0;
|
|
|
|
pHalData->EEPROMSubCustomerID = 0;
|
|
|
|
}
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("EEPROM Customer ID: 0x%2x\n", pHalData->EEPROMCustomerID);
|
|
|
|
/* DBG_88E("EEPROM SubCustomer ID: 0x%02x\n", pHalData->EEPROMSubCustomerID); */
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
Hal_ReadAntennaDiversity88E(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * pAdapter,
|
|
|
|
u8* PROMContent,
|
|
|
|
bool AutoLoadFail
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
struct registry_priv *registry_par = &pAdapter->registrypriv;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (!AutoLoadFail)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* Antenna Diversity setting. */
|
2015-08-15 18:02:34 +00:00
|
|
|
if (registry_par->antdiv_cfg == 2)/* 2:By EFUSE */
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->AntDivCfg = (PROMContent[EEPROM_RF_BOARD_OPTION_88E]&0x18)>>3;
|
2015-08-15 18:02:34 +00:00
|
|
|
if (PROMContent[EEPROM_RF_BOARD_OPTION_88E] == 0xFF)
|
2014-12-19 06:59:46 +00:00
|
|
|
pHalData->AntDivCfg = (EEPROM_DEFAULT_BOARD_OPTION&0x18)>>3;;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
else
|
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
pHalData->AntDivCfg = registry_par->antdiv_cfg ; /* 0:OFF , 1:ON, 2:By EFUSE */
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (registry_par->antdiv_type == 0)/* If TRxAntDivType is AUTO in advanced setting, use EFUSE value instead. */
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
|
|
|
pHalData->TRxAntDivType = PROMContent[EEPROM_RF_ANTENNA_OPT_88E];
|
|
|
|
if (pHalData->TRxAntDivType == 0xFF)
|
2015-02-20 00:51:33 +00:00
|
|
|
pHalData->TRxAntDivType = CG_TRX_HW_ANTDIV; /* For 88EE, 1Tx and 1RxCG are fixed.(1Ant, Tx and RxCG are both on aux port) */
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2015-08-15 18:27:00 +00:00
|
|
|
else {
|
2014-12-17 04:09:56 +00:00
|
|
|
pHalData->TRxAntDivType = registry_par->antdiv_type ;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
if (pHalData->TRxAntDivType == CG_TRX_HW_ANTDIV || pHalData->TRxAntDivType == CGCS_RX_HW_ANTDIV)
|
2015-02-20 00:51:33 +00:00
|
|
|
pHalData->AntDivCfg = 1; /* 0xC1[3] is ignored. */
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
pHalData->AntDivCfg = 0;
|
2015-02-20 00:51:33 +00:00
|
|
|
pHalData->TRxAntDivType = pHalData->TRxAntDivType; /* The value in the driver setting of device manager. */
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("EEPROM : AntDivCfg = %x, TRxAntDivType = %x\n",pHalData->AntDivCfg, pHalData->TRxAntDivType);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
void
|
|
|
|
Hal_ReadThermalMeter_88E(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter *Adapter,
|
|
|
|
u8* PROMContent,
|
|
|
|
bool AutoloadFail
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
2014-12-30 23:50:44 +00:00
|
|
|
u8 tempval;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* */
|
|
|
|
/* ThermalMeter from EEPROM */
|
|
|
|
/* */
|
2015-08-15 18:02:34 +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;
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (pHalData->EEPROMThermalMeter == 0xff || AutoloadFail)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
pHalData->bAPKThermalMeterIgnore = true;
|
2014-12-19 06:59:46 +00:00
|
|
|
pHalData->EEPROMThermalMeter = EEPROM_Default_ThermalMeter_88E;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* pHalData->ThermalMeter[0] = pHalData->EEPROMThermalMeter; */
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("ThermalMeter = 0x%x\n", pHalData->EEPROMThermalMeter);
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
Hal_InitChannelPlan(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter *padapter
|
2014-12-17 04:09:56 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-03-02 23:21:23 +00:00
|
|
|
bool HalDetectPwrDownMode88E(struct adapter *Adapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
u8 tmpvalue = 0;
|
2014-12-17 04:09:56 +00:00
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
|
|
|
struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(Adapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
EFUSE_ShadowRead(Adapter, 1, EEPROM_RF_FEATURE_OPTION_88E, (u32 *)&tmpvalue);
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* 2010/08/25 MH INF priority > PDN Efuse value. */
|
2015-08-15 18:02:34 +00:00
|
|
|
if (tmpvalue & BIT(4) && pwrctrlpriv->reg_pdnmode)
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
pHalData->pwrdown = true;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-17 04:09:56 +00:00
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
pHalData->pwrdown = false;
|
2014-12-17 04:09:56 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 04:09:56 +00:00
|
|
|
DBG_8192C("HalDetectPwrDownMode(): PDN=%d\n", pHalData->pwrdown);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return pHalData->pwrdown;
|
2015-02-20 00:51:33 +00:00
|
|
|
} /* HalDetectPwrDownMode */
|
2014-12-17 04:09:56 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* 20100209 Joseph: */
|
|
|
|
/* This function is used only for 92C to set REG_BCN_CTRL(0x550) register. */
|
|
|
|
/* We just reserve the value of the register in variable pHalData->RegBcnCtrlVal and then operate */
|
|
|
|
/* the value of the register via atomic operation. */
|
|
|
|
/* This prevents from race condition when setting this register. */
|
|
|
|
/* The value of pHalData->RegBcnCtrlVal is initialized in HwConfigureRTL8192CE() function. */
|
|
|
|
/* */
|
2014-12-17 04:09:56 +00:00
|
|
|
void SetBcnCtrlReg(
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *padapter,
|
2014-12-17 04:09:56 +00:00
|
|
|
u8 SetBits,
|
|
|
|
u8 ClearBits)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 04:09:56 +00:00
|
|
|
PHAL_DATA_TYPE pHalData;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
pHalData = GET_HAL_DATA(padapter);
|
|
|
|
|
|
|
|
pHalData->RegBcnCtrlVal |= SetBits;
|
|
|
|
pHalData->RegBcnCtrlVal &= ~ClearBits;
|
|
|
|
|
|
|
|
rtw_write8(padapter, REG_BCN_CTRL, (u8)pHalData->RegBcnCtrlVal);
|
|
|
|
}
|