]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: ethernet: renesas: rcar_gen4_ptp: Add helper to read time
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Sun, 1 Feb 2026 18:37:44 +0000 (19:37 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 4 Feb 2026 03:35:38 +0000 (19:35 -0800)
Instead of accessing the Gen4 PTP specific structure directly in drivers
add a helper to read the time. This is done in preparation to
completely hide the Gen4 PTP specific structure from users.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Link: https://patch.msgid.link/20260201183745.1075399-4-niklas.soderlund+renesas@ragnatech.se
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/renesas/rcar_gen4_ptp.c
drivers/net/ethernet/renesas/rcar_gen4_ptp.h
drivers/net/ethernet/renesas/rtsn.c

index 75bf7aac089bc4cca6ed579bfc3cc91e4dabce00..a14a16cf5fe6ef666332a54b9195dc5733b42bb3 100644 (file)
@@ -194,6 +194,16 @@ int rcar_gen4_ptp_clock_index(struct rcar_gen4_ptp_private *priv)
 }
 EXPORT_SYMBOL_GPL(rcar_gen4_ptp_clock_index);
 
+void rcar_gen4_ptp_gettime64(struct rcar_gen4_ptp_private *priv,
+                            struct timespec64 *ts)
+{
+       if (!priv->initialized)
+               return;
+
+       priv->info.gettime64(&priv->info, ts);
+}
+EXPORT_SYMBOL_GPL(rcar_gen4_ptp_gettime64);
+
 MODULE_AUTHOR("Yoshihiro Shimoda");
 MODULE_DESCRIPTION("Renesas R-Car Gen4 gPTP driver");
 MODULE_LICENSE("GPL");
index c141cd38a40d663bdf1e15ec40b3df01b1cc1c50..fffccda401f56271c61fca16533a35bd9341238f 100644 (file)
@@ -24,5 +24,7 @@ struct rcar_gen4_ptp_private *rcar_gen4_ptp_alloc(struct platform_device *pdev,
                                                  void __iomem *addr);
 
 int rcar_gen4_ptp_clock_index(struct rcar_gen4_ptp_private *priv);
+void rcar_gen4_ptp_gettime64(struct rcar_gen4_ptp_private *priv,
+                            struct timespec64 *ts);
 
 #endif /* #ifndef __RCAR_GEN4_PTP_H__ */
index ce1047743970c26fdbf6d3a88d49a7c214f9c005..85052b47afb9d67ae90cf3aa8cd2131f1d7f56ba 100644 (file)
@@ -104,13 +104,6 @@ static void rtsn_ctrl_data_irq(struct rtsn_private *priv, bool enable)
        }
 }
 
-static void rtsn_get_timestamp(struct rtsn_private *priv, struct timespec64 *ts)
-{
-       struct rcar_gen4_ptp_private *ptp_priv = priv->ptp_priv;
-
-       ptp_priv->info.gettime64(&ptp_priv->info, ts);
-}
-
 static int rtsn_tx_free(struct net_device *ndev, bool free_txed_only)
 {
        struct rtsn_private *priv = netdev_priv(ndev);
@@ -133,7 +126,7 @@ static int rtsn_tx_free(struct net_device *ndev, bool free_txed_only)
                                struct skb_shared_hwtstamps shhwtstamps;
                                struct timespec64 ts;
 
-                               rtsn_get_timestamp(priv, &ts);
+                               rcar_gen4_ptp_gettime64(priv->ptp_priv, &ts);
                                memset(&shhwtstamps, 0, sizeof(shhwtstamps));
                                shhwtstamps.hwtstamp = timespec64_to_ktime(ts);
                                skb_tstamp_tx(skb, &shhwtstamps);