Re: [PATCH 4/4] rtc: s3c: Fix RTC read on first boot
From: Krzysztof Kozlowski <hidden>
Date: 2021-10-19 16:10:26
Also in:
linux-samsung-soc, lkml
From: Krzysztof Kozlowski <hidden>
Date: 2021-10-19 16:10:26
Also in:
linux-samsung-soc, lkml
On 19/10/2021 17:48, Alexandre Belloni wrote:
On 19/10/2021 16:17:24+0300, Sam Protsenko wrote:quoted
On first RTC boot it has the month register value set to 0. Unconditional subtracting of 1 subsequently in s3c_rtc_gettime() leads to the next error message in kernel log: hctosys: unable to read the hardware clock That happens in s3c_rtc_probe() when trying to register the RTC, which in turn tries to read and validate the time. Initialize RTC date/time registers to valid values in probe function on the first boot to prevent such errors.No, never ever do that, the time is bogus and it has to stay this way, else userspace can't know whether the time on the RTC is the actual wall time or just some random value that you have set from the driver.
Indeed. This looks basically like a revert of your commit 5c78cceeb2d8
("rtc: s3c: stop setting bogus time"). For the Samsung PMIC RTC, we
dropped time initialization in commit fe787a5b2297 ("rtc: s5m: remove
undocumented time init on first boot").
Best regards,
Krzysztof