summaryrefslogtreecommitdiff
path: root/arch/microblaze/cpu/interrupts.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/microblaze/cpu/interrupts.c')
-rw-r--r--arch/microblaze/cpu/interrupts.c76
1 files changed, 35 insertions, 41 deletions
diff --git a/arch/microblaze/cpu/interrupts.c b/arch/microblaze/cpu/interrupts.c
index 9364e2f..b6d6610 100644
--- a/arch/microblaze/cpu/interrupts.c
+++ b/arch/microblaze/cpu/interrupts.c
@@ -14,10 +14,9 @@
#include <asm/microblaze_intc.h>
#include <asm/asm.h>
-#undef DEBUG_INT
-
void enable_interrupts(void)
{
+ debug("Enable interrupts for the whole CPU\n");
MSRSET(0x2);
}
@@ -50,12 +49,11 @@ static void enable_one_interrupt(int irq)
offset <<= irq;
mask = intc->ier;
intc->ier = (mask | offset);
-#ifdef DEBUG_INT
- printf("Enable one interrupt irq %x - mask %x,ier %x\n", offset, mask,
- intc->ier);
- printf("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
- intc->iar, intc->mer);
-#endif
+
+ debug("Enable one interrupt irq %x - mask %x,ier %x\n", offset, mask,
+ intc->ier);
+ debug("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
+ intc->iar, intc->mer);
}
static void disable_one_interrupt(int irq)
@@ -66,12 +64,11 @@ static void disable_one_interrupt(int irq)
offset <<= irq;
mask = intc->ier;
intc->ier = (mask & ~offset);
-#ifdef DEBUG_INT
- printf("Disable one interrupt irq %x - mask %x,ier %x\n", irq, mask,
- intc->ier);
- printf("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
- intc->iar, intc->mer);
-#endif
+
+ debug("Disable one interrupt irq %x - mask %x,ier %x\n", irq, mask,
+ intc->ier);
+ debug("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
+ intc->iar, intc->mer);
}
int install_interrupt_handler(int irq, interrupt_handler_t *hdlr, void *arg)
@@ -88,12 +85,12 @@ int install_interrupt_handler(int irq, interrupt_handler_t *hdlr, void *arg)
act->handler = hdlr;
act->arg = arg;
act->count = 0;
- enable_one_interrupt (irq);
+ enable_one_interrupt(irq);
return 0;
}
/* Disable */
- act->handler = (interrupt_handler_t *) def_hdlr;
+ act->handler = (interrupt_handler_t *)def_hdlr;
act->arg = (void *)irq;
disable_one_interrupt(irq);
return 1;
@@ -107,18 +104,17 @@ static void intc_init(void)
intc->iar = 0xFFFFFFFF;
/* XIntc_Start - hw_interrupt enable and all interrupt enable */
intc->mer = 0x3;
-#ifdef DEBUG_INT
- printf("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
- intc->iar, intc->mer);
-#endif
+
+ debug("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
+ intc->iar, intc->mer);
}
-int interrupts_init(void)
+int interrupt_init(void)
{
int i;
#if defined(CONFIG_SYS_INTC_0_ADDR) && defined(CONFIG_SYS_INTC_0_NUM)
- intc = (microblaze_intc_t *) (CONFIG_SYS_INTC_0_ADDR);
+ intc = (microblaze_intc_t *)CONFIG_SYS_INTC_0_ADDR;
irq_no = CONFIG_SYS_INTC_0_NUM;
#endif
if (irq_no) {
@@ -130,7 +126,7 @@ int interrupts_init(void)
/* initialize irq list */
for (i = 0; i < irq_no; i++) {
- vecs[i].handler = (interrupt_handler_t *) def_hdlr;
+ vecs[i].handler = (interrupt_handler_t *)def_hdlr;
vecs[i].arg = (void *)i;
vecs[i].count = 0;
}
@@ -147,31 +143,29 @@ void interrupt_handler(void)
{
int irqs = intc->ivr; /* find active interrupt */
int mask = 1;
-#ifdef DEBUG_INT
int value;
- printf ("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
- intc->iar, intc->mer);
- R14(value);
- printf ("Interrupt handler on %x line, r14 %x\n", irqs, value);
-#endif
struct irq_action *act = vecs + irqs;
-#ifdef DEBUG_INT
- printf
- ("Jumping to interrupt handler rutine addr %x,count %x,arg %x\n",
- act->handler, act->count, act->arg);
+ debug("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
+ intc->iar, intc->mer);
+#ifdef DEBUG
+ R14(value);
#endif
- act->handler (act->arg);
+ debug("Interrupt handler on %x line, r14 %x\n", irqs, value);
+
+ debug("Jumping to interrupt handler rutine addr %x,count %x,arg %x\n",
+ (u32)act->handler, act->count, (u32)act->arg);
+ act->handler(act->arg);
act->count++;
intc->iar = mask << irqs;
-#ifdef DEBUG_INT
- printf ("Dump INTC reg, isr %x, ier %x, iar %x, mer %x\n", intc->isr,
- intc->ier, intc->iar, intc->mer);
+ debug("Dump INTC reg, isr %x, ier %x, iar %x, mer %x\n", intc->isr,
+ intc->ier, intc->iar, intc->mer);
+#ifdef DEBUG
R14(value);
- printf ("Interrupt handler on %x line, r14 %x\n", irqs, value);
#endif
+ debug("Interrupt handler on %x line, r14 %x\n", irqs, value);
}
#if defined(CONFIG_CMD_IRQ)
@@ -186,10 +180,10 @@ int do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, const char *argv[])
"-----------------------------\n");
for (i = 0; i < irq_no; i++) {
- if (act->handler != (interrupt_handler_t *) def_hdlr) {
+ if (act->handler != (interrupt_handler_t *)def_hdlr) {
printf("%02d %08x %08x %d\n", i,
- (int)act->handler, (int)act->arg,
- act->count);
+ (int)act->handler, (int)act->arg,
+ act->count);
}
act++;
}