Lines Matching full:ptp
67 * This function will configure timestamping during PTP initialization
76 pf->ptp.tstamp_config.rx_filter = HWTSTAMP_FILTER_ALL; in ice_ptp_cfg_timestamp()
77 pf->ptp.tstamp_config.tx_type = HWTSTAMP_TX_ON; in ice_ptp_cfg_timestamp()
79 pf->ptp.tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE; in ice_ptp_cfg_timestamp()
80 pf->ptp.tstamp_config.tx_type = HWTSTAMP_TX_OFF; in ice_ptp_cfg_timestamp()
85 * ice_get_ptp_clock_index - Get the PTP clock index
88 * Determine the clock index of the PTP clock associated with this device. If
95 * Returns: the index of the PTP clock associated with this device, or -1 if
108 if (pf->ptp.clock) in ice_get_ptp_clock_index()
109 return ptp_clock_index(pf->ptp.clock); in ice_get_ptp_clock_index()
119 dev_err(dev, "Failed to read PTP clock index parameter, err %d aq_err %s\n", in ice_get_ptp_clock_index()
124 /* The PTP clock index is an integer, and will be between 0 and in ice_get_ptp_clock_index()
135 * ice_set_ptp_clock_index - Set the PTP clock index
138 * Set the PTP clock index for this device into the shared driver parameters,
142 * will continue operating PTP.
153 if (!pf->ptp.clock) in ice_set_ptp_clock_index()
162 value = (u32)ptp_clock_index(pf->ptp.clock); in ice_set_ptp_clock_index()
164 dev_err(dev, "PTP Clock index is too large to store\n"); in ice_set_ptp_clock_index()
171 dev_err(dev, "Failed to set PTP clock index parameter, err %d aq_err %s\n", in ice_set_ptp_clock_index()
177 * ice_clear_ptp_clock_index - Clear the PTP clock index
180 * Clear the PTP clock index for this device. Must be called when
181 * unregistering the PTP clock, in order to ensure other PFs stop reporting
204 dev_dbg(dev, "Failed to clear PTP clock index parameter, err %d aq_err %s\n", in ice_clear_ptp_clock_index()
267 WRITE_ONCE(pf->ptp.cached_phc_time, systime); in ice_ptp_update_cached_phctime()
374 * time stored in the device private PTP structure as the basis for timestamp
384 return ice_ptp_extend_32b_ts(pf->ptp.cached_phc_time, in ice_ptp_extend_40b_ts()
440 * @info: the driver's PTP info structure
480 dev_err(ice_pf_to_dev(pf), "PTP failed to set incval, err %d\n", in ice_ptp_adjfine()
492 * Service for PTP external clock event
496 struct ice_ptp *ptp = container_of(work, struct ice_ptp, extts_work); in ice_ptp_extts_work() local
497 struct ice_pf *pf = container_of(ptp, struct ice_pf, ptp); in ice_ptp_extts_work()
511 if (pf->ptp.ext_ts_irq & (1 << chan)) { in ice_ptp_extts_work()
519 ptp_clock_event(pf->ptp.clock, &event); in ice_ptp_extts_work()
520 pf->ptp.ext_ts_irq &= ~(1 << chan); in ice_ptp_extts_work()
541 if (chan > (unsigned int)pf->ptp.info.n_ext_ts) in ice_ptp_cfg_extts()
569 pf->ptp.ext_ts_chan |= (1 << chan); in ice_ptp_cfg_extts()
574 pf->ptp.ext_ts_chan &= ~(1 << chan); in ice_ptp_cfg_extts()
575 if (!pf->ptp.ext_ts_chan) in ice_ptp_cfg_extts()
618 gpio_pin = pf->ptp.perout_channels[chan].gpio_pin; in ice_ptp_cfg_clkout()
623 memset(&pf->ptp.perout_channels[chan], 0, in ice_ptp_cfg_clkout()
680 memcpy(&pf->ptp.perout_channels[chan], config, in ice_ptp_cfg_clkout()
682 pf->ptp.perout_channels[chan].start_time = phase; in ice_ptp_cfg_clkout()
687 dev_err(ice_pf_to_dev(pf), "PTP failed to cfg per_clk\n"); in ice_ptp_cfg_clkout()
696 * certain changes to the PTP hardware clock. Use ice_ptp_enable_all_clkout to
703 for (i = 0; i < pf->ptp.info.n_per_out; i++) in ice_ptp_disable_all_clkout()
704 if (pf->ptp.perout_channels[i].ena) in ice_ptp_disable_all_clkout()
720 for (i = 0; i < pf->ptp.info.n_per_out; i++) in ice_ptp_enable_all_clkout()
721 if (pf->ptp.perout_channels[i].ena) in ice_ptp_enable_all_clkout()
722 ice_ptp_cfg_clkout(pf, i, &pf->ptp.perout_channels[i], in ice_ptp_enable_all_clkout()
728 * @info: the driver's PTP info structure
774 * @info: the driver's PTP info structure
790 dev_err(ice_pf_to_dev(pf), "PTP failed to get time\n"); in ice_ptp_gettimex64()
802 * @info: the driver's PTP info structure
834 dev_err(ice_pf_to_dev(pf), "PTP failed to set time %d\n", err); in ice_ptp_settime64()
843 * @info: the driver's PTP info structure
859 * @info: the driver's PTP info structure
881 dev_err(dev, "PTP failed to acquire semaphore in adjtime\n"); in ice_ptp_adjtime()
896 dev_err(dev, "PTP failed to adjust time, err %d\n", err); in ice_ptp_adjtime()
919 config = &pf->ptp.tstamp_config; in ice_ptp_get_ts_config()
999 pf->ptp.tstamp_config = config; in ice_ptp_set_ts_config()
1041 * ice_ptp_setup_pins_e810 - Setup PTP pins in sysfs
1042 * @info: PTP clock capabilities
1053 * @info: PTP info to fill
1055 * Assign functions to the PTP capabiltiies structure for E810 devices.
1069 * ice_ptp_set_caps - Set PTP capabilities
1074 struct ptp_clock_info *info = &pf->ptp.info; in ice_ptp_set_caps()
1090 * ice_ptp_create_clock - Create PTP clock device for userspace
1093 * This function creates a new PTP clock device. It only creates one if we
1105 if (pf->ptp.clock) in ice_ptp_create_clock()
1110 info = &pf->ptp.info; in ice_ptp_create_clock()
1118 pf->ptp.clock = clock; in ice_ptp_create_clock()
1222 kthread_queue_work(pf->ptp.kworker, &tx->work); in ice_ptp_tx_tstamp_work()
1228 * @tx: the PTP Tx timestamp tracker to request from
1268 * Queue work required to process the PTP Tx timestamps outside of interrupt
1273 if (pf->ptp.port.tx.init) in ice_ptp_process_ts()
1274 kthread_queue_work(pf->ptp.kworker, &pf->ptp.port.tx.work); in ice_ptp_process_ts()
1378 * @tx: PTP Tx tracker to clean up
1413 struct ice_ptp *ptp = container_of(work, struct ice_ptp, work.work); in ice_ptp_periodic_work() local
1414 struct ice_pf *pf = container_of(ptp, struct ice_pf, ptp); in ice_ptp_periodic_work()
1421 ice_ptp_tx_tstamp_cleanup(&pf->ptp.port.tx); in ice_ptp_periodic_work()
1424 kthread_queue_delayed_work(ptp->kworker, &ptp->work, in ice_ptp_periodic_work()
1432 * Setup and initialize a PTP clock device that represents the device hardware
1489 /* Store the PTP clock index for other PFs */ in ice_ptp_init_owner()
1495 pf->ptp.clock = NULL; in ice_ptp_init_owner()
1497 dev_err(dev, "PTP failed to register clock, err %d\n", err); in ice_ptp_init_owner()
1503 * ice_ptp_init - Initialize the PTP support after device probe or reset
1506 * This function sets device up for PTP support. The first time it is run, it
1517 /* PTP is currently only supported on E810 devices */ in ice_ptp_init()
1531 /* Initialize the PTP port Tx timestamp tracker */ in ice_ptp_init()
1532 ice_ptp_init_tx_e810(pf, &pf->ptp.port.tx); in ice_ptp_init()
1535 kthread_init_delayed_work(&pf->ptp.work, ice_ptp_periodic_work); in ice_ptp_init()
1536 kthread_init_work(&pf->ptp.extts_work, ice_ptp_extts_work); in ice_ptp_init()
1539 * connected to the PTP hardware clock. in ice_ptp_init()
1541 kworker = kthread_create_worker(0, "ice-ptp-%s", dev_name(dev)); in ice_ptp_init()
1546 pf->ptp.kworker = kworker; in ice_ptp_init()
1551 kthread_queue_delayed_work(pf->ptp.kworker, &pf->ptp.work, 0); in ice_ptp_init()
1553 dev_info(dev, "PTP init successful\n"); in ice_ptp_init()
1557 /* If we registered a PTP clock, release it */ in ice_ptp_init()
1558 if (pf->ptp.clock) { in ice_ptp_init()
1559 ptp_clock_unregister(pf->ptp.clock); in ice_ptp_init()
1560 pf->ptp.clock = NULL; in ice_ptp_init()
1562 dev_err(dev, "PTP failed %d\n", err); in ice_ptp_init()
1580 ice_ptp_release_tx_tracker(pf, &pf->ptp.port.tx); in ice_ptp_release()
1584 kthread_cancel_delayed_work_sync(&pf->ptp.work); in ice_ptp_release()
1586 if (pf->ptp.kworker) { in ice_ptp_release()
1587 kthread_destroy_worker(pf->ptp.kworker); in ice_ptp_release()
1588 pf->ptp.kworker = NULL; in ice_ptp_release()
1591 if (!pf->ptp.clock) in ice_ptp_release()
1598 ptp_clock_unregister(pf->ptp.clock); in ice_ptp_release()
1599 pf->ptp.clock = NULL; in ice_ptp_release()
1601 dev_info(ice_pf_to_dev(pf), "Removed PTP clock\n"); in ice_ptp_release()