sparc32,leon: add support for extended interrupt controller
PATCH 2/7 sparc32,leon: add support for extended interrupt controller
The extended IRQ controller gives the LEON 16 more IRQs.
The patch installs a custom handler for the exetended controller IRQ, where a register is read and the "real" IRQ causing IRQ is determined.
--- arch/sparc/include/asm/leon.h | 7 +-- arch/sparc/kernel/leon_kernel.c | 95 +++++++++++++++++++++++++++++---------- 2 files changed, 74 insertions(+), 28 deletions(-)
arch/sparc/include/asm/leon.h +3 -4
@@ -183,7 +183,6 @@ static inline void leon_srmmu_enabletlb(void)/* macro access for leon_readnobuffer_reg() */ #define LEON_BYPASSCACHE_LOAD_VA (x) leon_readnobuffer_reg((unsigned long)(x)) -extern void sparc_leon_eirq_register (int eirq);extern void leon_init (void );extern void leon_switch_mm (void );extern void leon_init_IRQ (void );
@@ -339,9 +338,9 @@ struct leon2_cacheregs {#include <linux/interrupt.h> struct device_node ; -extern int sparc_leon_eirq_get (int eirq,int cpu); -extern irqreturn_t sparc_leon_eirq_isr (int dummy,void *dev_id); -extern void sparc_leon_eirq_register (int eirq); +extern unsigned int leon_build_device_irq (unsigned int real_irq, +irq_flow_handler_t flow_handler, +const char *name,int do_ack);extern void leon_clear_clock_irq (void );extern void leon_load_profile_irq (int cpu,unsigned int limit);extern void leon_init_timers (irq_handler_t counter_fn);
arch/sparc/kernel/leon_kernel.c +71 -24
165 lines not on this page · raw message
Signature · 1 line
1.5.4
Re: [PATCH 2/7] sparc32,leon: add support for extended interrupt
Hi Daniel.
A few nits that I missed during the private review.
arch/sparc/kernel/leon_kernel.c static DEFINE_SPINLOCK(leon_irq_lock); · line 41
Quoted 2 lines
arch/sparc/kernel/leon_kernel.c +2
-0+#define LEON_IMASK (&leon3_irqctrl_regs->mask[0]) +#define LEON_IACK (&leon3_irqctrl_regs->iclear)
Hiding these behind macros may not make code more obvious. But I am not strongly about it.
arch/sparc/kernel/leon_kernel.c static DEFINE_SPINLOCK(leon_irq_lock); · line 46
Quoted 7 lines
arch/sparc/kernel/leon_kernel.c +4
-2+#define LEON_DO_ACK_HW 1 -/* Return the IRQ of the pending IRQ on the extended IRQ controller */ -int sparc_leon_eirq_get (int eirq,int cpu) +/* Return the last ACKed IRQ by the Extended IRQ controller. It has already +* been (automatically) ACKed when the CPU takes the trap. +*/
In general - nice to see the improved comments
arch/sparc/kernel/leon_kernel.c static DEFINE_SPINLOCK(leon_irq_lock); · line 67
Quoted 7 lines
/* The extended IRQ controller has been found, this function registers it */
arch/sparc/kernel/leon_kernel.c +3
-2-void sparc_leon_eirq_register (int eirq) +void leon_eirq_setup (unsigned int eirq) { -int irq; +unsigned long mask, oldmask; +int veirq;
veirq is used for an unsigned int value later. Use "unsigned int" to avoid mixing signed/unsigned.
Sam
Re: [PATCH 2/7] sparc32,leon: add support for extended interrupt
In reply to Daniel HellstromQuoted 6 lines · Sam Ravnborg
Hi Daniel.
A few nits that I missed during the private review.
Quoted 9 lines
arch/sparc/kernel/leon_kernel.c static DEFINE_SPINLOCK(leon_irq_lock); · line 41
Quoted 4 lines
arch/sparc/kernel/leon_kernel.c +2
-0+#define LEON_IMASK (&leon3_irqctrl_regs->mask[0]) +#define LEON_IACK (&leon3_irqctrl_regs->iclear)Hiding these behind macros may not make code more obvious. But I am not strongly about it.
LEON_MASK was defined since before, I only removed a pair of unused parenteses and added LEON_IACK in the same spirit. I will leave it the way it is, I think it can be cleaned up later.
Quoted 15 lines
arch/sparc/kernel/leon_kernel.c static DEFINE_SPINLOCK(leon_irq_lock); · line 46
Quoted 11 lines
arch/sparc/kernel/leon_kernel.c +4
-2+#define LEON_DO_ACK_HW 1 -/* Return the IRQ of the pending IRQ on the extended IRQ controller */ -int sparc_leon_eirq_get (int eirq,int cpu) +/* Return the last ACKed IRQ by the Extended IRQ controller. It has already +* been (automatically) ACKed when the CPU takes the trap. +*/ In general - nice to see the improved comments
Quoted 14 lines
arch/sparc/kernel/leon_kernel.c static DEFINE_SPINLOCK(leon_irq_lock); · line 67
Quoted 9 lines
/* The extended IRQ controller has been found, this function registers it */
arch/sparc/kernel/leon_kernel.c +1
-1-void sparc_leon_eirq_register (int eirq) +void leon_eirq_setup (unsigned int eirq){
arch/sparc/kernel/leon_kernel.c +2
-1-int irq; +unsigned long mask, oldmask; +int veirq;veirq is used for an unsigned int value later. Use "unsigned int" to avoid mixing signed/unsigned.
I will fix this and resend the patch.
Thanks,
Daniel