Commit | Line | Data |
---|---|---|
6d9598e2 MD |
1 | /* |
2 | * sh73a0 processor support | |
3 | * | |
4 | * Copyright (C) 2010 Takashi Yoshii | |
5 | * Copyright (C) 2010 Magnus Damm | |
6 | * Copyright (C) 2008 Yoshihiro Shimoda | |
7 | * | |
8 | * This program is free software; you can redistribute it and/or modify | |
9 | * it under the terms of the GNU General Public License as published by | |
10 | * the Free Software Foundation; version 2 of the License. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with this program; if not, write to the Free Software | |
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | */ | |
21 | #include <linux/kernel.h> | |
22 | #include <linux/init.h> | |
23 | #include <linux/interrupt.h> | |
24 | #include <linux/irq.h> | |
25 | #include <linux/platform_device.h> | |
26 | #include <linux/delay.h> | |
27 | #include <linux/input.h> | |
28 | #include <linux/io.h> | |
29 | #include <linux/serial_sci.h> | |
30 | #include <linux/sh_intc.h> | |
31 | #include <linux/sh_timer.h> | |
32 | #include <mach/hardware.h> | |
33 | #include <asm/mach-types.h> | |
34 | #include <asm/mach/arch.h> | |
35 | ||
36 | static struct plat_sci_port scif0_platform_data = { | |
37 | .mapbase = 0xe6c40000, | |
38 | .flags = UPF_BOOT_AUTOCONF, | |
39 | .type = PORT_SCIFA, | |
40 | .irqs = { gic_spi(72), gic_spi(72), | |
41 | gic_spi(72), gic_spi(72) }, | |
42 | }; | |
43 | ||
44 | static struct platform_device scif0_device = { | |
45 | .name = "sh-sci", | |
46 | .id = 0, | |
47 | .dev = { | |
48 | .platform_data = &scif0_platform_data, | |
49 | }, | |
50 | }; | |
51 | ||
52 | static struct plat_sci_port scif1_platform_data = { | |
53 | .mapbase = 0xe6c50000, | |
54 | .flags = UPF_BOOT_AUTOCONF, | |
55 | .type = PORT_SCIFA, | |
56 | .irqs = { gic_spi(73), gic_spi(73), | |
57 | gic_spi(73), gic_spi(73) }, | |
58 | }; | |
59 | ||
60 | static struct platform_device scif1_device = { | |
61 | .name = "sh-sci", | |
62 | .id = 1, | |
63 | .dev = { | |
64 | .platform_data = &scif1_platform_data, | |
65 | }, | |
66 | }; | |
67 | ||
68 | static struct plat_sci_port scif2_platform_data = { | |
69 | .mapbase = 0xe6c60000, | |
70 | .flags = UPF_BOOT_AUTOCONF, | |
71 | .type = PORT_SCIFA, | |
72 | .irqs = { gic_spi(74), gic_spi(74), | |
73 | gic_spi(74), gic_spi(74) }, | |
74 | }; | |
75 | ||
76 | static struct platform_device scif2_device = { | |
77 | .name = "sh-sci", | |
78 | .id = 2, | |
79 | .dev = { | |
80 | .platform_data = &scif2_platform_data, | |
81 | }, | |
82 | }; | |
83 | ||
84 | static struct plat_sci_port scif3_platform_data = { | |
85 | .mapbase = 0xe6c70000, | |
86 | .flags = UPF_BOOT_AUTOCONF, | |
87 | .type = PORT_SCIFA, | |
88 | .irqs = { gic_spi(75), gic_spi(75), | |
89 | gic_spi(75), gic_spi(75) }, | |
90 | }; | |
91 | ||
92 | static struct platform_device scif3_device = { | |
93 | .name = "sh-sci", | |
94 | .id = 3, | |
95 | .dev = { | |
96 | .platform_data = &scif3_platform_data, | |
97 | }, | |
98 | }; | |
99 | ||
100 | static struct plat_sci_port scif4_platform_data = { | |
101 | .mapbase = 0xe6c80000, | |
102 | .flags = UPF_BOOT_AUTOCONF, | |
103 | .type = PORT_SCIFA, | |
104 | .irqs = { gic_spi(78), gic_spi(78), | |
105 | gic_spi(78), gic_spi(78) }, | |
106 | }; | |
107 | ||
108 | static struct platform_device scif4_device = { | |
109 | .name = "sh-sci", | |
110 | .id = 4, | |
111 | .dev = { | |
112 | .platform_data = &scif4_platform_data, | |
113 | }, | |
114 | }; | |
115 | ||
116 | static struct plat_sci_port scif5_platform_data = { | |
117 | .mapbase = 0xe6cb0000, | |
118 | .flags = UPF_BOOT_AUTOCONF, | |
119 | .type = PORT_SCIFA, | |
120 | .irqs = { gic_spi(79), gic_spi(79), | |
121 | gic_spi(79), gic_spi(79) }, | |
122 | }; | |
123 | ||
124 | static struct platform_device scif5_device = { | |
125 | .name = "sh-sci", | |
126 | .id = 5, | |
127 | .dev = { | |
128 | .platform_data = &scif5_platform_data, | |
129 | }, | |
130 | }; | |
131 | ||
132 | static struct plat_sci_port scif6_platform_data = { | |
133 | .mapbase = 0xe6cc0000, | |
134 | .flags = UPF_BOOT_AUTOCONF, | |
135 | .type = PORT_SCIFA, | |
136 | .irqs = { gic_spi(156), gic_spi(156), | |
137 | gic_spi(156), gic_spi(156) }, | |
138 | }; | |
139 | ||
140 | static struct platform_device scif6_device = { | |
141 | .name = "sh-sci", | |
142 | .id = 6, | |
143 | .dev = { | |
144 | .platform_data = &scif6_platform_data, | |
145 | }, | |
146 | }; | |
147 | ||
148 | static struct plat_sci_port scif7_platform_data = { | |
149 | .mapbase = 0xe6cd0000, | |
150 | .flags = UPF_BOOT_AUTOCONF, | |
151 | .type = PORT_SCIFA, | |
152 | .irqs = { gic_spi(143), gic_spi(143), | |
153 | gic_spi(143), gic_spi(143) }, | |
154 | }; | |
155 | ||
156 | static struct platform_device scif7_device = { | |
157 | .name = "sh-sci", | |
158 | .id = 7, | |
159 | .dev = { | |
160 | .platform_data = &scif7_platform_data, | |
161 | }, | |
162 | }; | |
163 | ||
164 | static struct plat_sci_port scif8_platform_data = { | |
165 | .mapbase = 0xe6c30000, | |
166 | .flags = UPF_BOOT_AUTOCONF, | |
167 | .type = PORT_SCIFB, | |
168 | .irqs = { gic_spi(80), gic_spi(80), | |
169 | gic_spi(80), gic_spi(80) }, | |
170 | }; | |
171 | ||
172 | static struct platform_device scif8_device = { | |
173 | .name = "sh-sci", | |
174 | .id = 8, | |
175 | .dev = { | |
176 | .platform_data = &scif8_platform_data, | |
177 | }, | |
178 | }; | |
179 | ||
180 | static struct sh_timer_config cmt10_platform_data = { | |
181 | .name = "CMT10", | |
182 | .channel_offset = 0x10, | |
183 | .timer_bit = 0, | |
184 | .clockevent_rating = 125, | |
185 | .clocksource_rating = 125, | |
186 | }; | |
187 | ||
188 | static struct resource cmt10_resources[] = { | |
189 | [0] = { | |
190 | .name = "CMT10", | |
191 | .start = 0xe6138010, | |
192 | .end = 0xe613801b, | |
193 | .flags = IORESOURCE_MEM, | |
194 | }, | |
195 | [1] = { | |
196 | .start = gic_spi(65), | |
197 | .flags = IORESOURCE_IRQ, | |
198 | }, | |
199 | }; | |
200 | ||
201 | static struct platform_device cmt10_device = { | |
202 | .name = "sh_cmt", | |
203 | .id = 10, | |
204 | .dev = { | |
205 | .platform_data = &cmt10_platform_data, | |
206 | }, | |
207 | .resource = cmt10_resources, | |
208 | .num_resources = ARRAY_SIZE(cmt10_resources), | |
209 | }; | |
210 | ||
211 | static struct platform_device *sh73a0_early_devices[] __initdata = { | |
212 | &scif0_device, | |
213 | &scif1_device, | |
214 | &scif2_device, | |
215 | &scif3_device, | |
216 | &scif4_device, | |
217 | &scif5_device, | |
218 | &scif6_device, | |
219 | &scif7_device, | |
220 | &scif8_device, | |
221 | &cmt10_device, | |
222 | }; | |
223 | ||
224 | void __init sh73a0_add_standard_devices(void) | |
225 | { | |
226 | platform_add_devices(sh73a0_early_devices, | |
227 | ARRAY_SIZE(sh73a0_early_devices)); | |
228 | } | |
229 | ||
230 | void __init sh73a0_add_early_devices(void) | |
231 | { | |
232 | early_platform_add_devices(sh73a0_early_devices, | |
233 | ARRAY_SIZE(sh73a0_early_devices)); | |
234 | } |