From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 14/14] ARM: exynos4: switch MCT to the full local timer infrastructure
Date: Fri, 3 Jun 2011 15:15:58 +0100 [thread overview]
Message-ID: <1307110558-29710-15-git-send-email-marc.zyngier@arm.com> (raw)
In-Reply-To: <1307110558-29710-1-git-send-email-marc.zyngier@arm.com>
Despite MCT not using PPIs, there is now no reason for not
using the local timer infrastructure.
Cc: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-exynos4/mct.c | 68 ++++++++++++++++++------------------------
1 files changed, 29 insertions(+), 39 deletions(-)
diff --git a/arch/arm/mach-exynos4/mct.c b/arch/arm/mach-exynos4/mct.c
index 14ac10b..1a30278 100644
--- a/arch/arm/mach-exynos4/mct.c
+++ b/arch/arm/mach-exynos4/mct.c
@@ -22,6 +22,7 @@
#include <mach/map.h>
#include <mach/regs-mct.h>
+#include <asm/localtimer.h>
#include <asm/mach/time.h>
static unsigned long clk_cnt_per_tick;
@@ -30,9 +31,10 @@ static unsigned long clk_rate;
struct mct_clock_event_device {
struct clock_event_device *evt;
void __iomem *base;
+ bool booted;
};
-struct mct_clock_event_device mct_tick[2];
+static struct mct_clock_event_device mct_tick[2];
static void exynos4_mct_write(unsigned int value, void *addr)
{
@@ -307,17 +309,20 @@ static inline void exynos4_tick_set_mode(enum clock_event_mode mode,
exynos4_mct_tick_start(clk_cnt_per_tick, mevt);
break;
- case CLOCK_EVT_MODE_ONESHOT:
case CLOCK_EVT_MODE_UNUSED:
+ disable_irq(evt->irq);
+ /* fall through */
+ case CLOCK_EVT_MODE_ONESHOT:
case CLOCK_EVT_MODE_SHUTDOWN:
case CLOCK_EVT_MODE_RESUME:
break;
}
}
-static irqreturn_t exynos4_mct_tick_isr(int irq, void *dev_id)
+int local_timer_ack(void)
{
- struct mct_clock_event_device *mevt = dev_id;
+ unsigned int cpu = smp_processor_id();
+ struct mct_clock_event_device *mevt = &mct_tick[cpu];
struct clock_event_device *evt = mevt->evt;
/*
@@ -330,27 +335,14 @@ static irqreturn_t exynos4_mct_tick_isr(int irq, void *dev_id)
/* Clear the MCT tick interrupt */
exynos4_mct_write(0x1, mevt->base + MCT_L_INT_CSTAT_OFFSET);
-
- evt->event_handler(evt);
-
- return IRQ_HANDLED;
+
+ return 1;
}
-static struct irqaction mct_tick0_event_irq = {
- .name = "mct_tick0_irq",
- .flags = IRQF_TIMER | IRQF_NOBALANCING,
- .handler = exynos4_mct_tick_isr,
-};
-
-static struct irqaction mct_tick1_event_irq = {
- .name = "mct_tick1_irq",
- .flags = IRQF_TIMER | IRQF_NOBALANCING,
- .handler = exynos4_mct_tick_isr,
-};
-
-static void exynos4_mct_tick_init(struct clock_event_device *evt)
+int __cpuinit local_timer_setup(struct clock_event_device *evt)
{
unsigned int cpu = smp_processor_id();
+ int err = 0;
mct_tick[cpu].evt = evt;
@@ -378,27 +370,25 @@ static void exynos4_mct_tick_init(struct clock_event_device *evt)
exynos4_mct_write(0x1, mct_tick[cpu].base + MCT_L_TCNTB_OFFSET);
- if (cpu == 0) {
- mct_tick0_event_irq.dev_id = &mct_tick[cpu];
- setup_irq(IRQ_MCT_L0, &mct_tick0_event_irq);
- } else {
- mct_tick1_event_irq.dev_id = &mct_tick[cpu];
- irq_set_affinity(IRQ_MCT1, cpumask_of(1));
- setup_irq(IRQ_MCT_L1, &mct_tick1_event_irq);
- }
-}
+ if (cpu == 0)
+ evt->irq = IRQ_MCT_L0;
+ else
+ evt->irq = IRQ_MCT_L1;
-/* Setup the local clock events for a CPU */
-void __cpuinit local_timer_setup(struct clock_event_device *evt)
-{
- exynos4_mct_tick_init(evt);
-}
+ if (!mct_tick[cpu].booted) {
+ irq_set_affinity(evt->irq, cpumask_of(cpu));
+ err = request_irq(evt->irq, percpu_timer_handler,
+ IRQF_TIMER | IRQF_NOBALANCING,
+ evt->name, evt);
-int local_timer_ack(void)
-{
- return 0;
-}
+ if (err)
+ pr_err("MCT: request_irq failed for %s\n", evt->name);
+ mct_tick[cpu].booted = true;
+ } else
+ enable_irq(evt->irq);
+ return err;
+}
#endif /* CONFIG_LOCAL_TIMERS */
static void __init exynos4_timer_resources(void)
--
1.7.0.4
prev parent reply other threads:[~2011-06-03 14:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-03 14:15 [PATCH v6 00/14] Consolidating GIC per-cpu interrupts Marc Zyngier
2011-06-03 14:15 ` [PATCH v6 01/14] ARM: gic: add per-cpu interrupt multiplexer Marc Zyngier
2011-06-03 14:15 ` [PATCH v6 02/14] ARM: smp: add interrupt handler for local timers Marc Zyngier
2011-06-03 14:15 ` [PATCH v6 03/14] ARM: smp_twd: add support for remapped PPI interrupts Marc Zyngier
2011-06-03 14:15 ` [PATCH v6 04/14] ARM: omap4: use remapped PPI interrupts for local timer Marc Zyngier
2011-06-03 14:15 ` [PATCH v6 05/14] ARM: versatile: " Marc Zyngier
2011-06-03 14:15 ` [PATCH v6 06/14] ARM: shmobile: " Marc Zyngier
2011-06-03 14:15 ` [PATCH v6 07/14] ARM: ux500: " Marc Zyngier
2011-06-03 14:15 ` [PATCH v6 08/14] ARM: tegra: " Marc Zyngier
2011-06-03 14:15 ` [PATCH v6 09/14] ARM: msm: " Marc Zyngier
2011-06-03 14:15 ` [PATCH v6 10/14] ARM: exynos4: " Marc Zyngier
2011-06-03 14:15 ` [PATCH v6 11/14] ARM: gic: remove previous local timer interrupt handling Marc Zyngier
2011-06-03 14:15 ` [PATCH v6 12/14] ARM: gic: add compute_irqnr macro for exynos4 Marc Zyngier
2011-06-03 14:15 ` [PATCH v6 13/14] ARM: SMP: automatically select ARM_GIC_VPPI Marc Zyngier
2011-06-03 14:15 ` Marc Zyngier [this message]
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=1307110558-29710-15-git-send-email-marc.zyngier@arm.com \
--to=marc.zyngier@arm.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).