System Clock runaway on Xilinx platform

Grant Likely grant.likely at
Thu Feb 7 07:29:18 EST 2008

On 2/6/08, khollan <khollan at> wrote:
> Hi all,
> Thanks for the help so far!
> I'm now running linux 2.6.21 on my custom virtex 4 board modeled after the
> ml410.  The cpu clock is 300MHz and the PLB bus is 175MHz.
> My question is which clock is the linux system clock that keeps track of the
> date derived from?  I set my date with rdate -s at boot and
> then compare with the date command and rdate -p and they are
> off by 20 or so seconds even just after a few minutes, this trend continues
> and it will be off by a day after a few hours.  I think I just don't have
> something defined correctly but I can't figure out which.

The clock is maintained off of the PowerPC time base register (TBL,
TBU).  On Virtex ppc platforms, the time base frequency is supposed to
be the same as the CPU clock.  Can you figure out *exactly* how
quickly the clock is drifting?

How are you booting your Virtex platform?  u-boot or a zImage.elf?  If
it's a zImage, the CPU clock frequency is set in
arch/ppc/boot/simple/embed_config.c (search for CONFIG_XILINX and look
for the line that sets bd->bi_intfreq).  Make XPAR_CORE_CLOCK_FREQ_HZ
in xparameters matches you CPU clock speed.

Side note: you may notice that bd->bi_tbfreq is also used but not set;
that's because bd->bi_intfreq and bd->tbfreq point to the same memory
location.  (It's kind of messed up that way, don't worry too much
about it)

If you're using u-boot, then u-boot will set the cpu frequency in the
board info structure.


Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

More information about the Linuxppc-embedded mailing list