Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5885778rwb; Tue, 1 Aug 2023 09:10:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlEKFFsTq3e59a0f74o/L5at+FQdjXSeAtUeRF8JTkfNMArYVFK6h4ch+bJgpJfVnc2YhPvV X-Received: by 2002:a17:902:b198:b0:1bb:d70b:dff9 with SMTP id s24-20020a170902b19800b001bbd70bdff9mr9812987plr.18.1690906202117; Tue, 01 Aug 2023 09:10:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690906202; cv=none; d=google.com; s=arc-20160816; b=bcNUlhEytzwb8CHmzqyESEXt/iqZexWckVt973pExOIEcrdD3onXVyoKsDi8pQkd67 CndI7G5tafXyjIE7LdOkBJf8gxldAw3TvLdaSCHVkAocx+TeAhhHlkFA90mRrK1yLSAL w91fapJjNt/6G/CQexyhC8ANPJ++GaR701u3Gkwto0nzSAaamI1rDe07qUgVIjZD4cBT KBKY/PniFHX+/3sUbmvp2XR4amQqaSmvvTaODweRdMcqT83gssJOsuoDBjqT0Ecp2bBY DJu6g1ATgsXSxHrkTHQHKwCpuqtKmdyWHv7/BWMlVYZ5kAOpaTg/sbFQG11z7nRdTsWU NZYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from; bh=B0rA6XhNJ954VA8V2Px8Ra71CFB7/syczgbxY/evgAo=; fh=H1TX2Vtyu/duQ0CFAoQsM9ai+HHftWqo1OLzTPwIqhM=; b=J4xGnlwFDaKIIZDi0BtUufYRnyv3i3THxT2xzEeF8Ek7p2xSMWe4VdVhL7WdaEEouU OxQP99PaK69pPE4WYg/XTMWyLVWBuJXn4LG0ZbdpBzJST96IQd4hNuTklcWXFOZ6ouPt tFbIhBbS5MQeS6RdMXZVrQ+qCG+Zxdyn1RwQc06PjlS0cxpqeGqUyYIqMdzjJyfJ7Nhq zjJBgcheNGwadFQYH9yzNsii2q+yW/JVUGjHr2E4/YVDzirgHIP9Vp4kwV9Xi33Cb1kL 2uicIcXecg1mu5VKgEWEH13rR+VvcbAaEIB9uW5lkvft6sJOPzdQ8vpq4HNtbg5M9SHG qzVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a170902e80600b001b892a54d89si9506556plg.629.2023.08.01.09.09.43; Tue, 01 Aug 2023 09:10:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234984AbjHAPpY (ORCPT + 99 others); Tue, 1 Aug 2023 11:45:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234948AbjHAPpT (ORCPT ); Tue, 1 Aug 2023 11:45:19 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD949FD for ; Tue, 1 Aug 2023 08:45:17 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qQrY8-0003zK-QC; Tue, 01 Aug 2023 17:44:40 +0200 Received: from [2a0a:edc0:0:1101:1d::39] (helo=dude03.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1qQrY5-000Q2g-5s; Tue, 01 Aug 2023 17:44:37 +0200 Received: from localhost ([::1] helo=dude03.red.stw.pengutronix.de) by dude03.red.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1qQrY4-00Bf3I-6O; Tue, 01 Aug 2023 17:44:36 +0200 From: Johannes Zink Date: Tue, 01 Aug 2023 17:44:30 +0200 Subject: [PATCH v3 2/2] net: stmmac: dwmac-imx: enable MAC propagation delay correction for i.MX8MP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230719-stmmac_correct_mac_delay-v3-2-61e63427735e@pengutronix.de> References: <20230719-stmmac_correct_mac_delay-v3-0-61e63427735e@pengutronix.de> In-Reply-To: <20230719-stmmac_correct_mac_delay-v3-0-61e63427735e@pengutronix.de> To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Richard Cochran , Russell King Cc: patchwork-jzi@pengutronix.de, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Kurt Kanzenbach , kernel test robot , Johannes Zink X-Mailer: b4 0.12.2 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: j.zink@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As the i.MX8MP supports reading MAC propagation delay and correcting the Hardware timestamp counter for additional delays [1], enable the feature for this SoC. This reduces phase error of the PPS output from the PTP Hardware Clock from approx 150ns to 100ns. [1] i.MX8MP Reference Manual, rev.1 Section 11.7.2.5.3 "Timestamp correction" Signed-off-by: Johannes Zink --- drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c index 92e06a96757a..645a9454a490 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c @@ -42,6 +42,7 @@ struct imx_dwmac_ops { u32 addr_width; + u32 flags; bool mac_rgmii_txclk_auto_adj; int (*fix_soc_reset)(void *priv, void __iomem *ioaddr); @@ -311,6 +312,9 @@ static int imx_dwmac_probe(struct platform_device *pdev) goto err_parse_dt; } + if (data->flags & STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY) + plat_dat->flags |= STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY; + plat_dat->host_dma_width = dwmac->ops->addr_width; plat_dat->init = imx_dwmac_init; plat_dat->exit = imx_dwmac_exit; @@ -350,6 +354,7 @@ static struct imx_dwmac_ops imx8mp_dwmac_data = { .addr_width = 34, .mac_rgmii_txclk_auto_adj = false, .set_intf_mode = imx8mp_set_intf_mode, + .flags = STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY, }; static struct imx_dwmac_ops imx8dxl_dwmac_data = { -- 2.39.2