blob: 55df21add2d43979d334c8f0ebf99f9395113182 [file] [log] [blame]
Magnus Dammf411fad2011-12-14 01:36:12 +09001/*
2 * r8a7779 processor support
3 *
4 * Copyright (C) 2011 Renesas Solutions Corp.
5 * Copyright (C) 2011 Magnus Damm
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>
Rob Herring250a2722012-01-03 16:57:33 -060032#include <mach/irqs.h>
Magnus Dammf411fad2011-12-14 01:36:12 +090033#include <mach/r8a7779.h>
Magnus Damma662c082012-01-10 15:50:01 +090034#include <mach/common.h>
Magnus Dammf411fad2011-12-14 01:36:12 +090035#include <asm/mach-types.h>
36#include <asm/mach/arch.h>
37
38static struct plat_sci_port scif0_platform_data = {
39 .mapbase = 0xffe40000,
40 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
41 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
42 .scbrr_algo_id = SCBRR_ALGO_2,
43 .type = PORT_SCIF,
44 .irqs = { gic_spi(88), gic_spi(88),
45 gic_spi(88), gic_spi(88) },
46};
47
48static struct platform_device scif0_device = {
49 .name = "sh-sci",
50 .id = 0,
51 .dev = {
52 .platform_data = &scif0_platform_data,
53 },
54};
55
56static struct plat_sci_port scif1_platform_data = {
57 .mapbase = 0xffe41000,
58 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
59 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
60 .scbrr_algo_id = SCBRR_ALGO_2,
61 .type = PORT_SCIF,
62 .irqs = { gic_spi(89), gic_spi(89),
63 gic_spi(89), gic_spi(89) },
64};
65
66static struct platform_device scif1_device = {
67 .name = "sh-sci",
68 .id = 1,
69 .dev = {
70 .platform_data = &scif1_platform_data,
71 },
72};
73
74static struct plat_sci_port scif2_platform_data = {
75 .mapbase = 0xffe42000,
76 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
77 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
78 .scbrr_algo_id = SCBRR_ALGO_2,
79 .type = PORT_SCIF,
80 .irqs = { gic_spi(90), gic_spi(90),
81 gic_spi(90), gic_spi(90) },
82};
83
84static struct platform_device scif2_device = {
85 .name = "sh-sci",
86 .id = 2,
87 .dev = {
88 .platform_data = &scif2_platform_data,
89 },
90};
91
92static struct plat_sci_port scif3_platform_data = {
93 .mapbase = 0xffe43000,
94 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
95 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
96 .scbrr_algo_id = SCBRR_ALGO_2,
97 .type = PORT_SCIF,
98 .irqs = { gic_spi(91), gic_spi(91),
99 gic_spi(91), gic_spi(91) },
100};
101
102static struct platform_device scif3_device = {
103 .name = "sh-sci",
104 .id = 3,
105 .dev = {
106 .platform_data = &scif3_platform_data,
107 },
108};
109
110static struct plat_sci_port scif4_platform_data = {
111 .mapbase = 0xffe44000,
112 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
113 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
114 .scbrr_algo_id = SCBRR_ALGO_2,
115 .type = PORT_SCIF,
116 .irqs = { gic_spi(92), gic_spi(92),
117 gic_spi(92), gic_spi(92) },
118};
119
120static struct platform_device scif4_device = {
121 .name = "sh-sci",
122 .id = 4,
123 .dev = {
124 .platform_data = &scif4_platform_data,
125 },
126};
127
128static struct plat_sci_port scif5_platform_data = {
129 .mapbase = 0xffe45000,
130 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
131 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
132 .scbrr_algo_id = SCBRR_ALGO_2,
133 .type = PORT_SCIF,
134 .irqs = { gic_spi(93), gic_spi(93),
135 gic_spi(93), gic_spi(93) },
136};
137
138static struct platform_device scif5_device = {
139 .name = "sh-sci",
140 .id = 5,
141 .dev = {
142 .platform_data = &scif5_platform_data,
143 },
144};
145
146/* TMU */
147static struct sh_timer_config tmu00_platform_data = {
148 .name = "TMU00",
149 .channel_offset = 0x4,
150 .timer_bit = 0,
151 .clockevent_rating = 200,
152};
153
154static struct resource tmu00_resources[] = {
155 [0] = {
156 .name = "TMU00",
157 .start = 0xffd80008,
158 .end = 0xffd80013,
159 .flags = IORESOURCE_MEM,
160 },
161 [1] = {
162 .start = gic_spi(32),
163 .flags = IORESOURCE_IRQ,
164 },
165};
166
167static struct platform_device tmu00_device = {
168 .name = "sh_tmu",
169 .id = 0,
170 .dev = {
171 .platform_data = &tmu00_platform_data,
172 },
173 .resource = tmu00_resources,
174 .num_resources = ARRAY_SIZE(tmu00_resources),
175};
176
177static struct sh_timer_config tmu01_platform_data = {
178 .name = "TMU01",
179 .channel_offset = 0x10,
180 .timer_bit = 1,
181 .clocksource_rating = 200,
182};
183
184static struct resource tmu01_resources[] = {
185 [0] = {
186 .name = "TMU01",
187 .start = 0xffd80014,
188 .end = 0xffd8001f,
189 .flags = IORESOURCE_MEM,
190 },
191 [1] = {
192 .start = gic_spi(33),
193 .flags = IORESOURCE_IRQ,
194 },
195};
196
197static struct platform_device tmu01_device = {
198 .name = "sh_tmu",
199 .id = 1,
200 .dev = {
201 .platform_data = &tmu01_platform_data,
202 },
203 .resource = tmu01_resources,
204 .num_resources = ARRAY_SIZE(tmu01_resources),
205};
206
207static struct platform_device *r8a7779_early_devices[] __initdata = {
208 &scif0_device,
209 &scif1_device,
210 &scif2_device,
211 &scif3_device,
212 &scif4_device,
213 &scif5_device,
214 &tmu00_device,
215 &tmu01_device,
216};
217
218static struct platform_device *r8a7779_late_devices[] __initdata = {
219};
220
221void __init r8a7779_add_standard_devices(void)
222{
Magnus Damma662c082012-01-10 15:50:01 +0900223 r8a7779_pm_init();
224
225 r8a7779_init_pm_domain(&r8a7779_sh4a);
226 r8a7779_init_pm_domain(&r8a7779_sgx);
227 r8a7779_init_pm_domain(&r8a7779_vdp1);
228 r8a7779_init_pm_domain(&r8a7779_impx3);
229
Magnus Dammf411fad2011-12-14 01:36:12 +0900230 platform_add_devices(r8a7779_early_devices,
231 ARRAY_SIZE(r8a7779_early_devices));
232 platform_add_devices(r8a7779_late_devices,
233 ARRAY_SIZE(r8a7779_late_devices));
234}
235
236void __init r8a7779_add_early_devices(void)
237{
238 early_platform_add_devices(r8a7779_early_devices,
239 ARRAY_SIZE(r8a7779_early_devices));
240}