aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sh/Kconfig11
-rw-r--r--arch/sh/include/asm/timer.h28
-rw-r--r--arch/sh/kernel/Makefile_322
-rw-r--r--arch/sh/kernel/Makefile_642
-rw-r--r--arch/sh/kernel/cpu/clock.c1
-rw-r--r--arch/sh/kernel/time.c29
-rw-r--r--arch/sh/kernel/timers/Makefile5
-rw-r--r--arch/sh/kernel/timers/timer.c46
8 files changed, 4 insertions, 120 deletions
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index e7b6406c96b6..fb75c2d1928d 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -494,17 +494,6 @@ config SH_TIMER_MTU2
494 help 494 help
495 This enables build of the MTU2 timer driver. 495 This enables build of the MTU2 timer driver.
496 496
497config SH_TIMER_IRQ
498 int
499 default "28" if CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785 || \
500 CPU_SUBTYPE_SH7763
501 default "86" if CPU_SUBTYPE_SH7619
502 default "140" if CPU_SUBTYPE_SH7206
503 default "142" if CPU_SUBTYPE_SH7203 && SH_CMT
504 default "153" if CPU_SUBTYPE_SH7203 && SH_MTU2
505 default "238" if CPU_SUBTYPE_MXG
506 default "16"
507
508config SH_PCLK_FREQ 497config SH_PCLK_FREQ
509 int "Peripheral clock frequency (in Hz)" 498 int "Peripheral clock frequency (in Hz)"
510 default "27000000" if CPU_SUBTYPE_SH7343 499 default "27000000" if CPU_SUBTYPE_SH7343
diff --git a/arch/sh/include/asm/timer.h b/arch/sh/include/asm/timer.h
deleted file mode 100644
index f27a88bfdcc7..000000000000
--- a/arch/sh/include/asm/timer.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef __ASM_SH_TIMER_H
2#define __ASM_SH_TIMER_H
3
4#include <linux/sysdev.h>
5#include <linux/clocksource.h>
6#include <cpu/timer.h>
7
8struct sys_timer_ops {
9 int (*init)(void);
10 int (*start)(void);
11 int (*stop)(void);
12};
13
14struct sys_timer {
15 const char *name;
16
17 struct sys_device dev;
18 struct sys_timer_ops *ops;
19};
20
21extern struct sys_timer *sys_timer;
22
23/* arch/sh/kernel/timers/timer.c */
24struct sys_timer *get_sys_timer(void);
25
26extern struct clocksource clocksource_sh;
27
28#endif /* __ASM_SH_TIMER_H */
diff --git a/arch/sh/kernel/Makefile_32 b/arch/sh/kernel/Makefile_32
index aee08afe5ff7..9411e3e31e68 100644
--- a/arch/sh/kernel/Makefile_32
+++ b/arch/sh/kernel/Makefile_32
@@ -14,7 +14,7 @@ obj-y := debugtraps.o idle.o io.o io_generic.o irq.o \
14 sys_sh.o sys_sh32.o syscalls_32.o time.o topology.o \ 14 sys_sh.o sys_sh32.o syscalls_32.o time.o topology.o \
15 traps.o traps_32.o 15 traps.o traps_32.o
16 16
17obj-y += cpu/ timers/ 17obj-y += cpu/
18obj-$(CONFIG_VSYSCALL) += vsyscall/ 18obj-$(CONFIG_VSYSCALL) += vsyscall/
19obj-$(CONFIG_SMP) += smp.o 19obj-$(CONFIG_SMP) += smp.o
20obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o 20obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o
diff --git a/arch/sh/kernel/Makefile_64 b/arch/sh/kernel/Makefile_64
index c845a0d61979..67b9f6c6326b 100644
--- a/arch/sh/kernel/Makefile_64
+++ b/arch/sh/kernel/Makefile_64
@@ -4,7 +4,7 @@ obj-y := debugtraps.o idle.o io.o io_generic.o irq.o machvec.o process_64.o \
4 ptrace_64.o setup.o signal_64.o sys_sh.o sys_sh64.o \ 4 ptrace_64.o setup.o signal_64.o sys_sh.o sys_sh64.o \
5 syscalls_64.o time.o topology.o traps.o traps_64.o 5 syscalls_64.o time.o topology.o traps.o traps_64.o
6 6
7obj-y += cpu/ timers/ 7obj-y += cpu/
8obj-$(CONFIG_SMP) += smp.o 8obj-$(CONFIG_SMP) += smp.o
9obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o 9obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o
10obj-$(CONFIG_MODULES) += sh_ksyms_64.o module.o 10obj-$(CONFIG_MODULES) += sh_ksyms_64.o module.o
diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c
index 133dbe403341..f54769f455b1 100644
--- a/arch/sh/kernel/cpu/clock.c
+++ b/arch/sh/kernel/cpu/clock.c
@@ -26,7 +26,6 @@
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/proc_fs.h> 27#include <linux/proc_fs.h>
28#include <asm/clock.h> 28#include <asm/clock.h>
29#include <asm/timer.h>
30 29
31static LIST_HEAD(clock_list); 30static LIST_HEAD(clock_list);
32static DEFINE_SPINLOCK(clock_lock); 31static DEFINE_SPINLOCK(clock_lock);
diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c
index a77838f539f8..2edde32c764b 100644
--- a/arch/sh/kernel/time.c
+++ b/arch/sh/kernel/time.c
@@ -22,9 +22,6 @@
22#include <linux/rtc.h> 22#include <linux/rtc.h>
23#include <asm/clock.h> 23#include <asm/clock.h>
24#include <asm/rtc.h> 24#include <asm/rtc.h>
25#include <asm/timer.h>
26
27struct sys_timer *sys_timer;
28 25
29/* Dummy RTC ops */ 26/* Dummy RTC ops */
30static void null_rtc_get_time(struct timespec *tv) 27static void null_rtc_get_time(struct timespec *tv)
@@ -94,20 +91,9 @@ module_init(rtc_generic_init);
94 91
95void (*board_time_init)(void); 92void (*board_time_init)(void);
96 93
97struct clocksource clocksource_sh = {
98 .name = "SuperH",
99};
100
101unsigned long long sched_clock(void) 94unsigned long long sched_clock(void)
102{ 95{
103 unsigned long long cycles; 96 return (jiffies_64 - INITIAL_JIFFIES) * (NSEC_PER_SEC / HZ);
104
105 /* jiffies based sched_clock if no clocksource is installed */
106 if (!clocksource_sh.rating)
107 return (jiffies_64 - INITIAL_JIFFIES) * (NSEC_PER_SEC / HZ);
108
109 cycles = clocksource_sh.read(&clocksource_sh);
110 return cyc2ns(&clocksource_sh, cycles);
111} 97}
112 98
113static void __init sh_late_time_init(void) 99static void __init sh_late_time_init(void)
@@ -117,18 +103,7 @@ static void __init sh_late_time_init(void)
117 * Run probe() for one "earlytimer" device. 103 * Run probe() for one "earlytimer" device.
118 */ 104 */
119 early_platform_driver_register_all("earlytimer"); 105 early_platform_driver_register_all("earlytimer");
120 if (early_platform_driver_probe("earlytimer", 1, 0)) 106 early_platform_driver_probe("earlytimer", 1, 0);
121 return;
122
123 /*
124 * Find the timer to use as the system timer, it will be
125 * initialized for us.
126 */
127 sys_timer = get_sys_timer();
128 if (unlikely(!sys_timer))
129 panic("System timer missing.\n");
130
131 printk(KERN_INFO "Using %s for system timer\n", sys_timer->name);
132} 107}
133 108
134void __init time_init(void) 109void __init time_init(void)
diff --git a/arch/sh/kernel/timers/Makefile b/arch/sh/kernel/timers/Makefile
deleted file mode 100644
index fefd7edd413d..000000000000
--- a/arch/sh/kernel/timers/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for the various Linux/SuperH timers
3#
4
5obj-y := timer.o
diff --git a/arch/sh/kernel/timers/timer.c b/arch/sh/kernel/timers/timer.c
deleted file mode 100644
index f8812bd3b797..000000000000
--- a/arch/sh/kernel/timers/timer.c
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * arch/sh/kernel/timers/timer.c - Common timer code
3 *
4 * Copyright (C) 2005 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/timer.h>
13#include <linux/string.h>
14#include <asm/timer.h>
15
16static struct sys_timer *sys_timers[] = {
17 NULL,
18};
19
20static char timer_override[10];
21static int __init timer_setup(char *str)
22{
23 if (str)
24 strlcpy(timer_override, str, sizeof(timer_override));
25 return 1;
26}
27__setup("timer=", timer_setup);
28
29struct sys_timer *get_sys_timer(void)
30{
31 int i;
32
33 for (i = 0; i < ARRAY_SIZE(sys_timers); i++) {
34 struct sys_timer *t = sys_timers[i];
35
36 if (unlikely(!t))
37 break;
38 if (unlikely(timer_override[0]))
39 if ((strcmp(timer_override, t->name) != 0))
40 continue;
41 if (likely(t->ops->init() == 0))
42 return t;
43 }
44
45 return NULL;
46}