mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Ahmed Ammar <b33fc0d3@gentoo.org>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.arm.linux.org.uk,
	Ahmed Ammar <aammar@edge-techno.com>
Subject: Re: [PATCH 1/1] [ARM] ep93xx clockevent support
Date: Wed, 22 Jul 2009 10:25:47 +0100	[thread overview]
Message-ID: <20090722092547.GA28648@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1248253786-18993-2-git-send-email-b33fc0d3@gentoo.org>

On Wed, Jul 22, 2009 at 12:09:46PM +0300, Ahmed Ammar wrote:
> @@ -849,6 +851,7 @@ config HZ
>  	default AT91_TIMER_HZ if ARCH_AT91
>  	default 100
>  
> +

Please don't add unrelated blank lines.

> @@ -100,55 +103,129 @@ void __init ep93xx_map_io(void)
>   * to use this timer for something else.  We also use timer 4 for keeping
>   * track of lost jiffies.
>   */
> -static unsigned int last_jiffy_time;
> -
> -#define TIMER4_TICKS_PER_JIFFY		((CLOCK_TICK_RATE + (HZ/2)) / HZ)
> +static struct clock_event_device clockevent_ep93xx;
>  
>  static irqreturn_t ep93xx_timer_interrupt(int irq, void *dev_id)
>  {
> -	__raw_writel(1, EP93XX_TIMER1_CLEAR);
> -	while ((signed long)
> -		(__raw_readl(EP93XX_TIMER4_VALUE_LOW) - last_jiffy_time)
> -						>= TIMER4_TICKS_PER_JIFFY) {
> -		last_jiffy_time += TIMER4_TICKS_PER_JIFFY;
> -		timer_tick();
> -	}
> -
> + 	__raw_writel(EP93XX_TC_CLEAR, EP93XX_TIMER1_CLEAR);
> + 	clockevent_ep93xx.event_handler(&clockevent_ep93xx);

You can avoid the forward declaration by doing:

	struct clk_event_device *evt = dev_id;

	evt->event_handler(evt);

here, and:

> +static struct clock_event_device clockevent_ep93xx = {
> +	.name		= "ep93xx-timer1",
> +	.features	= CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
> +	.shift		= 32,
> +	.set_mode	= ep93xx_set_mode,
> +	.set_next_event	= ep93xx_set_next_event,
> +};
> +
>  static struct irqaction ep93xx_timer_irq = {
>  	.name		= "ep93xx timer",
>  	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
>  	.handler	= ep93xx_timer_interrupt,

adding here:

	.dev_id		= &clockevent_ep93xx,

> diff --git a/arch/arm/mach-ep93xx/include/mach/timex.h b/arch/arm/mach-ep93xx/include/mach/timex.h
> index 6b3503b..ddf3a8a 100644
> --- a/arch/arm/mach-ep93xx/include/mach/timex.h
> +++ b/arch/arm/mach-ep93xx/include/mach/timex.h
> @@ -1,5 +1,11 @@
>  /*
>   * arch/arm/mach-ep93xx/include/mach/timex.h
>   */
> +#include <mach/ep93xx-regs.h>
> +#include <asm/io.h>
>  
>  #define CLOCK_TICK_RATE		983040
> +
> +#define mach_read_cycles() __raw_readl(EP93XX_TIMER4_VALUE_LOW)
> +#define mach_cycles_to_usecs(d) (((d) * ((1000000LL << 32) / CLOCK_TICK_RATE)) >> 32)
> +#define mach_usecs_to_cycles(d) (((d) * (((long long)CLOCK_TICK_RATE << 32) / 1000000)) >> 32)

Two points here:

1. You don't seem to use these in this patch, they're unrelated so please
   send as a separate patch.
2. Please don't pollute mach/timex.h with anything other than the
   CLOCK_TICK_RATE definition.  That's what it's there for, and it gets
   included by almost the entire kernel, so please don't pollute this
   file.

  reply	other threads:[~2009-07-22  9:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-22  9:09 [PATCH 0/1] [ARM] ep93xx clockevent support for 2.6.29.6-rt23 Ahmed Ammar
2009-07-22  9:09 ` [PATCH 1/1] [ARM] ep93xx clockevent support Ahmed Ammar
2009-07-22  9:25   ` Russell King - ARM Linux [this message]
2009-07-22 18:31     ` H Hartley Sweeten
2009-07-22 10:12   ` Ahmed Ammar
2009-07-30 22:18     ` H Hartley Sweeten
2009-07-30 22:49       ` H Hartley Sweeten
2009-07-22 18:29   ` H Hartley Sweeten
2009-07-23  2:52     ` Ryan Mallon

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=20090722092547.GA28648@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=aammar@edge-techno.com \
    --cc=b33fc0d3@gentoo.org \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.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

Powered by JetHome