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 AA569454EF; Tue, 25 Jun 2024 13:26:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E95DE4329E; Tue, 25 Jun 2024 13:18:47 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by mails.dpdk.org (Postfix) with ESMTP id 8EDFB40696 for ; Tue, 25 Jun 2024 13:17:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719314246; x=1750850246; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VTg5FnxVufoRqlo57Yp3++9MuLgwxoHzm/3nU9EkL3U=; b=DhY8Mk3XMRrnUDMujx0FIIPuq9I6YAywltThXvCNG1zCjhDBhkVvrfay oxlmgfpcboNZPYcta3Tn6wygcthztV/mnvSBl4ryhxvwh5Svc4b/1l4fi hnxQFL1+eSSW2NR+xEcA7A7mAPNtI+tviFeNTPT2aWeyT3R0DvWgnZkru jYuad/d+xtI0SY97l0grjOB4/bZrmyw0TsZhkvl3iLHiWahUruLObv1qk Z2w6euE/8nrJ1WyENSYYYcua5Lp2GLSkI2eU4qskmSk1mwXLqJ4Kd61Wi e33tj39ypkrzGY5oBSeDUQWqCz0NFFPcOGNzrgw3Thv06hICgEBhQ4AJ1 Q==; X-CSE-ConnectionGUID: byPQAoJ2S3O5Co2ix4coeg== X-CSE-MsgGUID: rZfqbIdaTg2sex0kpJfXHg== X-IronPort-AV: E=McAfee;i="6700,10204,11113"; a="16080455" X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="16080455" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2024 04:17:26 -0700 X-CSE-ConnectionGUID: S+vHtqAuT7WfIrwJs26ASA== X-CSE-MsgGUID: CgJi5n/sTyi1yj+UYP3zOQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="43719569" Received: from unknown (HELO silpixa00401119.ir.intel.com) ([10.55.129.167]) by orviesa009.jf.intel.com with ESMTP; 25 Jun 2024 04:17:26 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: bruce.richardson@intel.com, ian.stokes@intel.com Subject: [PATCH v3 092/129] net/ice/base: move ice_ptp_init_phy_model to align with upstream Date: Tue, 25 Jun 2024 12:13:37 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: 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 Upstream code has this function in a different place, so move it to match the upstream code. Signed-off-by: Anatoly Burakov --- drivers/net/ice/base/ice_ptp_hw.c | 127 +++++++++++++++--------------- 1 file changed, 63 insertions(+), 64 deletions(-) diff --git a/drivers/net/ice/base/ice_ptp_hw.c b/drivers/net/ice/base/ice_ptp_hw.c index 9de5c1caaf..7f360a0192 100644 --- a/drivers/net/ice/base/ice_ptp_hw.c +++ b/drivers/net/ice/base/ice_ptp_hw.c @@ -2321,70 +2321,6 @@ ice_get_phy_tx_tstamp_ready_eth56g(struct ice_hw *hw, u8 port, 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 structure - * - * Determine the PHY model for the device, and initialize hw->phy_model - * for use by other functions. - */ -void ice_ptp_init_phy_model(struct ice_hw *hw) -{ - unsigned int phy; - - for (phy = 0; phy < MAX_PHYS_PER_ICE; phy++) - hw->phy_addr[phy] = 0; - - switch (hw->device_id & ICE_DEVID_MASK) { - case ICE_DEV_ID_E825C_BACKPLANE & ICE_DEVID_MASK: - hw->phy_addr[0] = eth56g_dev_0; - hw->phy_addr[1] = eth56g_dev_1; - hw->num_phys = ICE_PHYS_PER_CPLX_C825X; - hw->phy_ports = ICE_PORTS_PER_PHY_C825X; - hw->max_phy_port = ice_is_nac_dual(hw) ? - ICE_PORTS_PER_PHY_C825X : - ICE_PHYS_PER_CPLX_C825X * ICE_PORTS_PER_PHY_C825X; - break; - default: - goto e8xx; - } - - ice_sb_access_ena_eth56g(hw, true); - for (phy = 0; phy < hw->num_phys; phy++) - if (hw->phy_addr[phy]) { - int err; - u32 phy_rev; - - err = ice_read_phy_eth56g_raw_lp(hw, phy, - PHY_REG_REVISION, - &phy_rev, true); - if (err) { - hw->phy_model = ICE_PHY_UNSUP; - return; - } - - if (phy_rev != PHY_REVISION_ETH56G) { - hw->phy_model = ICE_PHY_UNSUP; - return; - } - } - - hw->phy_model = ICE_PHY_ETH56G; - - return; -e8xx: - - 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; -} - /* E822 family functions * * The following functions operate on the E822 family of devices. @@ -5639,6 +5575,69 @@ void ice_ptp_unlock(struct ice_hw *hw) wr32(hw, PFTSYN_SEM + (PFTSYN_SEM_BYTES * hw->pf_id), 0); } +#define ICE_DEVID_MASK 0xFFF8 + +/** + * ice_ptp_init_phy_model - Initialize hw->phy_model based on device type + * @hw: pointer to the HW structure + * + * Determine the PHY model for the device, and initialize hw->phy_model + * for use by other functions. + */ +void ice_ptp_init_phy_model(struct ice_hw *hw) +{ + unsigned int phy; + + for (phy = 0; phy < MAX_PHYS_PER_ICE; phy++) + hw->phy_addr[phy] = 0; + + switch (hw->device_id & ICE_DEVID_MASK) { + case ICE_DEV_ID_E825C_BACKPLANE & ICE_DEVID_MASK: + hw->phy_addr[0] = eth56g_dev_0; + hw->phy_addr[1] = eth56g_dev_1; + hw->num_phys = ICE_PHYS_PER_CPLX_C825X; + hw->phy_ports = ICE_PORTS_PER_PHY_C825X; + hw->max_phy_port = ice_is_nac_dual(hw) ? + ICE_PORTS_PER_PHY_C825X : + ICE_PHYS_PER_CPLX_C825X * ICE_PORTS_PER_PHY_C825X; + break; + default: + goto e8xx; + } + + ice_sb_access_ena_eth56g(hw, true); + for (phy = 0; phy < hw->num_phys; phy++) + if (hw->phy_addr[phy]) { + int err; + u32 phy_rev; + + err = ice_read_phy_eth56g_raw_lp(hw, phy, + PHY_REG_REVISION, + &phy_rev, true); + if (err) { + hw->phy_model = ICE_PHY_UNSUP; + return; + } + + if (phy_rev != PHY_REVISION_ETH56G) { + hw->phy_model = ICE_PHY_UNSUP; + return; + } + } + + hw->phy_model = ICE_PHY_ETH56G; + + return; +e8xx: + + 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; +} + /** * ice_ptp_write_port_cmd - Prepare a single PHY port for a timer command * @hw: pointer to HW struct -- 2.43.0