Add another Freescale driver into the support matrix.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
No need to set kernel_leap twice in a row.

This patch removes a redundant initialization of the kernel_leap clock
variable. The field is already set in clock_create a few lines earlier.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Clean up indented white space.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
pmc: fix coding style by using K&R style functions.
Reset announce timer when port is passive.

Whenever a port enters the passive state, it should act like a slaved
port in one respect. Incoming announce messages from the grand master
are supposed to reset the announce timer. This patch fixes the port
logic to properly maintain the passive state.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reported-by: Rohrer Hansjoerg <hj.rohrer@mobatime.com>
Add missing option to the default configuration file.

While the userDescription field is implemented in the code, the same
option is not present in the sample configuration file. This patch
fixes the issue by adding the option with an empty default value.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reported-by: Rohrer Hansjoerg <hj.rohrer@mobatime.com>
Add a clock variable to hold the value of the time source.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Add a configuration option for the time source.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Introduce a non-portable management TLV for grand masters.

When running as grand master, the attributes of the local clock are not
known by the ptp4l program. Since these attributes may change over time,
for example when losing signal from GPS satellites, we need to have a
way to provide updated information at run time. This patch provides a
new TLV intended for local IPC that contains the required settings.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Support the grand master settings management query.

This patch also replaces the hard coded logic for the UTC offset and the
time property flags with clock variables. This new clock state will be
used for adjusting the grand master attributes at run time.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
pmc: Support the grandmaster settings management request.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Support configuration of the grand master settings.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Throw a state decision event if the clock quality changes.

Management messages can cause a change in the clock quality. If this
happens, then it is time to run the Best Master Clock algorithm again.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
pmc: add a utility function for sending a message with the SET action.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
pmc: add our very first SET command.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Let the clock servo know the expected sync interval.

This patch adds a new servo method to let the algorithm know about the
master clock's reported sync message interval. This information can be
used by the servo to adapt its synchronization parameters.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Use a dynamic frequency estimation interval.

A slow servo (with smaller constants and lower sync rate) needs a
longer, better frequency estimation, but a higher sync rate hardly
needs any estimation at all, since it learns the frequency right away
in any case.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
phc2sys: Set servo sync interval.

[RC: merged servo_sync_interval signature change with earlier patch]

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Adjust constants of PI servo according to sync interval.

Instead of using fixed constants, set them by the following formula from
the current sync to allow good performance of the servo even when the
sync interval changes in runtime and to avoid instability.

kp = min(kp_scale * sync^kp_exponent, kp_norm_max / sync)
ki = min(ki_scale * sync^ki_exponent, ki_norm_max / sync)

The scale, exponent and norm_max constants are configurable. The
defaults are chosen so there is no change to the previous default
constants of the servo with one second sync interval. The automatic
adjustment can be disabled by setting the pi_proportional_const and
pi_integral_const options to a non-zero value, but stability of the
servo is always enforced.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Become the grand master when all alone.

This patch cleans up the BMC logic to allow assuming the GM role when no
other clocks are found in the network. By allowing the "best" to be NULL,
we can let the BMC to naturally pick the local clock as GM. As an added
bonus, this also get rid of the hacky check for a lost master.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>