Commit | Line | Data |
---|---|---|
7dec62e9 PM |
1 | /* |
2 | * SH4-202 Setup | |
3 | * | |
4 | * Copyright (C) 2006 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/platform_device.h> | |
11 | #include <linux/init.h> | |
12 | #include <linux/serial.h> | |
96de1a8f | 13 | #include <linux/serial_sci.h> |
5f8a29ba | 14 | #include <linux/sh_timer.h> |
7dec62e9 PM |
15 | |
16 | static struct plat_sci_port sci_platform_data[] = { | |
17 | { | |
18 | .mapbase = 0xffe80000, | |
19 | .flags = UPF_BOOT_AUTOCONF, | |
20 | .type = PORT_SCIF, | |
21 | .irqs = { 40, 41, 43, 42 }, | |
22 | }, { | |
23 | .flags = 0, | |
24 | } | |
25 | }; | |
26 | ||
27 | static struct platform_device sci_device = { | |
28 | .name = "sh-sci", | |
29 | .id = -1, | |
30 | .dev = { | |
31 | .platform_data = sci_platform_data, | |
32 | }, | |
33 | }; | |
34 | ||
5f8a29ba MD |
35 | static struct sh_timer_config tmu0_platform_data = { |
36 | .name = "TMU0", | |
37 | .channel_offset = 0x04, | |
38 | .timer_bit = 0, | |
39 | .clk = "module_clk", | |
40 | .clockevent_rating = 200, | |
41 | }; | |
42 | ||
43 | static struct resource tmu0_resources[] = { | |
44 | [0] = { | |
45 | .name = "TMU0", | |
46 | .start = 0xffd80008, | |
47 | .end = 0xffd80013, | |
48 | .flags = IORESOURCE_MEM, | |
49 | }, | |
50 | [1] = { | |
51 | .start = 16, | |
52 | .flags = IORESOURCE_IRQ, | |
53 | }, | |
54 | }; | |
55 | ||
56 | static struct platform_device tmu0_device = { | |
57 | .name = "sh_tmu", | |
58 | .id = 0, | |
59 | .dev = { | |
60 | .platform_data = &tmu0_platform_data, | |
61 | }, | |
62 | .resource = tmu0_resources, | |
63 | .num_resources = ARRAY_SIZE(tmu0_resources), | |
64 | }; | |
65 | ||
66 | static struct sh_timer_config tmu1_platform_data = { | |
67 | .name = "TMU1", | |
68 | .channel_offset = 0x10, | |
69 | .timer_bit = 1, | |
70 | .clk = "module_clk", | |
71 | .clocksource_rating = 200, | |
72 | }; | |
73 | ||
74 | static struct resource tmu1_resources[] = { | |
75 | [0] = { | |
76 | .name = "TMU1", | |
77 | .start = 0xffd80014, | |
78 | .end = 0xffd8001f, | |
79 | .flags = IORESOURCE_MEM, | |
80 | }, | |
81 | [1] = { | |
82 | .start = 17, | |
83 | .flags = IORESOURCE_IRQ, | |
84 | }, | |
85 | }; | |
86 | ||
87 | static struct platform_device tmu1_device = { | |
88 | .name = "sh_tmu", | |
89 | .id = 1, | |
90 | .dev = { | |
91 | .platform_data = &tmu1_platform_data, | |
92 | }, | |
93 | .resource = tmu1_resources, | |
94 | .num_resources = ARRAY_SIZE(tmu1_resources), | |
95 | }; | |
96 | ||
97 | static struct sh_timer_config tmu2_platform_data = { | |
98 | .name = "TMU2", | |
99 | .channel_offset = 0x1c, | |
100 | .timer_bit = 2, | |
101 | .clk = "module_clk", | |
102 | }; | |
103 | ||
104 | static struct resource tmu2_resources[] = { | |
105 | [0] = { | |
106 | .name = "TMU2", | |
107 | .start = 0xffd80020, | |
108 | .end = 0xffd8002f, | |
109 | .flags = IORESOURCE_MEM, | |
110 | }, | |
111 | [1] = { | |
112 | .start = 18, | |
113 | .flags = IORESOURCE_IRQ, | |
114 | }, | |
115 | }; | |
116 | ||
117 | static struct platform_device tmu2_device = { | |
118 | .name = "sh_tmu", | |
119 | .id = 2, | |
120 | .dev = { | |
121 | .platform_data = &tmu2_platform_data, | |
122 | }, | |
123 | .resource = tmu2_resources, | |
124 | .num_resources = ARRAY_SIZE(tmu2_resources), | |
125 | }; | |
126 | ||
7dec62e9 PM |
127 | static struct platform_device *sh4202_devices[] __initdata = { |
128 | &sci_device, | |
5f8a29ba MD |
129 | &tmu0_device, |
130 | &tmu1_device, | |
131 | &tmu2_device, | |
7dec62e9 PM |
132 | }; |
133 | ||
134 | static int __init sh4202_devices_setup(void) | |
135 | { | |
136 | return platform_add_devices(sh4202_devices, | |
137 | ARRAY_SIZE(sh4202_devices)); | |
138 | } | |
139 | __initcall(sh4202_devices_setup); | |
b58d134c | 140 | |
5f8a29ba MD |
141 | static struct platform_device *sh4202_early_devices[] __initdata = { |
142 | &tmu0_device, | |
143 | &tmu1_device, | |
144 | &tmu2_device, | |
145 | }; | |
146 | ||
147 | void __init plat_early_device_setup(void) | |
148 | { | |
149 | early_platform_add_devices(sh4202_early_devices, | |
150 | ARRAY_SIZE(sh4202_early_devices)); | |
151 | } | |
152 | ||
b58d134c MD |
153 | void __init plat_irq_setup(void) |
154 | { | |
155 | /* do nothing - all IRL interrupts are handled by the board code */ | |
156 | } |