public inbox for linux-rtc@vger.kernel.org
 help / color / mirror / Atom feed
* [QUESTION] rtc: zynqmp: CALIB_RD reset behavior differs between ZynqMP and Versal
@ 2026-03-05  9:24 Takumi Ando
  2026-03-06 10:09 ` Tomas Melin
  0 siblings, 1 reply; 6+ messages in thread
From: Takumi Ando @ 2026-03-05  9:24 UTC (permalink / raw)
  To: linux-rtc; +Cc: alexandre.belloni, michal.simek, Yasushi SHOJI, kanta tamura

Hi,

I have a question about the initialization logic in the zynqmp RTC
driver(drivers/rtc/rtc-zynqmp.c).

Currently the driver programs CALIB_WRITE only when CALIB_READ returns 0:

ret = readl(... + RTC_CALIB_RD);
if (!ret)
    writel(freq, ... + RTC_CALIB_WR);

My understanding is that this was designed to avoid overwriting an
existing calibration value. Since the RTC may continue running from the
battery domain even when Linux is not running, the calibration value may
have been configured previously and should be preserved.

However, according to the Versal Adaptive SoC Register Reference (AM012) [1],
the value returned by CALIB_RD after reset can be undefined.
In practice, on Versal hardware we observe non-zero values even before
any calibration has been programmed. Because of this, the current logic
may skip programming CALIB_WR and leave the Max_Tick field uninitialized.

On Zynq UltraScale+ Devices Register Reference (UG1087) [2],
CALIB_RD resets to 0, so the current logic works correctly there.
However, this assumption does not appear to hold for Versal.

If there is a register or mechanism that indicates whether the RTC has
already been calibrated, the driver could use that instead. However,
I could not find such an indicator in the documentation.

Am I missing something here? Is there a recommended way to detect whether
RTC calibration has already been configured?

Alternatively, would it be acceptable for the driver to always program
Max_Tick while preserving the fractional calibration bits already stored
in hardware?

Best regards,

[1] https://docs.amd.com/r/en-US/am012-versal-register-reference/CALIB_READ-PMC_RTC-Register
[2] https://docs.amd.com/r/en-US/ug1087-zynq-ultrascale-registers/CALIB_READ-RTC-Register

-- 
Takumi Ando
Space Cubics Inc.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-11  6:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-05  9:24 [QUESTION] rtc: zynqmp: CALIB_RD reset behavior differs between ZynqMP and Versal Takumi Ando
2026-03-06 10:09 ` Tomas Melin
2026-03-06 11:13   ` Alexandre Belloni
2026-03-11  3:19     ` Takumi Ando
2026-03-11  5:22       ` Tomas Melin
2026-03-11  6:52         ` Takumi Ando

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox