Lines Matching +full:ptp +full:- +full:ref

123 #include "xgbe-common.h"
132 nsec = pdata->hw_if.get_tstamp_time(pdata); in xgbe_cc_read()
145 addend = adjust_by_scaled_ppm(pdata->tstamp_addend, scaled_ppm); in xgbe_adjfine()
147 spin_lock_irqsave(&pdata->tstamp_lock, flags); in xgbe_adjfine()
149 pdata->hw_if.update_tstamp_addend(pdata, addend); in xgbe_adjfine()
151 spin_unlock_irqrestore(&pdata->tstamp_lock, flags); in xgbe_adjfine()
163 spin_lock_irqsave(&pdata->tstamp_lock, flags); in xgbe_adjtime()
164 timecounter_adjtime(&pdata->tstamp_tc, delta); in xgbe_adjtime()
165 spin_unlock_irqrestore(&pdata->tstamp_lock, flags); in xgbe_adjtime()
178 spin_lock_irqsave(&pdata->tstamp_lock, flags); in xgbe_gettime()
180 nsec = timecounter_read(&pdata->tstamp_tc); in xgbe_gettime()
182 spin_unlock_irqrestore(&pdata->tstamp_lock, flags); in xgbe_gettime()
200 spin_lock_irqsave(&pdata->tstamp_lock, flags); in xgbe_settime()
202 timecounter_init(&pdata->tstamp_tc, &pdata->tstamp_cc, nsec); in xgbe_settime()
204 spin_unlock_irqrestore(&pdata->tstamp_lock, flags); in xgbe_settime()
212 return -EOPNOTSUPP; in xgbe_enable()
217 struct ptp_clock_info *info = &pdata->ptp_clock_info; in xgbe_ptp_register()
219 struct cyclecounter *cc = &pdata->tstamp_cc; in xgbe_ptp_register()
222 snprintf(info->name, sizeof(info->name), "%s", in xgbe_ptp_register()
223 netdev_name(pdata->netdev)); in xgbe_ptp_register()
224 info->owner = THIS_MODULE; in xgbe_ptp_register()
225 info->max_adj = pdata->ptpclk_rate; in xgbe_ptp_register()
226 info->adjfine = xgbe_adjfine; in xgbe_ptp_register()
227 info->adjtime = xgbe_adjtime; in xgbe_ptp_register()
228 info->gettime64 = xgbe_gettime; in xgbe_ptp_register()
229 info->settime64 = xgbe_settime; in xgbe_ptp_register()
230 info->enable = xgbe_enable; in xgbe_ptp_register()
232 clock = ptp_clock_register(info, pdata->dev); in xgbe_ptp_register()
234 dev_err(pdata->dev, "ptp_clock_register failed\n"); in xgbe_ptp_register()
238 pdata->ptp_clock = clock; in xgbe_ptp_register()
241 * addend = 2^32 / (PTP ref clock / 50Mhz) in xgbe_ptp_register()
242 * = (2^32 * 50Mhz) / PTP ref clock in xgbe_ptp_register()
246 pdata->tstamp_addend = div_u64(dividend, pdata->ptpclk_rate); in xgbe_ptp_register()
249 cc->read = xgbe_cc_read; in xgbe_ptp_register()
250 cc->mask = CLOCKSOURCE_MASK(64); in xgbe_ptp_register()
251 cc->mult = 1; in xgbe_ptp_register()
252 cc->shift = 0; in xgbe_ptp_register()
254 timecounter_init(&pdata->tstamp_tc, &pdata->tstamp_cc, in xgbe_ptp_register()
259 pdata->tstamp_config.tx_type = HWTSTAMP_TX_OFF; in xgbe_ptp_register()
260 pdata->tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE; in xgbe_ptp_register()
265 if (pdata->ptp_clock) in xgbe_ptp_unregister()
266 ptp_clock_unregister(pdata->ptp_clock); in xgbe_ptp_unregister()