From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Alexandre Torgue <alexandre.torgue@foss.st.com>,
Jose Abreu <joabreu@synopsys.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
davem@davemloft.net, Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Richard Cochran <richardcochran@gmail.com>
Cc: "Maxime Chevallier" <maxime.chevallier@bootlin.com>,
"Alexis Lothoré" <alexis.lothore@bootlin.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
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 3/7] net: stmmac: Only update the auto-discovered PTP clock features
Date: Tue, 29 Oct 2024 12:54:11 +0100 [thread overview]
Message-ID: <20241029115419.1160201-4-maxime.chevallier@bootlin.com> (raw)
In-Reply-To: <20241029115419.1160201-1-maxime.chevallier@bootlin.com>
Some DWMAC variants such as dwmac1000 don't support disovering 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 <maxime.chevallier@bootlin.com>
---
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;
--
2.47.0
next prev parent reply other threads:[~2024-10-29 12:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-29 11:54 [PATCH net-next 0/7] Support external snapshots on dwmac1000 Maxime Chevallier
2024-10-29 11:54 ` [PATCH net-next 1/7] net: stmmac: Don't modify the global ptp ops directly Maxime Chevallier
2024-10-29 11:54 ` [PATCH net-next 2/7] net: stmmac: Use per-hw ptp clock ops Maxime Chevallier
2024-10-29 11:54 ` Maxime Chevallier [this message]
2024-10-29 12:50 ` [PATCH net-next 3/7] net: stmmac: Only update the auto-discovered PTP clock features Alexis Lothoré
2024-10-29 11:54 ` [PATCH net-next 4/7] net: stmmac: Introduce dwmac1000 ptp_clock_info and operations Maxime Chevallier
2024-10-29 11:54 ` [PATCH net-next 5/7] net: stmmac: Introduce dwmac1000 timestamping operations Maxime Chevallier
2024-10-29 11:54 ` [PATCH net-next 6/7] net: stmmac: Enable timestamping interrupt on dwmac1000 Maxime Chevallier
2024-10-29 11:54 ` [PATCH net-next 7/7] net: stmmac: Don't include dwmac4 definitions in stmmac_ptp Maxime Chevallier
2024-10-29 14:45 ` [PATCH net-next 0/7] Support external snapshots on dwmac1000 Alexis Lothoré
2024-10-29 14:49 ` Maxime Chevallier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241029115419.1160201-4-maxime.chevallier@bootlin.com \
--to=maxime.chevallier@bootlin.com \
--cc=alexandre.torgue@foss.st.com \
--cc=alexis.lothore@bootlin.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=joabreu@synopsys.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox