diff options
author | Grygorii Strashko <grygorii.strashko@ti.com> | 2020-12-24 18:24:05 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-12-28 13:32:34 -0800 |
commit | 4614792eebcbf81c60ad3604c1aeeb2b0899cea4 (patch) | |
tree | 021179a47711a66b7afaec858b327b343c5fed28 | |
parent | 5ff3fda971ae6c5a0d884dc9ff8780e89536fb72 (diff) | |
download | linux-stable-4614792eebcbf81c60ad3604c1aeeb2b0899cea4.tar.gz linux-stable-4614792eebcbf81c60ad3604c1aeeb2b0899cea4.tar.bz2 linux-stable-4614792eebcbf81c60ad3604c1aeeb2b0899cea4.zip |
net: ethernet: ti: cpts: fix ethtool output when no ptp_clock registered
The CPTS driver registers PTP PHC clock when first netif is going up and
unregister it when all netif are down. Now ethtool will show:
- PTP PHC clock index 0 after boot until first netif is up;
- the last assigned PTP PHC clock index even if PTP PHC clock is not
registered any more after all netifs are down.
This patch ensures that -1 is returned by ethtool when PTP PHC clock is not
registered any more.
Fixes: 8a2c9a5ab4b9 ("net: ethernet: ti: cpts: rework initialization/deinitialization")
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Link: https://lore.kernel.org/r/20201224162405.28032-1-grygorii.strashko@ti.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r-- | drivers/net/ethernet/ti/cpts.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c index d1fc7955d422..43222a34cba0 100644 --- a/drivers/net/ethernet/ti/cpts.c +++ b/drivers/net/ethernet/ti/cpts.c @@ -599,6 +599,7 @@ void cpts_unregister(struct cpts *cpts) ptp_clock_unregister(cpts->clock); cpts->clock = NULL; + cpts->phc_index = -1; cpts_write32(cpts, 0, int_enable); cpts_write32(cpts, 0, control); @@ -784,6 +785,7 @@ struct cpts *cpts_create(struct device *dev, void __iomem *regs, cpts->cc.read = cpts_systim_read; cpts->cc.mask = CLOCKSOURCE_MASK(32); cpts->info = cpts_info; + cpts->phc_index = -1; if (n_ext_ts) cpts->info.n_ext_ts = n_ext_ts; |