diff mbox series

[15/70] net/e1000/base: setup copper link function for i225

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

Checks

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

Commit Message

Guinan Sun June 22, 2020, 6:45 a.m. UTC
A dedicated function for i225 that Configures the link for auto-neg
or forced speed and duplex. It was taken from the
e1000_setup_copper_link_82575 function in e1000_82575 file and was
refactored for i225 only.

Signed-off-by: Dany Trakhtenberg <Dany.Trakhtenberg@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
---
 drivers/net/e1000/base/e1000_i225.c | 30 +++++++++++++++++++++++++++++
 drivers/net/e1000/base/e1000_phy.h  | 13 +++++++++++++
 2 files changed, 43 insertions(+)

Comments

Zhao1, Wei June 23, 2020, 2:22 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>; Trakhtenberg, Dany
> <dany.trakhtenberg@intel.com>
> Subject: [PATCH 15/70] net/e1000/base: setup copper link function for i225
> 
> A dedicated function for i225 that Configures the link for auto-neg or forced
> speed and duplex. It was taken from the
> e1000_setup_copper_link_82575 function in e1000_82575 file and was
> refactored for i225 only.
> 
> Signed-off-by: Dany Trakhtenberg <Dany.Trakhtenberg@intel.com>
> Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> ---
>  drivers/net/e1000/base/e1000_i225.c | 30
> +++++++++++++++++++++++++++++  drivers/net/e1000/base/e1000_phy.h
> | 13 +++++++++++++
>  2 files changed, 43 insertions(+)
> 
> diff --git a/drivers/net/e1000/base/e1000_i225.c
> b/drivers/net/e1000/base/e1000_i225.c
> index 4ba6c45be..621dc6863 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


> @@ -124,6 +124,36 @@ void e1000_release_swfw_sync_i225(struct
> e1000_hw *hw, u16 mask)
>  	e1000_put_hw_semaphore_generic(hw);
>  }
> 
> +/*
> + * e1000_setup_copper_link_i225 - Configure copper link settings
> + * @hw: pointer to the HW structure
> + *
> + * Configures the link for auto-neg or forced speed and duplex.  Then
> +we check
> + * for link, once link is established calls to configure collision
> +distance
> + * and flow control are called.
> + */
> +s32 e1000_setup_copper_link_i225(struct e1000_hw *hw) {
> +	u32 phpm_reg;
> +
diff mbox series

Patch

diff --git a/drivers/net/e1000/base/e1000_i225.c b/drivers/net/e1000/base/e1000_i225.c
index 4ba6c45be..621dc6863 100644
--- a/drivers/net/e1000/base/e1000_i225.c
+++ b/drivers/net/e1000/base/e1000_i225.c
@@ -124,6 +124,36 @@  void e1000_release_swfw_sync_i225(struct e1000_hw *hw, u16 mask)
 	e1000_put_hw_semaphore_generic(hw);
 }
 
+/*
+ * e1000_setup_copper_link_i225 - Configure copper link settings
+ * @hw: pointer to the HW structure
+ *
+ * Configures the link for auto-neg or forced speed and duplex.  Then we check
+ * for link, once link is established calls to configure collision distance
+ * and flow control are called.
+ */
+s32 e1000_setup_copper_link_i225(struct e1000_hw *hw)
+{
+	u32 phpm_reg;
+	s32 ret_val;
+	u32 ctrl;
+
+	DEBUGFUNC("e1000_setup_copper_link_i225");
+
+	ctrl = E1000_READ_REG(hw, E1000_CTRL);
+	ctrl |= E1000_CTRL_SLU;
+	ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX);
+	E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
+
+	phpm_reg = E1000_READ_REG(hw, E1000_I225_PHPM);
+	phpm_reg &= ~E1000_I225_PHPM_GO_LINKD;
+	E1000_WRITE_REG(hw, E1000_I225_PHPM, phpm_reg);
+
+	ret_val = e1000_setup_copper_link_generic(hw);
+
+	return ret_val;
+}
+
 /* e1000_get_hw_semaphore_i225 - Acquire hardware semaphore
  * @hw: pointer to the HW structure
  *
diff --git a/drivers/net/e1000/base/e1000_phy.h b/drivers/net/e1000/base/e1000_phy.h
index 32e9d2620..3321bc0ba 100644
--- a/drivers/net/e1000/base/e1000_phy.h
+++ b/drivers/net/e1000/base/e1000_phy.h
@@ -122,6 +122,19 @@  s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr,
 #define GS40G_MAC_SPEED_1G		0X0006
 #define GS40G_COPPER_SPEC		0x0010
 
+#endif /* NO_I210_SUPPORT */
+#ifndef NO_I225_SUPPORT
+#define E1000_I225_PHPM			0x0E14 /* I225 PHY Power Management */
+#define E1000_I225_PHPM_DIS_1000_D3	0x0008 /* Disable 1G in D3 */
+#define E1000_I225_PHPM_LINK_ENERGY	0x0010 /* Link Energy Detect */
+#define E1000_I225_PHPM_GO_LINKD	0x0020 /* Go Link Disconnect */
+#define E1000_I225_PHPM_DIS_1000	0x0040 /* Disable 1G globally */
+#define E1000_I225_PHPM_SPD_B2B_EN	0x0080 /* Smart Power Down Back2Back */
+#define E1000_I225_PHPM_RST_COMPL	0x0100 /* PHY Reset Completed */
+#define E1000_I225_PHPM_DIS_100_D3	0x0200 /* Disable 100M in D3 */
+#define E1000_I225_PHPM_ULP		0x0400 /* Ultra Low-Power Mode */
+#define E1000_I225_PHPM_DIS_2500	0x0800 /* Disable 2.5G globally */
+#define E1000_I225_PHPM_DIS_2500_D3	0x1000 /* Disable 2.5G in D3 */
 /* GPY211 - I225 defines */
 #define GPY_MMD_MASK			0xFFFF0000
 #define GPY_MMD_SHIFT			16