diff mbox series

[net-next,5/8] net: stmmac: set number of snapshot external triggers for GMAC3

Message ID 20230616100409.164583-6-alexis.lothore@bootlin.com (mailing list archive)
State New, archived
Headers show
Series net: stmmac: enable timestamp snapshots for DWMAC1000 | expand

Commit Message

Alexis Lothoré June 16, 2023, 10:04 a.m. UTC
From: Alexis Lothoré <alexis.lothore@bootlin.com>

While GMAC4 exposes number of available auxiliary snapshots inputs in
MAC_HW_FEATURE2 register, GMAC3 (DWMAC1000) does not expose this
information in its only hardware feature register.
When running on GMAC3, hardcode the value to 1 to allow external trigger
usage

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
index 167bfbf68911..090a9d803446 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
@@ -280,7 +280,10 @@  void stmmac_ptp_register(struct stmmac_priv *priv)
 		priv->plat->cdc_error_adj = (2 * NSEC_PER_SEC) / priv->plat->clk_ptp_rate;
 
 	stmmac_ptp_clock_ops.n_per_out = priv->dma_cap.pps_out_num;
-	stmmac_ptp_clock_ops.n_ext_ts = priv->dma_cap.aux_snapshot_n;
+	/* Number of available external triggers is not provided through a
+	 * hardware capabilities register for GMAC3
+	 */
+	stmmac_ptp_clock_ops.n_ext_ts = priv->plat->has_gmac ? 1 : priv->dma_cap.aux_snapshot_n;
 
 	rwlock_init(&priv->ptp_lock);
 	mutex_init(&priv->aux_ts_lock);