diff options
Diffstat (limited to 'arch/sh/kernel/cpu/sh4a/setup-shx3.c')
-rw-r--r-- | arch/sh/kernel/cpu/sh4a/setup-shx3.c | 209 |
1 files changed, 207 insertions, 2 deletions
diff --git a/arch/sh/kernel/cpu/sh4a/setup-shx3.c b/arch/sh/kernel/cpu/sh4a/setup-shx3.c index bd35f32534b9..53c65fd9ccef 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-shx3.c +++ b/arch/sh/kernel/cpu/sh4a/setup-shx3.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * SH-X3 Setup | 2 | * SH-X3 Prototype Setup |
3 | * | 3 | * |
4 | * Copyright (C) 2007 Paul Mundt | 4 | * Copyright (C) 2007 - 2009 Paul Mundt |
5 | * | 5 | * |
6 | * This file is subject to the terms and conditions of the GNU General Public | 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 | 7 | * License. See the file "COPYING" in the main directory of this archive |
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/serial.h> | 12 | #include <linux/serial.h> |
13 | #include <linux/serial_sci.h> | 13 | #include <linux/serial_sci.h> |
14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
15 | #include <linux/sh_timer.h> | ||
15 | #include <asm/mmzone.h> | 16 | #include <asm/mmzone.h> |
16 | 17 | ||
17 | static struct plat_sci_port sci_platform_data[] = { | 18 | static struct plat_sci_port sci_platform_data[] = { |
@@ -48,17 +49,221 @@ static struct platform_device sci_device = { | |||
48 | }, | 49 | }, |
49 | }; | 50 | }; |
50 | 51 | ||
52 | static struct sh_timer_config tmu0_platform_data = { | ||
53 | .name = "TMU0", | ||
54 | .channel_offset = 0x04, | ||
55 | .timer_bit = 0, | ||
56 | .clk = "peripheral_clk", | ||
57 | .clockevent_rating = 200, | ||
58 | }; | ||
59 | |||
60 | static struct resource tmu0_resources[] = { | ||
61 | [0] = { | ||
62 | .name = "TMU0", | ||
63 | .start = 0xffc10008, | ||
64 | .end = 0xffc10013, | ||
65 | .flags = IORESOURCE_MEM, | ||
66 | }, | ||
67 | [1] = { | ||
68 | .start = 16, | ||
69 | .flags = IORESOURCE_IRQ, | ||
70 | }, | ||
71 | }; | ||
72 | |||
73 | static struct platform_device tmu0_device = { | ||
74 | .name = "sh_tmu", | ||
75 | .id = 0, | ||
76 | .dev = { | ||
77 | .platform_data = &tmu0_platform_data, | ||
78 | }, | ||
79 | .resource = tmu0_resources, | ||
80 | .num_resources = ARRAY_SIZE(tmu0_resources), | ||
81 | }; | ||
82 | |||
83 | static struct sh_timer_config tmu1_platform_data = { | ||
84 | .name = "TMU1", | ||
85 | .channel_offset = 0x10, | ||
86 | .timer_bit = 1, | ||
87 | .clk = "peripheral_clk", | ||
88 | .clocksource_rating = 200, | ||
89 | }; | ||
90 | |||
91 | static struct resource tmu1_resources[] = { | ||
92 | [0] = { | ||
93 | .name = "TMU1", | ||
94 | .start = 0xffc10014, | ||
95 | .end = 0xffc1001f, | ||
96 | .flags = IORESOURCE_MEM, | ||
97 | }, | ||
98 | [1] = { | ||
99 | .start = 17, | ||
100 | .flags = IORESOURCE_IRQ, | ||
101 | }, | ||
102 | }; | ||
103 | |||
104 | static struct platform_device tmu1_device = { | ||
105 | .name = "sh_tmu", | ||
106 | .id = 1, | ||
107 | .dev = { | ||
108 | .platform_data = &tmu1_platform_data, | ||
109 | }, | ||
110 | .resource = tmu1_resources, | ||
111 | .num_resources = ARRAY_SIZE(tmu1_resources), | ||
112 | }; | ||
113 | |||
114 | static struct sh_timer_config tmu2_platform_data = { | ||
115 | .name = "TMU2", | ||
116 | .channel_offset = 0x1c, | ||
117 | .timer_bit = 2, | ||
118 | .clk = "peripheral_clk", | ||
119 | }; | ||
120 | |||
121 | static struct resource tmu2_resources[] = { | ||
122 | [0] = { | ||
123 | .name = "TMU2", | ||
124 | .start = 0xffc10020, | ||
125 | .end = 0xffc1002f, | ||
126 | .flags = IORESOURCE_MEM, | ||
127 | }, | ||
128 | [1] = { | ||
129 | .start = 18, | ||
130 | .flags = IORESOURCE_IRQ, | ||
131 | }, | ||
132 | }; | ||
133 | |||
134 | static struct platform_device tmu2_device = { | ||
135 | .name = "sh_tmu", | ||
136 | .id = 2, | ||
137 | .dev = { | ||
138 | .platform_data = &tmu2_platform_data, | ||
139 | }, | ||
140 | .resource = tmu2_resources, | ||
141 | .num_resources = ARRAY_SIZE(tmu2_resources), | ||
142 | }; | ||
143 | |||
144 | static struct sh_timer_config tmu3_platform_data = { | ||
145 | .name = "TMU3", | ||
146 | .channel_offset = 0x04, | ||
147 | .timer_bit = 0, | ||
148 | .clk = "peripheral_clk", | ||
149 | }; | ||
150 | |||
151 | static struct resource tmu3_resources[] = { | ||
152 | [0] = { | ||
153 | .name = "TMU3", | ||
154 | .start = 0xffc20008, | ||
155 | .end = 0xffc20013, | ||
156 | .flags = IORESOURCE_MEM, | ||
157 | }, | ||
158 | [1] = { | ||
159 | .start = 19, | ||
160 | .flags = IORESOURCE_IRQ, | ||
161 | }, | ||
162 | }; | ||
163 | |||
164 | static struct platform_device tmu3_device = { | ||
165 | .name = "sh_tmu", | ||
166 | .id = 3, | ||
167 | .dev = { | ||
168 | .platform_data = &tmu3_platform_data, | ||
169 | }, | ||
170 | .resource = tmu3_resources, | ||
171 | .num_resources = ARRAY_SIZE(tmu3_resources), | ||
172 | }; | ||
173 | |||
174 | static struct sh_timer_config tmu4_platform_data = { | ||
175 | .name = "TMU4", | ||
176 | .channel_offset = 0x10, | ||
177 | .timer_bit = 1, | ||
178 | .clk = "peripheral_clk", | ||
179 | }; | ||
180 | |||
181 | static struct resource tmu4_resources[] = { | ||
182 | [0] = { | ||
183 | .name = "TMU4", | ||
184 | .start = 0xffc20014, | ||
185 | .end = 0xffc2001f, | ||
186 | .flags = IORESOURCE_MEM, | ||
187 | }, | ||
188 | [1] = { | ||
189 | .start = 20, | ||
190 | .flags = IORESOURCE_IRQ, | ||
191 | }, | ||
192 | }; | ||
193 | |||
194 | static struct platform_device tmu4_device = { | ||
195 | .name = "sh_tmu", | ||
196 | .id = 4, | ||
197 | .dev = { | ||
198 | .platform_data = &tmu4_platform_data, | ||
199 | }, | ||
200 | .resource = tmu4_resources, | ||
201 | .num_resources = ARRAY_SIZE(tmu4_resources), | ||
202 | }; | ||
203 | |||
204 | static struct sh_timer_config tmu5_platform_data = { | ||
205 | .name = "TMU5", | ||
206 | .channel_offset = 0x1c, | ||
207 | .timer_bit = 2, | ||
208 | .clk = "peripheral_clk", | ||
209 | }; | ||
210 | |||
211 | static struct resource tmu5_resources[] = { | ||
212 | [0] = { | ||
213 | .name = "TMU5", | ||
214 | .start = 0xffc20020, | ||
215 | .end = 0xffc2002b, | ||
216 | .flags = IORESOURCE_MEM, | ||
217 | }, | ||
218 | [1] = { | ||
219 | .start = 21, | ||
220 | .flags = IORESOURCE_IRQ, | ||
221 | }, | ||
222 | }; | ||
223 | |||
224 | static struct platform_device tmu5_device = { | ||
225 | .name = "sh_tmu", | ||
226 | .id = 5, | ||
227 | .dev = { | ||
228 | .platform_data = &tmu5_platform_data, | ||
229 | }, | ||
230 | .resource = tmu5_resources, | ||
231 | .num_resources = ARRAY_SIZE(tmu5_resources), | ||
232 | }; | ||
233 | |||
234 | static struct platform_device *shx3_early_devices[] __initdata = { | ||
235 | &tmu0_device, | ||
236 | &tmu1_device, | ||
237 | &tmu2_device, | ||
238 | &tmu3_device, | ||
239 | &tmu4_device, | ||
240 | &tmu5_device, | ||
241 | }; | ||
242 | |||
51 | static struct platform_device *shx3_devices[] __initdata = { | 243 | static struct platform_device *shx3_devices[] __initdata = { |
52 | &sci_device, | 244 | &sci_device, |
53 | }; | 245 | }; |
54 | 246 | ||
55 | static int __init shx3_devices_setup(void) | 247 | static int __init shx3_devices_setup(void) |
56 | { | 248 | { |
249 | int ret; | ||
250 | |||
251 | ret = platform_add_devices(shx3_early_devices, | ||
252 | ARRAY_SIZE(shx3_early_devices)); | ||
253 | if (unlikely(ret != 0)) | ||
254 | return ret; | ||
255 | |||
57 | return platform_add_devices(shx3_devices, | 256 | return platform_add_devices(shx3_devices, |
58 | ARRAY_SIZE(shx3_devices)); | 257 | ARRAY_SIZE(shx3_devices)); |
59 | } | 258 | } |
60 | __initcall(shx3_devices_setup); | 259 | __initcall(shx3_devices_setup); |
61 | 260 | ||
261 | void __init plat_early_device_setup(void) | ||
262 | { | ||
263 | early_platform_add_devices(shx3_early_devices, | ||
264 | ARRAY_SIZE(shx3_early_devices)); | ||
265 | } | ||
266 | |||
62 | enum { | 267 | enum { |
63 | UNUSED = 0, | 268 | UNUSED = 0, |
64 | 269 | ||