Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Neftin <sasha.neftin@intel.com>
To: intel-wired-lan@lists.osuosl.org
Cc: Sasha Neftin <sasha.neftin@intel.com>
Subject: [Intel-wired-lan] [PATCH iwl-net v1 1/1] e1000e: Correct the maximum frequency adjustment
Date: Sat,  9 Dec 2023 19:07:53 +0200	[thread overview]
Message-ID: <20231209170753.168989-1-sasha.neftin@intel.com> (raw)

The latest Intel platform used two clocks for 1588 time synchronization
dependent on the HW strap: 24 MHz and 38.4 MHz. The maximum possible
frequency adjustment, in parts per billion, calculated as follows:
max ppb = ((MAX_INCVAL – BASE_INCVAL)*1billion) / BASE_INCVAL.
Where MAX_INCVAL is TIMINCA resolution (2^24 -1) and BASE_INCVAL is
depends on the clock.
For 24 MHz the max ppb value should be 600,000,000 and for the 38.4MHz
the max ppb value is 230,000,000.

Reported-by: Trey Harrison <harrisondigitalmedia@gmail.com>
Fixes: d89777bf0e42 ("e1000e: add support for IEEE-1588 PTP")
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
---
 drivers/net/ethernet/intel/e1000e/ptp.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000e/ptp.c b/drivers/net/ethernet/intel/e1000e/ptp.c
index 02d871bc112a..792dfe602ca0 100644
--- a/drivers/net/ethernet/intel/e1000e/ptp.c
+++ b/drivers/net/ethernet/intel/e1000e/ptp.c
@@ -283,17 +283,24 @@ void e1000e_ptp_init(struct e1000_adapter *adapter)
 	case e1000_pch_lpt:
 	case e1000_pch_spt:
 	case e1000_pch_cnp:
+		if (hw->mac.type < e1000_pch_lpt ||
+		    (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI)) {
+			adapter->ptp_clock_info.max_adj = 24000000 - 1;
+			break;
+		}
+		fallthrough;
 	case e1000_pch_tgp:
 	case e1000_pch_adp:
 	case e1000_pch_mtp:
 	case e1000_pch_lnp:
 	case e1000_pch_ptp:
 	case e1000_pch_nvp:
-		if ((hw->mac.type < e1000_pch_lpt) ||
-		    (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI)) {
-			adapter->ptp_clock_info.max_adj = 24000000 - 1;
-			break;
-		}
+		if (hw->mac.type < e1000_pch_lpt ||
+		    (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI))
+			adapter->ptp_clock_info.max_adj = 600000000 - 1;
+		else
+			adapter->ptp_clock_info.max_adj = 230000000 - 1;
+		break;
 		fallthrough;
 	case e1000_82574:
 	case e1000_82583:
-- 
2.34.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

             reply	other threads:[~2023-12-09 17:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-09 17:07 Sasha Neftin [this message]
2023-12-12  2:23 ` [Intel-wired-lan] [PATCH iwl-net v1 1/1] e1000e: Correct the maximum frequency adjustment Jacob Keller

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=20231209170753.168989-1-sasha.neftin@intel.com \
    --to=sasha.neftin@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    /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