]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ice: fix 'adjust' timer programming for E830 devices
authorGrzegorz Nitka <grzegorz.nitka@intel.com>
Fri, 17 Apr 2026 00:53:25 +0000 (17:53 -0700)
committerJakub Kicinski <kuba@kernel.org>
Sat, 18 Apr 2026 19:01:33 +0000 (12:01 -0700)
Fix incorrect 'adjust the timer' programming sequence for E830 devices
series. Only shadow registers GLTSYN_SHADJ were programmed in the
current implementation. According to the specification [1], write to
command GLTSYN_CMD register is also required with CMD field set to
"Adjust the Time" value, for the timer adjustment to take the effect.

The flow was broken for the adjustment less than S32_MAX/MIN range
(around +/- 2 seconds). For bigger adjustment, non-atomic programming
flow is used, involving set timer programming. Non-atomic flow is
implemented correctly.

Testing hints:
Run command:
phc_ctl /dev/ptpX get adj 2 get
Expected result:
Returned timestamps differ at least by 2 seconds

[1] IntelĀ® Ethernet Controller E830 Datasheet rev 1.3, chapter 9.7.5.4
https://cdrdv2.intel.com/v1/dl/getContent/787353?explicitVersion=true

Fixes: f00307522786 ("ice: Implement PTP support for E830 devices")
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Grzegorz Nitka <grzegorz.nitka@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Rinitha S <sx.rinitha@intel.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20260416-iwl-net-submission-2026-04-14-v2-1-686c33c9828d@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/intel/ice/ice_ptp_hw.c

index 61c0a0d93ea892a9747679c59f3642512f8544bc..5a5c511ccbb6e51e348cf924bffc4be28c245673 100644 (file)
@@ -5381,8 +5381,8 @@ int ice_ptp_write_incval_locked(struct ice_hw *hw, u64 incval)
  */
 int ice_ptp_adj_clock(struct ice_hw *hw, s32 adj)
 {
+       int err = 0;
        u8 tmr_idx;
-       int err;
 
        tmr_idx = hw->func_caps.ts_func_info.tmr_index_owned;
 
@@ -5399,8 +5399,8 @@ int ice_ptp_adj_clock(struct ice_hw *hw, s32 adj)
                err = ice_ptp_prep_phy_adj_e810(hw, adj);
                break;
        case ICE_MAC_E830:
-               /* E830 sync PHYs automatically after setting GLTSYN_SHADJ */
-               return 0;
+               /* E830 sync PHYs automatically after setting cmd register */
+               break;
        case ICE_MAC_GENERIC:
                err = ice_ptp_prep_phy_adj_e82x(hw, adj);
                break;