Skip to content

Commit 88c360e

Browse files
jacob-kelleranguy11
authored andcommitted
ice: Support cross-timestamping for E823 devices
The E822 hardware has cross timestamping support using a device feature termed "Hammock Harbor" by the data sheet. This device feature is similar to PCIe PTM, and captures the Always Running Timer (ART) simultaneously with the PTP hardware clock time. This functionality also exists on E823 devices, but is not currently enabled. Rename the cross-timestamp functions to use the _e82x postfix, indicating that the support works across the E82x family of devices and not just the E822 hardware. The flow for capturing a cross-timestamp requires an additional step on E823 devices. The GLTSYN_CMD register must be programmed with the READ_TIME command. Otherwise, the cross timestamp will always report a value of zero for the PTP hardware clock time. To fix this, call ice_ptp_src_cmd() prior to initiating the cross timestamp logic. Once the cross timestamp has completed, call ice_ptp_src_cmd() with ICE_PTP_OP to ensure that the timer command registers are cleared. Co-developed-by: Sergey Temerkhanov <sergey.temerkhanov@intel.com> Signed-off-by: Sergey Temerkhanov <sergey.temerkhanov@intel.com> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent 097c317 commit 88c360e

3 files changed

Lines changed: 21 additions & 11 deletions

File tree

drivers/net/ethernet/intel/ice/ice_ptp.c

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,6 +1993,9 @@ ice_ptp_get_syncdevicetime(ktime_t *device,
19931993
return -EBUSY;
19941994
}
19951995

1996+
/* Program cmd to master timer */
1997+
ice_ptp_src_cmd(hw, ICE_PTP_READ_TIME);
1998+
19961999
/* Start the ART and device clock sync sequence */
19972000
hh_art_ctl = rd32(hw, GLHH_ART_CTL);
19982001
hh_art_ctl = hh_art_ctl | GLHH_ART_CTL_ACTIVE_M;
@@ -2022,6 +2025,10 @@ ice_ptp_get_syncdevicetime(ktime_t *device,
20222025
break;
20232026
}
20242027
}
2028+
2029+
/* Clear the master timer */
2030+
ice_ptp_src_cmd(hw, ICE_PTP_NOP);
2031+
20252032
/* Release HW lock */
20262033
hh_lock = rd32(hw, PFHH_SEM + (PFTSYN_SEM_BYTES * hw->pf_id));
20272034
hh_lock = hh_lock & ~PFHH_SEM_BUSY_M;
@@ -2034,22 +2041,22 @@ ice_ptp_get_syncdevicetime(ktime_t *device,
20342041
}
20352042

20362043
/**
2037-
* ice_ptp_getcrosststamp_e822 - Capture a device cross timestamp
2044+
* ice_ptp_getcrosststamp_e82x - Capture a device cross timestamp
20382045
* @info: the driver's PTP info structure
20392046
* @cts: The memory to fill the cross timestamp info
20402047
*
20412048
* Capture a cross timestamp between the ART and the device PTP hardware
20422049
* clock. Fill the cross timestamp information and report it back to the
20432050
* caller.
20442051
*
2045-
* This is only valid for E822 devices which have support for generating the
2046-
* cross timestamp via PCIe PTM.
2052+
* This is only valid for E822 and E823 devices which have support for
2053+
* generating the cross timestamp via PCIe PTM.
20472054
*
20482055
* In order to correctly correlate the ART timestamp back to the TSC time, the
20492056
* CPU must have X86_FEATURE_TSC_KNOWN_FREQ.
20502057
*/
20512058
static int
2052-
ice_ptp_getcrosststamp_e822(struct ptp_clock_info *info,
2059+
ice_ptp_getcrosststamp_e82x(struct ptp_clock_info *info,
20532060
struct system_device_crosststamp *cts)
20542061
{
20552062
struct ice_pf *pf = ptp_info_to_pf(info);
@@ -2283,22 +2290,22 @@ ice_ptp_setup_pins_e823(struct ice_pf *pf, struct ptp_clock_info *info)
22832290
}
22842291

22852292
/**
2286-
* ice_ptp_set_funcs_e822 - Set specialized functions for E822 support
2293+
* ice_ptp_set_funcs_e82x - Set specialized functions for E82x support
22872294
* @pf: Board private structure
22882295
* @info: PTP info to fill
22892296
*
2290-
* Assign functions to the PTP capabiltiies structure for E822 devices.
2297+
* Assign functions to the PTP capabiltiies structure for E82x devices.
22912298
* Functions which operate across all device families should be set directly
2292-
* in ice_ptp_set_caps. Only add functions here which are distinct for E822
2299+
* in ice_ptp_set_caps. Only add functions here which are distinct for E82x
22932300
* devices.
22942301
*/
22952302
static void
2296-
ice_ptp_set_funcs_e822(struct ice_pf *pf, struct ptp_clock_info *info)
2303+
ice_ptp_set_funcs_e82x(struct ice_pf *pf, struct ptp_clock_info *info)
22972304
{
22982305
#ifdef CONFIG_ICE_HWTS
22992306
if (boot_cpu_has(X86_FEATURE_ART) &&
23002307
boot_cpu_has(X86_FEATURE_TSC_KNOWN_FREQ))
2301-
info->getcrosststamp = ice_ptp_getcrosststamp_e822;
2308+
info->getcrosststamp = ice_ptp_getcrosststamp_e82x;
23022309
#endif /* CONFIG_ICE_HWTS */
23032310
}
23042311

@@ -2332,6 +2339,8 @@ ice_ptp_set_funcs_e810(struct ice_pf *pf, struct ptp_clock_info *info)
23322339
static void
23332340
ice_ptp_set_funcs_e823(struct ice_pf *pf, struct ptp_clock_info *info)
23342341
{
2342+
ice_ptp_set_funcs_e82x(pf, info);
2343+
23352344
info->enable = ice_ptp_gpio_enable_e823;
23362345
ice_ptp_setup_pins_e823(pf, info);
23372346
}
@@ -2359,7 +2368,7 @@ static void ice_ptp_set_caps(struct ice_pf *pf)
23592368
else if (ice_is_e823(&pf->hw))
23602369
ice_ptp_set_funcs_e823(pf, info);
23612370
else
2362-
ice_ptp_set_funcs_e822(pf, info);
2371+
ice_ptp_set_funcs_e82x(pf, info);
23632372
}
23642373

23652374
/**

drivers/net/ethernet/intel/ice/ice_ptp_hw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ static u64 ice_ptp_read_src_incval(struct ice_hw *hw)
233233
*
234234
* Prepare the source timer for an upcoming timer sync command.
235235
*/
236-
static void ice_ptp_src_cmd(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd)
236+
void ice_ptp_src_cmd(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd)
237237
{
238238
u32 cmd_val;
239239
u8 tmr_idx;

drivers/net/ethernet/intel/ice/ice_ptp_hw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ extern const struct ice_vernier_info_e822 e822_vernier[NUM_ICE_PTP_LNK_SPD];
203203
u8 ice_get_ptp_src_clock_index(struct ice_hw *hw);
204204
bool ice_ptp_lock(struct ice_hw *hw);
205205
void ice_ptp_unlock(struct ice_hw *hw);
206+
void ice_ptp_src_cmd(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd);
206207
int ice_ptp_init_time(struct ice_hw *hw, u64 time);
207208
int ice_ptp_write_incval(struct ice_hw *hw, u64 incval);
208209
int ice_ptp_write_incval_locked(struct ice_hw *hw, u64 incval);

0 commit comments

Comments
 (0)