Skip to content
Snippets Groups Projects
Commit bb1bdc72 authored by Stefan Eichenberger's avatar Stefan Eichenberger Committed by Greg Kroah-Hartman
Browse files

rtc: snvs: Allow a time difference on clock register read


[ Upstream commit 0462681e ]

On an iMX6ULL the following message appears when a wakealarm is set:

echo 0 > /sys/class/rtc/rtc1/wakealarm
rtc rtc1: Timeout trying to get valid LPSRT Counter read

This does not always happen but is reproducible quite often (7 out of 10
times). The problem appears because the iMX6ULL is not able to read the
registers within one 32kHz clock cycle which is the base clock of the
RTC. Therefore, this patch allows a difference of up to 320 cycles
(10ms). 10ms was chosen to be big enough even on systems with less cpu
power (e.g. iMX6ULL). According to the reference manual a difference is
fine:
- If the two consecutive reads are similar, the value is correct.
The values have to be similar, not equal.

Fixes: cd7f3a24 ("rtc: snvs: Add timeouts to avoid kernel lockups")
Reviewed-by: default avatarFrancesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: default avatarStefan Eichenberger <stefan.eichenberger@toradex.com>
Signed-off-by: default avatarFrancesco Dolcini <francesco@dolcini.it>
Link: https://lore.kernel.org/r/20221106115915.7930-1-francesco@dolcini.it


Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 6a54d033
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment