net: ethernet: renesas: rcar_gen4_ptp: Add helper to get clock index

Instead of accessing the Gen4 PTP specific structure directly in drivers
add a helper to read the clock index. 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-3-niklas.soderlund+renesas@ragnatech.se
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Niklas Söderlund 2026-02-01 19:37:43 +01:00 committed by Jakub Kicinski
parent 642377346a
commit 9afe65e7e7
4 changed files with 13 additions and 2 deletions

View File

@ -185,6 +185,15 @@ struct rcar_gen4_ptp_private *rcar_gen4_ptp_alloc(struct platform_device *pdev,
}
EXPORT_SYMBOL_GPL(rcar_gen4_ptp_alloc);
int rcar_gen4_ptp_clock_index(struct rcar_gen4_ptp_private *priv)
{
if (!priv->initialized)
return -1;
return ptp_clock_index(priv->clock);
}
EXPORT_SYMBOL_GPL(rcar_gen4_ptp_clock_index);
MODULE_AUTHOR("Yoshihiro Shimoda");
MODULE_DESCRIPTION("Renesas R-Car Gen4 gPTP driver");
MODULE_LICENSE("GPL");

View File

@ -23,4 +23,6 @@ int rcar_gen4_ptp_unregister(struct rcar_gen4_ptp_private *ptp_priv);
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);
#endif /* #ifndef __RCAR_GEN4_PTP_H__ */

View File

@ -1891,7 +1891,7 @@ static int rswitch_get_ts_info(struct net_device *ndev, struct kernel_ethtool_ts
{
struct rswitch_device *rdev = netdev_priv(ndev);
info->phc_index = ptp_clock_index(rdev->priv->ptp_priv->clock);
info->phc_index = rcar_gen4_ptp_clock_index(rdev->priv->ptp_priv);
info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |
SOF_TIMESTAMPING_TX_HARDWARE |
SOF_TIMESTAMPING_RX_HARDWARE |

View File

@ -1197,7 +1197,7 @@ static int rtsn_get_ts_info(struct net_device *ndev,
{
struct rtsn_private *priv = netdev_priv(ndev);
info->phc_index = ptp_clock_index(priv->ptp_priv->clock);
info->phc_index = rcar_gen4_ptp_clock_index(priv->ptp_priv);
info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |
SOF_TIMESTAMPING_TX_HARDWARE |
SOF_TIMESTAMPING_RX_HARDWARE |