From a8c7c708a9e0051c6358718c53572a4681eaa22b Mon Sep 17 00:00:00 2001 From: wdenk Date: Sat, 6 Dec 2003 19:49:23 +0000 Subject: * 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 --- cpu/mpc8260/interrupts.c | 131 +++-------------------------------------------- 1 file changed, 6 insertions(+), 125 deletions(-) (limited to 'cpu/mpc8260') diff --git a/cpu/mpc8260/interrupts.c b/cpu/mpc8260/interrupts.c index 3c5ef7460e..e2a6c97782 100644 --- a/cpu/mpc8260/interrupts.c +++ b/cpu/mpc8260/interrupts.c @@ -24,19 +24,13 @@ */ #include -#include #include #include #include #include -#ifdef CONFIG_STATUS_LED -#include -#endif /****************************************************************************/ -unsigned decrementer_count; /* count val for 1e6/HZ microseconds */ - struct irq_action { interrupt_handler_t *handler; void *arg; @@ -144,57 +138,13 @@ static int m8260_get_irq (struct pt_regs *regs) /* end of code ripped out of arch/ppc/kernel/ppc8260_pic.c */ /****************************************************************************/ -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;sync;isync"::"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) { DECLARE_GLOBAL_DATA_PTR; volatile immap_t *immr = (immap_t *) CFG_IMMR; - decrementer_count = (gd->bus_clk / 4) / CFG_HZ; + *decrementer_count = (gd->bus_clk / 4) / CFG_HZ; /* Initialize the default interrupt mapping priorities */ immr->im_intctl.ic_sicr = 0; @@ -216,10 +166,6 @@ int interrupt_init (void) immr->im_intctl.ic_siexr = -1; #endif - set_dec (decrementer_count); - - set_msr (get_msr () | MSR_EE); - return (0); } @@ -236,7 +182,7 @@ void external_interrupt (struct pt_regs *regs) m8260_mask_and_ack (irq); - set_msr (get_msr () | MSR_EE); + enable_interrupts (); if (irq_handlers[irq].handler != NULL) (*irq_handlers[irq].handler) (irq_handlers[irq].arg); @@ -292,75 +238,10 @@ void irq_free_handler (int irq) /****************************************************************************/ -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) -{ -#if defined(CONFIG_WATCHDOG) || defined(CFG_HYMOD_DBLEDS) - volatile immap_t *immr = (immap_t *) CFG_IMMR; -#endif /* CONFIG_WATCHDOG */ - - /* Restore Decrementer Count */ - set_dec (decrementer_count); - - timestamp++; - -#if defined(CONFIG_WATCHDOG) || \ - defined(CFG_CMA_LCD_HEARTBEAT) || \ - defined(CFG_HYMOD_DBLEDS) - - if ((timestamp % CFG_HZ) == 0) { -#if defined(CFG_CMA_LCD_HEARTBEAT) - extern void lcd_heartbeat (void); -#endif /* CFG_CMA_LCD_HEARTBEAT */ -#if defined(CFG_HYMOD_DBLEDS) - volatile iop8260_t *iop = &immr->im_ioport; - static int shift = 0; -#endif /* CFG_HYMOD_DBLEDS */ - -#if defined(CFG_CMA_LCD_HEARTBEAT) - lcd_heartbeat (); -#endif /* CFG_CMA_LCD_HEARTBEAT */ - -#if defined(CONFIG_WATCHDOG) - reset_8260_watchdog (immr); -#endif /* CONFIG_WATCHDOG */ - -#if defined(CFG_HYMOD_DBLEDS) - /* hymod daughter board LEDs */ - if (++shift > 3) - shift = 0; - iop->iop_pdatd = - (iop->iop_pdatd & ~0x0f000000) | (1 << (24 + shift)); -#endif /* CFG_HYMOD_DBLEDS */ - } -#endif /* CONFIG_WATCHDOG || CFG_CMA_LCD_HEARTBEAT */ - -#ifdef CONFIG_STATUS_LED - status_led_tick (timestamp); -#endif /* CONFIG_STATUS_LED */ -} - -/****************************************************************************/ - -void reset_timer (void) -{ - timestamp = 0; -} - -ulong get_timer (ulong base) -{ - return (timestamp - base); -} - -void set_timer (ulong t) +void timer_interrupt_cpu (struct pt_regs *regs) { - timestamp = t; + /* nothing to do here */ + return; } /****************************************************************************/ -- cgit