On 11/12/2017 at 14:46:41 +0200, Rabeeh Khoury wrote: > On Fri, Dec 1, 2017 at 7:10 PM, Gregory CLEMENT < > gregory.clement@xxxxxxxxxxxxxxxxxx> wrote: > > > Hi Baruch, > > > > On jeu., nov. 30 2017, Baruch Siach <baruch@xxxxxxxxxx> wrote: > > > > > Hi Thomas, > > > > > > As you know, the Armada 38x/8k RTC needs a reset sequence to be > > operational > > > when first powered up. This reset code is currently in the vendor > > provided > > > U-Boot RTC driver. But having to run 'date reset' from the U-Boot prompt > > every > > > first boot (happens quite a lot when dealing with SOMs) is not nice. An > > > automatic reset in the kernel driver would be much better. > > > > > > Rabeeh has mentioned to me that you had an idea how to detect at run > > time that > > > the RTC is in first power up state. Do you recall the details? > > > > Actually it was me who worked on the RTC but I didn't remember having a > > way to detect that the RTC is in first power up state. I dig in the > > datasheet, errata sheet and alos on varisou branches of the vendor tree > > and didn't find anything. > > > > Maybe a solution could be to reset the RTC when we set the time. > > > > > This is one way to do it; but then on first boot you might get real awkward > time; like year 2035 which can seriously confuse the boot process. > Detecting an uninitialized RTC and forcing it to tick with time = 0 (i.e. > 1970) is better way since boot failures can be reproduced in an orderly > manner (and the developer would know what was really wrong). Certainly not. If you know the time is invalid, then just return an error. Else, userspace has no way to know whether it can rely on the time from the RTC and act accordingly. -- Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com