Skip to content

Commit 88269ec

Browse files
committed
ice: Enable 1PPS out from CGU for E825C products
JIRA: https://issues.redhat.com/browse/RHEL-29207 Upstream commit(s): commit 5a4f45c Author: Sergey Temerkhanov <sergey.temerkhanov@intel.com> Date: Fri Aug 30 13:07:23 2024 +0200 ice: Enable 1PPS out from CGU for E825C products Implement configuring 1PPS signal output from CGU. Use maximal amplitude because Linux PTP pin API does not have any way for user to set signal level. This change is necessary for E825C products to properly output any signal from 1PPS pin. Reviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com> Signed-off-by: Sergey Temerkhanov <sergey.temerkhanov@intel.com> Co-developed-by: Karol Kolacinski <karol.kolacinski@intel.com> Signed-off-by: Karol Kolacinski <karol.kolacinski@intel.com> Reviewed-by: Simon Horman <horms@kernel.org> 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> Signed-off-by: Petr Oros <poros@redhat.com>
1 parent 14304d3 commit 88269ec

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "ice.h"
55
#include "ice_lib.h"
66
#include "ice_trace.h"
7+
#include "ice_cgu_regs.h"
78

89
static const char ice_pin_names[][64] = {
910
"SDP0",
@@ -1717,6 +1718,15 @@ static int ice_ptp_write_perout(struct ice_hw *hw, unsigned int chan,
17171718
/* 0. Reset mode & out_en in AUX_OUT */
17181719
wr32(hw, GLTSYN_AUX_OUT(chan, tmr_idx), 0);
17191720

1721+
if (ice_is_e825c(hw)) {
1722+
int err;
1723+
1724+
/* Enable/disable CGU 1PPS output for E825C */
1725+
err = ice_cgu_cfg_pps_out(hw, !!period);
1726+
if (err)
1727+
return err;
1728+
}
1729+
17201730
/* 1. Write perout with half of required period value.
17211731
* HW toggles output when source clock hits the TGT and then adds
17221732
* GLTSYN_CLKO value to the target, so it ends up with 50% duty cycle.

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,29 @@ static int ice_cfg_cgu_pll_e825c(struct ice_hw *hw,
659659
return 0;
660660
}
661661

662+
#define ICE_ONE_PPS_OUT_AMP_MAX 3
663+
664+
/**
665+
* ice_cgu_cfg_pps_out - Configure 1PPS output from CGU
666+
* @hw: pointer to the HW struct
667+
* @enable: true to enable 1PPS output, false to disable it
668+
*
669+
* Return: 0 on success, other negative error code when CGU read/write failed
670+
*/
671+
int ice_cgu_cfg_pps_out(struct ice_hw *hw, bool enable)
672+
{
673+
union nac_cgu_dword9 dw9;
674+
int err;
675+
676+
err = ice_read_cgu_reg_e82x(hw, NAC_CGU_DWORD9, &dw9.val);
677+
if (err)
678+
return err;
679+
680+
dw9.one_pps_out_en = enable;
681+
dw9.one_pps_out_amp = enable * ICE_ONE_PPS_OUT_AMP_MAX;
682+
return ice_write_cgu_reg_e82x(hw, NAC_CGU_DWORD9, dw9.val);
683+
}
684+
662685
/**
663686
* ice_cfg_cgu_pll_dis_sticky_bits_e82x - disable TS PLL sticky bits
664687
* @hw: pointer to the HW struct

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ extern const struct ice_vernier_info_e82x e822_vernier[NUM_ICE_PTP_LNK_SPD];
331331

332332
/* Device agnostic functions */
333333
u8 ice_get_ptp_src_clock_index(struct ice_hw *hw);
334+
int ice_cgu_cfg_pps_out(struct ice_hw *hw, bool enable);
334335
bool ice_ptp_lock(struct ice_hw *hw);
335336
void ice_ptp_unlock(struct ice_hw *hw);
336337
void ice_ptp_src_cmd(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd);

0 commit comments

Comments
 (0)