Commit 42d40bb2 authored by Jacob Keller's avatar Jacob Keller Committed by Tony Nguyen

ice: introduce ice_pf_src_tmr_owned

Add ice_pf_src_tmr_owned() macro to check the function capability bit
indicating if the current function owns the PTP hardware clock. This is
slightly shorter than the more verbose access via
hw.func_caps.ts_func_info.src_tmr_owned. Use this where possible rather
than open coding its equivalent.
Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 5a7cee1c
...@@ -196,6 +196,8 @@ ...@@ -196,6 +196,8 @@
#define ice_pf_to_dev(pf) (&((pf)->pdev->dev)) #define ice_pf_to_dev(pf) (&((pf)->pdev->dev))
#define ice_pf_src_tmr_owned(pf) ((pf)->hw.func_caps.ts_func_info.src_tmr_owned)
enum ice_feature { enum ice_feature {
ICE_F_DSCP, ICE_F_DSCP,
ICE_F_PHY_RCLK, ICE_F_PHY_RCLK,
......
...@@ -3992,7 +3992,7 @@ void ice_init_feature_support(struct ice_pf *pf) ...@@ -3992,7 +3992,7 @@ void ice_init_feature_support(struct ice_pf *pf)
if (ice_is_phy_rclk_present(&pf->hw)) if (ice_is_phy_rclk_present(&pf->hw))
ice_set_feature_support(pf, ICE_F_PHY_RCLK); ice_set_feature_support(pf, ICE_F_PHY_RCLK);
/* If we don't own the timer - don't enable other caps */ /* If we don't own the timer - don't enable other caps */
if (!pf->hw.func_caps.ts_func_info.src_tmr_owned) if (!ice_pf_src_tmr_owned(pf))
break; break;
if (ice_is_cgu_present(&pf->hw)) if (ice_is_cgu_present(&pf->hw))
ice_set_feature_support(pf, ICE_F_CGU); ice_set_feature_support(pf, ICE_F_CGU);
......
...@@ -3159,7 +3159,7 @@ static irqreturn_t ice_misc_intr(int __always_unused irq, void *data) ...@@ -3159,7 +3159,7 @@ static irqreturn_t ice_misc_intr(int __always_unused irq, void *data)
ena_mask &= ~PFINT_OICR_TSYN_EVNT_M; ena_mask &= ~PFINT_OICR_TSYN_EVNT_M;
if (hw->func_caps.ts_func_info.src_tmr_owned) { if (ice_pf_src_tmr_owned(pf)) {
/* Save EVENTs from GLTSYN register */ /* Save EVENTs from GLTSYN register */
pf->ptp.ext_ts_irq |= gltsyn_stat & pf->ptp.ext_ts_irq |= gltsyn_stat &
(GLTSYN_STAT_EVENT0_M | (GLTSYN_STAT_EVENT0_M |
......
...@@ -436,7 +436,7 @@ static void ice_clear_ptp_clock_index(struct ice_pf *pf) ...@@ -436,7 +436,7 @@ static void ice_clear_ptp_clock_index(struct ice_pf *pf)
int err; int err;
/* Do not clear the index if we don't own the timer */ /* Do not clear the index if we don't own the timer */
if (!hw->func_caps.ts_func_info.src_tmr_owned) if (!ice_pf_src_tmr_owned(pf))
return; return;
tmr_idx = hw->func_caps.ts_func_info.tmr_index_assoc; tmr_idx = hw->func_caps.ts_func_info.tmr_index_assoc;
...@@ -2499,7 +2499,7 @@ void ice_ptp_reset(struct ice_pf *pf) ...@@ -2499,7 +2499,7 @@ void ice_ptp_reset(struct ice_pf *pf)
if (test_bit(ICE_PFR_REQ, pf->state)) if (test_bit(ICE_PFR_REQ, pf->state))
goto pfr; goto pfr;
if (!hw->func_caps.ts_func_info.src_tmr_owned) if (!ice_pf_src_tmr_owned(pf))
goto reset_ts; goto reset_ts;
err = ice_ptp_init_phc(hw); err = ice_ptp_init_phc(hw);
...@@ -2751,7 +2751,7 @@ void ice_ptp_init(struct ice_pf *pf) ...@@ -2751,7 +2751,7 @@ void ice_ptp_init(struct ice_pf *pf)
/* If this function owns the clock hardware, it must allocate and /* If this function owns the clock hardware, it must allocate and
* configure the PTP clock device to represent it. * configure the PTP clock device to represent it.
*/ */
if (hw->func_caps.ts_func_info.src_tmr_owned) { if (ice_pf_src_tmr_owned(pf)) {
err = ice_ptp_init_owner(pf); err = ice_ptp_init_owner(pf);
if (err) if (err)
goto err; goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment