linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 17/19] clockevents: ARM sp804: obtain sp804 timer rate via clks
Date: Mon, 16 May 2011 16:24:27 -0500	[thread overview]
Message-ID: <4DD1960B.5000603@gmail.com> (raw)
In-Reply-To: <E1QM1dU-0003EL-9p@rmk-PC.arm.linux.org.uk>

On 05/16/2011 12:31 PM, Russell King - ARM Linux wrote:
> This allows platforms to specify the rate of the SP804 clockevent via
> the clk subsystem.  While ARM boards clock these at 1MHz, BCMRing also
> has SP804 timers but are clocked at different rates.
>
> Cc: Catalin Marinas<catalin.marinas@arm.com>
> Signed-off-by: Russell King<rmk+kernel@arm.linux.org.uk>
> ---
>   arch/arm/common/timer-sp.c        |   16 ++++++++--------
>   arch/arm/mach-vexpress/ct-ca9x4.c |    4 ++++
>   arch/arm/mach-vexpress/v2m.c      |    4 ++++
>   3 files changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
> index bf92afe..1707c92 100644
> --- a/arch/arm/common/timer-sp.c
> +++ b/arch/arm/common/timer-sp.c
> @@ -28,12 +28,6 @@
>
>   #include<asm/hardware/arm_timer.h>
>
> -/*
> - * These timers are currently always setup to be clocked at 1MHz.
> - */
> -#define TIMER_FREQ_KHZ	(1000)
> -#define TIMER_RELOAD	(TIMER_FREQ_KHZ * 1000 / HZ)
> -
>   static long __init sp804_get_clock_rate(const char *name)
>   {
>   	struct clk *clk;
> @@ -84,6 +78,7 @@ void __init sp804_clocksource_init(void __iomem *base, const char *name)
>
>
>   static void __iomem *clkevt_base;
> +static unsigned long clkevt_reload;
>
>   /*
>    * IRQ handler for the timer
> @@ -109,7 +104,7 @@ static void sp804_set_mode(enum clock_event_mode mode,
>
>   	switch (mode) {
>   	case CLOCK_EVT_MODE_PERIODIC:
> -		writel(TIMER_RELOAD, clkevt_base + TIMER_LOAD);
> +		writel(clkevt_reload, clkevt_base + TIMER_LOAD);
>   		ctrl |= TIMER_CTRL_PERIODIC | TIMER_CTRL_ENABLE;
>   		break;
>
> @@ -158,12 +153,17 @@ void __init sp804_clockevents_init(void __iomem *base, unsigned int irq,
>   	const char *name)
>   {
>   	struct clock_event_device *evt =&sp804_clockevent;
> +	long rate = sp804_get_clock_rate(name);
> +
> +	if (rate<  0)
> +		return;
>
>   	clkevt_base = base;
> +	clkevt_reload = DIV_ROUND_CLOSEST(rate, HZ);
>
>   	evt->name = name;
>   	evt->irq = irq;
> -	evt->mult = div_sc(TIMER_FREQ_KHZ, NSEC_PER_MSEC, evt->shift);
> +	evt->mult = div_sc(rate, SEC_PER_MSEC, evt->shift);

This doesn't compile or make sense. Should be NSEC_PER_SEC.

Rob

  reply	other threads:[~2011-05-16 21:24 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-16 17:23 [PATCH v2 00/19] Consolidate simple ARM MMIO clock sources Russell King - ARM Linux
2011-05-16 17:25 ` [PATCH 01/19] Make clocksource name const Russell King - ARM Linux
2011-05-19  1:24   ` Hans J. Koch
2011-05-19  7:19   ` Linus Walleij
2011-05-16 17:26 ` [PATCH 02/19] ARM: s5p: consolidate selection of timer register Russell King - ARM Linux
2011-05-16 17:26 ` [PATCH 03/19] ARM: omap1: delete useless interrupt handler Russell King - ARM Linux
2011-05-16 17:26 ` [PATCH 04/19] ARM: omap1: convert to using readl/writel instead of volatile struct Russell King - ARM Linux
2011-05-17 21:59   ` Catalin Marinas
2011-05-18  7:56     ` Russell King - ARM Linux
2011-05-18 20:48     ` Linus Walleij
2011-05-16 17:27 ` [PATCH 05/19] ARM: update sa1100 to reflect PXA updates Russell King - ARM Linux
2011-05-16 17:27 ` [PATCH 06/19] clocksource: add common mmio clocksource Russell King - ARM Linux
2011-05-16 17:27 ` [PATCH 07/19] clocksource: convert ARM 32-bit up counting clocksources Russell King - ARM Linux
2011-05-16 18:30   ` Eric Miao
2011-05-17  6:38   ` Sascha Hauer
2011-05-16 17:28 ` [PATCH 08/19] clocksource: convert ARM 32-bit down " Russell King - ARM Linux
2011-05-16 17:28 ` [PATCH 09/19] clocksource: convert W90x900 24-bit down counting clocksource Russell King - ARM Linux
2011-05-16 17:28 ` [PATCH 10/19] clocksource: convert Integrator/AP 16-bit " Russell King - ARM Linux
2011-05-16 17:29 ` [PATCH 11/19] clocksource: convert SPEAr platforms 16-bit up " Russell King - ARM Linux
2011-05-16 17:29 ` [PATCH 12/19] clocksource: convert MXS timrotv2 to 32-bit down " Russell King - ARM Linux
2011-05-16 17:29 ` [PATCH 13/19] clocksource: convert OMAP1 " Russell King - ARM Linux
2011-05-16 17:30 ` [PATCH 14/19] clocksource: ARM sp804: allow clocksource name to be specified Russell King - ARM Linux
2011-05-16 17:30 ` [PATCH 15/19] clocksource: ARM sp804: obtain sp804 timer rate via clks Russell King - ARM Linux
2011-05-16 22:18   ` Rob Herring
2011-05-16 22:34     ` Russell King - ARM Linux
2011-05-16 17:30 ` [PATCH 16/19] clockevents: ARM sp804: allow clockevent name to be specified Russell King - ARM Linux
2011-05-16 21:25   ` Rob Herring
2011-05-16 21:33     ` Russell King - ARM Linux
2011-05-23 10:55   ` Catalin Marinas
2011-05-16 17:31 ` [PATCH 17/19] clockevents: ARM sp804: obtain sp804 timer rate via clks Russell King - ARM Linux
2011-05-16 21:24   ` Rob Herring [this message]
2011-05-16 21:34     ` Russell King - ARM Linux
2011-05-23 10:56   ` Catalin Marinas
2011-05-16 17:31 ` [PATCH 18/19] ARM: bcmring: convert to sp804 clocksource Russell King - ARM Linux
2011-05-16 17:31 ` [PATCH 19/19] ARM: bcmring: convert to use sp804 clockevents Russell King - ARM Linux
2011-05-17 23:04   ` [PATCH] ARM: bcmring: fix patches to convert to " Jiandong Zheng
2011-05-17 23:20     ` Russell King - ARM Linux
2011-05-17 23:42       ` Jiandong Zheng
2011-05-18 15:46         ` Russell King - ARM Linux
2011-05-18 18:01           ` [PATCH] ARM: bcmring: Add clkdev table in init_early Jiandong Zheng
2011-05-18 20:42             ` Russell King - ARM Linux
2011-05-18 22:37               ` Russell King - ARM Linux
2011-05-18 22:45                 ` Jiandong Zheng
2011-05-18 22:52                   ` Russell King - ARM Linux
2011-05-18 23:38                     ` Jiandong Zheng

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=4DD1960B.5000603@gmail.com \
    --to=robherring2@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).