summaryrefslogtreecommitdiff
path: root/drivers/rtc
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2022-03-09 17:22:52 +0100
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2022-03-23 19:58:40 +0100
commita87a07a111443adbf69cb815187e9532319e8530 (patch)
tree81b106c3915155234fd5a46a6076158f6ac0e056 /drivers/rtc
parent343597e29eecb391fec144e600b1af84999a5045 (diff)
downloadlinux-a87a07a111443adbf69cb815187e9532319e8530.tar.gz
rtc: spear: fix spear_rtc_read_time
The reference manual doesn't specify whether the registers are latched and they probably aren't, ensure the read time and date are consistent. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Link: https://lore.kernel.org/r/20220309162301.61679-21-alexandre.belloni@bootlin.com
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-spear.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c
index c395af3ebc91..d4777b01ab22 100644
--- a/drivers/rtc/rtc-spear.c
+++ b/drivers/rtc/rtc-spear.c
@@ -204,8 +204,10 @@ static int spear_rtc_read_time(struct device *dev, struct rtc_time *tm)
/* we don't report wday/yday/isdst ... */
rtc_wait_not_busy(config);
- time = readl(config->ioaddr + TIME_REG);
- date = readl(config->ioaddr + DATE_REG);
+ do {
+ time = readl(config->ioaddr + TIME_REG);
+ date = readl(config->ioaddr + DATE_REG);
+ } while (time == readl(config->ioaddr + TIME_REG));
tm->tm_sec = (time >> SECOND_SHIFT) & SECOND_MASK;
tm->tm_min = (time >> MINUTE_SHIFT) & MIN_MASK;
tm->tm_hour = (time >> HOUR_SHIFT) & HOUR_MASK;