ppc4xx: Update flash size in reg property of the NOR flash node
[oweals/u-boot.git] / cpu / mpc5xx / interrupts.c
index 3678b5bfc8d7092e33a98f98dc7afd87ade0807c..167543fcf53789ad1b51733f428a1a253f308417 100644 (file)
  */
 
 #include <common.h>
+#include <command.h>
 #include <mpc5xx.h>
 #include <asm/processor.h>
 
+#if defined(CONFIG_PATI)
+/* PATI uses IRQs for PCI doorbell */
+#undef NR_IRQS
+#define NR_IRQS 16
+#endif
+
 struct interrupt_action {
        interrupt_handler_t *handler;
        void *arg;
+       int count;
 };
 
 static struct interrupt_action irq_vecs[NR_IRQS];
@@ -44,13 +52,19 @@ static struct interrupt_action irq_vecs[NR_IRQS];
 
 int interrupt_init_cpu (ulong *decrementer_count)
 {
-       volatile immap_t *immr = (immap_t *) CFG_IMMR;
+       volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
+       int vec;
 
        /* Decrementer used here for status led */
-       *decrementer_count = get_tbclk () / CFG_HZ;
+       *decrementer_count = get_tbclk () / CONFIG_SYS_HZ;
 
        /* Disable all interrupts */
        immr->im_siu_conf.sc_simask = 0;
+       for (vec=0; vec<NR_IRQS; vec++) {
+               irq_vecs[vec].handler = NULL;
+               irq_vecs[vec].arg = NULL;
+               irq_vecs[vec].count = 0;
+       }
 
        return (0);
 }
@@ -60,7 +74,7 @@ int interrupt_init_cpu (ulong *decrementer_count)
  */
 void external_interrupt (struct pt_regs *regs)
 {
-       volatile immap_t *immr = (immap_t *) CFG_IMMR;
+       volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
        int irq;
        ulong simask, newmask;
        ulong vec, v_bit;
@@ -116,7 +130,7 @@ void external_interrupt (struct pt_regs *regs)
 void irq_install_handler (int vec, interrupt_handler_t * handler,
                                                  void *arg)
 {
-       volatile immap_t *immr = (immap_t *) CFG_IMMR;
+       volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
        /* SIU interrupt */
        if (irq_vecs[vec].handler != NULL) {
                printf ("SIU interrupt %d 0x%x\n",
@@ -134,7 +148,7 @@ void irq_install_handler (int vec, interrupt_handler_t * handler,
 
 void irq_free_handler (int vec)
 {
-       volatile immap_t *immr = (immap_t *) CFG_IMMR;
+       volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
        /* SIU interrupt */
 #if 0
        printf ("Free CPM interrupt for vector %d\n",
@@ -151,7 +165,7 @@ void irq_free_handler (int vec)
  */
 void timer_interrupt_cpu (struct pt_regs *regs)
 {
-       volatile immap_t *immr = (immap_t *) CFG_IMMR;
+       volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
 
 #if 0
        printf ("*** Timer Interrupt *** ");
@@ -163,3 +177,31 @@ void timer_interrupt_cpu (struct pt_regs *regs)
 
        return;
 }
+
+#if defined(CONFIG_CMD_IRQ)
+/*******************************************************************************
+ *
+ * irqinfo - print information about IRQs
+ *
+ */
+int do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+       int vec;
+
+       printf ("\nInterrupt-Information:\n");
+       printf ("Nr  Routine   Arg       Count\n");
+
+       for (vec=0; vec<NR_IRQS; vec++) {
+               if (irq_vecs[vec].handler != NULL) {
+                       printf ("%02d  %08lx  %08lx  %d\n",
+                               vec,
+                               (ulong)irq_vecs[vec].handler,
+                               (ulong)irq_vecs[vec].arg,
+                               irq_vecs[vec].count);
+               }
+       }
+       return 0;
+}
+
+
+#endif