Use clock_adjtime from glibc if available.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
bugfix: use a sensible test to detect a new master.

The code to detect a new master used pointer equality using a stale
pointer within the clock instance. Instead, the clock needs to remember
the identity of the foreign master in order to correctly detect a
change of master.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Introduce a helper function to convert from tmv to nanoseconds.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
trivial: fix a spelling error in a comment.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Introduce the time status management message.

This non-portable, implementation specific message is designed to inform
external programs about the relationship between the local clock and the
remote master clock.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Do not expect or open a /dev/ptpX device when in free_running mode

Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
phc2sys: fix operation without -s option.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Merge branch 'as2'
Warn if a slave only node is selected by the bmc.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Discover and utilize the initial clock frequency adjustment.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
phc2sys: remove unused variable.

The 'src' parameter to the do_servo() function is never used, so
remove it.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
phc2sys: remove useless option.

The 'rdelay' option has been obsoleted by the newer read_phc() logic.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
phc2sys: disentangle the PPS loop from the read_phc loop.

The main loop has become a bit messy, mixing two completely disjunct code
paths. This patch separates the two use cases for the sake of clarity.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
phc2sys: refactor and rationalize the output messages.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
phc2sys: add sk.o to phc2sys for sk_interface_phc

This patch adds support for sk_interface_phc to lookup the /dev/ptpX device
using ethtool's get_ts_info ioctl

-v2-
* set ethdev to null initially
* rebased on top of phc2sys changes

-v3-
* fixed typo regarding slash

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
ptp4l: modify servo setup to take an enum rather than string

passing a string as the servo type seems ugly when there are only a few
choices. This patch modifies the servo_create to take an enum instead.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
ptp4l: modify clock_create to take servo as argument

this patch modifies the clock_create to take the servo type as an argument

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
ptp4l: add servo selection to the configuration file

this patch adds the servo selection to the configuration file

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
ptp4l: add maximum offset to pi servo

this patch modifies the pi servo to add a configurable max offset (default
infinity). When ever the detected offset is larger than this value, the clock
will jump and reset the servo state. The value of this feature is for decreasing
time to stabalize when clock is off by a large ammount during late running. This
can occur when the upstream master changes, or when the clock is reset due to
outside forces. The method used to reset clock is simply to reset the pi servo
to the unlocked state.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
ptp4l: update the configuration files

this patch updates the default.cfg and gPTP.cfg to show the new defaults

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>