From patchwork Wed Nov 6 09:03:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Chevallier X-Patchwork-Id: 13864189 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 3C75CD3E78C for ; Wed, 6 Nov 2024 09:16:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NkGxMlPDNP8jSIw5T0tZvfBvg6tLoLPlBAwO+v2kSjk=; b=jm26JHYM+LCQpwS5FRyqzB5JXK /xg52WkERt2mftKAUyXYF2XAODnyLNfyT3oTCxTSgG9TVnMJ+p81MLgI0BjfsIDkP26DKa5mSyX7M qAGYVTJG7NxazcT4bf47rgyWSd/J5yY+VeXs+3WassQ+3JWjm2CdcVLJlUUmCcXP0VEvHPZkmAlA6 7A5rNcxfjnMblwNEL5ZRAUlDELiQG3nAtBUZ5Q7vnkZ37TSOkdTAL6b9vI2CvD655wUKcZdKZhjMp wjZ+6i2n4+9KbxXlKjOWNrmz81XuBHHiAvH5LyMJmCu8odSlJ+qR2T9mrdgy/s7wmhEfZEcn6nj/X B7aAjzvg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t8c99-00000002SnY-16aJ; Wed, 06 Nov 2024 09:16:15 +0000 Received: from relay6-d.mail.gandi.net ([2001:4b98:dc4:8::226]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t8bwx-00000002OS5-2Hqy for linux-arm-kernel@lists.infradead.org; Wed, 06 Nov 2024 09:03:41 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 3F107C000F; Wed, 6 Nov 2024 09:03:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1730883818; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NkGxMlPDNP8jSIw5T0tZvfBvg6tLoLPlBAwO+v2kSjk=; b=CD8znPWuyklEx5hX2MW1sCNG4NJxsDPL3l3qOm2dfkRMd2qpyAKOZncIzrCt/sIcl1kwNf vQXtWNilwUZkDeO20MqK1dGat5MCvm83zpOeKUGP/vDVZ8PyydviSjZBix3WxcMhQQ1bW3 v6ua8iNs5TH+vIoUEFJvUAzJRkRR2OY/NtoZ/hP7e22Xv5rm6pdwXJVSEAoXHOV9C+Rrl8 FVC4Eo4WRs92PK6bf9M668BcCa91mpQeHnxpiQiKbrQnL3OYNQLvUF9SV9vXOy4zkDsUXg v0DP9L5GtWOPYYyXNmwe1HiXnijcM4oiXmRUG3bXV1uFiACkoByiS3pP6yvPEA== From: Maxime Chevallier To: Alexandre Torgue , Jose Abreu , Andrew Lunn , davem@davemloft.net, Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Richard Cochran Cc: Maxime Chevallier , =?utf-8?q?Alexis_Loth?= =?utf-8?q?or=C3=A9?= , Thomas Petazzoni , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v3 3/9] net: stmmac: Only update the auto-discovered PTP clock features Date: Wed, 6 Nov 2024 10:03:24 +0100 Message-ID: <20241106090331.56519-4-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241106090331.56519-1-maxime.chevallier@bootlin.com> References: <20241106090331.56519-1-maxime.chevallier@bootlin.com> MIME-Version: 1.0 X-GND-Sasl: maxime.chevallier@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241106_010339_788141_A3B50E8D X-CRM114-Status: GOOD ( 12.50 ) 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 Some DWMAC variants such as dwmac1000 don't support discovering the number of output pps and auxiliary snapshots. Allow these parameters to be defined in default ptp_clock_info, and let them be updated only when the feature discovery yielded a result. Signed-off-by: Maxime Chevallier --- drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c index 41581f516ea9..8ea2b4226234 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c @@ -303,8 +303,14 @@ void stmmac_ptp_register(struct stmmac_priv *priv) if (priv->plat->has_gmac4 && priv->plat->clk_ptp_rate) priv->plat->cdc_error_adj = (2 * NSEC_PER_SEC) / priv->plat->clk_ptp_rate; - priv->ptp_clock_ops.n_per_out = priv->dma_cap.pps_out_num; - priv->ptp_clock_ops.n_ext_ts = priv->dma_cap.aux_snapshot_n; + /* Update the ptp clock parameters based on feature discovery, when + * available + */ + if (priv->dma_cap.pps_out_num) + priv->ptp_clock_ops.n_per_out = priv->dma_cap.pps_out_num; + + if (priv->dma_cap.aux_snapshot_n) + priv->ptp_clock_ops.n_ext_ts = priv->dma_cap.aux_snapshot_n; if (priv->plat->ptp_max_adj) priv->ptp_clock_ops.max_adj = priv->plat->ptp_max_adj;