Browse Source

sh: First step at generic timeofday support.

At the moment we wrap GENERIC_TIME around our existing timer API.
As boards start providing their own clocksources, they're able to
select GENERIC_TIME accordingly and optimize out most of the timer
API.

Once the current timers have been reworked as proper clocksource
drivers, the rest of the place holders for the timer API can go
away and we can flip on GENERIC_TIME unconditionally.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Paul Mundt 18 years ago
parent
commit
4588214526
3 changed files with 10 additions and 0 deletions
  1. 4 0
      arch/sh/Kconfig
  2. 2 0
      arch/sh/kernel/time.c
  3. 4 0
      include/asm-sh/timer.h

+ 4 - 0
arch/sh/Kconfig

@@ -45,6 +45,9 @@ config GENERIC_CALIBRATE_DELAY
 config GENERIC_IOMAP
 config GENERIC_IOMAP
 	bool
 	bool
 
 
+config GENERIC_TIME
+	def_bool n
+
 config ARCH_MAY_HAVE_PC_FDC
 config ARCH_MAY_HAVE_PC_FDC
 	bool
 	bool
 
 
@@ -357,6 +360,7 @@ config CPU_HAS_SR_RB
 endmenu
 endmenu
 
 
 menu "Timer support"
 menu "Timer support"
+depends on !GENERIC_TIME
 
 
 config SH_TMU
 config SH_TMU
 	bool "TMU timer support"
 	bool "TMU timer support"

+ 2 - 0
arch/sh/kernel/time.c

@@ -47,6 +47,7 @@ unsigned long long __attribute__ ((weak)) sched_clock(void)
 	return (unsigned long long)jiffies * (1000000000 / HZ);
 	return (unsigned long long)jiffies * (1000000000 / HZ);
 }
 }
 
 
+#ifndef CONFIG_GENERIC_TIME
 void do_gettimeofday(struct timeval *tv)
 void do_gettimeofday(struct timeval *tv)
 {
 {
 	unsigned long seq;
 	unsigned long seq;
@@ -99,6 +100,7 @@ int do_settimeofday(struct timespec *tv)
 	return 0;
 	return 0;
 }
 }
 EXPORT_SYMBOL(do_settimeofday);
 EXPORT_SYMBOL(do_settimeofday);
+#endif /* !CONFIG_GENERIC_TIME */
 
 
 /* last time the RTC clock got updated */
 /* last time the RTC clock got updated */
 static long last_rtc_update;
 static long last_rtc_update;

+ 4 - 0
include/asm-sh/timer.h

@@ -8,7 +8,9 @@ struct sys_timer_ops {
 	int (*init)(void);
 	int (*init)(void);
 	int (*start)(void);
 	int (*start)(void);
 	int (*stop)(void);
 	int (*stop)(void);
+#ifndef CONFIG_GENERIC_TIME
 	unsigned long (*get_offset)(void);
 	unsigned long (*get_offset)(void);
+#endif
 	unsigned long (*get_frequency)(void);
 	unsigned long (*get_frequency)(void);
 };
 };
 
 
@@ -24,10 +26,12 @@ struct sys_timer {
 extern struct sys_timer tmu_timer;
 extern struct sys_timer tmu_timer;
 extern struct sys_timer *sys_timer;
 extern struct sys_timer *sys_timer;
 
 
+#ifndef CONFIG_GENERIC_TIME
 static inline unsigned long get_timer_offset(void)
 static inline unsigned long get_timer_offset(void)
 {
 {
 	return sys_timer->ops->get_offset();
 	return sys_timer->ops->get_offset();
 }
 }
+#endif
 
 
 static inline unsigned long get_timer_frequency(void)
 static inline unsigned long get_timer_frequency(void)
 {
 {