Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5765EC433EF for ; Tue, 25 Jan 2022 03:25:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=u9AlkErPyPWUBNPHjxfBTTJ2vIgbS50g2ZzuNSO6YEQ=; b=sD1neVlR1ZG/wC pF4Y0n5QJGpurGEtTEoFcV/jJczhytmlwsGjtUvc0jETP0iKeeV7u53c+ZwK6KA7W9VeuliBXofSr BfU4mkOBGrnRKZGEx9vhjakdwU3nZ23fofwMW4HPJIvN3rleM5gNTHf3u7z7xywfLqRj6krHjKtCM 7EA3m2usiuTv6SZc3+lLYGkhSMpvY4JQM5zUAJOJTT7zl0zsKP2JHpV4tKO99EpTafZi6LvmLrm0l 98cb7Ij3AAa+LVa2ApqWO8wCkBTwcFiN5jJOMWFrZ0tt8V98Ox8wvrQzmpvyeWJWBWCustsci5mNJ r9N26ll65yyI1+Vzul/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCCRn-006J4X-7g; Tue, 25 Jan 2022 03:24:43 +0000 Received: from mga14.intel.com ([192.55.52.115]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCCRY-006IzY-Pb for linux-arm-kernel@lists.infradead.org; Tue, 25 Jan 2022 03:24:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643081068; x=1674617068; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=8ucIpNbwLKGUANZTl44G5Tsgc2DPHdejNQlu4/aegko=; b=MD2MIB2jLAbKXP239RbrLTZHRWE3JkRR9vsGnHplerX5Cg0B6+4bwZf/ xlz9oatHV42/ihjDNiP9fuZpNupjEIR2J6I4vwOdwhSKqkgjoItpDGNWJ b+P9n/ZYBaVGT3B3gPUl5mE1/bAk6pY3hduyzReQdNYgL9inhGB8mZE9m CAlfrtNkuFq9x/k9yvdphL7w3tsXBS9EJ2XJAynke6/rYpqGKdJBI10VN rZr2DsqXJRFOkNxXv7Fgwp52ZG96ZRaHicSaTjNfDoXQI3EXDLNWcfpaj rJZMn5pxuOOPeyckIv1Wv/SOXcVbnDUOfE9WECfAr1qB3nl3rKe0wUt8W w==; X-IronPort-AV: E=McAfee;i="6200,9189,10237"; a="246425361" X-IronPort-AV: E=Sophos;i="5.88,314,1635231600"; d="scan'208";a="246425361" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2022 19:24:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,314,1635231600"; d="scan'208";a="532293091" Received: from mismail5-ilbpg0.png.intel.com ([10.88.229.13]) by fmsmga007.fm.intel.com with ESMTP; 24 Jan 2022 19:24:20 -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 v2 2/2] net: stmmac: skip only stmmac_ptp_register when resume from suspend Date: Tue, 25 Jan 2022 11:23:24 +0800 Message-Id: <20220125032324.4055-3-mohammad.athari.ismail@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220125032324.4055-1-mohammad.athari.ismail@intel.com> References: <20220125032324.4055-1-mohammad.athari.ismail@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220124_192428_879959_D5BD8A1A X-CRM114-Status: GOOD ( 16.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 --- v2 changelog: - Fix build warning related to "function parameter or member not described". --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 22 +++++++++---------- 1 file changed, 11 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..b8e5e19e6f7b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -880,11 +880,12 @@ EXPORT_SYMBOL_GPL(stmmac_init_tstamp_counter); /** * stmmac_init_ptp - init PTP * @priv: driver private structure + * @ptp_register: register PTP if set * Description: this is to verify if the HW supports the PTPv1 or PTPv2. * This is done by looking at the HW cap. register. * This function also registers the ptp driver. */ -static int stmmac_init_ptp(struct stmmac_priv *priv) +static int stmmac_init_ptp(struct stmmac_priv *priv, bool ptp_register) { bool xmac = priv->plat->has_gmac4 || priv->plat->has_xgmac; int ret; @@ -914,7 +915,8 @@ static int stmmac_init_ptp(struct stmmac_priv *priv) priv->hwts_tx_en = 0; priv->hwts_rx_en = 0; - stmmac_ptp_register(priv); + if (ptp_register) + stmmac_ptp_register(priv); return 0; } @@ -3241,7 +3243,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 +3253,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 +3310,11 @@ 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, ptp_register); + if (ret == -EOPNOTSUPP) + netdev_warn(priv->dev, "PTP not supported by HW\n"); + else if (ret) + netdev_warn(priv->dev, "PTP init failed\n"); priv->eee_tw_timer = STMMAC_DEFAULT_TWT_LS; -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel