[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250804213213d4844d4e@mail.local>
Date: Mon, 4 Aug 2025 23:32:13 +0200
From: Alexandre Belloni <alexandre.belloni@...tlin.com>
To: Lothar Rubusch <l.rubusch@...il.com>
Cc: michal.simek@....com, srinivas.neeli@...inx.com,
linux-rtc@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, Ivan Vera <ivan.vera@...lustra.com>
Subject: Re: [PATCH v1 1/1] rtc: zynqmp: ensure correct RTC calibration
On 04/08/2025 15:47:50+0000, Lothar Rubusch wrote:
> From: Ivan Vera <ivan.vera@...lustra.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@...lustra.com>
> Signed-off-by: Lothar Rubusch <l.rubusch@...il.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);
Doesn't this forcefully overwrite the proper value that has been set
from userspace and so trashes the time at each reboot?
Isn't the proper way to reset it to simply set the offset from userspace
again?
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists