Best way to determine tb_ticks_per_jiffy inside todc_calibrate_decr()

Mark A. Greer mgreer at mvista.com
Tue Apr 12 04:39:05 EST 2005


Daniel Ann wrote:

>On Apr 9, 2005 3:32 AM, Mark A. Greer <mgreer at mvista.com> wrote:
>  
>

>>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.
>

Ah, that sounds reasonable.  ;)

>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 :)
>

Cool.

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

Because the internally kept time in ppc linux is based on the 
decrementer counter and, according to the manual for the 8245, the 
decrementer counter is decremented once every four sys_logic_clk 
cycles.  Therefore, you need to divide by 4.

Mark




More information about the Linuxppc-embedded mailing list