Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5474567pxb; Wed, 26 Jan 2022 12:53:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJHJxbXNxls/Y18h/ajYTtcjRr6IS9DaVLAXPBYtoZUe6Bl+8y5wP847h6dq0zdZBuj4jt X-Received: by 2002:a17:902:e803:: with SMTP id u3mr234242plg.41.1643230432005; Wed, 26 Jan 2022 12:53:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643230432; cv=none; d=google.com; s=arc-20160816; b=0ZIVWd60IEbQDejT5yETZ0U1CNFsS05i2Bp/Yz68hOHutrSbOd1k2KohdgS5cUQcQa +/sZSeWQLj5xGVy/fr8MXqgeW/eNolph1AFYTF4HjAoxS8y5rwEKWR56yWk4OUcfZC8d Twbcf1r8E+FFj7X2c6FQE9ZtG1hnNlYdOIDZpB+o27cF/dZRw2HH1i/PdS0CsPBf8kIj 87ByOwb2Nu0eH46H5BYQmCwtTn9dW2lpjk7E8X40QctpczyuEMsZ4JZjRo2MmPbAON9Q 3AVWHLPPpg+/YKSDUthi/wTG4A/fQFnIwtg4pGKozYGTQh0xkNMbKi+YUX01KghRI15r lKlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=asNCtL5/WV4fUeUu/klZ6XV13DdDlpFmnVgy4rmGTdA=; b=FtQl0besodcU+HyVvmLsaAzP9vdMJWc2fAKJFdjc3dYgB/2BiAR6gswLFFdXb6n8/9 XQvrdJmgSTMaKDc2UwWAqbF+ycOfmpL6KMaOBqlQB9QSlt9nIsDeA1Z0eEyo55k41TZ+ r1efvnBTFxIOi2EZ9p0vRbAJlIkuIFr9JizswV6pleq3sl0VFVfPbKqIjCq0jQKJ05RX BtHVIvdlmstkWIqOGClKxrDlbNCafqOKBOba5uoSPzRw5AiCGXyXdXum3VsVxKr9Xd1O I498GBCmoE64Jmupe6ERiPLl/e/tqEB4pE0cv0Z/x6JyhbIHqK2gYm3ANtHukKTlRYTK 47YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LiX7XRbM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id me15si4499375pjb.98.2022.01.26.12.53.40; Wed, 26 Jan 2022 12:53:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LiX7XRbM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239291AbiAZJsZ (ORCPT + 99 others); Wed, 26 Jan 2022 04:48:25 -0500 Received: from mga18.intel.com ([134.134.136.126]:4595 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239366AbiAZJsW (ORCPT ); Wed, 26 Jan 2022 04:48:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643190502; x=1674726502; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=MpWSglKXQYEeeqqBjrw+ec+l47eU3cuban3iOotIK3s=; b=LiX7XRbMTt/5ixoeYiYu8iJxHtvO4B7FvFc7Nxgds6rJn1QBesJXp9Uw 2HQNr4Mo412gRLibO9YHw8TkXKHCGdqLl+rM3YGQtTERcgziiUXWl1B// P+eq/1FEyonwmFMZT3jtwbEE5vY5NLfwytE9frlGLLs1TQnTO/30TD5FQ T1ffmhI8YF7h4Smvp7mu2XmtWJ3qTPRmrOqSjO0nAX/CrYUH9851ZCoOT hcWwohaIEslV3sxmmgMxXwnlDiaTt5agNiNiLfUpGnUb8yTOKZUVdw8IN 5q7IBETfHGnQ5S5JJFBK188/iiWDwKRfb3mDOJ/3T6CPdMYMZdPpALHtn A==; X-IronPort-AV: E=McAfee;i="6200,9189,10238"; a="230090791" X-IronPort-AV: E=Sophos;i="5.88,317,1635231600"; d="scan'208";a="230090791" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2022 01:48:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,317,1635231600"; d="scan'208";a="617918605" Received: from mismail5-ilbpg0.png.intel.com ([10.88.229.13]) by FMSMGA003.fm.intel.com with ESMTP; 26 Jan 2022 01:48:17 -0800 From: Mohammad Athari Bin Ismail To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Jakub Kicinski , Maxime Coquelin , Ong Boon Leong , Voon Weifeng , Wong Vee Khee , Huacai Chen , Alexandre Torgue Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, mohammad.athari.ismail@intel.com Subject: [PATCH net v3 2/2] net: stmmac: skip only stmmac_ptp_register when resume from suspend Date: Wed, 26 Jan 2022 17:47:23 +0800 Message-Id: <20220126094723.11849-3-mohammad.athari.ismail@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220126094723.11849-1-mohammad.athari.ismail@intel.com> References: <20220126094723.11849-1-mohammad.athari.ismail@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When resume from suspend, besides skipping PTP registration, it also skipping PTP HW initialization. This could cause PTP clock not able to operate properly when resume from suspend. To fix this, only stmmac_ptp_register() is skipped when resume from suspend. Fixes: fe1319291150 ("stmmac: Don't init ptp again when resume from suspend/hibernation") Cc: # 5.15.x Signed-off-by: Mohammad Athari Bin Ismail --- v3 changelog: - Move the stmmac_ptp_register() call out to stmmac_hw_setup(). Commented by Jakub Kicinski . v2 changelog: - Fix build warning related to "function parameter or member not described". --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index d7e261768f73..dfda1cbf81ae 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -914,8 +914,6 @@ static int stmmac_init_ptp(struct stmmac_priv *priv) priv->hwts_tx_en = 0; priv->hwts_rx_en = 0; - stmmac_ptp_register(priv); - return 0; } @@ -3241,7 +3239,7 @@ static int stmmac_fpe_start_wq(struct stmmac_priv *priv) /** * stmmac_hw_setup - setup mac in a usable state. * @dev : pointer to the device structure. - * @init_ptp: initialize PTP if set + * @ptp_register: register PTP if set * Description: * this is the main function to setup the HW in a usable state because the * dma engine is reset, the core registers are configured (e.g. AXI, @@ -3251,7 +3249,7 @@ static int stmmac_fpe_start_wq(struct stmmac_priv *priv) * 0 on success and an appropriate (-)ve integer as defined in errno.h * file on failure. */ -static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) +static int stmmac_hw_setup(struct net_device *dev, bool ptp_register) { struct stmmac_priv *priv = netdev_priv(dev); u32 rx_cnt = priv->plat->rx_queues_to_use; @@ -3308,13 +3306,13 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) stmmac_mmc_setup(priv); - if (init_ptp) { - ret = stmmac_init_ptp(priv); - if (ret == -EOPNOTSUPP) - netdev_warn(priv->dev, "PTP not supported by HW\n"); - else if (ret) - netdev_warn(priv->dev, "PTP init failed\n"); - } + ret = stmmac_init_ptp(priv); + if (ret == -EOPNOTSUPP) + netdev_warn(priv->dev, "PTP not supported by HW\n"); + else if (ret) + netdev_warn(priv->dev, "PTP init failed\n"); + else if (ptp_register) + stmmac_ptp_register(priv); priv->eee_tw_timer = STMMAC_DEFAULT_TWT_LS; -- 2.17.1