aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68knommu/kernel
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/kernel
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/kernel')
-rw-r--r--arch/m68knommu/kernel/setup.c9
-rw-r--r--arch/m68knommu/kernel/time.c22
2 files changed, 8 insertions, 23 deletions
diff --git a/arch/m68knommu/kernel/setup.c b/arch/m68knommu/kernel/setup.c
index de7732903763..74bf94948ec2 100644
--- a/arch/m68knommu/kernel/setup.c
+++ b/arch/m68knommu/kernel/setup.c
@@ -273,12 +273,3 @@ struct seq_operations cpuinfo_op = {
273 .show = show_cpuinfo, 273 .show = show_cpuinfo,
274}; 274};
275 275
276void arch_gettod(int *year, int *mon, int *day, int *hour,
277 int *min, int *sec)
278{
279 if (mach_gettod)
280 mach_gettod(year, mon, day, hour, min, sec);
281 else
282 *year = *mon = *day = *hour = *min = *sec = 0;
283}
284
diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c
index 467053da2d08..77e5375a2dd5 100644
--- a/arch/m68knommu/kernel/time.c
+++ b/arch/m68knommu/kernel/time.c
@@ -27,7 +27,6 @@
27 27
28#define TICK_SIZE (tick_nsec / 1000) 28#define TICK_SIZE (tick_nsec / 1000)
29 29
30
31static inline int set_rtc_mmss(unsigned long nowtime) 30static inline int set_rtc_mmss(unsigned long nowtime)
32{ 31{
33 if (mach_set_clock_mmss) 32 if (mach_set_clock_mmss)
@@ -39,15 +38,11 @@ static inline int set_rtc_mmss(unsigned long nowtime)
39 * timer_interrupt() needs to keep up the real-time clock, 38 * timer_interrupt() needs to keep up the real-time clock,
40 * as well as call the "do_timer()" routine every clocktick 39 * as well as call the "do_timer()" routine every clocktick
41 */ 40 */
42static irqreturn_t timer_interrupt(int irq, void *dummy) 41irqreturn_t arch_timer_interrupt(int irq, void *dummy)
43{ 42{
44 /* last time the cmos clock got updated */ 43 /* last time the cmos clock got updated */
45 static long last_rtc_update=0; 44 static long last_rtc_update=0;
46 45
47 /* may need to kick the hardware timer */
48 if (mach_tick)
49 mach_tick();
50
51 write_seqlock(&xtime_lock); 46 write_seqlock(&xtime_lock);
52 47
53 do_timer(1); 48 do_timer(1);
@@ -103,10 +98,10 @@ void time_init(void)
103{ 98{
104 unsigned int year, mon, day, hour, min, sec; 99 unsigned int year, mon, day, hour, min, sec;
105 100
106 extern void arch_gettod(int *year, int *mon, int *day, int *hour, 101 if (mach_gettod)
107 int *min, int *sec); 102 mach_gettod(&year, &mon, &day, &hour, &min, &sec);
108 103 else
109 arch_gettod(&year, &mon, &day, &hour, &min, &sec); 104 year = mon = day = hour = min = sec = 0;
110 105
111 if ((year += 1900) < 1970) 106 if ((year += 1900) < 1970)
112 year += 100; 107 year += 100;
@@ -114,7 +109,7 @@ void time_init(void)
114 xtime.tv_nsec = 0; 109 xtime.tv_nsec = 0;
115 wall_to_monotonic.tv_sec = -xtime.tv_sec; 110 wall_to_monotonic.tv_sec = -xtime.tv_sec;
116 111
117 mach_sched_init(timer_interrupt); 112 hw_timer_init();
118} 113}
119 114
120/* 115/*
@@ -128,7 +123,7 @@ void do_gettimeofday(struct timeval *tv)
128 123
129 do { 124 do {
130 seq = read_seqbegin_irqsave(&xtime_lock, flags); 125 seq = read_seqbegin_irqsave(&xtime_lock, flags);
131 usec = mach_gettimeoffset ? mach_gettimeoffset() : 0; 126 usec = hw_timer_offset();
132 sec = xtime.tv_sec; 127 sec = xtime.tv_sec;
133 usec += (xtime.tv_nsec / 1000); 128 usec += (xtime.tv_nsec / 1000);
134 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); 129 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
@@ -160,8 +155,7 @@ int do_settimeofday(struct timespec *tv)
160 * Discover what correction gettimeofday 155 * Discover what correction gettimeofday
161 * would have done, and then undo it! 156 * would have done, and then undo it!
162 */ 157 */
163 if (mach_gettimeoffset) 158 nsec -= (hw_timer_offset() * 1000);
164 nsec -= (mach_gettimeoffset() * 1000);
165 159
166 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); 160 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
167 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); 161 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);