mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Akashdeep Kaur <a-kaur@ti.com>
To: <praneeth@ti.com>, <nm@ti.com>, <vigneshr@ti.com>,
	<alexandre.belloni@bootlin.com>, <linux-rtc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <sebin.francis@ti.com>
Cc: <s-tripathi1@ti.com>, <vishalm@ti.com>, <k-willis@ti.com>,
	<a-kaur@ti.com>
Subject: [PATCH 0/2] rtc: Prevent hctosys from using invalid RTC time
Date: Wed, 21 Oct 2026 09:54:33 +0530	[thread overview]
Message-ID: <20261021042435.3895543-1-a-kaur@ti.com> (raw)

The kernel's boot-time RTC synchronization blindly trusts the RTC 
value when setting system time, but RTCs may have invalid time 
depending on the boot path:

- On first cold boot: RTC may have lost power, time is invalid
- After low-power mode (RTC-only) cold boot: RTC retained power, time 
  is valid

On normal cold boot where bootloader or NTP has already established 
correct time, boot-time sync (triggered when RTC driver loads as 
module or probes at boot) can overwrite it with invalid RTC data, 
causing time rollback to 1970. However, on boot from RTC-only power 
mode, the RTC has valid time and boot-time sync should work to 
restore system time from RTC.

This series adds a flag that drivers set dynamically per-boot to 
indicate whether RTC has valid time. Drivers check at probe if RTC 
retained power through this specific boot. Boot-time sync checks this 
flag before setting system time. This enables correct behavior for 
both boot paths while keeping PM suspend/resume compensation 
unaffected.

---

Akashdeep Kaur (2):
  rtc: Add flag for dynamic hctosys control
  rtc: ti-k3: Mark RTC time as invalid without battery backup

 drivers/rtc/class.c     | 15 +++++++++++++++
 drivers/rtc/rtc-ti-k3.c |  7 +++++++
 include/linux/rtc.h     |  7 +++++++
 3 files changed, 29 insertions(+)


base-commit: 8f7df005a7564bd7ffa75da9c3085d5b996f1e16
-- 
2.34.1


             reply	other threads:[~2026-10-21  4:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21  4:24 Akashdeep Kaur [this message]
2026-10-21  4:24 ` [PATCH 1/2] rtc: Add flag for dynamic hctosys control Akashdeep Kaur
2026-10-21  4:24 ` [PATCH 2/2] rtc: ti-k3: Mark RTC time as invalid without battery backup Akashdeep Kaur
2026-10-21  7:13 ` [PATCH 0/2] rtc: Prevent hctosys from using invalid RTC time Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261021042435.3895543-1-a-kaur@ti.com \
    --to=a-kaur@ti.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=k-willis@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=praneeth@ti.com \
    --cc=s-tripathi1@ti.com \
    --cc=sebin.francis@ti.com \
    --cc=vigneshr@ti.com \
    --cc=vishalm@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®