From patchwork Wed Dec 16 11:32:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Holger Assmann X-Patchwork-Id: 11977293 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12674C0018C for ; Wed, 16 Dec 2020 11:36:49 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A9D0123343 for ; Wed, 16 Dec 2020 11:36:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A9D0123343 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=h4hP0R8eHUVL0W5dbkg63MlyRLAHwdc5/OJUuD5i1a0=; b=pv3UmSUhRg5cElSyEyMl6Iq9i qGL4VPbU5mfC3qRPYMH+iGYatHhz921q5BC7w3GKPC27zC7dqzGz2A+s/38hq6n5uC+GcjVoGyGQd 38VsPNCt3RdCV5k+r/ftFBaK4EUTy59inXQYBjO/rfu8jN3IJtnzVPh35KIG85TA3gzY5HpU7Yhuu UPxNLziA/qDKkH0AgxaOrsyn3ZRTfHNwdWmRsZQz6hAD5Ru7kNb3RGRKHJDeVV/8av1DbdnC3TKI7 whRjFLFNpkTAUgGDPSCHyJPP2n0WPWCKGowAd/bvvKYqfEo/wjgd0XQ511pAiFURujL5j3XuQ5/9K YEkTQcVmw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kpV5g-0005LW-EQ; Wed, 16 Dec 2020 11:35:32 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kpV5d-0005KZ-KC for linux-arm-kernel@lists.infradead.org; Wed, 16 Dec 2020 11:35:31 +0000 Received: from [2a0a:edc0:0:1101:1d::39] (helo=dude03.red.stw.pengutronix.de) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpV5X-0000K6-PS; Wed, 16 Dec 2020 12:35:23 +0100 Received: from has by dude03.red.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1kpV5X-00CVWp-6B; Wed, 16 Dec 2020 12:35:23 +0100 From: Holger Assmann To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Maxime Coquelin Subject: [PATCH 2/2] net: stmmac: drop no longer variable priv member Date: Wed, 16 Dec 2020 12:32:39 +0100 Message-Id: <20201216113239.2980816-2-h.assmann@pengutronix.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201216113239.2980816-1-h.assmann@pengutronix.de> References: <20201216113239.2980816-1-h.assmann@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:1101:1d::39 X-SA-Exim-Mail-From: has@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201216_063529_894428_7CB6BAD7 X-CRM114-Status: GOOD ( 17.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ahmad Fatoum , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Holger Assmann , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This follow-up patch removes the member "systime_flags" from "stmmac_priv" and the affected funtions in stmmac. Usage of this variable becomes deprecated after the introduction of "stmmac_init_hwtstamp()", which now takes care of setting the respective register flags. Signed-off-by: Ahmad Fatoum Signed-off-by: Holger Assmann --- drivers/net/ethernet/stmicro/stmmac/dwmac5.c | 7 +++---- drivers/net/ethernet/stmicro/stmmac/dwmac5.h | 2 +- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 7 +++---- drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 - drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +----- drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 3 +-- 7 files changed, 10 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c index 03e79a677c8b..53d14d660220 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c @@ -494,7 +494,7 @@ int dwmac5_rxp_config(void __iomem *ioaddr, struct stmmac_tc_entry *entries, int dwmac5_flex_pps_config(void __iomem *ioaddr, int index, struct stmmac_pps_cfg *cfg, bool enable, - u32 sub_second_inc, u32 systime_flags) + u32 sub_second_inc) { u32 tnsec = readl(ioaddr + MAC_PPSx_TARGET_TIME_NSEC(index)); u32 val = readl(ioaddr + MAC_PPS_CONTROL); @@ -504,7 +504,7 @@ int dwmac5_flex_pps_config(void __iomem *ioaddr, int index, return -EINVAL; if (tnsec & TRGTBUSY0) return -EBUSY; - if (!sub_second_inc || !systime_flags) + if (!sub_second_inc) return -EINVAL; val &= ~PPSx_MASK(index); @@ -522,8 +522,7 @@ int dwmac5_flex_pps_config(void __iomem *ioaddr, int index, writel(cfg->start.tv_sec, ioaddr + MAC_PPSx_TARGET_TIME_SEC(index)); - if (!(systime_flags & PTP_TCR_TSCTRLSSR)) - cfg->start.tv_nsec = (cfg->start.tv_nsec * 1000) / 465; + /* HW timestamping init always sets PTP_TCR_TSCTRLSSR, so no conversion necessary */ writel(cfg->start.tv_nsec, ioaddr + MAC_PPSx_TARGET_TIME_NSEC(index)); period = cfg->period.tv_sec * 1000000000; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac5.h b/drivers/net/ethernet/stmicro/stmmac/dwmac5.h index 56b0762c1276..f89996cc4403 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.h @@ -108,7 +108,7 @@ int dwmac5_rxp_config(void __iomem *ioaddr, struct stmmac_tc_entry *entries, unsigned int count); int dwmac5_flex_pps_config(void __iomem *ioaddr, int index, struct stmmac_pps_cfg *cfg, bool enable, - u32 sub_second_inc, u32 systime_flags); + u32 sub_second_inc); int dwmac5_est_configure(void __iomem *ioaddr, struct stmmac_est *cfg, unsigned int ptp_rate); void dwmac5_fpe_configure(void __iomem *ioaddr, u32 num_txq, u32 num_rxq, diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c index ad4df9bddcf3..3bf3ce81dbd8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c @@ -1109,7 +1109,7 @@ static int dwxgmac2_get_mac_tx_timestamp(struct mac_device_info *hw, u64 *ts) static int dwxgmac2_flex_pps_config(void __iomem *ioaddr, int index, struct stmmac_pps_cfg *cfg, bool enable, - u32 sub_second_inc, u32 systime_flags) + u32 sub_second_inc) { u32 tnsec = readl(ioaddr + XGMAC_PPSx_TARGET_TIME_NSEC(index)); u32 val = readl(ioaddr + XGMAC_PPS_CONTROL); @@ -1119,7 +1119,7 @@ static int dwxgmac2_flex_pps_config(void __iomem *ioaddr, int index, return -EINVAL; if (tnsec & XGMAC_TRGTBUSY0) return -EBUSY; - if (!sub_second_inc || !systime_flags) + if (!sub_second_inc) return -EINVAL; val &= ~XGMAC_PPSx_MASK(index); @@ -1136,8 +1136,7 @@ static int dwxgmac2_flex_pps_config(void __iomem *ioaddr, int index, writel(cfg->start.tv_sec, ioaddr + XGMAC_PPSx_TARGET_TIME_SEC(index)); - if (!(systime_flags & PTP_TCR_TSCTRLSSR)) - cfg->start.tv_nsec = (cfg->start.tv_nsec * 1000) / 465; + /* HW timestamping init always sets PTP_TCR_TSCTRLSSR, so no conversion necessary */ writel(cfg->start.tv_nsec, ioaddr + XGMAC_PPSx_TARGET_TIME_NSEC(index)); period = cfg->period.tv_sec * 1000000000; diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index b40b2e0667bb..7d73d3206068 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -360,7 +360,7 @@ struct stmmac_ops { /* Flexible PPS */ int (*flex_pps_config)(void __iomem *ioaddr, int index, struct stmmac_pps_cfg *cfg, bool enable, - u32 sub_second_inc, u32 systime_flags); + u32 sub_second_inc); /* Loopback for selftests */ void (*set_mac_loopback)(void __iomem *ioaddr, bool enable); /* RSS */ diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index e553b9a1f785..4d0642ae55d6 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -217,7 +217,6 @@ struct stmmac_priv { struct ptp_clock_info ptp_clock_ops; unsigned int default_addend; u32 sub_second_inc; - u32 systime_flags; u32 adv_ts; int use_riwt; int irq_wake; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 55f5e6cd1cad..a6e4c7c26b4d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -697,9 +697,6 @@ static int stmmac_hwtstamp_set(struct net_device *dev, struct ifreq *ifr) ptp_over_ipv6_udp | ptp_over_ipv4_udp | ts_event_en | ts_master_en | snap_type_sel); stmmac_config_hw_tstamping(priv, priv->ptpaddr, value); - - /* Store flags for later use */ - priv->systime_flags = value; } memcpy(&priv->tstamp_config, &config, sizeof(config)); @@ -806,9 +803,8 @@ static int stmmac_init_hwtstamp(struct stmmac_priv *priv) xmac, &sec_inc); temp = div_u64(1000000000ULL, sec_inc); - /* Store sub second increment and flags for later use */ + /* Store sub second increment for later use */ priv->sub_second_inc = sec_inc; - priv->systime_flags = value; /* calculate default added value: * formula is : diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c index 0989e2bb6ee3..70a113ab4789 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c @@ -154,8 +154,7 @@ static int stmmac_enable(struct ptp_clock_info *ptp, spin_lock_irqsave(&priv->ptp_lock, flags); ret = stmmac_flex_pps_config(priv, priv->ioaddr, rq->perout.index, cfg, on, - priv->sub_second_inc, - priv->systime_flags); + priv->sub_second_inc); spin_unlock_irqrestore(&priv->ptp_lock, flags); break; default: