Skip to content

Commit 5a4f45c

Browse files
stemerkanguy11
authored andcommitted
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 <[email protected]> Signed-off-by: Sergey Temerkhanov <[email protected]> Co-developed-by: Karol Kolacinski <[email protected]> Signed-off-by: Karol Kolacinski <[email protected]> Reviewed-by: Simon Horman <[email protected]> Tested-by: Pucha Himasekhar Reddy <[email protected]> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <[email protected]>
1 parent ebb2693 commit 5a4f45c

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",
@@ -1699,6 +1700,15 @@ static int ice_ptp_write_perout(struct ice_hw *hw, unsigned int chan,
16991700
/* 0. Reset mode & out_en in AUX_OUT */
17001701
wr32(hw, GLTSYN_AUX_OUT(chan, tmr_idx), 0);
17011702

1703+
if (ice_is_e825c(hw)) {
1704+
int err;
1705+
1706+
/* Enable/disable CGU 1PPS output for E825C */
1707+
err = ice_cgu_cfg_pps_out(hw, !!period);
1708+
if (err)
1709+
return err;
1710+
}
1711+
17021712
/* 1. Write perout with half of required period value.
17031713
* HW toggles output when source clock hits the TGT and then adds
17041714
* 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
@@ -661,6 +661,29 @@ static int ice_cfg_cgu_pll_e825c(struct ice_hw *hw,
661661
return 0;
662662
}
663663

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