Re: [PATCH] rtc: s3c-rtc: Avoid using broken ALMYEAR register

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Alexandre,

On 2018-11-13 12:39, Alexandre Belloni wrote:
> On 13/11/2018 12:32:50+0100, Marek Szyprowski wrote:
>> (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.
>>
> I'm probably missing something but can't you set that third BCD value to
> 0 in ALMYEAR?


s3c-rtc code sets it to 0 already, both for ALMYEAR and RTCYEAR registers
(bin2bcd returns 2 BCD characters, which are written to the register as u32,
with leading zeros). However I've observed that both mentioned registers
after such operation can still contain random noise on the third BCD
character, what make the alarm completely unreliable.

> ...


Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland




[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  Powered by Linux