From: <Valentina.FernandezAlanis@microchip.com>
To: <conor@kernel.org>, <linux-riscv@lists.infradead.org>
Cc: <Conor.Dooley@microchip.com>, <stable@vger.kernel.org>,
<Daire.McNamara@microchip.com>, <alexandre.belloni@bootlin.com>,
<linux-rtc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<Valentina.FernandezAlanis@microchip.com>
Subject: Re: [PATCH v1] rtc: mpfs: fix counter upload completion condition
Date: Tue, 2 Jun 2026 13:14:02 +0000 [thread overview]
Message-ID: <fa8c35eb-7572-4413-867d-db42df92790f@microchip.com> (raw)
In-Reply-To: <20260513-panhandle-ashy-70c6abf84d59@spud>
On 13/05/2026 18:55, Conor Dooley wrote:
> From: Conor Dooley <conor.dooley@microchip.com>
>
> The condition that needs to be checked for upload completion is the
> UPLOAD bit in the completion register going low. The original iterations
> of this driver used a do-while and this was converted to a
> read_poll_timeout() during upstreaming without the condition being
> inverted as it should have been.
>
> I suspect that this went unnoticed until now because a) the first read
> was done when the bit was still set, immediately completing the
> read_poll_timeout() and b) because the RTC doesn't hold time when power
> is removed from the SoC reducing its utility (I for one keep it
> disabled). If my first suspicion was true when the driver was
> upstreamed, it's not true any longer though, hence the detection of the
> problem.
>
> Fixes: 0b31d703598dc ("rtc: Add driver for Microchip PolarFire SoC")
> CC: stable@vger.kernel.org
> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Tested-by: Valentina Fernandez <valentina.fernandezalanis@microchip.com>
> ---
> CC: Valentina.FernandezAlanis@microchip.com
> CC: Conor Dooley <conor.dooley@microchip.com>
> CC: Daire McNamara <daire.mcnamara@microchip.com>
> CC: Alexandre Belloni <alexandre.belloni@bootlin.com>
> CC: linux-riscv@lists.infradead.org
> CC: linux-rtc@vger.kernel.org
> CC: linux-kernel@vger.kernel.org
> ---
> drivers/rtc/rtc-mpfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-mpfs.c b/drivers/rtc/rtc-mpfs.c
> index 6aa3eae575d2a..ece6de4a6adbd 100644
> --- a/drivers/rtc/rtc-mpfs.c
> +++ b/drivers/rtc/rtc-mpfs.c
> @@ -112,7 +112,7 @@ static int mpfs_rtc_settime(struct device *dev, struct rtc_time *tm)
> ctrl |= CONTROL_UPLOAD_BIT;
> writel(ctrl, rtcdev->base + CONTROL_REG);
>
> - ret = read_poll_timeout(readl, prog, prog & CONTROL_UPLOAD_BIT, 0, UPLOAD_TIMEOUT_US,
> + ret = read_poll_timeout(readl, prog, !(prog & CONTROL_UPLOAD_BIT), 0, UPLOAD_TIMEOUT_US,
> false, rtcdev->base + CONTROL_REG);
> if (ret) {
> dev_err(dev, "timed out uploading time to rtc");
prev parent reply other threads:[~2026-06-02 13:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 17:55 [PATCH v1] rtc: mpfs: fix counter upload completion condition Conor Dooley
2026-06-02 9:16 ` Conor Dooley
2026-06-02 13:14 ` Valentina.FernandezAlanis [this message]
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=fa8c35eb-7572-4413-867d-db42df92790f@microchip.com \
--to=valentina.fernandezalanis@microchip.com \
--cc=Conor.Dooley@microchip.com \
--cc=Daire.McNamara@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=conor@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-rtc@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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