summaryrefslogtreecommitdiff
path: root/cpu/mpc8xx/interrupts.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-12-06 19:49:23 +0000
committerwdenk <wdenk>2003-12-06 19:49:23 +0000
commita8c7c708a9e0051c6358718c53572a4681eaa22b (patch)
treeb560561c91725eb2f86289da61ee676787419e37 /cpu/mpc8xx/interrupts.c
parentfa1399ed127c8be507bf182dc7d8d61a54938d79 (diff)
* Patch by Gleb Natapov, 19 Sep 2003:
Move most of the timer interrupt related PPC code to ppc_lib/interrupts.c * Patch by Anders Larsen, 17 Sep 2003: Bring ARM memory layout in sync with the documentation: stack and malloc-heap are now located _below_ the U-Boot code
Diffstat (limited to 'cpu/mpc8xx/interrupts.c')
-rw-r--r--cpu/mpc8xx/interrupts.c117
1 files changed, 3 insertions, 114 deletions
diff --git a/cpu/mpc8xx/interrupts.c b/cpu/mpc8xx/interrupts.c
index 8bc0a1afde..558dc09c07 100644
--- a/cpu/mpc8xx/interrupts.c
+++ b/cpu/mpc8xx/interrupts.c
@@ -22,7 +22,6 @@
*/
#include <common.h>
-#include <watchdog.h>
#include <mpc8xx.h>
#include <mpc8xx_irq.h>
#include <asm/processor.h>
@@ -30,10 +29,6 @@
/************************************************************************/
-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,20 +259,15 @@ 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
@@ -339,57 +279,6 @@ void timer_interrupt (struct pt_regs *regs)
#else
immr->im_clkrst.car_plprcr |= PLPRCR_TEXPS | PLPRCR_TMIST;
#endif
- /* 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
-
-#if defined(CFG_CMA_LCD_HEARTBEAT)
- extern void lcd_heartbeat (void);
-
- lcd_heartbeat ();
-#endif /* CFG_CMA_LCD_HEARTBEAT */
-
-#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;
}
/************************************************************************/