From patchwork Fri Mar 29 11:21:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karol Kolacinski X-Patchwork-Id: 1917813 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=lU2j2KNu; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V5dMr3TLZz1yYM for ; Fri, 29 Mar 2024 22:24:08 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 2D06882572; Fri, 29 Mar 2024 11:24:04 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id naehdjDq08eT; Fri, 29 Mar 2024 11:24:03 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 4E4D98258A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1711711442; bh=Xa4mNhwX4VpFt3HAFUtB0x2bUW1MXjI6J1/D4uXfbNg=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=lU2j2KNu1fxQusv5g1YGejaSPW3LwpScxisBvULjXOk7u85Kt+218/l26+FK0PCU9 YGaIAsdoCip2pNYFT44tmTV0JcRDtedZcPYZD6gN3L3RF/o78NCHdkMmPPYmromHxn CSKZ+YRiDLITQYhcQuJDFgjKydhXUGnrVrEfoWZcgyuocN/t2rWJlprA8Vc5TEK9qZ 5NPO9tRn/dE8V4Jic2gS5RV/BL44hnbk1zm/LBalkprphRrMXavHNukG0F/ImrP/di I/fiFchl7Or/ASROL5ZPUUzYFXRjURp1mhS3bLfUcBlfXZS8bSEaxwiz/fi6pxqYLY TcCcSX7K8CuIg== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id 4E4D98258A; Fri, 29 Mar 2024 11:24:02 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id C2B2A1BF298 for ; Fri, 29 Mar 2024 11:23:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id AD5656067C for ; Fri, 29 Mar 2024 11:23:58 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id HH6stDmWOKIZ for ; Fri, 29 Mar 2024 11:23:58 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.19; helo=mgamail.intel.com; envelope-from=karol.kolacinski@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org E7DCC60E6B DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org E7DCC60E6B Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by smtp3.osuosl.org (Postfix) with ESMTPS id E7DCC60E6B for ; Fri, 29 Mar 2024 11:23:57 +0000 (UTC) X-CSE-ConnectionGUID: 0zTd+oN1RnSjsMSfZDnhnA== X-CSE-MsgGUID: uevUdEyYSMeWHW/HWZKqJQ== X-IronPort-AV: E=McAfee;i="6600,9927,11027"; a="6755189" X-IronPort-AV: E=Sophos;i="6.07,164,1708416000"; d="scan'208";a="6755189" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2024 04:23:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,164,1708416000"; d="scan'208";a="16836719" Received: from kkolacin-desk1.igk.intel.com ([10.102.102.152]) by fmviesa010.fm.intel.com with ESMTP; 29 Mar 2024 04:23:56 -0700 From: Karol Kolacinski To: intel-wired-lan@lists.osuosl.org Date: Fri, 29 Mar 2024 12:21:50 +0100 Message-ID: <20240329112339.29642-20-karol.kolacinski@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240329112339.29642-14-karol.kolacinski@intel.com> References: <20240329112339.29642-14-karol.kolacinski@intel.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711711438; x=1743247438; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ERHAALLSA2vzNMYtvNj4cUg4n40CUGxACTCDlBu/TEw=; b=Wes5IGse5cyPycx5HRkaPDsMJTtJZfL4frtnUMY03n5Aj2zyTbTfw6rt o+nE6AhcQk8q9DS9R3pD65D5amOP1a7pX5Og/xEgVMY78ODt4wZ+yPRho uFD0uW0PF76XDhUntqWNSZ8ofBm8X13vTOgM291WbEYGY0ebVxlLTAnSi 1zNSvkyj44dLFuXzCcOAauly65zFL1D2CO6SyKieqBTAfQmMV0dImdN9A kVCs0gHmO/bVkHE+xiMqJwwSGxjEeaJDXxJ5OEBeVj45bNWwNOWD6zpMv bW+XpO5NchAFBYFwzVo7doGIGjs5t4NvysMp376Oeao0f6qKURAFat/pI w==; X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Wes5IGse Subject: [Intel-wired-lan] [PATCH v3 iwl-next 06/12] ice: Introduce ice_get_base_incval() helper X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, Arkadiusz Kubalewski , Karol Kolacinski , anthony.l.nguyen@intel.com, Przemek Kitszel , Jacob Keller Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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 --- 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; + 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