Skip to content

Commit 4614792

Browse files
grygoriySkuba-moo
authored andcommitted
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: 8a2c9a5 ("net: ethernet: ti: cpts: rework initialization/deinitialization") Signed-off-by: Grygorii Strashko <[email protected]> Acked-by: Richard Cochran <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 5ff3fda commit 4614792

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/ethernet/ti/cpts.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ void cpts_unregister(struct cpts *cpts)
599599

600600
ptp_clock_unregister(cpts->clock);
601601
cpts->clock = NULL;
602+
cpts->phc_index = -1;
602603

603604
cpts_write32(cpts, 0, int_enable);
604605
cpts_write32(cpts, 0, control);
@@ -784,6 +785,7 @@ struct cpts *cpts_create(struct device *dev, void __iomem *regs,
784785
cpts->cc.read = cpts_systim_read;
785786
cpts->cc.mask = CLOCKSOURCE_MASK(32);
786787
cpts->info = cpts_info;
788+
cpts->phc_index = -1;
787789

788790
if (n_ext_ts)
789791
cpts->info.n_ext_ts = n_ext_ts;

0 commit comments

Comments
 (0)