Skip to contentSkip to conversation

staging: r8188eu: more efuse cleanup

PATCH In review Martin Kaiser 2 participants 19 messages Nov 13, 2021 – Nov 15, 2021 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: r8188eu: more efuse cleanup

This series removes some more unused parts of the efuse code.

Martin Kaiser (15):
staging: r8188eu: remove efuse type from definition functions
staging: r8188eu: remove efuse type from read functions
staging: r8188eu: remove test code for efuse shadow map
staging: r8188eu: merge small adapter info helpers
staging: r8188eu: rtl8188e_EfuseGetCurrentSize is now unused
staging: r8188eu: rtl8188e_Efuse_PgPacketRead is now unused
staging: r8188eu: merge Efuse_ReadAllMap into EFUSE_ShadowMapUpdate
staging: r8188eu: use efuse map length define directly
staging: r8188eu: rtl8188e_EFUSE_GetEfuseDefinition is unused
staging: r8188eu: remove defines for efuse type
staging: r8188eu: efuse_OneByteRead is unused
staging: r8188eu: efuse_OneByteWrite is unused
staging: r8188eu: remove bt efuse definitions
staging: r8188eu: remove fake efuse variables
staging: r8188eu: remove the efuse_hal structure

 drivers/staging/r8188eu/core/rtw_efuse.c      | 162 +-------
 .../staging/r8188eu/hal/rtl8188e_hal_init.c   | 370 +-----------------
 drivers/staging/r8188eu/hal/usb_halinit.c     |  42 +-
 drivers/staging/r8188eu/include/hal_intf.h    |   8 +-
 .../staging/r8188eu/include/rtl8188e_hal.h    |   2 -
 drivers/staging/r8188eu/include/rtw_efuse.h   |  79 +---
 6 files changed, 50 insertions(+), 613 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/15 staging: r8188eu: remove efuse type from definition functions

Hal_EFUSEGetEfuseDefinition88E and Hal_EFUSEGetEfuseDefinition_Pseudo88E do not use their efuseType parameter.

Remove the parameter from these functions and from their callers.

---
 drivers/staging/r8188eu/core/rtw_efuse.c        |  4 ++--
 drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 12 ++++++------
 drivers/staging/r8188eu/include/hal_intf.h      |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)
drivers/staging/r8188eu/core/rtw_efuse.c +2 -2
index bcdacae1b058..9cad66f9df91 100644
@@ -243,7 +243,7 @@ static void Efuse_ReadAllMap(struct adapter *pAdapter, u8 efuseType, u8 *Efuse,
 
 	rtl8188e_EfusePowerSwitch(pAdapter, true);
 
-	rtl8188e_EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_EFUSE_MAP_LEN, (void *)&mapLen, pseudo);
+	rtl8188e_EFUSE_GetEfuseDefinition(pAdapter, TYPE_EFUSE_MAP_LEN, (void *)&mapLen, pseudo);
 
 	rtl8188e_ReadEFuse(pAdapter, efuseType, 0, mapLen, Efuse, pseudo);
 
@@ -274,7 +274,7 @@ void EFUSE_ShadowMapUpdate(
 	struct eeprom_priv *pEEPROM = &pAdapter->eeprompriv;
 	u16 mapLen = 0;
 
-	rtl8188e_EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_EFUSE_MAP_LEN, (void *)&mapLen, pseudo);
+	rtl8188e_EFUSE_GetEfuseDefinition(pAdapter, TYPE_EFUSE_MAP_LEN, (void *)&mapLen, pseudo);
 
 	if (pEEPROM->bautoload_fail_flag)
 		memset(pEEPROM->efuse_eeprom_data, 0xFF, mapLen);
drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +6 -6
index 019e67a7989f..f0d51eb694e7 100644
@@ -852,7 +852,7 @@ void rtl8188e_ReadEFuse(struct adapter *Adapter, u8 efuseType,
 }
 
 /* Do not support BT */
-static void Hal_EFUSEGetEfuseDefinition88E(struct adapter *pAdapter, u8 efuseType, u8 type, void *pOut)
+static void Hal_EFUSEGetEfuseDefinition88E(struct adapter *pAdapter, u8 type, void *pOut)
 {
 	switch (type) {
 	case TYPE_EFUSE_MAX_SECTION:
@@ -914,7 +914,7 @@ static void Hal_EFUSEGetEfuseDefinition88E(struct adapter *pAdapter, u8 efuseTyp
 	}
 }
 
-static void Hal_EFUSEGetEfuseDefinition_Pseudo88E(struct adapter *pAdapter, u8 efuseType, u8 type, void *pOut)
+static void Hal_EFUSEGetEfuseDefinition_Pseudo88E(struct adapter *pAdapter, u8 type, void *pOut)
 {
 	switch (type) {
 	case TYPE_EFUSE_MAX_SECTION:
@@ -976,12 +976,12 @@ static void Hal_EFUSEGetEfuseDefinition_Pseudo88E(struct adapter *pAdapter, u8 e
 	}
 }
 
-void rtl8188e_EFUSE_GetEfuseDefinition(struct adapter *pAdapter, u8 efuseType, u8 type, void *pOut, bool bPseudoTest)
+void rtl8188e_EFUSE_GetEfuseDefinition(struct adapter *pAdapter, u8 type, void *pOut, bool bPseudoTest)
 {
 	if (bPseudoTest)
-		Hal_EFUSEGetEfuseDefinition_Pseudo88E(pAdapter, efuseType, type, pOut);
+		Hal_EFUSEGetEfuseDefinition_Pseudo88E(pAdapter, type, pOut);
 	else
-		Hal_EFUSEGetEfuseDefinition88E(pAdapter, efuseType, type, pOut);
+		Hal_EFUSEGetEfuseDefinition88E(pAdapter, type, pOut);
 }
 
 static u16 hal_EfuseGetCurrentSize_8188e(struct adapter *pAdapter, bool bPseudoTest)
@@ -1060,7 +1060,7 @@ static int hal_EfusePgPacketRead_8188e(struct adapter *pAdapter, u8 offset, u8 *
 	u8 max_section = 0;
 	u8 tmp_header = 0;
 
-	rtl8188e_EFUSE_GetEfuseDefinition(pAdapter, EFUSE_WIFI, TYPE_EFUSE_MAX_SECTION, (void *)&max_section, bPseudoTest);
+	rtl8188e_EFUSE_GetEfuseDefinition(pAdapter, TYPE_EFUSE_MAX_SECTION, (void *)&max_section, bPseudoTest);
 
 	if (!data)
 		return false;
drivers/staging/r8188eu/include/hal_intf.h +1 -1
index e27300678114..6c53f2ca665d 100644
@@ -124,7 +124,7 @@ void rtl8188e_EfusePowerSwitch(struct adapter *pAdapter, u8 PwrState);
 void rtl8188e_ReadEFuse(struct adapter *Adapter, u8 efuseType,
 			u16 _offset, u16 _size_byte, u8 *pbuf,
 			bool bPseudoTest);
-void rtl8188e_EFUSE_GetEfuseDefinition(struct adapter *pAdapter, u8 efuseType,
+void rtl8188e_EFUSE_GetEfuseDefinition(struct adapter *pAdapter,
 				       u8 type, void *pOut, bool bPseudoTest);
 u16 rtl8188e_EfuseGetCurrentSize(struct adapter *pAdapter, u8 efuseType, bool bPseudoTest);
 int rtl8188e_Efuse_PgPacketRead(struct adapter *pAdapter, u8 offset, u8 *data, bool bPseudoTest);
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/15 staging: r8188eu: remove efuse type from read functions

In reply to Martin Kaiser

Efuse_ReadAllMap, ReadEFuseByIC and ReadEFuse_Pseudo do not use their efuseType parameter. Remove the parameter from these functions and from their callers.

---
 drivers/staging/r8188eu/core/rtw_efuse.c        |  7 +++----
 drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 14 ++++++--------
 drivers/staging/r8188eu/include/hal_intf.h      |  2 +-
 drivers/staging/r8188eu/include/rtw_efuse.h     |  2 +-
 4 files changed, 11 insertions(+), 14 deletions(-)
drivers/staging/r8188eu/core/rtw_efuse.c +3 -4
index 9cad66f9df91..d8ae995270bc 100644
@@ -237,7 +237,7 @@ void efuse_WordEnableDataRead(u8 word_en, u8 *sourdata, u8 *targetdata)
  * 11/11/2008	MHC		Create Version 0.
  *
  *---------------------------------------------------------------------------*/
-static void Efuse_ReadAllMap(struct adapter *pAdapter, u8 efuseType, u8 *Efuse, bool pseudo)
+static void Efuse_ReadAllMap(struct adapter *pAdapter, u8 *Efuse, bool pseudo)
 {
 	u16 mapLen = 0;
 
@@ -245,7 +245,7 @@ static void Efuse_ReadAllMap(struct adapter *pAdapter, u8 efuseType, u8 *Efuse,
 
 	rtl8188e_EFUSE_GetEfuseDefinition(pAdapter, TYPE_EFUSE_MAP_LEN, (void *)&mapLen, pseudo);
 
-	rtl8188e_ReadEFuse(pAdapter, efuseType, 0, mapLen, Efuse, pseudo);
+	rtl8188e_ReadEFuse(pAdapter, 0, mapLen, Efuse, pseudo);
 
 	rtl8188e_EfusePowerSwitch(pAdapter, false);
 }
@@ -268,7 +268,6 @@ static void Efuse_ReadAllMap(struct adapter *pAdapter, u8 efuseType, u8 *Efuse,
  *---------------------------------------------------------------------------*/
 void EFUSE_ShadowMapUpdate(
 	struct adapter *pAdapter,
-	u8 efuseType,
 	bool pseudo)
 {
 	struct eeprom_priv *pEEPROM = &pAdapter->eeprompriv;
@@ -279,5 +278,5 @@ void EFUSE_ShadowMapUpdate(
 	if (pEEPROM->bautoload_fail_flag)
 		memset(pEEPROM->efuse_eeprom_data, 0xFF, mapLen);
 	else
-		Efuse_ReadAllMap(pAdapter, efuseType, pEEPROM->efuse_eeprom_data, pseudo);
+		Efuse_ReadAllMap(pAdapter, pEEPROM->efuse_eeprom_data, pseudo);
 } /*  EFUSE_ShadowMapUpdate */
drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +6 -8
index f0d51eb694e7..b501419da0a1 100644
@@ -815,7 +815,7 @@ static void Hal_EfuseReadEFuse88E(struct adapter *Adapter,
 	kfree(eFuseWord);
 }
 
-static void ReadEFuseByIC(struct adapter *Adapter, u8 efuseType, u16 _offset, u16 _size_byte, u8 *pbuf, bool bPseudoTest)
+static void ReadEFuseByIC(struct adapter *Adapter, u16 _offset, u16 _size_byte, u8 *pbuf, bool bPseudoTest)
 {
 	if (!bPseudoTest) {
 		int ret = _FAIL;
@@ -836,19 +836,17 @@ static void ReadEFuseByIC(struct adapter *Adapter, u8 efuseType, u16 _offset, u1
 	return;
 }
 
-static void ReadEFuse_Pseudo(struct adapter *Adapter, u8 efuseType, u16 _offset, u16 _size_byte, u8 *pbuf, bool bPseudoTest)
+static void ReadEFuse_Pseudo(struct adapter *Adapter, u16 _offset, u16 _size_byte, u8 *pbuf, bool bPseudoTest)
 {
 	Hal_EfuseReadEFuse88E(Adapter, _offset, _size_byte, pbuf, bPseudoTest);
 }
 
-void rtl8188e_ReadEFuse(struct adapter *Adapter, u8 efuseType,
-			u16 _offset, u16 _size_byte, u8 *pbuf,
-			bool bPseudoTest)
+void rtl8188e_ReadEFuse(struct adapter *Adapter, u16 _offset, u16 _size_byte, u8 *pbuf, bool bPseudoTest)
 {
 	if (bPseudoTest)
-		ReadEFuse_Pseudo(Adapter, efuseType, _offset, _size_byte, pbuf, bPseudoTest);
+		ReadEFuse_Pseudo(Adapter, _offset, _size_byte, pbuf, bPseudoTest);
 	else
-		ReadEFuseByIC(Adapter, efuseType, _offset, _size_byte, pbuf, bPseudoTest);
+		ReadEFuseByIC(Adapter, _offset, _size_byte, pbuf, bPseudoTest);
 }
 
 /* Do not support BT */
@@ -1313,7 +1311,7 @@ void
 Hal_InitPGData88E(struct adapter *padapter)
 {
 	if (!is_boot_from_eeprom(padapter))
-		EFUSE_ShadowMapUpdate(padapter, EFUSE_WIFI, false);
+		EFUSE_ShadowMapUpdate(padapter, false);
 }
 
 void
drivers/staging/r8188eu/include/hal_intf.h +1 -1
index 6c53f2ca665d..59272570bc5d 100644
@@ -121,7 +121,7 @@ void rtl8188e_SetHalODMVar(struct adapter *Adapter,
 u32 rtl8188eu_InitPowerOn(struct adapter *adapt);
 void rtl8188e_free_hal_data(struct adapter *padapter);
 void rtl8188e_EfusePowerSwitch(struct adapter *pAdapter, u8 PwrState);
-void rtl8188e_ReadEFuse(struct adapter *Adapter, u8 efuseType,
+void rtl8188e_ReadEFuse(struct adapter *Adapter,
 			u16 _offset, u16 _size_byte, u8 *pbuf,
 			bool bPseudoTest);
 void rtl8188e_EFUSE_GetEfuseDefinition(struct adapter *pAdapter,
drivers/staging/r8188eu/include/rtw_efuse.h +1 -1
index 2e19b7be1075..0b5c8523d42f 100644
@@ -108,6 +108,6 @@ u8 efuse_OneByteWrite(struct adapter *adapter, u16 addr, u8 data, bool	test);
 
 void efuse_WordEnableDataRead(u8 word_en, u8 *sourdata, u8 *targetdata);
 
-void EFUSE_ShadowMapUpdate(struct adapter *adapter, u8 efusetype, bool test);
+void EFUSE_ShadowMapUpdate(struct adapter *adapter, bool test);
 
 #endif
Signature · 1 line
2.20.1
#3 lore raw

PATCH 3/15 staging: r8188eu: remove test code for efuse shadow map

In reply to Martin Kaiser

The EFUSE_ShadowMapUpdate function has a parameter to replace the actual read operations with test reads. The only caller of EFUSE_ShadowMapUpdate does not use this test mode.

Remove the read test code from EFUSE_ShadowMapUpdate and the low-level functions that it calls.

---
 drivers/staging/r8188eu/core/rtw_efuse.c      |  22 +--
 .../staging/r8188eu/hal/rtl8188e_hal_init.c   | 125 ++++--------------
 drivers/staging/r8188eu/include/hal_intf.h    |   7 +-
 drivers/staging/r8188eu/include/rtw_efuse.h   |   4 +-
 4 files changed, 34 insertions(+), 124 deletions(-)
drivers/staging/r8188eu/core/rtw_efuse.c +7 -15
index d8ae995270bc..d799d0c7817f 100644
@@ -83,18 +83,12 @@ void
 ReadEFuseByte(
 		struct adapter *Adapter,
 		u16 _offset,
-		u8 *pbuf,
-		bool pseudo)
+		u8 *pbuf)
 {
 	u32 value32;
 	u8 readbyte;
 	u16 retry;
 
-	if (pseudo) {
-		Efuse_Read1ByteFromFakeContent(_offset, pbuf);
-		return;
-	}
-
 	/* Write Address */
 	rtw_write8(Adapter, EFUSE_CTRL + 1, (_offset & 0xff));
 	readbyte = rtw_read8(Adapter, EFUSE_CTRL + 2);
@@ -237,15 +231,15 @@ void efuse_WordEnableDataRead(u8 word_en, u8 *sourdata, u8 *targetdata)
  * 11/11/2008	MHC		Create Version 0.
  *
  *---------------------------------------------------------------------------*/
-static void Efuse_ReadAllMap(struct adapter *pAdapter, u8 *Efuse, bool pseudo)
+static void Efuse_ReadAllMap(struct adapter *pAdapter, u8 *Efuse)
 {
 	u16 mapLen = 0;
 
 	rtl8188e_EfusePowerSwitch(pAdapter, true);
 
-	rtl8188e_EFUSE_GetEfuseDefinition(pAdapter, TYPE_EFUSE_MAP_LEN, (void *)&mapLen, pseudo);
+	rtl8188e_EFUSE_GetEfuseDefinition(pAdapter, TYPE_EFUSE_MAP_LEN, (void *)&mapLen);
 
-	rtl8188e_ReadEFuse(pAdapter, 0, mapLen, Efuse, pseudo);
+	rtl8188e_ReadEFuse(pAdapter, 0, mapLen, Efuse);
 
 	rtl8188e_EfusePowerSwitch(pAdapter, false);
 }
@@ -266,17 +260,15 @@ static void Efuse_ReadAllMap(struct adapter *pAdapter, u8 *Efuse, bool pseudo)
  * 11/13/2008	MHC		Create Version 0.
  *
  *---------------------------------------------------------------------------*/
-void EFUSE_ShadowMapUpdate(
-	struct adapter *pAdapter,
-	bool pseudo)
+void EFUSE_ShadowMapUpdate(struct adapter *pAdapter)
 {
 	struct eeprom_priv *pEEPROM = &pAdapter->eeprompriv;
 	u16 mapLen = 0;
 
-	rtl8188e_EFUSE_GetEfuseDefinition(pAdapter, TYPE_EFUSE_MAP_LEN, (void *)&mapLen, pseudo);
+	rtl8188e_EFUSE_GetEfuseDefinition(pAdapter, TYPE_EFUSE_MAP_LEN, (void *)&mapLen);
 
 	if (pEEPROM->bautoload_fail_flag)
 		memset(pEEPROM->efuse_eeprom_data, 0xFF, mapLen);
 	else
-		Efuse_ReadAllMap(pAdapter, pEEPROM->efuse_eeprom_data, pseudo);
+		Efuse_ReadAllMap(pAdapter, pEEPROM->efuse_eeprom_data);
 } /*  EFUSE_ShadowMapUpdate */
drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +23 -102

196 lines not on this page · raw message

drivers/staging/r8188eu/include/hal_intf.h +2 -5
index 59272570bc5d..de9744d065da 100644
@@ -121,11 +121,8 @@ void rtl8188e_SetHalODMVar(struct adapter *Adapter,
 u32 rtl8188eu_InitPowerOn(struct adapter *adapt);
 void rtl8188e_free_hal_data(struct adapter *padapter);
 void rtl8188e_EfusePowerSwitch(struct adapter *pAdapter, u8 PwrState);
-void rtl8188e_ReadEFuse(struct adapter *Adapter,
-			u16 _offset, u16 _size_byte, u8 *pbuf,
-			bool bPseudoTest);
-void rtl8188e_EFUSE_GetEfuseDefinition(struct adapter *pAdapter,
-				       u8 type, void *pOut, bool bPseudoTest);
+void rtl8188e_ReadEFuse(struct adapter *Adapter, u16 _offset, u16 _size_byte, u8 *pbuf);
+void rtl8188e_EFUSE_GetEfuseDefinition(struct adapter *pAdapter, u8 type, void *pOut);
 u16 rtl8188e_EfuseGetCurrentSize(struct adapter *pAdapter, u8 efuseType, bool bPseudoTest);
 int rtl8188e_Efuse_PgPacketRead(struct adapter *pAdapter, u8 offset, u8 *data, bool bPseudoTest);
 
drivers/staging/r8188eu/include/rtw_efuse.h +2 -2
index 0b5c8523d42f..c767e985f196 100644
@@ -102,12 +102,12 @@ extern u8 fakeBTEfuseModifiedMap[];
 /*------------------------Export global variable----------------------------*/
 
 u8 Efuse_CalculateWordCnts(u8 word_en);
-void ReadEFuseByte(struct adapter *adapter, u16 _offset, u8 *pbuf, bool test);
+void ReadEFuseByte(struct adapter *adapter, u16 _offset, u8 *pbuf);
 u8 efuse_OneByteRead(struct adapter *adapter, u16 addr, u8 *data, bool test);
 u8 efuse_OneByteWrite(struct adapter *adapter, u16 addr, u8 data, bool	test);
 
 void efuse_WordEnableDataRead(u8 word_en, u8 *sourdata, u8 *targetdata);
 
-void EFUSE_ShadowMapUpdate(struct adapter *adapter, bool test);
+void EFUSE_ShadowMapUpdate(struct adapter *adapter);
 
 #endif
Signature · 1 line
2.20.1
#4 lore raw

Re: [PATCH 03/15] staging: r8188eu: remove test code for efuse shadow map

Quoted 19 lines · Martin Kaiser
drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +5 -8
@@ -815,38 +813,26 @@ static void Hal_EfuseReadEFuse88E(struct adapter *Adapter,
 	kfree(eFuseWord);
 }
 
-static void ReadEFuseByIC(struct adapter *Adapter, u16 _offset, u16 _size_byte, u8 *pbuf, bool bPseudoTest)
+static void ReadEFuseByIC(struct adapter *Adapter, u16 _offset, u16 _size_byte, u8 *pbuf)
 {
-	if (!bPseudoTest) {
-		int ret = _FAIL;
-		if (rtw_IOL_applied(Adapter)) {
-			rtl8188eu_InitPowerOn(Adapter);
+	int ret = _FAIL;
+	if (rtw_IOL_applied(Adapter)) {
+		rtl8188eu_InitPowerOn(Adapter);
 
-			iol_mode_enable(Adapter, 1);
-			ret = iol_read_efuse(Adapter, 0, _offset, _size_byte, pbuf);
-			iol_mode_enable(Adapter, 0);
+		iol_mode_enable(Adapter, 1);

drivers/staging/r8188eu/hal/rtl8188e_hal_init.c static void Hal_EfuseReadEFuse88E(struct adapter *Adapter, · line 833

Quoted 10 lines
drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +4 -4
+		ret = iol_read_efuse(Adapter, 0, _offset, _size_byte, pbuf);
+		iol_mode_enable(Adapter, 0);
 
-			if (_SUCCESS == ret)
-				goto exit;
-		}
+		if (_SUCCESS == ret)
+			return;
 	}
-	Hal_EfuseReadEFuse88E(Adapter, _offset, _size_byte, pbuf, bPseudoTest);

It looks like this changes how the code works here. Originally we called Hal_EfuseReadEFuse88E() fir rtw_IOL_applied() was false or if iol_read_efuse() failed.

Was that intentional?

drivers/staging/r8188eu/hal/rtl8188e_hal_init.c static void Hal_EfuseReadEFuse88E(struct adapter *Adapter, · line 837

Quoted 4 lines
drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +0 -4
-
-exit:
-	return;
-}

regards,
dan carpenter

#5 lore raw

Re: [PATCH 03/15] staging: r8188eu: remove test code for efuse shadow map

Hi Dan,

Thus wrote Dan Carpenter ([email protected]):

Quoted 13 lines · Martin Kaiser

drivers/staging/r8188eu/hal/rtl8188e_hal_init.c static void Hal_EfuseReadEFuse88E(struct adapter *Adapter, · line 833

Quoted 8 lines
drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +2 -4
-			if (_SUCCESS == ret)
-				goto exit;
-		}
+		if (_SUCCESS == ret)
+			return;
 	}
-	Hal_EfuseReadEFuse88E(Adapter, _offset, _size_byte, pbuf, bPseudoTest);

It looks like this changes how the code works here. Originally we called Hal_EfuseReadEFuse88E() fir rtw_IOL_applied() was false or if iol_read_efuse() failed.

the call to Hal_EfuseReadEFuse88E is still there, it's below the part that you quoted:

- Hal_EfuseReadEFuse88E(Adapter, _offset, _size_byte, pbuf, bPseudoTest);
-
-exit:
- return;
-}

-static void ReadEFuse_Pseudo(struct adapter *Adapter, u16 _offset, u16 _size_byte, u8 *pbuf, bool bPseudoTest) -{
- Hal_EfuseReadEFuse88E(Adapter, _offset, _size_byte, pbuf, bPseudoTest);
+ Hal_EfuseReadEFuse88E(Adapter, _offset, _size_byte, pbuf);
}

The removal of ReadEFuse_Pseudo makes the diff a bit confusing. When I checked the patches before posting, I stumbled across this part as well.

Best regards,
Martin

#6 lore raw

Re: [PATCH 03/15] staging: r8188eu: remove test code for efuse shadow map

Quoted 33 lines · Martin Kaiser

Hi Dan,

Thus wrote Dan Carpenter ([email protected]):

Quoted 13 lines · Martin Kaiser

drivers/staging/r8188eu/hal/rtl8188e_hal_init.c static void Hal_EfuseReadEFuse88E(struct adapter *Adapter, · line 833

Quoted 8 lines
drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +2 -4
-			if (_SUCCESS == ret)
-				goto exit;
-		}
+		if (_SUCCESS == ret)
+			return;
 	}
-	Hal_EfuseReadEFuse88E(Adapter, _offset, _size_byte, pbuf, bPseudoTest);

It looks like this changes how the code works here. Originally we called Hal_EfuseReadEFuse88E() fir rtw_IOL_applied() was false or if iol_read_efuse() failed.

the call to Hal_EfuseReadEFuse88E is still there, it's below the part that you quoted:

drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +1 -8
-       Hal_EfuseReadEFuse88E(Adapter, _offset, _size_byte, pbuf, bPseudoTest);
-
-exit:
-       return;
-}
 
-static void ReadEFuse_Pseudo(struct adapter *Adapter, u16 _offset, u16 _size_byte, u8 *pbuf, bool bPseudoTest)
-{
-       Hal_EfuseReadEFuse88E(Adapter, _offset, _size_byte, pbuf, bPseudoTest);
+       Hal_EfuseReadEFuse88E(Adapter, _offset, _size_byte, pbuf);
 }
Quoted 2 lines

The removal of ReadEFuse_Pseudo makes the diff a bit confusing. When I checked the patches before posting, I stumbled across this part as well.

Oh... Sorry. I should have seen that. Thanks!

regards,
dan carpenter

#7 lore raw

PATCH 4/15 staging: r8188eu: merge small adapter info helpers

In reply to Martin Kaiser

ReadAdapterInfo8188EU calls Hal_InitPGData88E and readAdapterInfo_8188EU, both of which are small and have no other callers. Merge the two latter functions into ReadAdapterInfo8188EU.

---
 .../staging/r8188eu/hal/rtl8188e_hal_init.c   |  7 ----
 drivers/staging/r8188eu/hal/usb_halinit.c     | 42 ++++++++-----------
 .../staging/r8188eu/include/rtl8188e_hal.h    |  1 -
 3 files changed, 17 insertions(+), 33 deletions(-)
drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +0 -7
index 84abbed51cbe..d658f3f5df32 100644
@@ -1228,13 +1228,6 @@ s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy)
 	return status;
 }
 
-void
-Hal_InitPGData88E(struct adapter *padapter)
-{
-	if (!is_boot_from_eeprom(padapter))
-		EFUSE_ShadowMapUpdate(padapter);
-}
-
 void
 Hal_EfuseParseIDCode88E(
 		struct adapter *padapter,
drivers/staging/r8188eu/hal/usb_halinit.c +17 -25

54 lines not on this page · raw message

drivers/staging/r8188eu/include/rtl8188e_hal.h +0 -1
index 6630cb5c5e55..4bf1f5d0815a 100644
@@ -316,7 +316,6 @@ s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy);
 
 /*  EFuse */
 u8 GetEEPROMSize8188E(struct adapter *padapter);
-void Hal_InitPGData88E(struct adapter *padapter);
 void Hal_EfuseParseIDCode88E(struct adapter *padapter, u8 *hwinfo);
 void Hal_ReadTxPowerInfo88E(struct adapter *padapter, u8 *hwinfo,
 			    bool AutoLoadFail);
Signature · 1 line
2.20.1
#8 lore raw

PATCH 5/15 staging: r8188eu: rtl8188e_EfuseGetCurrentSize is now unused

In reply to Martin Kaiser

After we removed efuse write support, rtl8188e_EfuseGetCurrentSize is no longer needed. Remove this function and its internal helpers.

---
 .../staging/r8188eu/hal/rtl8188e_hal_init.c   | 62 -------------------
 drivers/staging/r8188eu/include/hal_intf.h    |  1 -
 2 files changed, 63 deletions(-)
drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +0 -62
index d658f3f5df32..8205f6237520 100644
@@ -903,68 +903,6 @@ void rtl8188e_EFUSE_GetEfuseDefinition(struct adapter *pAdapter, u8 type, void *
 	Hal_EFUSEGetEfuseDefinition88E(pAdapter, type, pOut);
 }
 
-static u16 hal_EfuseGetCurrentSize_8188e(struct adapter *pAdapter, bool bPseudoTest)
-{
-	int	bContinual = true;
-	u16	efuse_addr = 0;
-	u8 hworden = 0;
-	u8 efuse_data, word_cnts = 0;
-
-	if (bPseudoTest)
-		efuse_addr = (u16)(fakeEfuseUsedBytes);
-	else
-		GetHwReg8188EU(pAdapter, HW_VAR_EFUSE_BYTES, (u8 *)&efuse_addr);
-
-	while (bContinual &&
-	       efuse_OneByteRead(pAdapter, efuse_addr, &efuse_data, bPseudoTest) &&
-	       AVAILABLE_EFUSE_ADDR(efuse_addr)) {
-		if (efuse_data != 0xFF) {
-			if ((efuse_data & 0x1F) == 0x0F) {		/* extended header */
-				efuse_addr++;
-				efuse_OneByteRead(pAdapter, efuse_addr, &efuse_data, bPseudoTest);
-				if ((efuse_data & 0x0F) == 0x0F) {
-					efuse_addr++;
-					continue;
-				} else {
-					hworden = efuse_data & 0x0F;
-				}
-			} else {
-				hworden =  efuse_data & 0x0F;
-			}
-			word_cnts = Efuse_CalculateWordCnts(hworden);
-			/* read next header */
-			efuse_addr = efuse_addr + (word_cnts * 2) + 1;
-		} else {
-			bContinual = false;
-		}
-	}
-
-	if (bPseudoTest)
-		fakeEfuseUsedBytes = efuse_addr;
-	else
-		SetHwReg8188EU(pAdapter, HW_VAR_EFUSE_BYTES, (u8 *)&efuse_addr);
-
-	return efuse_addr;
-}
-
-static u16 Hal_EfuseGetCurrentSize_Pseudo(struct adapter *pAdapter, bool bPseudoTest)
-{
-	u16	ret = 0;
-
-	ret = hal_EfuseGetCurrentSize_8188e(pAdapter, bPseudoTest);
-	return ret;
-}
-
-u16 rtl8188e_EfuseGetCurrentSize(struct adapter *pAdapter, u8 efuseType, bool bPseudoTest)
-{
-	u16	ret = 0;
-
-	if (bPseudoTest)
-		ret = Hal_EfuseGetCurrentSize_Pseudo(pAdapter, bPseudoTest);
-	else
-		ret = hal_EfuseGetCurrentSize_8188e(pAdapter, bPseudoTest);
-	return ret;
-}
 
 static int hal_EfusePgPacketRead_8188e(struct adapter *pAdapter, u8 offset, u8 *data, bool bPseudoTest)
 {
drivers/staging/r8188eu/include/hal_intf.h +0 -1
index de9744d065da..01e256f3e268 100644
@@ -123,7 +123,6 @@ void rtl8188e_free_hal_data(struct adapter *padapter);
 void rtl8188e_EfusePowerSwitch(struct adapter *pAdapter, u8 PwrState);
 void rtl8188e_ReadEFuse(struct adapter *Adapter, u16 _offset, u16 _size_byte, u8 *pbuf);
 void rtl8188e_EFUSE_GetEfuseDefinition(struct adapter *pAdapter, u8 type, void *pOut);
-u16 rtl8188e_EfuseGetCurrentSize(struct adapter *pAdapter, u8 efuseType, bool bPseudoTest);
 int rtl8188e_Efuse_PgPacketRead(struct adapter *pAdapter, u8 offset, u8 *data, bool bPseudoTest);
 
 void hal_notch_filter_8188e(struct adapter *adapter, bool enable);
Signature · 1 line
2.20.1
#9 lore raw

PATCH 6/15 staging: r8188eu: rtl8188e_Efuse_PgPacketRead is now unused

In reply to Martin Kaiser

After we removed efuse write support, rtl8188e_Efuse_PgPacketRead is no longer needed. Remove this function and its internal helpers.

---
 .../staging/r8188eu/hal/rtl8188e_hal_init.c   | 114 ------------------
 drivers/staging/r8188eu/include/hal_intf.h    |   1 -
 drivers/staging/r8188eu/include/rtw_efuse.h   |  20 ---
 3 files changed, 135 deletions(-)
drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +0 -114
index 8205f6237520..55b750b4d6ff 100644
@@ -903,120 +903,6 @@ void rtl8188e_EFUSE_GetEfuseDefinition(struct adapter *pAdapter, u8 type, void *
 	Hal_EFUSEGetEfuseDefinition88E(pAdapter, type, pOut);
 }
 
-
-static int hal_EfusePgPacketRead_8188e(struct adapter *pAdapter, u8 offset, u8 *data, bool bPseudoTest)
-{
-	u8 ReadState = PG_STATE_HEADER;
-	int	bContinual = true;
-	int	bDataEmpty = true;
-	u8 efuse_data, word_cnts = 0;
-	u16	efuse_addr = 0;
-	u8 hoffset = 0, hworden = 0;
-	u8 tmpidx = 0;
-	u8 tmpdata[8];
-	u8 max_section = 0;
-	u8 tmp_header = 0;
-
-	rtl8188e_EFUSE_GetEfuseDefinition(pAdapter, TYPE_EFUSE_MAX_SECTION, (void *)&max_section);
-
-	if (!data)
-		return false;
-	if (offset > max_section)
-		return false;
-
-	memset((void *)data, 0xff, sizeof(u8) * PGPKT_DATA_SIZE);
-	memset((void *)tmpdata, 0xff, sizeof(u8) * PGPKT_DATA_SIZE);
-
-	/*  <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. */
-	while (bContinual && AVAILABLE_EFUSE_ADDR(efuse_addr)) {
-		/*   Header Read ------------- */
-		if (ReadState & PG_STATE_HEADER) {
-			if (efuse_OneByteRead(pAdapter, efuse_addr, &efuse_data, bPseudoTest) && (efuse_data != 0xFF)) {
-				if (EXT_HEADER(efuse_data)) {
-					tmp_header = efuse_data;
-					efuse_addr++;
-					efuse_OneByteRead(pAdapter, efuse_addr, &efuse_data, bPseudoTest);
-					if (!ALL_WORDS_DISABLED(efuse_data)) {
-						hoffset = ((tmp_header & 0xE0) >> 5) | ((efuse_data & 0xF0) >> 1);
-						hworden = efuse_data & 0x0F;
-					} else {
-						DBG_88E("Error, All words disabled\n");
-						efuse_addr++;
-						continue;
-					}
-				} else {
-					hoffset = (efuse_data >> 4) & 0x0F;
-					hworden =  efuse_data & 0x0F;
-				}
-				word_cnts = Efuse_CalculateWordCnts(hworden);
-				bDataEmpty = true;
-
-				if (hoffset == offset) {
-					for (tmpidx = 0; tmpidx < word_cnts * 2; tmpidx++) {
-						if (efuse_OneByteRead(pAdapter, efuse_addr + 1 + tmpidx, &efuse_data, bPseudoTest)) {
-							tmpdata[tmpidx] = efuse_data;
-							if (efuse_data != 0xff)
-								bDataEmpty = false;
-						}
-					}
-					if (!bDataEmpty) {
-						ReadState = PG_STATE_DATA;
-					} else {/* read next header */
-						efuse_addr = efuse_addr + (word_cnts * 2) + 1;
-						ReadState = PG_STATE_HEADER;
-					}
-				} else {/* read next header */
-					efuse_addr = efuse_addr + (word_cnts * 2) + 1;
-					ReadState = PG_STATE_HEADER;
-				}
-			} else {
-				bContinual = false;
-			}
-		} else if (ReadState & PG_STATE_DATA) {
-		/*   Data section Read ------------- */
-			efuse_WordEnableDataRead(hworden, tmpdata, data);
-			efuse_addr = efuse_addr + (word_cnts * 2) + 1;
-			ReadState = PG_STATE_HEADER;
-		}
-
-	}
-
-	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))
-		return false;
-	else
-		return true;
-}
-
-static int Hal_EfusePgPacketRead(struct adapter *pAdapter, u8 offset, u8 *data, bool bPseudoTest)
-{
-	int	ret;
-
-	ret = hal_EfusePgPacketRead_8188e(pAdapter, offset, data, bPseudoTest);
-	return ret;
-}
-
-static int Hal_EfusePgPacketRead_Pseudo(struct adapter *pAdapter, u8 offset, u8 *data, bool bPseudoTest)
-{
-	int	ret;
-
-	ret = hal_EfusePgPacketRead_8188e(pAdapter, offset, data, bPseudoTest);
-	return ret;
-}
-
-int rtl8188e_Efuse_PgPacketRead(struct adapter *pAdapter, u8 offset, u8 *data, bool bPseudoTest)
-{
-	int	ret;
-
-	if (bPseudoTest)
-		ret = Hal_EfusePgPacketRead_Pseudo(pAdapter, offset, data, bPseudoTest);
-	else
-		ret = Hal_EfusePgPacketRead(pAdapter, offset, data, bPseudoTest);
-	return ret;
-}
-
 void rtl8188e_read_chip_version(struct adapter *padapter)
 {
 	u32				value32;
drivers/staging/r8188eu/include/hal_intf.h +0 -1
index 01e256f3e268..1f69aae7cb0e 100644
@@ -123,7 +123,6 @@ void rtl8188e_free_hal_data(struct adapter *padapter);
 void rtl8188e_EfusePowerSwitch(struct adapter *pAdapter, u8 PwrState);
 void rtl8188e_ReadEFuse(struct adapter *Adapter, u16 _offset, u16 _size_byte, u8 *pbuf);
 void rtl8188e_EFUSE_GetEfuseDefinition(struct adapter *pAdapter, u8 type, void *pOut);
-int rtl8188e_Efuse_PgPacketRead(struct adapter *pAdapter, u8 offset, u8 *data, bool bPseudoTest);
 
 void hal_notch_filter_8188e(struct adapter *adapter, bool enable);
 
drivers/staging/r8188eu/include/rtw_efuse.h +0 -20
index c767e985f196..7c4c84d74bc2 100644
@@ -8,18 +8,6 @@
 
 #define	EFUSE_ERROE_HANDLE		1
 
-#define	PG_STATE_HEADER			0x01
-#define	PG_STATE_WORD_0		0x02
-#define	PG_STATE_WORD_1		0x04
-#define	PG_STATE_WORD_2		0x08
-#define	PG_STATE_WORD_3		0x10
-#define	PG_STATE_DATA			0x20
-
-#define	PG_SWBYTE_H			0x01
-#define	PG_SWBYTE_L			0x02
-
-#define	PGPKT_DATA_SIZE		8
-
 #define	EFUSE_WIFI				0
 #define	EFUSE_BT				1
 
@@ -55,14 +43,6 @@ enum _EFUSE_DEF_TYPE {
 /*--------------------------Define Parameters-------------------------------*/
 #define		EFUSE_MAX_WORD_UNIT			4
 
-/*------------------------------Define structure----------------------------*/
-struct pgpkt {
-	u8 offset;
-	u8 word_en;
-	u8 data[8];
-	u8 word_cnts;
-};
-
 /*------------------------------Define structure----------------------------*/
 struct efuse_hal {
 	u8 fakeEfuseBank;
Signature · 1 line
2.20.1
#10 lore raw

PATCH 7/15 staging: r8188eu: merge Efuse_ReadAllMap into EFUSE_ShadowMapUpdate

In reply to Martin Kaiser

Efuse_ReadAllMap is small, it's called only by EFUSE_ShadowMapUpdate. This patch merges the two functions.

---
 drivers/staging/r8188eu/core/rtw_efuse.c | 42 +++++-------------------
 1 file changed, 9 insertions(+), 33 deletions(-)
drivers/staging/r8188eu/core/rtw_efuse.c +9 -33
index d799d0c7817f..2999313dfe69 100644
@@ -215,35 +215,6 @@ void efuse_WordEnableDataRead(u8 word_en, u8 *sourdata, u8 *targetdata)
 	}
 }
 
-/*-----------------------------------------------------------------------------
- * Function:	Efuse_ReadAllMap
- *
- * Overview:	Read All Efuse content
- *
- * Input:       NONE
- *
- * Output:      NONE
- *
- * Return:      NONE
- *
- * Revised History:
- * When			Who		Remark
- * 11/11/2008	MHC		Create Version 0.
- *
- *---------------------------------------------------------------------------*/
-static void Efuse_ReadAllMap(struct adapter *pAdapter, u8 *Efuse)
-{
-	u16 mapLen = 0;
-
-	rtl8188e_EfusePowerSwitch(pAdapter, true);
-
-	rtl8188e_EFUSE_GetEfuseDefinition(pAdapter, TYPE_EFUSE_MAP_LEN, (void *)&mapLen);
-
-	rtl8188e_ReadEFuse(pAdapter, 0, mapLen, Efuse);
-
-	rtl8188e_EfusePowerSwitch(pAdapter, false);
-}
-
 /*-----------------------------------------------------------------------------
  * Function:	EFUSE_ShadowMapUpdate
  *
@@ -267,8 +238,13 @@ void EFUSE_ShadowMapUpdate(struct adapter *pAdapter)
 
 	rtl8188e_EFUSE_GetEfuseDefinition(pAdapter, TYPE_EFUSE_MAP_LEN, (void *)&mapLen);
 
-	if (pEEPROM->bautoload_fail_flag)
+	if (pEEPROM->bautoload_fail_flag) {
 		memset(pEEPROM->efuse_eeprom_data, 0xFF, mapLen);
-	else
-		Efuse_ReadAllMap(pAdapter, pEEPROM->efuse_eeprom_data);
-} /*  EFUSE_ShadowMapUpdate */
+		return;
+	}
+
+	rtl8188e_EfusePowerSwitch(pAdapter, true);
+	rtl8188e_EFUSE_GetEfuseDefinition(pAdapter, TYPE_EFUSE_MAP_LEN, (void *)&mapLen);
+	rtl8188e_ReadEFuse(pAdapter, 0, mapLen, pEEPROM->efuse_eeprom_data);
+	rtl8188e_EfusePowerSwitch(pAdapter, false);
+}
Signature · 1 line
2.20.1
#11 lore raw

PATCH 8/15 staging: r8188eu: use efuse map length define directly

In reply to Martin Kaiser

The length of the efuse data section is constant. We can use the corresponding define directly, there's no need to get the length from rtl8188e_EFUSE_GetEfuseDefinition.

---
 drivers/staging/r8188eu/core/rtw_efuse.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/staging/r8188eu/core/rtw_efuse.c +3 -6
index 2999313dfe69..1a999d41483b 100644
@@ -6,6 +6,7 @@
 #include "../include/osdep_service.h"
 #include "../include/drv_types.h"
 #include "../include/rtw_efuse.h"
+#include "../include/rtl8188e_hal.h"
 
 /*------------------------Define local variable------------------------------*/
 u8 fakeEfuseBank;
@@ -234,17 +235,13 @@ void efuse_WordEnableDataRead(u8 word_en, u8 *sourdata, u8 *targetdata)
 void EFUSE_ShadowMapUpdate(struct adapter *pAdapter)
 {
 	struct eeprom_priv *pEEPROM = &pAdapter->eeprompriv;
-	u16 mapLen = 0;
-
-	rtl8188e_EFUSE_GetEfuseDefinition(pAdapter, TYPE_EFUSE_MAP_LEN, (void *)&mapLen);
 
 	if (pEEPROM->bautoload_fail_flag) {
-		memset(pEEPROM->efuse_eeprom_data, 0xFF, mapLen);
+		memset(pEEPROM->efuse_eeprom_data, 0xFF, EFUSE_MAP_LEN_88E);
 		return;
 	}
 
 	rtl8188e_EfusePowerSwitch(pAdapter, true);
-	rtl8188e_EFUSE_GetEfuseDefinition(pAdapter, TYPE_EFUSE_MAP_LEN, (void *)&mapLen);
-	rtl8188e_ReadEFuse(pAdapter, 0, mapLen, pEEPROM->efuse_eeprom_data);
+	rtl8188e_ReadEFuse(pAdapter, 0, EFUSE_MAP_LEN_88E, pEEPROM->efuse_eeprom_data);
 	rtl8188e_EfusePowerSwitch(pAdapter, false);
 }
Signature · 1 line
2.20.1
#12 lore raw

PATCH 9/15 staging: r8188eu: rtl8188e_EFUSE_GetEfuseDefinition is unused

In reply to Martin Kaiser

Now that we use the map length directly, rtl8188e_EFUSE_GetEfuseDefinition is no longer needed and can be removed.

---
 .../staging/r8188eu/hal/rtl8188e_hal_init.c   | 68 -------------------
 drivers/staging/r8188eu/include/hal_intf.h    |  1 -
 drivers/staging/r8188eu/include/rtw_efuse.h   | 10 ---
 3 files changed, 79 deletions(-)
drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +0 -68
index 55b750b4d6ff..b7d5b5775ff5 100644
@@ -835,74 +835,6 @@ void rtl8188e_ReadEFuse(struct adapter *Adapter, u16 _offset, u16 _size_byte, u8
 	ReadEFuseByIC(Adapter, _offset, _size_byte, pbuf);
 }
 
-/* Do not support BT */
-static void Hal_EFUSEGetEfuseDefinition88E(struct adapter *pAdapter, u8 type, void *pOut)
-{
-	switch (type) {
-	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;
-	}
-}
-
-void rtl8188e_EFUSE_GetEfuseDefinition(struct adapter *pAdapter, u8 type, void *pOut)
-{
-	Hal_EFUSEGetEfuseDefinition88E(pAdapter, type, pOut);
-}
-
 void rtl8188e_read_chip_version(struct adapter *padapter)
 {
 	u32				value32;
drivers/staging/r8188eu/include/hal_intf.h +0 -1
index 1f69aae7cb0e..693eb32fe1a9 100644
@@ -122,7 +122,6 @@ u32 rtl8188eu_InitPowerOn(struct adapter *adapt);
 void rtl8188e_free_hal_data(struct adapter *padapter);
 void rtl8188e_EfusePowerSwitch(struct adapter *pAdapter, u8 PwrState);
 void rtl8188e_ReadEFuse(struct adapter *Adapter, u16 _offset, u16 _size_byte, u8 *pbuf);
-void rtl8188e_EFUSE_GetEfuseDefinition(struct adapter *pAdapter, u8 type, void *pOut);
 
 void hal_notch_filter_8188e(struct adapter *adapter, bool enable);
 
drivers/staging/r8188eu/include/rtw_efuse.h +0 -10
index 7c4c84d74bc2..fe421fff127a 100644
@@ -11,16 +11,6 @@
 #define	EFUSE_WIFI				0
 #define	EFUSE_BT				1
 
-enum _EFUSE_DEF_TYPE {
-	TYPE_EFUSE_MAX_SECTION				= 0,
-	TYPE_EFUSE_REAL_CONTENT_LEN			= 1,
-	TYPE_AVAILABLE_EFUSE_BYTES_BANK		= 2,
-	TYPE_AVAILABLE_EFUSE_BYTES_TOTAL	= 3,
-	TYPE_EFUSE_MAP_LEN					= 4,
-	TYPE_EFUSE_PROTECT_BYTES_BANK		= 5,
-	TYPE_EFUSE_CONTENT_LEN_BANK			= 6,
-};
-
 /* E-Fuse */
 #define EFUSE_MAP_SIZE      512
 #define EFUSE_MAX_SIZE      256
Signature · 1 line
2.20.1
#13 lore raw

PATCH 10/15 staging: r8188eu: remove defines for efuse type

In reply to Martin Kaiser

We've removed all code to handle efuse types. The last step is to remove the defines for bt and wifi efuse types.

---
 drivers/staging/r8188eu/include/rtw_efuse.h | 3 ---
 1 file changed, 3 deletions(-)
drivers/staging/r8188eu/include/rtw_efuse.h +0 -3
index fe421fff127a..825f880a71da 100644
@@ -8,9 +8,6 @@
 
 #define	EFUSE_ERROE_HANDLE		1
 
-#define	EFUSE_WIFI				0
-#define	EFUSE_BT				1
-
 /* E-Fuse */
 #define EFUSE_MAP_SIZE      512
 #define EFUSE_MAX_SIZE      256
Signature · 1 line
2.20.1
#14 lore raw

PATCH 11/15 staging: r8188eu: efuse_OneByteRead is unused

In reply to Martin Kaiser

Remove the efuse_OneByteRead function, which is no longer used. Remove resulting dead code as well.

---
 drivers/staging/r8188eu/core/rtw_efuse.c    | 41 ---------------------
 drivers/staging/r8188eu/include/rtw_efuse.h |  1 -
 2 files changed, 42 deletions(-)
drivers/staging/r8188eu/core/rtw_efuse.c +0 -41
index 1a999d41483b..7829a422d225 100644
@@ -29,17 +29,6 @@ u8 fakeBTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN] = {0};
 #define REG_EFUSE_CTRL		0x0030
 #define EFUSE_CTRL			REG_EFUSE_CTRL		/*  E-Fuse Control. */
 
-static bool Efuse_Read1ByteFromFakeContent(u16 Offset, u8 *Value)
-{
-	if (Offset >= EFUSE_MAX_HW_SIZE)
-		return false;
-	if (fakeEfuseBank == 0)
-		*Value = fakeEfuseContent[Offset];
-	else
-		*Value = fakeBTEfuseContent[fakeEfuseBank - 1][Offset];
-	return true;
-}
-
 static bool
 Efuse_Write1ByteToFakeContent(u16 Offset, u8 Value)
 {
@@ -117,36 +106,6 @@ ReadEFuseByte(
 	*pbuf = (u8)(value32 & 0xff);
 }
 
-/*  11/16/2008 MH Read one byte from real Efuse. */
-u8 efuse_OneByteRead(struct adapter *pAdapter, u16 addr, u8 *data, bool pseudo)
-{
-	u8 tmpidx = 0;
-	u8 result;
-
-	if (pseudo) {
-		result = Efuse_Read1ByteFromFakeContent(addr, data);
-		return result;
-	}
-	/*  -----------------e-fuse reg ctrl --------------------------------- */
-	/* address */
-	rtw_write8(pAdapter, EFUSE_CTRL + 1, (u8)(addr & 0xff));
-	rtw_write8(pAdapter, EFUSE_CTRL + 2, ((u8)((addr >> 8) & 0x03)) |
-		   (rtw_read8(pAdapter, EFUSE_CTRL + 2) & 0xFC));
-
-	rtw_write8(pAdapter, EFUSE_CTRL + 3,  0x72);/* read cmd */
-
-	while (!(0x80 & rtw_read8(pAdapter, EFUSE_CTRL + 3)) && (tmpidx < 100))
-		tmpidx++;
-	if (tmpidx < 100) {
-		*data = rtw_read8(pAdapter, EFUSE_CTRL);
-		result = true;
-	} else {
-		*data = 0xff;
-		result = false;
-	}
-	return result;
-}
-
 /*  11/16/2008 MH Write one byte to reald Efuse. */
 u8 efuse_OneByteWrite(struct adapter *pAdapter, u16 addr, u8 data, bool pseudo)
 {
drivers/staging/r8188eu/include/rtw_efuse.h +0 -1
index 825f880a71da..f21d08d1be90 100644
@@ -70,7 +70,6 @@ extern u8 fakeBTEfuseModifiedMap[];
 
 u8 Efuse_CalculateWordCnts(u8 word_en);
 void ReadEFuseByte(struct adapter *adapter, u16 _offset, u8 *pbuf);
-u8 efuse_OneByteRead(struct adapter *adapter, u16 addr, u8 *data, bool test);
 u8 efuse_OneByteWrite(struct adapter *adapter, u16 addr, u8 data, bool	test);
 
 void efuse_WordEnableDataRead(u8 word_en, u8 *sourdata, u8 *targetdata);
Signature · 1 line
2.20.1
#15 lore raw

PATCH 12/15 staging: r8188eu: efuse_OneByteWrite is unused

In reply to Martin Kaiser

Remove the efuse_OneByteWrite function, which is no longer used. Remove resulting dead code as well.

---
 drivers/staging/r8188eu/core/rtw_efuse.c    | 45 ---------------------
 drivers/staging/r8188eu/include/rtw_efuse.h |  1 -
 2 files changed, 46 deletions(-)
drivers/staging/r8188eu/core/rtw_efuse.c +0 -45
index 7829a422d225..d226aee68085 100644
@@ -29,19 +29,6 @@ u8 fakeBTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN] = {0};
 #define REG_EFUSE_CTRL		0x0030
 #define EFUSE_CTRL			REG_EFUSE_CTRL		/*  E-Fuse Control. */
 
-static bool
-Efuse_Write1ByteToFakeContent(u16 Offset, u8 Value)
-{
-	if (Offset >= EFUSE_MAX_HW_SIZE)
-		return false;
-	if (fakeEfuseBank == 0) {
-		fakeEfuseContent[Offset] = Value;
-	} else {
-		fakeBTEfuseContent[fakeEfuseBank - 1][Offset] = Value;
-	}
-	return true;
-}
-
 /*  11/16/2008 MH Add description. Get current efuse area enabled word!!. */
 u8
 Efuse_CalculateWordCnts(u8 word_en)
@@ -106,38 +93,6 @@ ReadEFuseByte(
 	*pbuf = (u8)(value32 & 0xff);
 }
 
-/*  11/16/2008 MH Write one byte to reald Efuse. */
-u8 efuse_OneByteWrite(struct adapter *pAdapter, u16 addr, u8 data, bool pseudo)
-{
-	u8 tmpidx = 0;
-	u8 result;
-
-	if (pseudo) {
-		result = Efuse_Write1ByteToFakeContent(addr, data);
-		return result;
-	}
-
-	/*  -----------------e-fuse reg ctrl --------------------------------- */
-	/* address */
-	rtw_write8(pAdapter, EFUSE_CTRL + 1, (u8)(addr & 0xff));
-	rtw_write8(pAdapter, EFUSE_CTRL + 2,
-		   (rtw_read8(pAdapter, EFUSE_CTRL + 2) & 0xFC) |
-		   (u8)((addr >> 8) & 0x03));
-	rtw_write8(pAdapter, EFUSE_CTRL, data);/* data */
-
-	rtw_write8(pAdapter, EFUSE_CTRL + 3, 0xF2);/* write cmd */
-
-	while ((0x80 &  rtw_read8(pAdapter, EFUSE_CTRL + 3)) && (tmpidx < 100))
-		tmpidx++;
-
-	if (tmpidx < 100)
-		result = true;
-	else
-		result = false;
-
-	return result;
-}
-
 /*-----------------------------------------------------------------------------
  * Function:	efuse_WordEnableDataRead
  *
drivers/staging/r8188eu/include/rtw_efuse.h +0 -1
index f21d08d1be90..0696d850d2d3 100644
@@ -70,7 +70,6 @@ extern u8 fakeBTEfuseModifiedMap[];
 
 u8 Efuse_CalculateWordCnts(u8 word_en);
 void ReadEFuseByte(struct adapter *adapter, u16 _offset, u8 *pbuf);
-u8 efuse_OneByteWrite(struct adapter *adapter, u16 addr, u8 data, bool	test);
 
 void efuse_WordEnableDataRead(u8 word_en, u8 *sourdata, u8 *targetdata);
 
Signature · 1 line
2.20.1
#16 lore raw

PATCH 13/15 staging: r8188eu: remove bt efuse definitions

In reply to Martin Kaiser

This driver does not use bt efuses. Remove global variables and definitions related to bt efuses.

---
 drivers/staging/r8188eu/core/rtw_efuse.c    |  9 --------
 drivers/staging/r8188eu/include/rtw_efuse.h | 24 ---------------------
 2 files changed, 33 deletions(-)
drivers/staging/r8188eu/core/rtw_efuse.c +0 -9
index d226aee68085..b7f2274c62ac 100644
@@ -15,15 +15,6 @@ u8 fakeEfuseContent[EFUSE_MAX_HW_SIZE] = {0};
 u8 fakeEfuseInitMap[EFUSE_MAX_MAP_LEN] = {0};
 u8 fakeEfuseModifiedMap[EFUSE_MAX_MAP_LEN] = {0};
 
-u32 BTEfuseUsedBytes;
-u8 BTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
-u8 BTEfuseInitMap[EFUSE_BT_MAX_MAP_LEN] = {0};
-u8 BTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN] = {0};
-
-u32 fakeBTEfuseUsedBytes;
-u8 fakeBTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
-u8 fakeBTEfuseInitMap[EFUSE_BT_MAX_MAP_LEN] = {0};
-u8 fakeBTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN] = {0};
 /*------------------------Define local variable------------------------------*/
 
 #define REG_EFUSE_CTRL		0x0030
drivers/staging/r8188eu/include/rtw_efuse.h +0 -24
index 0696d850d2d3..b402531e639a 100644
@@ -23,10 +23,6 @@
 
 #define		EFUSE_REPEAT_THRESHOLD_			3
 
-/*	The following is for BT Efuse definition */
-#define		EFUSE_BT_MAX_MAP_LEN		1024
-#define		EFUSE_MAX_BANK			4
-#define		EFUSE_MAX_BT_BANK		(EFUSE_MAX_BANK-1)
 /*--------------------------Define Parameters-------------------------------*/
 #define		EFUSE_MAX_WORD_UNIT			4
 
@@ -37,17 +33,6 @@ struct efuse_hal {
 	u8 fakeEfuseContent[EFUSE_MAX_HW_SIZE];
 	u8 fakeEfuseInitMap[EFUSE_MAX_MAP_LEN];
 	u8 fakeEfuseModifiedMap[EFUSE_MAX_MAP_LEN];
-
-	u16 BTEfuseUsedBytes;
-	u8 BTEfuseUsedPercentage;
-	u8 BTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
-	u8 BTEfuseInitMap[EFUSE_BT_MAX_MAP_LEN];
-	u8 BTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN];
-
-	u16 fakeBTEfuseUsedBytes;
-	u8 fakeBTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
-	u8 fakeBTEfuseInitMap[EFUSE_BT_MAX_MAP_LEN];
-	u8 fakeBTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN];
 };
 
 /*------------------------Export global variable----------------------------*/
@@ -57,15 +42,6 @@ extern u8 fakeEfuseContent[];
 extern u8 fakeEfuseInitMap[];
 extern u8 fakeEfuseModifiedMap[];
 
-extern u32 BTEfuseUsedBytes;
-extern u8 BTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
-extern u8 BTEfuseInitMap[];
-extern u8 BTEfuseModifiedMap[];
-
-extern u32 fakeBTEfuseUsedBytes;
-extern u8 fakeBTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
-extern u8 fakeBTEfuseInitMap[];
-extern u8 fakeBTEfuseModifiedMap[];
 /*------------------------Export global variable----------------------------*/
 
 u8 Efuse_CalculateWordCnts(u8 word_en);
Signature · 1 line
2.20.1
#17 lore raw

PATCH 14/15 staging: r8188eu: remove fake efuse variables

In reply to Martin Kaiser

We removed the pseudo read code. This patch removes the fake efuse arrays that were used by pseudo reads.

---
 drivers/staging/r8188eu/core/rtw_efuse.c    | 9 ---------
 drivers/staging/r8188eu/include/rtw_efuse.h | 7 -------
 2 files changed, 16 deletions(-)
drivers/staging/r8188eu/core/rtw_efuse.c +0 -9
index b7f2274c62ac..f88d086329b1 100644
@@ -8,15 +8,6 @@
 #include "../include/rtw_efuse.h"
 #include "../include/rtl8188e_hal.h"
 
-/*------------------------Define local variable------------------------------*/
-u8 fakeEfuseBank;
-u32 fakeEfuseUsedBytes;
-u8 fakeEfuseContent[EFUSE_MAX_HW_SIZE] = {0};
-u8 fakeEfuseInitMap[EFUSE_MAX_MAP_LEN] = {0};
-u8 fakeEfuseModifiedMap[EFUSE_MAX_MAP_LEN] = {0};
-
-/*------------------------Define local variable------------------------------*/
-
 #define REG_EFUSE_CTRL		0x0030
 #define EFUSE_CTRL			REG_EFUSE_CTRL		/*  E-Fuse Control. */
 
drivers/staging/r8188eu/include/rtw_efuse.h +0 -7
index b402531e639a..9174f3d635e4 100644
@@ -35,13 +35,6 @@ struct efuse_hal {
 	u8 fakeEfuseModifiedMap[EFUSE_MAX_MAP_LEN];
 };
 
-/*------------------------Export global variable----------------------------*/
-extern u8 fakeEfuseBank;
-extern u32 fakeEfuseUsedBytes;
-extern u8 fakeEfuseContent[];
-extern u8 fakeEfuseInitMap[];
-extern u8 fakeEfuseModifiedMap[];
-
 /*------------------------Export global variable----------------------------*/
 
 u8 Efuse_CalculateWordCnts(u8 word_en);
Signature · 1 line
2.20.1
#18 lore raw

PATCH 15/15 staging: r8188eu: remove the efuse_hal structure

In reply to Martin Kaiser

struct efuse_hal is not used and can be removed.

---
 drivers/staging/r8188eu/include/rtl8188e_hal.h | 1 -
 drivers/staging/r8188eu/include/rtw_efuse.h    | 9 ---------
 2 files changed, 10 deletions(-)
drivers/staging/r8188eu/include/rtl8188e_hal.h +0 -1
index 4bf1f5d0815a..31a46f204954 100644
@@ -184,7 +184,6 @@ struct hal_data_8188e {
 	u8	bAPKThermalMeterIgnore;
 
 	bool	EepromOrEfuse;
-	struct efuse_hal	EfuseHal;
 
 	u8	Index24G_CCK_Base[RF_PATH_MAX][CHANNEL_MAX_NUMBER];
 	u8	Index24G_BW40_Base[RF_PATH_MAX][CHANNEL_MAX_NUMBER];
drivers/staging/r8188eu/include/rtw_efuse.h +0 -9
index 9174f3d635e4..4d8eff8e860e 100644
@@ -26,15 +26,6 @@
 /*--------------------------Define Parameters-------------------------------*/
 #define		EFUSE_MAX_WORD_UNIT			4
 
-/*------------------------------Define structure----------------------------*/
-struct efuse_hal {
-	u8 fakeEfuseBank;
-	u32	fakeEfuseUsedBytes;
-	u8 fakeEfuseContent[EFUSE_MAX_HW_SIZE];
-	u8 fakeEfuseInitMap[EFUSE_MAX_MAP_LEN];
-	u8 fakeEfuseModifiedMap[EFUSE_MAX_MAP_LEN];
-};
-
 /*------------------------Export global variable----------------------------*/
 
 u8 Efuse_CalculateWordCnts(u8 word_en);
Signature · 1 line
2.20.1