From: Tony Lindgren <tony@atomide.com>
To: Tarun Kanti DebBarma <tarun.kanti@ti.com>
Cc: linux-omap@vger.kernel.org, R Sricharan <r.sricharan@ti.com>
Subject: Re: [PATCH v3]OMAP:GPTIMER:1ms tick generation correction
Date: Wed, 7 Jul 2010 14:59:47 +0300 [thread overview]
Message-ID: <20100707115946.GM1920@atomide.com> (raw)
In-Reply-To: <1277239078-31386-1-git-send-email-tarun.kanti@ti.com>
* Tarun Kanti DebBarma <tarun.kanti@ti.com> [100622 12:35]:
> +/**
> + * omap_dm_timer_ms_correction - hardware correction for millisecond timer
> + * @timer: GPTIMER on which the correction support is to be applied
> + * @load: timer load value, used here to extract the expiry count
> + */
> +static void omap_dm_timer_ms_correction(struct omap_dm_timer *timer, u32 load)
> +{
> + int pos_increment, neg_increment;
> + unsigned int count = (0xFFFFFFFF - load) * 1024;
> +
> + pos_increment = (DIV_ROUND_UP(count, 1000) * 1000000) \
> + - (count * 1000);
> + neg_increment = ((DIV_ROUND_UP(count, 1000) - 1) * 1000000) \
> + - (count * 1000);
> + omap_dm_timer_write_reg(timer, OMAP_TIMER_TICK_POS_REG, pos_increment);
> + omap_dm_timer_write_reg(timer, OMAP_TIMER_TICK_NEG_REG, neg_increment);
> +}
>
> struct omap_dm_timer *omap_dm_timer_request(void)
> {
> @@ -612,6 +639,10 @@ void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
> {
> u32 l;
>
> +#ifdef CONFIG_ARCH_OMAP2PLUS
> + if (timer->ms_correction)
> + omap_dm_timer_ms_correction(timer, load);
> +#endif
> l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
> if (autoreload) {
> l |= OMAP_TIMER_CTRL_AR;
How do you know that the timer is configured to use the 32KiHZ source?
Also, since omap2_gp_timer_set_next_event calls all the time,
we don't want to do this calculation for every tick.. So we should
make it a separate optional function.
Or can we somehow calculate this drift once during init?
Regards,
Tony
next prev parent reply other threads:[~2010-07-07 11:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-22 20:37 [PATCH v3]OMAP:GPTIMER:1ms tick generation correction Tarun Kanti DebBarma
2010-07-07 11:59 ` Tony Lindgren [this message]
2010-07-07 12:33 ` David Brownell
2010-07-07 12:43 ` Tony Lindgren
2010-07-07 14:13 ` DebBarma, Tarun Kanti
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=20100707115946.GM1920@atomide.com \
--to=tony@atomide.com \
--cc=linux-omap@vger.kernel.org \
--cc=r.sricharan@ti.com \
--cc=tarun.kanti@ti.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.