All of lore.kernel.org
 help / color / mirror / Atom feed
From: cov@codeaurora.org (Christopher Covington)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/4] ARM: local timers: Add A15 architected timer support
Date: Mon, 13 Feb 2012 18:03:15 -0500	[thread overview]
Message-ID: <4F3996B3.1040503@codeaurora.org> (raw)
In-Reply-To: <1328115575-24866-2-git-send-email-marc.zyngier@arm.com>

Hi Marc,

On 02/01/2012 11:59 AM, Marc Zyngier wrote:
> Add support for the A15 generic timer and clocksource.
> As the timer generates interrupts on a different PPI depending
> on the execution mode (normal or secure), it is possible to
> register two different PPIs.

[snip]

> diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c
> new file mode 100644
> index 0000000..680cf1e
> --- /dev/null
> +++ b/arch/arm/kernel/arch_timer.c
> @@ -0,0 +1,286 @@
> +/*
> + *  linux/arch/arm/kernel/arch_timer.c
> + *
> + *  Copyright (C) 2011 ARM Ltd.
> + *  All Rights Reserved
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +#include <linux/delay.h>
> +#include <linux/device.h>
> +#include <linux/smp.h>
> +#include <linux/cpu.h>
> +#include <linux/jiffies.h>
> +#include <linux/clockchips.h>
> +#include <linux/interrupt.h>
> +#include <linux/io.h>
> +
> +#include <asm/cputype.h>
> +#include <asm/localtimer.h>
> +#include <asm/arch_timer.h>
> +
> +static unsigned long arch_timer_rate;
> +static int arch_timer_ppi;
> +static int arch_timer_ppi2;
> +
> +static struct clock_event_device __percpu **arch_timer_evt;
> +
> +/*
> + * Architected system timer support.
> + */
> +
> +#define ARCH_TIMER_CTRL_ENABLE		(1 << 0)
> +#define ARCH_TIMER_CTRL_IT_MASK		(1 << 1)
> +
> +#define ARCH_TIMER_REG_CTRL		0
> +#define ARCH_TIMER_REG_FREQ		1
> +#define ARCH_TIMER_REG_TVAL		2

[snip]

> +static irqreturn_t arch_timer_handler(int irq, void *dev_id)
> +{
> +	struct clock_event_device *evt = *(struct clock_event_device **)dev_id;
> +	unsigned long ctrl;
> +
> +	ctrl = arch_timer_reg_read(ARCH_TIMER_REG_CTRL);
> +	if (ctrl & 0x4) {

Perhaps this bit could be given a name like the others.

[snip]

> +static inline cycle_t arch_counter_get_cntpct(void)
> +{
> +	u32 cvall, cvalh;
> +
> +	asm volatile("mrrc p15, 0, %0, %1, c14" : "=r" (cvall), "=r" (cvalh));
> +
> +	return ((u64) cvalh << 32) | cvall;

Would it not be better to cast to cycle_t?

> +}
> +
> +static inline cycle_t arch_counter_get_cntvct(void)
> +{
> +	u32 cvall, cvalh;
> +
> +	asm volatile("mrrc p15, 1, %0, %1, c14" : "=r" (cvall), "=r" (cvalh));
> +
> +	return ((u64) cvalh << 32) | cvall;

Ditto.

> +}

[snip]

> +out_free_irq:
> +	free_percpu_irq(arch_timer_ppi, arch_timer_evt);
> +	if (arch_timer_ppi2)
> +		free_percpu_irq(arch_timer_ppi2, arch_timer_evt);
> +	

Trailing whitespace.

> +out_free:
> +	free_percpu(arch_timer_evt);
> +
> +	return err;
> +}

Regards,
Christopher

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum

  reply	other threads:[~2012-02-13 23:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-01 16:59 [PATCH v2 0/4] A7/A15 architected timer support Marc Zyngier
2012-02-01 16:59 ` [PATCH v2 1/4] ARM: local timers: Add A15 " Marc Zyngier
2012-02-13 23:03   ` Christopher Covington [this message]
2012-02-01 16:59 ` [PATCH v2 2/4] ARM: architected timers: Add A15 specific sched_clock implementation Marc Zyngier
2012-02-01 16:59 ` [PATCH v2 3/4] ARM: architected timers: add DT support Marc Zyngier
2012-02-13 23:05   ` Christopher Covington
2012-02-01 16:59 ` [PATCH v2 4/4] ARM: architected timers: add support for UP timer Marc Zyngier
2012-02-13 23:07   ` Christopher Covington
2012-02-14 11:19     ` Marc Zyngier

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=4F3996B3.1040503@codeaurora.org \
    --to=cov@codeaurora.org \
    --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 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.