
Wolfgang Denk schrieb:
Dear Reinhard Meyer,
In message 4C31ED2B.1020707@emk-elektronik.de you wrote:
As well as there is a difference between read error and file not found, there well might be a difference in clock nonfunctional and time invalid...
Indeed.
But alas, I will make rtc_get not return an error and zero out the tm structure instead when the driver KNOWS the date is not correct.
Why would you do that? This prevents anybody trying to track down problems from seeing what is really going on. When you retrun the real (incorrect) data, I can see if the attempt to set the date shows any affect at all - with your method I don't see anything at all.
So far no AT91SAM9xxx board has a date command in u-boot. The kernel as it is will not set the system time when the offset register is zero. If the register is non-zero the time will be used.
I'm just trying to have the same behaviour in u-boot.
Besides your argumentation is flawed: why try to READ the clock when I am going to set it anyway? This reading and the following if just increase the code size :)
Now setting the clock still gives the warning (puts() in the driver) that the time is invalid (because the time is read before overwritten).
I think that is more irritating. So your suggestions is then to have the driver not say anything at all, just return OK and a bogus value...
Reinhard