public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] 86xx: remove redudant code with lib_ppc/interrupts.c
@ 2008-08-19 20:05 Kumar Gala
  2008-08-28 12:09 ` Kumar Gala
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kumar Gala @ 2008-08-19 20:05 UTC (permalink / raw)
  To: u-boot

For some reason we duplicated the majority of code in lib_ppc/interrupts.c
not show 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 <galak@kernel.crashing.org>
---
 cpu/mpc86xx/interrupts.c |  131 +++-------------------------------------------
 1 files changed, 7 insertions(+), 124 deletions(-)

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 <mpc86xx.h>
 #include <command.h>
 #include <asm/processor.h>
-#include <ppc_asm.tmpl>
-#include <watchdog.h>
 
-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;
 }
 
-- 
1.5.5.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] 86xx: remove redudant code with lib_ppc/interrupts.c
  2008-08-19 20:05 [U-Boot] [PATCH] 86xx: remove redudant code with lib_ppc/interrupts.c Kumar Gala
@ 2008-08-28 12:09 ` Kumar Gala
  2008-10-12 22:16 ` Wolfgang Denk
  2008-10-13 11:56 ` Wolfgang Denk
  2 siblings, 0 replies; 4+ messages in thread
From: Kumar Gala @ 2008-08-28 12:09 UTC (permalink / raw)
  To: u-boot


On Aug 19, 2008, at 3:05 PM, Kumar Gala wrote:

> For some reason we duplicated the majority of code in lib_ppc/ 
> interrupts.c
> not show 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 <galak@kernel.crashing.org>
> ---
> cpu/mpc86xx/interrupts.c |  131 ++ 
> +-------------------------------------------
> 1 files changed, 7 insertions(+), 124 deletions(-)

Jon, can you ack or pick up this patch.

- k

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] 86xx: remove redudant code with lib_ppc/interrupts.c
  2008-08-19 20:05 [U-Boot] [PATCH] 86xx: remove redudant code with lib_ppc/interrupts.c Kumar Gala
  2008-08-28 12:09 ` Kumar Gala
@ 2008-10-12 22:16 ` Wolfgang Denk
  2008-10-13 11:56 ` Wolfgang Denk
  2 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2008-10-12 22:16 UTC (permalink / raw)
  To: u-boot

Dear Jon,

In message <1219176334-9864-1-git-send-email-galak@kernel.crashing.org> Kumar Gala wrote:
> For some reason we duplicated the majority of code in lib_ppc/interrupts.c
> not show 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.

I think this patch was not added, nor was any feedback sent?

Please comment.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"There are three principal ways to lose money: wine, women,  and  en-
gineers.  While  the first two are more pleasant, the third is by far
the more certain."                      -- Baron Rothschild, ca. 1800

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] 86xx: remove redudant code with lib_ppc/interrupts.c
  2008-08-19 20:05 [U-Boot] [PATCH] 86xx: remove redudant code with lib_ppc/interrupts.c Kumar Gala
  2008-08-28 12:09 ` Kumar Gala
  2008-10-12 22:16 ` Wolfgang Denk
@ 2008-10-13 11:56 ` Wolfgang Denk
  2 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2008-10-13 11:56 UTC (permalink / raw)
  To: u-boot

Dear Kumar,

In message <1219176334-9864-1-git-send-email-galak@kernel.crashing.org> you wrote:
> For some reason we duplicated the majority of code in lib_ppc/interrupts.c
> not show 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 <galak@kernel.crashing.org>
> ---
>  cpu/mpc86xx/interrupts.c |  131 +++-------------------------------------------
>  1 files changed, 7 insertions(+), 124 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Obviously, a major malfunction has occurred."
              -- Steve Nesbitt, voice of Mission Control, January 28,
                 1986, as the shuttle Challenger exploded within view
                 of the grandstands.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-10-13 11:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-19 20:05 [U-Boot] [PATCH] 86xx: remove redudant code with lib_ppc/interrupts.c Kumar Gala
2008-08-28 12:09 ` Kumar Gala
2008-10-12 22:16 ` Wolfgang Denk
2008-10-13 11:56 ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox