]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - arch/sh/kernel/cpu/sh3/setup-sh7705.c
sh: sh3: Change the specification method of IRQ to SCIx_IRQ_MUXED
[mirror_ubuntu-artful-kernel.git] / arch / sh / kernel / cpu / sh3 / setup-sh7705.c
CommitLineData
7dec62e9
PM
1/*
2 * SH7705 Setup
3 *
0caedb02 4 * Copyright (C) 2006 - 2009 Paul Mundt
2a8ff459 5 * Copyright (C) 2007 Nobuhiro Iwamatsu
7dec62e9
PM
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#include <linux/platform_device.h>
12#include <linux/init.h>
70e8be0a 13#include <linux/irq.h>
7dec62e9 14#include <linux/serial.h>
96de1a8f 15#include <linux/serial_sci.h>
acd664ab 16#include <linux/sh_timer.h>
ad89f87a 17#include <asm/rtc.h>
61a6976b 18#include <cpu/serial.h>
7dec62e9 19
ad89f87a 20enum {
70e8be0a
MD
21 UNUSED = 0,
22
23 /* interrupt sources */
24 IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5,
25 PINT07, PINT815,
0caedb02
PM
26
27 DMAC, SCIF0, SCIF2, ADC_ADI, USB,
28
70e8be0a 29 TPU0, TPU1, TPU2, TPU3,
0caedb02 30 TMU0, TMU1, TMU2,
70e8be0a 31
0caedb02 32 RTC, WDT, REF_RCMI,
70e8be0a
MD
33};
34
5c37e025 35static struct intc_vect vectors[] __initdata = {
a276e588 36 /* IRQ0->5 are handled in setup-sh3.c */
70e8be0a 37 INTC_VECT(PINT07, 0x700), INTC_VECT(PINT815, 0x720),
0caedb02
PM
38 INTC_VECT(DMAC, 0x800), INTC_VECT(DMAC, 0x820),
39 INTC_VECT(DMAC, 0x840), INTC_VECT(DMAC, 0x860),
40 INTC_VECT(SCIF0, 0x880), INTC_VECT(SCIF0, 0x8a0),
41 INTC_VECT(SCIF0, 0x8e0),
42 INTC_VECT(SCIF2, 0x900), INTC_VECT(SCIF2, 0x920),
43 INTC_VECT(SCIF2, 0x960),
70e8be0a 44 INTC_VECT(ADC_ADI, 0x980),
0caedb02 45 INTC_VECT(USB, 0xa20), INTC_VECT(USB, 0xa40),
70e8be0a 46 INTC_VECT(TPU0, 0xc00), INTC_VECT(TPU1, 0xc20),
65c07d4b 47 INTC_VECT(TPU2, 0xc80), INTC_VECT(TPU3, 0xca0),
70e8be0a 48 INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
0caedb02
PM
49 INTC_VECT(TMU2, 0x440), INTC_VECT(TMU2, 0x460),
50 INTC_VECT(RTC, 0x480), INTC_VECT(RTC, 0x4a0),
51 INTC_VECT(RTC, 0x4c0),
70e8be0a
MD
52 INTC_VECT(WDT, 0x560),
53 INTC_VECT(REF_RCMI, 0x580),
54};
55
5c37e025 56static struct intc_prio_reg prio_registers[] __initdata = {
6ef5fb2c
MD
57 { 0xfffffee2, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, RTC } },
58 { 0xfffffee4, 0, 16, 4, /* IPRB */ { WDT, REF_RCMI, 0, 0 } },
59 { 0xa4000016, 0, 16, 4, /* IPRC */ { IRQ3, IRQ2, IRQ1, IRQ0 } },
60 { 0xa4000018, 0, 16, 4, /* IPRD */ { PINT07, PINT815, IRQ5, IRQ4 } },
61 { 0xa400001a, 0, 16, 4, /* IPRE */ { DMAC, SCIF0, SCIF2, ADC_ADI } },
62 { 0xa4080000, 0, 16, 4, /* IPRF */ { 0, 0, USB } },
63 { 0xa4080002, 0, 16, 4, /* IPRG */ { TPU0, TPU1 } },
64 { 0xa4080004, 0, 16, 4, /* IPRH */ { TPU2, TPU3 } },
70e8be0a
MD
65
66};
67
0caedb02 68static DECLARE_INTC_DESC(intc_desc, "sh7705", vectors, NULL,
7f3edee8 69 NULL, prio_registers, NULL);
70e8be0a 70
44658dfb
MD
71static struct plat_sci_port scif0_platform_data = {
72 .mapbase = 0xa4410000,
73 .flags = UPF_BOOT_AUTOCONF,
f43dc23d
PM
74 .scscr = SCSCR_TIE | SCSCR_RIE | SCSCR_TE |
75 SCSCR_RE | SCSCR_CKE1 | SCSCR_CKE0,
76 .scbrr_algo_id = SCBRR_ALGO_4,
44658dfb 77 .type = PORT_SCIF,
545f3bcf 78 .irqs = SCIx_IRQ_MUXED(evt2irq(0x900)),
61a6976b
PM
79 .ops = &sh770x_sci_port_ops,
80 .regtype = SCIx_SH7705_SCIF_REGTYPE,
44658dfb
MD
81};
82
83static struct platform_device scif0_device = {
7dec62e9 84 .name = "sh-sci",
44658dfb
MD
85 .id = 0,
86 .dev = {
87 .platform_data = &scif0_platform_data,
88 },
89};
90
91static struct plat_sci_port scif1_platform_data = {
92 .mapbase = 0xa4400000,
93 .flags = UPF_BOOT_AUTOCONF,
f43dc23d
PM
94 .scscr = SCSCR_TIE | SCSCR_RIE | SCSCR_TE | SCSCR_RE,
95 .scbrr_algo_id = SCBRR_ALGO_4,
44658dfb 96 .type = PORT_SCIF,
545f3bcf 97 .irqs = SCIx_IRQ_MUXED(evt2irq(0x880)),
61a6976b
PM
98 .ops = &sh770x_sci_port_ops,
99 .regtype = SCIx_SH7705_SCIF_REGTYPE,
44658dfb
MD
100};
101
102static struct platform_device scif1_device = {
103 .name = "sh-sci",
104 .id = 1,
7dec62e9 105 .dev = {
44658dfb 106 .platform_data = &scif1_platform_data,
7dec62e9
PM
107 },
108};
109
70e8be0a
MD
110static struct resource rtc_resources[] = {
111 [0] = {
112 .start = 0xfffffec0,
113 .end = 0xfffffec0 + 0x1e,
114 .flags = IORESOURCE_IO,
115 },
116 [1] = {
117 .start = 20,
118 .flags = IORESOURCE_IRQ,
119 },
70e8be0a
MD
120};
121
ad89f87a
PM
122static struct sh_rtc_platform_info rtc_info = {
123 .capabilities = RTC_CAP_4_DIGIT_YEAR,
124};
125
70e8be0a
MD
126static struct platform_device rtc_device = {
127 .name = "sh-rtc",
128 .id = -1,
129 .num_resources = ARRAY_SIZE(rtc_resources),
130 .resource = rtc_resources,
ad89f87a
PM
131 .dev = {
132 .platform_data = &rtc_info,
133 },
70e8be0a
MD
134};
135
acd664ab 136static struct sh_timer_config tmu0_platform_data = {
acd664ab
MD
137 .channel_offset = 0x02,
138 .timer_bit = 0,
acd664ab
MD
139 .clockevent_rating = 200,
140};
141
142static struct resource tmu0_resources[] = {
143 [0] = {
acd664ab
MD
144 .start = 0xfffffe94,
145 .end = 0xfffffe9f,
146 .flags = IORESOURCE_MEM,
147 },
148 [1] = {
149 .start = 16,
150 .flags = IORESOURCE_IRQ,
151 },
152};
153
154static struct platform_device tmu0_device = {
155 .name = "sh_tmu",
156 .id = 0,
157 .dev = {
158 .platform_data = &tmu0_platform_data,
159 },
160 .resource = tmu0_resources,
161 .num_resources = ARRAY_SIZE(tmu0_resources),
162};
163
164static struct sh_timer_config tmu1_platform_data = {
acd664ab
MD
165 .channel_offset = 0xe,
166 .timer_bit = 1,
acd664ab
MD
167 .clocksource_rating = 200,
168};
169
170static struct resource tmu1_resources[] = {
171 [0] = {
acd664ab
MD
172 .start = 0xfffffea0,
173 .end = 0xfffffeab,
174 .flags = IORESOURCE_MEM,
175 },
176 [1] = {
177 .start = 17,
178 .flags = IORESOURCE_IRQ,
179 },
180};
181
182static struct platform_device tmu1_device = {
183 .name = "sh_tmu",
184 .id = 1,
185 .dev = {
186 .platform_data = &tmu1_platform_data,
187 },
188 .resource = tmu1_resources,
189 .num_resources = ARRAY_SIZE(tmu1_resources),
190};
191
192static struct sh_timer_config tmu2_platform_data = {
acd664ab
MD
193 .channel_offset = 0x1a,
194 .timer_bit = 2,
acd664ab
MD
195};
196
197static struct resource tmu2_resources[] = {
198 [0] = {
acd664ab
MD
199 .start = 0xfffffeac,
200 .end = 0xfffffebb,
201 .flags = IORESOURCE_MEM,
202 },
203 [1] = {
204 .start = 18,
205 .flags = IORESOURCE_IRQ,
206 },
207};
208
209static struct platform_device tmu2_device = {
210 .name = "sh_tmu",
211 .id = 2,
212 .dev = {
213 .platform_data = &tmu2_platform_data,
214 },
215 .resource = tmu2_resources,
216 .num_resources = ARRAY_SIZE(tmu2_resources),
217};
218
7dec62e9 219static struct platform_device *sh7705_devices[] __initdata = {
44658dfb
MD
220 &scif0_device,
221 &scif1_device,
acd664ab
MD
222 &tmu0_device,
223 &tmu1_device,
224 &tmu2_device,
70e8be0a 225 &rtc_device,
7dec62e9
PM
226};
227
228static int __init sh7705_devices_setup(void)
229{
230 return platform_add_devices(sh7705_devices,
231 ARRAY_SIZE(sh7705_devices));
232}
ba9a6337 233arch_initcall(sh7705_devices_setup);
2a8ff459 234
acd664ab 235static struct platform_device *sh7705_early_devices[] __initdata = {
44658dfb
MD
236 &scif0_device,
237 &scif1_device,
acd664ab
MD
238 &tmu0_device,
239 &tmu1_device,
240 &tmu2_device,
241};
242
243void __init plat_early_device_setup(void)
244{
245 early_platform_add_devices(sh7705_early_devices,
246 ARRAY_SIZE(sh7705_early_devices));
247}
248
90015c89 249void __init plat_irq_setup(void)
2a8ff459 250{
70e8be0a 251 register_intc_controller(&intc_desc);
a276e588 252 plat_irq_setup_sh3();
2a8ff459 253}