Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3507774pxb; Mon, 24 Jan 2022 11:01:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJzmxWag/zQ06b4teGU3JV+uwsfZv8a70OGFNnY7O6CMgLsYh2DwVfDKkXqR4KolIu0Eh8u6 X-Received: by 2002:a63:fb58:: with SMTP id w24mr13069783pgj.445.1643050903225; Mon, 24 Jan 2022 11:01:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643050903; cv=none; d=google.com; s=arc-20160816; b=uSZaxk0fMgSa18Xr4Rdk7dp0nc2Gnih15GyKO42yCk3AeRq+OwCqlFwS+PUrDlCAq1 +ReFOKr6h14xWnb2MD5BJ4dPhke5Sx1vf1eHv6YWNY77tWJEkryeLGYgUs+/E4JBo1XA xGjIhUn1Xw/jCMeczB6FMMmWDU+jFeeKBs+z3Jb7xgsuPIIHdLiZxAi7w8pXQ+baQWJm BK9k4OCtds5wF7DgmBFrCT2kvDiEK1/9a49APx/PE51VY5XbQwIukp2SdHGPxS4I0ZqI kbbmRoizNkY8xL7jeysiWGk04sP9M0uCURXkHa7zxllC47vtm2kXbv8tSPiD0N093RcP +cZw== 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=weA8O6EvntfZul1mecFTvS0Dwb9gypwnhUcVy63K0rI=; b=vYjd0N6GU2HuD0QxAWB+5emF1cAW8U6nZ8CcV6gvQqU1svgCyoxONvAmtxvHCOqSgf TzegQZP9UMr4crcdV5iNgKpBeY1CHziJnBpZ830CPw33EDhwR5sKieo9L7lYVTNMTkwp qxywSZEiNmtdGT2+OhbSEE/M7Yqu6mMSVPHTKrE9IZR8dmvQypKHwPRQ1FpY6az3boCm TYJvRoLBmKByqdG/TTIXEP8Ta3N/4/WD7bAYSTvtQILccqPKxan7a57rfq3GKvM4BVXV bcZsTDdVqVSo3VLrH+T77CHJxtMWyGWda2Xr5pChVH0GnhWz7i1E9inuYO+ADvhQbu9P +FJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=azwlsuTM; 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 z5si12566945pfa.66.2022.01.24.11.01.29; Mon, 24 Jan 2022 11:01:43 -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=azwlsuTM; 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 S236954AbiAXKBF (ORCPT + 99 others); Mon, 24 Jan 2022 05:01:05 -0500 Received: from mga07.intel.com ([134.134.136.100]:24600 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236933AbiAXKAz (ORCPT ); Mon, 24 Jan 2022 05:00:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643018455; x=1674554455; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=fcP5Mi3E+ddUCuSeWk/h23NjNWIPP76BCXW3Nop8uuI=; b=azwlsuTMIbyV3ChuHuHZUMD/EwqfL01hhc8zN4+aJkB7+Jl0L02U8o3Y VAcsmrYI7t5B/br72blM0ptAVznjNWnukDJaUzwhg9JCSsfqrkl04lcIX IFKt8bfOtmCtGoOVErbin49n5BcPlNdoAgkhrwaOdzABxmVuYTCUIyvk5 RaMkeFyf2O/+PcCR3o4Wiz062G8TiqE/kp5jIGH/lYchWMR7Lfmq0Ev2h i/dSJOU0wD89nGL0Vlm0ayjvkI8gIZ6utNLt7nTiqlHSs5Y+7kHfXbitr BStRXoJY6d5P0pWyH+/GOKhMc2LENzNzgW/fsN5wvhFa9M4XhXUzB+IGY w==; X-IronPort-AV: E=McAfee;i="6200,9189,10236"; a="309331470" X-IronPort-AV: E=Sophos;i="5.88,311,1635231600"; d="scan'208";a="309331470" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2022 02:00:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,311,1635231600"; d="scan'208";a="519886979" Received: from mismail5-ilbpg0.png.intel.com ([10.88.229.13]) by orsmga007.jf.intel.com with ESMTP; 24 Jan 2022 02:00:43 -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 Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, mohammad.athari.ismail@intel.com Subject: [PATCH net 2/2] net: stmmac: skip only stmmac_ptp_register when resume from suspend Date: Mon, 24 Jan 2022 17:59:51 +0800 Message-Id: <20220124095951.23845-3-mohammad.athari.ismail@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220124095951.23845-1-mohammad.athari.ismail@intel.com> References: <20220124095951.23845-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 --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index d7e261768f73..cfea38a50a73 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -884,7 +884,7 @@ EXPORT_SYMBOL_GPL(stmmac_init_tstamp_counter); * 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 +914,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; } @@ -3251,7 +3252,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 +3309,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