diff options
Diffstat (limited to 'arch/sh/kernel/cpu/sh2a/setup-mxg.c')
-rw-r--r-- | arch/sh/kernel/cpu/sh2a/setup-mxg.c | 111 |
1 files changed, 110 insertions, 1 deletions
diff --git a/arch/sh/kernel/cpu/sh2a/setup-mxg.c b/arch/sh/kernel/cpu/sh2a/setup-mxg.c index 844293723cfc..870030aa05bc 100644 --- a/arch/sh/kernel/cpu/sh2a/setup-mxg.c +++ b/arch/sh/kernel/cpu/sh2a/setup-mxg.c | |||
@@ -11,6 +11,7 @@ | |||
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_mtu2.h> | ||
14 | 15 | ||
15 | enum { | 16 | enum { |
16 | UNUSED = 0, | 17 | UNUSED = 0, |
@@ -24,7 +25,7 @@ enum { | |||
24 | 25 | ||
25 | SCIF0, SCIF1, | 26 | SCIF0, SCIF1, |
26 | 27 | ||
27 | MTU2_GROUP1, MTU2_GROUP2, MTU2_GROUP3, MTU2_GROUP4, MTU2_GROUP5 | 28 | MTU2_GROUP1, MTU2_GROUP2, MTU2_GROUP3, MTU2_GROUP4, MTU2_GROUP5, |
28 | MTU2_TGI3B, MTU2_TGI3C, | 29 | MTU2_TGI3B, MTU2_TGI3C, |
29 | 30 | ||
30 | /* interrupt groups */ | 31 | /* interrupt groups */ |
@@ -113,6 +114,99 @@ static struct intc_mask_reg mask_registers[] __initdata = { | |||
113 | static DECLARE_INTC_DESC(intc_desc, "mxg", vectors, groups, | 114 | static DECLARE_INTC_DESC(intc_desc, "mxg", vectors, groups, |
114 | mask_registers, prio_registers, NULL); | 115 | mask_registers, prio_registers, NULL); |
115 | 116 | ||
117 | static struct sh_mtu2_config mtu2_0_platform_data = { | ||
118 | .name = "MTU2_0", | ||
119 | .channel_offset = -0x80, | ||
120 | .timer_bit = 0, | ||
121 | .clk = "module_clk", | ||
122 | .clockevent_rating = 200, | ||
123 | }; | ||
124 | |||
125 | static struct resource mtu2_0_resources[] = { | ||
126 | [0] = { | ||
127 | .name = "MTU2_0", | ||
128 | .start = 0xff801300, | ||
129 | .end = 0xff801326, | ||
130 | .flags = IORESOURCE_MEM, | ||
131 | }, | ||
132 | [1] = { | ||
133 | .start = 228, | ||
134 | .flags = IORESOURCE_IRQ, | ||
135 | }, | ||
136 | }; | ||
137 | |||
138 | static struct platform_device mtu2_0_device = { | ||
139 | .name = "sh_mtu2", | ||
140 | .id = 0, | ||
141 | .dev = { | ||
142 | .platform_data = &mtu2_0_platform_data, | ||
143 | }, | ||
144 | .resource = mtu2_0_resources, | ||
145 | .num_resources = ARRAY_SIZE(mtu2_0_resources), | ||
146 | }; | ||
147 | |||
148 | static struct sh_mtu2_config mtu2_1_platform_data = { | ||
149 | .name = "MTU2_1", | ||
150 | .channel_offset = -0x100, | ||
151 | .timer_bit = 1, | ||
152 | .clk = "module_clk", | ||
153 | .clockevent_rating = 200, | ||
154 | }; | ||
155 | |||
156 | static struct resource mtu2_1_resources[] = { | ||
157 | [0] = { | ||
158 | .name = "MTU2_1", | ||
159 | .start = 0xff801380, | ||
160 | .end = 0xff801390, | ||
161 | .flags = IORESOURCE_MEM, | ||
162 | }, | ||
163 | [1] = { | ||
164 | .start = 234, | ||
165 | .flags = IORESOURCE_IRQ, | ||
166 | }, | ||
167 | }; | ||
168 | |||
169 | static struct platform_device mtu2_1_device = { | ||
170 | .name = "sh_mtu2", | ||
171 | .id = 1, | ||
172 | .dev = { | ||
173 | .platform_data = &mtu2_1_platform_data, | ||
174 | }, | ||
175 | .resource = mtu2_1_resources, | ||
176 | .num_resources = ARRAY_SIZE(mtu2_1_resources), | ||
177 | }; | ||
178 | |||
179 | static struct sh_mtu2_config mtu2_2_platform_data = { | ||
180 | .name = "MTU2_2", | ||
181 | .channel_offset = 0x80, | ||
182 | .timer_bit = 2, | ||
183 | .clk = "module_clk", | ||
184 | .clockevent_rating = 200, | ||
185 | }; | ||
186 | |||
187 | static struct resource mtu2_2_resources[] = { | ||
188 | [0] = { | ||
189 | .name = "MTU2_2", | ||
190 | .start = 0xff801000, | ||
191 | .end = 0xff80100a, | ||
192 | .flags = IORESOURCE_MEM, | ||
193 | }, | ||
194 | [1] = { | ||
195 | .start = 240, | ||
196 | .flags = IORESOURCE_IRQ, | ||
197 | }, | ||
198 | }; | ||
199 | |||
200 | static struct platform_device mtu2_2_device = { | ||
201 | .name = "sh_mtu2", | ||
202 | .id = 2, | ||
203 | .dev = { | ||
204 | .platform_data = &mtu2_2_platform_data, | ||
205 | }, | ||
206 | .resource = mtu2_2_resources, | ||
207 | .num_resources = ARRAY_SIZE(mtu2_2_resources), | ||
208 | }; | ||
209 | |||
116 | static struct plat_sci_port sci_platform_data[] = { | 210 | static struct plat_sci_port sci_platform_data[] = { |
117 | { | 211 | { |
118 | .mapbase = 0xff804000, | 212 | .mapbase = 0xff804000, |
@@ -134,6 +228,9 @@ static struct platform_device sci_device = { | |||
134 | 228 | ||
135 | static struct platform_device *mxg_devices[] __initdata = { | 229 | static struct platform_device *mxg_devices[] __initdata = { |
136 | &sci_device, | 230 | &sci_device, |
231 | &mtu2_0_device, | ||
232 | &mtu2_1_device, | ||
233 | &mtu2_2_device, | ||
137 | }; | 234 | }; |
138 | 235 | ||
139 | static int __init mxg_devices_setup(void) | 236 | static int __init mxg_devices_setup(void) |
@@ -147,3 +244,15 @@ void __init plat_irq_setup(void) | |||
147 | { | 244 | { |
148 | register_intc_controller(&intc_desc); | 245 | register_intc_controller(&intc_desc); |
149 | } | 246 | } |
247 | |||
248 | static struct platform_device *mxg_early_devices[] __initdata = { | ||
249 | &mtu2_0_device, | ||
250 | &mtu2_1_device, | ||
251 | &mtu2_2_device, | ||
252 | }; | ||
253 | |||
254 | void __init plat_early_device_setup(void) | ||
255 | { | ||
256 | early_platform_add_devices(mxg_early_devices, | ||
257 | ARRAY_SIZE(mxg_early_devices)); | ||
258 | } | ||