From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 025D14404F; Wed, 12 Jun 2024 17:19:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C265642F73; Wed, 12 Jun 2024 17:06:09 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mails.dpdk.org (Postfix) with ESMTP id 67CA142F69 for ; Wed, 12 Jun 2024 17:06:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718204768; x=1749740768; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XymecpeggdTm+qKWGdBtWivEVYB8wUcn8wbDNOyNSpE=; b=Rrnjr1m6yaPAbeu+rD3ERZayp8uPKDAJvFTGN/+DshLCuIQJS4ppntKj mm+6+hGZKGSBJzcYWraM5E5qCyd2+zdkwyf1Wyh9l4LRSHVsouAKgXCB1 +u2WEQKABbPtZPW7uUf80sY0v/lgCA1GbL4G1FOv3icwLlUxexJ8tdpOT QkyEip0DY5h4LQRAZBacOxzFa8sjXX5dBWnpKfGKXCHfVQUcblpiK6XIc 90Vd876JePpVYC0ffvcWIzn3ZfMPT1HAMiRJv0075+BrAoEOVj4ps0yrA s8/I6kMJhL7iVC+RJAN60trgzHR1iaFmZBwA5VjxRRgdfru7lVYvaqzSD g==; X-CSE-ConnectionGUID: YG+07tsbSe+3qAzpzmDCUA== X-CSE-MsgGUID: cC9p4wOYQuKVElWtfEaxrg== X-IronPort-AV: E=McAfee;i="6700,10204,11101"; a="32459861" X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="32459861" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2024 08:06:07 -0700 X-CSE-ConnectionGUID: lj9myuUsS6ykK02z+h/I/Q== X-CSE-MsgGUID: XABAjm/bQc+2221H2qfECA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="39925807" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by orviesa009.jf.intel.com with ESMTP; 12 Jun 2024 08:06:05 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Ian Stokes , bruce.richardson@intel.com, Sergey Temerkhanov Subject: [PATCH v2 103/148] net/ice/base: refactor ETH56G PHY initialization Date: Wed, 12 Jun 2024 16:01:37 +0100 Message-ID: <073c583232a05b272c49fc85e3be3b622b7b40ef.1718204529.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: <20240430154014.1026-1-ian.stokes@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Ian Stokes Assign the ETH56G PHY address according to the PCI IDs in preparation for further changes. Signed-off-by: Sergey Temerkhanov Signed-off-by: Ian Stokes --- drivers/net/ice/base/ice_ptp_hw.c | 39 +++++++++++++++++++----------- drivers/net/ice/base/ice_ptp_hw.h | 2 +- drivers/net/ice/base/ice_sbq_cmd.h | 2 +- drivers/net/ice/base/ice_type.h | 1 + 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/drivers/net/ice/base/ice_ptp_hw.c b/drivers/net/ice/base/ice_ptp_hw.c index 1b4534d127..5be4abb73d 100644 --- a/drivers/net/ice/base/ice_ptp_hw.c +++ b/drivers/net/ice/base/ice_ptp_hw.c @@ -940,7 +940,7 @@ ice_write_phy_eth56g_raw_lp(struct ice_hw *hw, u32 reg_addr, u32 val, phy_msg.msg_addr_high = ICE_HI_WORD(reg_addr); phy_msg.data = val; - phy_msg.dest_dev = phy_56g; + phy_msg.dest_dev = hw->phy_addr; err = ice_sbq_rw_reg_lp(hw, &phy_msg, lock_sbq); @@ -970,7 +970,7 @@ ice_read_phy_eth56g_raw_lp(struct ice_hw *hw, u32 reg_addr, u32 *val, phy_msg.msg_addr_low = ICE_LO_WORD(reg_addr); phy_msg.msg_addr_high = ICE_HI_WORD(reg_addr); - phy_msg.dest_dev = phy_56g; + phy_msg.dest_dev = hw->phy_addr; err = ice_sbq_rw_reg_lp(hw, &phy_msg, lock_sbq); @@ -2291,6 +2291,8 @@ ice_ptp_read_tx_hwtstamp_status_eth56g(struct ice_hw *hw, u32 *ts_err) return 0; } +#define ICE_DEVID_MASK 0xFFF8 + /** * ice_ptp_init_phy_model - Initialize hw->phy_model based on device type * @hw: pointer to the HW struct @@ -2298,31 +2300,40 @@ ice_ptp_read_tx_hwtstamp_status_eth56g(struct ice_hw *hw, u32 *ts_err) * Determine the PHY configuration for the device, and initialize hw->phy_model * for use by other functions. */ -int ice_ptp_init_phy_model(struct ice_hw *hw) +void ice_ptp_init_phy_model(struct ice_hw *hw) { - int err; u32 phy_rev; - ice_sb_access_ena_eth56g(hw, true); + switch (hw->device_id & ICE_DEVID_MASK) { + case ICE_DEV_ID_E825C_BACKPLANE & ICE_DEVID_MASK: + hw->phy_addr = eth56g_dev_0; + break; + default: + hw->phy_addr = 0; + } - err = ice_read_phy_eth56g_raw_lp(hw, PHY_REG_REVISION, &phy_rev, - true); - if (err) - return err; + if (hw->phy_addr) { + int err; - if (phy_rev == PHY_REVISION_ETH56G) { - hw->phy_model = ICE_PHY_ETH56G; - return 0; + ice_sb_access_ena_eth56g(hw, true); + err = ice_read_phy_eth56g_raw_lp(hw, PHY_REG_REVISION, + &phy_rev, true); + if (err) + return; + + if (phy_rev == PHY_REVISION_ETH56G) { + hw->phy_model = ICE_PHY_ETH56G; + return; + } } if (ice_is_e810(hw)) hw->phy_model = ICE_PHY_E810; else hw->phy_model = ICE_PHY_E822; + hw->phy_ports = ICE_NUM_EXTERNAL_PORTS; hw->max_phy_port = ICE_NUM_EXTERNAL_PORTS; - - return 0; } /* E822 family functions diff --git a/drivers/net/ice/base/ice_ptp_hw.h b/drivers/net/ice/base/ice_ptp_hw.h index 0684d1516d..952e7966a3 100644 --- a/drivers/net/ice/base/ice_ptp_hw.h +++ b/drivers/net/ice/base/ice_ptp_hw.h @@ -301,7 +301,7 @@ ice_start_phy_timer_eth56g(struct ice_hw *hw, u8 port, bool bypass); int ice_phy_cfg_tx_offset_eth56g(struct ice_hw *hw, u8 port); int ice_phy_cfg_rx_offset_eth56g(struct ice_hw *hw, u8 port); -int ice_ptp_init_phy_model(struct ice_hw *hw); +void ice_ptp_init_phy_model(struct ice_hw *hw); #define PFTSYN_SEM_BYTES 4 diff --git a/drivers/net/ice/base/ice_sbq_cmd.h b/drivers/net/ice/base/ice_sbq_cmd.h index 4da16caf70..aad77af9a1 100644 --- a/drivers/net/ice/base/ice_sbq_cmd.h +++ b/drivers/net/ice/base/ice_sbq_cmd.h @@ -48,7 +48,7 @@ struct ice_sbq_evt_desc { }; enum ice_sbq_msg_dev { - phy_56g = 0x02, + eth56g_dev_0 = 0x02, rmn_0 = 0x02, rmn_1 = 0x03, rmn_2 = 0x04, diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h index 7bada1dd5b..67ea9f9038 100644 --- a/drivers/net/ice/base/ice_type.h +++ b/drivers/net/ice/base/ice_type.h @@ -1269,6 +1269,7 @@ struct ice_hw { u8 pf_id; /* device profile info */ enum ice_phy_model phy_model; + u8 phy_addr; /* PHY address */ u8 phy_ports; u8 max_phy_port; u8 logical_pf_id; -- 2.43.0