Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+4 -2
+4 -2
drivers/rtc/rtc-spear.c
··· 204 204 /* we don't report wday/yday/isdst ... */ 205 205 rtc_wait_not_busy(config); 206 206 207 - time = readl(config->ioaddr + TIME_REG); 208 - date = readl(config->ioaddr + DATE_REG); 207 + do { 208 + time = readl(config->ioaddr + TIME_REG); 209 + date = readl(config->ioaddr + DATE_REG); 210 + } while (time == readl(config->ioaddr + TIME_REG)); 209 211 tm->tm_sec = (time >> SECOND_SHIFT) & SECOND_MASK; 210 212 tm->tm_min = (time >> MINUTE_SHIFT) & MIN_MASK; 211 213 tm->tm_hour = (time >> HOUR_SHIFT) & HOUR_MASK;