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 51784454EF; Tue, 25 Jun 2024 13:25:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4733443258; Tue, 25 Jun 2024 13:18:36 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by mails.dpdk.org (Postfix) with ESMTP id 47B9642D91 for ; Tue, 25 Jun 2024 13:17:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719314233; x=1750850233; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tbiuCpuOZuY3myHaLzJG5gLRM55+Y9ykbSiNa4npBjM=; b=R/peeH17PB89nDoHgARB7adLI9vJExZW5nxUNw7snxUAG9fzzDlERj3d CDT7JvB04Wx7xRhwQelxMVZfUzGxWZM1dwJKt7DggZoLZhIuft7Nn4QZI ADAhXiRuwMnUsIVVGhh02z7ISY2JMC7VrU2IeKd3WExZchCI6a/l3oIA/ HCVcP2Sw3J5pOnFL8JHpoT6MpQphcSA1oDRTQF+2MIzdZ1fs9MHMfkmNI ebcrhmXfmvrWqFlxCPjC7RfN4fdFLA1tKynzxYH5okS3+sMzfW9l/pXub TOSAuisGRu96SIAq5Wup6YlGiG6lTkBRYiX2k/2GfGqAi0B6VSltNWH90 Q==; X-CSE-ConnectionGUID: hLtyi+9/SjavJlAXF6xvHg== X-CSE-MsgGUID: SY7GRB0wQP29KRR8tsT9oA== X-IronPort-AV: E=McAfee;i="6700,10204,11113"; a="16080414" X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="16080414" 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:12 -0700 X-CSE-ConnectionGUID: VqqNLB7yQTaHqnd2Lfu4lw== X-CSE-MsgGUID: ZN8iiF4VRl2qlcHr71Q8mQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="43719515" Received: from unknown (HELO silpixa00401119.ir.intel.com) ([10.55.129.167]) by orviesa009.jf.intel.com with ESMTP; 25 Jun 2024 04:17:12 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Sergey Temerkhanov , bruce.richardson@intel.com, ian.stokes@intel.com Subject: [PATCH v3 083/129] net/ice/base: enable SB access explicitly before 1st PHY access Date: Tue, 25 Jun 2024 12:13:28 +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 From: Sergey Temerkhanov Explicitly enable sideband device access before the first PHY access to avoid possible errors for ETH56G. Signed-off-by: Sergey Temerkhanov Signed-off-by: Ian Stokes --- drivers/net/ice/base/ice_ptp_hw.c | 38 +++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/drivers/net/ice/base/ice_ptp_hw.c b/drivers/net/ice/base/ice_ptp_hw.c index dc050011ef..e406c62a3a 100644 --- a/drivers/net/ice/base/ice_ptp_hw.c +++ b/drivers/net/ice/base/ice_ptp_hw.c @@ -2227,6 +2227,33 @@ ice_start_phy_timer_eth56g(struct ice_hw *hw, u8 port, bool bypass) return 0; } +/** + * ice_sb_access_ena_eth56g - Enable SB devices (PHY and others) access + * @hw: pointer to HW struct + * @enable: Enable or disable access + * + * Enable sideband devices (PHY and others) access. + */ +static void ice_sb_access_ena_eth56g(struct ice_hw *hw, bool enable) +{ + u32 regval; + + /* Enable reading and writing switch and PHY registers over the + * sideband queue. + */ +#define PF_SB_REM_DEV_CTL_SWITCH_READ BIT(1) +#define PF_SB_REM_DEV_CTL_PHY0 BIT(2) + regval = rd32(hw, PF_SB_REM_DEV_CTL); + if (enable) + regval |= (PF_SB_REM_DEV_CTL_SWITCH_READ | + PF_SB_REM_DEV_CTL_PHY0); + else + regval &= ~(PF_SB_REM_DEV_CTL_SWITCH_READ | + PF_SB_REM_DEV_CTL_PHY0); + + wr32(hw, PF_SB_REM_DEV_CTL, regval); +} + /** * ice_ptp_init_phc_eth56g - Perform E822 specific PHC initialization * @hw: pointer to HW struct @@ -2236,15 +2263,6 @@ ice_start_phy_timer_eth56g(struct ice_hw *hw, u8 port, bool bypass) static int ice_ptp_init_phc_eth56g(struct ice_hw *hw) { int err = 0; - u32 regval; - - /* Enable reading switch and PHY registers over the sideband queue */ -#define PF_SB_REM_DEV_CTL_SWITCH_READ BIT(1) -#define PF_SB_REM_DEV_CTL_PHY0 BIT(2) - regval = rd32(hw, PF_SB_REM_DEV_CTL); - regval |= (PF_SB_REM_DEV_CTL_SWITCH_READ | - PF_SB_REM_DEV_CTL_PHY0); - wr32(hw, PF_SB_REM_DEV_CTL, regval); /* Initialize the Clock Generation Unit */ err = ice_init_cgu_e82x(hw); @@ -2285,6 +2303,8 @@ int ice_ptp_init_phy_model(struct ice_hw *hw) int err; u32 phy_rev; + ice_sb_access_ena_eth56g(hw, true); + err = ice_read_phy_eth56g_raw_lp(hw, PHY_REG_REVISION, &phy_rev, true); if (err) -- 2.43.0