]> git.baikalelectronics.ru Git - kernel.git/commit
rtc: s3c-rtc: Avoid using broken ALMYEAR register
authorMarek Szyprowski <m.szyprowski@samsung.com>
Tue, 13 Nov 2018 11:32:50 +0000 (12:32 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 14 Nov 2018 09:44:36 +0000 (10:44 +0100)
commitcb3cc92d51a7b30d4659619b78581501632fa9d5
tree214c670fd15872fb228552d20de246b5ea3223d4
parent0a2880d45d4ecf537a6e81405c3f1508e1013378
rtc: s3c-rtc: Avoid using broken ALMYEAR register

(RTC,ALM)YEAR registers of Exynos built-in RTC device contains 3 BCD
characters. s3c-rtc driver uses only 2 lower of them and supports years
from 2000..2099 range. The third BCD value is typically set to 0, but it
looks that handling of it is broken in the hardware. It sometimes
defaults to a random (even non-BCD) value. This is not an issue
for handling RTCYEAR register, because bcd2bin() properly handles only
8bit values (2 BCD characters, the third one is skipped). The problem
is however with ALMYEAR register and proper RTC alarm operation. When
YEAREN bit is set for the configured alarm, RTC hardware triggers alarm
only when ALMYEAR and RTCYEAR matches. This usually doesn't happen
because of the random noise on the third BCD character.

Fix this by simply skipping setting ALMYEAR register in alarm
configuration. This workaround fixes broken alarm operation on Exynos
built-in rtc device. My tests revealed that the issue happens on the
following Exynos series: 3250, 4210, 4412, 5250 and 5410.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-s3c.c