]> 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)
commit90f8f4c0e3cebd541deaa45cf0e470bb9810dd4f
treea08d7c91f26d718065e83dd6e1acba11d1909539
parent0b0e2ff10356e7e2ffd66ecdd6eee69a2f03449b
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: 6d59d4fa1789 ("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