Skip to content

Commit

Permalink
ice: Add support for E825-C TS PLL handling
Browse files Browse the repository at this point in the history
The CGU layout of E825-C is a little different than E822/E823. Add
support the new hardware adding relevant functions.

Signed-off-by: Michal Michalik <michal.michalik@intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Signed-off-by: Karol Kolacinski <karol.kolacinski@intel.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://lore.kernel.org/r/20240528-next-2024-05-28-ptp-refactors-v1-9-c082739bb6f6@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Michal Michalik authored and Jakub Kicinski committed Jun 1, 2024
1 parent b390ecc commit 713dcad
Show file tree
Hide file tree
Showing 6 changed files with 429 additions and 19 deletions.
65 changes: 65 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_cgu_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ union nac_cgu_dword9 {
u32 val;
};

#define NAC_CGU_DWORD16_E825C 0x40
union nac_cgu_dword16_e825c {
struct {
u32 synce_remndr : 6;
u32 synce_phlmt_en : 1;
u32 misc13 : 17;
u32 tspll_ck_refclkfreq : 8;
};
u32 val;
};

#define NAC_CGU_DWORD19 0x4c
union nac_cgu_dword19 {
struct {
Expand Down Expand Up @@ -67,6 +78,22 @@ union nac_cgu_dword22 {
u32 val;
};

#define NAC_CGU_DWORD23_E825C 0x5C
union nac_cgu_dword23_e825c {
struct {
u32 cgupll_fbdiv_intgr : 10;
u32 ux56pll_fbdiv_intgr : 10;
u32 misc20 : 4;
u32 ts_pll_enable : 1;
u32 time_sync_tspll_align_sel : 1;
u32 ext_synce_sel : 1;
u32 ref1588_ck_div : 4;
u32 time_ref_sel : 1;

};
u32 val;
};

#define NAC_CGU_DWORD24 0x60
union nac_cgu_dword24 {
struct {
Expand Down Expand Up @@ -113,4 +140,42 @@ union tspll_ro_bwm_lf {
u32 val;
};

#define TSPLL_RO_LOCK_E825C 0x3f0
union tspll_ro_lock_e825c {
struct {
u32 bw_freqov_high_cri_7_0 : 8;
u32 bw_freqov_high_cri_9_8 : 2;
u32 reserved455 : 1;
u32 plllock_gain_tran_cri : 1;
u32 plllock_true_lock_cri : 1;
u32 pllunlock_flag_cri : 1;
u32 afcerr_cri : 1;
u32 afcdone_cri : 1;
u32 feedfwrdgain_cal_cri_7_0 : 8;
u32 reserved462 : 8;
};
u32 val;
};

#define TSPLL_BW_TDC_E825C 0x31c
union tspll_bw_tdc_e825c {
struct {
u32 i_tdc_offset_lock_1_0 : 2;
u32 i_bbthresh1_2_0 : 3;
u32 i_bbthresh2_2_0 : 3;
u32 i_tdcsel_1_0 : 2;
u32 i_tdcovccorr_en_h : 1;
u32 i_divretimeren : 1;
u32 i_bw_ampmeas_window : 1;
u32 i_bw_lowerbound_2_0 : 3;
u32 i_bw_upperbound_2_0 : 3;
u32 i_bw_mode_1_0 : 2;
u32 i_ft_mode_sel_2_0 : 3;
u32 i_bwphase_4_0 : 5;
u32 i_plllock_sel_1_0 : 2;
u32 i_afc_divratio : 1;
};
u32 val;
};

#endif /* _ICE_CGU_REGS_H_ */
9 changes: 7 additions & 2 deletions drivers/net/ethernet/intel/ice/ice_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2314,8 +2314,13 @@ ice_parse_1588_func_caps(struct ice_hw *hw, struct ice_hw_func_caps *func_p,
info->tmr_index_owned = ((number & ICE_TS_TMR_IDX_OWND_M) != 0);
info->tmr_index_assoc = ((number & ICE_TS_TMR_IDX_ASSOC_M) != 0);

info->clk_freq = FIELD_GET(ICE_TS_CLK_FREQ_M, number);
info->clk_src = ((number & ICE_TS_CLK_SRC_M) != 0);
if (!ice_is_e825c(hw)) {
info->clk_freq = FIELD_GET(ICE_TS_CLK_FREQ_M, number);
info->clk_src = ((number & ICE_TS_CLK_SRC_M) != 0);
} else {
info->clk_freq = ICE_TIME_REF_FREQ_156_250;
info->clk_src = ICE_CLK_SRC_TCXO;
}

if (info->clk_freq < NUM_ICE_TIME_REF_FREQ) {
info->time_ref = (enum ice_time_ref_freq)info->clk_freq;
Expand Down
87 changes: 87 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_ptp_consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,93 @@ const struct ice_cgu_pll_params_e82x e822_cgu_params[NUM_ICE_TIME_REF_FREQ] = {
},
};

const
struct ice_cgu_pll_params_e825c e825c_cgu_params[NUM_ICE_TIME_REF_FREQ] = {
/* ICE_TIME_REF_FREQ_25_000 -> 25 MHz */
{
/* tspll_ck_refclkfreq */
0x19,
/* tspll_ndivratio */
1,
/* tspll_fbdiv_intgr */
320,
/* tspll_fbdiv_frac */
0,
/* ref1588_ck_div */
0,
},

/* ICE_TIME_REF_FREQ_122_880 -> 122.88 MHz */
{
/* tspll_ck_refclkfreq */
0x29,
/* tspll_ndivratio */
3,
/* tspll_fbdiv_intgr */
195,
/* tspll_fbdiv_frac */
1342177280UL,
/* ref1588_ck_div */
0,
},

/* ICE_TIME_REF_FREQ_125_000 -> 125 MHz */
{
/* tspll_ck_refclkfreq */
0x3E,
/* tspll_ndivratio */
2,
/* tspll_fbdiv_intgr */
128,
/* tspll_fbdiv_frac */
0,
/* ref1588_ck_div */
0,
},

/* ICE_TIME_REF_FREQ_153_600 -> 153.6 MHz */
{
/* tspll_ck_refclkfreq */
0x33,
/* tspll_ndivratio */
3,
/* tspll_fbdiv_intgr */
156,
/* tspll_fbdiv_frac */
1073741824UL,
/* ref1588_ck_div */
0,
},

/* ICE_TIME_REF_FREQ_156_250 -> 156.25 MHz */
{
/* tspll_ck_refclkfreq */
0x1F,
/* tspll_ndivratio */
5,
/* tspll_fbdiv_intgr */
256,
/* tspll_fbdiv_frac */
0,
/* ref1588_ck_div */
0,
},

/* ICE_TIME_REF_FREQ_245_760 -> 245.76 MHz */
{
/* tspll_ck_refclkfreq */
0x52,
/* tspll_ndivratio */
3,
/* tspll_fbdiv_intgr */
97,
/* tspll_fbdiv_frac */
2818572288UL,
/* ref1588_ck_div */
0,
},
};

/* struct ice_vernier_info_e82x
*
* E822 hardware calibrates the delay of the timestamp indication from the
Expand Down
Loading

0 comments on commit 713dcad

Please sign in to comment.