blob: d6b15648d8b0b4f4e702b32c1f604c0d99079c71 [file] [log] [blame]
Magnus Damm2b7eda62010-02-05 11:14:58 +00001/*
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
Magnus Damm33c96072010-05-20 14:41:00 +000035/* SCIFA0 */
Magnus Damm2b7eda62010-02-05 11:14:58 +000036static struct plat_sci_port scif0_platform_data = {
37 .mapbase = 0xe6c40000,
38 .flags = UPF_BOOT_AUTOCONF,
39 .type = PORT_SCIF,
Magnus Damm33c96072010-05-20 14:41:00 +000040 .irqs = { evt2irq(0x0c00), evt2irq(0x0c00),
41 evt2irq(0x0c00), evt2irq(0x0c00) },
Magnus Damm2b7eda62010-02-05 11:14:58 +000042};
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
Magnus Damm33c96072010-05-20 14:41:00 +000052/* SCIFA1 */
Magnus Damm2b7eda62010-02-05 11:14:58 +000053static struct plat_sci_port scif1_platform_data = {
54 .mapbase = 0xe6c50000,
55 .flags = UPF_BOOT_AUTOCONF,
56 .type = PORT_SCIF,
Magnus Damm33c96072010-05-20 14:41:00 +000057 .irqs = { evt2irq(0x0c20), evt2irq(0x0c20),
58 evt2irq(0x0c20), evt2irq(0x0c20) },
Magnus Damm2b7eda62010-02-05 11:14:58 +000059};
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
Magnus Damm33c96072010-05-20 14:41:00 +000069/* SCIFA2 */
Magnus Damm2b7eda62010-02-05 11:14:58 +000070static struct plat_sci_port scif2_platform_data = {
71 .mapbase = 0xe6c60000,
72 .flags = UPF_BOOT_AUTOCONF,
73 .type = PORT_SCIF,
Magnus Damm33c96072010-05-20 14:41:00 +000074 .irqs = { evt2irq(0x0c40), evt2irq(0x0c40),
75 evt2irq(0x0c40), evt2irq(0x0c40) },
Magnus Damm2b7eda62010-02-05 11:14:58 +000076};
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
Magnus Damm33c96072010-05-20 14:41:00 +000086/* SCIFA3 */
Magnus Damm2b7eda62010-02-05 11:14:58 +000087static struct plat_sci_port scif3_platform_data = {
88 .mapbase = 0xe6c70000,
89 .flags = UPF_BOOT_AUTOCONF,
90 .type = PORT_SCIF,
Magnus Damm33c96072010-05-20 14:41:00 +000091 .irqs = { evt2irq(0x0c60), evt2irq(0x0c60),
92 evt2irq(0x0c60), evt2irq(0x0c60) },
Magnus Damm2b7eda62010-02-05 11:14:58 +000093};
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
Magnus Damm33c96072010-05-20 14:41:00 +0000103/* SCIFA4 */
Magnus Damm2b7eda62010-02-05 11:14:58 +0000104static struct plat_sci_port scif4_platform_data = {
105 .mapbase = 0xe6c80000,
106 .flags = UPF_BOOT_AUTOCONF,
107 .type = PORT_SCIF,
Magnus Damm33c96072010-05-20 14:41:00 +0000108 .irqs = { evt2irq(0x0d20), evt2irq(0x0d20),
109 evt2irq(0x0d20), evt2irq(0x0d20) },
Magnus Damm2b7eda62010-02-05 11:14:58 +0000110};
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
Magnus Damm33c96072010-05-20 14:41:00 +0000120/* SCIFA5 */
Magnus Damm2b7eda62010-02-05 11:14:58 +0000121static struct plat_sci_port scif5_platform_data = {
122 .mapbase = 0xe6cb0000,
123 .flags = UPF_BOOT_AUTOCONF,
124 .type = PORT_SCIF,
Magnus Damm33c96072010-05-20 14:41:00 +0000125 .irqs = { evt2irq(0x0d40), evt2irq(0x0d40),
126 evt2irq(0x0d40), evt2irq(0x0d40) },
Magnus Damm2b7eda62010-02-05 11:14:58 +0000127};
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
Magnus Damm33c96072010-05-20 14:41:00 +0000137/* SCIFB */
Magnus Damm2b7eda62010-02-05 11:14:58 +0000138static struct plat_sci_port scif6_platform_data = {
139 .mapbase = 0xe6c30000,
140 .flags = UPF_BOOT_AUTOCONF,
141 .type = PORT_SCIF,
Magnus Damm33c96072010-05-20 14:41:00 +0000142 .irqs = { evt2irq(0x0d60), evt2irq(0x0d60),
143 evt2irq(0x0d60), evt2irq(0x0d60) },
Magnus Damm2b7eda62010-02-05 11:14:58 +0000144};
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
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000154/* CMT */
Magnus Damm2b7eda62010-02-05 11:14:58 +0000155static struct sh_timer_config cmt10_platform_data = {
156 .name = "CMT10",
157 .channel_offset = 0x10,
158 .timer_bit = 0,
Magnus Damm495b3ce2010-05-12 14:21:34 +0000159 .clk = "cmt1",
Magnus Damm2b7eda62010-02-05 11:14:58 +0000160 .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] = {
Magnus Damm33c96072010-05-20 14:41:00 +0000172 .start = evt2irq(0x0b00), /* CMT1_CMT10 */
Magnus Damm2b7eda62010-02-05 11:14:58 +0000173 .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
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000187/* 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] = {
Magnus Damm33c96072010-05-20 14:41:00 +0000196 .start = intcs_evt2irq(0xe00), /* IIC0_ALI0 */
197 .end = intcs_evt2irq(0xe60), /* IIC0_DTEI0 */
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000198 .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] = {
Magnus Damm33c96072010-05-20 14:41:00 +0000217 .start = evt2irq(0x780), /* IIC1_ALI1 */
218 .end = evt2irq(0x7e0), /* IIC1_DTEI1 */
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000219 .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
Magnus Damm2b7eda62010-02-05 11:14:58 +0000230static 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,
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000239 &iic0_device,
240 &iic1_device,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000241};
242
243void __init sh7372_add_standard_devices(void)
244{
245 platform_add_devices(sh7372_early_devices,
246 ARRAY_SIZE(sh7372_early_devices));
247}
248
Magnus Damm2b7eda62010-02-05 11:14:58 +0000249void __init sh7372_add_early_devices(void)
250{
Magnus Damm2b7eda62010-02-05 11:14:58 +0000251 early_platform_add_devices(sh7372_early_devices,
252 ARRAY_SIZE(sh7372_early_devices));
253}