Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4013288pxb; Tue, 25 Jan 2022 01:22:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxt+bWhP6hpLr/0+KcQEhvifDEsdBrEV9tZ8IHfeI1073HxIgbtGHdNGLkY/y9k5UI+m9Uw X-Received: by 2002:a17:90a:1b4c:: with SMTP id q70mr2595168pjq.36.1643102553339; Tue, 25 Jan 2022 01:22:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643102553; cv=none; d=google.com; s=arc-20160816; b=Hu+W2aZLHWX5rQ+NF7q7TSl9LHAnBN0tQyxKmaB0CqLaZceyafM6E8EqUxNKzG0MYQ ny+Ls/GyXpbwrE2rdn7eR6PG3vrhUo6PWwJBWZSlfAP9Wq9Ngn/5JmjZd45mT9yXwuQ2 YRtjhaARLcgg18Qx3KKn/nQB2Va7sgfIbKZpx05FA9gFeTroI6UXlOkgrK9X7BT6pqpX NzWpGuqL/kPoLYApsvzdxHp5pAIyziI0H2UGE/JHrhACsm19ELxEI1waG/aiwjchK5b1 wZoDq4oTRjmjaD6DDz+al3LRa9zSZdUUrCkx+bPOOW+rmHU972jRJl+9IoVZIqLrDIkz ibpQ== 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=i80WkWBVNNzParhcMm6PHhx4FzAGHSsfWNW24MSSiMo=; b=quu0Zs2/x/hSBY3JLI2tbPCArow69LZJuDj93ak+vi3ghZF+QFr/t+nTYp2vHKvlxK /Dv/j2J/3QUlL78hlx1CKPIVD62mCxigL/MbdmhU+14zWiy9S1zSm1b+jrnydyYMDwmC G1REpEotDblS5R92017nVEYRhqN9+UIkNa6TbBWL0G0pnuDR7idQCLuYvTkaoBHZ9Vfa zD/9MFdplr1MF44Etigjpi15poQQq30Zkj0Bli4OKsyl0F7lLTT6whF7E4gSviq/YTzh DDLZKzMC7HoHNNXNKwCU1/zcwqaoHJVhWMKullecI6jvDEe22MkIH5+9qA4M5dBIdYkQ ld5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bIj0+mqF; 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 bc12si7824644pgb.269.2022.01.25.01.22.20; Tue, 25 Jan 2022 01:22:33 -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=bIj0+mqF; 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 S1445322AbiAYH1x (ORCPT + 99 others); Tue, 25 Jan 2022 02:27:53 -0500 Received: from mga06.intel.com ([134.134.136.31]:11673 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1324845AbiAYDeN (ORCPT ); Mon, 24 Jan 2022 22:34:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643081653; x=1674617653; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=8ucIpNbwLKGUANZTl44G5Tsgc2DPHdejNQlu4/aegko=; b=bIj0+mqFnr8rkpNH+C5RXD3UNTFfYCByL+yTmyju4Dx/p5sZn4LQB1CB yukNioJW1AABANiq2eNB6GhbAoytUAdEAI/nUZzFR4i47C3DPSXd4+BWL GSst27XbAnRr1+gJQ+ASatID/Z+WuuoHlbJYIxpdpnLboDHE/MQw5Nklu tmEkoE3BiUtDrUSGeAWewO32MLZY/Q/vp43YAuCYcngGJNEM0rcbuYPgP i4+wOXw5K8blGcEA2Ewo/U3aNhaep5CgYuFLjg2ZCEwOCAXphIbLawyMc d5J8HguAdozBeZZzJ1chZEmU/iGCyVpfN1Dg1zY2E0ASVru02eJzkFcuH A==; X-IronPort-AV: E=McAfee;i="6200,9189,10237"; a="306923149" X-IronPort-AV: E=Sophos;i="5.88,314,1635231600"; d="scan'208";a="306923149" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.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> 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 --- 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