aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68knommu/platform/5307
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@snapgear.com>2007-10-23 00:37:54 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-23 11:32:35 -0400
commit2f2c2679893c963bd90c5e1c0669b97fd87d1c4a (patch)
treee999c52741b86aef2ad5bcb4ef4e1aeb44613f1d /arch/m68knommu/platform/5307
parent49aa49bfd40d718095669c1c70c9d167b814e29b (diff)
m68knommu: cleanup m68knommu timer code
Reduce the function pointer mess of the m68knommu timer code by calling directly to the local hardware's timer setup, and expose the local common timer interrupt handler to the lower level hardware timer. Ultimately this will save definitions of all these functions across all the platform code to setup the function pointers (which for any given m68knommu CPU family member can be only one set of hardware timer functions). Signed-off-by: Greg Ungerer <gerg@uclinux.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/m68knommu/platform/5307')
-rw-r--r--arch/m68knommu/platform/5307/config.c10
-rw-r--r--arch/m68knommu/platform/5307/pit.c15
-rw-r--r--arch/m68knommu/platform/5307/timers.c19
3 files changed, 20 insertions, 24 deletions
diff --git a/arch/m68knommu/platform/5307/config.c b/arch/m68knommu/platform/5307/config.c
index e3461619fd65..6040821e637d 100644
--- a/arch/m68knommu/platform/5307/config.c
+++ b/arch/m68knommu/platform/5307/config.c
@@ -10,25 +10,18 @@
10/***************************************************************************/ 10/***************************************************************************/
11 11
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/sched.h>
14#include <linux/param.h> 13#include <linux/param.h>
15#include <linux/init.h> 14#include <linux/init.h>
16#include <linux/interrupt.h> 15#include <linux/interrupt.h>
17#include <asm/irq.h>
18#include <asm/dma.h> 16#include <asm/dma.h>
19#include <asm/traps.h>
20#include <asm/machdep.h> 17#include <asm/machdep.h>
21#include <asm/coldfire.h> 18#include <asm/coldfire.h>
22#include <asm/mcftimer.h>
23#include <asm/mcfsim.h> 19#include <asm/mcfsim.h>
24#include <asm/mcfdma.h> 20#include <asm/mcfdma.h>
25#include <asm/mcfwdebug.h> 21#include <asm/mcfwdebug.h>
26 22
27/***************************************************************************/ 23/***************************************************************************/
28 24
29void coldfire_tick(void);
30void coldfire_timer_init(irq_handler_t handler);
31unsigned long coldfire_timer_offset(void);
32void coldfire_reset(void); 25void coldfire_reset(void);
33 26
34extern unsigned int mcf_timervector; 27extern unsigned int mcf_timervector;
@@ -122,9 +115,6 @@ void config_BSP(char *commandp, int size)
122 mcf_timerlevel = 6; 115 mcf_timerlevel = 6;
123#endif 116#endif
124 117
125 mach_sched_init = coldfire_timer_init;
126 mach_tick = coldfire_tick;
127 mach_gettimeoffset = coldfire_timer_offset;
128 mach_reset = coldfire_reset; 118 mach_reset = coldfire_reset;
129 119
130#ifdef MCF_BDM_DISABLE 120#ifdef MCF_BDM_DISABLE
diff --git a/arch/m68knommu/platform/5307/pit.c b/arch/m68knommu/platform/5307/pit.c
index f18352fa35a6..173b754d1cda 100644
--- a/arch/m68knommu/platform/5307/pit.c
+++ b/arch/m68knommu/platform/5307/pit.c
@@ -17,6 +17,7 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <asm/machdep.h>
20#include <asm/io.h> 21#include <asm/io.h>
21#include <asm/coldfire.h> 22#include <asm/coldfire.h>
22#include <asm/mcfpit.h> 23#include <asm/mcfpit.h>
@@ -31,28 +32,30 @@
31 32
32/***************************************************************************/ 33/***************************************************************************/
33 34
34void coldfire_pit_tick(void) 35static irqreturn_t hw_tick(int irq, void *dummy)
35{ 36{
36 unsigned short pcsr; 37 unsigned short pcsr;
37 38
38 /* Reset the ColdFire timer */ 39 /* Reset the ColdFire timer */
39 pcsr = __raw_readw(TA(MCFPIT_PCSR)); 40 pcsr = __raw_readw(TA(MCFPIT_PCSR));
40 __raw_writew(pcsr | MCFPIT_PCSR_PIF, TA(MCFPIT_PCSR)); 41 __raw_writew(pcsr | MCFPIT_PCSR_PIF, TA(MCFPIT_PCSR));
42
43 return arch_timer_interrupt(irq, dummy);
41} 44}
42 45
43/***************************************************************************/ 46/***************************************************************************/
44 47
45static struct irqaction coldfire_pit_irq = { 48static struct irqaction coldfire_pit_irq = {
46 .name = "timer", 49 .name = "timer",
47 .flags = IRQF_DISABLED | IRQF_TIMER, 50 .flags = IRQF_DISABLED | IRQF_TIMER,
51 .handler = hw_tick,
48}; 52};
49 53
50void coldfire_pit_init(irq_handler_t handler) 54void hw_timer_init(void)
51{ 55{
52 volatile unsigned char *icrp; 56 volatile unsigned char *icrp;
53 volatile unsigned long *imrp; 57 volatile unsigned long *imrp;
54 58
55 coldfire_pit_irq.handler = handler;
56 setup_irq(MCFINT_VECBASE + MCFINT_PIT1, &coldfire_pit_irq); 59 setup_irq(MCFINT_VECBASE + MCFINT_PIT1, &coldfire_pit_irq);
57 60
58 icrp = (volatile unsigned char *) (MCF_IPSBAR + MCFICM_INTC0 + 61 icrp = (volatile unsigned char *) (MCF_IPSBAR + MCFICM_INTC0 +
@@ -71,7 +74,7 @@ void coldfire_pit_init(irq_handler_t handler)
71 74
72/***************************************************************************/ 75/***************************************************************************/
73 76
74unsigned long coldfire_pit_offset(void) 77unsigned long hw_timer_offset(void)
75{ 78{
76 volatile unsigned long *ipr; 79 volatile unsigned long *ipr;
77 unsigned long pmr, pcntr, offset; 80 unsigned long pmr, pcntr, offset;
diff --git a/arch/m68knommu/platform/5307/timers.c b/arch/m68knommu/platform/5307/timers.c
index 64bd0ff9029e..489dec85c859 100644
--- a/arch/m68knommu/platform/5307/timers.c
+++ b/arch/m68knommu/platform/5307/timers.c
@@ -9,10 +9,9 @@
9/***************************************************************************/ 9/***************************************************************************/
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h>
12#include <linux/sched.h> 13#include <linux/sched.h>
13#include <linux/param.h>
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/init.h>
16#include <linux/irq.h> 15#include <linux/irq.h>
17#include <asm/io.h> 16#include <asm/io.h>
18#include <asm/traps.h> 17#include <asm/traps.h>
@@ -54,24 +53,28 @@ extern int mcf_timerirqpending(int timer);
54 53
55/***************************************************************************/ 54/***************************************************************************/
56 55
57void coldfire_tick(void) 56static irqreturn_t hw_tick(int irq, void *dummy)
58{ 57{
59 /* Reset the ColdFire timer */ 58 /* Reset the ColdFire timer */
60 __raw_writeb(MCFTIMER_TER_CAP | MCFTIMER_TER_REF, TA(MCFTIMER_TER)); 59 __raw_writeb(MCFTIMER_TER_CAP | MCFTIMER_TER_REF, TA(MCFTIMER_TER));
60
61 return arch_timer_interrupt(irq, dummy);
61} 62}
62 63
63/***************************************************************************/ 64/***************************************************************************/
64 65
65static struct irqaction coldfire_timer_irq = { 66static struct irqaction coldfire_timer_irq = {
66 .name = "timer", 67 .name = "timer",
67 .flags = IRQF_DISABLED | IRQF_TIMER, 68 .flags = IRQF_DISABLED | IRQF_TIMER,
69 .handler = hw_tick,
68}; 70};
69 71
72/***************************************************************************/
73
70static int ticks_per_intr; 74static int ticks_per_intr;
71 75
72void coldfire_timer_init(irq_handler_t handler) 76void hw_timer_init(void)
73{ 77{
74 coldfire_timer_irq.handler = handler;
75 setup_irq(mcf_timervector, &coldfire_timer_irq); 78 setup_irq(mcf_timervector, &coldfire_timer_irq);
76 79
77 __raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR)); 80 __raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR));
@@ -89,7 +92,7 @@ void coldfire_timer_init(irq_handler_t handler)
89 92
90/***************************************************************************/ 93/***************************************************************************/
91 94
92unsigned long coldfire_timer_offset(void) 95unsigned long hw_timer_offset(void)
93{ 96{
94 unsigned long tcn, offset; 97 unsigned long tcn, offset;
95 98