From: Kumar Gala <galak@kernel.crashing.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 24/24] mpc85xx: remove redudant code with lib_ppc/interrupts.c
Date: Wed, 27 Aug 2008 01:10:57 -0500 [thread overview]
Message-ID: <1219817457-7432-24-git-send-email-galak@kernel.crashing.org> (raw)
In-Reply-To: <1219817457-7432-23-git-send-email-galak@kernel.crashing.org>
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/mpc85xx/interrupts.c | 109 +++++-----------------------------------------
1 files changed, 12 insertions(+), 97 deletions(-)
diff --git a/cpu/mpc85xx/interrupts.c b/cpu/mpc85xx/interrupts.c
index 4fe1fac..06d4d8b 100644
--- a/cpu/mpc85xx/interrupts.c
+++ b/cpu/mpc85xx/interrupts.c
@@ -31,64 +31,20 @@
#include <watchdog.h>
#include <command.h>
#include <asm/processor.h>
-#include <ppc_asm.tmpl>
-unsigned decrementer_count; /* count value for 1e6/HZ microseconds */
-
-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));
- asm volatile("isync");
-}
-
-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));
-}
-
-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 long *decrementer_count)
{
volatile ccsr_pic_t *pic = (void *)(CFG_MPC85xx_PIC_ADDR);
pic->gcr = MPC85xx_PICGCR_RST;
- while (pic->gcr & MPC85xx_PICGCR_RST);
+ while (pic->gcr & MPC85xx_PICGCR_RST)
+ ;
pic->gcr = MPC85xx_PICGCR_M;
- decrementer_count = get_tbclk() / CFG_HZ;
+
+ *decrementer_count = get_tbclk() / CFG_HZ;
+
+ /* PIE is same as DIE, dec interrupt enable */
mtspr(SPRN_TCR, TCR_PIE);
- set_dec (decrementer_count);
- set_msr (get_msr () | MSR_EE);
#ifdef CONFIG_INTERRUPTS
pic->iivpr1 = 0x810001; /* 50220 enable ecm interrupts */
@@ -123,9 +79,7 @@ int interrupt_init (void)
return (0);
}
-/*
- * Install and free a interrupt handler. Not implemented yet.
- */
+/* Install and free a interrupt handler. Not implemented yet. */
void
irq_install_handler(int vec, interrupt_handler_t *handler, void *arg)
@@ -139,55 +93,16 @@ irq_free_handler(int vec)
return;
}
-/****************************************************************************/
-
-
-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)
{
- timestamp++;
- set_dec (decrementer_count);
+ /* PIS is same as DIS, dec interrupt status */
mtspr(SPRN_TSR, TSR_PIS);
-#if defined(CONFIG_WATCHDOG)
- if ((timestamp % 1000) == 0)
- reset_85xx_watchdog();
-#endif /* CONFIG_WATCHDOG */
-}
-
-void reset_timer (void)
-{
- timestamp = 0;
-}
-
-ulong get_timer (ulong base)
-{
- return (timestamp - base);
-}
-
-void set_timer (ulong t)
-{
- timestamp = t;
}
#if defined(CONFIG_CMD_IRQ)
-
-/*******************************************************************************
- *
- * irqinfo - print information about PCI devices,not implemented.
- *
- */
-int
-do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+/* irqinfo - print information about PCI devices,not implemented. */
+int do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- printf ("\nInterrupt-unsupported:\n");
-
return 0;
}
-
#endif
--
1.5.5.1
next prev parent reply other threads:[~2008-08-27 6:10 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-27 6:10 [U-Boot] [PATCH 01/24] FSL DDR: Remove duplicate setting of cs0_bnds register on 86xx Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 02/24] FSL DDR: Add e500 TLB helper for DDR code Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 03/24] FSL DDR: Add 85xx specific register setting Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 04/24] FSL DDR: Convert MPC8540ADS to new DDR code Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 05/24] FSL DDR: Convert MPC8560ADS " Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 06/24] FSL DDR: Convert MPC8555ADS " Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 07/24] FSL DDR: Convert MPC8541CDS " Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 08/24] FSL DDR: Convert MPC8548CDS " Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 09/24] FSL DDR: Convert MPC8568MDS " Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 10/24] FSL DDR: Convert MPC8544DS " Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 11/24] FSL DDR: Convert socrates " Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 12/24] FSL DDR: Convert atum8548 " Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 13/24] FSL DDR: Convert sbc8548 " Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 14/24] FSL DDR: Convert PM854 " Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 15/24] FSL DDR: Convert PM856 " Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 16/24] FSL DDR: Convert MPC8540EVAL " Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 17/24] FSL DDR: Convert SBC8560 " Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 18/24] FSL DDR: Convert STXGP3 " Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 19/24] FSL DDR: Convert STXSSA " Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 20/24] FSL DDR: Remove old SPD support from cpu/mpc85xx Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 21/24] mpc85xx: Add support for the MPC8572DS reference board Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 22/24] mpc85xx: Add support for the MPC8536 Kumar Gala
2008-08-27 6:10 ` [U-Boot] [PATCH 23/24] mpc85xx: Add support for the MPC8536DS reference board Kumar Gala
2008-08-27 6:10 ` Kumar Gala [this message]
2008-10-18 18:07 ` [U-Boot] [PATCH 19/24] FSL DDR: Convert STXSSA to new DDR code Wolfgang Denk
2008-10-19 18:19 ` Kumar Gala
2008-08-27 22:37 ` [U-Boot] [PATCH 01/24] FSL DDR: Remove duplicate setting of cs0_bnds register on 86xx Wolfgang Denk
2008-08-27 22:45 ` Jon Loeliger
2008-08-27 23:17 ` Kumar Gala
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1219817457-7432-24-git-send-email-galak@kernel.crashing.org \
--to=galak@kernel.crashing.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox