blob: 885dfaa54c2a91fb328e1f24bc709c99ea21ba0a [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
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +000035/* SCIF */
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,
40 .irqs = { 80, 80, 80, 80 },
41};
42
43static struct platform_device scif0_device = {
44 .name = "sh-sci",
45 .id = 0,
46 .dev = {
47 .platform_data = &scif0_platform_data,
48 },
49};
50
51static struct plat_sci_port scif1_platform_data = {
52 .mapbase = 0xe6c50000,
53 .flags = UPF_BOOT_AUTOCONF,
54 .type = PORT_SCIF,
55 .irqs = { 81, 81, 81, 81 },
56};
57
58static struct platform_device scif1_device = {
59 .name = "sh-sci",
60 .id = 1,
61 .dev = {
62 .platform_data = &scif1_platform_data,
63 },
64};
65
66static struct plat_sci_port scif2_platform_data = {
67 .mapbase = 0xe6c60000,
68 .flags = UPF_BOOT_AUTOCONF,
69 .type = PORT_SCIF,
70 .irqs = { 82, 82, 82, 82 },
71};
72
73static struct platform_device scif2_device = {
74 .name = "sh-sci",
75 .id = 2,
76 .dev = {
77 .platform_data = &scif2_platform_data,
78 },
79};
80
81static struct plat_sci_port scif3_platform_data = {
82 .mapbase = 0xe6c70000,
83 .flags = UPF_BOOT_AUTOCONF,
84 .type = PORT_SCIF,
85 .irqs = { 83, 83, 83, 83 },
86};
87
88static struct platform_device scif3_device = {
89 .name = "sh-sci",
90 .id = 3,
91 .dev = {
92 .platform_data = &scif3_platform_data,
93 },
94};
95
96static struct plat_sci_port scif4_platform_data = {
97 .mapbase = 0xe6c80000,
98 .flags = UPF_BOOT_AUTOCONF,
99 .type = PORT_SCIF,
100 .irqs = { 89, 89, 89, 89 },
101};
102
103static struct platform_device scif4_device = {
104 .name = "sh-sci",
105 .id = 4,
106 .dev = {
107 .platform_data = &scif4_platform_data,
108 },
109};
110
111static struct plat_sci_port scif5_platform_data = {
112 .mapbase = 0xe6cb0000,
113 .flags = UPF_BOOT_AUTOCONF,
114 .type = PORT_SCIF,
115 .irqs = { 90, 90, 90, 90 },
116};
117
118static struct platform_device scif5_device = {
119 .name = "sh-sci",
120 .id = 5,
121 .dev = {
122 .platform_data = &scif5_platform_data,
123 },
124};
125
126static struct plat_sci_port scif6_platform_data = {
127 .mapbase = 0xe6c30000,
128 .flags = UPF_BOOT_AUTOCONF,
129 .type = PORT_SCIF,
130 .irqs = { 91, 91, 91, 91 },
131};
132
133static struct platform_device scif6_device = {
134 .name = "sh-sci",
135 .id = 6,
136 .dev = {
137 .platform_data = &scif6_platform_data,
138 },
139};
140
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000141/* CMT */
Magnus Damm2b7eda62010-02-05 11:14:58 +0000142static struct sh_timer_config cmt10_platform_data = {
143 .name = "CMT10",
144 .channel_offset = 0x10,
145 .timer_bit = 0,
Magnus Damm495b3ce2010-05-12 14:21:34 +0000146 .clk = "cmt1",
Magnus Damm2b7eda62010-02-05 11:14:58 +0000147 .clockevent_rating = 125,
148 .clocksource_rating = 125,
149};
150
151static struct resource cmt10_resources[] = {
152 [0] = {
153 .name = "CMT10",
154 .start = 0xe6138010,
155 .end = 0xe613801b,
156 .flags = IORESOURCE_MEM,
157 },
158 [1] = {
159 .start = 72,
160 .flags = IORESOURCE_IRQ,
161 },
162};
163
164static struct platform_device cmt10_device = {
165 .name = "sh_cmt",
166 .id = 10,
167 .dev = {
168 .platform_data = &cmt10_platform_data,
169 },
170 .resource = cmt10_resources,
171 .num_resources = ARRAY_SIZE(cmt10_resources),
172};
173
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000174/* I2C */
175static struct resource iic0_resources[] = {
176 [0] = {
177 .name = "IIC0",
178 .start = 0xFFF20000,
179 .end = 0xFFF20425 - 1,
180 .flags = IORESOURCE_MEM,
181 },
182 [1] = {
183 .start = intcs_evt2irq(0xe00),
184 .end = intcs_evt2irq(0xe60),
185 .flags = IORESOURCE_IRQ,
186 },
187};
188
189static struct platform_device iic0_device = {
190 .name = "i2c-sh_mobile",
191 .id = 0, /* "i2c0" clock */
192 .num_resources = ARRAY_SIZE(iic0_resources),
193 .resource = iic0_resources,
194};
195
196static struct resource iic1_resources[] = {
197 [0] = {
198 .name = "IIC1",
199 .start = 0xE6C20000,
200 .end = 0xE6C20425 - 1,
201 .flags = IORESOURCE_MEM,
202 },
203 [1] = {
204 .start = 44,
205 .end = 47,
206 .flags = IORESOURCE_IRQ,
207 },
208};
209
210static struct platform_device iic1_device = {
211 .name = "i2c-sh_mobile",
212 .id = 1, /* "i2c1" clock */
213 .num_resources = ARRAY_SIZE(iic1_resources),
214 .resource = iic1_resources,
215};
216
Magnus Damm2b7eda62010-02-05 11:14:58 +0000217static struct platform_device *sh7372_early_devices[] __initdata = {
218 &scif0_device,
219 &scif1_device,
220 &scif2_device,
221 &scif3_device,
222 &scif4_device,
223 &scif5_device,
224 &scif6_device,
225 &cmt10_device,
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000226 &iic0_device,
227 &iic1_device,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000228};
229
230void __init sh7372_add_standard_devices(void)
231{
232 platform_add_devices(sh7372_early_devices,
233 ARRAY_SIZE(sh7372_early_devices));
234}
235
Magnus Damm2b7eda62010-02-05 11:14:58 +0000236void __init sh7372_add_early_devices(void)
237{
Magnus Damm2b7eda62010-02-05 11:14:58 +0000238 early_platform_add_devices(sh7372_early_devices,
239 ARRAY_SIZE(sh7372_early_devices));
240}