This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5748: SDK09/11: System clock drift / systemd-journald "Time going backwards"

Part Number: AM5748

There is a clock drift issue with the current 57x kernel which was initiated because of a switch to the 32k counter due to an errata.

commit: "clocksource/drivers/timer-ti-dm: Handle dra7 timer wrap errata i940"

This 32k counter unfortunately introduces a large clock drift (2s per hour) since its divided down from the 20Mhz sysclk which results in a 32,787Hz clock, instead of the expected 32,768Hz.

 
 
Sinthu Raja <sinthu.raja@ti.com>submitted a patch series to u-boot which switches to use dmtimer12, which can accurately generate a higher speed clockrate for the kernel.

https://patchew.org/linux/20250901101525.1090334-1-a-dutta@ti.com/

I tested this series on a Critical Link MitySOM-AM57x board (AM572x /
DRA752-GP, 20 MHz SYS_CLK1).  With counter_32k disabled and DMTimer 12
registered as the system clocksource via these patches, system clock
drift dropped from +553 ppm (counter_32k 32,787Hz instead of 32,768Hz)
to +2 ppm over a 50.8 h measurement window

  /sys/devices/system/clocksource/clocksource0/available_clocksource:
  dmtimer

Note: to make the fix apply to non-beagle-x15 DRA7/AM57 boards, I moved
the &timer12_target and &counter32k overrides from am57xx-beagle-x15.dts
into dra7.dtsi.  Worth considering for v3 so other boards (MitySOM,
am57xx-idk, AM572x-EVM, etc.) pick up the fix automatically rather than
each needing the same per-board override.

https://support.criticallink.com/gitweb/?p=linux-ti.git;a=commit;h=0769404453bc6c6ec4afb08ba9c1b82376baf446
https://support.criticallink.com/gitweb/?p=linux-ti.git;a=commit;h=99f8348e183b94f3e4dd258cf08a8eaac0002b27

This brings me to the second issue, TI has added a work around systemd service sys-clock-drift.service which forces the current time to the rtc time. This does help keep system time from drifting too far but unfortunately triggers a jump in time which systemd-journald trips as a system time jump. This service needs to be disabled now that the kernel is fixed but someone bbappended the systemd recipe instead of creating a seperate recipe which could be easily disabled...
systemd-journald[117]: Time jumped backwards, rotating.
https://git.ti.com/cgit/ti-sdk-linux/meta-tisdk/commit/?h=am57x&id=982761ae3031c12ab7c270fb4e91b15198795299