From 0899e4aa2a41b66c2ff465c8fdfb86f2f2954d71 Mon Sep 17 00:00:00 2001 From: "Wayne Wang(SW-TEGRA)" Date: Mon, 18 Oct 2021 13:56:53 +0800 Subject: net: eqos: ethtool: resolve the fixed ptp clock issue When using ethtool to determine which ptp clock is register to the eqos. It will always report ptp0. And it may not be true. This causes issues when using ptp4l as the clocks do not line up with the interfaces. Bug 3392620 Change-Id: I97192952817dadea9ce795cff548e97d2cd65477 Signed-off-by: Wayne Wang(SW-TEGRA) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2612151 Reviewed-by: Sushil Kumar Singh Reviewed-by: Bibek Basu Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- drivers/net/ethernet/nvidia/eqos/ethtool.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/nvidia/eqos/ethtool.c b/drivers/net/ethernet/nvidia/eqos/ethtool.c index e692c54a8..83c5013bd 100644 --- a/drivers/net/ethernet/nvidia/eqos/ethtool.c +++ b/drivers/net/ethernet/nvidia/eqos/ethtool.c @@ -276,13 +276,20 @@ static const struct eqos_stats eqos_mmc[] = { static int eqos_get_ts_info(struct net_device *net, struct ethtool_ts_info *info) { + struct eqos_prv_data *pdata = netdev_priv(net); + info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE | SOF_TIMESTAMPING_RX_SOFTWARE | SOF_TIMESTAMPING_SOFTWARE | SOF_TIMESTAMPING_TX_HARDWARE | SOF_TIMESTAMPING_RX_HARDWARE | SOF_TIMESTAMPING_RAW_HARDWARE; - info->phc_index = 0; + + if (pdata && pdata->ptp_clock) + info->phc_index = ptp_clock_index(pdata->ptp_clock); + else + info->phc_index = -1; + info->tx_types = (1 << HWTSTAMP_TX_OFF) | (1 << HWTSTAMP_TX_ON); -- cgit v1.2.2