]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rtc: mpfs: fix counter upload completion condition
authorConor Dooley <conor.dooley@microchip.com>
Wed, 13 May 2026 17:55:55 +0000 (18:55 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 22 Jun 2026 00:15:29 +0000 (02:15 +0200)
commit9792ff8afa9017fe14f436f3ef3cd75f41f9f145
tree897a5c8308712c29448a00ad56ca7e7735547510
parent419719c514252a2dbb2e2976f564c83417dd6d0a
rtc: mpfs: fix counter upload completion condition

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>
Link: https://patch.msgid.link/20260513-panhandle-ashy-70c6abf84d59@spud
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-mpfs.c