aboutsummaryrefslogtreecommitdiffstats
path: root/arch/h8300
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@csr.com>2008-10-20 11:07:19 -0400
committerDavid Vrabel <david.vrabel@csr.com>2008-10-20 11:07:19 -0400
commit61e0e79ee3c609eb34edf2fe023708cba6a79b1f (patch)
tree663deacffd4071120dc9badb70428fe5f124c7b9 /arch/h8300
parentc15895ef30c2c03e99802951787183039a349d32 (diff)
parent0cfd81031a26717fe14380d18275f8e217571615 (diff)
Merge branch 'master' into for-upstream
Conflicts: Documentation/ABI/testing/sysfs-bus-usb drivers/Makefile
Diffstat (limited to 'arch/h8300')
-rw-r--r--arch/h8300/Kconfig7
-rw-r--r--arch/h8300/Kconfig.cpu115
-rw-r--r--arch/h8300/include/asm/a.out.h20
-rw-r--r--arch/h8300/include/asm/bug.h4
-rw-r--r--arch/h8300/include/asm/elf.h2
-rw-r--r--arch/h8300/include/asm/io.h34
-rw-r--r--arch/h8300/include/asm/md.h2
-rw-r--r--arch/h8300/include/asm/system.h2
-rw-r--r--arch/h8300/kernel/Makefile2
-rw-r--r--arch/h8300/kernel/module.c3
-rw-r--r--arch/h8300/kernel/process.c1
-rw-r--r--arch/h8300/kernel/time.c29
-rw-r--r--arch/h8300/kernel/timer/Makefile6
-rw-r--r--arch/h8300/kernel/timer/itu.c83
-rw-r--r--arch/h8300/kernel/timer/timer16.c78
-rw-r--r--arch/h8300/kernel/timer/timer8.c103
-rw-r--r--arch/h8300/kernel/timer/tpu.c102
-rw-r--r--arch/h8300/kernel/traps.c17
-rw-r--r--arch/h8300/mm/fault.c5
-rw-r--r--arch/h8300/platform/h8300h/aki3068net/Makefile1
-rw-r--r--arch/h8300/platform/h8300h/aki3068net/timer.c51
-rw-r--r--arch/h8300/platform/h8300h/generic/Makefile1
-rw-r--r--arch/h8300/platform/h8300h/generic/timer.c95
-rw-r--r--arch/h8300/platform/h8300h/h8max/Makefile1
-rw-r--r--arch/h8300/platform/h8300h/h8max/timer.c52
-rw-r--r--arch/h8300/platform/h8s/edosk2674/Makefile1
-rw-r--r--arch/h8300/platform/h8s/edosk2674/timer.c54
-rw-r--r--arch/h8300/platform/h8s/generic/Makefile1
-rw-r--r--arch/h8300/platform/h8s/generic/timer.c53
29 files changed, 496 insertions, 429 deletions
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 2b413325e885..7789c3d82d3c 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -62,13 +62,14 @@ config GENERIC_TIME
62 bool 62 bool
63 default y 63 default y
64 64
65config GENERIC_BUG
66 bool
67 depends on BUG
68
65config TIME_LOW_RES 69config TIME_LOW_RES
66 bool 70 bool
67 default y 71 default y
68 72
69config ARCH_SUPPORTS_AOUT
70 def_bool y
71
72config NO_IOPORT 73config NO_IOPORT
73 def_bool y 74 def_bool y
74 75
diff --git a/arch/h8300/Kconfig.cpu b/arch/h8300/Kconfig.cpu
index 582797db9603..b65dcfe51d9c 100644
--- a/arch/h8300/Kconfig.cpu
+++ b/arch/h8300/Kconfig.cpu
@@ -1,5 +1,7 @@
1menu "Processor type and features" 1menu "Processor type and features"
2 2
3source "kernel/time/Kconfig"
4
3choice 5choice
4 prompt "H8/300 platform" 6 prompt "H8/300 platform"
5 default H8300H_GENERIC 7 default H8300H_GENERIC
@@ -11,6 +13,7 @@ config H8300H_GENERIC
11 13
12config H8300H_AKI3068NET 14config H8300H_AKI3068NET
13 bool "AE-3068/69" 15 bool "AE-3068/69"
16 select CONFIG_H83068
14 help 17 help
15 AKI-H8/3068F / AKI-H8/3069F Flashmicom LAN Board Support 18 AKI-H8/3068F / AKI-H8/3069F Flashmicom LAN Board Support
16 More Information. (Japanese Only) 19 More Information. (Japanese Only)
@@ -21,6 +24,7 @@ config H8300H_AKI3068NET
21 24
22config H8300H_H8MAX 25config H8300H_H8MAX
23 bool "H8MAX" 26 bool "H8MAX"
27 select CONFIG_H83068
24 help 28 help
25 H8MAX Evaluation Board Support 29 H8MAX Evaluation Board Support
26 More Information. (Japanese Only) 30 More Information. (Japanese Only)
@@ -28,6 +32,7 @@ config H8300H_H8MAX
28 32
29config H8300H_SIM 33config H8300H_SIM
30 bool "H8/300H Simulator" 34 bool "H8/300H Simulator"
35 select CONFIG_H83007
31 help 36 help
32 GDB Simulator Support 37 GDB Simulator Support
33 More Information. 38 More Information.
@@ -40,6 +45,7 @@ config H8S_GENERIC
40 45
41config H8S_EDOSK2674 46config H8S_EDOSK2674
42 bool "EDOSK-2674" 47 bool "EDOSK-2674"
48 select CONFIG_H8S2768
43 help 49 help
44 Renesas EDOSK-2674 Evaluation Board Support 50 Renesas EDOSK-2674 Evaluation Board Support
45 More Information. 51 More Information.
@@ -55,44 +61,37 @@ config H8S_SIM
55 61
56endchoice 62endchoice
57 63
58if (H8300H_GENERIC || H8S_GENERIC)
59menu "Detail Selection"
60if (H8300H_GENERIC)
61choice 64choice
62 prompt "CPU Selection" 65 prompt "CPU Selection"
63 66
64config H83002 67config H83002
65 bool "H8/3001,3002,3003" 68 bool "H8/3001,3002,3003"
69 select CPU_H8300H
66 70
67config H83007 71config H83007
68 bool "H8/3006,3007" 72 bool "H8/3006,3007"
73 select CPU_H8300H
69 74
70config H83048 75config H83048
71 bool "H8/3044,3045,3046,3047,3048,3052" 76 bool "H8/3044,3045,3046,3047,3048,3052"
77 select CPU_H8300H
72 78
73config H83068 79config H83068
74 bool "H8/3065,3066,3067,3068,3069" 80 bool "H8/3065,3066,3067,3068,3069"
75endchoice 81 select CPU_H8300H
76endif
77
78if (H8S_GENERIC)
79choice
80 prompt "CPU Selection"
81 82
82config H8S2678 83config H8S2678
83 bool "H8S/2670,2673,2674R,2675,2676" 84 bool "H8S/2670,2673,2674R,2675,2676"
85 select CPU_H8S
86
84endchoice 87endchoice
85endif
86 88
87config CPU_CLOCK 89config CPU_CLOCK
88 int "CPU Clock Frequency (/1KHz)" 90 int "CPU Clock Frequency (/1KHz)"
89 default "20000" 91 default "20000"
90 help 92 help
91 CPU Clock Frequency divide to 1000 93 CPU Clock Frequency divide to 1000
92endmenu
93endif
94 94
95if (H8300H_GENERIC || H8S_GENERIC || H8300H_SIM || H8S_SIM || H8S_EDOSK2674)
96choice 95choice
97 prompt "Kernel executes from" 96 prompt "Kernel executes from"
98 ---help--- 97 ---help---
@@ -107,75 +106,61 @@ config ROMKERNEL
107 bool "ROM" 106 bool "ROM"
108 help 107 help
109 The kernel will be resident in FLASH/ROM when running. 108 The kernel will be resident in FLASH/ROM when running.
110
111endchoice 109endchoice
112endif
113 110
114if (H8300H_AKI3068NET)
115config H83068
116 bool
117 default y
118 111
119config CPU_CLOCK 112config CPU_H8300H
120 int
121 default "20000"
122
123config RAMKERNEL
124 bool 113 bool
114 depends on (H83002 || H83007 || H83048 || H83068)
125 default y 115 default y
126endif
127 116
128if (H8300H_H8MAX) 117config CPU_H8S
129config H83068
130 bool 118 bool
119 depends on H8S2678
131 default y 120 default y
132 121
133config CPU_CLOCK 122choice
134 int 123 prompt "Timer"
135 default 25000 124config H8300_TIMER8
125 bool "8bit timer (2ch cascade)"
126 depends on (H83007 || H83068 || H8S2678)
136 127
137config RAMKERNEL 128config H8300_TIMER16
138 bool 129 bool "16bit timer"
139 default y 130 depends on (H83007 || H83068)
140endif
141 131
142if (H8300H_SIM) 132config H8300_ITU
143config H83007 133 bool "ITU"
144 bool 134 depends on (H83002 || H83048)
145 default y
146 135
147config CPU_CLOCK 136config H8300_TPU
148 int 137 bool "TPU"
149 default "16000" 138 depends on H8S2678
150endif 139endchoice
151 140
152if (H8S_EDOSK2674) 141if H8300_TIMER8
153config H8S2678 142choice
154 bool 143 prompt "Timer Channel"
155 default y 144config H8300_TIMER8_CH0
156config CPU_CLOCK 145 bool "Channel 0"
157 int 146config H8300_TIMER8_CH2
158 default 33000 147 bool "Channel 2"
148 depends on CPU_H8300H
149endchoice
159endif 150endif
160 151
161if (H8S_SIM) 152config H8300_TIMER16_CH
162config H8S2678 153 int "16bit timer channel (0 - 2)"
163 bool 154 depends on H8300_TIMER16
164 default y 155 range 0 2
165config CPU_CLOCK
166 int
167 default 33000
168endif
169 156
170config CPU_H8300H 157config H8300_ITU_CH
171 bool 158 int "ITU channel"
172 depends on (H83002 || H83007 || H83048 || H83068) 159 depends on H8300_ITU
173 default y
174 160
175config CPU_H8S 161config H8300_TPU_CH
176 bool 162 int "TPU channel"
177 depends on H8S2678 163 depends on H8300_TPU
178 default y
179 164
180config PREEMPT 165config PREEMPT
181 bool "Preemptible Kernel" 166 bool "Preemptible Kernel"
diff --git a/arch/h8300/include/asm/a.out.h b/arch/h8300/include/asm/a.out.h
deleted file mode 100644
index ded780f0a492..000000000000
--- a/arch/h8300/include/asm/a.out.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef __H8300_A_OUT_H__
2#define __H8300_A_OUT_H__
3
4struct exec
5{
6 unsigned long a_info; /* Use macros N_MAGIC, etc for access */
7 unsigned a_text; /* length of text, in bytes */
8 unsigned a_data; /* length of data, in bytes */
9 unsigned a_bss; /* length of uninitialized data area for file, in bytes */
10 unsigned a_syms; /* length of symbol table data in file, in bytes */
11 unsigned a_entry; /* start address */
12 unsigned a_trsize; /* length of relocation info for text, in bytes */
13 unsigned a_drsize; /* length of relocation info for data, in bytes */
14};
15
16#define N_TRSIZE(a) ((a).a_trsize)
17#define N_DRSIZE(a) ((a).a_drsize)
18#define N_SYMSIZE(a) ((a).a_syms)
19
20#endif /* __H8300_A_OUT_H__ */
diff --git a/arch/h8300/include/asm/bug.h b/arch/h8300/include/asm/bug.h
index edddf5b086e5..887c19773185 100644
--- a/arch/h8300/include/asm/bug.h
+++ b/arch/h8300/include/asm/bug.h
@@ -1,4 +1,8 @@
1#ifndef _H8300_BUG_H 1#ifndef _H8300_BUG_H
2#define _H8300_BUG_H 2#define _H8300_BUG_H
3
4/* always true */
5#define is_valid_bugaddr(addr) (1)
6
3#include <asm-generic/bug.h> 7#include <asm-generic/bug.h>
4#endif 8#endif
diff --git a/arch/h8300/include/asm/elf.h b/arch/h8300/include/asm/elf.h
index a8b57d1f4128..94e2284c8816 100644
--- a/arch/h8300/include/asm/elf.h
+++ b/arch/h8300/include/asm/elf.h
@@ -55,7 +55,7 @@ typedef unsigned long elf_fpregset_t;
55 55
56#define ELF_PLATFORM (NULL) 56#define ELF_PLATFORM (NULL)
57 57
58#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX) 58#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
59 59
60#define R_H8_NONE 0 60#define R_H8_NONE 0
61#define R_H8_DIR32 1 61#define R_H8_DIR32 1
diff --git a/arch/h8300/include/asm/io.h b/arch/h8300/include/asm/io.h
index 26dc6ccd9441..33e842f3284b 100644
--- a/arch/h8300/include/asm/io.h
+++ b/arch/h8300/include/asm/io.h
@@ -295,6 +295,40 @@ static __inline__ void ctrl_outl(unsigned long b, unsigned long addr)
295 *(volatile unsigned long*)addr = b; 295 *(volatile unsigned long*)addr = b;
296} 296}
297 297
298static __inline__ void ctrl_bclr(int b, unsigned long addr)
299{
300 if (__builtin_constant_p(b))
301 switch (b) {
302 case 0: __asm__("bclr #0,@%0"::"r"(addr)); break;
303 case 1: __asm__("bclr #1,@%0"::"r"(addr)); break;
304 case 2: __asm__("bclr #2,@%0"::"r"(addr)); break;
305 case 3: __asm__("bclr #3,@%0"::"r"(addr)); break;
306 case 4: __asm__("bclr #4,@%0"::"r"(addr)); break;
307 case 5: __asm__("bclr #5,@%0"::"r"(addr)); break;
308 case 6: __asm__("bclr #6,@%0"::"r"(addr)); break;
309 case 7: __asm__("bclr #7,@%0"::"r"(addr)); break;
310 }
311 else
312 __asm__("bclr %w0,@%1"::"r"(b), "r"(addr));
313}
314
315static __inline__ void ctrl_bset(int b, unsigned long addr)
316{
317 if (__builtin_constant_p(b))
318 switch (b) {
319 case 0: __asm__("bset #0,@%0"::"r"(addr)); break;
320 case 1: __asm__("bset #1,@%0"::"r"(addr)); break;
321 case 2: __asm__("bset #2,@%0"::"r"(addr)); break;
322 case 3: __asm__("bset #3,@%0"::"r"(addr)); break;
323 case 4: __asm__("bset #4,@%0"::"r"(addr)); break;
324 case 5: __asm__("bset #5,@%0"::"r"(addr)); break;
325 case 6: __asm__("bset #6,@%0"::"r"(addr)); break;
326 case 7: __asm__("bset #7,@%0"::"r"(addr)); break;
327 }
328 else
329 __asm__("bset %w0,@%1"::"r"(b), "r"(addr));
330}
331
298/* Pages to physical address... */ 332/* Pages to physical address... */
299#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT) 333#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
300#define page_to_bus(page) ((page - mem_map) << PAGE_SHIFT) 334#define page_to_bus(page) ((page - mem_map) << PAGE_SHIFT)
diff --git a/arch/h8300/include/asm/md.h b/arch/h8300/include/asm/md.h
index 1a47dc6691fb..1b7300e0a175 100644
--- a/arch/h8300/include/asm/md.h
+++ b/arch/h8300/include/asm/md.h
@@ -1,4 +1,4 @@
1/* $Id: md.h,v 1.1 2002/11/19 02:09:26 gerg Exp $ 1/*
2 * md.h: High speed xor_block operation for RAID4/5 2 * md.h: High speed xor_block operation for RAID4/5
3 * 3 *
4 */ 4 */
diff --git a/arch/h8300/include/asm/system.h b/arch/h8300/include/asm/system.h
index 4b8e475908ae..d98d97685f06 100644
--- a/arch/h8300/include/asm/system.h
+++ b/arch/h8300/include/asm/system.h
@@ -155,4 +155,6 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz
155 155
156#define arch_align_stack(x) (x) 156#define arch_align_stack(x) (x)
157 157
158void die(char *str, struct pt_regs *fp, unsigned long err);
159
158#endif /* _H8300_SYSTEM_H */ 160#endif /* _H8300_SYSTEM_H */
diff --git a/arch/h8300/kernel/Makefile b/arch/h8300/kernel/Makefile
index 6c248c3c5c3b..8d4d2a54be9e 100644
--- a/arch/h8300/kernel/Makefile
+++ b/arch/h8300/kernel/Makefile
@@ -7,6 +7,6 @@ extra-y := vmlinux.lds
7obj-y := process.o traps.o ptrace.o irq.o \ 7obj-y := process.o traps.o ptrace.o irq.o \
8 sys_h8300.o time.o signal.o \ 8 sys_h8300.o time.o signal.o \
9 setup.o gpio.o init_task.o syscalls.o \ 9 setup.o gpio.o init_task.o syscalls.o \
10 entry.o 10 entry.o timer/
11 11
12obj-$(CONFIG_MODULES) += module.o h8300_ksyms.o 12obj-$(CONFIG_MODULES) += module.o h8300_ksyms.o
diff --git a/arch/h8300/kernel/module.c b/arch/h8300/kernel/module.c
index 4fd7138a6e03..cfc9127d2ced 100644
--- a/arch/h8300/kernel/module.c
+++ b/arch/h8300/kernel/module.c
@@ -114,9 +114,10 @@ int module_finalize(const Elf_Ehdr *hdr,
114 const Elf_Shdr *sechdrs, 114 const Elf_Shdr *sechdrs,
115 struct module *me) 115 struct module *me)
116{ 116{
117 return 0; 117 return module_bug_finalize(hdr, sechdrs, me);
118} 118}
119 119
120void module_arch_cleanup(struct module *mod) 120void module_arch_cleanup(struct module *mod)
121{ 121{
122 module_bug_cleanup(mod);
122} 123}
diff --git a/arch/h8300/kernel/process.c b/arch/h8300/kernel/process.c
index dfbe7ab9ffe2..a8ef654a5a0b 100644
--- a/arch/h8300/kernel/process.c
+++ b/arch/h8300/kernel/process.c
@@ -34,7 +34,6 @@
34#include <linux/ptrace.h> 34#include <linux/ptrace.h>
35#include <linux/slab.h> 35#include <linux/slab.h>
36#include <linux/user.h> 36#include <linux/user.h>
37#include <linux/a.out.h>
38#include <linux/interrupt.h> 37#include <linux/interrupt.h>
39#include <linux/reboot.h> 38#include <linux/reboot.h>
40#include <linux/fs.h> 39#include <linux/fs.h>
diff --git a/arch/h8300/kernel/time.c b/arch/h8300/kernel/time.c
index e37c835e67cf..7f2d6cfbb4b6 100644
--- a/arch/h8300/kernel/time.c
+++ b/arch/h8300/kernel/time.c
@@ -27,27 +27,21 @@
27#include <linux/profile.h> 27#include <linux/profile.h>
28 28
29#include <asm/io.h> 29#include <asm/io.h>
30#include <asm/target_time.h> 30#include <asm/timer.h>
31 31
32#define TICK_SIZE (tick_nsec / 1000) 32#define TICK_SIZE (tick_nsec / 1000)
33 33
34/* 34void h8300_timer_tick(void)
35 * timer_interrupt() needs to keep up the real-time clock,
36 * as well as call the "do_timer()" routine every clocktick
37 */
38static void timer_interrupt(int irq, void *dummy, struct pt_regs * regs)
39{ 35{
40 /* may need to kick the hardware timer */ 36 if (current->pid)
41 platform_timer_eoi(); 37 profile_tick(CPU_PROFILING);
42 38 write_seqlock(&xtime_lock);
43 do_timer(1); 39 do_timer(1);
44#ifndef CONFIG_SMP 40 write_sequnlock(&xtime_lock);
45 update_process_times(user_mode(regs)); 41 update_process_times(user_mode(get_irq_regs()));
46#endif
47 profile_tick(CPU_PROFILING);
48} 42}
49 43
50void time_init(void) 44void __init time_init(void)
51{ 45{
52 unsigned int year, mon, day, hour, min, sec; 46 unsigned int year, mon, day, hour, min, sec;
53 47
@@ -57,12 +51,13 @@ void time_init(void)
57 year = 1980; 51 year = 1980;
58 mon = day = 1; 52 mon = day = 1;
59 hour = min = sec = 0; 53 hour = min = sec = 0;
60 platform_gettod (&year, &mon, &day, &hour, &min, &sec); 54#ifdef CONFIG_H8300_GETTOD
61 55 h8300_gettod (&year, &mon, &day, &hour, &min, &sec);
56#endif
62 if ((year += 1900) < 1970) 57 if ((year += 1900) < 1970)
63 year += 100; 58 year += 100;
64 xtime.tv_sec = mktime(year, mon, day, hour, min, sec); 59 xtime.tv_sec = mktime(year, mon, day, hour, min, sec);
65 xtime.tv_nsec = 0; 60 xtime.tv_nsec = 0;
66 61
67 platform_timer_setup(timer_interrupt); 62 h8300_timer_setup();
68} 63}
diff --git a/arch/h8300/kernel/timer/Makefile b/arch/h8300/kernel/timer/Makefile
new file mode 100644
index 000000000000..bef0510ea6ad
--- /dev/null
+++ b/arch/h8300/kernel/timer/Makefile
@@ -0,0 +1,6 @@
1# h8300 internal timer handler
2
3obj-$(CONFIG_H8300_TIMER8) := timer8.o
4obj-$(CONFIG_H8300_TIMER16) := timer16.o
5obj-$(CONFIG_H8300_ITU) := itu.o
6obj-$(CONFIG_H8300_TPU) := tpu.o
diff --git a/arch/h8300/kernel/timer/itu.c b/arch/h8300/kernel/timer/itu.c
new file mode 100644
index 000000000000..d1c926596b08
--- /dev/null
+++ b/arch/h8300/kernel/timer/itu.c
@@ -0,0 +1,83 @@
1/*
2 * linux/arch/h8300/kernel/timer/itu.c
3 *
4 * Yoshinori Sato <ysato@users.sourcefoge.jp>
5 *
6 * ITU Timer Handler
7 *
8 */
9
10#include <linux/errno.h>
11#include <linux/sched.h>
12#include <linux/kernel.h>
13#include <linux/param.h>
14#include <linux/string.h>
15#include <linux/mm.h>
16#include <linux/interrupt.h>
17#include <linux/init.h>
18#include <linux/timex.h>
19
20#include <asm/segment.h>
21#include <asm/io.h>
22#include <asm/irq.h>
23#include <asm/regs306x.h>
24
25#if CONFIG_H8300_ITU_CH == 0
26#define ITUBASE 0xffff64
27#define ITUIRQ 24
28#elif CONFIG_H8300_ITU_CH == 1
29#define ITUBASE 0xffff6e
30#define ITUIRQ 28
31#elif CONFIG_H8300_ITU_CH == 2
32#define ITUBASE 0xffff78
33#define ITUIRQ 32
34#elif CONFIG_H8300_ITU_CH == 3
35#define ITUBASE 0xffff82
36#define ITUIRQ 36
37#elif CONFIG_H8300_ITU_CH == 4
38#define ITUBASE 0xffff92
39#define ITUIRQ 40
40#else
41#error Unknown timer channel.
42#endif
43
44#define TCR 0
45#define TIOR 1
46#define TIER 2
47#define TSR 3
48#define TCNT 4
49#define GRA 6
50#define GRB 8
51
52static irqreturn_t timer_interrupt(int irq, void *dev_id)
53{
54 h8300_timer_tick();
55 ctrl_bclr(IMFA, ITUBASE + TSR);
56 return IRQ_HANDLED;
57}
58
59static struct irqaction itu_irq = {
60 .name = "itu",
61 .handler = timer_interrupt,
62 .flags = IRQF_DISABLED | IRQF_TIMER,
63 .mask = CPU_MASK_NONE,
64};
65
66static const int __initdata divide_rate[] = {1, 2, 4, 8};
67
68void __init h8300_timer_setup(void)
69{
70 unsigned int div;
71 unsigned int cnt;
72
73 calc_param(cnt, div, divide_rate, 0x10000);
74
75 setup_irq(ITUIRQ, &itu_irq);
76
77 /* initalize timer */
78 ctrl_outb(0, TSTR);
79 ctrl_outb(CCLR0 | div, ITUBASE + TCR);
80 ctrl_outb(0x01, ITUBASE + TIER);
81 ctrl_outw(cnt, ITUBASE + GRA);
82 ctrl_bset(CONFIG_H8300_ITU_CH, TSTR);
83}
diff --git a/arch/h8300/kernel/timer/timer16.c b/arch/h8300/kernel/timer/timer16.c
new file mode 100644
index 000000000000..e14271b72119
--- /dev/null
+++ b/arch/h8300/kernel/timer/timer16.c
@@ -0,0 +1,78 @@
1/*
2 * linux/arch/h8300/kernel/timer/timer16.c
3 *
4 * Yoshinori Sato <ysato@users.sourcefoge.jp>
5 *
6 * 16bit Timer Handler
7 *
8 */
9
10#include <linux/errno.h>
11#include <linux/sched.h>
12#include <linux/kernel.h>
13#include <linux/param.h>
14#include <linux/string.h>
15#include <linux/mm.h>
16#include <linux/interrupt.h>
17#include <linux/init.h>
18#include <linux/timex.h>
19
20#include <asm/segment.h>
21#include <asm/io.h>
22#include <asm/irq.h>
23#include <asm/regs306x.h>
24
25/* 16bit timer */
26#if CONFIG_H8300_TIMER16_CH == 0
27#define _16BASE 0xffff78
28#define _16IRQ 24
29#elif CONFIG_H8300_TIMER16_CH == 1
30#define _16BASE 0xffff80
31#define _16IRQ 28
32#elif CONFIG_H8300_TIMER16_CH == 2
33#define _16BASE 0xffff88
34#define _16IRQ 32
35#else
36#error Unknown timer channel.
37#endif
38
39#define TCR 0
40#define TIOR 1
41#define TCNT 2
42#define GRA 4
43#define GRB 6
44
45#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*10000 /* Timer input freq. */
46
47static irqreturn_t timer_interrupt(int irq, void *dev_id)
48{
49 h8300_timer_tick();
50 ctrl_bclr(CONFIG_H8300_TIMER16_CH, TISRA);
51 return IRQ_HANDLED;
52}
53
54static struct irqaction timer16_irq = {
55 .name = "timer-16",
56 .handler = timer_interrupt,
57 .flags = IRQF_DISABLED | IRQF_TIMER,
58 .mask = CPU_MASK_NONE,
59};
60
61static const int __initdata divide_rate[] = {1, 2, 4, 8};
62
63void __init h8300_timer_setup(void)
64{
65 unsigned int div;
66 unsigned int cnt;
67
68 calc_param(cnt, div, divide_rate, 0x10000);
69
70 setup_irq(_16IRQ, &timer16_irq);
71
72 /* initalize timer */
73 ctrl_outb(0, TSTR);
74 ctrl_outb(CCLR0 | div, _16BASE + TCR);
75 ctrl_outw(cnt, _16BASE + GRA);
76 ctrl_bset(4 + CONFIG_H8300_TIMER16_CH, TISRA);
77 ctrl_bset(CONFIG_H8300_TIMER16_CH, TSTR);
78}
diff --git a/arch/h8300/kernel/timer/timer8.c b/arch/h8300/kernel/timer/timer8.c
new file mode 100644
index 000000000000..0556d7c7bea6
--- /dev/null
+++ b/arch/h8300/kernel/timer/timer8.c
@@ -0,0 +1,103 @@
1/*
2 * linux/arch/h8300/kernel/cpu/timer/timer8.c
3 *
4 * Yoshinori Sato <ysato@users.sourcefoge.jp>
5 *
6 * 8bit Timer Handler
7 *
8 */
9
10#include <linux/errno.h>
11#include <linux/sched.h>
12#include <linux/kernel.h>
13#include <linux/param.h>
14#include <linux/string.h>
15#include <linux/mm.h>
16#include <linux/interrupt.h>
17#include <linux/init.h>
18#include <linux/profile.h>
19
20#include <asm/io.h>
21#include <asm/irq.h>
22#include <asm/timer.h>
23#if defined(CONFIG_CPU_H8300H)
24#include <asm/regs306x.h>
25#endif
26#if defined(CONFIG_CPU_H8S)
27#include <asm/regs267x.h>
28#endif
29
30/* 8bit timer x2 */
31#define CMFA 6
32
33#if defined(CONFIG_H8300_TIMER8_CH0)
34#define _8BASE _8TCR0
35#ifdef CONFIG_CPU_H8300H
36#define _8IRQ 36
37#endif
38#ifdef CONFIG_CPU_H8S
39#define _8IRQ 72
40#endif
41#elif defined(CONFIG_H8300_TIMER8_CH2)
42#ifdef CONFIG_CPU_H8300H
43#define _8BASE _8TCR2
44#define _8IRQ 40
45#endif
46#endif
47
48#ifndef _8BASE
49#error Unknown timer channel.
50#endif
51
52#define _8TCR 0
53#define _8TCSR 2
54#define TCORA 4
55#define TCORB 6
56#define _8TCNT 8
57
58#define CMIEA 0x40
59#define CCLR_CMA 0x08
60#define CKS2 0x04
61
62/*
63 * timer_interrupt() needs to keep up the real-time clock,
64 * as well as call the "do_timer()" routine every clocktick
65 */
66
67static irqreturn_t timer_interrupt(int irq, void *dev_id)
68{
69 h8300_timer_tick();
70 ctrl_bclr(CMFA, _8BASE + _8TCSR);
71 return IRQ_HANDLED;
72}
73
74static struct irqaction timer8_irq = {
75 .name = "timer-8",
76 .handler = timer_interrupt,
77 .flags = IRQF_DISABLED | IRQF_TIMER,
78 .mask = CPU_MASK_NONE,
79};
80
81static const int __initdata divide_rate[] = {8, 64, 8192};
82
83void __init h8300_timer_setup(void)
84{
85 unsigned int div;
86 unsigned int cnt;
87
88 calc_param(cnt, div, divide_rate, 0x10000);
89 div++;
90
91 setup_irq(_8IRQ, &timer8_irq);
92
93#if defined(CONFIG_CPU_H8S)
94 /* Timer module enable */
95 ctrl_bclr(0, MSTPCRL)
96#endif
97
98 /* initalize timer */
99 ctrl_outw(cnt, _8BASE + TCORA);
100 ctrl_outw(0x0000, _8BASE + _8TCSR);
101 ctrl_outw((CMIEA|CCLR_CMA|CKS2) << 8 | div,
102 _8BASE + _8TCR);
103}
diff --git a/arch/h8300/kernel/timer/tpu.c b/arch/h8300/kernel/timer/tpu.c
new file mode 100644
index 000000000000..df7f453a9673
--- /dev/null
+++ b/arch/h8300/kernel/timer/tpu.c
@@ -0,0 +1,102 @@
1/*
2 * linux/arch/h8300/kernel/timer/tpu.c
3 *
4 * Yoshinori Sato <ysato@users.sourceforge.jp>
5 *
6 * TPU Timer Handler
7 *
8 */
9
10#include <linux/config.h>
11#include <linux/errno.h>
12#include <linux/sched.h>
13#include <linux/kernel.h>
14#include <linux/param.h>
15#include <linux/string.h>
16#include <linux/mm.h>
17#include <linux/interrupt.h>
18#include <linux/init.h>
19#include <linux/timex.h>
20
21#include <asm/segment.h>
22#include <asm/io.h>
23#include <asm/irq.h>
24#include <asm/regs267x.h>
25
26/* TPU */
27#if CONFIG_H8300_TPU_CH == 0
28#define TPUBASE 0xffffd0
29#define TPUIRQ 40
30#elif CONFIG_H8300_TPU_CH == 1
31#define TPUBASE 0xffffe0
32#define TPUIRQ 48
33#elif CONFIG_H8300_TPU_CH == 2
34#define TPUBASE 0xfffff0
35#define TPUIRQ 52
36#elif CONFIG_H8300_TPU_CH == 3
37#define TPUBASE 0xfffe80
38#define TPUIRQ 56
39#elif CONFIG_H8300_TPU_CH == 4
40#define TPUBASE 0xfffe90
41#define TPUIRQ 64
42#else
43#error Unknown timer channel.
44#endif
45
46#define _TCR 0
47#define _TMDR 1
48#define _TIOR 2
49#define _TIER 4
50#define _TSR 5
51#define _TCNT 6
52#define _GRA 8
53#define _GRB 10
54
55#define CCLR0 0x20
56
57static irqreturn_t timer_interrupt(int irq, void *dev_id)
58{
59 h8300_timer_tick();
60 ctrl_bclr(0, TPUBASE + _TSR);
61 return IRQ_HANDLED;
62}
63
64static struct irqaction tpu_irq = {
65 .name = "tpu",
66 .handler = timer_interrupt,
67 .flags = IRQF_DISABLED | IRQF_TIMER,
68 .mask = CPU_MASK_NONE,
69};
70
71const static int __initdata divide_rate[] = {
72#if CONFIG_H8300_TPU_CH == 0
73 1,4,16,64,0,0,0,0,
74#elif (CONFIG_H8300_TPU_CH == 1) || (CONFIG_H8300_TPU_CH == 5)
75 1,4,16,64,0,0,256,0,
76#elif (CONFIG_H8300_TPU_CH == 2) || (CONFIG_H8300_TPU_CH == 4)
77 1,4,16,64,0,0,0,1024,
78#elif CONFIG_H8300_TPU_CH == 3
79 1,4,16,64,0,1024,256,4096,
80#endif
81};
82
83void __init h8300_timer_setup(void)
84{
85 unsigned int cnt;
86 unsigned int div;
87
88 calc_param(cnt, div, divide_rate, 0x10000);
89
90 setup_irq(TPUIRQ, &tpu_irq);
91
92 /* TPU module enabled */
93 ctrl_bclr(3, MSTPCRH);
94
95 ctrl_outb(0, TSTR);
96 ctrl_outb(CCLR0 | div, TPUBASE + _TCR);
97 ctrl_outb(0, TPUBASE + _TMDR);
98 ctrl_outw(0, TPUBASE + _TIOR);
99 ctrl_outb(0x01, TPUBASE + _TIER);
100 ctrl_outw(cnt, TPUBASE + _GRA);
101 ctrl_bset(CONFIG_H8300_TPU_CH, TSTR);
102}
diff --git a/arch/h8300/kernel/traps.c b/arch/h8300/kernel/traps.c
index f8f7d7ea97f1..3c0b66bc669e 100644
--- a/arch/h8300/kernel/traps.c
+++ b/arch/h8300/kernel/traps.c
@@ -20,12 +20,14 @@
20#include <linux/errno.h> 20#include <linux/errno.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/bug.h>
23 24
24#include <asm/system.h> 25#include <asm/system.h>
25#include <asm/irq.h> 26#include <asm/irq.h>
26#include <asm/traps.h> 27#include <asm/traps.h>
27#include <asm/page.h> 28#include <asm/page.h>
28#include <asm/gpio.h> 29
30static DEFINE_SPINLOCK(die_lock);
29 31
30/* 32/*
31 * this must be called very early as the kernel might 33 * this must be called very early as the kernel might
@@ -94,16 +96,19 @@ static void dump(struct pt_regs *fp)
94 printk("\n\n"); 96 printk("\n\n");
95} 97}
96 98
97void die_if_kernel (char *str, struct pt_regs *fp, int nr) 99void die(char *str, struct pt_regs *fp, unsigned long err)
98{ 100{
99 extern int console_loglevel; 101 static int diecount;
100 102
101 if (!(fp->ccr & PS_S)) 103 oops_enter();
102 return;
103 104
104 console_loglevel = 15; 105 console_verbose();
106 spin_lock_irq(&die_lock);
107 report_bug(fp->pc, fp);
108 printk(KERN_EMERG "%s: %04lx [#%d] ", str, err & 0xffff, ++diecount);
105 dump(fp); 109 dump(fp);
106 110
111 spin_unlock_irq(&die_lock);
107 do_exit(SIGSEGV); 112 do_exit(SIGSEGV);
108} 113}
109 114
diff --git a/arch/h8300/mm/fault.c b/arch/h8300/mm/fault.c
index 29e9af9f0e6a..1d092abebf03 100644
--- a/arch/h8300/mm/fault.c
+++ b/arch/h8300/mm/fault.c
@@ -20,8 +20,6 @@
20#include <asm/system.h> 20#include <asm/system.h>
21#include <asm/pgtable.h> 21#include <asm/pgtable.h>
22 22
23extern void die_if_kernel(char *, struct pt_regs *, long);
24
25/* 23/*
26 * This routine handles page faults. It determines the problem, and 24 * This routine handles page faults. It determines the problem, and
27 * then passes it off to one of the appropriate routines. 25 * then passes it off to one of the appropriate routines.
@@ -50,7 +48,8 @@ asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
50 } else 48 } else
51 printk(KERN_ALERT "Unable to handle kernel access"); 49 printk(KERN_ALERT "Unable to handle kernel access");
52 printk(" at virtual address %08lx\n",address); 50 printk(" at virtual address %08lx\n",address);
53 die_if_kernel("Oops", regs, error_code); 51 if (!user_mode(regs))
52 die("Oops", regs, error_code);
54 do_exit(SIGKILL); 53 do_exit(SIGKILL);
55 54
56 return 1; 55 return 1;
diff --git a/arch/h8300/platform/h8300h/aki3068net/Makefile b/arch/h8300/platform/h8300h/aki3068net/Makefile
index b03c328f8c70..b7ff78050b7f 100644
--- a/arch/h8300/platform/h8300h/aki3068net/Makefile
+++ b/arch/h8300/platform/h8300h/aki3068net/Makefile
@@ -3,4 +3,3 @@
3# 3#
4 4
5extra-y := crt0_ram.o 5extra-y := crt0_ram.o
6obj-y := timer.o
diff --git a/arch/h8300/platform/h8300h/aki3068net/timer.c b/arch/h8300/platform/h8300h/aki3068net/timer.c
deleted file mode 100644
index 27cd85d56128..000000000000
--- a/arch/h8300/platform/h8300h/aki3068net/timer.c
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 * linux/arch/h8300/platform/h8300h/aki3068net/timer.c
3 *
4 * Yoshinori Sato <ysato@users.sourcefoge.jp>
5 *
6 * Platform depend Timer Handler
7 *
8 */
9
10#include <linux/errno.h>
11#include <linux/sched.h>
12#include <linux/kernel.h>
13#include <linux/param.h>
14#include <linux/string.h>
15#include <linux/mm.h>
16#include <linux/interrupt.h>
17#include <linux/init.h>
18#include <linux/timex.h>
19
20#include <asm/segment.h>
21#include <asm/io.h>
22#include <asm/irq.h>
23#include <asm/regs306x.h>
24
25#define CMFA 6
26
27#define CMIEA 0x40
28#define CCLR_CMA 0x08
29#define CLK_DIV8192 0x03
30
31#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192 /* Timer input freq. */
32
33void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
34{
35 /* setup 8bit timer ch2 */
36 ctrl_outb(H8300_TIMER_FREQ / HZ, TCORA2); /* set interval */
37 ctrl_outb(0x00, _8TCSR2); /* no output */
38 request_irq(40, timer_int, 0, "timer", 0);
39 ctrl_outb(CMIEA|CCLR_CMA|CLK_DIV8192, _8TCR2); /* start count */
40}
41
42void platform_timer_eoi(void)
43{
44 *(volatile unsigned char *)_8TCSR2 &= ~(1 << CMFA);
45}
46
47void platform_gettod(int *year, int *mon, int *day, int *hour,
48 int *min, int *sec)
49{
50 *year = *mon = *day = *hour = *min = *sec = 0;
51}
diff --git a/arch/h8300/platform/h8300h/generic/Makefile b/arch/h8300/platform/h8300h/generic/Makefile
index 32b964a9010e..2b12a170209e 100644
--- a/arch/h8300/platform/h8300h/generic/Makefile
+++ b/arch/h8300/platform/h8300h/generic/Makefile
@@ -3,4 +3,3 @@
3# 3#
4 4
5extra-y := crt0_$(MODEL).o 5extra-y := crt0_$(MODEL).o
6obj-y := timer.o
diff --git a/arch/h8300/platform/h8300h/generic/timer.c b/arch/h8300/platform/h8300h/generic/timer.c
deleted file mode 100644
index 6f5cefe0cceb..000000000000
--- a/arch/h8300/platform/h8300h/generic/timer.c
+++ /dev/null
@@ -1,95 +0,0 @@
1/*
2 * linux/arch/h8300/platform/h8300h/generic/timer.c
3 *
4 * Yoshinori Sato <ysato@users.sourceforge.jp>
5 *
6 * Platform depend Timer Handler
7 *
8 */
9
10#include <linux/errno.h>
11#include <linux/sched.h>
12#include <linux/kernel.h>
13#include <linux/param.h>
14#include <linux/string.h>
15#include <linux/mm.h>
16#include <linux/interrupt.h>
17
18#include <asm/segment.h>
19#include <asm/io.h>
20#include <asm/irq.h>
21
22#include <linux/timex.h>
23
24#if defined(CONFIG_H83007) || defined(CONFIG_H83068)
25#include <asm/regs306x.h>
26#define CMFA 6
27
28#define CMIEA 0x40
29#define CCLR_CMA 0x08
30#define CLK_DIV8192 0x03
31
32#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192 /* Timer input freq. */
33
34void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
35{
36 /* setup 8bit timer ch2 */
37 ctrl_outb(H8300_TIMER_FREQ / HZ, TCORA2); /* set interval */
38 ctrl_outb(0x00, _8TCSR2); /* no output */
39 request_irq(40, timer_int, 0, "timer", 0);
40 ctrl_outb(CMIEA|CCLR_CMA|CLK_DIV8192, _8TCR2); /* start count */
41}
42
43void platform_timer_eoi(void)
44{
45 *(volatile unsigned char *)_8TCSR2 &= ~(1 << CMFA);
46}
47#endif
48
49#if defined(CONFIG_H83002) || defined(CONFIG_H83048)
50/* FIXME! */
51#define TSTR 0x00ffff60
52#define TSNC 0x00ffff61
53#define TMDR 0x00ffff62
54#define TFCR 0x00ffff63
55#define TOER 0x00ffff90
56#define TOCR 0x00ffff91
57/* ITU0 */
58#define TCR 0x00ffff64
59#define TIOR 0x00ffff65
60#define TIER 0x00ffff66
61#define TSR 0x00ffff67
62#define TCNT 0x00ffff68
63#define GRA 0x00ffff6a
64#define GRB 0x00ffff6c
65
66#define CCLR_CMGRA 0x20
67#define CLK_DIV8 0x03
68
69#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8 /* Timer input freq. */
70
71void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
72{
73 *(unsigned short *)GRA= H8300_TIMER_FREQ / HZ; /* set interval */
74 *(unsigned short *)TCNT=0; /* clear counter */
75 ctrl_outb(0x80|CCLR_CMGRA|CLK_DIV8, TCR); /* set ITU0 clock */
76 ctrl_outb(0x88, TIOR); /* no output */
77 request_irq(26, timer_int, 0, "timer", 0);
78 ctrl_outb(0xf9, TIER); /* compare match GRA interrupt */
79 ctrl_outb(ctrl_inb(TSNC) & ~0x01, TSNC); /* ITU0 async */
80 ctrl_outb(ctrl_inb(TMDR) & ~0x01, TMDR); /* ITU0 normal mode */
81 ctrl_outb(ctrl_inb(TSTR) | 0x01, TSTR); /* ITU0 Start */
82 return 0;
83}
84
85void platform_timer_eoi(void)
86{
87 ctrl_outb(ctrl_inb(TSR) & ~0x01,TSR);
88}
89#endif
90
91void platform_gettod(int *year, int *mon, int *day, int *hour,
92 int *min, int *sec)
93{
94 *year = *mon = *day = *hour = *min = *sec = 0;
95}
diff --git a/arch/h8300/platform/h8300h/h8max/Makefile b/arch/h8300/platform/h8300h/h8max/Makefile
index b03c328f8c70..b7ff78050b7f 100644
--- a/arch/h8300/platform/h8300h/h8max/Makefile
+++ b/arch/h8300/platform/h8300h/h8max/Makefile
@@ -3,4 +3,3 @@
3# 3#
4 4
5extra-y := crt0_ram.o 5extra-y := crt0_ram.o
6obj-y := timer.o
diff --git a/arch/h8300/platform/h8300h/h8max/timer.c b/arch/h8300/platform/h8300h/h8max/timer.c
deleted file mode 100644
index 85a574afe9d0..000000000000
--- a/arch/h8300/platform/h8300h/h8max/timer.c
+++ /dev/null
@@ -1,52 +0,0 @@
1/*
2 * linux/arch/h8300/platform/h8300h/h8max/timer.c
3 *
4 * Yoshinori Sato <ysato@users.sourcefoge.jp>
5 *
6 * Platform depend Timer Handler
7 *
8 */
9
10#include <linux/errno.h>
11#include <linux/sched.h>
12#include <linux/kernel.h>
13#include <linux/param.h>
14#include <linux/string.h>
15#include <linux/mm.h>
16#include <linux/interrupt.h>
17#include <linux/init.h>
18#include <linux/timex.h>
19
20#include <asm/segment.h>
21#include <asm/io.h>
22#include <asm/irq.h>
23#include <asm/regs306x.h>
24
25#define CMFA 6
26
27#define CMIEA 0x40
28#define CCLR_CMA 0x08
29#define CLK_DIV8192 0x03
30
31#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192 /* Timer input freq. */
32
33void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
34{
35 /* setup 8bit timer ch2 */
36 ctrl_outb(H8300_TIMER_FREQ / HZ, TCORA2); /* set interval */
37 ctrl_outb(0x00, _8TCSR2); /* no output */
38 request_irq(40, timer_int, 0, "timer", 0);
39 ctrl_outb(CMIEA|CCLR_CMA|CLK_DIV8192, _8TCR2); /* start count */
40}
41
42void platform_timer_eoi(void)
43{
44 *(volatile unsigned char *)_8TCSR2 &= ~(1 << CMFA);
45}
46
47void platform_gettod(int *year, int *mon, int *day, int *hour,
48 int *min, int *sec)
49{
50 *year = *mon = *day = *hour = *min = *sec = 0;
51}
52
diff --git a/arch/h8300/platform/h8s/edosk2674/Makefile b/arch/h8300/platform/h8s/edosk2674/Makefile
index f763654ac6fe..8e349723bb4f 100644
--- a/arch/h8300/platform/h8s/edosk2674/Makefile
+++ b/arch/h8300/platform/h8s/edosk2674/Makefile
@@ -3,4 +3,3 @@
3# 3#
4 4
5extra-y := crt0_$(MODEL).o 5extra-y := crt0_$(MODEL).o
6obj-y := timer.o
diff --git a/arch/h8300/platform/h8s/edosk2674/timer.c b/arch/h8300/platform/h8s/edosk2674/timer.c
deleted file mode 100644
index bfb1424482f4..000000000000
--- a/arch/h8300/platform/h8s/edosk2674/timer.c
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * linux/arch/h8300/platform/h8s/edosk2674/timer.c
3 *
4 * Yoshinori Sato <ysato@users.sourceforge.jp>
5 *
6 * Platform depend Timer Handler
7 *
8 */
9
10#include <linux/errno.h>
11#include <linux/sched.h>
12#include <linux/kernel.h>
13#include <linux/param.h>
14#include <linux/string.h>
15#include <linux/mm.h>
16#include <linux/interrupt.h>
17#include <linux/init.h>
18#include <linux/timex.h>
19
20#include <asm/segment.h>
21#include <asm/io.h>
22#include <asm/irq.h>
23#include <asm/regs267x.h>
24
25#define CMFA 6
26
27#define CMIEA 0x40
28#define CCLR_CMA 0x08
29#define CLK_DIV8192 0x03
30
31#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192 /* Timer input freq. */
32
33void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
34{
35 /* 8bit timer module enabled */
36 ctrl_outb(ctrl_inb(MSTPCRL) & ~0x01, MSTPCRL);
37 /* setup 8bit timer ch1 */
38 ctrl_outb(H8300_TIMER_FREQ / HZ, _8TCORA1); /* set interval */
39 ctrl_outb(0x00, _8TCSR1); /* no output */
40 request_irq(76, timer_int, 0, "timer" ,0);
41 ctrl_outb(CMIEA|CCLR_CMA|CLK_DIV8192, _8TCR1); /* start count */
42}
43
44void platform_timer_eoi(void)
45{
46 *(volatile unsigned char *)_8TCSR1 &= ~(1 << CMFA);
47}
48
49void platform_gettod(int *year, int *mon, int *day, int *hour,
50 int *min, int *sec)
51{
52/* FIXME! not RTC support */
53 *year = *mon = *day = *hour = *min = *sec = 0;
54}
diff --git a/arch/h8300/platform/h8s/generic/Makefile b/arch/h8300/platform/h8s/generic/Makefile
index 055d53a9811b..44b4685c664c 100644
--- a/arch/h8300/platform/h8s/generic/Makefile
+++ b/arch/h8300/platform/h8s/generic/Makefile
@@ -3,4 +3,3 @@
3# 3#
4 4
5extra-y = crt0_$(MODEL).o 5extra-y = crt0_$(MODEL).o
6obj-y := timer.o
diff --git a/arch/h8300/platform/h8s/generic/timer.c b/arch/h8300/platform/h8s/generic/timer.c
deleted file mode 100644
index c2211c6e79da..000000000000
--- a/arch/h8300/platform/h8s/generic/timer.c
+++ /dev/null
@@ -1,53 +0,0 @@
1/*
2 * linux/arch/h8300/platform/h8s/generic/timer.c
3 *
4 * Yoshinori Sato <ysato@users.sourceforge.jp>
5 *
6 * Platform depend Timer Handler
7 *
8 */
9
10#include <linux/errno.h>
11#include <linux/sched.h>
12#include <linux/kernel.h>
13#include <linux/param.h>
14#include <linux/string.h>
15#include <linux/mm.h>
16#include <linux/interrupt.h>
17#include <linux/init.h>
18#include <linux/timex.h>
19
20#include <asm/segment.h>
21#include <asm/io.h>
22#include <asm/irq.h>
23#include <asm/regs267x.h>
24
25#define CMFA 6
26
27#define CMIEA 0x40
28#define CCLR_CMA 0x08
29#define CLK_DIV8192 0x03
30
31#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192 /* Timer input freq. */
32
33void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
34{
35 /* 8bit timer module enabled */
36 ctrl_outb(ctrl_inb(MSTPCRL) & ~0x01, MSTPCRL);
37 /* setup 8bit timer ch1 */
38 ctrl_outb(H8300_TIMER_FREQ / HZ, _8TCORA1); /* set interval */
39 ctrl_outb(0x00, _8TCSR1); /* no output */
40 request_irq(76, timer_int, 0, "timer" ,0);
41 ctrl_outb(CMIEA|CCLR_CMA|CLK_DIV8192, _8TCR1); /* start count */
42}
43
44void platform_timer_eoi(void)
45{
46 *(volatile unsigned char *)_8TCSR1 &= ~(1 << CMFA);
47}
48
49void platform_gettod(int *year, int *mon, int *day, int *hour,
50 int *min, int *sec)
51{
52 *year = *mon = *day = *hour = *min = *sec = 0;
53}