mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2024-11-29 07:33:39 +00:00
rtl8188eu: Fix checkpatch ERRORs in core/rtw_efuse.c
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
4f7065928d
commit
7e4cdda1c0
1 changed files with 206 additions and 331 deletions
301
core/rtw_efuse.c
301
core/rtw_efuse.c
|
@ -26,18 +26,18 @@
|
||||||
|
|
||||||
|
|
||||||
/*------------------------Define local variable------------------------------*/
|
/*------------------------Define local variable------------------------------*/
|
||||||
u8 fakeEfuseBank=0;
|
u8 fakeEfuseBank;
|
||||||
u32 fakeEfuseUsedBytes=0;
|
u32 fakeEfuseUsedBytes;
|
||||||
u8 fakeEfuseContent[EFUSE_MAX_HW_SIZE] = {0};
|
u8 fakeEfuseContent[EFUSE_MAX_HW_SIZE] = {0};
|
||||||
u8 fakeEfuseInitMap[EFUSE_MAX_MAP_LEN] = {0};
|
u8 fakeEfuseInitMap[EFUSE_MAX_MAP_LEN] = {0};
|
||||||
u8 fakeEfuseModifiedMap[EFUSE_MAX_MAP_LEN] = {0};
|
u8 fakeEfuseModifiedMap[EFUSE_MAX_MAP_LEN] = {0};
|
||||||
|
|
||||||
u32 BTEfuseUsedBytes=0;
|
u32 BTEfuseUsedBytes;
|
||||||
u8 BTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
|
u8 BTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
|
||||||
u8 BTEfuseInitMap[EFUSE_BT_MAX_MAP_LEN] = {0};
|
u8 BTEfuseInitMap[EFUSE_BT_MAX_MAP_LEN] = {0};
|
||||||
u8 BTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN] = {0};
|
u8 BTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN] = {0};
|
||||||
|
|
||||||
u32 fakeBTEfuseUsedBytes=0;
|
u32 fakeBTEfuseUsedBytes;
|
||||||
u8 fakeBTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
|
u8 fakeBTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
|
||||||
u8 fakeBTEfuseInitMap[EFUSE_BT_MAX_MAP_LEN] = {0};
|
u8 fakeBTEfuseInitMap[EFUSE_BT_MAX_MAP_LEN] = {0};
|
||||||
u8 fakeBTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN] = {0};
|
u8 fakeBTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN] = {0};
|
||||||
|
@ -60,9 +60,7 @@ Efuse_Read1ByteFromFakeContent(
|
||||||
u8 *Value)
|
u8 *Value)
|
||||||
{
|
{
|
||||||
if (Offset >= EFUSE_MAX_HW_SIZE)
|
if (Offset >= EFUSE_MAX_HW_SIZE)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
if (fakeEfuseBank == 0)
|
if (fakeEfuseBank == 0)
|
||||||
*Value = fakeEfuseContent[Offset];
|
*Value = fakeEfuseContent[Offset];
|
||||||
else
|
else
|
||||||
|
@ -70,11 +68,6 @@ Efuse_Read1ByteFromFakeContent(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
Efuse_Write1ByteToFakeContent(
|
|
||||||
struct adapter * pAdapter,
|
|
||||||
u16 Offset,
|
|
||||||
u8 Value );
|
|
||||||
bool
|
bool
|
||||||
Efuse_Write1ByteToFakeContent(
|
Efuse_Write1ByteToFakeContent(
|
||||||
struct adapter *pAdapter,
|
struct adapter *pAdapter,
|
||||||
|
@ -82,13 +75,10 @@ Efuse_Write1ByteToFakeContent(
|
||||||
u8 Value)
|
u8 Value)
|
||||||
{
|
{
|
||||||
if (Offset >= EFUSE_MAX_HW_SIZE)
|
if (Offset >= EFUSE_MAX_HW_SIZE)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
if (fakeEfuseBank == 0) {
|
||||||
if (fakeEfuseBank == 0)
|
|
||||||
fakeEfuseContent[Offset] = Value;
|
fakeEfuseContent[Offset] = Value;
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
fakeBTEfuseContent[fakeEfuseBank-1][Offset] = Value;
|
fakeBTEfuseContent[fakeEfuseBank-1][Offset] = Value;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -115,10 +105,10 @@ Efuse_Write1ByteToFakeContent(
|
||||||
void
|
void
|
||||||
Efuse_PowerSwitch(
|
Efuse_PowerSwitch(
|
||||||
struct adapter *pAdapter,
|
struct adapter *pAdapter,
|
||||||
u8 bWrite,
|
u8 write,
|
||||||
u8 PwrState)
|
u8 PwrState)
|
||||||
{
|
{
|
||||||
pAdapter->HalFunc.EfusePowerSwitch(pAdapter, bWrite, PwrState);
|
pAdapter->HalFunc.EfusePowerSwitch(pAdapter, write, PwrState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
/*-----------------------------------------------------------------------------
|
||||||
|
@ -141,11 +131,11 @@ u16
|
||||||
Efuse_GetCurrentSize(
|
Efuse_GetCurrentSize(
|
||||||
struct adapter *pAdapter,
|
struct adapter *pAdapter,
|
||||||
u8 efuseType,
|
u8 efuseType,
|
||||||
bool bPseudoTest)
|
bool pseudo)
|
||||||
{
|
{
|
||||||
u16 ret = 0;
|
u16 ret = 0;
|
||||||
|
|
||||||
ret = pAdapter->HalFunc.EfuseGetCurrentSize(pAdapter, efuseType, bPseudoTest);
|
ret = pAdapter->HalFunc.EfuseGetCurrentSize(pAdapter, efuseType, pseudo);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -155,10 +145,14 @@ u8
|
||||||
Efuse_CalculateWordCnts(u8 word_en)
|
Efuse_CalculateWordCnts(u8 word_en)
|
||||||
{
|
{
|
||||||
u8 word_cnts = 0;
|
u8 word_cnts = 0;
|
||||||
if (!(word_en & BIT(0))) word_cnts++; /* 0 : write enable */
|
if (!(word_en & BIT(0)))
|
||||||
if (!(word_en & BIT(1))) word_cnts++;
|
word_cnts++; /* 0 : write enable */
|
||||||
if (!(word_en & BIT(2))) word_cnts++;
|
if (!(word_en & BIT(1)))
|
||||||
if (!(word_en & BIT(3))) word_cnts++;
|
word_cnts++;
|
||||||
|
if (!(word_en & BIT(2)))
|
||||||
|
word_cnts++;
|
||||||
|
if (!(word_en & BIT(3)))
|
||||||
|
word_cnts++;
|
||||||
return word_cnts;
|
return word_cnts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,14 +172,13 @@ ReadEFuseByte(
|
||||||
struct adapter *Adapter,
|
struct adapter *Adapter,
|
||||||
u16 _offset,
|
u16 _offset,
|
||||||
u8 *pbuf,
|
u8 *pbuf,
|
||||||
bool bPseudoTest)
|
bool pseudo)
|
||||||
{
|
{
|
||||||
u32 value32;
|
u32 value32;
|
||||||
u8 readbyte;
|
u8 readbyte;
|
||||||
u16 retry;
|
u16 retry;
|
||||||
|
|
||||||
if (bPseudoTest)
|
if (pseudo) {
|
||||||
{
|
|
||||||
Efuse_Read1ByteFromFakeContent(Adapter, _offset, pbuf);
|
Efuse_Read1ByteFromFakeContent(Adapter, _offset, pbuf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -202,8 +195,7 @@ ReadEFuseByte(
|
||||||
/* Check bit 32 read-ready */
|
/* Check bit 32 read-ready */
|
||||||
retry = 0;
|
retry = 0;
|
||||||
value32 = rtw_read32(Adapter, EFUSE_CTRL);
|
value32 = rtw_read32(Adapter, EFUSE_CTRL);
|
||||||
while (!(((value32 >> 24) & 0xff) & 0x80) && (retry<10000))
|
while (!(((value32 >> 24) & 0xff) & 0x80) && (retry < 10000)) {
|
||||||
{
|
|
||||||
value32 = rtw_read32(Adapter, EFUSE_CTRL);
|
value32 = rtw_read32(Adapter, EFUSE_CTRL);
|
||||||
retry++;
|
retry++;
|
||||||
}
|
}
|
||||||
|
@ -216,10 +208,8 @@ ReadEFuseByte(
|
||||||
value32 = rtw_read32(Adapter, EFUSE_CTRL);
|
value32 = rtw_read32(Adapter, EFUSE_CTRL);
|
||||||
|
|
||||||
*pbuf = (u8)(value32 & 0xff);
|
*pbuf = (u8)(value32 & 0xff);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
/* Description: */
|
/* Description: */
|
||||||
/* 1. Execute E-Fuse read byte operation according as map offset and */
|
/* 1. Execute E-Fuse read byte operation according as map offset and */
|
||||||
|
@ -238,38 +228,15 @@ ReadEFuseByte(
|
||||||
/* write addr must be after sec5. */
|
/* write addr must be after sec5. */
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
void
|
void efuse_ReadEFuse(struct adapter *Adapter, u8 efuseType, u16 _offset, u16 _size_byte, u8 *pbuf, bool pseudo)
|
||||||
efuse_ReadEFuse(
|
|
||||||
struct adapter * Adapter,
|
|
||||||
u8 efuseType,
|
|
||||||
u16 _offset,
|
|
||||||
u16 _size_byte,
|
|
||||||
u8 *pbuf,
|
|
||||||
bool bPseudoTest
|
|
||||||
);
|
|
||||||
void
|
|
||||||
efuse_ReadEFuse(
|
|
||||||
struct adapter * Adapter,
|
|
||||||
u8 efuseType,
|
|
||||||
u16 _offset,
|
|
||||||
u16 _size_byte,
|
|
||||||
u8 *pbuf,
|
|
||||||
bool bPseudoTest
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
Adapter->HalFunc.ReadEFuse(Adapter, efuseType, _offset, _size_byte, pbuf, bPseudoTest);
|
Adapter->HalFunc.ReadEFuse(Adapter, efuseType, _offset, _size_byte, pbuf, pseudo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void EFUSE_GetEfuseDefinition(struct adapter *pAdapter, u8 efuseType, u8 type, void *pOut, bool pseudo
|
||||||
EFUSE_GetEfuseDefinition(
|
|
||||||
struct adapter * pAdapter,
|
|
||||||
u8 efuseType,
|
|
||||||
u8 type,
|
|
||||||
void *pOut,
|
|
||||||
bool bPseudoTest
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
pAdapter->HalFunc.EFUSEGetEfuseDefinition(pAdapter, efuseType, type, pOut, bPseudoTest);
|
pAdapter->HalFunc.EFUSEGetEfuseDefinition(pAdapter, efuseType, type, pOut, pseudo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
/*-----------------------------------------------------------------------------
|
||||||
|
@ -288,10 +255,7 @@ EFUSE_GetEfuseDefinition(
|
||||||
* 09/23/2008 MHC Copy from WMAC.
|
* 09/23/2008 MHC Copy from WMAC.
|
||||||
*
|
*
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
u8
|
u8 EFUSE_Read1Byte(struct adapter *Adapter, u16 Address)
|
||||||
EFUSE_Read1Byte(
|
|
||||||
struct adapter * Adapter,
|
|
||||||
u16 Address)
|
|
||||||
{
|
{
|
||||||
u8 data;
|
u8 data;
|
||||||
u8 Bytetemp = {0x00};
|
u8 Bytetemp = {0x00};
|
||||||
|
@ -301,8 +265,7 @@ EFUSE_Read1Byte(
|
||||||
|
|
||||||
EFUSE_GetEfuseDefinition(Adapter, EFUSE_WIFI , TYPE_EFUSE_REAL_CONTENT_LEN, (void *)&contentLen, false);
|
EFUSE_GetEfuseDefinition(Adapter, EFUSE_WIFI , TYPE_EFUSE_REAL_CONTENT_LEN, (void *)&contentLen, false);
|
||||||
|
|
||||||
if (Address < contentLen) /* E-fuse 512Byte */
|
if (Address < contentLen) { /* E-fuse 512Byte */
|
||||||
{
|
|
||||||
/* Write E-fuse Register address bit0~7 */
|
/* Write E-fuse Register address bit0~7 */
|
||||||
temp = Address & 0xFF;
|
temp = Address & 0xFF;
|
||||||
rtw_write8(Adapter, EFUSE_CTRL+1, temp);
|
rtw_write8(Adapter, EFUSE_CTRL+1, temp);
|
||||||
|
@ -318,21 +281,19 @@ EFUSE_Read1Byte(
|
||||||
|
|
||||||
/* Wait Write-ready (0x30[31]= 1) */
|
/* Wait Write-ready (0x30[31]= 1) */
|
||||||
Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
|
Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
|
||||||
while (!(Bytetemp & 0x80))
|
while (!(Bytetemp & 0x80)) {
|
||||||
{
|
|
||||||
Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
|
Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
|
||||||
k++;
|
k++;
|
||||||
if (k==1000)
|
if (k == 1000) {
|
||||||
{
|
|
||||||
k = 0;
|
k = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data = rtw_read8(Adapter, EFUSE_CTRL);
|
data = rtw_read8(Adapter, EFUSE_CTRL);
|
||||||
return data;
|
return data;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
return 0xFF;
|
return 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
} /* EFUSE_Read1Byte */
|
} /* EFUSE_Read1Byte */
|
||||||
|
|
||||||
|
@ -353,16 +314,7 @@ EFUSE_Read1Byte(
|
||||||
*
|
*
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void
|
void EFUSE_Write1Byte(struct adapter *Adapter, u16 Address, u8 Value)
|
||||||
EFUSE_Write1Byte(
|
|
||||||
struct adapter * Adapter,
|
|
||||||
u16 Address,
|
|
||||||
u8 Value);
|
|
||||||
void
|
|
||||||
EFUSE_Write1Byte(
|
|
||||||
struct adapter * Adapter,
|
|
||||||
u16 Address,
|
|
||||||
u8 Value)
|
|
||||||
{
|
{
|
||||||
u8 Bytetemp = {0x00};
|
u8 Bytetemp = {0x00};
|
||||||
u8 temp = {0x00};
|
u8 temp = {0x00};
|
||||||
|
@ -372,8 +324,7 @@ EFUSE_Write1Byte(
|
||||||
/* RT_TRACE(COMP_EFUSE, DBG_LOUD, ("Addr =%x Data =%x\n", Address, Value)); */
|
/* RT_TRACE(COMP_EFUSE, DBG_LOUD, ("Addr =%x Data =%x\n", Address, Value)); */
|
||||||
EFUSE_GetEfuseDefinition(Adapter, EFUSE_WIFI , TYPE_EFUSE_REAL_CONTENT_LEN, (void *)&contentLen, false);
|
EFUSE_GetEfuseDefinition(Adapter, EFUSE_WIFI , TYPE_EFUSE_REAL_CONTENT_LEN, (void *)&contentLen, false);
|
||||||
|
|
||||||
if ( Address < contentLen) /* E-fuse 512Byte */
|
if (Address < contentLen) { /* E-fuse 512Byte */
|
||||||
{
|
|
||||||
rtw_write8(Adapter, EFUSE_CTRL, Value);
|
rtw_write8(Adapter, EFUSE_CTRL, Value);
|
||||||
|
|
||||||
/* Write E-fuse Register address bit0~7 */
|
/* Write E-fuse Register address bit0~7 */
|
||||||
|
@ -392,12 +343,10 @@ EFUSE_Write1Byte(
|
||||||
|
|
||||||
/* Wait Write-ready (0x30[31]= 0) */
|
/* Wait Write-ready (0x30[31]= 0) */
|
||||||
Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
|
Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
|
||||||
while (Bytetemp & 0x80)
|
while (Bytetemp & 0x80) {
|
||||||
{
|
|
||||||
Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
|
Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
|
||||||
k++;
|
k++;
|
||||||
if (k==100)
|
if (k == 100) {
|
||||||
{
|
|
||||||
k = 0;
|
k = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -406,20 +355,14 @@ EFUSE_Write1Byte(
|
||||||
} /* EFUSE_Write1Byte */
|
} /* EFUSE_Write1Byte */
|
||||||
|
|
||||||
/* 11/16/2008 MH Read one byte from real Efuse. */
|
/* 11/16/2008 MH Read one byte from real Efuse. */
|
||||||
u8
|
u8 efuse_OneByteRead(struct adapter *pAdapter, u16 addr, u8 *data, bool pseudo)
|
||||||
efuse_OneByteRead(
|
|
||||||
struct adapter * pAdapter,
|
|
||||||
u16 addr,
|
|
||||||
u8 *data,
|
|
||||||
bool bPseudoTest)
|
|
||||||
{
|
{
|
||||||
u8 tmpidx = 0;
|
u8 tmpidx = 0;
|
||||||
u8 bResult;
|
u8 result;
|
||||||
|
|
||||||
if (bPseudoTest)
|
if (pseudo) {
|
||||||
{
|
result = Efuse_Read1ByteFromFakeContent(pAdapter, addr, data);
|
||||||
bResult = Efuse_Read1ByteFromFakeContent(pAdapter, addr, data);
|
return result;
|
||||||
return bResult;
|
|
||||||
}
|
}
|
||||||
/* -----------------e-fuse reg ctrl --------------------------------- */
|
/* -----------------e-fuse reg ctrl --------------------------------- */
|
||||||
/* address */
|
/* address */
|
||||||
|
@ -430,105 +373,73 @@ efuse_OneByteRead(
|
||||||
rtw_write8(pAdapter, EFUSE_CTRL+3, 0x72);/* read cmd */
|
rtw_write8(pAdapter, EFUSE_CTRL+3, 0x72);/* read cmd */
|
||||||
|
|
||||||
while (!(0x80 & rtw_read8(pAdapter, EFUSE_CTRL+3)) && (tmpidx < 100))
|
while (!(0x80 & rtw_read8(pAdapter, EFUSE_CTRL+3)) && (tmpidx < 100))
|
||||||
{
|
|
||||||
tmpidx++;
|
tmpidx++;
|
||||||
}
|
if (tmpidx < 100) {
|
||||||
if (tmpidx<100)
|
|
||||||
{
|
|
||||||
*data = rtw_read8(pAdapter, EFUSE_CTRL);
|
*data = rtw_read8(pAdapter, EFUSE_CTRL);
|
||||||
bResult = true;
|
result = true;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
*data = 0xff;
|
*data = 0xff;
|
||||||
bResult = false;
|
result = false;
|
||||||
}
|
}
|
||||||
return bResult;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 11/16/2008 MH Write one byte to reald Efuse. */
|
/* 11/16/2008 MH Write one byte to reald Efuse. */
|
||||||
u8
|
u8 efuse_OneByteWrite(struct adapter *pAdapter, u16 addr, u8 data, bool pseudo)
|
||||||
efuse_OneByteWrite(
|
|
||||||
struct adapter * pAdapter,
|
|
||||||
u16 addr,
|
|
||||||
u8 data,
|
|
||||||
bool bPseudoTest)
|
|
||||||
{
|
{
|
||||||
u8 tmpidx = 0;
|
u8 tmpidx = 0;
|
||||||
u8 bResult;
|
u8 result;
|
||||||
|
|
||||||
if (bPseudoTest)
|
if (pseudo) {
|
||||||
{
|
result = Efuse_Write1ByteToFakeContent(pAdapter, addr, data);
|
||||||
bResult = Efuse_Write1ByteToFakeContent(pAdapter, addr, data);
|
return result;
|
||||||
return bResult;
|
|
||||||
}
|
}
|
||||||
/* RT_TRACE(COMP_EFUSE, DBG_LOUD, ("Addr = %x Data=%x\n", addr, data)); */
|
|
||||||
|
|
||||||
/* return 0; */
|
|
||||||
|
|
||||||
/* -----------------e-fuse reg ctrl --------------------------------- */
|
/* -----------------e-fuse reg ctrl --------------------------------- */
|
||||||
/* address */
|
/* address */
|
||||||
rtw_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr&0xff));
|
rtw_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr&0xff));
|
||||||
rtw_write8(pAdapter, EFUSE_CTRL+2,
|
rtw_write8(pAdapter, EFUSE_CTRL+2,
|
||||||
(rtw_read8(pAdapter, EFUSE_CTRL+2)&0xFC )|(u8)((addr>>8)&0x03) );
|
(rtw_read8(pAdapter, EFUSE_CTRL+2) & 0xFC) |
|
||||||
|
(u8)((addr>>8) & 0x03));
|
||||||
rtw_write8(pAdapter, EFUSE_CTRL, data);/* data */
|
rtw_write8(pAdapter, EFUSE_CTRL, data);/* data */
|
||||||
|
|
||||||
rtw_write8(pAdapter, EFUSE_CTRL+3, 0xF2);/* write cmd */
|
rtw_write8(pAdapter, EFUSE_CTRL+3, 0xF2);/* write cmd */
|
||||||
|
|
||||||
while ((0x80 & rtw_read8(pAdapter, EFUSE_CTRL+3)) && (tmpidx<100) ){
|
while ((0x80 & rtw_read8(pAdapter, EFUSE_CTRL+3)) && (tmpidx < 100))
|
||||||
tmpidx++;
|
tmpidx++;
|
||||||
}
|
|
||||||
|
|
||||||
if (tmpidx < 100)
|
if (tmpidx < 100)
|
||||||
{
|
result = true;
|
||||||
bResult = true;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
result = false;
|
||||||
bResult = false;
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bResult;
|
int Efuse_PgPacketRead(struct adapter *pAdapter, u8 offset, u8 *data, bool pseudo)
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
Efuse_PgPacketRead( struct adapter * pAdapter,
|
|
||||||
u8 offset,
|
|
||||||
u8 *data,
|
|
||||||
bool bPseudoTest)
|
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
ret = pAdapter->HalFunc.Efuse_PgPacketRead(pAdapter, offset, data, bPseudoTest);
|
ret = pAdapter->HalFunc.Efuse_PgPacketRead(pAdapter, offset, data, pseudo);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int Efuse_PgPacketWrite(struct adapter *pAdapter, u8 offset, u8 word_en, u8 *data, bool pseudo)
|
||||||
Efuse_PgPacketWrite( struct adapter * pAdapter,
|
|
||||||
u8 offset,
|
|
||||||
u8 word_en,
|
|
||||||
u8 *data,
|
|
||||||
bool bPseudoTest)
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = pAdapter->HalFunc.Efuse_PgPacketWrite(pAdapter, offset, word_en, data, bPseudoTest);
|
ret = pAdapter->HalFunc.Efuse_PgPacketWrite(pAdapter, offset, word_en, data, pseudo);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int Efuse_PgPacketWrite_BT(struct adapter *pAdapter, u8 offset, u8 word_en, u8 *data, bool pseudo)
|
||||||
Efuse_PgPacketWrite_BT( struct adapter * pAdapter,
|
|
||||||
u8 offset,
|
|
||||||
u8 word_en,
|
|
||||||
u8 *data,
|
|
||||||
bool bPseudoTest)
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = pAdapter->HalFunc.Efuse_PgPacketWrite_BT(pAdapter, offset, word_en, data, bPseudoTest);
|
ret = pAdapter->HalFunc.Efuse_PgPacketWrite_BT(pAdapter, offset, word_en, data, pseudo);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -550,44 +461,31 @@ Efuse_PgPacketWrite_BT( struct adapter * pAdapter,
|
||||||
* 11/21/2008 MHC Fix Write bug when we only enable late word.
|
* 11/21/2008 MHC Fix Write bug when we only enable late word.
|
||||||
*
|
*
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
void
|
void efuse_WordEnableDataRead(u8 word_en, u8 *sourdata, u8 *targetdata)
|
||||||
efuse_WordEnableDataRead( u8 word_en,
|
|
||||||
u8 *sourdata,
|
|
||||||
u8 *targetdata)
|
|
||||||
{
|
|
||||||
if (!(word_en&BIT(0)))
|
|
||||||
{
|
{
|
||||||
|
if (!(word_en&BIT(0))) {
|
||||||
targetdata[0] = sourdata[0];
|
targetdata[0] = sourdata[0];
|
||||||
targetdata[1] = sourdata[1];
|
targetdata[1] = sourdata[1];
|
||||||
}
|
}
|
||||||
if (!(word_en&BIT(1)))
|
if (!(word_en&BIT(1))) {
|
||||||
{
|
|
||||||
targetdata[2] = sourdata[2];
|
targetdata[2] = sourdata[2];
|
||||||
targetdata[3] = sourdata[3];
|
targetdata[3] = sourdata[3];
|
||||||
}
|
}
|
||||||
if (!(word_en&BIT(2)))
|
if (!(word_en&BIT(2))) {
|
||||||
{
|
|
||||||
targetdata[4] = sourdata[4];
|
targetdata[4] = sourdata[4];
|
||||||
targetdata[5] = sourdata[5];
|
targetdata[5] = sourdata[5];
|
||||||
}
|
}
|
||||||
if (!(word_en&BIT(3)))
|
if (!(word_en&BIT(3))) {
|
||||||
{
|
|
||||||
targetdata[6] = sourdata[6];
|
targetdata[6] = sourdata[6];
|
||||||
targetdata[7] = sourdata[7];
|
targetdata[7] = sourdata[7];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u8 Efuse_WordEnableDataWrite(struct adapter *pAdapter, u16 efuse_addr, u8 word_en, u8 *data, bool pseudo)
|
||||||
u8
|
|
||||||
Efuse_WordEnableDataWrite( struct adapter * pAdapter,
|
|
||||||
u16 efuse_addr,
|
|
||||||
u8 word_en,
|
|
||||||
u8 *data,
|
|
||||||
bool bPseudoTest)
|
|
||||||
{
|
{
|
||||||
u8 ret = 0;
|
u8 ret = 0;
|
||||||
|
|
||||||
ret = pAdapter->HalFunc.Efuse_WordEnableDataWrite(pAdapter, efuse_addr, word_en, data, bPseudoTest);
|
ret = pAdapter->HalFunc.Efuse_WordEnableDataWrite(pAdapter, efuse_addr, word_en, data, pseudo);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -605,7 +503,7 @@ static u8 efuse_write8(struct adapter * padapter, u16 address, u8 *value)
|
||||||
/*
|
/*
|
||||||
* read/wirte raw efuse data
|
* read/wirte raw efuse data
|
||||||
*/
|
*/
|
||||||
u8 rtw_efuse_access(struct adapter * padapter, u8 bWrite, u16 start_addr, u16 cnts, u8 *data)
|
u8 rtw_efuse_access(struct adapter *padapter, u8 write, u16 start_addr, u16 cnts, u8 *data)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
u16 real_content_len = 0, max_available_size = 0;
|
u16 real_content_len = 0, max_available_size = 0;
|
||||||
|
@ -618,14 +516,15 @@ u8 rtw_efuse_access(struct adapter * padapter, u8 bWrite, u16 start_addr, u16 cn
|
||||||
if (start_addr > real_content_len)
|
if (start_addr > real_content_len)
|
||||||
return _FAIL;
|
return _FAIL;
|
||||||
|
|
||||||
if (true == bWrite) {
|
if (write) {
|
||||||
if ((start_addr + cnts) > max_available_size)
|
if ((start_addr + cnts) > max_available_size)
|
||||||
return _FAIL;
|
return _FAIL;
|
||||||
rw8 = &efuse_write8;
|
rw8 = &efuse_write8;
|
||||||
} else
|
} else {
|
||||||
rw8 = &efuse_read8;
|
rw8 = &efuse_read8;
|
||||||
|
}
|
||||||
|
|
||||||
Efuse_PowerSwitch(padapter, bWrite, true);
|
Efuse_PowerSwitch(padapter, write, true);
|
||||||
|
|
||||||
/* e-fuse one byte read / write */
|
/* e-fuse one byte read / write */
|
||||||
for (i = 0; i < cnts; i++) {
|
for (i = 0; i < cnts; i++) {
|
||||||
|
@ -635,10 +534,11 @@ u8 rtw_efuse_access(struct adapter * padapter, u8 bWrite, u16 start_addr, u16 cn
|
||||||
}
|
}
|
||||||
|
|
||||||
res = rw8(padapter, start_addr++, data++);
|
res = rw8(padapter, start_addr++, data++);
|
||||||
if (_FAIL == res) break;
|
if (_FAIL == res)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Efuse_PowerSwitch(padapter, bWrite, false);
|
Efuse_PowerSwitch(padapter, write, false);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -806,7 +706,8 @@ u8 rtw_BT_efuse_map_write(struct adapter * padapter, u16 addr, u16 cnts, u8 *dat
|
||||||
return _FAIL;
|
return _FAIL;
|
||||||
|
|
||||||
ret = rtw_BT_efuse_map_read(padapter, 0, mapLen, map);
|
ret = rtw_BT_efuse_map_read(padapter, 0, mapLen, map);
|
||||||
if (ret == _FAIL) goto exit;
|
if (ret == _FAIL)
|
||||||
|
goto exit;
|
||||||
|
|
||||||
Efuse_PowerSwitch(padapter, true, true);
|
Efuse_PowerSwitch(padapter, true, true);
|
||||||
|
|
||||||
|
@ -898,26 +799,15 @@ exit:
|
||||||
* 11/11/2008 MHC Create Version 0.
|
* 11/11/2008 MHC Create Version 0.
|
||||||
*
|
*
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
void
|
void Efuse_ReadAllMap(struct adapter *pAdapter, u8 efuseType, u8 *Efuse, bool pseudo)
|
||||||
Efuse_ReadAllMap(
|
|
||||||
struct adapter * pAdapter,
|
|
||||||
u8 efuseType,
|
|
||||||
u8 *Efuse,
|
|
||||||
bool bPseudoTest);
|
|
||||||
void
|
|
||||||
Efuse_ReadAllMap(
|
|
||||||
struct adapter * pAdapter,
|
|
||||||
u8 efuseType,
|
|
||||||
u8 *Efuse,
|
|
||||||
bool bPseudoTest)
|
|
||||||
{
|
{
|
||||||
u16 mapLen = 0;
|
u16 mapLen = 0;
|
||||||
|
|
||||||
Efuse_PowerSwitch(pAdapter, false, true);
|
Efuse_PowerSwitch(pAdapter, false, true);
|
||||||
|
|
||||||
EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_EFUSE_MAP_LEN, (void *)&mapLen, bPseudoTest);
|
EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_EFUSE_MAP_LEN, (void *)&mapLen, pseudo);
|
||||||
|
|
||||||
efuse_ReadEFuse(pAdapter, efuseType, 0, mapLen, Efuse, bPseudoTest);
|
efuse_ReadEFuse(pAdapter, efuseType, 0, mapLen, Efuse, pseudo);
|
||||||
|
|
||||||
Efuse_PowerSwitch(pAdapter, false, false);
|
Efuse_PowerSwitch(pAdapter, false, false);
|
||||||
}
|
}
|
||||||
|
@ -1062,17 +952,17 @@ efuse_ShadowWrite4Byte(
|
||||||
void EFUSE_ShadowMapUpdate(
|
void EFUSE_ShadowMapUpdate(
|
||||||
struct adapter *pAdapter,
|
struct adapter *pAdapter,
|
||||||
u8 efuseType,
|
u8 efuseType,
|
||||||
bool bPseudoTest)
|
bool pseudo)
|
||||||
{
|
{
|
||||||
struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
|
struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
|
||||||
u16 mapLen = 0;
|
u16 mapLen = 0;
|
||||||
|
|
||||||
EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_EFUSE_MAP_LEN, (void *)&mapLen, bPseudoTest);
|
EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_EFUSE_MAP_LEN, (void *)&mapLen, pseudo);
|
||||||
|
|
||||||
if (pEEPROM->bautoload_fail_flag == true)
|
if (pEEPROM->bautoload_fail_flag)
|
||||||
_rtw_memset(pEEPROM->efuse_eeprom_data, 0xFF, mapLen);
|
_rtw_memset(pEEPROM->efuse_eeprom_data, 0xFF, mapLen);
|
||||||
else
|
else
|
||||||
Efuse_ReadAllMap(pAdapter, efuseType, pEEPROM->efuse_eeprom_data, bPseudoTest);
|
Efuse_ReadAllMap(pAdapter, efuseType, pEEPROM->efuse_eeprom_data, pseudo);
|
||||||
} /* EFUSE_ShadowMapUpdate */
|
} /* EFUSE_ShadowMapUpdate */
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
/*-----------------------------------------------------------------------------
|
||||||
|
@ -1123,18 +1013,7 @@ EFUSE_ShadowRead(
|
||||||
* 11/12/2008 MHC Create Version 0.
|
* 11/12/2008 MHC Create Version 0.
|
||||||
*
|
*
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
void
|
void EFUSE_ShadowWrite(struct adapter *pAdapter, u8 Type, u16 Offset, u32 Value)
|
||||||
EFUSE_ShadowWrite(
|
|
||||||
struct adapter * pAdapter,
|
|
||||||
u8 Type,
|
|
||||||
u16 Offset,
|
|
||||||
u32 Value);
|
|
||||||
void
|
|
||||||
EFUSE_ShadowWrite(
|
|
||||||
struct adapter * pAdapter,
|
|
||||||
u8 Type,
|
|
||||||
u16 Offset,
|
|
||||||
u32 Value)
|
|
||||||
{
|
{
|
||||||
if (pAdapter->registrypriv.mp_mode == 0)
|
if (pAdapter->registrypriv.mp_mode == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -1157,16 +1036,12 @@ void Efuse_InitSomeVar(struct adapter *pAdapter)
|
||||||
_rtw_memset((void *)&fakeEfuseModifiedMap[0], 0xff, EFUSE_MAX_MAP_LEN);
|
_rtw_memset((void *)&fakeEfuseModifiedMap[0], 0xff, EFUSE_MAX_MAP_LEN);
|
||||||
|
|
||||||
for (i = 0; i < EFUSE_MAX_BT_BANK; i++)
|
for (i = 0; i < EFUSE_MAX_BT_BANK; i++)
|
||||||
{
|
|
||||||
_rtw_memset((void *)&BTEfuseContent[i][0], EFUSE_MAX_HW_SIZE, 0xff);
|
_rtw_memset((void *)&BTEfuseContent[i][0], EFUSE_MAX_HW_SIZE, 0xff);
|
||||||
}
|
|
||||||
_rtw_memset((void *)&BTEfuseInitMap[0], 0xff, EFUSE_BT_MAX_MAP_LEN);
|
_rtw_memset((void *)&BTEfuseInitMap[0], 0xff, EFUSE_BT_MAX_MAP_LEN);
|
||||||
_rtw_memset((void *)&BTEfuseModifiedMap[0], 0xff, EFUSE_BT_MAX_MAP_LEN);
|
_rtw_memset((void *)&BTEfuseModifiedMap[0], 0xff, EFUSE_BT_MAX_MAP_LEN);
|
||||||
|
|
||||||
for (i = 0; i < EFUSE_MAX_BT_BANK; i++)
|
for (i = 0; i < EFUSE_MAX_BT_BANK; i++)
|
||||||
{
|
|
||||||
_rtw_memset((void *)&fakeBTEfuseContent[i][0], 0xff, EFUSE_MAX_HW_SIZE);
|
_rtw_memset((void *)&fakeBTEfuseContent[i][0], 0xff, EFUSE_MAX_HW_SIZE);
|
||||||
}
|
|
||||||
_rtw_memset((void *)&fakeBTEfuseInitMap[0], 0xff, EFUSE_BT_MAX_MAP_LEN);
|
_rtw_memset((void *)&fakeBTEfuseInitMap[0], 0xff, EFUSE_BT_MAX_MAP_LEN);
|
||||||
_rtw_memset((void *)&fakeBTEfuseModifiedMap[0], 0xff, EFUSE_BT_MAX_MAP_LEN);
|
_rtw_memset((void *)&fakeBTEfuseModifiedMap[0], 0xff, EFUSE_BT_MAX_MAP_LEN);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue