linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Lothar Rubusch <l.rubusch@gmail.com>
To: alexandre.belloni@bootlin.com, michal.simek@amd.com,
	srinivas.neeli@xilinx.com
Cc: linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, l.rubusch@gmail.com,
	Ivan Vera <ivan.vera@enclustra.com>
Subject: [PATCH v1 1/1] rtc: zynqmp: ensure correct RTC calibration
Date: Mon,  4 Aug 2025 15:47:50 +0000	[thread overview]
Message-ID: <20250804154750.28249-2-l.rubusch@gmail.com> (raw)
In-Reply-To: <20250804154750.28249-1-l.rubusch@gmail.com>

From: Ivan Vera <ivan.vera@enclustra.com>

In the event of an uninitialized calibration register, ensure the register
is reset and properly programmed during the probe sequence.

At present, only the calibration register is evaluated. If it holds invalid
values after a power cycle, there's no longer a way to reset it, for
instance, via a devicetree entry to 0x7FFF. This issue is documented here:
https://adaptivesupport.amd.com/s/article/000036886?language=en_US 

The fix prioritizes an optional calibration value provided via the
devicetree over the value in the register.

Fixes: 07dcc6f9c76275d6679f28a69e042a2f9dc8f128 ("rtc: zynqmp: Add calibration set and get support")
Signed-off-by: Ivan Vera <ivan.vera@enclustra.com>
Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
---
 drivers/rtc/rtc-zynqmp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c
index f39102b66eac..0c063c3fae52 100644
--- a/drivers/rtc/rtc-zynqmp.c
+++ b/drivers/rtc/rtc-zynqmp.c
@@ -331,9 +331,9 @@ static int xlnx_rtc_probe(struct platform_device *pdev)
 		if (ret)
 			xrtcdev->freq = RTC_CALIB_DEF;
 	}
-	ret = readl(xrtcdev->reg_base + RTC_CALIB_RD);
-	if (!ret)
-		writel(xrtcdev->freq, (xrtcdev->reg_base + RTC_CALIB_WR));
+
+	/* Enable unconditional re-calibration to RTC_CALIB_DEF or DTB entry. */
+	writel(xrtcdev->freq, xrtcdev->reg_base + RTC_CALIB_WR);
 
 	xlnx_init_rtc(xrtcdev);
 
-- 
2.39.5



  reply	other threads:[~2025-08-04 16:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-04 15:47 [PATCH v1 0/1] rtc: zynqmp: ensure correct RTC calibration Lothar Rubusch
2025-08-04 15:47 ` Lothar Rubusch [this message]
2025-08-04 21:32   ` [PATCH v1 1/1] " Alexandre Belloni
2025-08-05 21:56     ` Lothar Rubusch
2025-08-05 22:24       ` Alexandre Belloni
2025-08-08 22:36         ` Lothar Rubusch

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=20250804154750.28249-2-l.rubusch@gmail.com \
    --to=l.rubusch@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=ivan.vera@enclustra.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=srinivas.neeli@xilinx.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;
as well as URLs for NNTP newsgroup(s).