DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shweta Choudaha <shweta.choudaha@gmail.com>
To: dev@dpdk.org
Cc: Shweta Choudaha <shweta.choudaha@att.com>
Subject: [dpdk-dev] [PATCH v3 2/2] net/ixgbe : backplane port MDIO support
Date: Tue, 23 Jan 2018 15:05:32 +0000	[thread overview]
Message-ID: <20180123150532.33912-2-shweta.choudaha@gmail.com> (raw)
In-Reply-To: <20180123150532.33912-1-shweta.choudaha@gmail.com>

From: Shweta Choudaha <shweta.choudaha@att.com>

Initialize and implement MDIO read/write functions
for backplane port (IXGBE_DEV_ID_X550EM_A_KR_L) to
enable read/write registers via MDIO

Signed-off-by: Shweta Choudaha <shweta.choudaha@att.com>
Reviewed-by: Chas Williams <chas3@att.com>
Reviewed-by: Luca Boccassi <bluca@debian.org>
---
 drivers/net/ixgbe/base/ixgbe_x550.c | 54 ++++++++++++++++++++++++++++++++++---
 1 file changed, 50 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index f7401c060..885eaccfe 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -613,18 +613,62 @@ s32 ixgbe_shutdown_fw_phy(struct ixgbe_hw *hw)
 	return ixgbe_fw_phy_activity(hw, FW_PHY_ACT_FORCE_LINK_DOWN, &setup);
 }
 
+/**
+ *  ixgbe_read_phy_reg_x550em - Reads specified PHY register
+ *  @hw: pointer to hardware structure
+ *  @reg_addr: 32 bit address of PHY register to read
+ *  @device_type: 5 bit device type
+ *  @phy_data: Pointer to read data from PHY register
+ *
+ *  Reads a value from a specified PHY register using the SWFW lock and PHY
+ *  Token. The PHY Token is needed since the MDIO can be shared between MAC
+ *  instances.
+ **/
 STATIC s32 ixgbe_read_phy_reg_x550em(struct ixgbe_hw *hw, u32 reg_addr,
 				     u32 device_type, u16 *phy_data)
 {
-	UNREFERENCED_4PARAMETER(*hw, reg_addr, device_type, *phy_data);
-	return IXGBE_NOT_IMPLEMENTED;
+	s32 status;
+	u32 mask = hw->phy.phy_semaphore_mask | IXGBE_GSSR_TOKEN_SM;
+
+	DEBUGFUNC("ixgbe_read_phy_reg_x550em");
+
+	if (hw->mac.ops.acquire_swfw_sync(hw, mask))
+		return IXGBE_ERR_SWFW_SYNC;
+
+	status = hw->phy.ops.read_reg_mdi(hw, reg_addr, device_type, phy_data);
+
+	hw->mac.ops.release_swfw_sync(hw, mask);
+
+	return status;
 }
 
+/**
+ *  ixgbe_write_phy_reg_x550em- Writes specified PHY register
+ *  @hw: pointer to hardware structure
+ *  @reg_addr: 32 bit PHY register to write
+ *  @device_type: 5 bit device type
+ *  @phy_data: Data to write to the PHY register
+ *
+ *  Writes a value to specified PHY register using the SWFW lock and PHY Token.
+ *  The PHY Token is needed since the MDIO can be shared between MAC instances.
+ **/
 STATIC s32 ixgbe_write_phy_reg_x550em(struct ixgbe_hw *hw, u32 reg_addr,
 				      u32 device_type, u16 phy_data)
 {
-	UNREFERENCED_4PARAMETER(*hw, reg_addr, device_type, phy_data);
-	return IXGBE_NOT_IMPLEMENTED;
+	s32 status;
+	u32 mask = hw->phy.phy_semaphore_mask | IXGBE_GSSR_TOKEN_SM;
+
+	DEBUGFUNC("ixgbe_write_phy_reg_x550em");
+
+	if (hw->mac.ops.acquire_swfw_sync(hw, mask) == IXGBE_SUCCESS) {
+		status = hw->phy.ops.write_reg_mdi(hw, reg_addr, device_type,
+						 phy_data);
+		hw->mac.ops.release_swfw_sync(hw, mask);
+	} else {
+		status = IXGBE_ERR_SWFW_SYNC;
+	}
+
+	return status;
 }
 
 /**
@@ -2423,6 +2467,8 @@ s32 ixgbe_init_phy_ops_X550em(struct ixgbe_hw *hw)
 		phy->ops.write_reg = ixgbe_write_phy_reg_x550em;
 		break;
 	case ixgbe_phy_x550em_kr:
+		phy->ops.read_reg_mdi = ixgbe_read_phy_reg_mdi_22;
+		phy->ops.write_reg_mdi = ixgbe_write_phy_reg_mdi_22;
 		phy->ops.setup_link = ixgbe_setup_kr_x550em;
 		phy->ops.read_reg = ixgbe_read_phy_reg_x550em;
 		phy->ops.write_reg = ixgbe_write_phy_reg_x550em;
-- 
2.11.0

      reply	other threads:[~2018-01-23 15:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-06 13:42 [dpdk-dev] [PATCH 1/2] net/ixgbe: add and export MDIO APIs Shweta Choudaha
2017-11-06 14:25 ` [dpdk-dev] [PATCH v2 " Shweta Choudaha
2017-11-06 14:25   ` [dpdk-dev] [PATCH v2 2/2] net/ixgbe : backplane port MDIO support Shweta Choudaha
2017-12-21  3:23     ` Zhang, Helin
2018-01-10  3:17     ` Zhang, Helin
2018-01-23 14:14       ` Shweta Choudaha
2017-12-21  3:25   ` [dpdk-dev] [PATCH v2 1/2] net/ixgbe: add and export MDIO APIs Zhang, Helin
2018-01-23 15:12     ` Shweta Choudaha
2018-01-23 15:05   ` [dpdk-dev] [PATCH v3 " Shweta Choudaha
2018-01-23 15:05     ` Shweta Choudaha [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180123150532.33912-2-shweta.choudaha@gmail.com \
    --to=shweta.choudaha@gmail.com \
    --cc=dev@dpdk.org \
    --cc=shweta.choudaha@att.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).