@@ -1089,34 +1089,6 @@ void igb_ptp_init(struct igb_adapter *adapter)
10891089
10901090 wrfl ();
10911091
1092- spin_lock_init (& adapter -> tmreg_lock );
1093- INIT_WORK (& adapter -> ptp_tx_work , igb_ptp_tx_work );
1094-
1095- /* Initialize the clock and overflow work for devices that need it. */
1096- if ((hw -> mac .type == e1000_i210 ) || (hw -> mac .type == e1000_i211 )) {
1097- struct timespec64 ts = ktime_to_timespec64 (ktime_get_real ());
1098-
1099- igb_ptp_settime_i210 (& adapter -> ptp_caps , & ts );
1100- } else {
1101- timecounter_init (& adapter -> tc , & adapter -> cc ,
1102- ktime_to_ns (ktime_get_real ()));
1103-
1104- INIT_DELAYED_WORK (& adapter -> ptp_overflow_work ,
1105- igb_ptp_overflow_check );
1106-
1107- schedule_delayed_work (& adapter -> ptp_overflow_work ,
1108- IGB_SYSTIM_OVERFLOW_PERIOD );
1109- }
1110-
1111- /* Initialize the time sync interrupts for devices that support it. */
1112- if (hw -> mac .type >= e1000_82580 ) {
1113- wr32 (E1000_TSIM , TSYNC_INTERRUPTS );
1114- wr32 (E1000_IMS , E1000_IMS_TS );
1115- }
1116-
1117- adapter -> tstamp_config .rx_filter = HWTSTAMP_FILTER_NONE ;
1118- adapter -> tstamp_config .tx_type = HWTSTAMP_TX_OFF ;
1119-
11201092 adapter -> ptp_clock = ptp_clock_register (& adapter -> ptp_caps ,
11211093 & adapter -> pdev -> dev );
11221094 if (IS_ERR (adapter -> ptp_clock )) {
@@ -1126,6 +1098,34 @@ void igb_ptp_init(struct igb_adapter *adapter)
11261098 dev_info (& adapter -> pdev -> dev , "added PHC on %s\n" ,
11271099 adapter -> netdev -> name );
11281100 adapter -> flags |= IGB_FLAG_PTP ;
1101+
1102+ spin_lock_init (& adapter -> tmreg_lock );
1103+ INIT_WORK (& adapter -> ptp_tx_work , igb_ptp_tx_work );
1104+
1105+ /* Initialize the clock and overflow work for devices that need it. */
1106+ if ((hw -> mac .type == e1000_i210 ) || (hw -> mac .type == e1000_i211 )) {
1107+ struct timespec64 ts = ktime_to_timespec64 (ktime_get_real ());
1108+
1109+ igb_ptp_settime_i210 (& adapter -> ptp_caps , & ts );
1110+ } else {
1111+ timecounter_init (& adapter -> tc , & adapter -> cc ,
1112+ ktime_to_ns (ktime_get_real ()));
1113+
1114+ INIT_DELAYED_WORK (& adapter -> ptp_overflow_work ,
1115+ igb_ptp_overflow_check );
1116+
1117+ schedule_delayed_work (& adapter -> ptp_overflow_work ,
1118+ IGB_SYSTIM_OVERFLOW_PERIOD );
1119+ }
1120+
1121+ /* Initialize the time sync interrupts for devices that support it. */
1122+ if (hw -> mac .type >= e1000_82580 ) {
1123+ wr32 (E1000_TSIM , TSYNC_INTERRUPTS );
1124+ wr32 (E1000_IMS , E1000_IMS_TS );
1125+ }
1126+
1127+ adapter -> tstamp_config .rx_filter = HWTSTAMP_FILTER_NONE ;
1128+ adapter -> tstamp_config .tx_type = HWTSTAMP_TX_OFF ;
11291129 }
11301130}
11311131
0 commit comments