From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 8BA7D454EF;
	Tue, 25 Jun 2024 13:19:53 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 36F2942EE2;
	Tue, 25 Jun 2024 13:16:39 +0200 (CEST)
Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19])
 by mails.dpdk.org (Postfix) with ESMTP id 4BCE342E24
 for <dev@dpdk.org>; Tue, 25 Jun 2024 13:15:59 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
 t=1719314159; x=1750850159;
 h=from:to:cc:subject:date:message-id:in-reply-to:
 references:mime-version:content-transfer-encoding;
 bh=Yt/NdGYMkRunFk6YJmv3C8A3LarcqUAkL5Ifql1LrCE=;
 b=Z1NaooMdruo/zPb97fqfnkE53yIG28wFdX8KrGLllR0f4fo/Z4QQxWST
 uz5/B39JMfDqCJGyBJV4v9HWkNE58YhH9Kuw2K6Dwzuzug4ZcKRsR266K
 4usJ7Cu5dgI/RG9QR7qH9LeIL4Di+eRHREVs6z3HugNKrBM43Y2lGqdWn
 IUjEpK/cFrSjD8laS0D1zdQ8R1HJKmUJYhjLHiGe+0vIximTzeprrRrB2
 6lPNH8uNOn8cpJvVnrzS/oRBJV/E9sXUurAWk0xEPQiel09wC7qco4jEU
 YAiXBDsX0X26lVKZofzA8bckY7g4XO5CZUgQjstU1K+5Y56qm4tpzkSpi Q==;
X-CSE-ConnectionGUID: TLMZc2apQQWBQGzaKrILeg==
X-CSE-MsgGUID: dmtGxcMiSQywLA14P5oceQ==
X-IronPort-AV: E=McAfee;i="6700,10204,11113"; a="16080171"
X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="16080171"
Received: from orviesa009.jf.intel.com ([10.64.159.149])
 by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 25 Jun 2024 04:15:59 -0700
X-CSE-ConnectionGUID: lzggycGsQBiyUSjtkkfHkA==
X-CSE-MsgGUID: d6JjH6rGQ0q9bOUYS4ga5w==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="43719137"
Received: from unknown (HELO silpixa00401119.ir.intel.com) ([10.55.129.167])
 by orviesa009.jf.intel.com with ESMTP; 25 Jun 2024 04:15:58 -0700
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Cc: Yochai Hagvi <yochai.hagvi@intel.com>, bruce.richardson@intel.com,
 ian.stokes@intel.com
Subject: [PATCH v3 036/129] net/ice/base: add helper function for refsync
Date: Tue, 25 Jun 2024 12:12:41 +0100
Message-ID: <f663e122aaaac198b6188d08946b8d3894e22687.1719313663.git.anatoly.burakov@intel.com>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <cover.1719313663.git.anatoly.burakov@intel.com>
References: <cover.1718204528.git.anatoly.burakov@intel.com>
 <cover.1719313663.git.anatoly.burakov@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

From: Yochai Hagvi <yochai.hagvi@intel.com>

Add a helper function to determine whether a given pin of DPLL is capable for
refsync configuration.

Signed-off-by: Yochai Hagvi <yochai.hagvi@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
---
 drivers/net/ice/base/ice_ptp_hw.c | 16 ++++++++++++++++
 drivers/net/ice/base/ice_ptp_hw.h |  1 +
 2 files changed, 17 insertions(+)

diff --git a/drivers/net/ice/base/ice_ptp_hw.c b/drivers/net/ice/base/ice_ptp_hw.c
index 85c2cbb3ed..4168608225 100644
--- a/drivers/net/ice/base/ice_ptp_hw.c
+++ b/drivers/net/ice/base/ice_ptp_hw.c
@@ -5783,3 +5783,19 @@ int ice_ptp_init_phc(struct ice_hw *hw)
 
 	return status;
 }
+
+/**
+ * refsync_pin_id_valid
+ * @hw: pointer to the HW struct
+ * @id: pin index
+ *
+ * Checks whether DPLL's input pin can be configured to ref-sync pairing mode.
+ */
+bool refsync_pin_id_valid(struct ice_hw *hw, u8 id)
+{
+	/* refsync is allowed only on pins 1 or 5 for E810T */
+	if (ice_is_e810t(hw) && id != 1 && id != 5)
+		return false;
+
+	return true;
+}
diff --git a/drivers/net/ice/base/ice_ptp_hw.h b/drivers/net/ice/base/ice_ptp_hw.h
index 7095c20209..c8f0e57cf1 100644
--- a/drivers/net/ice/base/ice_ptp_hw.h
+++ b/drivers/net/ice/base/ice_ptp_hw.h
@@ -142,6 +142,7 @@ ice_read_phy_tstamp(struct ice_hw *hw, u8 block, u8 idx, u64 *tstamp);
 int
 ice_clear_phy_tstamp(struct ice_hw *hw, u8 block, u8 idx);
 int ice_ptp_init_phc(struct ice_hw *hw);
+bool refsync_pin_id_valid(struct ice_hw *hw, u8 id);
 
 /* E822 family functions */
 int
-- 
2.43.0