Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[deliverable/linux.git] / arch / arm / mach-shmobile / setup-sh7372.c
CommitLineData
2b7eda63
MD
1/*
2 * sh7372 processor support
3 *
4 * Copyright (C) 2010 Magnus Damm
5 * Copyright (C) 2008 Yoshihiro Shimoda
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/interrupt.h>
23#include <linux/irq.h>
24#include <linux/platform_device.h>
25#include <linux/delay.h>
26#include <linux/input.h>
27#include <linux/io.h>
28#include <linux/serial_sci.h>
29#include <linux/sh_intc.h>
30#include <linux/sh_timer.h>
31#include <mach/hardware.h>
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34
33c9607a 35/* SCIFA0 */
2b7eda63
MD
36static struct plat_sci_port scif0_platform_data = {
37 .mapbase = 0xe6c40000,
38 .flags = UPF_BOOT_AUTOCONF,
eb6e8605 39 .type = PORT_SCIFA,
33c9607a
MD
40 .irqs = { evt2irq(0x0c00), evt2irq(0x0c00),
41 evt2irq(0x0c00), evt2irq(0x0c00) },
2b7eda63
MD
42};
43
44static struct platform_device scif0_device = {
45 .name = "sh-sci",
46 .id = 0,
47 .dev = {
48 .platform_data = &scif0_platform_data,
49 },
50};
51
33c9607a 52/* SCIFA1 */
2b7eda63
MD
53static struct plat_sci_port scif1_platform_data = {
54 .mapbase = 0xe6c50000,
55 .flags = UPF_BOOT_AUTOCONF,
eb6e8605 56 .type = PORT_SCIFA,
33c9607a
MD
57 .irqs = { evt2irq(0x0c20), evt2irq(0x0c20),
58 evt2irq(0x0c20), evt2irq(0x0c20) },
2b7eda63
MD
59};
60
61static struct platform_device scif1_device = {
62 .name = "sh-sci",
63 .id = 1,
64 .dev = {
65 .platform_data = &scif1_platform_data,
66 },
67};
68
33c9607a 69/* SCIFA2 */
2b7eda63
MD
70static struct plat_sci_port scif2_platform_data = {
71 .mapbase = 0xe6c60000,
72 .flags = UPF_BOOT_AUTOCONF,
eb6e8605 73 .type = PORT_SCIFA,
33c9607a
MD
74 .irqs = { evt2irq(0x0c40), evt2irq(0x0c40),
75 evt2irq(0x0c40), evt2irq(0x0c40) },
2b7eda63
MD
76};
77
78static struct platform_device scif2_device = {
79 .name = "sh-sci",
80 .id = 2,
81 .dev = {
82 .platform_data = &scif2_platform_data,
83 },
84};
85
33c9607a 86/* SCIFA3 */
2b7eda63
MD
87static struct plat_sci_port scif3_platform_data = {
88 .mapbase = 0xe6c70000,
89 .flags = UPF_BOOT_AUTOCONF,
eb6e8605 90 .type = PORT_SCIFA,
33c9607a
MD
91 .irqs = { evt2irq(0x0c60), evt2irq(0x0c60),
92 evt2irq(0x0c60), evt2irq(0x0c60) },
2b7eda63
MD
93};
94
95static struct platform_device scif3_device = {
96 .name = "sh-sci",
97 .id = 3,
98 .dev = {
99 .platform_data = &scif3_platform_data,
100 },
101};
102
33c9607a 103/* SCIFA4 */
2b7eda63
MD
104static struct plat_sci_port scif4_platform_data = {
105 .mapbase = 0xe6c80000,
106 .flags = UPF_BOOT_AUTOCONF,
eb6e8605 107 .type = PORT_SCIFA,
33c9607a
MD
108 .irqs = { evt2irq(0x0d20), evt2irq(0x0d20),
109 evt2irq(0x0d20), evt2irq(0x0d20) },
2b7eda63
MD
110};
111
112static struct platform_device scif4_device = {
113 .name = "sh-sci",
114 .id = 4,
115 .dev = {
116 .platform_data = &scif4_platform_data,
117 },
118};
119
33c9607a 120/* SCIFA5 */
2b7eda63
MD
121static struct plat_sci_port scif5_platform_data = {
122 .mapbase = 0xe6cb0000,
123 .flags = UPF_BOOT_AUTOCONF,
eb6e8605 124 .type = PORT_SCIFA,
33c9607a
MD
125 .irqs = { evt2irq(0x0d40), evt2irq(0x0d40),
126 evt2irq(0x0d40), evt2irq(0x0d40) },
2b7eda63
MD
127};
128
129static struct platform_device scif5_device = {
130 .name = "sh-sci",
131 .id = 5,
132 .dev = {
133 .platform_data = &scif5_platform_data,
134 },
135};
136
33c9607a 137/* SCIFB */
2b7eda63
MD
138static struct plat_sci_port scif6_platform_data = {
139 .mapbase = 0xe6c30000,
140 .flags = UPF_BOOT_AUTOCONF,
eb6e8605 141 .type = PORT_SCIFB,
33c9607a
MD
142 .irqs = { evt2irq(0x0d60), evt2irq(0x0d60),
143 evt2irq(0x0d60), evt2irq(0x0d60) },
2b7eda63
MD
144};
145
146static struct platform_device scif6_device = {
147 .name = "sh-sci",
148 .id = 6,
149 .dev = {
150 .platform_data = &scif6_platform_data,
151 },
152};
153
c1909cc1 154/* CMT */
2b7eda63
MD
155static struct sh_timer_config cmt10_platform_data = {
156 .name = "CMT10",
157 .channel_offset = 0x10,
158 .timer_bit = 0,
495b3cea 159 .clk = "cmt1",
2b7eda63
MD
160 .clockevent_rating = 125,
161 .clocksource_rating = 125,
162};
163
164static struct resource cmt10_resources[] = {
165 [0] = {
166 .name = "CMT10",
167 .start = 0xe6138010,
168 .end = 0xe613801b,
169 .flags = IORESOURCE_MEM,
170 },
171 [1] = {
33c9607a 172 .start = evt2irq(0x0b00), /* CMT1_CMT10 */
2b7eda63
MD
173 .flags = IORESOURCE_IRQ,
174 },
175};
176
177static struct platform_device cmt10_device = {
178 .name = "sh_cmt",
179 .id = 10,
180 .dev = {
181 .platform_data = &cmt10_platform_data,
182 },
183 .resource = cmt10_resources,
184 .num_resources = ARRAY_SIZE(cmt10_resources),
185};
186
c1909cc1
KM
187/* I2C */
188static struct resource iic0_resources[] = {
189 [0] = {
190 .name = "IIC0",
191 .start = 0xFFF20000,
192 .end = 0xFFF20425 - 1,
193 .flags = IORESOURCE_MEM,
194 },
195 [1] = {
33c9607a
MD
196 .start = intcs_evt2irq(0xe00), /* IIC0_ALI0 */
197 .end = intcs_evt2irq(0xe60), /* IIC0_DTEI0 */
c1909cc1
KM
198 .flags = IORESOURCE_IRQ,
199 },
200};
201
202static struct platform_device iic0_device = {
203 .name = "i2c-sh_mobile",
204 .id = 0, /* "i2c0" clock */
205 .num_resources = ARRAY_SIZE(iic0_resources),
206 .resource = iic0_resources,
207};
208
209static struct resource iic1_resources[] = {
210 [0] = {
211 .name = "IIC1",
212 .start = 0xE6C20000,
213 .end = 0xE6C20425 - 1,
214 .flags = IORESOURCE_MEM,
215 },
216 [1] = {
33c9607a
MD
217 .start = evt2irq(0x780), /* IIC1_ALI1 */
218 .end = evt2irq(0x7e0), /* IIC1_DTEI1 */
c1909cc1
KM
219 .flags = IORESOURCE_IRQ,
220 },
221};
222
223static struct platform_device iic1_device = {
224 .name = "i2c-sh_mobile",
225 .id = 1, /* "i2c1" clock */
226 .num_resources = ARRAY_SIZE(iic1_resources),
227 .resource = iic1_resources,
228};
229
2b7eda63
MD
230static struct platform_device *sh7372_early_devices[] __initdata = {
231 &scif0_device,
232 &scif1_device,
233 &scif2_device,
234 &scif3_device,
235 &scif4_device,
236 &scif5_device,
237 &scif6_device,
238 &cmt10_device,
c1909cc1
KM
239 &iic0_device,
240 &iic1_device,
2b7eda63
MD
241};
242
243void __init sh7372_add_standard_devices(void)
244{
245 platform_add_devices(sh7372_early_devices,
246 ARRAY_SIZE(sh7372_early_devices));
247}
248
2b7eda63
MD
249void __init sh7372_add_early_devices(void)
250{
2b7eda63
MD
251 early_platform_add_devices(sh7372_early_devices,
252 ARRAY_SIZE(sh7372_early_devices));
253}
This page took 0.067507 seconds and 5 git commands to generate.