linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Mark A. Greer" <mgreer@mvista.com>
To: Daniel Ann <ktdann@gmail.com>
Cc: linuxppc-embedded <linuxppc-embedded@ozlabs.org>
Subject: Re: Best way to determine tb_ticks_per_jiffy inside	todc_calibrate_decr()
Date: Fri, 08 Apr 2005 11:32:33 -0700	[thread overview]
Message-ID: <4256CE41.1000404@mvista.com> (raw)
In-Reply-To: <9b7ca65705040801455b84eb0d@mail.gmail.com>

Daniel,

Daniel Ann wrote:

>Hey folks,
>
>I seem to have problem getting 1 second right. Board has no RTC so
>I've basically NULLed all the todc_XXX functions except
>todc_calibrate_decr.
>

If you don't have an RTC, you shouldn't be using any todc_xxx routines.

>
>Now question is, what value should I be assigning it to tb_ticks_per_jiffy ?
>
>I was able to dig up some info from the archive, and it read,
>=-=-=-FROM ARCHIVE =-=-=-
>You must find this value by yourself but a good starting point is your
>frequency in Hz (I think)
>Example of the code
>	unsigned int freq = 28000000;
>	tb_tick_per_jiffy = freq/HZ;
>	tb_to_us = mulhwu_scale_factor(freq,1000000);
>=-=-=-END OF ARCHIVE =-=-=-
>
>I'm fine with working it out myself but where do I start ? My board
>has 33MHz OSC, so I've trie freq = 33 * 1000000 (where HZ is defined
>100) but it turned out to be little short. I could have just tried few
>more trial and error, but I prefer knowing what I'm doing so.. :)
>

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

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.

Mark

  reply	other threads:[~2005-04-08 18:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-08  8:45 Best way to determine tb_ticks_per_jiffy inside todc_calibrate_decr() Daniel Ann
2005-04-08 18:32 ` Mark A. Greer [this message]
2005-04-09  1:29   ` Daniel Ann
2005-04-11 18:39     ` Mark A. Greer
2005-04-12  3:55       ` Daniel Ann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4256CE41.1000404@mvista.com \
    --to=mgreer@mvista.com \
    --cc=ktdann@gmail.com \
    --cc=linuxppc-embedded@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).