From patchwork Thu Aug 24 18:32:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 13364565 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 E72D7C3DA6F for ; Thu, 24 Aug 2023 18:33:43 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=T+STT/xyaAbUNpMVI4etemFYe9LBWZSdmhBADFTBlqI=; b=swmksr9uPE2pLM Rb+43KMXn/psRUBNRWvAYXSl7GKUnNtUiedHR6CLAkosPIYf3vk6RdqzZdj65rRbUg5aeflX3GFNd lMwJWSKYBnqKd9eIbLOc3HvJmKkIEYF8tQWQJracA6pnIV9UzDWY0CeuwZCcFR08PK6bjSFe4s4cp opb5vEm/zp5J2ij3EUshESjOWmtFJLngbCX1s4CIv2JfedRSMJr6NymhpIoMGtL7OSJ2myriThBu7 FRxyaLAFzhEfaHRT5HTrpYva4KMCEcFmLxV2KVbaUSP6hfdKumP0fP5x0Y1b0uJ/5Wjiqi/G7lCoh edQWNkr4sVtaim1GUbgg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qZF8r-003b3w-1r; Thu, 24 Aug 2023 18:33:13 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qZF8h-003ayV-2M for linux-arm-kernel@lists.infradead.org; Thu, 24 Aug 2023 18:33:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692901981; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6MSPeUOmvEq1eUUgwQ2syHQsuZQFtArlwfrE4/FiNFk=; b=iFdvdw+ulYEFXeFUvBD5NmjzJiOG7j8bLoYqQ+yt72PR/7bZuCmYWLccWcyAKGgq0u1rPQ EklH2BzrR9993jw/wrV3JXBDDBuZRmTTTS0w1aI7ptFd+rFe0nIC3rMn2JMRXmu63RosP2 HV/CsOPaKGcueJNCJBQF/xxmkKFNPaQ= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-660-mWqLgYNqNymrAytbMI708A-1; Thu, 24 Aug 2023 14:32:59 -0400 X-MC-Unique: mWqLgYNqNymrAytbMI708A-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-64ab5892bbcso2179836d6.0 for ; Thu, 24 Aug 2023 11:32:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692901979; x=1693506779; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6MSPeUOmvEq1eUUgwQ2syHQsuZQFtArlwfrE4/FiNFk=; b=By63nBwHVuNefN3fmUJokyn7Hg6/bTMYX0K4RrygHfJKieB/xCjxibi5SHHvNaT4W7 atRPwKW22OrHfyBy9HuX4GrZxS6kdcpuiv8u2MW+W1gJzZCtUc4Ai5t8ayEPCs+7Yi4J 512c39XIu4VMEAFt70URCCI1HYMI69LLOYKKyzs6YuYtec6jgXQOBu19pB1wiFsKtwTD dtGfg4JWaaWLZtK+/PyWhmtKk96z6qYhaYVXpwzvdD/dQFH42lHBb9+j/9hLB9DjsuGM n64heqlNpe40ZLNTS1rjrkm2YtXm+OGfEqsQ/o/831ELXA+5o2vtt3kEAceDURinGA+Z YZxA== X-Gm-Message-State: AOJu0YwP6UnbrSaZvcKOC2Ops1cL/tsOQ8jkxJ+0vrho7HMBc9Ap/RLk vQcIPeW3Jn/9nw/KqP9XqUysqcg7qVy04DOQ1KGfIcmJ1fQZfu3q6CgaD+w6sruAPVxSEmI137r p8Z0A/OahAFMuwU0cQ9Z7rGvbxQKQ4ExnGBk= X-Received: by 2002:a0c:e246:0:b0:647:2653:bcc with SMTP id x6-20020a0ce246000000b0064726530bccmr18915147qvl.13.1692901978978; Thu, 24 Aug 2023 11:32:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFOnxZtOm4Zbo/1b64keu9y2z8jyW5dWXMkNKbfmN/AXxPf8v016bCHVXCzjBnQUDUxKTav6w== X-Received: by 2002:a0c:e246:0:b0:647:2653:bcc with SMTP id x6-20020a0ce246000000b0064726530bccmr18915120qvl.13.1692901978737; Thu, 24 Aug 2023 11:32:58 -0700 (PDT) Received: from [192.168.1.165] ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id j17-20020a0ceb11000000b0064f77d37798sm4209qvp.5.2023.08.24.11.32.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Aug 2023 11:32:58 -0700 (PDT) From: Andrew Halaney Date: Thu, 24 Aug 2023 13:32:52 -0500 Subject: [PATCH net-next 1/7] net: stmmac: Use consistent variable name for subsecond increment MIME-Version: 1.0 Message-Id: <20230824-stmmac-subsecond-inc-cleanup-v1-1-e0b9f7c18b37@redhat.com> References: <20230824-stmmac-subsecond-inc-cleanup-v1-0-e0b9f7c18b37@redhat.com> In-Reply-To: <20230824-stmmac-subsecond-inc-cleanup-v1-0-e0b9f7c18b37@redhat.com> To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Richard Cochran Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Halaney X-Mailer: b4 0.12.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230824_113303_838327_53536C08 X-CRM114-Status: GOOD ( 14.98 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Subsecond increment is the name of the field being programmed. Let's stop using a bunch of variations of that name and just use sub_second_inc throughout. Signed-off-by: Andrew Halaney --- drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 6 +++--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index 238f17c50a1e..bd607da65037 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -524,7 +524,7 @@ struct stmmac_ops { struct stmmac_hwtimestamp { void (*config_hw_tstamping) (void __iomem *ioaddr, u32 data); void (*config_sub_second_increment)(void __iomem *ioaddr, u32 ptp_clock, - int gmac4, u32 *ssinc); + int gmac4, u32 *sub_second_inc); int (*init_systime) (void __iomem *ioaddr, u32 sec, u32 nsec); int (*config_addend) (void __iomem *ioaddr, u32 addend); int (*adjust_systime) (void __iomem *ioaddr, u32 sec, u32 nsec, diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c index 540f6a4ec0b8..6dcf8582a70e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c @@ -24,7 +24,7 @@ static void config_hw_tstamping(void __iomem *ioaddr, u32 data) } static void config_sub_second_increment(void __iomem *ioaddr, - u32 ptp_clock, int gmac4, u32 *ssinc) + u32 ptp_clock, int gmac4, u32 *sub_second_inc) { u32 value = readl(ioaddr + PTP_TCR); unsigned long data; @@ -56,8 +56,8 @@ static void config_sub_second_increment(void __iomem *ioaddr, writel(reg_value, ioaddr + PTP_SSIR); - if (ssinc) - *ssinc = data; + if (sub_second_inc) + *sub_second_inc = data; } static void hwtstamp_correct_latency(struct stmmac_priv *priv) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 7a9bbcf03ea5..67e4f65f0f68 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -836,7 +836,7 @@ int stmmac_init_tstamp_counter(struct stmmac_priv *priv, u32 systime_flags) { bool xmac = priv->plat->has_gmac4 || priv->plat->has_xgmac; struct timespec64 now; - u32 sec_inc = 0; + u32 sub_second_inc = 0; u64 temp = 0; if (!(priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp)) @@ -848,16 +848,16 @@ int stmmac_init_tstamp_counter(struct stmmac_priv *priv, u32 systime_flags) /* program Sub Second Increment reg */ stmmac_config_sub_second_increment(priv, priv->ptpaddr, priv->plat->clk_ptp_rate, - xmac, &sec_inc); - temp = div_u64(1000000000ULL, sec_inc); + xmac, &sub_second_inc); + temp = div_u64(1000000000ULL, sub_second_inc); /* Store sub second increment for later use */ - priv->sub_second_inc = sec_inc; + priv->sub_second_inc = sub_second_inc; /* calculate default added value: * formula is : * addend = (2^32)/freq_div_ratio; - * where, freq_div_ratio = 1e9ns/sec_inc + * where, freq_div_ratio = 1e9ns/sub_second_inc */ temp = (u64)(temp << 32); priv->default_addend = div_u64(temp, priv->plat->clk_ptp_rate); From patchwork Thu Aug 24 18:32:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 13364564 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 3D9E0C6FA8F for ; Thu, 24 Aug 2023 18:33:43 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oKn7gDUedCy4ov4wwhHRShKXac6S3M3XTJsuazRsbWo=; b=eWJ+sG7Lj+5Y8o QLDgq5JX4K3tR0HSb0cdQPjgKhC8/u+E9kWeMKq8yMDN+nL3qkq6+3MtupvfYtCGUpJd3gmDOiVT8 GWLh3OmsZq0XAFPGAkj4d1rO3Z+7Mb342iQL4mx2D5JffsgZgCN55pO2TFB6t9OYuxE8FZvNNNa4a RnTOyCeFHM6AOhitiyVF/aHSXGmwJSApLK02rt30v3eS9/yvNeABa+9MJNcD0X5ouAXyk08ShJOin iYyCoqNvqDxul4wyEbWF6pwpKy/8AWrD6AhkJYDFMbQzuNLXeVtO1D/e3ChipZN0t8JyyKMMQAKOG 5ZdwdXYsMPOb6oyCbF8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qZF8s-003b4k-29; Thu, 24 Aug 2023 18:33:14 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qZF8k-003azj-1r for linux-arm-kernel@lists.infradead.org; Thu, 24 Aug 2023 18:33:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692901985; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=thxHPyqpXjBOV26mQw4932uoaf4t0NSsG4y7+rk0Hj4=; b=I2V7ZtaYenrtdPuPjrY6uasSdyevvxG9YVrV9lhJEyuUSxdzfB4LMRtMDpbFyZ9REzPpiA XP8baufP3zxFDXhvZbmv7d8BZ8AtLSc55dwLtGszKk95ktMj70RAzrphEkvMqTwOobj21F NwwLf8IvfYWHQrdxoGpclqc0L9zc9Ps= Received: from mail-oa1-f70.google.com (mail-oa1-f70.google.com [209.85.160.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-683-y9SvWCD2M-2vyNJcGxZNLg-1; Thu, 24 Aug 2023 14:33:03 -0400 X-MC-Unique: y9SvWCD2M-2vyNJcGxZNLg-1 Received: by mail-oa1-f70.google.com with SMTP id 586e51a60fabf-1c0ed186cf5so110035fac.1 for ; Thu, 24 Aug 2023 11:33:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692901983; x=1693506783; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=thxHPyqpXjBOV26mQw4932uoaf4t0NSsG4y7+rk0Hj4=; b=l/Ifmgw9q539QOlodaYc3l2Tq5FMYdIawiDzw0rGv8k5hvF2Yf8njDCY/RB7X8e+up rldYH4m2j2zKS6pB7aL4ojwpK7S8y4qoo1HA3NJOTU9wdIM/3SdoNHswVvovNaU7qjrL x8BwSE5/YE4k6x5FQtBH2iDubo4KSdzVeCt+Ptg2tCdo31hpGjSb7GJfsO3WtP/lALKI 2BBnByCbQoFN9jk97u6QWH2wMunFPynWu9L4CXnroQW1xPwZ8Nw4pJtB+7nE7mV6bUK+ Jw8z6zCnIRJQPiCE6Y2eB6BnHdzxoBizYhRAunNQ/T9CWN3bDDiVRkryOrY3mpj+ODfo Akzw== X-Gm-Message-State: AOJu0YwSFTFYiPcEiXjJaKt0xsXjWWlGRHwzd2ghHmix9aEVwJKavWgV +irhYx2VM5/o+zpgsVmfAbA+AduDLUYYDDb8YhakYiJKd3NFB/hWi1y1myZ9SgHhgYjxNe40uOw 3PGoWrLD6ZUx2upxbeNAflR/u/4NUXE2VKo8= X-Received: by 2002:a05:6870:b30e:b0:1c8:b870:4e62 with SMTP id a14-20020a056870b30e00b001c8b8704e62mr554127oao.52.1692901983111; Thu, 24 Aug 2023 11:33:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFNSmaNfEZS7WL931iN10lI15Wz+1s4J2mbWyoGTTDkdpLqrEtuCwFnkDMpqeyKk0MWFoSBXQ== X-Received: by 2002:a05:6870:b30e:b0:1c8:b870:4e62 with SMTP id a14-20020a056870b30e00b001c8b8704e62mr553945oao.52.1692901979913; Thu, 24 Aug 2023 11:32:59 -0700 (PDT) Received: from [192.168.1.165] ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id j17-20020a0ceb11000000b0064f77d37798sm4209qvp.5.2023.08.24.11.32.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Aug 2023 11:32:59 -0700 (PDT) From: Andrew Halaney Date: Thu, 24 Aug 2023 13:32:53 -0500 Subject: [PATCH net-next 2/7] net: stmmac: Use NSEC_PER_SEC for hwtstamp calculations MIME-Version: 1.0 Message-Id: <20230824-stmmac-subsecond-inc-cleanup-v1-2-e0b9f7c18b37@redhat.com> References: <20230824-stmmac-subsecond-inc-cleanup-v1-0-e0b9f7c18b37@redhat.com> In-Reply-To: <20230824-stmmac-subsecond-inc-cleanup-v1-0-e0b9f7c18b37@redhat.com> To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Richard Cochran Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Halaney X-Mailer: b4 0.12.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230824_113306_686466_112C3642 X-CRM114-Status: GOOD ( 11.65 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This makes it more clear what unit conversions are happening. Signed-off-by: Andrew Halaney --- drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 6 +++--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c index 6dcf8582a70e..29fd51bb853d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c @@ -36,12 +36,12 @@ static void config_sub_second_increment(void __iomem *ioaddr, * to mid-range = 2^31 when the remainder of this division is zero, * which will make the accumulator overflow once every 2 ptp_clock * cycles, adding twice the number of nanoseconds of a clock cycle : - * 2000000000ULL / ptp_clock. + * 2 * NSEC_PER_SEC / ptp_clock. */ if (value & PTP_TCR_TSCFUPDT) - data = (2000000000ULL / ptp_clock); + data = (2 * NSEC_PER_SEC / ptp_clock); else - data = (1000000000ULL / ptp_clock); + data = (NSEC_PER_SEC / ptp_clock); /* 0.465ns accuracy */ if (!(value & PTP_TCR_TSCTRLSSR)) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 67e4f65f0f68..ba38ca284e26 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -849,7 +849,7 @@ int stmmac_init_tstamp_counter(struct stmmac_priv *priv, u32 systime_flags) stmmac_config_sub_second_increment(priv, priv->ptpaddr, priv->plat->clk_ptp_rate, xmac, &sub_second_inc); - temp = div_u64(1000000000ULL, sub_second_inc); + temp = div_u64(NSEC_PER_SEC, sub_second_inc); /* Store sub second increment for later use */ priv->sub_second_inc = sub_second_inc; From patchwork Thu Aug 24 18:32:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 13364567 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 9D3D4C71153 for ; Thu, 24 Aug 2023 18:33:44 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Kra3t4uECcf1/wejT5kvBVmZhEnFtD0L7KY1FK+zXng=; b=Ft8oRHD+J6ZXIp czkYkdADVfzVjh09nmvpB9jRTzVDL7ZvgmxM53fg57k36hybzOHGbZ+LEwsqnvYhloiVf/43iy/hq ZF2tNCjmcjpOlefSe9s5HHfc4guII46GuOFjE3iICqfaryOJBOSFdYLD6a7OAf7J5cJ6HoEc8wwO9 aXX1f6zv1b8zcTrautHTBOqKvY584QtL7BU7cSLXIiabrLuZLO1xCH5jjU9xgutLgQMosuKJrKVXR yjg/iiEc0aXwE1hI0WfurGi7u3eNUMzowgxxF4UsfJGeQkbipJ6IrJWmFD1dGIbr9kex/hsjTDOXI Zf4UZwv17eKRCCqCzCOA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qZF8s-003b4G-0L; Thu, 24 Aug 2023 18:33:14 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qZF8k-003azW-0I for linux-arm-kernel@lists.infradead.org; Thu, 24 Aug 2023 18:33:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692901985; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6l23XMepM0Sh/iOcowpX76UCT+vWOCxLFJ6fQYXhTVo=; b=Dy13I8iJPaTM4lWWn+sbxKUR5XcbGONog4ORkwgbsjtaf39jkEA5stm0ttg1DM1oAx43zt rQwUHHq3eK79e5KFR/h66lXGkGq9GrgvVUzMzmyLdmzpdY8MeKrXWJ7LrEkIWaXya58ZPL TVGFgA/7wNmwp04se3AISQa52gyNCWc= Received: from mail-oa1-f69.google.com (mail-oa1-f69.google.com [209.85.160.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-680-HLo4HzyDMMqDdnXqOL1kYg-1; Thu, 24 Aug 2023 14:33:03 -0400 X-MC-Unique: HLo4HzyDMMqDdnXqOL1kYg-1 Received: by mail-oa1-f69.google.com with SMTP id 586e51a60fabf-1befca4fdfaso117739fac.2 for ; Thu, 24 Aug 2023 11:33:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692901983; x=1693506783; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6l23XMepM0Sh/iOcowpX76UCT+vWOCxLFJ6fQYXhTVo=; b=ekW0m4nKiHJ6mRu1wCXO0CUvYfFEAT/35GA3Ie9g+0hoH2hztmEvmB6O/EK6rrsyBZ EOelxi6/V/dmy5szhDgqqKVdIIv8GqUcT0WtaYsuw2UF8jI7W5V2oXZd9HRjJAZiW+O3 H2zSUayy+PUcfxf6zVdd308xFJh+JlFNTx8efREn755srfj7NgAyDsGSYRyq1MHKVT8N YciALfgsM5jr3fcNmYv3lKmc9pmHnsa2EHHKHgoiuBUtprC2VWAa8Op6drPJkZdzz/LE 47yia8FVj+VOK4Amge4kYp/BbqVDDM9quZgrLhP7Rl6gHHmm+Mj8od72tOHMmHefxw++ Ky3w== X-Gm-Message-State: AOJu0YyOScGeyhC+RnSdvGgUFWnSKDdFI/+qtt+oZBftpVZb2grvjb9t WsPeg0c4QU2oVruYe3563QtnHWRcfKupBzgdnWLyK0z/BzivVvhMLH0VhGeU7yJLwKYyTMp4oLQ xwCUpHZNuYvsRyk/+MpgTsfZcEMQvGxRHubA= X-Received: by 2002:a05:6870:e253:b0:1be:f8d9:7bdd with SMTP id d19-20020a056870e25300b001bef8d97bddmr627460oac.6.1692901983126; Thu, 24 Aug 2023 11:33:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHS3fEn/UFcZp7p1JhHHa0Wzb/ax2PIiQ32dL4ujO6wuTfaKPgzGkO+lp3kAWh66sAyZwY+xw== X-Received: by 2002:a05:6870:e253:b0:1be:f8d9:7bdd with SMTP id d19-20020a056870e25300b001bef8d97bddmr627359oac.6.1692901981225; Thu, 24 Aug 2023 11:33:01 -0700 (PDT) Received: from [192.168.1.165] ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id j17-20020a0ceb11000000b0064f77d37798sm4209qvp.5.2023.08.24.11.33.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Aug 2023 11:33:00 -0700 (PDT) From: Andrew Halaney Date: Thu, 24 Aug 2023 13:32:54 -0500 Subject: [PATCH net-next 3/7] net: stmmac: Precede entire addend calculation with its comment MIME-Version: 1.0 Message-Id: <20230824-stmmac-subsecond-inc-cleanup-v1-3-e0b9f7c18b37@redhat.com> References: <20230824-stmmac-subsecond-inc-cleanup-v1-0-e0b9f7c18b37@redhat.com> In-Reply-To: <20230824-stmmac-subsecond-inc-cleanup-v1-0-e0b9f7c18b37@redhat.com> To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Richard Cochran Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Halaney X-Mailer: b4 0.12.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230824_113306_205646_6B1C74C9 X-CRM114-Status: GOOD ( 12.02 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The addend calculation is currently split. The variable to be programmed is first altered, then a comment explaining the full calculation is seen, then the variable is altered further before the calculation is finished. Make the comment the first thing read. This makes the conversion of sub_second_increment from nanoseconds to hertz much easier to understand and reads logically. Signed-off-by: Andrew Halaney --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index ba38ca284e26..f0e585e6ef76 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -849,7 +849,6 @@ int stmmac_init_tstamp_counter(struct stmmac_priv *priv, u32 systime_flags) stmmac_config_sub_second_increment(priv, priv->ptpaddr, priv->plat->clk_ptp_rate, xmac, &sub_second_inc); - temp = div_u64(NSEC_PER_SEC, sub_second_inc); /* Store sub second increment for later use */ priv->sub_second_inc = sub_second_inc; @@ -859,6 +858,7 @@ int stmmac_init_tstamp_counter(struct stmmac_priv *priv, u32 systime_flags) * addend = (2^32)/freq_div_ratio; * where, freq_div_ratio = 1e9ns/sub_second_inc */ + temp = div_u64(NSEC_PER_SEC, sub_second_inc); temp = (u64)(temp << 32); priv->default_addend = div_u64(temp, priv->plat->clk_ptp_rate); stmmac_config_addend(priv, priv->ptpaddr, priv->default_addend); From patchwork Thu Aug 24 18:32:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 13364566 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 99681C7EE2C for ; Thu, 24 Aug 2023 18:33:45 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hw+AtdUI1Bcf8HPRxXw29bdNEVkO7f2je+b8188dw/U=; b=s9qVyxi2zVIHiG g7oBctuKDqD6bOG66XlZ76Zvos5I4s8BCKIz/HjmCxJ4irbRi5697MP3o0OfQSrwyX5Ng47ENi8+k 1yqo1Z+7gEAE9K/NRyxvG6umJXDocMRGaN+MjIJbbp5wYhWki9eKJ5db2bVVlBPJC1XGsUhN4Z2R5 2f7AWc6LBpYO3iXJe9xxvYZmHqT4DKDrC6lIjFkBnRuv+kTsG5fzGSt/6VeP63mYQ9B14CEVwTFS6 0u2a+tubBBZnP7dDd4A/mw0EejRzn2Q5fBa5sGB3xtBIabecaNcsgU8Rx2FqpVZcU49jyPrP+rUd/ phvmOfJt5rrO3ka60iwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qZF8t-003b5S-2q; Thu, 24 Aug 2023 18:33:15 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qZF8l-003b0j-1T for linux-arm-kernel@lists.infradead.org; Thu, 24 Aug 2023 18:33:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692901986; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XQSvh9slhSAVrK9RWa2tfsuNvxEUSp0MXiAFYeXPuAw=; b=IhuyK+5N1qpU0uAJsDRNSr6Ycf1HqM8s3wtHbZscAIkmL9lJzDjRzWy57GSf8bQSnsS4WL EQKruUcoUI1JC/TFi96CeQpcWKfMaOIaJPUr4bn4p8x4ycA0q382Bm9CSkCHlk1lwM/NwW eJuFCDSMvtFrwxLtwlbnJj6AXC/CPMk= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-670-fN3fY0h6Nqq3kRgWFrFASQ-1; Thu, 24 Aug 2023 14:33:03 -0400 X-MC-Unique: fN3fY0h6Nqq3kRgWFrFASQ-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-64a5264b91eso1512966d6.1 for ; Thu, 24 Aug 2023 11:33:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692901982; x=1693506782; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XQSvh9slhSAVrK9RWa2tfsuNvxEUSp0MXiAFYeXPuAw=; b=PLoSOYheQRya8AxHZDdpv3HOYQy+p3YifqXa8vzVsKmnk3F1ORM8qGcHlykL9aZxuY sQU+2CZ8PQY3fX3cyaQ7eWEEzlSgrbU7OfC8+e9U1EVAeOKeWcWC8vdQ1dhvgRxXCdNs /3VcVOnpf7+y1cAXtttu6XgHhI3SpuE8Mpm8Wj56CWT7x/nnr/s71O9OBRWJYvquUTIi sn/OKq8HGZcSIs6JgeJP4eX6voCVzc31Uh+4hFG5oDrlkdH54KlgRg8eZUn18n7U+N4q WoLvGMW/k0RmnaaOaJCHJ6IRNsj0Be9l9ht6pyrvUNtdDnzQpLIBKXljfEcuDGsYh+eE KvKw== X-Gm-Message-State: AOJu0Ywh1prqFL7D6igpyVisiYyT45r3J4IUJMfjuNfiMRqTwJ9/Wl0g OiCmAbmurhtN5uvOJ/Hhy5o1HhLqz3eqQIkLGrDT7op1AAr8Ktj11gJFVOBt6l3wyxN7NRRGkbe rk7k0sjr8DvA0OmEF8FRAAlGKCcOuioM16fk= X-Received: by 2002:a0c:a99b:0:b0:63a:5ebc:6e7a with SMTP id a27-20020a0ca99b000000b0063a5ebc6e7amr15574223qvb.31.1692901982710; Thu, 24 Aug 2023 11:33:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFj5ZJm6hpe0krNTRRf2s5iyapXzQ1FpiG0EpY/VpNEjLrDgHOUR63fuY3Iw6CLeMnPKpjAVQ== X-Received: by 2002:a0c:a99b:0:b0:63a:5ebc:6e7a with SMTP id a27-20020a0ca99b000000b0063a5ebc6e7amr15574200qvb.31.1692901982497; Thu, 24 Aug 2023 11:33:02 -0700 (PDT) Received: from [192.168.1.165] ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id j17-20020a0ceb11000000b0064f77d37798sm4209qvp.5.2023.08.24.11.33.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Aug 2023 11:33:02 -0700 (PDT) From: Andrew Halaney Date: Thu, 24 Aug 2023 13:32:55 -0500 Subject: [PATCH net-next 4/7] net: stmmac: Remove a pointless cast MIME-Version: 1.0 Message-Id: <20230824-stmmac-subsecond-inc-cleanup-v1-4-e0b9f7c18b37@redhat.com> References: <20230824-stmmac-subsecond-inc-cleanup-v1-0-e0b9f7c18b37@redhat.com> In-Reply-To: <20230824-stmmac-subsecond-inc-cleanup-v1-0-e0b9f7c18b37@redhat.com> To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Richard Cochran Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Halaney X-Mailer: b4 0.12.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230824_113307_564853_B5DA9015 X-CRM114-Status: GOOD ( 11.24 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The type is already u64, there's no reason to cast it again. Signed-off-by: Andrew Halaney --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index f0e585e6ef76..20ef068b3e6b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -859,7 +859,7 @@ int stmmac_init_tstamp_counter(struct stmmac_priv *priv, u32 systime_flags) * where, freq_div_ratio = 1e9ns/sub_second_inc */ temp = div_u64(NSEC_PER_SEC, sub_second_inc); - temp = (u64)(temp << 32); + temp = temp << 32; priv->default_addend = div_u64(temp, priv->plat->clk_ptp_rate); stmmac_config_addend(priv, priv->ptpaddr, priv->default_addend); From patchwork Thu Aug 24 18:32:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 13364569 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 DDB85C6FA8F for ; Thu, 24 Aug 2023 18:33:47 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CZZ7cdvEqd6JJRg6Ferok2cqsl9+aJYQD0TAvs5/kLk=; b=nqA49foI/+NbrC w1aUoIwjOg6EaLMT2wk5GLmo5mcMhQMjOmh4d39fZMiTsuEsm7gKxgZRjxRyVUem+438oh2eKvfiF 4NfFBtJsj+RF2J+ScAFKEl8iIN7vZLna4FmK15OzNeeSaNq7hh+MjFXkT1QXeLWemFMNrHIeybPms btpYotRYRTVUR63kRsUMjhAWm2O2HFpszIMn2se0dD8ck3AKa1bp+BWgQrnKsB/ULTX1Vt8B3ErsZ OTgByejOPEaPkeyQFbpyFe9b2S2EC/1zMQWujE50P68uhHzu94Ac2asMquq7l+7HBKOe8JqwEz/03 hh8mMQcS2Z2FjmS7kXqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qZF8t-003b56-0v; Thu, 24 Aug 2023 18:33:15 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qZF8k-003b0R-2l for linux-arm-kernel@lists.infradead.org; Thu, 24 Aug 2023 18:33:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692901986; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kLlThC3R9OImoZ+MRsaHGOa2SVCnd5iJ51KhprNayB4=; b=VDxrOLOquTvM3Ira8HvBBKz1/e+ymoKoCLt2OYq5aiOmEBxJhlp3svO7qE3EjISsnFjaoG Pdl0ZGv8PFTyTRgZTHGKoz8VU/x7UXH22YuGmj/sbHLLTyG28mx0MJ6J70ppVoZRAjgTbI 6Uu2jpnH/VEJ4mSBex998l984eNz7os= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-694-hJZ7QlLEMBezK_h7fntthQ-1; Thu, 24 Aug 2023 14:33:04 -0400 X-MC-Unique: hJZ7QlLEMBezK_h7fntthQ-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-6491907dba4so2022866d6.1 for ; Thu, 24 Aug 2023 11:33:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692901984; x=1693506784; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kLlThC3R9OImoZ+MRsaHGOa2SVCnd5iJ51KhprNayB4=; b=GOMnCANoc8UTfJt3R9XdIMJzIqYmqI/e/Ksup8ynw7pCSru1dVoopEx9Pztgrozy1c MHrIQdk+JqY4YqxrPnMzSiu1gQzOjCXOSoUJU1iWxHuKUbS/jEQlYACYYfNL2O1x0WO8 EecjTI9pNMosRSOlsLKKaUO7D2V0N9Ix+qFAapn8Dx0pseV7z7A/E2DpurQ/gLXCTKR8 5ojLhayYiGiPF3UE8hmyu+4dzLbmCNTbpnoliMdgHc+8XbZDMI6zb38AMhVVQD4IKWwL mKtQGKFzTZDI+ap4wAyUr6KsGu4PGMtjQsL1E2dIA6YIX8mgg1hqvCABUcXdBXHAkiVz IBFA== X-Gm-Message-State: AOJu0Yw3GigSjwupDTFMv1mF3gYwBVnQjmpkjPkubkCbA+qPLcfBckmZ 66pErRgj/W0nmo/oxXAW+XXe1lNRok0lJEJZrKd3aWwHhxkrV6BT7hUw5MyD+Ajc7hQfUS2Ui06 Z+oVCTp11b/VwAmME90MbqIraWyLwjigYsesKI+eHDXA= X-Received: by 2002:a05:6214:ac9:b0:64b:926a:e7fc with SMTP id g9-20020a0562140ac900b0064b926ae7fcmr19233931qvi.21.1692901984163; Thu, 24 Aug 2023 11:33:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG/pC6Ozwx0rjBhGbBoQuQPKXeDRWWo7/yf47bHb2XuaionNEwEaUXyApPQsLo9pKSgtTNXGg== X-Received: by 2002:a05:6214:ac9:b0:64b:926a:e7fc with SMTP id g9-20020a0562140ac900b0064b926ae7fcmr19233915qvi.21.1692901983920; Thu, 24 Aug 2023 11:33:03 -0700 (PDT) Received: from [192.168.1.165] ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id j17-20020a0ceb11000000b0064f77d37798sm4209qvp.5.2023.08.24.11.33.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Aug 2023 11:33:03 -0700 (PDT) From: Andrew Halaney Date: Thu, 24 Aug 2023 13:32:56 -0500 Subject: [PATCH net-next 5/7] net: stmmac: Correct addend typo MIME-Version: 1.0 Message-Id: <20230824-stmmac-subsecond-inc-cleanup-v1-5-e0b9f7c18b37@redhat.com> References: <20230824-stmmac-subsecond-inc-cleanup-v1-0-e0b9f7c18b37@redhat.com> In-Reply-To: <20230824-stmmac-subsecond-inc-cleanup-v1-0-e0b9f7c18b37@redhat.com> To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Richard Cochran Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Halaney X-Mailer: b4 0.12.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230824_113306_969213_9E5E5D29 X-CRM114-Status: GOOD ( 11.12 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org added should be addend in this context. Signed-off-by: Andrew Halaney --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 20ef068b3e6b..dfead0df6163 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -853,7 +853,7 @@ int stmmac_init_tstamp_counter(struct stmmac_priv *priv, u32 systime_flags) /* Store sub second increment for later use */ priv->sub_second_inc = sub_second_inc; - /* calculate default added value: + /* calculate default addend value: * formula is : * addend = (2^32)/freq_div_ratio; * where, freq_div_ratio = 1e9ns/sub_second_inc From patchwork Thu Aug 24 18:32:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 13364568 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 733B6C7EE43 for ; Thu, 24 Aug 2023 18:33:45 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=g0cazTvDNc5kIxdfcg7hf8p5AOSgrLfHlscJIaZyn3k=; b=yCWFYrUGzgKFb2 5eQIgMopYjcpF+OJCqYDz8DhDLh7dztF3lY5jaLsQbNMvkujTqzDZZgLncO2SY6r17q+w43E9AGhJ uU3GXgL0wDLcvQk6x4pXK2T7Rq7mxdoglPTPh3uHIWD/ZsP8la7X27vfpUlqta6A62rLe4+qLZLxW LJC8cP/WWp8IDy+UtacM740Q8gDGo6YgHA8kRM8aPJodAlcWwAGdNTz1MwK1oy166s3CNxMMSh/9I BSr+lQBhG2qwhO7GGVLziC8F0In5VtIsa4kMH44YU8dLSVwGTX/TwfIYL+pVMG+/UyMvMrhx/YrSm DaGDWFq8jlCsBHGyVH9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qZF8v-003b6Y-09; Thu, 24 Aug 2023 18:33:17 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qZF8o-003b2d-1l for linux-arm-kernel@lists.infradead.org; Thu, 24 Aug 2023 18:33:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692901989; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZLXDxLfpL9zLoWLRxApVYve11hS/OEKZe5Jy4SYblss=; b=aLRx+n8cZsg8Y5kBbDjJOigGQTihY9ZoijkeAmnoI8/J8rD4yE9ShBat9RUL1i9Gt8MVD2 vhNXrcsdXLVcFjYVXZehdVcm74upXEkqNQoWxjBoMLZ8dqlppyjD3CYogWb3ZpL0i/sEqy DUYKTtrl/+VuD96biR/MaU7nbgRycd4= Received: from mail-oa1-f69.google.com (mail-oa1-f69.google.com [209.85.160.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-131-Lrfno-h-OWmA05P-M3e9KQ-1; Thu, 24 Aug 2023 14:33:06 -0400 X-MC-Unique: Lrfno-h-OWmA05P-M3e9KQ-1 Received: by mail-oa1-f69.google.com with SMTP id 586e51a60fabf-1bf2e81ce17so122800fac.0 for ; Thu, 24 Aug 2023 11:33:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692901985; x=1693506785; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZLXDxLfpL9zLoWLRxApVYve11hS/OEKZe5Jy4SYblss=; b=ld4uBimon07R7xZ9AiBURUM6Yx9MDf1FDvD5XKYHo+H6QcDOsPVhMu8/zzCJ9eno3L jjpSdT7+FvxQ10Aby8gulzbcnK2VmeW4MQpXnNi1oJA4VAry+Grv5RGFYonsKfzNRhac nn0+M0qF2A8HUP/uJM6xeR/Z3fvxeQ7AHTcaetHuFAHzu4Pmp6B8wHj8DmHiTSO4DiQ2 En7J4c2wQl+xrHX3l+8WRW+sjF/t3kv+PlECKgNNclS4oZIxO9FWdpDviz66sQFgEV34 v/F3UgouXIiya+WgRh3I6oYJnIAaXOb7wb+TKusNlFB6KFhNThCcVRnxkAW5LyFjAQGP YXrw== X-Gm-Message-State: AOJu0YzV2FiD+knW/E/Pz01ZrjtPJb0+dBcH7bNVqXlu6R3Gn4r25zIr e/lwVKqKmsgE14sqcLnL6aV0kIQFmRl+0Bxo8fRk7xDIXX5C0JdyjoS1nlaOMsg/wHIZDqWX5G1 X1rKL9wkosf8RAjweg0Ws6SrgyHCMC+Mpc04= X-Received: by 2002:a05:6871:299:b0:1b4:60b3:98bc with SMTP id i25-20020a056871029900b001b460b398bcmr646677oae.2.1692901985290; Thu, 24 Aug 2023 11:33:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFbJca0VCeTskNWvGHD1H3TewlM9C3a0yafFFNkx3PrLHoWuGVt7iXKwhjuSJvnGG6tkI3pdg== X-Received: by 2002:a05:6871:299:b0:1b4:60b3:98bc with SMTP id i25-20020a056871029900b001b460b398bcmr646661oae.2.1692901985092; Thu, 24 Aug 2023 11:33:05 -0700 (PDT) Received: from [192.168.1.165] ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id j17-20020a0ceb11000000b0064f77d37798sm4209qvp.5.2023.08.24.11.33.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Aug 2023 11:33:04 -0700 (PDT) From: Andrew Halaney Date: Thu, 24 Aug 2023 13:32:57 -0500 Subject: [PATCH net-next 6/7] net: stmmac: Fix comment about default addend calculation MIME-Version: 1.0 Message-Id: <20230824-stmmac-subsecond-inc-cleanup-v1-6-e0b9f7c18b37@redhat.com> References: <20230824-stmmac-subsecond-inc-cleanup-v1-0-e0b9f7c18b37@redhat.com> In-Reply-To: <20230824-stmmac-subsecond-inc-cleanup-v1-0-e0b9f7c18b37@redhat.com> To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Richard Cochran Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Halaney X-Mailer: b4 0.12.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230824_113310_655233_92CC2FCC X-CRM114-Status: GOOD ( 10.68 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The comment neglects that freq_div_ratio is the ratio between the subsecond increment frequency and the clk_ptp_rate frequency. Signed-off-by: Andrew Halaney --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index dfead0df6163..64185753865f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -853,10 +853,12 @@ int stmmac_init_tstamp_counter(struct stmmac_priv *priv, u32 systime_flags) /* Store sub second increment for later use */ priv->sub_second_inc = sub_second_inc; - /* calculate default addend value: - * formula is : - * addend = (2^32)/freq_div_ratio; - * where, freq_div_ratio = 1e9ns/sub_second_inc + /* Calculate default addend so the accumulator overflows (2^32) in + * sub_second_inc (ns). The addend is added to the accumulator + * every clk_ptp cycle. + * + * addend = (2^32) / freq_div_ratio + * where, freq_div_ratio = (1e9ns / sub_second_inc) / clk_ptp_rate */ temp = div_u64(NSEC_PER_SEC, sub_second_inc); temp = temp << 32; From patchwork Thu Aug 24 18:32:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 13364570 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 64272C3DA6F for ; Thu, 24 Aug 2023 18:33:49 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+oQ0PMmRDil8EwgSHmGQ3Z1qQXgiAnasJ6ounta5Yvo=; b=s9e1N7C7vfqSa+ g08qQgJJSv31AmoNGbyAdyClJBLZ0B6hRsOby6ifjZqIs8Jy5wz6PDUeajw+0C2Y95/uyQA48KYpY d42PCbsenM1+2nXAkF9IjJaF7D8Wf+lyHeGlORKZpfDWaRaViuFAnPmB+eoD/1riUAowYPLsAhGzd b29afQCW9pSveQlqc6A/X5pe1AoW/Fw6ozve+t4+RYZU4weu9KPW4pEgM0kRclMz/wZIn9sNHHbJb /CmxB7/5JW+tVivW2bhGb2kUhfkJpWZ6b6CGWWXmgg+BJ7P0Ea+9gqtq6bF92hL9/a110bd8YXH+1 F9+ouA+dj1VUI0xmsiZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qZF8u-003b5r-1V; Thu, 24 Aug 2023 18:33:16 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qZF8o-003b2Y-0g for linux-arm-kernel@lists.infradead.org; Thu, 24 Aug 2023 18:33:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692901989; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qzwAY3qfQtSXBG/JoTJUgqmvExN/Fjeet/g8tdk5k1I=; b=QliQ2zoGRBjpcBJenrG8k56JQFxpHAQzxYL05F2leZsy2S1ErAzixP6FD/q+swCZRnosbU 4oXrYaHOxwCSZAd2tDHFu9JLOlQ/HpCi0zVZujUxR0igtztEHc+p8/+Wvb1xfWmTJDFTKl l/Jcy2mhw75JTLovHJDGy5hzr4mQlEM= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-661-DhQWgfBGP8OdtG_cT9mIIg-1; Thu, 24 Aug 2023 14:33:07 -0400 X-MC-Unique: DhQWgfBGP8OdtG_cT9mIIg-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-62de65b3a5bso1324026d6.2 for ; Thu, 24 Aug 2023 11:33:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692901987; x=1693506787; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qzwAY3qfQtSXBG/JoTJUgqmvExN/Fjeet/g8tdk5k1I=; b=F4MNHj/vr0qH+rOMLmujfiTX6vd2crefvF9c/rV1cIwoq6wlr09UXTt6doX4WPkxvo ua5ISz4hkPL1z/w8d8McVWOnGw3xajE8zHpbqJvJxQIA62Ii3jjEVKof/bmYZM9dFQqh VySAo6gchWiHpvrIH5thtSX+75qqIJvVNThsI/OQ59eVicbF2CbziJRPN55eYLIzwB39 l+N748OUF0Nb6Brctp7Se16g7jyHEz4vAI+XpUvFV8RNWaW2IP+SdPOhODEUl9ciRUkE LulLmxDTjTC4Hhs9LvoxmG6YUiBvR9RIL1TEyzCJCDLdHaK9qsxqT1YEMUyDMio7/Lc6 dL1w== X-Gm-Message-State: AOJu0YxjaE5AYXdg84xPznD8myjHtjCHGRYkQ24TktjoxwrmVVWjUQdC xaOBSO7AlDWFYhlptqapsCJL51j13VxUK+tjm5E6fxEf1NpSIZYb5iIfAjjf9Q5/WrdiLX0C0Yz 0cYD7Gse865+Opu4FE7xwWtxgf1kyaJeR57A= X-Received: by 2002:a0c:cb8a:0:b0:64b:997f:5a73 with SMTP id p10-20020a0ccb8a000000b0064b997f5a73mr17312063qvk.0.1692901986874; Thu, 24 Aug 2023 11:33:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH0V6Mej9o119R+pmyxj+YFe+lm4pgu3DlavB9TMY9jyVspWXod0xr56aTpa4++K5uMfm7xpg== X-Received: by 2002:a0c:cb8a:0:b0:64b:997f:5a73 with SMTP id p10-20020a0ccb8a000000b0064b997f5a73mr17312048qvk.0.1692901986627; Thu, 24 Aug 2023 11:33:06 -0700 (PDT) Received: from [192.168.1.165] ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id j17-20020a0ceb11000000b0064f77d37798sm4209qvp.5.2023.08.24.11.33.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Aug 2023 11:33:06 -0700 (PDT) From: Andrew Halaney Date: Thu, 24 Aug 2023 13:32:58 -0500 Subject: [PATCH net-next 7/7] net: stmmac: Make PTP reference clock references more clear MIME-Version: 1.0 Message-Id: <20230824-stmmac-subsecond-inc-cleanup-v1-7-e0b9f7c18b37@redhat.com> References: <20230824-stmmac-subsecond-inc-cleanup-v1-0-e0b9f7c18b37@redhat.com> In-Reply-To: <20230824-stmmac-subsecond-inc-cleanup-v1-0-e0b9f7c18b37@redhat.com> To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Richard Cochran Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Halaney X-Mailer: b4 0.12.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230824_113310_317472_C791E198 X-CRM114-Status: GOOD ( 14.85 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org ptp_clock is an overloaded term, and in some instances it is used to represent the clk_ptp_rate variable. Just use that name as it is clear that it represents the rate of the PTP reference clock. Signed-off-by: Andrew Halaney --- drivers/net/ethernet/stmicro/stmmac/hwif.h | 5 +++-- drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index bd607da65037..ba92b10cff0e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -523,8 +523,9 @@ struct stmmac_ops { /* PTP and HW Timer helpers */ struct stmmac_hwtimestamp { void (*config_hw_tstamping) (void __iomem *ioaddr, u32 data); - void (*config_sub_second_increment)(void __iomem *ioaddr, u32 ptp_clock, - int gmac4, u32 *sub_second_inc); + void (*config_sub_second_increment)(void __iomem *ioaddr, + u32 clk_ptp_rate, + int gmac4, u32 *sub_second_inc); int (*init_systime) (void __iomem *ioaddr, u32 sec, u32 nsec); int (*config_addend) (void __iomem *ioaddr, u32 addend); int (*adjust_systime) (void __iomem *ioaddr, u32 sec, u32 nsec, diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c index 29fd51bb853d..cc0386ee6dee 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c @@ -24,7 +24,7 @@ static void config_hw_tstamping(void __iomem *ioaddr, u32 data) } static void config_sub_second_increment(void __iomem *ioaddr, - u32 ptp_clock, int gmac4, u32 *sub_second_inc) + u32 clk_ptp_rate, int gmac4, u32 *sub_second_inc) { u32 value = readl(ioaddr + PTP_TCR); unsigned long data; @@ -34,14 +34,14 @@ static void config_sub_second_increment(void __iomem *ioaddr, * increment to twice the number of nanoseconds of a clock cycle. * The calculation of the default_addend value by the caller will set it * to mid-range = 2^31 when the remainder of this division is zero, - * which will make the accumulator overflow once every 2 ptp_clock + * which will make the accumulator overflow once every 2 clk_ptp_rate * cycles, adding twice the number of nanoseconds of a clock cycle : - * 2 * NSEC_PER_SEC / ptp_clock. + * 2 * NSEC_PER_SEC / clk_ptp_rate. */ if (value & PTP_TCR_TSCFUPDT) - data = (2 * NSEC_PER_SEC / ptp_clock); + data = (2 * NSEC_PER_SEC / clk_ptp_rate); else - data = (NSEC_PER_SEC / ptp_clock); + data = (NSEC_PER_SEC / clk_ptp_rate); /* 0.465ns accuracy */ if (!(value & PTP_TCR_TSCTRLSSR))