@@ -22,7 +22,7 @@ static void ice_set_tx_tstamp(struct ice_pf *pf, bool on)
22
22
return ;
23
23
24
24
/* Set the timestamp enable flag for all the Tx rings */
25
- ice_for_each_rxq (vsi , i ) {
25
+ ice_for_each_txq (vsi , i ) {
26
26
if (!vsi -> tx_rings [i ])
27
27
continue ;
28
28
vsi -> tx_rings [i ]-> ptp_tx = on ;
@@ -688,6 +688,41 @@ static int ice_ptp_cfg_clkout(struct ice_pf *pf, unsigned int chan,
688
688
return - EFAULT ;
689
689
}
690
690
691
+ /**
692
+ * ice_ptp_disable_all_clkout - Disable all currently configured outputs
693
+ * @pf: pointer to the PF structure
694
+ *
695
+ * Disable all currently configured clock outputs. This is necessary before
696
+ * certain changes to the PTP hardware clock. Use ice_ptp_enable_all_clkout to
697
+ * re-enable the clocks again.
698
+ */
699
+ static void ice_ptp_disable_all_clkout (struct ice_pf * pf )
700
+ {
701
+ uint i ;
702
+
703
+ for (i = 0 ; i < pf -> ptp .info .n_per_out ; i ++ )
704
+ if (pf -> ptp .perout_channels [i ].ena )
705
+ ice_ptp_cfg_clkout (pf , i , NULL , false);
706
+ }
707
+
708
+ /**
709
+ * ice_ptp_enable_all_clkout - Enable all configured periodic clock outputs
710
+ * @pf: pointer to the PF structure
711
+ *
712
+ * Enable all currently configured clock outputs. Use this after
713
+ * ice_ptp_disable_all_clkout to reconfigure the output signals according to
714
+ * their configuration.
715
+ */
716
+ static void ice_ptp_enable_all_clkout (struct ice_pf * pf )
717
+ {
718
+ uint i ;
719
+
720
+ for (i = 0 ; i < pf -> ptp .info .n_per_out ; i ++ )
721
+ if (pf -> ptp .perout_channels [i ].ena )
722
+ ice_ptp_cfg_clkout (pf , i , & pf -> ptp .perout_channels [i ],
723
+ false);
724
+ }
725
+
691
726
/**
692
727
* ice_ptp_gpio_enable_e810 - Enable/disable ancillary features of PHC
693
728
* @info: the driver's PTP info structure
@@ -783,12 +818,17 @@ ice_ptp_settime64(struct ptp_clock_info *info, const struct timespec64 *ts)
783
818
goto exit ;
784
819
}
785
820
821
+ /* Disable periodic outputs */
822
+ ice_ptp_disable_all_clkout (pf );
823
+
786
824
err = ice_ptp_write_init (pf , & ts64 );
787
825
ice_ptp_unlock (hw );
788
826
789
827
if (!err )
790
828
ice_ptp_update_cached_phctime (pf );
791
829
830
+ /* Reenable periodic outputs */
831
+ ice_ptp_enable_all_clkout (pf );
792
832
exit :
793
833
if (err ) {
794
834
dev_err (ice_pf_to_dev (pf ), "PTP failed to set time %d\n" , err );
@@ -842,8 +882,14 @@ static int ice_ptp_adjtime(struct ptp_clock_info *info, s64 delta)
842
882
return - EBUSY ;
843
883
}
844
884
885
+ /* Disable periodic outputs */
886
+ ice_ptp_disable_all_clkout (pf );
887
+
845
888
err = ice_ptp_write_adj (pf , delta );
846
889
890
+ /* Reenable periodic outputs */
891
+ ice_ptp_enable_all_clkout (pf );
892
+
847
893
ice_ptp_unlock (hw );
848
894
849
895
if (err ) {
@@ -1064,17 +1110,6 @@ static long ice_ptp_create_clock(struct ice_pf *pf)
1064
1110
info = & pf -> ptp .info ;
1065
1111
dev = ice_pf_to_dev (pf );
1066
1112
1067
- /* Allocate memory for kernel pins interface */
1068
- if (info -> n_pins ) {
1069
- info -> pin_config = devm_kcalloc (dev , info -> n_pins ,
1070
- sizeof (* info -> pin_config ),
1071
- GFP_KERNEL );
1072
- if (!info -> pin_config ) {
1073
- info -> n_pins = 0 ;
1074
- return - ENOMEM ;
1075
- }
1076
- }
1077
-
1078
1113
/* Attempt to register the clock before enabling the hardware. */
1079
1114
clock = ptp_clock_register (info , dev );
1080
1115
if (IS_ERR (clock ))
@@ -1278,6 +1313,8 @@ ice_ptp_flush_tx_tracker(struct ice_pf *pf, struct ice_ptp_tx *tx)
1278
1313
{
1279
1314
u8 idx ;
1280
1315
1316
+ spin_lock (& tx -> lock );
1317
+
1281
1318
for (idx = 0 ; idx < tx -> len ; idx ++ ) {
1282
1319
u8 phy_idx = idx + tx -> quad_offset ;
1283
1320
@@ -1290,6 +1327,8 @@ ice_ptp_flush_tx_tracker(struct ice_pf *pf, struct ice_ptp_tx *tx)
1290
1327
tx -> tstamps [idx ].skb = NULL ;
1291
1328
}
1292
1329
}
1330
+
1331
+ spin_unlock (& tx -> lock );
1293
1332
}
1294
1333
1295
1334
/**
@@ -1550,6 +1589,9 @@ void ice_ptp_release(struct ice_pf *pf)
1550
1589
if (!pf -> ptp .clock )
1551
1590
return ;
1552
1591
1592
+ /* Disable periodic outputs */
1593
+ ice_ptp_disable_all_clkout (pf );
1594
+
1553
1595
ice_clear_ptp_clock_index (pf );
1554
1596
ptp_clock_unregister (pf -> ptp .clock );
1555
1597
pf -> ptp .clock = NULL ;
0 commit comments