Lines Matching +full:convert +full:- +full:rate
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 1999 - 2018 Intel Corporation. */
18 * period of 6.4ns. In order to convert the scale counter into
30 * Period * [ 2 ^ ( MaxWidth - PeriodWidth ) ]
41 * value in order to quickly convert it into a nanosecond clock,
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
114 * adjustments and apply them directly to the clock rate.
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
140 * proper mult and shift to convert the cycles into nanoseconds of time.
162 struct cyclecounter *cc = &adapter->hw_cc; in ixgbe_ptp_setup_sdp_X540()
163 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_setup_sdp_X540()
172 if (!(adapter->flags2 & IXGBE_FLAG2_PTP_PPS_ENABLED)) in ixgbe_ptp_setup_sdp_X540()
193 clock_period = div_u64((NS_PER_HALF_SEC << cc->shift), cc->mult); in ixgbe_ptp_setup_sdp_X540()
198 spin_lock_irqsave(&adapter->tmreg_lock, flags); in ixgbe_ptp_setup_sdp_X540()
199 ns = timecounter_read(&adapter->hw_tc); in ixgbe_ptp_setup_sdp_X540()
200 clock_edge = adapter->hw_tc.cycle_last; in ixgbe_ptp_setup_sdp_X540()
201 spin_unlock_irqrestore(&adapter->tmreg_lock, flags); in ixgbe_ptp_setup_sdp_X540()
209 rem = (NS_PER_SEC - rem); in ixgbe_ptp_setup_sdp_X540()
212 clock_edge += div_u64(((u64)rem << cc->shift), cc->mult); in ixgbe_ptp_setup_sdp_X540()
242 struct cyclecounter *cc = &adapter->hw_cc; in ixgbe_ptp_setup_sdp_X550()
243 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_setup_sdp_X550()
252 if (!(adapter->flags2 & IXGBE_FLAG2_PTP_PPS_ENABLED)) in ixgbe_ptp_setup_sdp_X550()
278 freqout = div_u64(NS_PER_HALF_SEC << cc->shift, cc->mult); in ixgbe_ptp_setup_sdp_X550()
281 spin_lock_irqsave(&adapter->tmreg_lock, flags); in ixgbe_ptp_setup_sdp_X550()
282 ns = timecounter_read(&adapter->hw_tc); in ixgbe_ptp_setup_sdp_X550()
283 clock_edge = adapter->hw_tc.cycle_last; in ixgbe_ptp_setup_sdp_X550()
284 spin_unlock_irqrestore(&adapter->tmreg_lock, flags); in ixgbe_ptp_setup_sdp_X550()
292 rem = (NS_PER_SEC - rem); in ixgbe_ptp_setup_sdp_X550()
295 clock_edge += div_u64(((u64)rem << cc->shift), cc->mult); in ixgbe_ptp_setup_sdp_X550()
300 * convert into the hardware representation. in ixgbe_ptp_setup_sdp_X550()
320 * ixgbe_ptp_read_X550 - read cycle counter value
324 * structure to convert from internal representation into nanoseconds. We need
333 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_read_X550()
343 * non-bitmask field since we have to convert our billions of cycles in ixgbe_ptp_read_X550()
359 * ixgbe_ptp_read_82599 - read raw cycle counter (to be used by time counter)
370 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_read_82599()
380 * ixgbe_ptp_convert_to_hwtstamp - convert register value to hw timestamp
385 * We need to convert the adapter's RX/TXSTMP registers into a hwtstamp value
406 switch (adapter->hw.mac.type) { in ixgbe_ptp_convert_to_hwtstamp()
409 * to convert the timestamp into cycles before it can be fed to the in ixgbe_ptp_convert_to_hwtstamp()
432 spin_lock_irqsave(&adapter->tmreg_lock, flags); in ixgbe_ptp_convert_to_hwtstamp()
433 ns = timecounter_cyc2time(&adapter->hw_tc, timestamp); in ixgbe_ptp_convert_to_hwtstamp()
434 spin_unlock_irqrestore(&adapter->tmreg_lock, flags); in ixgbe_ptp_convert_to_hwtstamp()
436 hwtstamp->hwtstamp = ns_to_ktime(ns); in ixgbe_ptp_convert_to_hwtstamp()
447 * Scaled parts per million is ppm with a 16-bit binary fractional field.
453 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_adjfine_82599()
457 incval = READ_ONCE(adapter->base_incval); in ixgbe_ptp_adjfine_82599()
460 switch (hw->mac.type) { in ixgbe_ptp_adjfine_82599()
463 e_dev_warn("PTP scaled_ppm adjusted SYSTIME rate overflowed!\n"); in ixgbe_ptp_adjfine_82599()
468 e_dev_warn("PTP scaled_ppm adjusted SYSTIME rate overflowed!\n"); in ixgbe_ptp_adjfine_82599()
488 * Scaled parts per million is ppm with a 16-bit binary fractional field.
494 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_adjfine_X550()
496 u64 rate; in ixgbe_ptp_adjfine_X550() local
499 neg_adj = diff_by_scaled_ppm(IXGBE_X550_BASE_PERIOD, scaled_ppm, &rate); in ixgbe_ptp_adjfine_X550()
501 /* warn if rate is too large */ in ixgbe_ptp_adjfine_X550()
502 if (rate >= INCVALUE_MASK) in ixgbe_ptp_adjfine_X550()
503 e_dev_warn("PTP scaled_ppm adjusted SYSTIME rate overflowed!\n"); in ixgbe_ptp_adjfine_X550()
505 inca = rate & INCVALUE_MASK; in ixgbe_ptp_adjfine_X550()
527 spin_lock_irqsave(&adapter->tmreg_lock, flags); in ixgbe_ptp_adjtime()
528 timecounter_adjtime(&adapter->hw_tc, delta); in ixgbe_ptp_adjtime()
529 spin_unlock_irqrestore(&adapter->tmreg_lock, flags); in ixgbe_ptp_adjtime()
531 if (adapter->ptp_setup_sdp) in ixgbe_ptp_adjtime()
532 adapter->ptp_setup_sdp(adapter); in ixgbe_ptp_adjtime()
552 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_gettimex()
556 spin_lock_irqsave(&adapter->tmreg_lock, flags); in ixgbe_ptp_gettimex()
558 switch (adapter->hw.mac.type) { in ixgbe_ptp_gettimex()
570 ts->tv_nsec = IXGBE_READ_REG(hw, IXGBE_SYSTIML); in ixgbe_ptp_gettimex()
571 ts->tv_sec = IXGBE_READ_REG(hw, IXGBE_SYSTIMH); in ixgbe_ptp_gettimex()
582 ns = timecounter_cyc2time(&adapter->hw_tc, stamp); in ixgbe_ptp_gettimex()
584 spin_unlock_irqrestore(&adapter->tmreg_lock, flags); in ixgbe_ptp_gettimex()
608 spin_lock_irqsave(&adapter->tmreg_lock, flags); in ixgbe_ptp_settime()
609 timecounter_init(&adapter->hw_tc, &adapter->hw_cc, ns); in ixgbe_ptp_settime()
610 spin_unlock_irqrestore(&adapter->tmreg_lock, flags); in ixgbe_ptp_settime()
612 if (adapter->ptp_setup_sdp) in ixgbe_ptp_settime()
613 adapter->ptp_setup_sdp(adapter); in ixgbe_ptp_settime()
638 if (rq->type != PTP_CLK_REQ_PPS || !adapter->ptp_setup_sdp) in ixgbe_ptp_feature_enable()
639 return -ENOTSUPP; in ixgbe_ptp_feature_enable()
642 adapter->flags2 |= IXGBE_FLAG2_PTP_PPS_ENABLED; in ixgbe_ptp_feature_enable()
644 adapter->flags2 &= ~IXGBE_FLAG2_PTP_PPS_ENABLED; in ixgbe_ptp_feature_enable()
646 adapter->ptp_setup_sdp(adapter); in ixgbe_ptp_feature_enable()
659 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_check_pps_event()
668 if (!adapter->ptp_clock) in ixgbe_ptp_check_pps_event()
671 switch (hw->mac.type) { in ixgbe_ptp_check_pps_event()
673 ptp_clock_event(adapter->ptp_clock, &event); in ixgbe_ptp_check_pps_event()
681 * ixgbe_ptp_overflow_check - watchdog task to detect SYSTIME overflow
690 bool timeout = time_is_before_jiffies(adapter->last_overflow_check + in ixgbe_ptp_overflow_check()
696 spin_lock_irqsave(&adapter->tmreg_lock, flags); in ixgbe_ptp_overflow_check()
697 timecounter_read(&adapter->hw_tc); in ixgbe_ptp_overflow_check()
698 spin_unlock_irqrestore(&adapter->tmreg_lock, flags); in ixgbe_ptp_overflow_check()
700 adapter->last_overflow_check = jiffies; in ixgbe_ptp_overflow_check()
705 * ixgbe_ptp_rx_hang - detect error case when Rx timestamp registers latched
715 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_rx_hang()
725 adapter->last_rx_ptp_check = jiffies; in ixgbe_ptp_rx_hang()
730 rx_event = adapter->last_rx_ptp_check; in ixgbe_ptp_rx_hang()
731 for (n = 0; n < adapter->num_rx_queues; n++) { in ixgbe_ptp_rx_hang()
732 rx_ring = adapter->rx_ring[n]; in ixgbe_ptp_rx_hang()
733 if (time_after(rx_ring->last_rx_timestamp, rx_event)) in ixgbe_ptp_rx_hang()
734 rx_event = rx_ring->last_rx_timestamp; in ixgbe_ptp_rx_hang()
740 adapter->last_rx_ptp_check = jiffies; in ixgbe_ptp_rx_hang()
742 adapter->rx_hwtstamp_cleared++; in ixgbe_ptp_rx_hang()
748 * ixgbe_ptp_clear_tx_timestamp - utility function to clear Tx timestamp state
757 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_clear_tx_timestamp()
760 if (adapter->ptp_tx_skb) { in ixgbe_ptp_clear_tx_timestamp()
761 dev_kfree_skb_any(adapter->ptp_tx_skb); in ixgbe_ptp_clear_tx_timestamp()
762 adapter->ptp_tx_skb = NULL; in ixgbe_ptp_clear_tx_timestamp()
764 clear_bit_unlock(__IXGBE_PTP_TX_IN_PROGRESS, &adapter->state); in ixgbe_ptp_clear_tx_timestamp()
768 * ixgbe_ptp_tx_hang - detect error case where Tx timestamp never finishes
773 bool timeout = time_is_before_jiffies(adapter->ptp_tx_start + in ixgbe_ptp_tx_hang()
776 if (!adapter->ptp_tx_skb) in ixgbe_ptp_tx_hang()
779 if (!test_bit(__IXGBE_PTP_TX_IN_PROGRESS, &adapter->state)) in ixgbe_ptp_tx_hang()
787 cancel_work_sync(&adapter->ptp_tx_work); in ixgbe_ptp_tx_hang()
789 adapter->tx_hwtstamp_timeouts++; in ixgbe_ptp_tx_hang()
795 * ixgbe_ptp_tx_hwtstamp - utility function which checks for TX time stamp
798 * if the timestamp is valid, we convert it into the timecounter ns
804 struct sk_buff *skb = adapter->ptp_tx_skb; in ixgbe_ptp_tx_hwtstamp()
805 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_tx_hwtstamp()
818 adapter->ptp_tx_skb = NULL; in ixgbe_ptp_tx_hwtstamp()
819 clear_bit_unlock(__IXGBE_PTP_TX_IN_PROGRESS, &adapter->state); in ixgbe_ptp_tx_hwtstamp()
838 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_tx_hwtstamp_work()
839 bool timeout = time_is_before_jiffies(adapter->ptp_tx_start + in ixgbe_ptp_tx_hwtstamp_work()
844 if (!adapter->ptp_tx_skb) { in ixgbe_ptp_tx_hwtstamp_work()
858 adapter->tx_hwtstamp_timeouts++; in ixgbe_ptp_tx_hwtstamp_work()
862 schedule_work(&adapter->ptp_tx_work); in ixgbe_ptp_tx_hwtstamp_work()
867 * ixgbe_ptp_rx_pktstamp - utility function to get RX time stamp from buffer
881 skb_copy_bits(skb, skb->len - IXGBE_TS_HDR_LEN, ®val, in ixgbe_ptp_rx_pktstamp()
883 __pskb_trim(skb, skb->len - IXGBE_TS_HDR_LEN); in ixgbe_ptp_rx_pktstamp()
891 ixgbe_ptp_convert_to_hwtstamp(q_vector->adapter, skb_hwtstamps(skb), in ixgbe_ptp_rx_pktstamp()
896 * ixgbe_ptp_rx_rgtstamp - utility function which checks for RX time stamp
900 * if the timestamp is valid, we convert it into the timecounter ns
913 if (!q_vector || !q_vector->adapter) in ixgbe_ptp_rx_rgtstamp()
916 adapter = q_vector->adapter; in ixgbe_ptp_rx_rgtstamp()
917 hw = &adapter->hw; in ixgbe_ptp_rx_rgtstamp()
934 * ixgbe_ptp_get_ts_config - get current hardware timestamping configuration
944 struct hwtstamp_config *config = &adapter->tstamp_config; in ixgbe_ptp_get_ts_config()
946 return copy_to_user(ifr->ifr_data, config, in ixgbe_ptp_get_ts_config()
947 sizeof(*config)) ? -EFAULT : 0; in ixgbe_ptp_get_ts_config()
951 * ixgbe_ptp_set_timestamp_mode - setup the hardware for the requested mode
978 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_set_timestamp_mode()
982 u32 aflags = adapter->flags; in ixgbe_ptp_set_timestamp_mode()
986 switch (config->tx_type) { in ixgbe_ptp_set_timestamp_mode()
993 return -ERANGE; in ixgbe_ptp_set_timestamp_mode()
996 switch (config->rx_filter) { in ixgbe_ptp_set_timestamp_mode()
1026 config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; in ixgbe_ptp_set_timestamp_mode()
1036 if (hw->mac.type >= ixgbe_mac_X550) { in ixgbe_ptp_set_timestamp_mode()
1038 config->rx_filter = HWTSTAMP_FILTER_ALL; in ixgbe_ptp_set_timestamp_mode()
1050 config->rx_filter = HWTSTAMP_FILTER_NONE; in ixgbe_ptp_set_timestamp_mode()
1051 return -ERANGE; in ixgbe_ptp_set_timestamp_mode()
1054 if (hw->mac.type == ixgbe_mac_82598EB) { in ixgbe_ptp_set_timestamp_mode()
1055 adapter->flags &= ~(IXGBE_FLAG_RX_HWTSTAMP_ENABLED | in ixgbe_ptp_set_timestamp_mode()
1058 return -ERANGE; in ixgbe_ptp_set_timestamp_mode()
1062 /* Per-packet timestamping only works if the filter is set to all in ixgbe_ptp_set_timestamp_mode()
1066 switch (hw->mac.type) { in ixgbe_ptp_set_timestamp_mode()
1074 if (config->rx_filter == HWTSTAMP_FILTER_NONE) in ixgbe_ptp_set_timestamp_mode()
1080 config->rx_filter = HWTSTAMP_FILTER_ALL; in ixgbe_ptp_set_timestamp_mode()
1116 adapter->flags = aflags; in ixgbe_ptp_set_timestamp_mode()
1126 * ixgbe_ptp_set_ts_config - user entry point for timestamp mode
1138 if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) in ixgbe_ptp_set_ts_config()
1139 return -EFAULT; in ixgbe_ptp_set_ts_config()
1146 memcpy(&adapter->tstamp_config, &config, in ixgbe_ptp_set_ts_config()
1147 sizeof(adapter->tstamp_config)); in ixgbe_ptp_set_ts_config()
1149 return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? in ixgbe_ptp_set_ts_config()
1150 -EFAULT : 0; in ixgbe_ptp_set_ts_config()
1161 * counter structure must be able to convert the systime value in ixgbe_ptp_link_speed_adjust()
1162 * to nanoseconds using only a multiplier and a right-shift, in ixgbe_ptp_link_speed_adjust()
1164 * => math based on internal DMA clock rate and available bits in ixgbe_ptp_link_speed_adjust()
1170 switch (adapter->link_speed) { in ixgbe_ptp_link_speed_adjust()
1188 * ixgbe_ptp_start_cyclecounter - create the cycle counter from hw
1192 * register and tell the cyclecounter structure what the tick rate of SYSTIME
1199 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_start_cyclecounter()
1210 * they do not properly function if the overflow point isn't 2^N-1. in ixgbe_ptp_start_cyclecounter()
1220 switch (hw->mac.type) { in ixgbe_ptp_start_cyclecounter()
1249 cc.shift -= IXGBE_INCVAL_SHIFT_82599; in ixgbe_ptp_start_cyclecounter()
1259 WRITE_ONCE(adapter->base_incval, incval); in ixgbe_ptp_start_cyclecounter()
1263 spin_lock_irqsave(&adapter->tmreg_lock, flags); in ixgbe_ptp_start_cyclecounter()
1264 memcpy(&adapter->hw_cc, &cc, sizeof(adapter->hw_cc)); in ixgbe_ptp_start_cyclecounter()
1265 spin_unlock_irqrestore(&adapter->tmreg_lock, flags); in ixgbe_ptp_start_cyclecounter()
1269 * ixgbe_ptp_init_systime - Initialize SYSTIME registers
1276 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_init_systime()
1279 switch (hw->mac.type) { in ixgbe_ptp_init_systime()
1317 * function is used to re-enable the device for PTP based on current settings.
1326 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_ptp_reset()
1330 ixgbe_ptp_set_timestamp_mode(adapter, &adapter->tstamp_config); in ixgbe_ptp_reset()
1333 if (hw->mac.type == ixgbe_mac_82598EB) in ixgbe_ptp_reset()
1340 spin_lock_irqsave(&adapter->tmreg_lock, flags); in ixgbe_ptp_reset()
1341 timecounter_init(&adapter->hw_tc, &adapter->hw_cc, in ixgbe_ptp_reset()
1343 spin_unlock_irqrestore(&adapter->tmreg_lock, flags); in ixgbe_ptp_reset()
1345 adapter->last_overflow_check = jiffies; in ixgbe_ptp_reset()
1348 * registers reset, (re-)enable the Clock out feature in ixgbe_ptp_reset()
1350 if (adapter->ptp_setup_sdp) in ixgbe_ptp_reset()
1351 adapter->ptp_setup_sdp(adapter); in ixgbe_ptp_reset()
1359 * initializes the PTP clock device, which is used to access the clock-like
1366 struct net_device *netdev = adapter->netdev; in ixgbe_ptp_create_clock()
1370 if (!IS_ERR_OR_NULL(adapter->ptp_clock)) in ixgbe_ptp_create_clock()
1373 switch (adapter->hw.mac.type) { in ixgbe_ptp_create_clock()
1375 snprintf(adapter->ptp_caps.name, in ixgbe_ptp_create_clock()
1376 sizeof(adapter->ptp_caps.name), in ixgbe_ptp_create_clock()
1377 "%s", netdev->name); in ixgbe_ptp_create_clock()
1378 adapter->ptp_caps.owner = THIS_MODULE; in ixgbe_ptp_create_clock()
1379 adapter->ptp_caps.max_adj = 250000000; in ixgbe_ptp_create_clock()
1380 adapter->ptp_caps.n_alarm = 0; in ixgbe_ptp_create_clock()
1381 adapter->ptp_caps.n_ext_ts = 0; in ixgbe_ptp_create_clock()
1382 adapter->ptp_caps.n_per_out = 0; in ixgbe_ptp_create_clock()
1383 adapter->ptp_caps.pps = 1; in ixgbe_ptp_create_clock()
1384 adapter->ptp_caps.adjfine = ixgbe_ptp_adjfine_82599; in ixgbe_ptp_create_clock()
1385 adapter->ptp_caps.adjtime = ixgbe_ptp_adjtime; in ixgbe_ptp_create_clock()
1386 adapter->ptp_caps.gettimex64 = ixgbe_ptp_gettimex; in ixgbe_ptp_create_clock()
1387 adapter->ptp_caps.settime64 = ixgbe_ptp_settime; in ixgbe_ptp_create_clock()
1388 adapter->ptp_caps.enable = ixgbe_ptp_feature_enable; in ixgbe_ptp_create_clock()
1389 adapter->ptp_setup_sdp = ixgbe_ptp_setup_sdp_X540; in ixgbe_ptp_create_clock()
1392 snprintf(adapter->ptp_caps.name, in ixgbe_ptp_create_clock()
1393 sizeof(adapter->ptp_caps.name), in ixgbe_ptp_create_clock()
1394 "%s", netdev->name); in ixgbe_ptp_create_clock()
1395 adapter->ptp_caps.owner = THIS_MODULE; in ixgbe_ptp_create_clock()
1396 adapter->ptp_caps.max_adj = 250000000; in ixgbe_ptp_create_clock()
1397 adapter->ptp_caps.n_alarm = 0; in ixgbe_ptp_create_clock()
1398 adapter->ptp_caps.n_ext_ts = 0; in ixgbe_ptp_create_clock()
1399 adapter->ptp_caps.n_per_out = 0; in ixgbe_ptp_create_clock()
1400 adapter->ptp_caps.pps = 0; in ixgbe_ptp_create_clock()
1401 adapter->ptp_caps.adjfine = ixgbe_ptp_adjfine_82599; in ixgbe_ptp_create_clock()
1402 adapter->ptp_caps.adjtime = ixgbe_ptp_adjtime; in ixgbe_ptp_create_clock()
1403 adapter->ptp_caps.gettimex64 = ixgbe_ptp_gettimex; in ixgbe_ptp_create_clock()
1404 adapter->ptp_caps.settime64 = ixgbe_ptp_settime; in ixgbe_ptp_create_clock()
1405 adapter->ptp_caps.enable = ixgbe_ptp_feature_enable; in ixgbe_ptp_create_clock()
1410 snprintf(adapter->ptp_caps.name, 16, "%s", netdev->name); in ixgbe_ptp_create_clock()
1411 adapter->ptp_caps.owner = THIS_MODULE; in ixgbe_ptp_create_clock()
1412 adapter->ptp_caps.max_adj = 30000000; in ixgbe_ptp_create_clock()
1413 adapter->ptp_caps.n_alarm = 0; in ixgbe_ptp_create_clock()
1414 adapter->ptp_caps.n_ext_ts = 0; in ixgbe_ptp_create_clock()
1415 adapter->ptp_caps.n_per_out = 0; in ixgbe_ptp_create_clock()
1416 adapter->ptp_caps.pps = 1; in ixgbe_ptp_create_clock()
1417 adapter->ptp_caps.adjfine = ixgbe_ptp_adjfine_X550; in ixgbe_ptp_create_clock()
1418 adapter->ptp_caps.adjtime = ixgbe_ptp_adjtime; in ixgbe_ptp_create_clock()
1419 adapter->ptp_caps.gettimex64 = ixgbe_ptp_gettimex; in ixgbe_ptp_create_clock()
1420 adapter->ptp_caps.settime64 = ixgbe_ptp_settime; in ixgbe_ptp_create_clock()
1421 adapter->ptp_caps.enable = ixgbe_ptp_feature_enable; in ixgbe_ptp_create_clock()
1422 adapter->ptp_setup_sdp = ixgbe_ptp_setup_sdp_X550; in ixgbe_ptp_create_clock()
1425 adapter->ptp_clock = NULL; in ixgbe_ptp_create_clock()
1426 adapter->ptp_setup_sdp = NULL; in ixgbe_ptp_create_clock()
1427 return -EOPNOTSUPP; in ixgbe_ptp_create_clock()
1430 adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps, in ixgbe_ptp_create_clock()
1431 &adapter->pdev->dev); in ixgbe_ptp_create_clock()
1432 if (IS_ERR(adapter->ptp_clock)) { in ixgbe_ptp_create_clock()
1433 err = PTR_ERR(adapter->ptp_clock); in ixgbe_ptp_create_clock()
1434 adapter->ptp_clock = NULL; in ixgbe_ptp_create_clock()
1437 } else if (adapter->ptp_clock) in ixgbe_ptp_create_clock()
1438 e_dev_info("registered PHC device on %s\n", netdev->name); in ixgbe_ptp_create_clock()
1444 adapter->tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE; in ixgbe_ptp_create_clock()
1445 adapter->tstamp_config.tx_type = HWTSTAMP_TX_OFF; in ixgbe_ptp_create_clock()
1464 spin_lock_init(&adapter->tmreg_lock); in ixgbe_ptp_init()
1466 /* obtain a PTP device, or re-use an existing device */ in ixgbe_ptp_init()
1471 INIT_WORK(&adapter->ptp_tx_work, ixgbe_ptp_tx_hwtstamp_work); in ixgbe_ptp_init()
1477 set_bit(__IXGBE_PTP_RUNNING, &adapter->state); in ixgbe_ptp_init()
1483 * ixgbe_ptp_suspend - stop PTP work items
1492 if (!test_and_clear_bit(__IXGBE_PTP_RUNNING, &adapter->state)) in ixgbe_ptp_suspend()
1495 adapter->flags2 &= ~IXGBE_FLAG2_PTP_PPS_ENABLED; in ixgbe_ptp_suspend()
1496 if (adapter->ptp_setup_sdp) in ixgbe_ptp_suspend()
1497 adapter->ptp_setup_sdp(adapter); in ixgbe_ptp_suspend()
1500 cancel_work_sync(&adapter->ptp_tx_work); in ixgbe_ptp_suspend()
1505 * ixgbe_ptp_stop - close the PTP device
1517 if (adapter->ptp_clock) { in ixgbe_ptp_stop()
1518 ptp_clock_unregister(adapter->ptp_clock); in ixgbe_ptp_stop()
1519 adapter->ptp_clock = NULL; in ixgbe_ptp_stop()
1521 adapter->netdev->name); in ixgbe_ptp_stop()