From 3439a397a8190b7e8d319959ec30e28c7ca14bab Mon Sep 17 00:00:00 2001 From: Hui Wang Date: Thu, 22 Sep 2011 17:40:08 +0800 Subject: ARM i.MX avic: convert to use generic irq chip Convert i.MX avic irq handler to use generic irq chip. This not only provides a cleanup implementation of irq chip handler, but also implements suspend/resume interface with the help of generic irq chip interface. Change mxc_irq_chip to a new structure mxc_extra_irq to handle fiq and priority functions. Signed-off-by: Hui Wang Acked-by: Shawn Guo Signed-off-by: Sascha Hauer --- arch/arm/plat-mxc/tzic.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'arch/arm/plat-mxc/tzic.c') diff --git a/arch/arm/plat-mxc/tzic.c b/arch/arm/plat-mxc/tzic.c index f257fccdc39..a5807509fc6 100644 --- a/arch/arm/plat-mxc/tzic.c +++ b/arch/arm/plat-mxc/tzic.c @@ -74,6 +74,12 @@ static int tzic_set_irq_fiq(unsigned int irq, unsigned int type) static unsigned int *wakeup_intr[4]; +static struct mxc_extra_irq tzic_extra_irq = { +#ifdef CONFIG_FIQ + .set_irq_fiq = tzic_set_irq_fiq, +#endif +}; + static __init void tzic_init_gc(unsigned int irq_start) { struct irq_chip_generic *gc; @@ -82,7 +88,7 @@ static __init void tzic_init_gc(unsigned int irq_start) gc = irq_alloc_generic_chip("tzic", 1, irq_start, tzic_base, handle_level_irq); - gc->private = tzic_set_irq_fiq; + gc->private = &tzic_extra_irq; gc->wake_enabled = IRQ_MSK(32); wakeup_intr[idx] = &gc->wake_active; -- cgit v1.2.3-70-g09d2 From 58a926008cd6f3788b73af0335b695dee7859e8d Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 20 Sep 2011 14:28:39 +0200 Subject: ARM i.MX tzic: add handle_irq function Signed-off-by: Sascha Hauer --- arch/arm/plat-mxc/include/mach/common.h | 4 ++++ arch/arm/plat-mxc/tzic.c | 24 +++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'arch/arm/plat-mxc/tzic.c') diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h index 6a6182df187..893ec911e66 100644 --- a/arch/arm/plat-mxc/include/mach/common.h +++ b/arch/arm/plat-mxc/include/mach/common.h @@ -74,6 +74,7 @@ extern int mx53_revision(void); extern int mx53_display_revision(void); void avic_handle_irq(struct pt_regs *); +void tzic_handle_irq(struct pt_regs *); #define imx1_handle_irq avic_handle_irq #define imx21_handle_irq avic_handle_irq @@ -81,5 +82,8 @@ void avic_handle_irq(struct pt_regs *); #define imx27_handle_irq avic_handle_irq #define imx31_handle_irq avic_handle_irq #define imx35_handle_irq avic_handle_irq +#define imx50_handle_irq tzic_handle_irq +#define imx51_handle_irq tzic_handle_irq +#define imx53_handle_irq tzic_handle_irq #endif diff --git a/arch/arm/plat-mxc/tzic.c b/arch/arm/plat-mxc/tzic.c index f257fccdc39..b7a272d16d3 100644 --- a/arch/arm/plat-mxc/tzic.c +++ b/arch/arm/plat-mxc/tzic.c @@ -42,7 +42,7 @@ #define TZIC_SRCCLAR0 0x0280 /* Source Clear Register 0 */ #define TZIC_PRIORITY0 0x0400 /* Priority Register 0 */ #define TZIC_PND0 0x0D00 /* Pending Register 0 */ -#define TZIC_HIPND0 0x0D80 /* High Priority Pending Register */ +#define TZIC_HIPND(i) (0x0D80+ ((i) << 2)) /* High Priority Pending Register */ #define TZIC_WAKEUP0(i) (0x0E00 + ((i) << 2)) /* Wakeup Config Register */ #define TZIC_SWINT 0x0F00 /* Software Interrupt Rigger Register */ #define TZIC_ID0 0x0FD0 /* Indentification Register 0 */ @@ -96,6 +96,28 @@ static __init void tzic_init_gc(unsigned int irq_start) irq_setup_generic_chip(gc, IRQ_MSK(32), 0, IRQ_NOREQUEST, 0); } +asmlinkage void __exception_irq_entry tzic_handle_irq(struct pt_regs *regs) +{ + u32 stat; + int i, irqofs, handled; + + do { + handled = 0; + + for (i = 0; i < 4; i++) { + stat = __raw_readl(tzic_base + TZIC_HIPND(i)) & + __raw_readl(tzic_base + TZIC_INTSEC0(i)); + + while (stat) { + handled = 1; + irqofs = fls(stat) - 1; + handle_IRQ(irqofs + i * 32, regs); + stat &= ~(1 << irqofs); + } + } + } while (handled); +} + /* * This function initializes the TZIC hardware and disables all the * interrupts. It registers the interrupt enable and disable functions -- cgit v1.2.3-70-g09d2 From 98de0cbbe2e7157fd87d04386621be3eadd4d6ab Mon Sep 17 00:00:00 2001 From: Jason Liu Date: Thu, 3 Nov 2011 17:31:26 +0800 Subject: ARM:i.MX: fix build error in tzic/avic.c arch/arm/plat-mxc/tzic.c:105: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'tzic_handle_irq' Signed-off-by: Jason Liu --- arch/arm/plat-mxc/avic.c | 1 + arch/arm/plat-mxc/tzic.c | 1 + 2 files changed, 2 insertions(+) (limited to 'arch/arm/plat-mxc/tzic.c') diff --git a/arch/arm/plat-mxc/avic.c b/arch/arm/plat-mxc/avic.c index 8875fb415f6..55f15699a38 100644 --- a/arch/arm/plat-mxc/avic.c +++ b/arch/arm/plat-mxc/avic.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "irq-common.h" diff --git a/arch/arm/plat-mxc/tzic.c b/arch/arm/plat-mxc/tzic.c index e993a184189..a3c164c7ba8 100644 --- a/arch/arm/plat-mxc/tzic.c +++ b/arch/arm/plat-mxc/tzic.c @@ -17,6 +17,7 @@ #include #include +#include #include #include -- cgit v1.2.3-70-g09d2