Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / arch / sh / kernel / cpu / sh2a / setup-sh7203.c
blob779490577bae89096dc5752f7d7eda032c9159f0
1 /*
2 * SH7203 and SH7263 Setup
4 * Copyright (C) 2007 Paul Mundt
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10 #include <linux/platform_device.h>
11 #include <linux/init.h>
12 #include <linux/serial.h>
13 <<<<<<< HEAD:arch/sh/kernel/cpu/sh2a/setup-sh7203.c
14 #include <asm/sci.h>
15 =======
16 #include <linux/serial_sci.h>
17 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sh/kernel/cpu/sh2a/setup-sh7203.c
19 enum {
20 UNUSED = 0,
22 /* interrupt sources */
23 IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
24 PINT0, PINT1, PINT2, PINT3, PINT4, PINT5, PINT6, PINT7,
25 DMAC0_DEI, DMAC0_HEI, DMAC1_DEI, DMAC1_HEI,
26 DMAC2_DEI, DMAC2_HEI, DMAC3_DEI, DMAC3_HEI,
27 DMAC4_DEI, DMAC4_HEI, DMAC5_DEI, DMAC5_HEI,
28 DMAC6_DEI, DMAC6_HEI, DMAC7_DEI, DMAC7_HEI,
29 USB, LCDC, CMT0, CMT1, BSC, WDT,
30 MTU2_TGI0A, MTU2_TGI0B, MTU2_TGI0C, MTU2_TGI0D,
31 MTU2_TCI0V, MTU2_TGI0E, MTU2_TGI0F,
32 MTU2_TGI1A, MTU2_TGI1B, MTU2_TCI1V, MTU2_TCI1U,
33 MTU2_TGI2A, MTU2_TGI2B, MTU2_TCI2V, MTU2_TCI2U,
34 MTU2_TGI3A, MTU2_TGI3B, MTU2_TGI3C, MTU2_TGI3D, MTU2_TCI3V,
35 MTU2_TGI4A, MTU2_TGI4B, MTU2_TGI4C, MTU2_TGI4D, MTU2_TCI4V,
36 ADC_ADI,
37 IIC30_STPI, IIC30_NAKI, IIC30_RXI, IIC30_TXI, IIC30_TEI,
38 IIC31_STPI, IIC31_NAKI, IIC31_RXI, IIC31_TXI, IIC31_TEI,
39 IIC32_STPI, IIC32_NAKI, IIC32_RXI, IIC32_TXI, IIC32_TEI,
40 IIC33_STPI, IIC33_NAKI, IIC33_RXI, IIC33_TXI, IIC33_TEI,
41 SCIF0_BRI, SCIF0_ERI, SCIF0_RXI, SCIF0_TXI,
42 SCIF1_BRI, SCIF1_ERI, SCIF1_RXI, SCIF1_TXI,
43 SCIF2_BRI, SCIF2_ERI, SCIF2_RXI, SCIF2_TXI,
44 SCIF3_BRI, SCIF3_ERI, SCIF3_RXI, SCIF3_TXI,
45 SSU0_SSERI, SSU0_SSRXI, SSU0_SSTXI,
46 SSU1_SSERI, SSU1_SSRXI, SSU1_SSTXI,
47 SSI0_SSII, SSI1_SSII, SSI2_SSII, SSI3_SSII,
49 /* ROM-DEC, SDHI, SRC, and IEB are SH7263 specific */
50 ROMDEC_ISY, ROMDEC_IERR, ROMDEC_IARG, ROMDEC_ISEC, ROMDEC_IBUF,
51 ROMDEC_IREADY,
53 FLCTL_FLSTEI, FLCTL_FLTENDI, FLCTL_FLTREQ0I, FLCTL_FLTREQ1I,
55 SDHI3, SDHI0, SDHI1,
57 RTC_ARM, RTC_PRD, RTC_CUP,
58 RCAN0_ERS, RCAN0_OVR, RCAN0_RM0, RCAN0_RM1, RCAN0_SLE,
59 RCAN1_ERS, RCAN1_OVR, RCAN1_RM0, RCAN1_RM1, RCAN1_SLE,
61 SRC_OVF, SRC_ODFI, SRC_IDEI, IEBI,
63 /* interrupt groups */
64 PINT, DMAC0, DMAC1, DMAC2, DMAC3, DMAC4, DMAC5, DMAC6, DMAC7,
65 MTU0_ABCD, MTU0_VEF, MTU1_AB, MTU1_VU, MTU2_AB, MTU2_VU,
66 MTU3_ABCD, MTU4_ABCD,
67 IIC30, IIC31, IIC32, IIC33, SCIF0, SCIF1, SCIF2, SCIF3,
68 SSU0, SSU1, ROMDEC, SDHI, FLCTL, RTC, RCAN0, RCAN1, SRC
71 static struct intc_vect vectors[] __initdata = {
72 INTC_IRQ(IRQ0, 64), INTC_IRQ(IRQ1, 65),
73 INTC_IRQ(IRQ2, 66), INTC_IRQ(IRQ3, 67),
74 INTC_IRQ(IRQ4, 68), INTC_IRQ(IRQ5, 69),
75 INTC_IRQ(IRQ6, 70), INTC_IRQ(IRQ7, 71),
76 INTC_IRQ(PINT0, 80), INTC_IRQ(PINT1, 81),
77 INTC_IRQ(PINT2, 82), INTC_IRQ(PINT3, 83),
78 INTC_IRQ(PINT4, 84), INTC_IRQ(PINT5, 85),
79 INTC_IRQ(PINT6, 86), INTC_IRQ(PINT7, 87),
80 INTC_IRQ(DMAC0_DEI, 108), INTC_IRQ(DMAC0_HEI, 109),
81 INTC_IRQ(DMAC1_DEI, 112), INTC_IRQ(DMAC1_HEI, 113),
82 INTC_IRQ(DMAC2_DEI, 116), INTC_IRQ(DMAC2_HEI, 117),
83 INTC_IRQ(DMAC3_DEI, 120), INTC_IRQ(DMAC3_HEI, 121),
84 INTC_IRQ(DMAC4_DEI, 124), INTC_IRQ(DMAC4_HEI, 125),
85 INTC_IRQ(DMAC5_DEI, 128), INTC_IRQ(DMAC5_HEI, 129),
86 INTC_IRQ(DMAC6_DEI, 132), INTC_IRQ(DMAC6_HEI, 133),
87 INTC_IRQ(DMAC7_DEI, 136), INTC_IRQ(DMAC7_HEI, 137),
88 INTC_IRQ(USB, 140), INTC_IRQ(LCDC, 141),
89 INTC_IRQ(CMT0, 142), INTC_IRQ(CMT1, 143),
90 INTC_IRQ(BSC, 144), INTC_IRQ(WDT, 145),
91 INTC_IRQ(MTU2_TGI0A, 146), INTC_IRQ(MTU2_TGI0B, 147),
92 INTC_IRQ(MTU2_TGI0C, 148), INTC_IRQ(MTU2_TGI0D, 149),
93 INTC_IRQ(MTU2_TCI0V, 150),
94 INTC_IRQ(MTU2_TGI0E, 151), INTC_IRQ(MTU2_TGI0F, 152),
95 INTC_IRQ(MTU2_TGI1A, 153), INTC_IRQ(MTU2_TGI1B, 154),
96 INTC_IRQ(MTU2_TCI1V, 155), INTC_IRQ(MTU2_TCI1U, 156),
97 INTC_IRQ(MTU2_TGI2A, 157), INTC_IRQ(MTU2_TGI2B, 158),
98 INTC_IRQ(MTU2_TCI2V, 159), INTC_IRQ(MTU2_TCI2U, 160),
99 INTC_IRQ(MTU2_TGI3A, 161), INTC_IRQ(MTU2_TGI3B, 162),
100 INTC_IRQ(MTU2_TGI3C, 163), INTC_IRQ(MTU2_TGI3D, 164),
101 INTC_IRQ(MTU2_TCI3V, 165),
102 INTC_IRQ(MTU2_TGI4A, 166), INTC_IRQ(MTU2_TGI4B, 167),
103 INTC_IRQ(MTU2_TGI4C, 168), INTC_IRQ(MTU2_TGI4D, 169),
104 INTC_IRQ(MTU2_TCI4V, 170),
105 INTC_IRQ(ADC_ADI, 171),
106 INTC_IRQ(IIC30_STPI, 172), INTC_IRQ(IIC30_NAKI, 173),
107 INTC_IRQ(IIC30_RXI, 174), INTC_IRQ(IIC30_TXI, 175),
108 INTC_IRQ(IIC30_TEI, 176),
109 INTC_IRQ(IIC31_STPI, 177), INTC_IRQ(IIC31_NAKI, 178),
110 INTC_IRQ(IIC31_RXI, 179), INTC_IRQ(IIC31_TXI, 180),
111 INTC_IRQ(IIC31_TEI, 181),
112 INTC_IRQ(IIC32_STPI, 182), INTC_IRQ(IIC32_NAKI, 183),
113 INTC_IRQ(IIC32_RXI, 184), INTC_IRQ(IIC32_TXI, 185),
114 INTC_IRQ(IIC32_TEI, 186),
115 INTC_IRQ(IIC33_STPI, 187), INTC_IRQ(IIC33_NAKI, 188),
116 INTC_IRQ(IIC33_RXI, 189), INTC_IRQ(IIC33_TXI, 190),
117 INTC_IRQ(IIC33_TEI, 191),
118 INTC_IRQ(SCIF0_BRI, 192), INTC_IRQ(SCIF0_ERI, 193),
119 INTC_IRQ(SCIF0_RXI, 194), INTC_IRQ(SCIF0_TXI, 195),
120 INTC_IRQ(SCIF1_BRI, 196), INTC_IRQ(SCIF1_ERI, 197),
121 INTC_IRQ(SCIF1_RXI, 198), INTC_IRQ(SCIF1_TXI, 199),
122 INTC_IRQ(SCIF2_BRI, 200), INTC_IRQ(SCIF2_ERI, 201),
123 INTC_IRQ(SCIF2_RXI, 202), INTC_IRQ(SCIF2_TXI, 203),
124 INTC_IRQ(SCIF3_BRI, 204), INTC_IRQ(SCIF3_ERI, 205),
125 INTC_IRQ(SCIF3_RXI, 206), INTC_IRQ(SCIF3_TXI, 207),
126 INTC_IRQ(SSU0_SSERI, 208), INTC_IRQ(SSU0_SSRXI, 209),
127 INTC_IRQ(SSU0_SSTXI, 210),
128 INTC_IRQ(SSU1_SSERI, 211), INTC_IRQ(SSU1_SSRXI, 212),
129 INTC_IRQ(SSU1_SSTXI, 213),
130 INTC_IRQ(SSI0_SSII, 214), INTC_IRQ(SSI1_SSII, 215),
131 INTC_IRQ(SSI2_SSII, 216), INTC_IRQ(SSI3_SSII, 217),
132 INTC_IRQ(FLCTL_FLSTEI, 224), INTC_IRQ(FLCTL_FLTENDI, 225),
133 INTC_IRQ(FLCTL_FLTREQ0I, 226), INTC_IRQ(FLCTL_FLTREQ1I, 227),
134 INTC_IRQ(RTC_ARM, 231), INTC_IRQ(RTC_PRD, 232),
135 INTC_IRQ(RTC_CUP, 233),
136 INTC_IRQ(RCAN0_ERS, 234), INTC_IRQ(RCAN0_OVR, 235),
137 INTC_IRQ(RCAN0_RM0, 236), INTC_IRQ(RCAN0_RM1, 237),
138 INTC_IRQ(RCAN0_SLE, 238),
139 INTC_IRQ(RCAN1_ERS, 239), INTC_IRQ(RCAN1_OVR, 240),
140 INTC_IRQ(RCAN1_RM0, 241), INTC_IRQ(RCAN1_RM1, 242),
141 INTC_IRQ(RCAN1_SLE, 243),
143 /* SH7263-specific trash */
144 #ifdef CONFIG_CPU_SUBTYPE_SH7263
145 INTC_IRQ(ROMDEC_ISY, 218), INTC_IRQ(ROMDEC_IERR, 219),
146 INTC_IRQ(ROMDEC_IARG, 220), INTC_IRQ(ROMDEC_ISEC, 221),
147 INTC_IRQ(ROMDEC_IBUF, 222), INTC_IRQ(ROMDEC_IREADY, 223),
149 INTC_IRQ(SDHI3, 228), INTC_IRQ(SDHI0, 229), INTC_IRQ(SDHI1, 230),
151 INTC_IRQ(SRC_OVF, 244), INTC_IRQ(SRC_ODFI, 245),
152 INTC_IRQ(SRC_IDEI, 246),
154 INTC_IRQ(IEBI, 247),
155 #endif
158 static struct intc_group groups[] __initdata = {
159 INTC_GROUP(PINT, PINT0, PINT1, PINT2, PINT3,
160 PINT4, PINT5, PINT6, PINT7),
161 INTC_GROUP(DMAC0, DMAC0_DEI, DMAC0_HEI),
162 INTC_GROUP(DMAC1, DMAC1_DEI, DMAC1_HEI),
163 INTC_GROUP(DMAC2, DMAC2_DEI, DMAC2_HEI),
164 INTC_GROUP(DMAC3, DMAC3_DEI, DMAC3_HEI),
165 INTC_GROUP(DMAC4, DMAC4_DEI, DMAC4_HEI),
166 INTC_GROUP(DMAC5, DMAC5_DEI, DMAC5_HEI),
167 INTC_GROUP(DMAC6, DMAC6_DEI, DMAC6_HEI),
168 INTC_GROUP(DMAC7, DMAC7_DEI, DMAC7_HEI),
169 INTC_GROUP(MTU0_ABCD, MTU2_TGI0A, MTU2_TGI0B, MTU2_TGI0C, MTU2_TGI0D),
170 INTC_GROUP(MTU0_VEF, MTU2_TCI0V, MTU2_TGI0E, MTU2_TGI0F),
171 INTC_GROUP(MTU1_AB, MTU2_TGI1A, MTU2_TGI1B),
172 INTC_GROUP(MTU1_VU, MTU2_TCI1V, MTU2_TCI1U),
173 INTC_GROUP(MTU2_AB, MTU2_TGI2A, MTU2_TGI2B),
174 INTC_GROUP(MTU2_VU, MTU2_TCI2V, MTU2_TCI2U),
175 INTC_GROUP(MTU3_ABCD, MTU2_TGI3A, MTU2_TGI3B, MTU2_TGI3C, MTU2_TGI3D),
176 INTC_GROUP(MTU4_ABCD, MTU2_TGI4A, MTU2_TGI4B, MTU2_TGI4C, MTU2_TGI4D),
177 INTC_GROUP(IIC30, IIC30_STPI, IIC30_NAKI, IIC30_RXI, IIC30_TXI,
178 IIC30_TEI),
179 INTC_GROUP(IIC31, IIC31_STPI, IIC31_NAKI, IIC31_RXI, IIC31_TXI,
180 IIC31_TEI),
181 INTC_GROUP(IIC32, IIC32_STPI, IIC32_NAKI, IIC32_RXI, IIC32_TXI,
182 IIC32_TEI),
183 INTC_GROUP(IIC33, IIC33_STPI, IIC33_NAKI, IIC33_RXI, IIC33_TXI,
184 IIC33_TEI),
185 INTC_GROUP(SCIF0, SCIF0_BRI, SCIF0_ERI, SCIF0_RXI, SCIF0_TXI),
186 INTC_GROUP(SCIF1, SCIF1_BRI, SCIF1_ERI, SCIF1_RXI, SCIF1_TXI),
187 INTC_GROUP(SCIF2, SCIF2_BRI, SCIF2_ERI, SCIF2_RXI, SCIF2_TXI),
188 INTC_GROUP(SCIF3, SCIF3_BRI, SCIF3_ERI, SCIF3_RXI, SCIF3_TXI),
189 INTC_GROUP(SSU0, SSU0_SSERI, SSU0_SSRXI, SSU0_SSTXI),
190 INTC_GROUP(SSU1, SSU1_SSERI, SSU1_SSRXI, SSU1_SSTXI),
191 INTC_GROUP(FLCTL, FLCTL_FLSTEI, FLCTL_FLTENDI, FLCTL_FLTREQ0I,
192 FLCTL_FLTREQ1I),
193 INTC_GROUP(RTC, RTC_ARM, RTC_PRD, RTC_CUP),
194 INTC_GROUP(RCAN0, RCAN0_ERS, RCAN0_OVR, RCAN0_RM0, RCAN0_RM1,
195 RCAN0_SLE),
196 INTC_GROUP(RCAN1, RCAN1_ERS, RCAN1_OVR, RCAN1_RM0, RCAN1_RM1,
197 RCAN1_SLE),
199 #ifdef CONFIG_CPU_SUBTYPE_SH7263
200 INTC_GROUP(ROMDEC, ROMDEC_ISY, ROMDEC_IERR, ROMDEC_IARG,
201 ROMDEC_ISEC, ROMDEC_IBUF, ROMDEC_IREADY),
202 INTC_GROUP(SDHI, SDHI3, SDHI0, SDHI1),
203 INTC_GROUP(SRC, SRC_OVF, SRC_ODFI, SRC_IDEI),
204 #endif
207 static struct intc_prio_reg prio_registers[] __initdata = {
208 { 0xfffe0818, 0, 16, 4, /* IPR01 */ { IRQ0, IRQ1, IRQ2, IRQ3 } },
209 { 0xfffe081a, 0, 16, 4, /* IPR02 */ { IRQ4, IRQ5, IRQ6, IRQ7 } },
210 { 0xfffe0820, 0, 16, 4, /* IPR05 */ { PINT, 0, 0, 0 } },
211 { 0xfffe0c00, 0, 16, 4, /* IPR06 */ { DMAC0, DMAC1, DMAC2, DMAC3 } },
212 { 0xfffe0c02, 0, 16, 4, /* IPR07 */ { DMAC4, DMAC5, DMAC6, DMAC7 } },
213 { 0xfffe0c04, 0, 16, 4, /* IPR08 */ { USB, LCDC, CMT0, CMT1 } },
214 { 0xfffe0c06, 0, 16, 4, /* IPR09 */ { BSC, WDT, MTU0_ABCD, MTU0_VEF } },
215 { 0xfffe0c08, 0, 16, 4, /* IPR10 */ { MTU1_AB, MTU1_VU, MTU2_AB,
216 MTU2_VU } },
217 { 0xfffe0c0a, 0, 16, 4, /* IPR11 */ { MTU3_ABCD, MTU2_TCI3V, MTU4_ABCD,
218 MTU2_TCI4V } },
219 { 0xfffe0c0c, 0, 16, 4, /* IPR12 */ { ADC_ADI, IIC30, IIC31, IIC32 } },
220 { 0xfffe0c0e, 0, 16, 4, /* IPR13 */ { IIC33, SCIF0, SCIF1, SCIF2 } },
221 { 0xfffe0c10, 0, 16, 4, /* IPR14 */ { SCIF3, SSU0, SSU1, SSI0_SSII } },
222 #ifdef CONFIG_CPU_SUBTYPE_SH7203
223 { 0xfffe0c12, 0, 16, 4, /* IPR15 */ { SSI1_SSII, SSI2_SSII,
224 SSI3_SSII, 0 } },
225 { 0xfffe0c14, 0, 16, 4, /* IPR16 */ { FLCTL, 0, RTC, RCAN0 } },
226 { 0xfffe0c16, 0, 16, 4, /* IPR17 */ { RCAN1, 0, 0, 0 } },
227 #else
228 { 0xfffe0c12, 0, 16, 4, /* IPR15 */ { SSI1_SSII, SSI2_SSII,
229 SSI3_SSII, ROMDEC } },
230 { 0xfffe0c14, 0, 16, 4, /* IPR16 */ { FLCTL, SDHI, RTC, RCAN0 } },
231 { 0xfffe0c16, 0, 16, 4, /* IPR17 */ { RCAN1, SRC, IEBI, 0 } },
232 #endif
235 static struct intc_mask_reg mask_registers[] __initdata = {
236 { 0xfffe0808, 0, 16, /* PINTER */
237 { 0, 0, 0, 0, 0, 0, 0, 0,
238 PINT7, PINT6, PINT5, PINT4, PINT3, PINT2, PINT1, PINT0 } },
241 static DECLARE_INTC_DESC(intc_desc, "sh7203", vectors, groups,
242 mask_registers, prio_registers, NULL);
244 static struct plat_sci_port sci_platform_data[] = {
246 .mapbase = 0xfffe8000,
247 .flags = UPF_BOOT_AUTOCONF,
248 .type = PORT_SCIF,
249 .irqs = { 193, 194, 195, 192 },
250 }, {
251 .mapbase = 0xfffe8800,
252 .flags = UPF_BOOT_AUTOCONF,
253 .type = PORT_SCIF,
254 .irqs = { 197, 198, 199, 196 },
255 }, {
256 .mapbase = 0xfffe9000,
257 .flags = UPF_BOOT_AUTOCONF,
258 .type = PORT_SCIF,
259 .irqs = { 201, 202, 203, 200 },
260 }, {
261 .mapbase = 0xfffe9800,
262 .flags = UPF_BOOT_AUTOCONF,
263 .type = PORT_SCIF,
264 .irqs = { 205, 206, 207, 204 },
265 }, {
266 .flags = 0,
270 static struct platform_device sci_device = {
271 .name = "sh-sci",
272 .id = -1,
273 .dev = {
274 .platform_data = sci_platform_data,
278 static struct resource rtc_resources[] = {
279 [0] = {
280 .start = 0xffff2000,
281 .end = 0xffff2000 + 0x58 - 1,
282 .flags = IORESOURCE_IO,
284 [1] = {
285 /* Period IRQ */
286 .start = 232,
287 .flags = IORESOURCE_IRQ,
289 [2] = {
290 /* Carry IRQ */
291 .start = 233,
292 .flags = IORESOURCE_IRQ,
294 [3] = {
295 /* Alarm IRQ */
296 .start = 231,
297 .flags = IORESOURCE_IRQ,
301 static struct platform_device rtc_device = {
302 .name = "sh-rtc",
303 .id = -1,
304 .num_resources = ARRAY_SIZE(rtc_resources),
305 .resource = rtc_resources,
308 static struct platform_device *sh7203_devices[] __initdata = {
309 &sci_device,
310 &rtc_device,
313 static int __init sh7203_devices_setup(void)
315 return platform_add_devices(sh7203_devices,
316 ARRAY_SIZE(sh7203_devices));
318 __initcall(sh7203_devices_setup);
320 void __init plat_irq_setup(void)
322 register_intc_controller(&intc_desc);