[16/70] net/e1000/base: implement Low-Power-Link-Up (LPLU) for i225

Message ID 20200622064634.70941-17-guinanx.sun@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series update e1000 base code |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Guinan Sun June 22, 2020, 6:45 a.m. UTC
  I225 introduces a new mechanism for Low-Power-Link-Up (LPLU) control.
This patch implements the new functions and sets the PHY OPS pointers.

Signed-off-by: Dima Ruinskiy <dima.ruinskiy@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
---
 drivers/net/e1000/base/e1000_i225.c | 58 +++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
  

Comments

Zhao1, Wei June 23, 2020, 2:23 a.m. UTC | #1
Hi, 

> -----Original Message-----
> From: Sun, GuinanX <guinanx.sun@intel.com>
> Sent: Monday, June 22, 2020 2:46 PM
> To: dev@dpdk.org
> Cc: Guo, Jia <jia.guo@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>; Sun,
> GuinanX <guinanx.sun@intel.com>; Dima Ruinskiy <dima.ruinskiy@intel.com>
> Subject: [PATCH 16/70] net/e1000/base: implement Low-Power-Link-Up (LPLU)
> for i225
> 
> I225 introduces a new mechanism for Low-Power-Link-Up (LPLU) control.
> This patch implements the new functions and sets the PHY OPS pointers.
> 
> Signed-off-by: Dima Ruinskiy <dima.ruinskiy@intel.com>
> Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> ---
>  drivers/net/e1000/base/e1000_i225.c | 58
> +++++++++++++++++++++++++++++
>  1 file changed, 58 insertions(+)
> 
> diff --git a/drivers/net/e1000/base/e1000_i225.c
> b/drivers/net/e1000/base/e1000_i225.c
> index 621dc6863..dbebb6fa3 100644
> --- a/drivers/net/e1000/base/e1000_i225.c
> +++ b/drivers/net/e1000/base/e1000_i225.c


It seems we should commit to folder dpdk/drivers/net/igc/base not in e1000 folder for i225

> @@ -1147,3 +1147,61 @@ s32 e1000_init_hw_i225(struct e1000_hw *hw)
>  	ret_val = e1000_init_hw_82575(hw);
>  	return ret_val;
>  }
> +
> +/*
> + * e1000_set_d0_lplu_state_i225 - Set Low-Power-Link-Up (LPLU) D0 state
> + * @hw: pointer to the HW structure
> + * @active: true to enable LPLU, false to disable
> + *
> + * Note: since I225 does not actually support LPLU, this function
> + * simply enables/disables 1G and 2.5G speeds in D0.
> + */
> +s32 e1000_set_d0_lplu_state_i225(struct e1000_hw *hw, bool active) {
> +	u32 data;
> +
> +	DEBUGFUNC("e1000_set_d0_lplu_state_i225");
> +
> +	data = E1000_READ_REG(hw, E1000_I225_PHPM);
> +
> +	if (active) {
> +		data |= E1000_I225_PHPM_DIS_1000;
> +		data |= E1000_I225_PHPM_DIS_2500;
> +	} else {
> +		data &= ~E1000_I225_PHPM_DIS_1000;
> +		data &= ~E1000_I225_PHPM_DIS_2500;
> +	}
> +
> +	E1000_WRITE_REG(hw, E1000_I225_PHPM, data);
> +	return E1000_SUCCESS;
> +}
> +
> +/*
> + * e1000_set_d3_lplu_state_i225 - Set Low-Power-Link-Up (LPLU) D3 state
> + * @hw: pointer to the HW structure
> + * @active: true to enable LPLU, false to disable
> + *
> + * Note: since I225 does not actually support LPLU, this function
> + * simply enables/disables 100M, 1G and 2.5G speeds in D3.
> + */
> +s32 e1000_set_d3_lplu_state_i225(struct e1000_hw *hw, bool active) {
> +	u32 data;
> +
> +	DEBUGFUNC("e1000_set_d3_lplu_state_i225");
> +
> +	data = E1000_READ_REG(hw, E1000_I225_PHPM);
> +
> +	if (active) {
> +		data |= E1000_I225_PHPM_DIS_100_D3;
> +		data |= E1000_I225_PHPM_DIS_1000_D3;
> +		data |= E1000_I225_PHPM_DIS_2500_D3;
> +	} else {
> +		data &= ~E1000_I225_PHPM_DIS_100_D3;
> +		data &= ~E1000_I225_PHPM_DIS_1000_D3;
> +		data &= ~E1000_I225_PHPM_DIS_2500_D3;
> +	}
> +
> +	E1000_WRITE_REG(hw, E1000_I225_PHPM, data);
> +	return E1000_SUCCESS;
> +}
> --
> 2.17.1
  

Patch

diff --git a/drivers/net/e1000/base/e1000_i225.c b/drivers/net/e1000/base/e1000_i225.c
index 621dc6863..dbebb6fa3 100644
--- a/drivers/net/e1000/base/e1000_i225.c
+++ b/drivers/net/e1000/base/e1000_i225.c
@@ -1147,3 +1147,61 @@  s32 e1000_init_hw_i225(struct e1000_hw *hw)
 	ret_val = e1000_init_hw_82575(hw);
 	return ret_val;
 }
+
+/*
+ * e1000_set_d0_lplu_state_i225 - Set Low-Power-Link-Up (LPLU) D0 state
+ * @hw: pointer to the HW structure
+ * @active: true to enable LPLU, false to disable
+ *
+ * Note: since I225 does not actually support LPLU, this function
+ * simply enables/disables 1G and 2.5G speeds in D0.
+ */
+s32 e1000_set_d0_lplu_state_i225(struct e1000_hw *hw, bool active)
+{
+	u32 data;
+
+	DEBUGFUNC("e1000_set_d0_lplu_state_i225");
+
+	data = E1000_READ_REG(hw, E1000_I225_PHPM);
+
+	if (active) {
+		data |= E1000_I225_PHPM_DIS_1000;
+		data |= E1000_I225_PHPM_DIS_2500;
+	} else {
+		data &= ~E1000_I225_PHPM_DIS_1000;
+		data &= ~E1000_I225_PHPM_DIS_2500;
+	}
+
+	E1000_WRITE_REG(hw, E1000_I225_PHPM, data);
+	return E1000_SUCCESS;
+}
+
+/*
+ * e1000_set_d3_lplu_state_i225 - Set Low-Power-Link-Up (LPLU) D3 state
+ * @hw: pointer to the HW structure
+ * @active: true to enable LPLU, false to disable
+ *
+ * Note: since I225 does not actually support LPLU, this function
+ * simply enables/disables 100M, 1G and 2.5G speeds in D3.
+ */
+s32 e1000_set_d3_lplu_state_i225(struct e1000_hw *hw, bool active)
+{
+	u32 data;
+
+	DEBUGFUNC("e1000_set_d3_lplu_state_i225");
+
+	data = E1000_READ_REG(hw, E1000_I225_PHPM);
+
+	if (active) {
+		data |= E1000_I225_PHPM_DIS_100_D3;
+		data |= E1000_I225_PHPM_DIS_1000_D3;
+		data |= E1000_I225_PHPM_DIS_2500_D3;
+	} else {
+		data &= ~E1000_I225_PHPM_DIS_100_D3;
+		data &= ~E1000_I225_PHPM_DIS_1000_D3;
+		data &= ~E1000_I225_PHPM_DIS_2500_D3;
+	}
+
+	E1000_WRITE_REG(hw, E1000_I225_PHPM, data);
+	return E1000_SUCCESS;
+}