From patchwork Fri Apr 5 09:57:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karol Kolacinski X-Patchwork-Id: 13618802 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 906921649D1 for ; Fri, 5 Apr 2024 10:07:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712311632; cv=none; b=HdzqY5fvLWXW9lSH3AyRY9aAdxvOjrTYdHgihHag8QNgBTSM4ZxJtolCnevFVWyu4IwP7uDVyheqiqYT+sZTI0/5t1Usi44VAX3RnBJYkdTX6MJf44NO79SMY+vA2n5DgE8uCBuIoNqquSLrZ4KnvzQ0TurBQ194ZQstWXclamA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712311632; c=relaxed/simple; bh=EDP/v5xXtSkV1N6Kc62noURJd38e2/GkI2l5z25K0HY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UGo0ZgjePcbE75v7bIkuP5yGDtATAlNa0/GSY7ENnIDJvjr6wNZ9HQi0SDiAIeFP39wEh35ftS6G3EKVpvzRnalEY8uT83vLl9UKOugR+AIHY9jJ9jvbceUIjkxPA7Xst8RjbEDIaF8/R6wH/VSTrT66pQeU6rYOMYGdSH6H5V4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=MXD+Oh5b; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="MXD+Oh5b" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712311630; x=1743847630; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EDP/v5xXtSkV1N6Kc62noURJd38e2/GkI2l5z25K0HY=; b=MXD+Oh5bicp2mxOai2tYk/T+FNao6A+N8G30lM4KlvPobn9kEkVAr4M8 ddn4ikCsSBb6xoqZiKq9PrWkinnrEtLBZWd5HxA2PnRiisXGLhM9Nu8eu sZ6UHq/ewqg+AfYqE8Ql3sG50aCf6g2qDJuIivDKB/Th7uRXaZWAVOgEE HqAEA144LsaUkjw8HAXkBfcyt8D1tVix+nA0mcMg9V2dQtlguNUGySuCf dGgvA1Das4Zo6ZoPoWP9Uz6BqNzxsQWmM/BxjUeUXVPEbMkE3hfGGEY3Y 8dbv9JcIeMmHmXKcuN0dW/UZdqtY+1B3mv90I3+4pM2owN5JY+fj24J1u g==; X-CSE-ConnectionGUID: 8IiYfOGqRn2A1mPMIPeTRQ== X-CSE-MsgGUID: aw6LxGixRJmxao6Ega9z8Q== X-IronPort-AV: E=McAfee;i="6600,9927,11034"; a="7493986" X-IronPort-AV: E=Sophos;i="6.07,181,1708416000"; d="scan'208";a="7493986" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2024 03:07:10 -0700 X-CSE-ConnectionGUID: sMzQFFxjQ9CEeVSlqHDSCw== X-CSE-MsgGUID: 1ijfzKjQRy2wfAgtIvQIXA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,181,1708416000"; d="scan'208";a="19536220" Received: from kkolacin-desk1.igk.intel.com ([10.102.102.152]) by orviesa007.jf.intel.com with ESMTP; 05 Apr 2024 03:07:09 -0700 From: Karol Kolacinski To: intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, anthony.l.nguyen@intel.com, jesse.brandeburg@intel.com, Jacob Keller , Przemek Kitszel , Arkadiusz Kubalewski , Karol Kolacinski Subject: [PATCH v6 iwl-next 06/12] ice: Introduce ice_get_base_incval() helper Date: Fri, 5 Apr 2024 11:57:18 +0200 Message-ID: <20240405100648.144756-20-karol.kolacinski@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240405100648.144756-14-karol.kolacinski@intel.com> References: <20240405100648.144756-14-karol.kolacinski@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Jacob Keller Add a new helper for getting base clock increment value for specific HW. Signed-off-by: Jacob Keller Reviewed-by: Przemek Kitszel Reviewed-by: Arkadiusz Kubalewski Signed-off-by: Karol Kolacinski --- V4 -> V5: Removed unused UNKNOWN_INCVAL_E82X drivers/net/ethernet/intel/ice/ice_ptp.c | 9 +-------- drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c index 6899b331f322..824d3f17587c 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -7,8 +7,6 @@ #define E810_OUT_PROP_DELAY_NS 1 -#define UNKNOWN_INCVAL_E82X 0x100000000ULL - static const struct ptp_pin_desc ice_pin_desc_e810t[] = { /* name idx func chan */ { "GNSS", GNSS, PTP_PF_EXTTS, 0, { 0, } }, @@ -1210,12 +1208,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 48c0bc179110..f10ddf598f58 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