]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - cpu/microblaze/interrupts.c
rename CFG_ macros to CONFIG_SYS
[people/ms/u-boot.git] / cpu / microblaze / interrupts.c
index 2db847cd02c368d29f7084dadac9dbdd94b96c3d..a6021c99c3b2ab6a563fdfb1acc14b2ce6ed3d30 100644 (file)
@@ -27,6 +27,7 @@
 #include <common.h>
 #include <command.h>
 #include <asm/microblaze_intc.h>
+#include <asm/asm.h>
 
 #undef DEBUG_INT
 
@@ -35,24 +36,28 @@ extern void microblaze_enable_interrupts (void);
 
 void enable_interrupts (void)
 {
-       microblaze_enable_interrupts ();
+       MSRSET(0x2);
 }
 
 int disable_interrupts (void)
 {
-       microblaze_disable_interrupts ();
+       MSRCLR(0x2);
        return 0;
 }
 
-#ifdef CFG_INTC_0
-#ifdef CFG_TIMER_0
+#ifdef CONFIG_SYS_INTC_0
+#ifdef CONFIG_SYS_TIMER_0
 extern void timer_init (void);
 #endif
+#ifdef CONFIG_SYS_FSL_2
+extern void fsl_init2 (void);
+#endif
+
 
-static struct irq_action vecs[CFG_INTC_0_NUM];
+static struct irq_action vecs[CONFIG_SYS_INTC_0_NUM];
 
 /* mapping structure to interrupt controller */
-microblaze_intc_t *intc = (microblaze_intc_t *) (CFG_INTC_0_ADDR);
+microblaze_intc_t *intc = (microblaze_intc_t *) (CONFIG_SYS_INTC_0_ADDR);
 
 /* default handler */
 void def_hdlr (void)
@@ -95,7 +100,7 @@ void install_interrupt_handler (int irq, interrupt_handler_t * hdlr, void *arg)
 {
        struct irq_action *act;
        /* irq out of range */
-       if ((irq < 0) || (irq > CFG_INTC_0_NUM)) {
+       if ((irq < 0) || (irq > CONFIG_SYS_INTC_0_NUM)) {
                puts ("IRQ out of range\n");
                return;
        }
@@ -106,7 +111,6 @@ void install_interrupt_handler (int irq, interrupt_handler_t * hdlr, void *arg)
                act->count = 0;
                enable_one_interrupt (irq);
        } else {                /* disable */
-
                act->handler = (interrupt_handler_t *) def_hdlr;
                act->arg = (void *)irq;
                disable_one_interrupt (irq);
@@ -131,15 +135,18 @@ int interrupts_init (void)
 {
        int i;
        /* initialize irq list */
-       for (i = 0; i < CFG_INTC_0_NUM; i++) {
+       for (i = 0; i < CONFIG_SYS_INTC_0_NUM; i++) {
                vecs[i].handler = (interrupt_handler_t *) def_hdlr;
                vecs[i].arg = (void *)i;
                vecs[i].count = 0;
        }
        /* initialize intc controller */
        intc_init ();
-#ifdef CFG_TIMER_0
+#ifdef CONFIG_SYS_TIMER_0
        timer_init ();
+#endif
+#ifdef CONFIG_SYS_FSL_2
+       fsl_init2 ();
 #endif
        enable_interrupts ();
        return 0;
@@ -147,12 +154,13 @@ int interrupts_init (void)
 
 void interrupt_handler (void)
 {
-       int irqs;
-       irqs = (intc->isr & intc->ier); /* find active interrupt */
-
+       int irqs = (intc->isr & intc->ier);     /* find active interrupt */
+       int i = 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;
@@ -165,21 +173,25 @@ void interrupt_handler (void)
 #endif
                        act->handler (act->arg);
                        act->count++;
+                       intc->iar = i;
+                       return;
                }
                irqs >>= 1;
                act++;
+               i <<= 1;
        }
-       intc->iar = 0xFFFFFFFF; /* erase all events */
-#ifdef DEBUG
+
+#ifdef DEBUG_INT
        printf ("Dump INTC reg, isr %x, ier %x, iar %x, mer %x\n", intc->isr,
                intc->ier, intc->iar, intc->mer);
-       printf ("Interrupt handler on %x line, r14\n", irqs);
+       R14(value);
+       printf ("Interrupt handler on %x line, r14 %x\n", irqs, value);
 #endif
 }
 #endif
 
-#if (CONFIG_COMMANDS & CFG_CMD_IRQ)
-#ifdef CFG_INTC_0
+#if defined(CONFIG_CMD_IRQ)
+#ifdef CONFIG_SYS_INTC_0
 int do_irqinfo (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 {
        int i;
@@ -189,9 +201,9 @@ int do_irqinfo (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
              "Nr  Routine   Arg       Count\n"
              "-----------------------------\n");
 
-       for (i = 0; i < CFG_INTC_0_NUM; i++) {
+       for (i = 0; i < CONFIG_SYS_INTC_0_NUM; i++) {
                if (act->handler != (interrupt_handler_t*) def_hdlr) {
-                       printf ("%02d  %08lx  %08lx  %d\n", i,
+                       printf ("%02d  %08x  %08x  %d\n", i,
                                (int)act->handler, (int)act->arg, act->count);
                }
                act++;
@@ -205,4 +217,4 @@ int do_irqinfo (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
        puts ("Undefined interrupt controller\n");
 }
 #endif
-#endif                         /* CONFIG_COMMANDS & CFG_CMD_IRQ */
+#endif