/** * e1000e_phc_adjfine - adjust the frequency of the hardware clock * @ptp: ptp clock structure * @delta: Desired frequency chance in scaled parts per million * * Adjust the frequency of the PHC cycle counter by the indicated delta from * the base frequency. * * Scaled parts per million is ppm but with a 16 bit binary fractional field.
**/ staticint e1000e_phc_adjfine(struct ptp_clock_info *ptp, long delta)
{ struct e1000_adapter *adapter = container_of(ptp, struct e1000_adapter,
ptp_clock_info); struct e1000_hw *hw = &adapter->hw; unsignedlong flags;
u64 incvalue;
u32 timinca;
s32 ret_val;
/* Get the System Time Register SYSTIM base frequency */
ret_val = e1000e_get_base_timinca(adapter, &timinca); if (ret_val) return ret_val;
/** * e1000e_phc_gettimex - Reads the current time from the hardware clock and * system clock * @ptp: ptp clock structure * @ts: timespec structure to hold the current PHC time * @sts: structure to hold the current system time * * Read the timecounter and return the correct value in ns after converting * it into a struct timespec.
**/ staticint e1000e_phc_gettimex(struct ptp_clock_info *ptp, struct timespec64 *ts, struct ptp_system_timestamp *sts)
{ struct e1000_adapter *adapter = container_of(ptp, struct e1000_adapter,
ptp_clock_info); unsignedlong flags;
u64 cycles, ns;
spin_lock_irqsave(&adapter->systim_lock, flags);
/* NOTE: Non-monotonic SYSTIM readings may be returned */
cycles = e1000e_read_systim(adapter, sts);
ns = timecounter_cyc2time(&adapter->tc, cycles);
/** * e1000e_phc_settime - Set the current time on the hardware clock * @ptp: ptp clock structure * @ts: timespec containing the new time for the cycle counter * * Reset the timecounter to use a new base value instead of the kernel * wall timer value.
**/ staticint e1000e_phc_settime(struct ptp_clock_info *ptp, conststruct timespec64 *ts)
{ struct e1000_adapter *adapter = container_of(ptp, struct e1000_adapter,
ptp_clock_info); unsignedlong flags;
u64 ns;
/** * e1000e_phc_enable - enable or disable an ancillary feature * @ptp: ptp clock structure * @request: Desired resource to enable or disable * @on: Caller passes one to enable or zero to disable * * Enable (or disable) ancillary features of the PHC subsystem. * Currently, no ancillary features are supported.
**/ staticint e1000e_phc_enable(struct ptp_clock_info __always_unused *ptp, struct ptp_clock_request __always_unused *request, int __always_unused on)
{ return -EOPNOTSUPP;
}
/** * e1000e_ptp_init - initialize PTP for devices which support it * @adapter: board private structure * * This function performs the required steps for enabling PTP support. * If PTP support has already been loaded it simply calls the cyclecounter * init routine and exits.
**/ void e1000e_ptp_init(struct e1000_adapter *adapter)
{ struct e1000_hw *hw = &adapter->hw;
adapter->ptp_clock = NULL;
if (!(adapter->flags & FLAG_HAS_HW_TIMESTAMP)) return;
switch (hw->mac.type) { case e1000_pch2lan:
adapter->ptp_clock_info.max_adj = MAX_PPB_96MHZ; break; case e1000_pch_lpt: if (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI)
adapter->ptp_clock_info.max_adj = MAX_PPB_96MHZ; else
adapter->ptp_clock_info.max_adj = MAX_PPB_25MHZ; break; case e1000_pch_spt:
adapter->ptp_clock_info.max_adj = MAX_PPB_24MHZ; break; case e1000_pch_cnp: case e1000_pch_tgp: case e1000_pch_adp: case e1000_pch_nvp: if (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI)
adapter->ptp_clock_info.max_adj = MAX_PPB_24MHZ; else
adapter->ptp_clock_info.max_adj = MAX_PPB_38400KHZ; break; case e1000_pch_mtp: case e1000_pch_lnp: case e1000_pch_ptp:
adapter->ptp_clock_info.max_adj = MAX_PPB_38400KHZ; break; case e1000_82574: case e1000_82583:
adapter->ptp_clock_info.max_adj = MAX_PPB_25MHZ; break; default: break;
}
#ifdef CONFIG_E1000E_HWTS /* CPU must have ART and GBe must be from Sunrise Point or greater */ if (hw->mac.type >= e1000_pch_spt && boot_cpu_has(X86_FEATURE_ART))
adapter->ptp_clock_info.getcrosststamp =
e1000e_phc_getcrosststamp; #endif/*CONFIG_E1000E_HWTS*/
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.