Skip to content

Commit 0bfd0af

Browse files
minimaxwellkuba-moo
authored andcommitted
net: stmmac: Only update the auto-discovered PTP clock features
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. Reviewed-by: Daniel Machon <[email protected]> Signed-off-by: Maxime Chevallier <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 13e9088 commit 0bfd0af

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,14 @@ void stmmac_ptp_register(struct stmmac_priv *priv)
303303
if (priv->plat->has_gmac4 && priv->plat->clk_ptp_rate)
304304
priv->plat->cdc_error_adj = (2 * NSEC_PER_SEC) / priv->plat->clk_ptp_rate;
305305

306-
priv->ptp_clock_ops.n_per_out = priv->dma_cap.pps_out_num;
307-
priv->ptp_clock_ops.n_ext_ts = priv->dma_cap.aux_snapshot_n;
306+
/* Update the ptp clock parameters based on feature discovery, when
307+
* available
308+
*/
309+
if (priv->dma_cap.pps_out_num)
310+
priv->ptp_clock_ops.n_per_out = priv->dma_cap.pps_out_num;
311+
312+
if (priv->dma_cap.aux_snapshot_n)
313+
priv->ptp_clock_ops.n_ext_ts = priv->dma_cap.aux_snapshot_n;
308314

309315
if (priv->plat->ptp_max_adj)
310316
priv->ptp_clock_ops.max_adj = priv->plat->ptp_max_adj;

0 commit comments

Comments
 (0)