From patchwork Fri Mar 29 16:09:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karol Kolacinski X-Patchwork-Id: 13610761 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (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 B95891311AC for ; Fri, 29 Mar 2024 16:18:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711729084; cv=none; b=Zf8yiGDeXR/yCP5au9QnbtnJ/HK+lc7+ynZpJ40iPV0uf+3sI+3zCAhP2ouukI1rHIon91ZH3R8YIKxQM3yvkIWUWkAQS5VK8Pw0XCHifF/g/trX2ImStZ2au4ZE4O6LDiJs0ZeSOrG5av6x4wZiaZmD1rPF91Q6tQqNdsKrI/U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711729084; c=relaxed/simple; bh=pmFmhALLZkhhSHkeUPHUUHTJY/9z2ETxafLz2EY1fmM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AQPqYemrvH4I35mwk3Uc+lAaE8pjywNpFnKcxk+8Es8DyO8KifHEagpPOgOYgxqeR6dR5HIPT1wNcVI22wNyJCcRC3HXNeu4XDD/AD7MJfvtT5Bvp76arLzJ6EHc5jN8Gdvq0U2nuY2dF7SFbDb99oXkS61zP5L9RDGE6I6fMAg= 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=noPZ7AFD; arc=none smtp.client-ip=198.175.65.16 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="noPZ7AFD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711729083; x=1743265083; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pmFmhALLZkhhSHkeUPHUUHTJY/9z2ETxafLz2EY1fmM=; b=noPZ7AFDcNU78X73jft0m+SXj+ttY1AXHdNO9c2R6Zhi3AsBByjelhfk 9QzgwoHjeLsgSq6LeWR0jEPedvK+ZujNPE6xniJloZMJwrz7kn52riytS QYFThZBD41aoui8bMXtY1u6+W0pFRTsj08fqo8geMjBn13A6mpbondGUC oZRkSlXol7L6B2ntrZkXzXDWk8A0Asse2MADOjoVvjOiBUzajimFVO2Ep HM+bTEF3Piv90Ex8Jtmc7WfOh4xjj0PVtZUdeZYTuKkBtFgvUoEgxPBKM BzL7DzgtQIqavjzc+z5XPlTOu64RNXjdacKRYxRA+2GrsC47Sq+L08x6d g==; X-CSE-ConnectionGUID: yCBkWU/GR5qbaF4vYhbCEg== X-CSE-MsgGUID: VUUc8HjQQJmLgS67Q5s/0Q== X-IronPort-AV: E=McAfee;i="6600,9927,11028"; a="7038377" X-IronPort-AV: E=Sophos;i="6.07,165,1708416000"; d="scan'208";a="7038377" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2024 09:18:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,165,1708416000"; d="scan'208";a="21474707" Received: from kkolacin-desk1.igk.intel.com ([10.102.102.152]) by fmviesa005.fm.intel.com with ESMTP; 29 Mar 2024 09:18:01 -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, Grzegorz Nitka , Arkadiusz Kubalewski , Karol Kolacinski Subject: [PATCH v4 iwl-next 12/12] ice: Adjust PTP init for 2x50G E825C devices Date: Fri, 29 Mar 2024 17:09:51 +0100 Message-ID: <20240329161730.47777-26-karol.kolacinski@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240329161730.47777-14-karol.kolacinski@intel.com> References: <20240329161730.47777-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: Grzegorz Nitka >From FW/HW perspective, 2 port topology in E825C devices requires merging of 2 port mapping internally to CPK and breakout mapping externally to CPK. As a consequence, it requires different port numbering from PTP code perspective. For that topology, pf_id can not be used to index PTP ports. Even if the 2nd port is identified as port with pf_id = 1, all PHY operations need to be performed as it was port 2. Thus, special mapping is needed for the 2nd port. This change adds detection of 2x50G topology and applies 'custom' mapping on the 2nd port. Signed-off-by: Grzegorz Nitka Reviewed-by: Arkadiusz Kubalewski Signed-off-by: Karol Kolacinski --- .../net/ethernet/intel/ice/ice_hw_autogen.h | 4 ++++ drivers/net/ethernet/intel/ice/ice_ptp.c | 5 ++++ drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 23 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_type.h | 9 ++++++++ 4 files changed, 41 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h index cfac1d432c15..26260eed852d 100644 --- a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h +++ b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h @@ -157,6 +157,8 @@ #define GLGEN_RTRIG_CORER_M BIT(0) #define GLGEN_RTRIG_GLOBR_M BIT(1) #define GLGEN_STAT 0x000B612C +#define GLGEN_SWITCH_MODE_CONFIG 0x000B81E0 +#define GLGEN_SWITCH_MODE_CONFIG_SELECT_25X4_ON_SINGLE_QUAD_M BIT(2) #define GLGEN_VFLRSTAT(_i) (0x00093A04 + ((_i) * 4)) #define PFGEN_CTRL 0x00091000 #define PFGEN_CTRL_PFSWR_M BIT(0) @@ -177,6 +179,8 @@ #define GLINT_CTL_ITR_GRAN_50_M ICE_M(0xF, 24) #define GLINT_CTL_ITR_GRAN_25_S 28 #define GLINT_CTL_ITR_GRAN_25_M ICE_M(0xF, 28) +#define GLGEN_MAC_LINK_TOPO 0x000B81DC +#define GLGEN_MAC_LINK_TOPO_LINK_TOPO_M GENMASK(1, 0) #define GLINT_DYN_CTL(_INT) (0x00160000 + ((_INT) * 4)) #define GLINT_DYN_CTL_INTENA_M BIT(0) #define GLINT_DYN_CTL_CLEARPBA_M BIT(1) diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c index 811830eab385..73898aa08dc5 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -1472,6 +1472,8 @@ void ice_ptp_link_change(struct ice_pf *pf, u8 port, bool linkup) return; ptp_port = &pf->ptp.port; + if (ice_is_e825c(hw) && hw->ptp.is_2x50g_muxed_topo) + port *= 2; if (WARN_ON_ONCE(ptp_port->port_num != port)) return; @@ -3329,6 +3331,9 @@ void ice_ptp_init(struct ice_pf *pf) } ptp->port.port_num = hw->pf_id; + if (ice_is_e825c(hw) && hw->ptp.is_2x50g_muxed_topo) + ptp->port.port_num = hw->pf_id * 2; + err = ice_ptp_init_port(pf, &ptp->port); if (err) goto err; diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c index b65c3455fe44..e31f06fa4a76 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c @@ -2469,6 +2469,27 @@ static int ice_get_phy_tx_tstamp_ready_eth56g(struct ice_hw *hw, u8 port, return 0; } +/** + * ice_is_muxed_topo - detect breakout 2x50G topology for E825C + * @hw: pointer to the HW struct + * + * Returns: true if it's 2x50 breakout topology, false otherwise + */ +static bool ice_is_muxed_topo(struct ice_hw *hw) +{ + u8 link_topo; + bool mux; + u32 val; + + val = rd32(hw, GLGEN_SWITCH_MODE_CONFIG); + mux = FIELD_GET(GLGEN_SWITCH_MODE_CONFIG_SELECT_25X4_ON_SINGLE_QUAD_M, + val); + val = rd32(hw, GLGEN_MAC_LINK_TOPO); + link_topo = FIELD_GET(GLGEN_MAC_LINK_TOPO_LINK_TOPO_M, val); + + return (mux && link_topo == ICE_LINK_TOPO_UP_TO_2_LINKS); +} + /** * ice_ptp_init_phy_e825c - initialize PHY parameters * @hw: pointer to the HW struct @@ -2501,6 +2522,8 @@ static void ice_ptp_init_phy_e825c(struct ice_hw *hw) return; } } + + ptp->is_2x50g_muxed_topo = ice_is_muxed_topo(hw); } /* E822 family functions diff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h index e019dad56819..c5b2ad113d1a 100644 --- a/drivers/net/ethernet/intel/ice/ice_type.h +++ b/drivers/net/ethernet/intel/ice/ice_type.h @@ -851,6 +851,14 @@ enum ice_phy_model { ICE_PHY_ETH56G, }; +/* Global Link Topology */ +enum ice_global_link_topo { + ICE_LINK_TOPO_UP_TO_2_LINKS, + ICE_LINK_TOPO_UP_TO_4_LINKS, + ICE_LINK_TOPO_UP_TO_8_LINKS, + ICE_LINK_TOPO_RESERVED, +}; + struct ice_ptp_hw { enum ice_phy_model phy_model; union ice_phy_params phy; @@ -858,6 +866,7 @@ struct ice_ptp_hw { u8 ports_per_phy; bool primary_nac; struct ice_hw *primary_hw; + bool is_2x50g_muxed_topo; }; /* Port hardware description */