diff options
author | Magnus Damm <damm@igel.co.jp> | 2009-04-30 00:08:18 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-04-30 00:20:37 -0400 |
commit | 698aa99da5f5e2b4c666fd21ab77306f0225b8f5 (patch) | |
tree | e6c88c11646a4e87d76d031f6e972bd9566aceaa /arch/sh/kernel/cpu/sh2a | |
parent | 3014f47460ecfb13d4169daae51f26a20bacfa17 (diff) |
sh: sh2/sh2a 16-bit CMT platform data
This patch adds 16-bit cmt platform data for the following cpus:
- sh7619 (2 channels)
- sh7203/sh7263 (2 channels)
- sh7206 (2 channels)
Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/cpu/sh2a')
-rw-r--r-- | arch/sh/kernel/cpu/sh2a/setup-sh7203.c | 84 | ||||
-rw-r--r-- | arch/sh/kernel/cpu/sh2a/setup-sh7206.c | 84 |
2 files changed, 168 insertions, 0 deletions
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c index 820dfb2e8656..0836acee2289 100644 --- a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c +++ b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c | |||
@@ -11,6 +11,8 @@ | |||
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
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/sh_cmt.h> | ||
15 | #include <linux/io.h> | ||
14 | 16 | ||
15 | enum { | 17 | enum { |
16 | UNUSED = 0, | 18 | UNUSED = 0, |
@@ -205,6 +207,70 @@ static struct platform_device sci_device = { | |||
205 | }, | 207 | }, |
206 | }; | 208 | }; |
207 | 209 | ||
210 | static struct sh_cmt_config cmt0_platform_data = { | ||
211 | .name = "CMT0", | ||
212 | .channel_offset = 0x02, | ||
213 | .timer_bit = 0, | ||
214 | .clk = "module_clk", | ||
215 | .clockevent_rating = 125, | ||
216 | .clocksource_rating = 0, /* disabled due to code generation issues */ | ||
217 | }; | ||
218 | |||
219 | static struct resource cmt0_resources[] = { | ||
220 | [0] = { | ||
221 | .name = "CMT0", | ||
222 | .start = 0xfffec002, | ||
223 | .end = 0xfffec007, | ||
224 | .flags = IORESOURCE_MEM, | ||
225 | }, | ||
226 | [1] = { | ||
227 | .start = 142, | ||
228 | .flags = IORESOURCE_IRQ, | ||
229 | }, | ||
230 | }; | ||
231 | |||
232 | static struct platform_device cmt0_device = { | ||
233 | .name = "sh_cmt", | ||
234 | .id = 0, | ||
235 | .dev = { | ||
236 | .platform_data = &cmt0_platform_data, | ||
237 | }, | ||
238 | .resource = cmt0_resources, | ||
239 | .num_resources = ARRAY_SIZE(cmt0_resources), | ||
240 | }; | ||
241 | |||
242 | static struct sh_cmt_config cmt1_platform_data = { | ||
243 | .name = "CMT1", | ||
244 | .channel_offset = 0x08, | ||
245 | .timer_bit = 1, | ||
246 | .clk = "module_clk", | ||
247 | .clockevent_rating = 125, | ||
248 | .clocksource_rating = 0, /* disabled due to code generation issues */ | ||
249 | }; | ||
250 | |||
251 | static struct resource cmt1_resources[] = { | ||
252 | [0] = { | ||
253 | .name = "CMT1", | ||
254 | .start = 0xfffec008, | ||
255 | .end = 0xfffec00d, | ||
256 | .flags = IORESOURCE_MEM, | ||
257 | }, | ||
258 | [1] = { | ||
259 | .start = 143, | ||
260 | .flags = IORESOURCE_IRQ, | ||
261 | }, | ||
262 | }; | ||
263 | |||
264 | static struct platform_device cmt1_device = { | ||
265 | .name = "sh_cmt", | ||
266 | .id = 1, | ||
267 | .dev = { | ||
268 | .platform_data = &cmt1_platform_data, | ||
269 | }, | ||
270 | .resource = cmt1_resources, | ||
271 | .num_resources = ARRAY_SIZE(cmt1_resources), | ||
272 | }; | ||
273 | |||
208 | static struct resource rtc_resources[] = { | 274 | static struct resource rtc_resources[] = { |
209 | [0] = { | 275 | [0] = { |
210 | .start = 0xffff2000, | 276 | .start = 0xffff2000, |
@@ -227,6 +293,8 @@ static struct platform_device rtc_device = { | |||
227 | 293 | ||
228 | static struct platform_device *sh7203_devices[] __initdata = { | 294 | static struct platform_device *sh7203_devices[] __initdata = { |
229 | &sci_device, | 295 | &sci_device, |
296 | &cmt0_device, | ||
297 | &cmt1_device, | ||
230 | &rtc_device, | 298 | &rtc_device, |
231 | }; | 299 | }; |
232 | 300 | ||
@@ -241,3 +309,19 @@ void __init plat_irq_setup(void) | |||
241 | { | 309 | { |
242 | register_intc_controller(&intc_desc); | 310 | register_intc_controller(&intc_desc); |
243 | } | 311 | } |
312 | |||
313 | static struct platform_device *sh7203_early_devices[] __initdata = { | ||
314 | &cmt0_device, | ||
315 | &cmt1_device, | ||
316 | }; | ||
317 | |||
318 | #define STBCR4 0xfffe040c | ||
319 | |||
320 | void __init plat_early_device_setup(void) | ||
321 | { | ||
322 | /* enable CMT clock */ | ||
323 | __raw_writeb(__raw_readb(STBCR4) & ~0x04, STBCR4); | ||
324 | |||
325 | early_platform_add_devices(sh7203_early_devices, | ||
326 | ARRAY_SIZE(sh7203_early_devices)); | ||
327 | } | ||
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c index c46a8355726d..f9606e3d2515 100644 --- a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c +++ b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c | |||
@@ -12,6 +12,8 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/serial.h> | 13 | #include <linux/serial.h> |
14 | #include <linux/serial_sci.h> | 14 | #include <linux/serial_sci.h> |
15 | #include <linux/sh_cmt.h> | ||
16 | #include <linux/io.h> | ||
15 | 17 | ||
16 | enum { | 18 | enum { |
17 | UNUSED = 0, | 19 | UNUSED = 0, |
@@ -165,8 +167,74 @@ static struct platform_device sci_device = { | |||
165 | }, | 167 | }, |
166 | }; | 168 | }; |
167 | 169 | ||
170 | static struct sh_cmt_config cmt0_platform_data = { | ||
171 | .name = "CMT0", | ||
172 | .channel_offset = 0x02, | ||
173 | .timer_bit = 0, | ||
174 | .clk = "module_clk", | ||
175 | .clockevent_rating = 125, | ||
176 | .clocksource_rating = 0, /* disabled due to code generation issues */ | ||
177 | }; | ||
178 | |||
179 | static struct resource cmt0_resources[] = { | ||
180 | [0] = { | ||
181 | .name = "CMT0", | ||
182 | .start = 0xfffec002, | ||
183 | .end = 0xfffec007, | ||
184 | .flags = IORESOURCE_MEM, | ||
185 | }, | ||
186 | [1] = { | ||
187 | .start = 140, | ||
188 | .flags = IORESOURCE_IRQ, | ||
189 | }, | ||
190 | }; | ||
191 | |||
192 | static struct platform_device cmt0_device = { | ||
193 | .name = "sh_cmt", | ||
194 | .id = 0, | ||
195 | .dev = { | ||
196 | .platform_data = &cmt0_platform_data, | ||
197 | }, | ||
198 | .resource = cmt0_resources, | ||
199 | .num_resources = ARRAY_SIZE(cmt0_resources), | ||
200 | }; | ||
201 | |||
202 | static struct sh_cmt_config cmt1_platform_data = { | ||
203 | .name = "CMT1", | ||
204 | .channel_offset = 0x08, | ||
205 | .timer_bit = 1, | ||
206 | .clk = "module_clk", | ||
207 | .clockevent_rating = 125, | ||
208 | .clocksource_rating = 0, /* disabled due to code generation issues */ | ||
209 | }; | ||
210 | |||
211 | static struct resource cmt1_resources[] = { | ||
212 | [0] = { | ||
213 | .name = "CMT1", | ||
214 | .start = 0xfffec008, | ||
215 | .end = 0xfffec00d, | ||
216 | .flags = IORESOURCE_MEM, | ||
217 | }, | ||
218 | [1] = { | ||
219 | .start = 144, | ||
220 | .flags = IORESOURCE_IRQ, | ||
221 | }, | ||
222 | }; | ||
223 | |||
224 | static struct platform_device cmt1_device = { | ||
225 | .name = "sh_cmt", | ||
226 | .id = 1, | ||
227 | .dev = { | ||
228 | .platform_data = &cmt1_platform_data, | ||
229 | }, | ||
230 | .resource = cmt1_resources, | ||
231 | .num_resources = ARRAY_SIZE(cmt1_resources), | ||
232 | }; | ||
233 | |||
168 | static struct platform_device *sh7206_devices[] __initdata = { | 234 | static struct platform_device *sh7206_devices[] __initdata = { |
169 | &sci_device, | 235 | &sci_device, |
236 | &cmt0_device, | ||
237 | &cmt1_device, | ||
170 | }; | 238 | }; |
171 | 239 | ||
172 | static int __init sh7206_devices_setup(void) | 240 | static int __init sh7206_devices_setup(void) |
@@ -180,3 +248,19 @@ void __init plat_irq_setup(void) | |||
180 | { | 248 | { |
181 | register_intc_controller(&intc_desc); | 249 | register_intc_controller(&intc_desc); |
182 | } | 250 | } |
251 | |||
252 | static struct platform_device *sh7206_early_devices[] __initdata = { | ||
253 | &cmt0_device, | ||
254 | &cmt1_device, | ||
255 | }; | ||
256 | |||
257 | #define STBCR4 0xfffe040c | ||
258 | |||
259 | void __init plat_early_device_setup(void) | ||
260 | { | ||
261 | /* enable CMT clock */ | ||
262 | __raw_writeb(__raw_readb(STBCR4) & ~0x04, STBCR4); | ||
263 | |||
264 | early_platform_add_devices(sh7206_early_devices, | ||
265 | ARRAY_SIZE(sh7206_early_devices)); | ||
266 | } | ||