linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linus.ml.walleij@gmail.com (Linus Walleij)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 05/10] [ARM] tegra: Add timer support
Date: Tue, 8 Jun 2010 01:43:00 +0200	[thread overview]
Message-ID: <AANLkTilitoPKhSCk1gxwyzOdu8LZD-9xA3EesFKkDsLy@mail.gmail.com> (raw)
In-Reply-To: <1275635441-17378-6-git-send-email-olof@lixom.net>

2010/6/4 Olof Johansson <olof@lixom.net>:

> (....)
> +static struct clock_event_device tegra_clockevent = {
> + ? ? ? .name ? ? ? ? ? = "timer0",
> + ? ? ? .rating ? ? ? ? = 300,
> + ? ? ? .features ? ? ? = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
> + ? ? ? .mult ? ? ? ? ? = 16777,
> + ? ? ? .shift ? ? ? ? ?= 24,
> + ? ? ? .set_next_event = tegra_timer_set_next_event,
> + ? ? ? .set_mode ? ? ? = tegra_timer_set_mode,
> +};
> +
> +static struct clocksource tegra_clocksource = {
> + ? ? ? .name ? = "timer_us",
> + ? ? ? .rating = 300,
> + ? ? ? .read ? = tegra_clocksource_read,
> + ? ? ? .mask ? = 0xFFFFFFFFUL,
> + ? ? ? .mult ? = 1000,
> + ? ? ? .shift ?= 0,
> + ? ? ? .flags ?= CLOCK_SOURCE_IS_CONTINUOUS,
> +};

How did you calculate the magic mult/shift numbers 16777/24 and
1000/0 above? Especially the latter intuitively seem very inappropriate,
and I guess there will be revisions of this platform with new frequencies
for the timer as well, making these hard-coded values a bug source.

I would consider using the
clocksource_calc_mult_shift() and
clockevents_calc_mult_shift()
functions based on the frequency of the timer counter and a minimum wakeup
range if you don't know exactly why you want these mult+shifts.

I posted some patches to encourage the use of these recently.

Yours,
Linus Walleij

  parent reply	other threads:[~2010-06-07 23:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3478yvr76gerav>
2010-06-04  7:10 ` [PATCH 0/10] Tegra platform support Olof Johansson
2010-06-04  7:10   ` [PATCH 01/10] [ARM] tegra: initial tegra support Olof Johansson
2010-06-04  7:10     ` [PATCH 02/10] [ARM] tegra: Add IRQ support Olof Johansson
2010-06-04  7:10       ` [PATCH 03/10] [ARM] tegra: Add clock support Olof Johansson
2010-06-04  7:10         ` [PATCH 04/10] [ARM] tegra: SMP support Olof Johansson
2010-06-04  7:10           ` [PATCH 05/10] [ARM] tegra: Add timer support Olof Johansson
2010-06-04  7:10             ` [PATCH 06/10] [ARM] tegra: add GPIO support Olof Johansson
2010-06-04  7:10               ` [PATCH 07/10] [ARM] tegra: add pinmux support Olof Johansson
2010-06-04  7:10                 ` [PATCH 08/10] [ARM] tegra: harmony: Add harmony board file Olof Johansson
2010-06-04  7:10                   ` [PATCH 09/10] [ARM] tegra: Add tegra_defconfig Olof Johansson
2010-06-04  7:23                     ` [PATCH 10/10] [ARM] tegra: Add MAINTAINERS entry Olof Johansson
2010-06-07 23:47                   ` [PATCH 08/10] [ARM] tegra: harmony: Add harmony board file Linus Walleij
2010-06-07 23:43             ` Linus Walleij [this message]
2010-06-11 18:54               ` [PATCH 05/10] [ARM] tegra: Add timer support Colin Cross
2010-06-07  8:10     ` [PATCH 01/10] [ARM] tegra: initial tegra support Mike Rapoport
2010-06-07 23:34     ` Linus Walleij
2010-06-11 13:51       ` Olof Johansson
2010-06-05 18:19   ` [PATCH 0/10] Tegra platform support Grant Likely

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=AANLkTilitoPKhSCk1gxwyzOdu8LZD-9xA3EesFKkDsLy@mail.gmail.com \
    --to=linus.ml.walleij@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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).