From: Jamie Iles <jamie-wmLquQDDieKakBO8gow8eQ@public.gmane.org>
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: viresh.kumar-qxv4g6HH51o@public.gmane.org,
kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
rmallon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org,
hsweeten-3FF4nKcrg1dE2c76skzGb0EOCMrvLtNR@public.gmane.org,
rajeev-dlh.kumar-qxv4g6HH51o@public.gmane.org,
ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org,
rubini-9wsNiZum9E8@public.gmane.org
Subject: [PATCHv4 03/13] ARM: vic: MULTI_IRQ_HANDLER handler
Date: Fri, 4 Nov 2011 01:10:00 +0000 [thread overview]
Message-ID: <1320369010-23428-4-git-send-email-jamie@jamieiles.com> (raw)
In-Reply-To: <1320369010-23428-1-git-send-email-jamie-wmLquQDDieKakBO8gow8eQ@public.gmane.org>
Add a handler for the VIC that is suitable for MULTI_IRQ_HANDLER
platforms. This can replace the ASM entry macros for platforms that use
the VIC.
v4: - rebase ontop of move __exception and friends to
asm/exception.h
- rework polling loop to handle as many irqs as possible in one go
v3: - simplify irq handling loop as suggested by Grant
- service interrupts from msb->lsb order
v2: - allow the handler be used for !CONFIG_OF
- use irq_domain_to_irq()
Cc: Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Signed-off-by: Jamie Iles <jamie-wmLquQDDieKakBO8gow8eQ@public.gmane.org>
---
arch/arm/common/vic.c | 38 +++++++++++++++++++++++++++++++++++
arch/arm/include/asm/hardware/vic.h | 3 ++
2 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c
index e689975..a82e3e0 100644
--- a/arch/arm/common/vic.c
+++ b/arch/arm/common/vic.c
@@ -30,6 +30,7 @@
#include <linux/device.h>
#include <linux/amba/bus.h>
+#include <asm/exception.h>
#include <asm/mach/irq.h>
#include <asm/hardware/vic.h>
@@ -427,3 +428,40 @@ int __init vic_of_init(struct device_node *node, struct device_node *parent)
return -EIO;
}
#endif /* CONFIG OF */
+
+#ifdef CONFIG_MULTI_IRQ_HANDLER
+/*
+ * Handle each interrupt in a single VIC. Returns non-zero if we've
+ * handled at least one interrupt. This does a single read of the
+ * status register and handles all interrupts in order from LSB first.
+ */
+static int handle_one_vic(struct vic_device *vic, struct pt_regs *regs)
+{
+ u32 stat, irq;
+ int handled = 0;
+
+ stat = readl_relaxed(vic->base + VIC_IRQ_STATUS);
+ while (stat) {
+ irq = ffs(stat) - 1;
+ handle_IRQ(irq_domain_to_irq(&vic->domain, irq), regs);
+ stat &= ~(1 << irq);
+ handled = 1;
+ }
+
+ return handled;
+}
+
+/*
+ * Keep iterating over all registered VIC's until there are no pending
+ * interrupts.
+ */
+asmlinkage void __exception_irq_entry vic_handle_irq(struct pt_regs *regs)
+{
+ int i, handled;
+
+ do {
+ for (i = 0, handled = 0; i < vic_id; ++i)
+ handled |= handle_one_vic(&vic_devices[i], regs);
+ } while (handled);
+}
+#endif /* CONFIG_MULTI_IRQ_HANDLER */
diff --git a/arch/arm/include/asm/hardware/vic.h b/arch/arm/include/asm/hardware/vic.h
index b348a54..f42ebd6 100644
--- a/arch/arm/include/asm/hardware/vic.h
+++ b/arch/arm/include/asm/hardware/vic.h
@@ -45,8 +45,11 @@
#include <linux/types.h>
struct device_node;
+struct pt_regs;
+
void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, u32 resume_sources);
int vic_of_init(struct device_node *node, struct device_node *parent);
+void vic_handle_irq(struct pt_regs *regs);
#endif /* __ASSEMBLY__ */
#endif
--
1.7.5.4
next prev parent reply other threads:[~2011-11-04 1:10 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-04 1:09 [PATCHv4 00/13] VIC DT binding and MULTI_IRQ_HANDLER Jamie Iles
[not found] ` <1320369010-23428-1-git-send-email-jamie-wmLquQDDieKakBO8gow8eQ@public.gmane.org>
2011-11-04 1:09 ` [PATCHv4 01/13] ARM: Make global handler and CONFIG_MULTI_IRQ_HANDLER mutually exclusive Jamie Iles
2011-11-04 1:09 ` [PATCHv4 02/13] ARM: vic: device tree binding Jamie Iles
[not found] ` <1320369010-23428-3-git-send-email-jamie-wmLquQDDieKakBO8gow8eQ@public.gmane.org>
2011-11-10 14:46 ` Jamie Iles
2011-11-10 15:20 ` Marc Zyngier
2011-11-10 16:28 ` Jamie Iles
2011-11-04 1:10 ` Jamie Iles [this message]
2011-11-04 1:10 ` [PATCHv4 04/13] ARM: ep93xx: convert to MULTI_IRQ_HANDLER Jamie Iles
2011-11-04 1:10 ` [PATCHv4 05/13] ARM: netx: " Jamie Iles
2011-11-04 1:10 ` [PATCHv4 06/13] ARM: nomadik: " Jamie Iles
2011-11-04 1:10 ` [PATCHv4 07/13] ARM: s3c64xx: " Jamie Iles
2011-11-09 11:25 ` Thomas Abraham
2011-11-09 11:34 ` Thomas Abraham
2011-11-09 11:54 ` Jamie Iles
2011-11-09 12:30 ` Thomas Abraham
2011-11-10 14:53 ` Jamie Iles
2011-11-10 16:19 ` Thomas Abraham
2011-11-09 14:50 ` Rob Herring
2011-11-09 14:55 ` Jamie Iles
2011-11-04 1:10 ` [PATCHv4 08/13] ARM: spear: " Jamie Iles
2011-11-09 10:15 ` Viresh Kumar
2011-11-04 1:10 ` [PATCHv4 09/13] ARM: u300: " Jamie Iles
2011-11-04 1:10 ` [PATCHv4 10/13] ARM: versatile: " Jamie Iles
2011-11-09 10:25 ` Marc Zyngier
2011-11-04 1:10 ` [PATCHv4 11/13] ARM: samsung: " Jamie Iles
2011-11-04 1:10 ` [PATCHv4 12/13] ARM: picoxcell: " Jamie Iles
2011-11-04 1:10 ` [PATCHv4 13/13] ARM: VIC: remove non MULTI_IRQ_HANDLER support Jamie Iles
2011-11-09 10:01 ` [PATCHv4 00/13] VIC DT binding and MULTI_IRQ_HANDLER Jamie Iles
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=1320369010-23428-4-git-send-email-jamie@jamieiles.com \
--to=jamie-wmlquqddiekakbo8gow8eq@public.gmane.org \
--cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=hsweeten-3FF4nKcrg1dE2c76skzGb0EOCMrvLtNR@public.gmane.org \
--cc=kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
--cc=rajeev-dlh.kumar-qxv4g6HH51o@public.gmane.org \
--cc=rmallon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
--cc=rubini-9wsNiZum9E8@public.gmane.org \
--cc=viresh.kumar-qxv4g6HH51o@public.gmane.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