]> git.baikalelectronics.ru Git - kernel.git/commit
ptp: ocp: Add ptp_ocp_adjtime_coarse for large adjustments
authorJonathan Lemon <jonathan.lemon@gmail.com>
Mon, 28 Feb 2022 20:39:57 +0000 (12:39 -0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 2 Mar 2022 17:51:21 +0000 (09:51 -0800)
commitd6c5da8943dcf6e0734f26afa666acb9317a1a60
treea08d7c91f26d718065e83dd6e1acba11d1909539
parent29b85e0cc6a1b04dbc0e4c806fbb4243df9b29ff
ptp: ocp: Add ptp_ocp_adjtime_coarse for large adjustments

In ("ptp: ocp: Have FPGA fold in ns adjustment for adjtime."), the
ns adjustment was written to the FPGA register, so the clock could
accurately perform adjustments.

However, the adjtime() call passes in a s64, while the clock adjustment
registers use a s32.  When trying to perform adjustments with a large
value (37 sec), things fail.

Examine the incoming delta, and if larger than 1 sec, use the original
(coarse) adjustment method.  If smaller than 1 sec, then allow the
FPGA to fold in the changes over a 1 second window.

Fixes: 07c366bf6177 ("ptp: ocp: Have FPGA fold in ns adjustment for adjtime.")
Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Link: https://lore.kernel.org/r/20220228203957.367371-1-jonathan.lemon@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/ptp/ptp_ocp.c