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;