Best way to determine tb_ticks_per_jiffy inside todc_calibrate_decr()

Daniel Ann ktdann at gmail.com
Sat Apr 9 11:29:57 EST 2005


On Apr 9, 2005 3:32 AM, Mark A. Greer <mgreer at mvista.com> wrote:
> If you don't have an RTC, you shouldn't be using any todc_xxx routines.

Yeah, I figured this much :)

> There are several platform files that explicitly set tb_ticks_per_jiffy
> and tb_to_us.  Did you try looking at those?

Actually that didnt occur to me since I thought it was related to the
supplied oscillator. Not knowing what their board is equiped with, I
couldnt trust their value any more than my estimated value. But
reading your next comment, it seems that it's related to processor as
well.

> Also, 33MHz does not sound right but then you don't say what processor
> you're using so who knows.  You need to find the bus freq used by the
> cpu/system.  Try looking for the freq of the processor's SYSCLK input.
> Then you probably have to divide that by 4 to get the frequency that the
> decrementer runs at.  That's the value that you should use for the
> 'freq' variable in the example code you included in your email.

Okay guess I had all these things mixed up in head. What I should have
said is, source to PCI_SYNC_IN is 33MHz.
Anyway, following the MPC8245 hardware Spec pdf file, I was able to
find the peripheral logic/memory bus clock to be 99,000,000. Dividing
that by 4 like you said, gave me the value of 24,750,000. Which is
I've used it to get very real 1 second :)

BTW, why do you have to divide it by 4 ?

-- 
Daniel



More information about the Linuxppc-embedded mailing list