ppc4xx: fdt: use fdt_fixup_ethernet()
[oweals/u-boot.git] / cpu / arm926ejs / interrupts.c
index 3985217c4fd94a0eda44cbcd8e9135b5d963872d..9cac969f64abd775e359b94dfb73ac4528469b35 100644 (file)
@@ -1,4 +1,7 @@
 /*
+ * (C) Copyright 2003
+ * Texas Instruments <www.ti.com>
+ *
  * (C) Copyright 2002
  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  * Marius Groeger <mgroeger@sysgo.de>
@@ -7,9 +10,12 @@
  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  * Alex Zuepke <azu@sysgo.de>
  *
- * (C) Copyright 2002
+ * (C) Copyright 2002-2004
  * Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
  *
+ * (C) Copyright 2004
+ * Philippe Robin, ARM Ltd. <philippe.robin@arm.com>
+ *
  * See file CREDITS for list of people who contributed to this
  * project.
  *
@@ -20,7 +26,7 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  */
 
 #include <common.h>
-#include <arm925t.h>
-#include <configs/omap1510.h>
-
+#include <arm926ejs.h>
 #include <asm/proc-armv/ptrace.h>
 
-extern void reset_cpu(ulong addr);
-#define TIMER_LOAD_VAL 0xffffffff
-
-/* macro to read the 32 bit timer */
-#define READ_TIMER (*(volatile ulong *)(CFG_TIMERBASE+8))
-
 #ifdef CONFIG_USE_IRQ
 /* enable IRQ interrupts */
 void enable_interrupts (void)
 {
        unsigned long temp;
        __asm__ __volatile__("mrs %0, cpsr\n"
-               "bic %0, %0, #0x80\n"
-               "msr cpsr_c, %0"
-               : "=r" (temp)
-               : "memory");
+                            "bic %0, %0, #0x80\n"
+                            "msr cpsr_c, %0"
+                            : "=r" (temp)
+                            :
+                            : "memory");
 }
 
+
 /*
  * disable IRQ/FIQ interrupts
  * returns true if interrupts had been enabled before we disabled them
@@ -61,10 +61,11 @@ int disable_interrupts (void)
 {
        unsigned long old,temp;
        __asm__ __volatile__("mrs %0, cpsr\n"
-               "orr %1, %0, #0xc0\n"
-               "msr cpsr_c, %1"
-               : "=r" (old), "=r" (temp)
-               : "memory");
+                            "orr %1, %0, #0xc0\n"
+                            "msr cpsr_c, %1"
+                            : "=r" (old), "=r" (temp)
+                            :
+                            : "memory");
        return (old & 0x80) == 0;
 }
 #else
@@ -101,15 +102,15 @@ void show_regs (struct pt_regs *regs)
 
        flags = condition_codes (regs);
 
-       printf ("pc : [<%08lx>]    lr : [<%08lx>]\n"
-               "sp : %08lx  ip : %08lx  fp : %08lx\n",
+       printf ("pc : [<%08lx>]    lr : [<%08lx>]\n"
+               "sp : %08lx  ip : %08lx  fp : %08lx\n",
                instruction_pointer (regs),
                regs->ARM_lr, regs->ARM_sp, regs->ARM_ip, regs->ARM_fp);
-       printf ("r10: %08lx  r9 : %08lx  r8 : %08lx\n",
+       printf ("r10: %08lx  r9 : %08lx  r8 : %08lx\n",
                regs->ARM_r10, regs->ARM_r9, regs->ARM_r8);
-       printf ("r7 : %08lx  r6 : %08lx  r5 : %08lx  r4 : %08lx\n",
+       printf ("r7 : %08lx  r6 : %08lx  r5 : %08lx  r4 : %08lx\n",
                regs->ARM_r7, regs->ARM_r6, regs->ARM_r5, regs->ARM_r4);
-       printf ("r3 : %08lx  r2 : %08lx  r1 : %08lx  r0 : %08lx\n",
+       printf ("r3 : %08lx  r2 : %08lx  r1 : %08lx  r0 : %08lx\n",
                regs->ARM_r3, regs->ARM_r2, regs->ARM_r1, regs->ARM_r0);
        printf ("Flags: %c%c%c%c",
                flags & CC_N_BIT ? 'N' : 'n',
@@ -171,122 +172,20 @@ void do_irq (struct pt_regs *pt_regs)
        bad_mode ();
 }
 
-static ulong timestamp;
-static ulong lastdec;
+#ifdef CONFIG_INTEGRATOR
 
-/* nothing really to do with interrupts, just starts up a counter. */
-int interrupt_init (void)
-{
-       int32_t val;
+       /* Timer functionality supplied by Integrator board (AP or CP) */
 
-       *((int32_t *) (CFG_TIMERBASE + LOAD_TIM)) = TIMER_LOAD_VAL;
-       val = MPUTIM_ST | MPUTIM_AR | MPUTIM_CLOCK_ENABLE |
-                       (CFG_PVT << MPUTIM_PTV_BIT);
-       *((int32_t *) (CFG_TIMERBASE + CNTL_TIMER)) = val;
-       return (0);
-}
-
-/*
- * timer without interrupts
- */
-
-void reset_timer (void)
-{
-       reset_timer_masked ();
-}
-
-ulong get_timer (ulong base)
-{
-       return get_timer_masked () - base;
-}
-
-void set_timer (ulong t)
-{
-       timestamp = t;
-}
-
-/* very rough timer... */
-void udelay (unsigned long usec)
-{
-#ifdef CONFIG_INNOVATOROMAP1610
-#define LOOPS_PER_MSEC 100             /* tuned on omap1610 */
-       volatile int i, time_remaining = LOOPS_PER_MSEC * usec;
-
-       for (i = time_remaining; i > 0; i--) {
-       }
 #else
 
-       ulong tmo;
-       tmo = usec / 1000;
-       tmo *= CFG_HZ;
-       tmo /= 1000;
-       tmo += get_timer (0);
-       while (get_timer_masked () < tmo)
-               /*NOP*/;
-#endif
-}
-
-void reset_timer_masked (void)
-{
-       /* reset time */
-       lastdec = READ_TIMER;
-       timestamp = 0;
-}
-
-ulong get_timer_masked (void)
-{
-       ulong now = READ_TIMER;         /* current tick value */
-
-       if (lastdec >= now) {           /* did I roll (rem decrementer) */
-               /* normal mode */
-               /* record amount of time since last check */
-               timestamp += lastdec - now;
-       } else {
-               /* we have an overflow ... */
-               timestamp += lastdec + TIMER_LOAD_VAL - now;
-       }
-       lastdec = now;
-
-       return timestamp;
-}
-
-void udelay_masked (unsigned long usec)
+/* nothing really to do with interrupts, just starts up a counter. */
+int interrupt_init (void)
 {
-#ifdef CONFIG_INNOVATOROMAP1610
-       #define LOOPS_PER_MSEC 100 /* tuned on omap1610 */
-       volatile int i, time_remaining = LOOPS_PER_MSEC*usec;
-       for (i=time_remaining; i>0; i--) { }
-#else
+       extern void timer_init(void);
 
-       ulong tmo;
+       timer_init();
 
-       tmo = usec / 1000;
-       tmo *= CFG_HZ;
-       tmo /= 1000;
-
-       reset_timer_masked ();
-
-       while (get_timer_masked () < tmo)
-               /*NOP*/;
-#endif
-}
-
-/*
- * This function is derived from PowerPC code (read timebase as long long).
- * On ARM it just returns the timer value.
- */
-unsigned long long get_ticks(void)
-{
-       return get_timer(0);
+       return 0;
 }
 
-/*
- * This function is derived from PowerPC code (timebase clock frequency).
- * On ARM it returns the number of timer ticks per second.
- */
-ulong get_tbclk (void)
-{
-       ulong tbclk;
-       tbclk = CFG_HZ;
-       return tbclk;
-}
+#endif /* CONFIG_INTEGRATOR */