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))