Message ID | 20240329161730.47777-20-karol.kolacinski@intel.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Introduce ETH56G PHY model for E825C products | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Guessing tree name failed - patch did not apply |
On 3/29/2024 9:09 AM, Karol Kolacinski wrote: > From: Jacob Keller <jacob.e.keller@intel.com> > > Add a new helper for getting base clock increment value for specific HW. > > Signed-off-by: Jacob Keller <jacob.e.keller@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> > --- > drivers/net/ethernet/intel/ice/ice_ptp.c | 7 +------ > drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 12 ++++++++++++ > 2 files changed, 13 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c > index 7980482bbf56..cd2dab7b4c44 100644 > --- a/drivers/net/ethernet/intel/ice/ice_ptp.c > +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c > @@ -1210,12 +1210,7 @@ static u64 ice_base_incval(struct ice_pf *pf) > struct ice_hw *hw = &pf->hw; > u64 incval; > > - if (ice_is_e810(hw)) > - incval = ICE_PTP_NOMINAL_INCVAL_E810; > - else if (ice_e82x_time_ref(hw) < NUM_ICE_TIME_REF_FREQ) > - incval = ice_e82x_nominal_incval(ice_e82x_time_ref(hw)); > - else > - incval = UNKNOWN_INCVAL_E82X; Unknown used to return a value: https://elixir.bootlin.com/linux/latest/source/drivers/net/ethernet/intel/ice/ice_ptp.c#L10 > + incval = ice_get_base_incval(hw); > > dev_dbg(ice_pf_to_dev(pf), "PTP: using base increment value of 0x%016llx\n", > incval); > diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.h b/drivers/net/ethernet/intel/ice/ice_ptp_hw.h > index 5223e17d2806..d477d334b1d8 100644 > --- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.h > +++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.h > @@ -285,6 +285,18 @@ int ice_get_cgu_rclk_pin_info(struct ice_hw *hw, u8 *base_idx, u8 *pin_num); > int ice_cgu_get_output_pin_state_caps(struct ice_hw *hw, u8 pin_id, > unsigned long *caps); > > +static inline u64 ice_get_base_incval(struct ice_hw *hw) > +{ > + switch (hw->ptp.phy_model) { > + case ICE_PHY_E810: > + return ICE_PTP_NOMINAL_INCVAL_E810; > + case ICE_PHY_E82X: > + return ice_e82x_nominal_incval(ice_e82x_time_ref(hw)); > + default: > + return 0; but now it's 0. Is this on purpose? If yes, it was the only usage of the UNKNOWN_INCVAL_E82X so it should be removed. > + } > +} > + > #define PFTSYN_SEM_BYTES 4 > > #define ICE_PTP_CLOCK_INDEX_0 0x00
diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c index 7980482bbf56..cd2dab7b4c44 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -1210,12 +1210,7 @@ static u64 ice_base_incval(struct ice_pf *pf) struct ice_hw *hw = &pf->hw; u64 incval; - if (ice_is_e810(hw)) - incval = ICE_PTP_NOMINAL_INCVAL_E810; - else if (ice_e82x_time_ref(hw) < NUM_ICE_TIME_REF_FREQ) - incval = ice_e82x_nominal_incval(ice_e82x_time_ref(hw)); - else - incval = UNKNOWN_INCVAL_E82X; + incval = ice_get_base_incval(hw); dev_dbg(ice_pf_to_dev(pf), "PTP: using base increment value of 0x%016llx\n", incval); diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.h b/drivers/net/ethernet/intel/ice/ice_ptp_hw.h index 5223e17d2806..d477d334b1d8 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.h +++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.h @@ -285,6 +285,18 @@ int ice_get_cgu_rclk_pin_info(struct ice_hw *hw, u8 *base_idx, u8 *pin_num); int ice_cgu_get_output_pin_state_caps(struct ice_hw *hw, u8 pin_id, unsigned long *caps); +static inline u64 ice_get_base_incval(struct ice_hw *hw) +{ + switch (hw->ptp.phy_model) { + case ICE_PHY_E810: + return ICE_PTP_NOMINAL_INCVAL_E810; + case ICE_PHY_E82X: + return ice_e82x_nominal_incval(ice_e82x_time_ref(hw)); + default: + return 0; + } +} + #define PFTSYN_SEM_BYTES 4 #define ICE_PTP_CLOCK_INDEX_0 0x00