]> git.sur5r.net Git - u-boot/blobdiff - cpu/mpc8xx/interrupts.c
Merge remote branch 'u-boot-at91/for-1.3.4'
[u-boot] / cpu / mpc8xx / interrupts.c
index 866482600fc79d380ee1a43ae144bc2868427d6f..20e7012c3724e6b02b7b628973720ff22b6db222 100644 (file)
@@ -22,7 +22,6 @@
  */
 
 #include <common.h>
-#include <watchdog.h>
 #include <mpc8xx.h>
 #include <mpc8xx_irq.h>
 #include <asm/processor.h>
 
 /************************************************************************/
 
-unsigned decrementer_count;    /* count value for 1e6/HZ microseconds  */
-
-/************************************************************************/
-
 /*
  * CPM interrupt vector functions.
  */
@@ -50,57 +45,11 @@ static void cpm_interrupt (void *regs);
 
 /************************************************************************/
 
-static __inline__ unsigned long get_msr (void)
-{
-       unsigned long msr;
-
-       asm volatile ("mfmsr %0":"=r" (msr):);
-
-       return msr;
-}
-
-static __inline__ void set_msr (unsigned long msr)
-{
-       asm volatile ("mtmsr %0"::"r" (msr));
-}
-
-static __inline__ unsigned long get_dec (void)
-{
-       unsigned long val;
-
-       asm volatile ("mfdec %0":"=r" (val):);
-
-       return val;
-}
-
-
-static __inline__ void set_dec (unsigned long val)
-{
-       asm volatile ("mtdec %0"::"r" (val));
-}
-
-
-void enable_interrupts (void)
-{
-       set_msr (get_msr () | MSR_EE);
-}
-
-/* returns flag if MSR_EE was set before */
-int disable_interrupts (void)
-{
-       ulong msr = get_msr ();
-
-       set_msr (msr & ~MSR_EE);
-       return ((msr & MSR_EE) != 0);
-}
-
-/************************************************************************/
-
-int interrupt_init (void)
+int interrupt_init_cpu (unsigned *decrementer_count)
 {
        volatile immap_t *immr = (immap_t *) CFG_IMMR;
 
-       decrementer_count = get_tbclk () / CFG_HZ;
+       *decrementer_count = get_tbclk () / CFG_HZ;
 
        /* disable all interrupts */
        immr->im_siu_conf.sc_simask = 0;
@@ -108,10 +57,6 @@ int interrupt_init (void)
        /* Configure CPM interrupts */
        cpm_interrupt_init ();
 
-       set_dec (decrementer_count);
-
-       set_msr (get_msr () | MSR_EE);
-
        return (0);
 }
 
@@ -314,78 +259,36 @@ static void cpm_interrupt_init (void)
 
 /************************************************************************/
 
-volatile ulong timestamp = 0;
-
 /*
  * timer_interrupt - gets called when the decrementer overflows,
  * with interrupts disabled.
  * Trivial implementation - no need to be really accurate.
  */
-void timer_interrupt (struct pt_regs *regs)
+void timer_interrupt_cpu (struct pt_regs *regs)
 {
        volatile immap_t *immr = (immap_t *) CFG_IMMR;
 
-#ifdef CONFIG_STATUS_LED
-       extern void status_led_tick (ulong);
-#endif
 #if 0
        printf ("*** Timer Interrupt *** ");
 #endif
        /* Reset Timer Expired and Timers Interrupt Status */
        immr->im_clkrstk.cark_plprcrk = KAPWR_KEY;
        __asm__ ("nop");
-       immr->im_clkrst.car_plprcr |= PLPRCR_TEXPS | PLPRCR_TMIST;
-       /* Restore Decrementer Count */
-       set_dec (decrementer_count);
-
-       timestamp++;
-
-#ifdef CONFIG_STATUS_LED
-       status_led_tick (timestamp);
-#endif /* CONFIG_STATUS_LED */
-
-#if defined(CONFIG_WATCHDOG) || defined(CFG_CMA_LCD_HEARTBEAT)
-
        /*
-        * The shortest watchdog period of all boards (except LWMON)
-        * is approx. 1 sec, thus re-trigger watchdog at least
-        * every 500 ms = CFG_HZ / 2
-        */
-#ifndef CONFIG_LWMON
-       if ((timestamp % (CFG_HZ / 2)) == 0) {
-#else
-       if ((timestamp % (CFG_HZ / 20)) == 0) {
-#endif
+         Clear TEXPS (and TMIST on older chips). SPLSS (on older
+         chips) is cleared too.
 
-#if defined(CFG_CMA_LCD_HEARTBEAT)
-               extern void lcd_heartbeat (void);
+         Bitwise OR is a read-modify-write operation so ALL bits
+         which are cleared by writing `1' would be cleared by
+         operations like
 
-               lcd_heartbeat ();
-#endif /* CFG_CMA_LCD_HEARTBEAT */
+         immr->im_clkrst.car_plprcr |= PLPRCR_TEXPS;
 
-#if defined(CONFIG_WATCHDOG)
-               reset_8xx_watchdog (immr);
-#endif /* CONFIG_WATCHDOG */
-
-       }
-#endif /* CONFIG_WATCHDOG || CFG_CMA_LCD_HEARTBEAT */
-}
-
-/************************************************************************/
-
-void reset_timer (void)
-{
-       timestamp = 0;
-}
-
-ulong get_timer (ulong base)
-{
-       return (timestamp - base);
-}
-
-void set_timer (ulong t)
-{
-       timestamp = t;
+         The same can be achieved by simple writing of the PLPRCR
+         to itself. If a bit value should be preserved, read the
+         register, ZERO the bit and write, not OR, the result back.
+       */
+       immr->im_clkrst.car_plprcr = immr->im_clkrst.car_plprcr;
 }
 
 /************************************************************************/