Port-sparc64 archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Sun Fire V240 RTC
Hi Frank,
> > So we know that the DS1307 clock on your machine is set correctly and stays
> > that way.
>
> I'm not so sure anymore. See below.
> > if you run `date` or shutdown, then the system time is saved to the
> > configured RTC(s).
>
> Yes. Confirmed. See below.
> I added some printf's this morning, and I can confirm that both RTCs are
> updated. During shutdown and also when setting the time with 'date'.
> [ 14.110019] WARNING: clock gained 10958 days
> [ 14.110019] dsrtc_gettime_ymdhms
> [ 14.220019] WARNING: clock gained 946771200 seconds
> [ 15.840028] entropy: ready
> Note, that both RTCs seem to have a problem and are off by 30 years, if we
> assume that the second warning belongs to the DS1307.
> The year written in the driver (at least mc146818, where I printed details)
> seems ok. But after reboot it always gains 30 years.
Oh! 30 years is important here, and I completely missed that earlier.
We set the rtc offset start year for the DS1307:
https://nxr.netbsd.org/xref/src/sys/arch/sparc64/sparc64/ofw_patch.c#709
and use it in the time calculation:
https://nxr.netbsd.org/xref/src/sys/dev/i2c/ds1307.c#329
https://nxr.netbsd.org/xref/src/sys/dev/i2c/ds1307.c#560 (get)
https://nxr.netbsd.org/xref/src/sys/dev/i2c/ds1307.c#588 (set)
However, I realise that I only tested with the offset on the V245 and not
on the V240. So, either it's not being applied correctly or we shouldn't
have that on the V240. Can you try removing that block from ofw_patch.c?
If that fixes it, then we can set the start-year property only for
V215/V245/V445. If not, then sc->sc_base_year is not being set correctly
in ds1307.c.
I'm guessing that our code is working correctly, but because we use the
wrong start offset, the ALOM moves the M5819p clock 30 years forward on
each reset, which makes the kernel think that the 2 clocks are 30 years
apart. Also, because we currently treat the first clock found as the
system clock, the system time moves forward 30 years on each boot.
"WARNING: clock gained 946771200 seconds" might mean that I have the clock
delta reversed. I also realise that it would be much better to display it
as something like "WARNING: dsrtc0 is 946771200 seconds ahead of rtc0"
(or "behind rtc0", depending on the skew).
Regards,
Julian
PS. I have some work-in-progress patches to set which clock is the system
clock and also for displaying the clock values using sysctl. For these
machines, the system clock would (obviously) be the ds1307.
--
Home |
Main Index |
Thread Index |
Old Index