Patchwork [1/4] ARM i.MX avic: add handle_irq function

login
register
mail settings
Submitter Sascha Hauer
Date Sept. 26, 2011, 9:46 a.m.
Message ID <1317030369-29352-2-git-send-email-s.hauer@pengutronix.de>
Download mbox | patch
Permalink /patch/116397/
State New
Headers show

Comments

Sascha Hauer - Sept. 26, 2011, 9:46 a.m.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/plat-mxc/avic.c                |   13 +++++++++++++
 arch/arm/plat-mxc/include/mach/common.h |   10 ++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)
Russell King - ARM Linux - Sept. 26, 2011, 11:21 a.m.
On Mon, Sep 26, 2011 at 11:46:06AM +0200, Sascha Hauer wrote:
> +void avic_handle_irq(struct pt_regs *);
> +
> +#define imx1_handle_irq avic_handle_irq
> +#define imx21_handle_irq avic_handle_irq
> +#define imx25_handle_irq avic_handle_irq
> +#define imx27_handle_irq avic_handle_irq
> +#define imx31_handle_irq avic_handle_irq
> +#define imx35_handle_irq avic_handle_irq

Is there really something wrong in knowing (elsewhere) that mx1..mx35 all
use the avic irq handler?
Sascha Hauer - Sept. 26, 2011, 12:25 p.m.
On Mon, Sep 26, 2011 at 12:21:51PM +0100, Russell King - ARM Linux wrote:
> On Mon, Sep 26, 2011 at 11:46:06AM +0200, Sascha Hauer wrote:
> > +void avic_handle_irq(struct pt_regs *);
> > +
> > +#define imx1_handle_irq avic_handle_irq
> > +#define imx21_handle_irq avic_handle_irq
> > +#define imx25_handle_irq avic_handle_irq
> > +#define imx27_handle_irq avic_handle_irq
> > +#define imx31_handle_irq avic_handle_irq
> > +#define imx35_handle_irq avic_handle_irq
> 
> Is there really something wrong in knowing (elsewhere) that mx1..mx35 all
> use the avic irq handler?

No technical reason. I copied this from the pxa code and thought
this way a board implementer does not need to know the interrupt
controller type but only the SoC type. We can use avic_/tzic_
directly if you like.

Sascha

Patch

diff --git a/arch/arm/plat-mxc/avic.c b/arch/arm/plat-mxc/avic.c
index 55d2534..4d68c5a 100644
--- a/arch/arm/plat-mxc/avic.c
+++ b/arch/arm/plat-mxc/avic.c
@@ -116,6 +116,19 @@  static struct mxc_irq_chip mxc_avic_chip = {
 #endif
 };
 
+asmlinkage void __exception_irq_entry avic_handle_irq(struct pt_regs *regs)
+{
+	u32 nivector;
+
+	do {
+		nivector = __raw_readl(avic_base + AVIC_NIVECSR) >> 16;
+		if (nivector == 0xffff)
+			break;
+
+		handle_IRQ(nivector, regs);
+	} while (1);
+}
+
 /*
  * This function initializes the AVIC hardware and disables all the
  * interrupts. It registers the interrupt enable and disable functions
diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h
index 4e3d978..6a6182d 100644
--- a/arch/arm/plat-mxc/include/mach/common.h
+++ b/arch/arm/plat-mxc/include/mach/common.h
@@ -72,4 +72,14 @@  extern void mxc_arch_reset_init(void __iomem *);
 extern void mx51_efikamx_reset(void);
 extern int mx53_revision(void);
 extern int mx53_display_revision(void);
+
+void avic_handle_irq(struct pt_regs *);
+
+#define imx1_handle_irq avic_handle_irq
+#define imx21_handle_irq avic_handle_irq
+#define imx25_handle_irq avic_handle_irq
+#define imx27_handle_irq avic_handle_irq
+#define imx31_handle_irq avic_handle_irq
+#define imx35_handle_irq avic_handle_irq
+
 #endif