Zynqmp RTC

Zynqmp RTC

Introduction

The Zynq® UltraScale+™ MPSoC real time clock (RTC) provides the real time even when the device is powered off. When the device is off, the RTC is switched to the battery power supply. A battery-backed RAM (BBRAM) is provided for when device is operating in the battery mode. However, the RTC controller and user interface are only operational when the low-power domain supply is ON. The RTC has an alarm function that generates an alarm at a specific time and date with a 136-year range. The RTC also has periodic software calibration and logic to correct the static fractional inaccuracy of an oscillator.

HW/IP FEATURES:

Real-Time Clock (RTC) provides the following features:

  • Maintains the real time, even when the device is off (powered-off).

  • Has the capability to generate an alarm at a specific time and date.

  • Includes the means for periodic software calibration of the RTC.

  • Includes logic to correct the static fractional inaccuracy of the oscillator.

  • Keeps track of time within a window of more than 136 years (232 seconds) from a reference point.

  • Implemented as three counters.

  • 16-bit tick counter creates one second based on the crystal clock.

  • 4-bit fraction counter keeps track of the static crystal errors in one second that is less than one oscillator tick.

  • 32-bit seconds counter holds the real time and allows on-demand reload whenever current time of the RTC is set.

  • Allows wake-up at a specific second within the 136 years (32-bit alarm)

Missing features, Known Issues, limitations

  • None

 

When the PMC is powered down, the RTC control register must be reprogrammed to maintain accurate control settings, as these registers reside in the battery power domain. Starting from Kernel 6.1, the RTC driver uses the calibration property from the device tree to set the CALIB_WRITE register. This calibration is applied only once, during the first boot, when the CALIB_READ register value is 0. The driver assumes the battery remains intact and will not be replaced, so it does not overwrite the calibration value in subsequent probes.

Battery Use Case:

  • If the calibration register becomes corrupted, it can result in incorrect RTC clock time. 

  • Since the RTC block has battery backup, calibration data is retained across power cycles.

  • Users can adjust calibration using the set/get offset framework calls.

Non-Battery Use Case / Battery Loss Scenario:

  • As the registers are powered by the battery domain, any battery power loss (e.g., glitch or replacement) will cause calibration loss.

  • It is the user's responsibility to set the calibration value in such cases.

  • Calibration can still be adjusted via set/get offset framework calls.

For Calibration register corruption, refer 000036886 - RTC clock time is incorrect due to calibration register corruption

Overview of Linux RTC Framework

http://lxr.free-electrons.com/source/Documentation/rtc.txt
This weblink is path to rtc.txt file in linux documentation which clearly expalins about the legacy and new framework for RTC on SoC.

Kernel Configuration:

Kconfig options:

config RTC_DRV_ZYNQMP tristate "Xilinx Zynq Ultrascale+ MPSoC RTC" depends on OF help If you say yes here you get support for the RTC controller found on Xilinx Zynq Ultrascale+ MPSoC.

Menuconfig snapshots -

[*] EDAC (Error Detection And Correction) reporting ---> [*] Real Time Clock ---> [*] DMA Engine support ---> [*] Auxiliary Display support --->



--- Real Time Clock [*] Set system time from RTC on startup and resume [*] Set the RTC time based on NTP synchronization (NEW) (rtc0) RTC used to set the system time [ ] RTC debug support *** RTC interfaces *** [*] /sys/class/rtc/rtcN (sysfs) [*] /proc/driver/rtc (procfs for rtcN) [*] /dev/rtcN (character devices) [ ] RTC UIE emulation on dev interface < > Test driver/device ........ *** Platform RTC drivers *** ........ < > ST M48T86/Dallas DS12887 < > ST M48T35 < > ST M48T59/M48T08/M48T02 < > Oki MSM6242 (NEW) < > TI BQ4802 < > Ricoh RP5C01 (NEW) < > EM Microelectronic V3020 <*> Xilinx Zynq Ultrascale+ MPSoC RTC (NEW) *** on-CPU RTC drivers ***

Testing Procedure

1.Get current date and time using "date" command 2.Set date and time using following commanddate -s "2015-09-08 13:36:00" 3. Verify the same using date command again.

Mainline status

This driver is currently in sync with the mainline kernel.

 

ChangeLog

  • 2025.1

    • Summary:

      • rtc: zynqmp: Fix optional clock name property

    • Commit:

  • 2024.2

    • None

  • 2024.1

    •  Summary

      • rtc: zynqmp: Convert to platform remove callback returning void

    • Commit

  • 2023.2

    • None

  • 2023.1

    • Summary

      • rtc: zynqmp: initialize fract_tick

    • Commit

Related Links

http://lxr.free-electrons.com/source/Documentation/rtc.txt

© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy