devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jamie Iles <jamie-wmLquQDDieKakBO8gow8eQ@public.gmane.org>
To: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@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,
	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,
	STEricsson_nomadik_linux-nkJGhpqTU55BDgjK7y7TUQ@public.gmane.org,
	rubini-9wsNiZum9E8@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	rmallon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Subject: Re: [PATCHv2 02/10] ARM: vic: MULTI_IRQ_HANDLER handler
Date: Thu, 29 Sep 2011 10:30:09 +0100	[thread overview]
Message-ID: <20110929093009.GM17204@pulham.picochip.com> (raw)
In-Reply-To: <CACRpkdZKns-GraGp-YMD6jzOPETkvEpt9bC8HcYUmf3JUyCV3A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Thu, Sep 29, 2011 at 08:55:08AM +0200, Linus Walleij wrote:
> On Wed, Sep 28, 2011 at 10:39 PM, Grant Likely
> <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:
> 
> > Why isn't it simply written this way:
> >
> >        stat = readl_relaxed(vic->base + VIC_IRQ_STATUS);
> >        while (stat) {
> >                irq = fls(stat) - 1;
> >                handle_IRQ(irq_domain_to_irq(&vic->domain, irq), regs);
> >                stat &= ~(1 << irq);
> >        }
> 
> That is indeed closer to the assembly loop most platforms have
> implemented.
> 
> Jamie can you test this approach? And also use ffs() insteadof
> fls()...

OK, here it is (and it works)!  That does make it a lot simpler, thanks 
guys!  I've updated the vic-dt branch in my repo too.

Jamie

8<------
From: Jamie Iles <jamie-wmLquQDDieKakBO8gow8eQ@public.gmane.org>
Subject: [PATCHv3] ARM: vic: MULTI_IRQ_HANDLER handler

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.

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>
Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Signed-off-by: Jamie Iles <jamie-wmLquQDDieKakBO8gow8eQ@public.gmane.org>
---
 arch/arm/common/vic.c               |   22 ++++++++++++++++++++++
 arch/arm/include/asm/hardware/vic.h |    4 ++++
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c
index 3f9c8f2..b22b83d 100644
--- a/arch/arm/common/vic.c
+++ b/arch/arm/common/vic.c
@@ -427,3 +427,25 @@ int __init vic_of_init(struct device_node *node, struct device_node *parent)
 	return -EIO;
 }
 #endif /* CONFIG OF */
+
+#ifdef CONFIG_MULTI_IRQ_HANDLER
+static void vic_single_handle_irq(struct vic_device *vic, struct pt_regs *regs)
+{
+	u32 stat, irq;
+
+	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);
+	}
+}
+
+asmlinkage void __exception_irq_entry vic_handle_irq(struct pt_regs *regs)
+{
+	int i;
+
+	for (i = 0; i < vic_id; ++i)
+		vic_single_handle_irq(&vic_devices[i], regs);
+}
+#endif /* CONFIG_MULTI_IRQ_HANDLER */
diff --git a/arch/arm/include/asm/hardware/vic.h b/arch/arm/include/asm/hardware/vic.h
index 0135215..c02fd6f 100644
--- a/arch/arm/include/asm/hardware/vic.h
+++ b/arch/arm/include/asm/hardware/vic.h
@@ -45,11 +45,15 @@
 #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);
 
 #ifdef CONFIG_OF
 int vic_of_init(struct device_node *node, struct device_node *parent);
 #endif /* CONFIG_OF */
 
+void vic_handle_irq(struct pt_regs *regs);
+
 #endif /* __ASSEMBLY__ */
 #endif
-- 
1.7.4.1

  parent reply	other threads:[~2011-09-29  9:30 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-28 10:41 [PATCHv2 00/10] VIC DT binding and MULTI_IRQ_HANDLER Jamie Iles
2011-09-28 10:41 ` [PATCHv2 01/10] ARM: vic: device tree binding Jamie Iles
     [not found]   ` <1317206507-18867-2-git-send-email-jamie-wmLquQDDieKakBO8gow8eQ@public.gmane.org>
2011-09-28 20:11     ` Grant Likely
2011-09-29  4:00   ` Rob Herring
     [not found] ` <1317206507-18867-1-git-send-email-jamie-wmLquQDDieKakBO8gow8eQ@public.gmane.org>
2011-09-28 10:41   ` [PATCHv2 02/10] ARM: vic: MULTI_IRQ_HANDLER handler Jamie Iles
2011-09-28 11:09     ` Linus Walleij
2011-09-28 12:08       ` Jamie Iles
2011-09-28 20:39     ` Grant Likely
2011-09-29  6:55       ` Linus Walleij
     [not found]         ` <CACRpkdZKns-GraGp-YMD6jzOPETkvEpt9bC8HcYUmf3JUyCV3A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-09-29  9:30           ` Jamie Iles [this message]
     [not found]             ` <20110929093009.GM17204-apL1N+EY0C9YtYNIL7UdTEEOCMrvLtNR@public.gmane.org>
2011-09-29 16:55               ` Grant Likely
2011-11-02 13:40               ` Russell King - ARM Linux
2011-11-02 14:08                 ` Jamie Iles
2011-11-03 12:29                   ` Linus Walleij
     [not found]                     ` <CACRpkdY+EBkHfupO5T4SYKPxzX2L2kr8fLVMJK=JctNeYAzn2g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-11-03 12:51                       ` Russell King - ARM Linux
2011-11-03 13:00                         ` Linus Walleij
2011-11-03 13:04                           ` Jamie Iles
     [not found]                           ` <CACRpkdZ1qfVduMAmusNoLjDoqy2kDA4crN__iW9qEeXBgVT4cA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-11-03 13:31                             ` Russell King - ARM Linux
2011-11-03 15:03                               ` Jamie Iles
2011-11-03 15:11                                 ` Russell King - ARM Linux
2011-11-03 13:49                         ` Nicolas Pitre
2011-09-29 15:03     ` Zoltan Devai
2011-09-29 15:13       ` Jamie Iles
2011-09-28 10:41   ` [PATCHv2 03/10] ARM: ep93xx: convert to MULTI_IRQ_HANDLER Jamie Iles
2011-09-28 11:15     ` Linus Walleij
2011-09-28 10:41   ` [PATCHv2 05/10] ARM: nomadik: " Jamie Iles
2011-09-28 11:12     ` Linus Walleij
2011-09-28 10:41   ` [PATCHv2 06/10] ARM: s3c64xx: " Jamie Iles
2011-09-28 10:41   ` [PATCHv2 07/10] ARM: spear: " Jamie Iles
2011-09-28 10:41   ` [PATCHv2 08/10] ARM: u300: " Jamie Iles
2011-09-28 11:03     ` Linus Walleij
2011-09-28 12:03       ` Jamie Iles
     [not found]         ` <20110928120340.GH17204-apL1N+EY0C9YtYNIL7UdTEEOCMrvLtNR@public.gmane.org>
2011-09-28 12:18           ` Linus Walleij
2011-09-28 12:29             ` Jamie Iles
2011-09-28 10:41   ` [PATCHv2 09/10] ARM: versatile: " Jamie Iles
2011-09-28 10:41   ` [PATCHv2 10/10] ARM: samsung: " Jamie Iles
2011-09-28 10:41 ` [PATCHv2 04/10] ARM: netx: " 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=20110929093009.GM17204@pulham.picochip.com \
    --to=jamie-wmlquqddiekakbo8gow8eq@public.gmane.org \
    --cc=STEricsson_nomadik_linux-nkJGhpqTU55BDgjK7y7TUQ@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=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@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;
as well as URLs for NNTP newsgroup(s).