From 5c7cbcd34d0ee566875a4fd0f2a3e5a62bba921c Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Tue, 19 Aug 2008 15:05:34 -0500 Subject: 86xx: remove redudant code with lib_ppc/interrupts.c For some reason we duplicated the majority of code in lib_ppc/interrupts.c Not know how that happened, but there is no good reason for it. Use the interrupt_init_cpu() and timer_interrupt_cpu() since its why they exist. Signed-off-by: Kumar Gala --- cpu/mpc86xx/interrupts.c | 131 +++-------------------------------------------- 1 file changed, 7 insertions(+), 124 deletions(-) (limited to 'cpu/mpc86xx/interrupts.c') diff --git a/cpu/mpc86xx/interrupts.c b/cpu/mpc86xx/interrupts.c index f16744b..fa2cfac 100644 --- a/cpu/mpc86xx/interrupts.c +++ b/cpu/mpc86xx/interrupts.c @@ -35,78 +35,23 @@ #include #include #include -#include -#include -unsigned long decrementer_count; /* count value for 1e6/HZ microseconds */ -unsigned long timestamp; - - -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) -{ - if (val) - asm volatile ("mtdec %0"::"r" (val)); -} - -/* interrupt is not supported yet */ int interrupt_init_cpu(unsigned long *decrementer_count) { - return 0; -} - -int interrupt_init(void) -{ - int ret; - volatile immap_t *immr = (immap_t *)CFG_IMMR; - immr->im_pic.gcr = MPC86xx_PICGCR_RST; - while (immr->im_pic.gcr & MPC86xx_PICGCR_RST); - immr->im_pic.gcr = MPC86xx_PICGCR_MODE; - - /* call cpu specific function from $(CPU)/interrupts.c */ - ret = interrupt_init_cpu(&decrementer_count); + volatile ccsr_pic_t *pic = &immr->im_pic; - if (ret) - return ret; + pic->gcr = MPC86xx_PICGCR_RST; + while (pic->gcr & MPC86xx_PICGCR_RST) + ; + pic->gcr = MPC86xx_PICGCR_MODE; - decrementer_count = get_tbclk() / CFG_HZ; + *decrementer_count = get_tbclk() / CFG_HZ; debug("interrupt init: tbclk() = %d MHz, decrementer_count = %ld\n", (get_tbclk() / 1000000), - decrementer_count); - - set_dec(decrementer_count); - - set_msr(get_msr() | MSR_EE); - - debug("MSR = 0x%08lx, Decrementer reg = 0x%08lx\n", - get_msr(), - get_dec()); + *decrementer_count); #ifdef CONFIG_INTERRUPTS - volatile ccsr_pic_t *pic = &immr->im_pic; pic->iivpr1 = 0x810001; /* 50220 enable mcm interrupts */ debug("iivpr1@%x = %x\n", &pic->iivpr1, pic->iivpr1); @@ -132,25 +77,6 @@ int interrupt_init(void) return 0; } -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; -} - -void increment_timestamp(void) -{ - timestamp++; -} - /* * timer_interrupt - gets called when the decrementer overflows, * with interrupts disabled. @@ -161,50 +87,9 @@ void timer_interrupt_cpu(struct pt_regs *regs) /* nothing to do here */ } -void timer_interrupt(struct pt_regs *regs) -{ - /* call cpu specific function from $(CPU)/interrupts.c */ - timer_interrupt_cpu(regs); - - timestamp++; - - /* Restore Decrementer Count */ - set_dec(decrementer_count); - -#if defined(CONFIG_WATCHDOG) || defined (CONFIG_HW_WATCHDOG) - if ((timestamp % (CFG_WATCHDOG_FREQ)) == 0) - WATCHDOG_RESET(); -#endif /* CONFIG_WATCHDOG || CONFIG_HW_WATCHDOG */ - -#ifdef CONFIG_STATUS_LED - status_led_tick(timestamp); -#endif /* CONFIG_STATUS_LED */ - -#ifdef CONFIG_SHOW_ACTIVITY - board_show_activity(timestamp); -#endif /* CONFIG_SHOW_ACTIVITY */ - -} - -void reset_timer(void) -{ - timestamp = 0; -} - -ulong get_timer(ulong base) -{ - return timestamp - base; -} - -void set_timer(ulong t) -{ - timestamp = t; -} - /* * Install and free a interrupt handler. Not implemented yet. */ - void irq_install_handler(int vec, interrupt_handler_t *handler, void *arg) { } @@ -218,8 +103,6 @@ void irq_free_handler(int vec) */ int do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { - printf("\nInterrupt-unsupported:\n"); - return 0; } -- cgit v1.1 From 6d0f6bcf337c5261c08fabe12982178c2c489d76 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Thu, 16 Oct 2008 15:01:15 +0200 Subject: rename CFG_ macros to CONFIG_SYS Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- cpu/mpc86xx/interrupts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cpu/mpc86xx/interrupts.c') diff --git a/cpu/mpc86xx/interrupts.c b/cpu/mpc86xx/interrupts.c index fa2cfac..c78fc72 100644 --- a/cpu/mpc86xx/interrupts.c +++ b/cpu/mpc86xx/interrupts.c @@ -38,7 +38,7 @@ int interrupt_init_cpu(unsigned long *decrementer_count) { - volatile immap_t *immr = (immap_t *)CFG_IMMR; + volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR; volatile ccsr_pic_t *pic = &immr->im_pic; pic->gcr = MPC86xx_PICGCR_RST; @@ -46,7 +46,7 @@ int interrupt_init_cpu(unsigned long *decrementer_count) ; pic->gcr = MPC86xx_PICGCR_MODE; - *decrementer_count = get_tbclk() / CFG_HZ; + *decrementer_count = get_tbclk() / CONFIG_SYS_HZ; debug("interrupt init: tbclk() = %d MHz, decrementer_count = %ld\n", (get_tbclk() / 1000000), *decrementer_count); -- cgit v1.1