Lines Matching +full:scaled +full:- +full:sync
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 1999 - 2018 Intel Corporation. */
30 * Period * [ 2 ^ ( MaxWidth - PeriodWidth ) ]
47 * +--------------+ +--------------+
49 * *--------------+ +--------------+
52 * +--------------+ +--------------+
54 * *--------------+ +--------------+
58 * 2^36 * 10^-9 / 60 = 1.14 minutes or 69 seconds
61 * 2^43 * 10^-9 / 3600 = 2.4 hours
89 * represents units of 2^-32 nanoseconds, and uses 31 bits for this, with the
97 * +--------------+ +--------------+ +-------------+
99 * *--------------+ +--------------+ +-------------+
100 * \____seconds___/ \_nanoseconds_/ \__2^-32 ns__/
112 * the base frequency. It is measured in 2^-32 ns units, with the high bit being
128 * For the X550, the Max adjustment is +/- 0.5 ns, and the base frequency is
133 * Because TIMINCA is measured in 2^-32 ns units, we have to convert 12.5 ns
134 * into 2^-32 units, which is
163 struct cyclecounter *cc = &adapter->hw_cc; in ixgbe_ptp_setup_sdp_X540()
164 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_setup_sdp_X540()
173 if (!(adapter->flags2 & IXGBE_FLAG2_PTP_PPS_ENABLED)) in ixgbe_ptp_setup_sdp_X540()
194 clock_period = div_u64((NS_PER_HALF_SEC << cc->shift), cc->mult); in ixgbe_ptp_setup_sdp_X540()
199 spin_lock_irqsave(&adapter->tmreg_lock, flags); in ixgbe_ptp_setup_sdp_X540()
200 ns = timecounter_read(&adapter->hw_tc); in ixgbe_ptp_setup_sdp_X540()
201 clock_edge = adapter->hw_tc.cycle_last; in ixgbe_ptp_setup_sdp_X540()
202 spin_unlock_irqrestore(&adapter->tmreg_lock, flags); in ixgbe_ptp_setup_sdp_X540()
210 rem = (NS_PER_SEC - rem); in ixgbe_ptp_setup_sdp_X540()
213 clock_edge += div_u64(((u64)rem << cc->shift), cc->mult); in ixgbe_ptp_setup_sdp_X540()
243 struct cyclecounter *cc = &adapter->hw_cc; in ixgbe_ptp_setup_sdp_X550()
244 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_setup_sdp_X550()
253 if (!(adapter->flags2 & IXGBE_FLAG2_PTP_PPS_ENABLED)) in ixgbe_ptp_setup_sdp_X550()
279 freqout = div_u64(NS_PER_HALF_SEC << cc->shift, cc->mult); in ixgbe_ptp_setup_sdp_X550()
282 spin_lock_irqsave(&adapter->tmreg_lock, flags); in ixgbe_ptp_setup_sdp_X550()
283 ns = timecounter_read(&adapter->hw_tc); in ixgbe_ptp_setup_sdp_X550()
284 clock_edge = adapter->hw_tc.cycle_last; in ixgbe_ptp_setup_sdp_X550()
285 spin_unlock_irqrestore(&adapter->tmreg_lock, flags); in ixgbe_ptp_setup_sdp_X550()
293 rem = (NS_PER_SEC - rem); in ixgbe_ptp_setup_sdp_X550()
296 clock_edge += div_u64(((u64)rem << cc->shift), cc->mult); in ixgbe_ptp_setup_sdp_X550()
321 * ixgbe_ptp_read_X550 - read cycle counter value
334 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_read_X550()
344 * non-bitmask field since we have to convert our billions of cycles in ixgbe_ptp_read_X550()
360 * ixgbe_ptp_read_82599 - read raw cycle counter (to be used by time counter)
371 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_read_82599()
381 * ixgbe_ptp_convert_to_hwtstamp - convert register value to hw timestamp
407 switch (adapter->hw.mac.type) { in ixgbe_ptp_convert_to_hwtstamp()
434 spin_lock_irqsave(&adapter->tmreg_lock, flags); in ixgbe_ptp_convert_to_hwtstamp()
435 ns = timecounter_cyc2time(&adapter->hw_tc, timestamp); in ixgbe_ptp_convert_to_hwtstamp()
436 spin_unlock_irqrestore(&adapter->tmreg_lock, flags); in ixgbe_ptp_convert_to_hwtstamp()
438 hwtstamp->hwtstamp = ns_to_ktime(ns); in ixgbe_ptp_convert_to_hwtstamp()
444 * @scaled_ppm: scaled parts per million adjustment from base
449 * Scaled parts per million is ppm with a 16-bit binary fractional field.
455 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_adjfine_82599()
459 incval = READ_ONCE(adapter->base_incval); in ixgbe_ptp_adjfine_82599()
462 switch (hw->mac.type) { in ixgbe_ptp_adjfine_82599()
485 * @scaled_ppm: scaled parts per million adjustment from base
490 * Scaled parts per million is ppm with a 16-bit binary fractional field.
496 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_adjfine_X550()
501 base = hw->mac.type == ixgbe_mac_e610 ? IXGBE_E610_BASE_PERIOD : in ixgbe_ptp_adjfine_X550()
531 spin_lock_irqsave(&adapter->tmreg_lock, flags); in ixgbe_ptp_adjtime()
532 timecounter_adjtime(&adapter->hw_tc, delta); in ixgbe_ptp_adjtime()
533 spin_unlock_irqrestore(&adapter->tmreg_lock, flags); in ixgbe_ptp_adjtime()
535 if (adapter->ptp_setup_sdp) in ixgbe_ptp_adjtime()
536 adapter->ptp_setup_sdp(adapter); in ixgbe_ptp_adjtime()
556 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_gettimex()
560 spin_lock_irqsave(&adapter->tmreg_lock, flags); in ixgbe_ptp_gettimex()
562 switch (adapter->hw.mac.type) { in ixgbe_ptp_gettimex()
575 ts->tv_nsec = IXGBE_READ_REG(hw, IXGBE_SYSTIML); in ixgbe_ptp_gettimex()
576 ts->tv_sec = IXGBE_READ_REG(hw, IXGBE_SYSTIMH); in ixgbe_ptp_gettimex()
587 ns = timecounter_cyc2time(&adapter->hw_tc, stamp); in ixgbe_ptp_gettimex()
589 spin_unlock_irqrestore(&adapter->tmreg_lock, flags); in ixgbe_ptp_gettimex()
613 spin_lock_irqsave(&adapter->tmreg_lock, flags); in ixgbe_ptp_settime()
614 timecounter_init(&adapter->hw_tc, &adapter->hw_cc, ns); in ixgbe_ptp_settime()
615 spin_unlock_irqrestore(&adapter->tmreg_lock, flags); in ixgbe_ptp_settime()
617 if (adapter->ptp_setup_sdp) in ixgbe_ptp_settime()
618 adapter->ptp_setup_sdp(adapter); in ixgbe_ptp_settime()
643 if (rq->type != PTP_CLK_REQ_PPS || !adapter->ptp_setup_sdp) in ixgbe_ptp_feature_enable()
644 return -ENOTSUPP; in ixgbe_ptp_feature_enable()
647 adapter->flags2 |= IXGBE_FLAG2_PTP_PPS_ENABLED; in ixgbe_ptp_feature_enable()
649 adapter->flags2 &= ~IXGBE_FLAG2_PTP_PPS_ENABLED; in ixgbe_ptp_feature_enable()
651 adapter->ptp_setup_sdp(adapter); in ixgbe_ptp_feature_enable()
664 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_check_pps_event()
673 if (!adapter->ptp_clock) in ixgbe_ptp_check_pps_event()
676 switch (hw->mac.type) { in ixgbe_ptp_check_pps_event()
678 ptp_clock_event(adapter->ptp_clock, &event); in ixgbe_ptp_check_pps_event()
686 * ixgbe_ptp_overflow_check - watchdog task to detect SYSTIME overflow
695 bool timeout = time_is_before_jiffies(adapter->last_overflow_check + in ixgbe_ptp_overflow_check()
701 spin_lock_irqsave(&adapter->tmreg_lock, flags); in ixgbe_ptp_overflow_check()
702 timecounter_read(&adapter->hw_tc); in ixgbe_ptp_overflow_check()
703 spin_unlock_irqrestore(&adapter->tmreg_lock, flags); in ixgbe_ptp_overflow_check()
705 adapter->last_overflow_check = jiffies; in ixgbe_ptp_overflow_check()
710 * ixgbe_ptp_rx_hang - detect error case when Rx timestamp registers latched
720 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_rx_hang()
730 adapter->last_rx_ptp_check = jiffies; in ixgbe_ptp_rx_hang()
735 rx_event = adapter->last_rx_ptp_check; in ixgbe_ptp_rx_hang()
736 for (n = 0; n < adapter->num_rx_queues; n++) { in ixgbe_ptp_rx_hang()
737 rx_ring = adapter->rx_ring[n]; in ixgbe_ptp_rx_hang()
738 if (time_after(rx_ring->last_rx_timestamp, rx_event)) in ixgbe_ptp_rx_hang()
739 rx_event = rx_ring->last_rx_timestamp; in ixgbe_ptp_rx_hang()
745 adapter->last_rx_ptp_check = jiffies; in ixgbe_ptp_rx_hang()
747 adapter->rx_hwtstamp_cleared++; in ixgbe_ptp_rx_hang()
753 * ixgbe_ptp_clear_tx_timestamp - utility function to clear Tx timestamp state
762 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_clear_tx_timestamp()
765 if (adapter->ptp_tx_skb) { in ixgbe_ptp_clear_tx_timestamp()
766 dev_kfree_skb_any(adapter->ptp_tx_skb); in ixgbe_ptp_clear_tx_timestamp()
767 adapter->ptp_tx_skb = NULL; in ixgbe_ptp_clear_tx_timestamp()
769 clear_bit_unlock(__IXGBE_PTP_TX_IN_PROGRESS, &adapter->state); in ixgbe_ptp_clear_tx_timestamp()
773 * ixgbe_ptp_tx_hang - detect error case where Tx timestamp never finishes
778 bool timeout = time_is_before_jiffies(adapter->ptp_tx_start + in ixgbe_ptp_tx_hang()
781 if (!adapter->ptp_tx_skb) in ixgbe_ptp_tx_hang()
784 if (!test_bit(__IXGBE_PTP_TX_IN_PROGRESS, &adapter->state)) in ixgbe_ptp_tx_hang()
792 cancel_work_sync(&adapter->ptp_tx_work); in ixgbe_ptp_tx_hang()
794 adapter->tx_hwtstamp_timeouts++; in ixgbe_ptp_tx_hang()
800 * ixgbe_ptp_tx_hwtstamp - utility function which checks for TX time stamp
809 struct sk_buff *skb = adapter->ptp_tx_skb; in ixgbe_ptp_tx_hwtstamp()
810 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_tx_hwtstamp()
823 adapter->ptp_tx_skb = NULL; in ixgbe_ptp_tx_hwtstamp()
824 clear_bit_unlock(__IXGBE_PTP_TX_IN_PROGRESS, &adapter->state); in ixgbe_ptp_tx_hwtstamp()
843 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_tx_hwtstamp_work()
844 bool timeout = time_is_before_jiffies(adapter->ptp_tx_start + in ixgbe_ptp_tx_hwtstamp_work()
849 if (!adapter->ptp_tx_skb) { in ixgbe_ptp_tx_hwtstamp_work()
863 adapter->tx_hwtstamp_timeouts++; in ixgbe_ptp_tx_hwtstamp_work()
867 schedule_work(&adapter->ptp_tx_work); in ixgbe_ptp_tx_hwtstamp_work()
872 * ixgbe_ptp_rx_pktstamp - utility function to get RX time stamp from buffer
886 skb_copy_bits(skb, skb->len - IXGBE_TS_HDR_LEN, ®val, in ixgbe_ptp_rx_pktstamp()
888 __pskb_trim(skb, skb->len - IXGBE_TS_HDR_LEN); in ixgbe_ptp_rx_pktstamp()
896 ixgbe_ptp_convert_to_hwtstamp(q_vector->adapter, skb_hwtstamps(skb), in ixgbe_ptp_rx_pktstamp()
901 * ixgbe_ptp_rx_rgtstamp - utility function which checks for RX time stamp
918 if (!q_vector || !q_vector->adapter) in ixgbe_ptp_rx_rgtstamp()
921 adapter = q_vector->adapter; in ixgbe_ptp_rx_rgtstamp()
922 hw = &adapter->hw; in ixgbe_ptp_rx_rgtstamp()
939 * ixgbe_ptp_get_ts_config - get current hardware timestamping configuration
949 struct hwtstamp_config *config = &adapter->tstamp_config; in ixgbe_ptp_get_ts_config()
951 return copy_to_user(ifr->ifr_data, config, in ixgbe_ptp_get_ts_config()
952 sizeof(*config)) ? -EFAULT : 0; in ixgbe_ptp_get_ts_config()
956 * ixgbe_ptp_set_timestamp_mode - setup the hardware for the requested mode
983 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_set_timestamp_mode()
987 u32 aflags = adapter->flags; in ixgbe_ptp_set_timestamp_mode()
991 switch (config->tx_type) { in ixgbe_ptp_set_timestamp_mode()
998 return -ERANGE; in ixgbe_ptp_set_timestamp_mode()
1001 switch (config->rx_filter) { in ixgbe_ptp_set_timestamp_mode()
1031 config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; in ixgbe_ptp_set_timestamp_mode()
1041 if (hw->mac.type >= ixgbe_mac_X550) { in ixgbe_ptp_set_timestamp_mode()
1043 config->rx_filter = HWTSTAMP_FILTER_ALL; in ixgbe_ptp_set_timestamp_mode()
1051 * therefore it is not possible to time stamp both V1 Sync and in ixgbe_ptp_set_timestamp_mode()
1055 config->rx_filter = HWTSTAMP_FILTER_NONE; in ixgbe_ptp_set_timestamp_mode()
1056 return -ERANGE; in ixgbe_ptp_set_timestamp_mode()
1059 if (hw->mac.type == ixgbe_mac_82598EB) { in ixgbe_ptp_set_timestamp_mode()
1060 adapter->flags &= ~(IXGBE_FLAG_RX_HWTSTAMP_ENABLED | in ixgbe_ptp_set_timestamp_mode()
1063 return -ERANGE; in ixgbe_ptp_set_timestamp_mode()
1067 /* Per-packet timestamping only works if the filter is set to all in ixgbe_ptp_set_timestamp_mode()
1071 switch (hw->mac.type) { in ixgbe_ptp_set_timestamp_mode()
1080 if (config->rx_filter == HWTSTAMP_FILTER_NONE) in ixgbe_ptp_set_timestamp_mode()
1086 config->rx_filter = HWTSTAMP_FILTER_ALL; in ixgbe_ptp_set_timestamp_mode()
1122 adapter->flags = aflags; in ixgbe_ptp_set_timestamp_mode()
1132 * ixgbe_ptp_set_ts_config - user entry point for timestamp mode
1144 if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) in ixgbe_ptp_set_ts_config()
1145 return -EFAULT; in ixgbe_ptp_set_ts_config()
1152 memcpy(&adapter->tstamp_config, &config, in ixgbe_ptp_set_ts_config()
1153 sizeof(adapter->tstamp_config)); in ixgbe_ptp_set_ts_config()
1155 return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? in ixgbe_ptp_set_ts_config()
1156 -EFAULT : 0; in ixgbe_ptp_set_ts_config()
1168 * to nanoseconds using only a multiplier and a right-shift, in ixgbe_ptp_link_speed_adjust()
1176 switch (adapter->link_speed) { in ixgbe_ptp_link_speed_adjust()
1194 * ixgbe_ptp_start_cyclecounter - create the cycle counter from hw
1205 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_start_cyclecounter()
1216 * they do not properly function if the overflow point isn't 2^N-1. in ixgbe_ptp_start_cyclecounter()
1226 switch (hw->mac.type) { in ixgbe_ptp_start_cyclecounter()
1256 cc.shift -= IXGBE_INCVAL_SHIFT_82599; in ixgbe_ptp_start_cyclecounter()
1266 WRITE_ONCE(adapter->base_incval, incval); in ixgbe_ptp_start_cyclecounter()
1270 spin_lock_irqsave(&adapter->tmreg_lock, flags); in ixgbe_ptp_start_cyclecounter()
1271 memcpy(&adapter->hw_cc, &cc, sizeof(adapter->hw_cc)); in ixgbe_ptp_start_cyclecounter()
1272 spin_unlock_irqrestore(&adapter->tmreg_lock, flags); in ixgbe_ptp_start_cyclecounter()
1276 * ixgbe_ptp_init_systime - Initialize SYSTIME registers
1283 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_init_systime()
1286 switch (hw->mac.type) { in ixgbe_ptp_init_systime()
1325 * function is used to re-enable the device for PTP based on current settings.
1334 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_reset()
1338 ixgbe_ptp_set_timestamp_mode(adapter, &adapter->tstamp_config); in ixgbe_ptp_reset()
1341 if (hw->mac.type == ixgbe_mac_82598EB) in ixgbe_ptp_reset()
1348 spin_lock_irqsave(&adapter->tmreg_lock, flags); in ixgbe_ptp_reset()
1349 timecounter_init(&adapter->hw_tc, &adapter->hw_cc, in ixgbe_ptp_reset()
1351 spin_unlock_irqrestore(&adapter->tmreg_lock, flags); in ixgbe_ptp_reset()
1353 adapter->last_overflow_check = jiffies; in ixgbe_ptp_reset()
1356 * registers reset, (re-)enable the Clock out feature in ixgbe_ptp_reset()
1358 if (adapter->ptp_setup_sdp) in ixgbe_ptp_reset()
1359 adapter->ptp_setup_sdp(adapter); in ixgbe_ptp_reset()
1367 * initializes the PTP clock device, which is used to access the clock-like
1374 struct net_device *netdev = adapter->netdev; in ixgbe_ptp_create_clock()
1378 if (!IS_ERR_OR_NULL(adapter->ptp_clock)) in ixgbe_ptp_create_clock()
1381 switch (adapter->hw.mac.type) { in ixgbe_ptp_create_clock()
1383 snprintf(adapter->ptp_caps.name, in ixgbe_ptp_create_clock()
1384 sizeof(adapter->ptp_caps.name), in ixgbe_ptp_create_clock()
1385 "%s", netdev->name); in ixgbe_ptp_create_clock()
1386 adapter->ptp_caps.owner = THIS_MODULE; in ixgbe_ptp_create_clock()
1387 adapter->ptp_caps.max_adj = 250000000; in ixgbe_ptp_create_clock()
1388 adapter->ptp_caps.n_alarm = 0; in ixgbe_ptp_create_clock()
1389 adapter->ptp_caps.n_ext_ts = 0; in ixgbe_ptp_create_clock()
1390 adapter->ptp_caps.n_per_out = 0; in ixgbe_ptp_create_clock()
1391 adapter->ptp_caps.pps = 1; in ixgbe_ptp_create_clock()
1392 adapter->ptp_caps.adjfine = ixgbe_ptp_adjfine_82599; in ixgbe_ptp_create_clock()
1393 adapter->ptp_caps.adjtime = ixgbe_ptp_adjtime; in ixgbe_ptp_create_clock()
1394 adapter->ptp_caps.gettimex64 = ixgbe_ptp_gettimex; in ixgbe_ptp_create_clock()
1395 adapter->ptp_caps.settime64 = ixgbe_ptp_settime; in ixgbe_ptp_create_clock()
1396 adapter->ptp_caps.enable = ixgbe_ptp_feature_enable; in ixgbe_ptp_create_clock()
1397 adapter->ptp_setup_sdp = ixgbe_ptp_setup_sdp_X540; in ixgbe_ptp_create_clock()
1400 snprintf(adapter->ptp_caps.name, in ixgbe_ptp_create_clock()
1401 sizeof(adapter->ptp_caps.name), in ixgbe_ptp_create_clock()
1402 "%s", netdev->name); in ixgbe_ptp_create_clock()
1403 adapter->ptp_caps.owner = THIS_MODULE; in ixgbe_ptp_create_clock()
1404 adapter->ptp_caps.max_adj = 250000000; in ixgbe_ptp_create_clock()
1405 adapter->ptp_caps.n_alarm = 0; in ixgbe_ptp_create_clock()
1406 adapter->ptp_caps.n_ext_ts = 0; in ixgbe_ptp_create_clock()
1407 adapter->ptp_caps.n_per_out = 0; in ixgbe_ptp_create_clock()
1408 adapter->ptp_caps.pps = 0; in ixgbe_ptp_create_clock()
1409 adapter->ptp_caps.adjfine = ixgbe_ptp_adjfine_82599; in ixgbe_ptp_create_clock()
1410 adapter->ptp_caps.adjtime = ixgbe_ptp_adjtime; in ixgbe_ptp_create_clock()
1411 adapter->ptp_caps.gettimex64 = ixgbe_ptp_gettimex; in ixgbe_ptp_create_clock()
1412 adapter->ptp_caps.settime64 = ixgbe_ptp_settime; in ixgbe_ptp_create_clock()
1413 adapter->ptp_caps.enable = ixgbe_ptp_feature_enable; in ixgbe_ptp_create_clock()
1419 snprintf(adapter->ptp_caps.name, 16, "%s", netdev->name); in ixgbe_ptp_create_clock()
1420 adapter->ptp_caps.owner = THIS_MODULE; in ixgbe_ptp_create_clock()
1421 adapter->ptp_caps.max_adj = 30000000; in ixgbe_ptp_create_clock()
1422 adapter->ptp_caps.n_alarm = 0; in ixgbe_ptp_create_clock()
1423 adapter->ptp_caps.n_ext_ts = 0; in ixgbe_ptp_create_clock()
1424 adapter->ptp_caps.n_per_out = 0; in ixgbe_ptp_create_clock()
1425 adapter->ptp_caps.pps = 1; in ixgbe_ptp_create_clock()
1426 adapter->ptp_caps.adjfine = ixgbe_ptp_adjfine_X550; in ixgbe_ptp_create_clock()
1427 adapter->ptp_caps.adjtime = ixgbe_ptp_adjtime; in ixgbe_ptp_create_clock()
1428 adapter->ptp_caps.gettimex64 = ixgbe_ptp_gettimex; in ixgbe_ptp_create_clock()
1429 adapter->ptp_caps.settime64 = ixgbe_ptp_settime; in ixgbe_ptp_create_clock()
1430 adapter->ptp_caps.enable = ixgbe_ptp_feature_enable; in ixgbe_ptp_create_clock()
1431 adapter->ptp_setup_sdp = ixgbe_ptp_setup_sdp_X550; in ixgbe_ptp_create_clock()
1434 adapter->ptp_clock = NULL; in ixgbe_ptp_create_clock()
1435 adapter->ptp_setup_sdp = NULL; in ixgbe_ptp_create_clock()
1436 return -EOPNOTSUPP; in ixgbe_ptp_create_clock()
1439 adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps, in ixgbe_ptp_create_clock()
1440 &adapter->pdev->dev); in ixgbe_ptp_create_clock()
1441 if (IS_ERR(adapter->ptp_clock)) { in ixgbe_ptp_create_clock()
1442 err = PTR_ERR(adapter->ptp_clock); in ixgbe_ptp_create_clock()
1443 adapter->ptp_clock = NULL; in ixgbe_ptp_create_clock()
1446 } else if (adapter->ptp_clock) in ixgbe_ptp_create_clock()
1447 e_dev_info("registered PHC device on %s\n", netdev->name); in ixgbe_ptp_create_clock()
1453 adapter->tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE; in ixgbe_ptp_create_clock()
1454 adapter->tstamp_config.tx_type = HWTSTAMP_TX_OFF; in ixgbe_ptp_create_clock()
1473 spin_lock_init(&adapter->tmreg_lock); in ixgbe_ptp_init()
1475 /* obtain a PTP device, or re-use an existing device */ in ixgbe_ptp_init()
1480 INIT_WORK(&adapter->ptp_tx_work, ixgbe_ptp_tx_hwtstamp_work); in ixgbe_ptp_init()
1486 set_bit(__IXGBE_PTP_RUNNING, &adapter->state); in ixgbe_ptp_init()
1492 * ixgbe_ptp_suspend - stop PTP work items
1501 if (!test_and_clear_bit(__IXGBE_PTP_RUNNING, &adapter->state)) in ixgbe_ptp_suspend()
1504 adapter->flags2 &= ~IXGBE_FLAG2_PTP_PPS_ENABLED; in ixgbe_ptp_suspend()
1505 if (adapter->ptp_setup_sdp) in ixgbe_ptp_suspend()
1506 adapter->ptp_setup_sdp(adapter); in ixgbe_ptp_suspend()
1509 cancel_work_sync(&adapter->ptp_tx_work); in ixgbe_ptp_suspend()
1514 * ixgbe_ptp_stop - close the PTP device
1526 if (adapter->ptp_clock) { in ixgbe_ptp_stop()
1527 ptp_clock_unregister(adapter->ptp_clock); in ixgbe_ptp_stop()
1528 adapter->ptp_clock = NULL; in ixgbe_ptp_stop()
1530 adapter->netdev->name); in ixgbe_ptp_stop()