Page MenuHomeFreeBSD

aw_rtc: bump settime() delays
ClosedPublic

Authored by mhorne on Dec 11 2025, 8:46 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jun 20, 1:19 PM
Unknown Object (File)
Fri, Jun 12, 8:51 AM
Unknown Object (File)
Thu, Jun 4, 10:44 AM
Unknown Object (File)
May 20 2026, 12:09 PM
Unknown Object (File)
May 18 2026, 5:38 PM
Unknown Object (File)
May 17 2026, 4:28 PM
Unknown Object (File)
May 17 2026, 12:00 PM
Unknown Object (File)
May 16 2026, 9:17 PM
Subscribers

Details

Summary

There are delay loops, checking the BUSY status bit, before writing to
the date or time registers. Each iteration contains a 1usec delay, for a
maximum of 70 iterations.

This is frequently not enough on the D1 platform, where the message is
emitted:

rtc0: could not set date, RTC busy

Bump the loop delay to 10usecs each, and the maximum number of
iterations to 150, for a maximum delay of 1.5msecs between each write of
the register.

In my testing this seems to be adequate.

The loop variable is renamed for clarity/simplicity.

Test Plan

I (roughly) measured the required number of loops on my hardware.

At DELAY(1):

rtc0: first read took 0 iterations
rtc0: second read took 156 iterations
rtc0: third read took 169 iterations

At DELAY(10):

rtc0: first read took 0 iterations
rtc0: second read took 127 iterations
rtc0: third read took 117 iterations

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable