Skip to contentSkip to conversation

staging: rtl8188eu: merge two functions

PATCH New Martin Kaiser 1 participant 10 messages Jul 18, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/10 staging: rtl8188eu: merge two functions

All that rtw_hal_read_chip_info does is call _ReadPROMContent. Merge the two functions.

---
 drivers/staging/rtl8188eu/hal/usb_halinit.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/staging/rtl8188eu/hal/usb_halinit.c +4 -11
index 05c67e7d23ad..56de6071eb72 100644
@@ -990,25 +990,18 @@ static void readAdapterInfo_8188EU(struct adapter *adapt)
 	Hal_ReadThermalMeter_88E(adapt, eeprom->efuse_eeprom_data, eeprom->bautoload_fail_flag);
 }
 
-static void _ReadPROMContent(struct adapter *Adapter)
+void rtw_hal_read_chip_info(struct adapter *Adapter)
 {
 	struct eeprom_priv *eeprom = GET_EEPROM_EFUSE_PRIV(Adapter);
-	u8 eeValue;
+	u8 eeValue = usb_read8(Adapter, REG_9346CR);
 
-	/* check system boot selection */
-	eeValue = usb_read8(Adapter, REG_9346CR);
-	eeprom->EepromOrEfuse		= (eeValue & BOOT_FROM_EEPROM) ? true : false;
-	eeprom->bautoload_fail_flag	= (eeValue & EEPROM_EN) ? false : true;
+	eeprom->EepromOrEfuse = (eeValue & BOOT_FROM_EEPROM) ? true : false;
+	eeprom->bautoload_fail_flag = (eeValue & EEPROM_EN) ? false : true;
 
 	Hal_InitPGData88E(Adapter);
 	readAdapterInfo_8188EU(Adapter);
 }
 
-void rtw_hal_read_chip_info(struct adapter *Adapter)
-{
-	_ReadPROMContent(Adapter);
-}
-
 #define GPIO_DEBUG_PORT_NUM 0
 static void rtl8192cu_trigger_gpio_0(struct adapter *adapt)
 {
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/10 staging: rtl8188eu: remove the "trigger gpio 0" hal variable

The hal variable to trigger gpio 0 seems to be a leftover from debugging code that was removed. An empty function is called when this variable is written to.

Remove the empty function and the variable itself. It should be safe to remove an entry from the hw_variables enum as this enum is used only within the rtl8188eu driver.

---
 drivers/staging/rtl8188eu/hal/usb_halinit.c  | 8 --------
 drivers/staging/rtl8188eu/include/hal_intf.h | 1 -
 2 files changed, 9 deletions(-)
drivers/staging/rtl8188eu/hal/usb_halinit.c +0 -8
index 56de6071eb72..26c445a77e35 100644
@@ -1002,11 +1002,6 @@ void rtw_hal_read_chip_info(struct adapter *Adapter)
 	readAdapterInfo_8188EU(Adapter);
 }
 
-#define GPIO_DEBUG_PORT_NUM 0
-static void rtl8192cu_trigger_gpio_0(struct adapter *adapt)
-{
-}
-
 static void ResumeTxBeacon(struct adapter *adapt)
 {
 	struct hal_data_8188e *haldata = adapt->HalData;
@@ -1550,9 +1545,6 @@ void rtw_hal_set_hwreg(struct adapter *Adapter, u8 variable, u8 *val)
 			}
 		}
 		break;
-	case HW_VAR_TRIGGER_GPIO_0:
-		rtl8192cu_trigger_gpio_0(Adapter);
-		break;
 	case HW_VAR_RPT_TIMER_SETTING:
 		{
 			u16 min_rpt_time = (*(u16 *)val);
drivers/staging/rtl8188eu/include/hal_intf.h +0 -1
index 2e3e933781eb..2eb4f1fa75bb 100644
@@ -74,7 +74,6 @@ enum hw_variables {
 	HW_VAR_TDLS_RS_RCR,
 	HW_VAR_TDLS_DONE_CH_SEN,
 	HW_VAR_INITIAL_GAIN,
-	HW_VAR_TRIGGER_GPIO_0,
 	HW_VAR_BT_SET_COEXIST,
 	HW_VAR_BT_ISSUE_DELBA,
 	HW_VAR_CURRENT_ANTENNA,
Signature · 1 line
2.20.1
#2 lore raw

PATCH 3/10 staging: rtl8188eu: remove RTL871X_HCI_TYPE enum

In reply to Martin Kaiser

This enum is not used and can be removed.

---
 drivers/staging/rtl8188eu/include/hal_intf.h | 7 -------
 1 file changed, 7 deletions(-)
drivers/staging/rtl8188eu/include/hal_intf.h +0 -7
index 2eb4f1fa75bb..2a00d2df95d4 100644
@@ -11,13 +11,6 @@
 #include <drv_types.h>
 #include <hal8188e_phy_cfg.h>
 
-enum RTL871X_HCI_TYPE {
-	RTW_PCIE	= BIT(0),
-	RTW_USB		= BIT(1),
-	RTW_SDIO	= BIT(2),
-	RTW_GSPI	= BIT(3),
-};
-
 enum _CHIP_TYPE {
 	NULL_CHIP_TYPE,
 	RTL8712_8188S_8191S_8192S,
Signature · 1 line
2.20.1
#3 lore raw

PATCH 4/10 staging: rtl8188eu: remove _CHIP_TYPE enum

In reply to Martin Kaiser

This enum is not used and can be removed.

---
 drivers/staging/rtl8188eu/include/hal_intf.h | 10 ----------
 1 file changed, 10 deletions(-)
drivers/staging/rtl8188eu/include/hal_intf.h +0 -10
index 2a00d2df95d4..c74249fc200f 100644
@@ -11,16 +11,6 @@
 #include <drv_types.h>
 #include <hal8188e_phy_cfg.h>
 
-enum _CHIP_TYPE {
-	NULL_CHIP_TYPE,
-	RTL8712_8188S_8191S_8192S,
-	RTL8188C_8192C,
-	RTL8192D,
-	RTL8723A,
-	RTL8188E,
-	MAX_CHIP_TYPE
-};
-
 enum hw_variables {
 	HW_VAR_MEDIA_STATUS,
 	HW_VAR_MEDIA_STATUS1,
Signature · 1 line
2.20.1
#4 lore raw

PATCH 5/10 staging: rtl8188eu: remove struct eeprom_priv's EepromOrEfuse

In reply to Martin Kaiser

This setting is used only in one place. There's no need to store it in a global struct.

While at it, merge the two-line Hal_InitPGData88E function and its only caller.

---
 drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c | 6 ------
 drivers/staging/rtl8188eu/hal/usb_halinit.c       | 5 +++--
 drivers/staging/rtl8188eu/include/hal_intf.h      | 2 --
 drivers/staging/rtl8188eu/include/rtl8188e_hal.h  | 3 ---
 4 files changed, 3 insertions(+), 13 deletions(-)
drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c +0 -6
index d1086699f952..62cbe052397f 100644
@@ -228,12 +228,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, u8 *hwinfo)
 {
 	struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
drivers/staging/rtl8188eu/hal/usb_halinit.c +3 -2
index 26c445a77e35..e0961919fcf8 100644
@@ -995,10 +995,11 @@ void rtw_hal_read_chip_info(struct adapter *Adapter)
 	struct eeprom_priv *eeprom = GET_EEPROM_EFUSE_PRIV(Adapter);
 	u8 eeValue = usb_read8(Adapter, REG_9346CR);
 
-	eeprom->EepromOrEfuse = (eeValue & BOOT_FROM_EEPROM) ? true : false;
 	eeprom->bautoload_fail_flag = (eeValue & EEPROM_EN) ? false : true;
 
-	Hal_InitPGData88E(Adapter);
+	if (eeValue & BOOT_FROM_EEPROM)
+		EFUSE_ShadowMapUpdate(Adapter);
+
 	readAdapterInfo_8188EU(Adapter);
 }
 
drivers/staging/rtl8188eu/include/hal_intf.h +0 -2
index c74249fc200f..4d4e0a259050 100644
@@ -131,8 +131,6 @@ enum hardware_type {
 
 #define GET_EEPROM_EFUSE_PRIV(adapter) (&adapter->eeprompriv)
 
-#define is_boot_from_eeprom(adapter) (adapter->eeprompriv.EepromOrEfuse)
-
 void UpdateHalRAMask8188EUsb(struct adapter *adapt, u32 mac_id, u8 rssi_level);
 u32 rtl8188eu_hal_deinit(struct adapter *Adapter);
 u32 rtl8188eu_hal_init(struct adapter *Adapter);
drivers/staging/rtl8188eu/include/rtl8188e_hal.h +0 -3
index 2c16d3f33e1c..f585cbe21a6f 100644
@@ -196,8 +196,6 @@ struct hal_data_8188e {
 	u8	bTXPowerDataReadFromEEPORM;
 	u8	EEPROMThermalMeter;
 
-	bool	EepromOrEfuse;
-
 	u8	Index24G_CCK_Base[MAX_RF_PATH][CHANNEL_MAX_NUMBER];
 	u8	Index24G_BW40_Base[MAX_RF_PATH][CHANNEL_MAX_NUMBER];
 	/* If only one tx, only BW20 and OFDM are used. */
@@ -298,7 +296,6 @@ void rtl8188e_InitializeFirmwareVars(struct adapter *padapter);
 s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy);
 
 /*  EFuse */
-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
#5 lore raw

PATCH 6/10 staging: rtl8188eu: remove efuse write support

In reply to Martin Kaiser

This driver does not need write access to the rtl1888eu chip's efuses. Remove the code to set the voltages for writing the efuses.

---
 drivers/staging/rtl8188eu/core/rtw_efuse.c | 32 ++--------------------
 1 file changed, 3 insertions(+), 29 deletions(-)
drivers/staging/rtl8188eu/core/rtw_efuse.c +3 -29
index 80673a73c119..0b821df58b77 100644
@@ -16,18 +16,8 @@
 #define REG_EFUSE_CTRL		0x0030
 #define EFUSE_CTRL			REG_EFUSE_CTRL		/*  E-Fuse Control. */
 
-enum{
-		VOLTAGE_V25						= 0x03,
-		LDOE25_SHIFT						= 28,
-	};
-
-/*
- * When we want to enable write operation, we should change to pwr on state.
- * When we stop write, we should switch to 500k mode and disable LDO 2.5V.
- */
-static void efuse_power_switch(struct adapter *pAdapter, u8 write, u8 pwrstate)
+static void efuse_power_switch(struct adapter *pAdapter, u8 pwrstate)
 {
-	u8 tempval;
 	u16 tmpv16;
 
 	if (pwrstate) {
@@ -52,22 +42,8 @@ static void efuse_power_switch(struct adapter *pAdapter, u8 write, u8 pwrstate)
 			tmpv16 |= (LOADER_CLK_EN | ANA8M);
 			usb_write16(pAdapter, REG_SYS_CLKR, tmpv16);
 		}
-
-		if (write) {
-			/*  Enable LDO 2.5V before read/write action */
-			tempval = usb_read8(pAdapter, EFUSE_TEST + 3);
-			tempval &= 0x0F;
-			tempval |= (VOLTAGE_V25 << 4);
-			usb_write8(pAdapter, EFUSE_TEST + 3, (tempval | 0x80));
-		}
 	} else {
 		usb_write8(pAdapter, REG_EFUSE_ACCESS, EFUSE_ACCESS_OFF);
-
-		if (write) {
-			/*  Disable LDO 2.5V after read/write action */
-			tempval = usb_read8(pAdapter, EFUSE_TEST + 3);
-			usb_write8(pAdapter, EFUSE_TEST + 3, (tempval & 0x7F));
-		}
 	}
 }
 
@@ -857,11 +833,9 @@ void efuse_WordEnableDataRead(u8 word_en, u8 *sourdata, u8 *targetdata)
 /* Read All Efuse content */
 static void Efuse_ReadAllMap(struct adapter *pAdapter, u8 *Efuse)
 {
-	efuse_power_switch(pAdapter, false, true);
-
+	efuse_power_switch(pAdapter, true);
 	efuse_ReadEFuse(pAdapter, 0, EFUSE_MAP_LEN_88E, Efuse);
-
-	efuse_power_switch(pAdapter, false, false);
+	efuse_power_switch(pAdapter, false);
 }
 
 /* Transfer current EFUSE content to shadow init and modify map. */
Signature · 1 line
2.20.1
#6 lore raw

PATCH 7/10 staging: rtl8188eu: remove unused power flows and transitions

In reply to Martin Kaiser

The driver defines a couple of "flows" to move the chip into a certain power state. Each flow is a sequence of "transitions".

This patch removes flows and transitions which are not used.

---
 drivers/staging/rtl8188eu/hal/pwrseq.c        |  52 --------
 drivers/staging/rtl8188eu/include/pwrseq.h    | 112 ------------------
 .../staging/rtl8188eu/include/rtl8188e_hal.h  |   6 -
 3 files changed, 170 deletions(-)
drivers/staging/rtl8188eu/hal/pwrseq.c +0 -52
index f7890a8f4673..80bf9692844f 100644
@@ -17,13 +17,6 @@ struct wl_pwr_cfg rtl8188E_power_on_flow[RTL8188E_TRANS_CARDEMU_TO_ACT_STEPS +
 	RTL8188E_TRANS_END
 };
 
-/* 3Radio off Array */
-struct wl_pwr_cfg rtl8188E_radio_off_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS +
-					  RTL8188E_TRANS_END_STEPS] = {
-	RTL8188E_TRANS_ACT_TO_CARDEMU
-	RTL8188E_TRANS_END
-};
-
 /* 3Card Disable Array */
 struct wl_pwr_cfg rtl8188E_card_disable_flow
 	[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS +
@@ -34,43 +27,6 @@ struct wl_pwr_cfg rtl8188E_card_disable_flow
 		RTL8188E_TRANS_END
 };
 
-/* 3 Card Enable Array */
-struct wl_pwr_cfg rtl8188E_card_enable_flow
-	[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS +
-	 RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS +
-	 RTL8188E_TRANS_END_STEPS] = {
-		RTL8188E_TRANS_CARDDIS_TO_CARDEMU
-		RTL8188E_TRANS_CARDEMU_TO_ACT
-		RTL8188E_TRANS_END
-};
-
-/* 3Suspend Array */
-struct wl_pwr_cfg rtl8188E_suspend_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS +
-					RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS +
-					RTL8188E_TRANS_END_STEPS] = {
-	RTL8188E_TRANS_ACT_TO_CARDEMU
-	RTL8188E_TRANS_CARDEMU_TO_SUS
-	RTL8188E_TRANS_END
-};
-
-/* 3 Resume Array */
-struct wl_pwr_cfg rtl8188E_resume_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS +
-				       RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS +
-				       RTL8188E_TRANS_END_STEPS] = {
-	RTL8188E_TRANS_SUS_TO_CARDEMU
-	RTL8188E_TRANS_CARDEMU_TO_ACT
-	RTL8188E_TRANS_END
-};
-
-/* 3HWPDN Array */
-struct wl_pwr_cfg rtl8188E_hwpdn_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS +
-				      RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS +
-				      RTL8188E_TRANS_END_STEPS] = {
-	RTL8188E_TRANS_ACT_TO_CARDEMU
-	RTL8188E_TRANS_CARDEMU_TO_PDN
-	RTL8188E_TRANS_END
-};
-
 /* 3 Enter LPS */
 struct wl_pwr_cfg rtl8188E_enter_lps_flow[RTL8188E_TRANS_ACT_TO_LPS_STEPS +
 					  RTL8188E_TRANS_END_STEPS] = {
@@ -78,11 +34,3 @@ struct wl_pwr_cfg rtl8188E_enter_lps_flow[RTL8188E_TRANS_ACT_TO_LPS_STEPS +
 	RTL8188E_TRANS_ACT_TO_LPS
 	RTL8188E_TRANS_END
 };
-
-/* 3 Leave LPS */
-struct wl_pwr_cfg rtl8188E_leave_lps_flow[RTL8188E_TRANS_LPS_TO_ACT_STEPS +
-					  RTL8188E_TRANS_END_STEPS] = {
-	/* FW behavior */
-	RTL8188E_TRANS_LPS_TO_ACT
-	RTL8188E_TRANS_END
-};
drivers/staging/rtl8188eu/include/pwrseq.h +0 -112

153 lines not on this page · raw message

drivers/staging/rtl8188eu/include/rtl8188e_hal.h +0 -6
index f585cbe21a6f..e508b4b9ef7f 100644
@@ -22,14 +22,8 @@
 
 /* RTL8188E Power Configuration CMDs for USB/SDIO interfaces */
 #define Rtl8188E_NIC_PWR_ON_FLOW		rtl8188E_power_on_flow
-#define Rtl8188E_NIC_RF_OFF_FLOW		rtl8188E_radio_off_flow
 #define Rtl8188E_NIC_DISABLE_FLOW		rtl8188E_card_disable_flow
-#define Rtl8188E_NIC_ENABLE_FLOW		rtl8188E_card_enable_flow
-#define Rtl8188E_NIC_SUSPEND_FLOW		rtl8188E_suspend_flow
-#define Rtl8188E_NIC_RESUME_FLOW		rtl8188E_resume_flow
-#define Rtl8188E_NIC_PDN_FLOW			rtl8188E_hwpdn_flow
 #define Rtl8188E_NIC_LPS_ENTER_FLOW		rtl8188E_enter_lps_flow
-#define Rtl8188E_NIC_LPS_LEAVE_FLOW		rtl8188E_leave_lps_flow
 
 #define DRVINFO_SZ	4 /*  unit is 8bytes */
 #define PageNum_128(_Len)	(u32)(((_Len) >> 7) + ((_Len) & 0x7F ? 1 : 0))
Signature · 1 line
2.20.1
#7 lore raw

PATCH 8/10 staging: rtl8188eu: remove constant function parameter

In reply to Martin Kaiser

The rtl88eu_pwrseqcmdparsing function takes a parameter to restrict commands to certain power cut versions of the rtl8188eu chipset. This mechanism is not used, the callers always select all versions.

Remove the power cut parameter.

---
 drivers/staging/rtl8188eu/hal/pwrseqcmd.c     | 82 +++++++++----------
 drivers/staging/rtl8188eu/hal/usb_halinit.c   |  9 +-
 drivers/staging/rtl8188eu/include/pwrseqcmd.h |  4 +-
 3 files changed, 42 insertions(+), 53 deletions(-)
drivers/staging/rtl8188eu/hal/pwrseqcmd.c +38 -44
index cec2ff879f5d..f2b973b377dd 100644
@@ -11,8 +11,7 @@
 /* This routine deals with the Power Configuration CMDs parsing
  * for RTL8723/RTL8188E Series IC.
  */
-u8 rtl88eu_pwrseqcmdparsing(struct adapter *padapter, u8 cut_vers,
-			    struct wl_pwr_cfg pwrseqcmd[])
+u8 rtl88eu_pwrseqcmdparsing(struct adapter *padapter, struct wl_pwr_cfg pwrseqcmd[])
 {
 	struct wl_pwr_cfg pwrcfgcmd;
 	u8 poll_bit = false;
@@ -25,53 +24,48 @@ u8 rtl88eu_pwrseqcmdparsing(struct adapter *padapter, u8 cut_vers,
 	do {
 		pwrcfgcmd = pwrseqcmd[aryidx];
 
-		/* Only Handle the command whose CUT is matched */
-		if (GET_PWR_CFG_CUT_MASK(pwrcfgcmd) & cut_vers) {
-			switch (GET_PWR_CFG_CMD(pwrcfgcmd)) {
-			case PWR_CMD_READ:
-				break;
-			case PWR_CMD_WRITE:
-				offset = GET_PWR_CFG_OFFSET(pwrcfgcmd);
+		switch (GET_PWR_CFG_CMD(pwrcfgcmd)) {
+		case PWR_CMD_READ:
+			break;
+		case PWR_CMD_WRITE:
+			offset = GET_PWR_CFG_OFFSET(pwrcfgcmd);
 
-				/*  Read the value from system register */
-				value = usb_read8(padapter, offset);
-
-				value &= ~(GET_PWR_CFG_MASK(pwrcfgcmd));
-				value |= (GET_PWR_CFG_VALUE(pwrcfgcmd) &
-					  GET_PWR_CFG_MASK(pwrcfgcmd));
+			/*  Read the value from system register */
+			value = usb_read8(padapter, offset);
 
-				/*  Write the value back to system register */
-				usb_write8(padapter, offset, value);
-				break;
-			case PWR_CMD_POLLING:
-				poll_bit = false;
-				offset = GET_PWR_CFG_OFFSET(pwrcfgcmd);
-				do {
-					value = usb_read8(padapter, offset);
-					value &= GET_PWR_CFG_MASK(pwrcfgcmd);
+			value &= ~(GET_PWR_CFG_MASK(pwrcfgcmd));
+			value |= (GET_PWR_CFG_VALUE(pwrcfgcmd) & GET_PWR_CFG_MASK(pwrcfgcmd));
 
-					if (value == (GET_PWR_CFG_VALUE(pwrcfgcmd) &
-						      GET_PWR_CFG_MASK(pwrcfgcmd)))
-						poll_bit = true;
-					else
-						udelay(10);
+			/*  Write the value back to system register */
+			usb_write8(padapter, offset, value);
+			break;
+		case PWR_CMD_POLLING:
+			poll_bit = false;
+			offset = GET_PWR_CFG_OFFSET(pwrcfgcmd);
+			do {
+				value = usb_read8(padapter, offset);
+				value &= GET_PWR_CFG_MASK(pwrcfgcmd);
 
-					if (poll_count++ > max_poll_count)
-						return false;
-				} while (!poll_bit);
-				break;
-			case PWR_CMD_DELAY:
-				if (GET_PWR_CFG_VALUE(pwrcfgcmd) == PWRSEQ_DELAY_US)
-					udelay(GET_PWR_CFG_OFFSET(pwrcfgcmd));
+				if (value == (GET_PWR_CFG_VALUE(pwrcfgcmd) & GET_PWR_CFG_MASK(pwrcfgcmd)))
+					poll_bit = true;
 				else
-					udelay(GET_PWR_CFG_OFFSET(pwrcfgcmd) * 1000);
-				break;
-			case PWR_CMD_END:
-				/* When this command is parsed, end the process */
-				return true;
-			default:
-				break;
-			}
+					udelay(10);
+
+				if (poll_count++ > max_poll_count)
+					return false;
+			} while (!poll_bit);
+			break;
+		case PWR_CMD_DELAY:
+			if (GET_PWR_CFG_VALUE(pwrcfgcmd) == PWRSEQ_DELAY_US)
+				udelay(GET_PWR_CFG_OFFSET(pwrcfgcmd));
+			else
+				udelay(GET_PWR_CFG_OFFSET(pwrcfgcmd) * 1000);
+			break;
+		case PWR_CMD_END:
+			/* When this command is parsed, end the process */
+			return true;
+		default:
+			break;
 		}
 
 		aryidx++;/* Add Array Index */
drivers/staging/rtl8188eu/hal/usb_halinit.c +3 -6
index e0961919fcf8..ae64678a5a5c 100644
@@ -88,8 +88,7 @@ u32 rtw_hal_power_on(struct adapter *adapt)
 	if (adapt->HalData->bMacPwrCtrlOn)
 		return _SUCCESS;
 
-	if (!rtl88eu_pwrseqcmdparsing(adapt, PWR_CUT_ALL_MSK,
-				      Rtl8188E_NIC_PWR_ON_FLOW))
+	if (!rtl88eu_pwrseqcmdparsing(adapt, Rtl8188E_NIC_PWR_ON_FLOW))
 		return _FAIL;
 
 	/*  Enable MAC DMA/WMAC/SCHEDULE/SEC block */
@@ -830,8 +829,7 @@ static void CardDisableRTL8188EU(struct adapter *Adapter)
 	usb_write8(Adapter, REG_CR, 0x0);
 
 	/*  Run LPS WL RFOFF flow */
-	rtl88eu_pwrseqcmdparsing(Adapter, PWR_CUT_ALL_MSK,
-				 Rtl8188E_NIC_LPS_ENTER_FLOW);
+	rtl88eu_pwrseqcmdparsing(Adapter, Rtl8188E_NIC_LPS_ENTER_FLOW);
 
 	/*  2. 0x1F[7:0] = 0		turn off RF */
 
@@ -852,8 +850,7 @@ static void CardDisableRTL8188EU(struct adapter *Adapter)
 	usb_write8(Adapter, REG_32K_CTRL, val8 & (~BIT(0)));
 
 	/*  Card disable power action flow */
-	rtl88eu_pwrseqcmdparsing(Adapter, PWR_CUT_ALL_MSK,
-				 Rtl8188E_NIC_DISABLE_FLOW);
+	rtl88eu_pwrseqcmdparsing(Adapter, Rtl8188E_NIC_DISABLE_FLOW);
 
 	/*  Reset MCU IO Wrapper */
 	val8 = usb_read8(Adapter, REG_RSV_CTRL + 1);
drivers/staging/rtl8188eu/include/pwrseqcmd.h +1 -3
index 05f117e2a105..e364ee450beb 100644
@@ -41,12 +41,10 @@ struct wl_pwr_cfg {
 };
 
 #define GET_PWR_CFG_OFFSET(__PWR_CMD)		__PWR_CMD.offset
-#define GET_PWR_CFG_CUT_MASK(__PWR_CMD)		__PWR_CMD.cut_msk
 #define GET_PWR_CFG_CMD(__PWR_CMD)		__PWR_CMD.cmd
 #define GET_PWR_CFG_MASK(__PWR_CMD)		__PWR_CMD.msk
 #define GET_PWR_CFG_VALUE(__PWR_CMD)		__PWR_CMD.value
 
-u8 rtl88eu_pwrseqcmdparsing(struct adapter *padapter, u8 cut_vers,
-			    struct wl_pwr_cfg pwrcfgCmd[]);
+u8 rtl88eu_pwrseqcmdparsing(struct adapter *padapter, struct wl_pwr_cfg pwrcfgCmd[]);
 
 #endif
Signature · 1 line
2.20.1
#8 lore raw

PATCH 9/10 staging: rtl8188eu: remove PWR_CMD_READ

In reply to Martin Kaiser

None of the power flows and transitions includes a read command. PWR_CMD_READ can be removed.

---
 drivers/staging/rtl8188eu/hal/pwrseqcmd.c     | 2 --
 drivers/staging/rtl8188eu/include/pwrseqcmd.h | 1 -
 2 files changed, 3 deletions(-)
drivers/staging/rtl8188eu/hal/pwrseqcmd.c +0 -2
index f2b973b377dd..cab774e31c60 100644
@@ -25,8 +25,6 @@ u8 rtl88eu_pwrseqcmdparsing(struct adapter *padapter, struct wl_pwr_cfg pwrseqcm
 		pwrcfgcmd = pwrseqcmd[aryidx];
 
 		switch (GET_PWR_CFG_CMD(pwrcfgcmd)) {
-		case PWR_CMD_READ:
-			break;
 		case PWR_CMD_WRITE:
 			offset = GET_PWR_CFG_OFFSET(pwrcfgcmd);
 
drivers/staging/rtl8188eu/include/pwrseqcmd.h +0 -1
index e364ee450beb..a5eb95fc58b9 100644
@@ -10,7 +10,6 @@
 #include <drv_types.h>
 
 /* The value of cmd: 4 bits */
-#define PWR_CMD_READ		0x00
 #define PWR_CMD_WRITE		0x01
 #define PWR_CMD_POLLING		0x02
 #define PWR_CMD_DELAY		0x03
Signature · 1 line
2.20.1
#9 lore raw

PATCH 10/10 staging: rtl8188eu: remove cut_mask field from wl_pwr_cfg

In reply to Martin Kaiser

We're no longer matching power transitions and commands against a power cut version mask.

The cut_mask field from struct wl_pwr_cfg can be removed. It was set to PWR_CUT_ALL_MSK for all remaining commands.

---
 drivers/staging/rtl8188eu/include/pwrseq.h    | 56 +++++++++----------
 drivers/staging/rtl8188eu/include/pwrseqcmd.h |  1 -
 2 files changed, 28 insertions(+), 29 deletions(-)
drivers/staging/rtl8188eu/include/pwrseq.h +28 -28
index caa6bf71da77..5a7b4206d240 100644
@@ -34,21 +34,21 @@
 	 * },
 	 * comment here
 	 */								\
-	{0x0006, PWR_CUT_ALL_MSK, PWR_CMD_POLLING, BIT(1), BIT(1)}, \
+	{0x0006, PWR_CMD_POLLING, BIT(1), BIT(1)}, \
 	/* wait till 0x04[17] = 1    power ready*/	\
-	{0x0002, PWR_CUT_ALL_MSK, PWR_CMD_WRITE, BIT(0) | BIT(1), 0}, \
+	{0x0002, PWR_CMD_WRITE, BIT(0) | BIT(1), 0}, \
 	/* 0x02[1:0] = 0	reset BB*/				\
-	{0x0026, PWR_CUT_ALL_MSK, PWR_CMD_WRITE, BIT(7), BIT(7)}, \
+	{0x0026, PWR_CMD_WRITE, BIT(7), BIT(7)}, \
 	/*0x24[23] = 2b'01 schmit trigger */				\
-	{0x0005, PWR_CUT_ALL_MSK, PWR_CMD_WRITE, BIT(7), 0}, \
+	{0x0005, PWR_CMD_WRITE, BIT(7), 0}, \
 	/* 0x04[15] = 0 disable HWPDN (control by DRV)*/		\
-	{0x0005, PWR_CUT_ALL_MSK, PWR_CMD_WRITE, BIT(4) | BIT(3), 0}, \
+	{0x0005, PWR_CMD_WRITE, BIT(4) | BIT(3), 0}, \
 	/*0x04[12:11] = 2b'00 disable WL suspend*/			\
-	{0x0005, PWR_CUT_ALL_MSK, PWR_CMD_WRITE, BIT(0), BIT(0)}, \
+	{0x0005, PWR_CMD_WRITE, BIT(0), BIT(0)}, \
 	/*0x04[8] = 1 polling until return 0*/				\
-	{0x0005, PWR_CUT_ALL_MSK, PWR_CMD_POLLING, BIT(0), 0}, \
+	{0x0005, PWR_CMD_POLLING, BIT(0), 0}, \
 	/*wait till 0x04[8] = 0*/					\
-	{0x0023, PWR_CUT_ALL_MSK, PWR_CMD_WRITE, BIT(4), 0}, \
+	{0x0023, PWR_CMD_WRITE, BIT(4), 0}, \
 	/*LDO normal mode*/
 
 #define RTL8188E_TRANS_ACT_TO_CARDEMU					\
@@ -57,13 +57,13 @@
 	 * },
 	 * comments here
 	 */								\
-	{0x001F, PWR_CUT_ALL_MSK, PWR_CMD_WRITE, 0xFF, 0}, \
+	{0x001F, PWR_CMD_WRITE, 0xFF, 0}, \
 	/*0x1F[7:0] = 0 turn off RF*/					\
-	{0x0023, PWR_CUT_ALL_MSK, PWR_CMD_WRITE, BIT(4), BIT(4)}, \
+	{0x0023, PWR_CMD_WRITE, BIT(4), BIT(4)}, \
 	/*LDO Sleep mode*/						\
-	{0x0005, PWR_CUT_ALL_MSK, PWR_CMD_WRITE, BIT(1), BIT(1)}, \
+	{0x0005, PWR_CMD_WRITE, BIT(1), BIT(1)}, \
 	/*0x04[9] = 1 turn off MAC by HW state machine*/		\
-	{0x0005, PWR_CUT_ALL_MSK, PWR_CMD_POLLING, BIT(1), 0}, \
+	{0x0005, PWR_CMD_POLLING, BIT(1), 0}, \
 	/*wait till 0x04[9] = 0 polling until return 0 to disable*/
 
 #define RTL8188E_TRANS_CARDEMU_TO_CARDDIS				\
@@ -72,15 +72,15 @@
 	 * value },
 	 * comments here
 	 */								\
-	{0x0026, PWR_CUT_ALL_MSK, PWR_CMD_WRITE, BIT(7), BIT(7)}, \
+	{0x0026, PWR_CMD_WRITE, BIT(7), BIT(7)}, \
 	/*0x24[23] = 2b'01 schmit trigger */				\
-	{0x0005, PWR_CUT_ALL_MSK, PWR_CMD_WRITE, BIT(3) | BIT(4), BIT(3)}, \
+	{0x0005, PWR_CMD_WRITE, BIT(3) | BIT(4), BIT(3)}, \
 	/*0x04[12:11] = 2b'01 enable WL suspend*/			\
-	{0x0007, PWR_CUT_ALL_MSK, PWR_CMD_WRITE, 0xFF, 0}, \
+	{0x0007, PWR_CMD_WRITE, 0xFF, 0}, \
 	/* 0x04[31:30] = 2b'10 enable enable bandgap mbias in suspend */\
-	{0x0041, PWR_CUT_ALL_MSK, PWR_CMD_WRITE, BIT(4), 0}, \
+	{0x0041, PWR_CMD_WRITE, BIT(4), 0}, \
 	/*Clear SIC_EN register 0x40[12] = 1'b0 */			\
-	{0xfe10, PWR_CUT_ALL_MSK, PWR_CMD_WRITE, BIT(4), BIT(4)}, \
+	{0xfe10, PWR_CMD_WRITE, BIT(4), BIT(4)}, \
 	/*Set USB suspend enable local register  0xfe10[4]=1 */
 
 /* This is used by driver for LPSRadioOff Procedure, not for FW LPS Step */
@@ -90,24 +90,24 @@
 	 * value },
 	 * comments here
 	 */								\
-	{0x0522, PWR_CUT_ALL_MSK, PWR_CMD_WRITE, 0xFF, 0x7F},/*Tx Pause*/ \
-	{0x05F8, PWR_CUT_ALL_MSK, PWR_CMD_POLLING, 0xFF, 0}, \
+	{0x0522, PWR_CMD_WRITE, 0xFF, 0x7F},/*Tx Pause*/ \
+	{0x05F8, PWR_CMD_POLLING, 0xFF, 0}, \
 	/*Should be zero if no packet is transmitting*/			\
-	{0x05F9, PWR_CUT_ALL_MSK, PWR_CMD_POLLING, 0xFF, 0}, \
+	{0x05F9, PWR_CMD_POLLING, 0xFF, 0}, \
 	/*Should be zero if no packet is transmitting*/			\
-	{0x05FA, PWR_CUT_ALL_MSK, PWR_CMD_POLLING, 0xFF, 0}, \
+	{0x05FA, PWR_CMD_POLLING, 0xFF, 0}, \
 	/*Should be zero if no packet is transmitting*/			\
-	{0x05FB, PWR_CUT_ALL_MSK, PWR_CMD_POLLING, 0xFF, 0}, \
+	{0x05FB, PWR_CMD_POLLING, 0xFF, 0}, \
 	/*Should be zero if no packet is transmitting*/			\
-	{0x0002, PWR_CUT_ALL_MSK, PWR_CMD_WRITE, BIT(0), 0}, \
+	{0x0002, PWR_CMD_WRITE, BIT(0), 0}, \
 	/*CCK and OFDM are disabled,and clock are gated*/		\
-	{0x0002, PWR_CUT_ALL_MSK, PWR_CMD_DELAY, 0,	PWRSEQ_DELAY_US}, \
+	{0x0002, PWR_CMD_DELAY, 0,	PWRSEQ_DELAY_US}, \
 	/*Delay 1us*/ \
-	{0x0100, PWR_CUT_ALL_MSK, PWR_CMD_WRITE, 0xFF, 0x3F}, \
+	{0x0100, PWR_CMD_WRITE, 0xFF, 0x3F}, \
 	/*Reset MAC TRX*/ \
-	{0x0101, PWR_CUT_ALL_MSK, PWR_CMD_WRITE, BIT(1), 0}, \
+	{0x0101, PWR_CMD_WRITE, BIT(1), 0}, \
 	/*check if removed later*/\
-	{0x0553, PWR_CUT_ALL_MSK, PWR_CMD_WRITE, BIT(5), BIT(5)}, \
+	{0x0553, PWR_CMD_WRITE, BIT(5), BIT(5)}, \
 	/*Respond TxOK to scheduler*/
 
 #define RTL8188E_TRANS_END						\
@@ -116,7 +116,7 @@
 	 * value },
 	 * comments here
 	 */								\
-	{0xFFFF, PWR_CUT_ALL_MSK, PWR_CMD_END, 0, 0},
+	{0xFFFF, PWR_CMD_END, 0, 0},
 
 extern struct wl_pwr_cfg rtl8188E_power_on_flow
 		[RTL8188E_TRANS_CARDEMU_TO_ACT_STEPS + RTL8188E_TRANS_END_STEPS];
drivers/staging/rtl8188eu/include/pwrseqcmd.h +0 -1
index a5eb95fc58b9..bfa0405cccde 100644
@@ -33,7 +33,6 @@ enum pwrseq_cmd_delat_unit {
 
 struct wl_pwr_cfg {
 	u16 offset;
-	u8 cut_msk;
 	u8 cmd:4;
 	u8 msk;
 	u8 value;
Signature · 1 line
2.20.1