]> git.karo-electronics.de Git - mv-sheeva.git/blob - arch/arm/mach-shmobile/setup-sh7372.c
d1a8095a19eb9a1e89adc87f67155fee4ae73790
[mv-sheeva.git] / arch / arm / mach-shmobile / setup-sh7372.c
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
35 /* SCIFA0 */
36 static struct plat_sci_port scif0_platform_data = {
37         .mapbase        = 0xe6c40000,
38         .flags          = UPF_BOOT_AUTOCONF,
39         .type           = PORT_SCIFA,
40         .irqs           = { evt2irq(0x0c00), evt2irq(0x0c00),
41                             evt2irq(0x0c00), evt2irq(0x0c00) },
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 /* SCIFA1 */
53 static struct plat_sci_port scif1_platform_data = {
54         .mapbase        = 0xe6c50000,
55         .flags          = UPF_BOOT_AUTOCONF,
56         .type           = PORT_SCIFA,
57         .irqs           = { evt2irq(0x0c20), evt2irq(0x0c20),
58                             evt2irq(0x0c20), evt2irq(0x0c20) },
59 };
60
61 static struct platform_device scif1_device = {
62         .name           = "sh-sci",
63         .id             = 1,
64         .dev            = {
65                 .platform_data  = &scif1_platform_data,
66         },
67 };
68
69 /* SCIFA2 */
70 static struct plat_sci_port scif2_platform_data = {
71         .mapbase        = 0xe6c60000,
72         .flags          = UPF_BOOT_AUTOCONF,
73         .type           = PORT_SCIFA,
74         .irqs           = { evt2irq(0x0c40), evt2irq(0x0c40),
75                             evt2irq(0x0c40), evt2irq(0x0c40) },
76 };
77
78 static struct platform_device scif2_device = {
79         .name           = "sh-sci",
80         .id             = 2,
81         .dev            = {
82                 .platform_data  = &scif2_platform_data,
83         },
84 };
85
86 /* SCIFA3 */
87 static struct plat_sci_port scif3_platform_data = {
88         .mapbase        = 0xe6c70000,
89         .flags          = UPF_BOOT_AUTOCONF,
90         .type           = PORT_SCIFA,
91         .irqs           = { evt2irq(0x0c60), evt2irq(0x0c60),
92                             evt2irq(0x0c60), evt2irq(0x0c60) },
93 };
94
95 static struct platform_device scif3_device = {
96         .name           = "sh-sci",
97         .id             = 3,
98         .dev            = {
99                 .platform_data  = &scif3_platform_data,
100         },
101 };
102
103 /* SCIFA4 */
104 static struct plat_sci_port scif4_platform_data = {
105         .mapbase        = 0xe6c80000,
106         .flags          = UPF_BOOT_AUTOCONF,
107         .type           = PORT_SCIFA,
108         .irqs           = { evt2irq(0x0d20), evt2irq(0x0d20),
109                             evt2irq(0x0d20), evt2irq(0x0d20) },
110 };
111
112 static struct platform_device scif4_device = {
113         .name           = "sh-sci",
114         .id             = 4,
115         .dev            = {
116                 .platform_data  = &scif4_platform_data,
117         },
118 };
119
120 /* SCIFA5 */
121 static struct plat_sci_port scif5_platform_data = {
122         .mapbase        = 0xe6cb0000,
123         .flags          = UPF_BOOT_AUTOCONF,
124         .type           = PORT_SCIFA,
125         .irqs           = { evt2irq(0x0d40), evt2irq(0x0d40),
126                             evt2irq(0x0d40), evt2irq(0x0d40) },
127 };
128
129 static struct platform_device scif5_device = {
130         .name           = "sh-sci",
131         .id             = 5,
132         .dev            = {
133                 .platform_data  = &scif5_platform_data,
134         },
135 };
136
137 /* SCIFB */
138 static struct plat_sci_port scif6_platform_data = {
139         .mapbase        = 0xe6c30000,
140         .flags          = UPF_BOOT_AUTOCONF,
141         .type           = PORT_SCIFB,
142         .irqs           = { evt2irq(0x0d60), evt2irq(0x0d60),
143                             evt2irq(0x0d60), evt2irq(0x0d60) },
144 };
145
146 static struct platform_device scif6_device = {
147         .name           = "sh-sci",
148         .id             = 6,
149         .dev            = {
150                 .platform_data  = &scif6_platform_data,
151         },
152 };
153
154 /* CMT */
155 static struct sh_timer_config cmt10_platform_data = {
156         .name = "CMT10",
157         .channel_offset = 0x10,
158         .timer_bit = 0,
159         .clk = "cmt1",
160         .clockevent_rating = 125,
161         .clocksource_rating = 125,
162 };
163
164 static struct resource cmt10_resources[] = {
165         [0] = {
166                 .name   = "CMT10",
167                 .start  = 0xe6138010,
168                 .end    = 0xe613801b,
169                 .flags  = IORESOURCE_MEM,
170         },
171         [1] = {
172                 .start  = evt2irq(0x0b00), /* CMT1_CMT10 */
173                 .flags  = IORESOURCE_IRQ,
174         },
175 };
176
177 static 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
187 /* I2C */
188 static struct resource iic0_resources[] = {
189         [0] = {
190                 .name   = "IIC0",
191                 .start  = 0xFFF20000,
192                 .end    = 0xFFF20425 - 1,
193                 .flags  = IORESOURCE_MEM,
194         },
195         [1] = {
196                 .start  = intcs_evt2irq(0xe00), /* IIC0_ALI0 */
197                 .end    = intcs_evt2irq(0xe60), /* IIC0_DTEI0 */
198                 .flags  = IORESOURCE_IRQ,
199         },
200 };
201
202 static 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
209 static struct resource iic1_resources[] = {
210         [0] = {
211                 .name   = "IIC1",
212                 .start  = 0xE6C20000,
213                 .end    = 0xE6C20425 - 1,
214                 .flags  = IORESOURCE_MEM,
215         },
216         [1] = {
217                 .start  = evt2irq(0x780), /* IIC1_ALI1 */
218                 .end    = evt2irq(0x7e0), /* IIC1_DTEI1 */
219                 .flags  = IORESOURCE_IRQ,
220         },
221 };
222
223 static 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
230 static 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,
239         &iic0_device,
240         &iic1_device,
241 };
242
243 void __init sh7372_add_standard_devices(void)
244 {
245         platform_add_devices(sh7372_early_devices,
246                             ARRAY_SIZE(sh7372_early_devices));
247 }
248
249 void __init sh7372_add_early_devices(void)
250 {
251         early_platform_add_devices(sh7372_early_devices,
252                                    ARRAY_SIZE(sh7372_early_devices));
253 }