From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 63071A0523; Thu, 2 Jul 2020 05:32:23 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0968E1D650; Thu, 2 Jul 2020 05:31:04 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id A90B51D635 for ; Thu, 2 Jul 2020 05:31:01 +0200 (CEST) IronPort-SDR: Ml5YYSEYuDWWk4H/X0FdcAWk3h+mY1zG528TZe4DdfeZ1W/Et34U7UZiZGqFRnvUkgptpi5Iet 2HtxqPh/E3cQ== X-IronPort-AV: E=McAfee;i="6000,8403,9669"; a="144300648" X-IronPort-AV: E=Sophos;i="5.75,302,1589266800"; d="scan'208";a="144300648" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2020 20:31:00 -0700 IronPort-SDR: amdEmfbdz2GUUL0fKIdaM2Ev5SMOta3KGV22EQ9ze3vfI5DEbQtxJygYw0B67ELjt7C0Svgzg/ kT8yOUGHddMg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,302,1589266800"; d="scan'208";a="295751562" Received: from intel.sh.intel.com ([10.239.255.18]) by orsmga002.jf.intel.com with ESMTP; 01 Jul 2020 20:30:58 -0700 From: Guinan Sun To: dev@dpdk.org Cc: Jeff Guo , Zhao1 Wei , Guinan Sun , Jakub Chylkowski Date: Thu, 2 Jul 2020 03:13:20 +0000 Message-Id: <20200702031329.4495-12-guinanx.sun@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200702031329.4495-1-guinanx.sun@intel.com> References: <20200612032410.20864-1-guinanx.sun@intel.com> <20200702031329.4495-1-guinanx.sun@intel.com> Subject: [dpdk-dev] [PATCH v2 11/20] net/ixgbe/base: create dedicated func to restart auto nego X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch is for restarting auto negotiation on PHY. Signed-off-by: Jakub Chylkowski Signed-off-by: Guinan Sun --- drivers/net/ixgbe/base/ixgbe_phy.c | 48 ++++++++++++++---------------- drivers/net/ixgbe/base/ixgbe_phy.h | 1 + 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/drivers/net/ixgbe/base/ixgbe_phy.c b/drivers/net/ixgbe/base/ixgbe_phy.c index 823cf161e..620154a41 100644 --- a/drivers/net/ixgbe/base/ixgbe_phy.c +++ b/drivers/net/ixgbe/base/ixgbe_phy.c @@ -542,6 +542,26 @@ s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw) return status; } +/** + * ixgbe_restart_auto_neg - Restart auto negotiation on the PHY + * @hw: pointer to hardware structure + **/ +void ixgbe_restart_auto_neg(struct ixgbe_hw *hw) +{ + u16 autoneg_reg; + + /* Check if PHY reset is blocked by MNG FW */ + if (ixgbe_check_reset_blocked(hw)) + return; + + /* Restart PHY auto-negotiation. */ + hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, + IXGBE_MDIO_AUTO_NEG_DEV_TYPE, &autoneg_reg); + autoneg_reg |= IXGBE_MII_RESTART; + hw->phy.ops.write_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, + IXGBE_MDIO_AUTO_NEG_DEV_TYPE, autoneg_reg); +} + /** * ixgbe_read_phy_mdi - Reads a value from a specified PHY register without * the SWFW lock @@ -826,19 +846,7 @@ s32 ixgbe_setup_phy_link_generic(struct ixgbe_hw *hw) IXGBE_MDIO_AUTO_NEG_DEV_TYPE, autoneg_reg); - /* Blocked by MNG FW so don't reset PHY */ - if (ixgbe_check_reset_blocked(hw)) - return status; - - /* Restart PHY auto-negotiation. */ - hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, - IXGBE_MDIO_AUTO_NEG_DEV_TYPE, &autoneg_reg); - - autoneg_reg |= IXGBE_MII_RESTART; - - hw->phy.ops.write_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, - IXGBE_MDIO_AUTO_NEG_DEV_TYPE, autoneg_reg); - + ixgbe_restart_auto_neg(hw); return status; } @@ -1062,19 +1070,7 @@ s32 ixgbe_setup_phy_link_tnx(struct ixgbe_hw *hw) autoneg_reg); } - /* Blocked by MNG FW so don't reset PHY */ - if (ixgbe_check_reset_blocked(hw)) - return status; - - /* Restart PHY auto-negotiation. */ - hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, - IXGBE_MDIO_AUTO_NEG_DEV_TYPE, &autoneg_reg); - - autoneg_reg |= IXGBE_MII_RESTART; - - hw->phy.ops.write_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, - IXGBE_MDIO_AUTO_NEG_DEV_TYPE, autoneg_reg); - + ixgbe_restart_auto_neg(hw); return status; } diff --git a/drivers/net/ixgbe/base/ixgbe_phy.h b/drivers/net/ixgbe/base/ixgbe_phy.h index a06c3be17..e28c52a7b 100644 --- a/drivers/net/ixgbe/base/ixgbe_phy.h +++ b/drivers/net/ixgbe/base/ixgbe_phy.h @@ -133,6 +133,7 @@ enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id); s32 ixgbe_get_phy_id(struct ixgbe_hw *hw); s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw); s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw); +void ixgbe_restart_auto_neg(struct ixgbe_hw *hw); s32 ixgbe_read_phy_reg_mdi(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type, u16 *phy_data); s32 ixgbe_write_phy_reg_mdi(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type, -- 2.17.1