netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>,
	 Anthony Nguyen <anthony.l.nguyen@intel.com>,
	 netdev <netdev@vger.kernel.org>
Cc: Jacob Keller <jacob.e.keller@intel.com>,
	 Michal Kubiak <michal.kubiak@intel.com>,
	 Aleksandr Loktionov <aleksandr.loktionov@intel.com>,
	 Karol Kolacinski <karol.kolacinski@intel.com>,
	 Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	 Milena Olech <milena.olech@intel.com>,
	Paul Menzel <pmenzel@molgen.mpg.de>
Subject: [PATCH v4 14/15] ice: move TSPLL init calls to ice_ptp.c
Date: Thu, 01 May 2025 15:54:25 -0700	[thread overview]
Message-ID: <20250501-kk-tspll-improvements-alignment-v4-14-24c83d0ce7a8@intel.com> (raw)
In-Reply-To: <20250501-kk-tspll-improvements-alignment-v4-0-24c83d0ce7a8@intel.com>

From: Karol Kolacinski <karol.kolacinski@intel.com>

Initialize TSPLL after initializing PHC in ice_ptp.c instead of calling
for each product in PHC init in ice_ptp_hw.c.

Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
Reviewed-by: Milena Olech <milena.olech@intel.com>
Signed-off-by: Karol Kolacinski <karol.kolacinski@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_ptp.c    | 11 +++++++++++
 drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 22 +---------------------
 drivers/net/ethernet/intel/ice/ice_tspll.c  |  5 +++++
 3 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
index 083f50f827441792d3b7a838c3359e05d2bbdf7c..3278b96d8f01cdf783db495db167e44c13e8c8da 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -2891,6 +2891,10 @@ static int ice_ptp_rebuild_owner(struct ice_pf *pf)
 	if (err)
 		return err;
 
+	err = ice_tspll_init(hw);
+	if (err)
+		return err;
+
 	/* Acquire the global hardware lock */
 	if (!ice_ptp_lock(hw)) {
 		err = -EBUSY;
@@ -3058,6 +3062,13 @@ static int ice_ptp_init_owner(struct ice_pf *pf)
 		return err;
 	}
 
+	err = ice_tspll_init(hw);
+	if (err) {
+		dev_err(ice_pf_to_dev(pf), "Failed to initialize CGU, status %d\n",
+			err);
+		return err;
+	}
+
 	/* Acquire the global hardware lock */
 	if (!ice_ptp_lock(hw)) {
 		err = -EBUSY;
diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c
index 6da82025934cb709d06f12cc26f9b494c6f4d772..523f95271f353e72b72ac5ea0123869f2d387e98 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c
@@ -2115,20 +2115,6 @@ int ice_start_phy_timer_eth56g(struct ice_hw *hw, u8 port)
 	return 0;
 }
 
-/**
- * ice_ptp_init_phc_e825 - Perform E825 specific PHC initialization
- * @hw: pointer to HW struct
- *
- * Perform E825-specific PTP hardware clock initialization steps.
- *
- * Return: 0 on success, negative error code otherwise.
- */
-static int ice_ptp_init_phc_e825(struct ice_hw *hw)
-{
-	/* Initialize the Clock Generation Unit */
-	return ice_tspll_init(hw);
-}
-
 /**
  * ice_ptp_read_tx_hwtstamp_status_eth56g - Get TX timestamp status
  * @hw: pointer to the HW struct
@@ -2788,7 +2774,6 @@ static int ice_ptp_set_vernier_wl(struct ice_hw *hw)
  */
 static int ice_ptp_init_phc_e82x(struct ice_hw *hw)
 {
-	int err;
 	u32 val;
 
 	/* Enable reading switch and PHY registers over the sideband queue */
@@ -2798,11 +2783,6 @@ static int ice_ptp_init_phc_e82x(struct ice_hw *hw)
 	val |= (PF_SB_REM_DEV_CTL_SWITCH_READ | PF_SB_REM_DEV_CTL_PHY0);
 	wr32(hw, PF_SB_REM_DEV_CTL, val);
 
-	/* Initialize the Clock Generation Unit */
-	err = ice_tspll_init(hw);
-	if (err)
-		return err;
-
 	/* Set window length for all the ports */
 	return ice_ptp_set_vernier_wl(hw);
 }
@@ -5584,7 +5564,7 @@ int ice_ptp_init_phc(struct ice_hw *hw)
 	case ICE_MAC_GENERIC:
 		return ice_ptp_init_phc_e82x(hw);
 	case ICE_MAC_GENERIC_3K_E825:
-		return ice_ptp_init_phc_e825(hw);
+		return 0;
 	default:
 		return -EOPNOTSUPP;
 	}
diff --git a/drivers/net/ethernet/intel/ice/ice_tspll.c b/drivers/net/ethernet/intel/ice/ice_tspll.c
index 7b61e1afe8b43a24c77edf0a0590562fbfa0ce3e..8f125ea5a80f5d145a412eee55a148b3ae3f830d 100644
--- a/drivers/net/ethernet/intel/ice/ice_tspll.c
+++ b/drivers/net/ethernet/intel/ice/ice_tspll.c
@@ -484,6 +484,11 @@ int ice_tspll_init(struct ice_hw *hw)
 	enum ice_clk_src clk_src;
 	int err;
 
+	/* Only E822, E823 and E825 products support TSPLL */
+	if (hw->mac_type != ICE_MAC_GENERIC &&
+	    hw->mac_type != ICE_MAC_GENERIC_3K_E825)
+		return 0;
+
 	tspll_freq = (enum ice_tspll_freq)ts_info->time_ref;
 	clk_src = (enum ice_clk_src)ts_info->clk_src;
 	if (!ice_tspll_check_params(hw, tspll_freq, clk_src))

-- 
2.48.1.397.gec9d649cc640


  parent reply	other threads:[~2025-05-01 22:54 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-01 22:54 [PATCH v4 00/15] ice: Separate TSPLL from PTP and clean up Jacob Keller
2025-05-01 22:54 ` [PATCH v4 01/15] ice: move TSPLL functions to a separate file Jacob Keller
2025-05-22 14:13   ` [Intel-wired-lan] " Rinitha, SX
2025-05-01 22:54 ` [PATCH v4 02/15] ice: rename TSPLL and CGU functions and definitions Jacob Keller
2025-05-22 14:15   ` [Intel-wired-lan] " Rinitha, SX
2025-05-01 22:54 ` [PATCH v4 03/15] ice: fix E825-C TSPLL register definitions Jacob Keller
2025-05-22 14:18   ` [Intel-wired-lan] " Rinitha, SX
2025-05-01 22:54 ` [PATCH v4 04/15] ice: remove ice_tspll_params_e825 definitions Jacob Keller
2025-05-22 14:19   ` [Intel-wired-lan] " Rinitha, SX
2025-05-01 22:54 ` [PATCH v4 05/15] ice: use designated initializers for TSPLL consts Jacob Keller
2025-05-22 14:21   ` [Intel-wired-lan] " Rinitha, SX
2025-05-01 22:54 ` [PATCH v4 06/15] ice: add TSPLL log config helper Jacob Keller
2025-05-22 14:23   ` [Intel-wired-lan] " Rinitha, SX
2025-05-01 22:54 ` [PATCH v4 07/15] ice: add ICE_READ/WRITE_CGU_REG_OR_DIE helpers Jacob Keller
2025-05-22 14:24   ` [Intel-wired-lan] " Rinitha, SX
2025-05-01 22:54 ` [PATCH v4 08/15] ice: clear time_sync_en field for E825-C during reprogramming Jacob Keller
2025-05-22 14:27   ` [Intel-wired-lan] " Rinitha, SX
2025-05-01 22:54 ` [PATCH v4 09/15] ice: read TSPLL registers again before reporting status Jacob Keller
2025-05-22 14:28   ` [Intel-wired-lan] " Rinitha, SX
2025-05-01 22:54 ` [PATCH v4 10/15] ice: use bitfields instead of unions for CGU regs Jacob Keller
2025-05-22 14:30   ` [Intel-wired-lan] " Rinitha, SX
2025-05-01 22:54 ` [PATCH v4 11/15] ice: add multiple TSPLL helpers Jacob Keller
2025-05-22 14:32   ` [Intel-wired-lan] " Rinitha, SX
2025-05-01 22:54 ` [PATCH v4 12/15] ice: wait before enabling TSPLL Jacob Keller
2025-05-22 14:34   ` [Intel-wired-lan] " Rinitha, SX
2025-05-01 22:54 ` [PATCH v4 13/15] ice: fall back to TCXO on TSPLL lock fail Jacob Keller
2025-05-22 14:36   ` [Intel-wired-lan] " Rinitha, SX
2025-05-01 22:54 ` Jacob Keller [this message]
2025-05-22 14:38   ` [Intel-wired-lan] [PATCH v4 14/15] ice: move TSPLL init calls to ice_ptp.c Rinitha, SX
2025-05-01 22:54 ` [PATCH v4 15/15] ice: default to TIME_REF instead of TXCO on E825-C Jacob Keller
2025-05-22 14:40   ` [Intel-wired-lan] " Rinitha, SX

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=20250501-kk-tspll-improvements-alignment-v4-14-24c83d0ce7a8@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=aleksandr.loktionov@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=karol.kolacinski@intel.com \
    --cc=michal.kubiak@intel.com \
    --cc=milena.olech@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pmenzel@molgen.mpg.de \
    --cc=przemyslaw.kitszel@intel.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).