1234a0538SKuninori Morimoto // SPDX-License-Identifier: GPL-2.0
22825999eSPeter Griffin /*
32825999eSPeter Griffin * SH7201 setup
42825999eSPeter Griffin *
52825999eSPeter Griffin * Copyright (C) 2008 Peter Griffin pgriffin@mpc-data.co.uk
6d55eedd5SPaul Mundt * Copyright (C) 2009 Paul Mundt
72825999eSPeter Griffin */
82825999eSPeter Griffin #include <linux/platform_device.h>
92825999eSPeter Griffin #include <linux/init.h>
102825999eSPeter Griffin #include <linux/serial.h>
112825999eSPeter Griffin #include <linux/serial_sci.h>
1246a12f74SPaul Mundt #include <linux/sh_timer.h>
13da107c6eSMagnus Damm #include <linux/io.h>
14507fd01dSBartosz Golaszewski #include <asm/platform_early.h>
152825999eSPeter Griffin
162825999eSPeter Griffin enum {
172825999eSPeter Griffin UNUSED = 0,
182825999eSPeter Griffin
192825999eSPeter Griffin /* interrupt sources */
202825999eSPeter Griffin IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
212825999eSPeter Griffin PINT0, PINT1, PINT2, PINT3, PINT4, PINT5, PINT6, PINT7,
22d55eedd5SPaul Mundt
232825999eSPeter Griffin ADC_ADI,
24d55eedd5SPaul Mundt
25d55eedd5SPaul Mundt MTU20_ABCD, MTU20_VEF, MTU21_AB, MTU21_VU, MTU22_AB, MTU22_VU,
26d55eedd5SPaul Mundt MTU23_ABCD, MTU24_ABCD, MTU25_UVW, MTU2_TCI3V, MTU2_TCI4V,
27d55eedd5SPaul Mundt
28d55eedd5SPaul Mundt RTC, WDT,
29d55eedd5SPaul Mundt
30d55eedd5SPaul Mundt IIC30, IIC31, IIC32,
312825999eSPeter Griffin
322825999eSPeter Griffin DMAC0_DMINT0, DMAC1_DMINT1,
332825999eSPeter Griffin DMAC2_DMINT2, DMAC3_DMINT3,
342825999eSPeter Griffin
35d55eedd5SPaul Mundt SCIF0, SCIF1, SCIF2, SCIF3, SCIF4, SCIF5, SCIF6, SCIF7,
362825999eSPeter Griffin
372825999eSPeter Griffin DMAC0_DMINTA, DMAC4_DMINT4, DMAC5_DMINT5, DMAC6_DMINT6,
382825999eSPeter Griffin DMAC7_DMINT7,
392825999eSPeter Griffin
40d55eedd5SPaul Mundt RCAN0, RCAN1,
412825999eSPeter Griffin
422825999eSPeter Griffin SSI0_SSII, SSI1_SSII,
432825999eSPeter Griffin
44d55eedd5SPaul Mundt TMR0, TMR1,
452825999eSPeter Griffin
462825999eSPeter Griffin /* interrupt groups */
47d55eedd5SPaul Mundt PINT,
482825999eSPeter Griffin };
492825999eSPeter Griffin
502825999eSPeter Griffin static struct intc_vect vectors[] __initdata = {
512825999eSPeter Griffin INTC_IRQ(IRQ0, 64), INTC_IRQ(IRQ1, 65),
522825999eSPeter Griffin INTC_IRQ(IRQ2, 66), INTC_IRQ(IRQ3, 67),
532825999eSPeter Griffin INTC_IRQ(IRQ4, 68), INTC_IRQ(IRQ5, 69),
542825999eSPeter Griffin INTC_IRQ(IRQ6, 70), INTC_IRQ(IRQ7, 71),
55d55eedd5SPaul Mundt
562825999eSPeter Griffin INTC_IRQ(PINT0, 80), INTC_IRQ(PINT1, 81),
572825999eSPeter Griffin INTC_IRQ(PINT2, 82), INTC_IRQ(PINT3, 83),
582825999eSPeter Griffin INTC_IRQ(PINT4, 84), INTC_IRQ(PINT5, 85),
592825999eSPeter Griffin INTC_IRQ(PINT6, 86), INTC_IRQ(PINT7, 87),
602825999eSPeter Griffin
612825999eSPeter Griffin INTC_IRQ(ADC_ADI, 92),
622825999eSPeter Griffin
63d55eedd5SPaul Mundt INTC_IRQ(MTU20_ABCD, 108), INTC_IRQ(MTU20_ABCD, 109),
64d55eedd5SPaul Mundt INTC_IRQ(MTU20_ABCD, 110), INTC_IRQ(MTU20_ABCD, 111),
652825999eSPeter Griffin
66d55eedd5SPaul Mundt INTC_IRQ(MTU20_VEF, 112), INTC_IRQ(MTU20_VEF, 113),
67d55eedd5SPaul Mundt INTC_IRQ(MTU20_VEF, 114),
682825999eSPeter Griffin
69d55eedd5SPaul Mundt INTC_IRQ(MTU21_AB, 116), INTC_IRQ(MTU21_AB, 117),
70d55eedd5SPaul Mundt INTC_IRQ(MTU21_VU, 120), INTC_IRQ(MTU21_VU, 121),
712825999eSPeter Griffin
72d55eedd5SPaul Mundt INTC_IRQ(MTU22_AB, 124), INTC_IRQ(MTU22_AB, 125),
73d55eedd5SPaul Mundt INTC_IRQ(MTU22_VU, 128), INTC_IRQ(MTU22_VU, 129),
74d55eedd5SPaul Mundt
75d55eedd5SPaul Mundt INTC_IRQ(MTU23_ABCD, 132), INTC_IRQ(MTU23_ABCD, 133),
76d55eedd5SPaul Mundt INTC_IRQ(MTU23_ABCD, 134), INTC_IRQ(MTU23_ABCD, 135),
77d55eedd5SPaul Mundt
782825999eSPeter Griffin INTC_IRQ(MTU2_TCI3V, 136),
792825999eSPeter Griffin
80d55eedd5SPaul Mundt INTC_IRQ(MTU24_ABCD, 140), INTC_IRQ(MTU24_ABCD, 141),
81d55eedd5SPaul Mundt INTC_IRQ(MTU24_ABCD, 142), INTC_IRQ(MTU24_ABCD, 143),
82d55eedd5SPaul Mundt
832825999eSPeter Griffin INTC_IRQ(MTU2_TCI4V, 144),
842825999eSPeter Griffin
85d55eedd5SPaul Mundt INTC_IRQ(MTU25_UVW, 148), INTC_IRQ(MTU25_UVW, 149),
86d55eedd5SPaul Mundt INTC_IRQ(MTU25_UVW, 150),
872825999eSPeter Griffin
88d55eedd5SPaul Mundt INTC_IRQ(RTC, 152), INTC_IRQ(RTC, 153),
89d55eedd5SPaul Mundt INTC_IRQ(RTC, 154),
902825999eSPeter Griffin
91d55eedd5SPaul Mundt INTC_IRQ(WDT, 156),
922825999eSPeter Griffin
93d55eedd5SPaul Mundt INTC_IRQ(IIC30, 157), INTC_IRQ(IIC30, 158),
94d55eedd5SPaul Mundt INTC_IRQ(IIC30, 159), INTC_IRQ(IIC30, 160),
95d55eedd5SPaul Mundt INTC_IRQ(IIC30, 161),
962825999eSPeter Griffin
97d55eedd5SPaul Mundt INTC_IRQ(IIC31, 164), INTC_IRQ(IIC31, 165),
98d55eedd5SPaul Mundt INTC_IRQ(IIC31, 166), INTC_IRQ(IIC31, 167),
99d55eedd5SPaul Mundt INTC_IRQ(IIC31, 168),
100d55eedd5SPaul Mundt
101d55eedd5SPaul Mundt INTC_IRQ(IIC32, 170), INTC_IRQ(IIC32, 171),
102d55eedd5SPaul Mundt INTC_IRQ(IIC32, 172), INTC_IRQ(IIC32, 173),
103d55eedd5SPaul Mundt INTC_IRQ(IIC32, 174),
1042825999eSPeter Griffin
1052825999eSPeter Griffin INTC_IRQ(DMAC0_DMINT0, 176), INTC_IRQ(DMAC1_DMINT1, 177),
1062825999eSPeter Griffin INTC_IRQ(DMAC2_DMINT2, 178), INTC_IRQ(DMAC3_DMINT3, 179),
1072825999eSPeter Griffin
108d55eedd5SPaul Mundt INTC_IRQ(SCIF0, 180), INTC_IRQ(SCIF0, 181),
109d55eedd5SPaul Mundt INTC_IRQ(SCIF0, 182), INTC_IRQ(SCIF0, 183),
110d55eedd5SPaul Mundt INTC_IRQ(SCIF1, 184), INTC_IRQ(SCIF1, 185),
111d55eedd5SPaul Mundt INTC_IRQ(SCIF1, 186), INTC_IRQ(SCIF1, 187),
112d55eedd5SPaul Mundt INTC_IRQ(SCIF2, 188), INTC_IRQ(SCIF2, 189),
113d55eedd5SPaul Mundt INTC_IRQ(SCIF2, 190), INTC_IRQ(SCIF2, 191),
114d55eedd5SPaul Mundt INTC_IRQ(SCIF3, 192), INTC_IRQ(SCIF3, 193),
115d55eedd5SPaul Mundt INTC_IRQ(SCIF3, 194), INTC_IRQ(SCIF3, 195),
116d55eedd5SPaul Mundt INTC_IRQ(SCIF4, 196), INTC_IRQ(SCIF4, 197),
117d55eedd5SPaul Mundt INTC_IRQ(SCIF4, 198), INTC_IRQ(SCIF4, 199),
118d55eedd5SPaul Mundt INTC_IRQ(SCIF5, 200), INTC_IRQ(SCIF5, 201),
119d55eedd5SPaul Mundt INTC_IRQ(SCIF5, 202), INTC_IRQ(SCIF5, 203),
120d55eedd5SPaul Mundt INTC_IRQ(SCIF6, 204), INTC_IRQ(SCIF6, 205),
121d55eedd5SPaul Mundt INTC_IRQ(SCIF6, 206), INTC_IRQ(SCIF6, 207),
122d55eedd5SPaul Mundt INTC_IRQ(SCIF7, 208), INTC_IRQ(SCIF7, 209),
123d55eedd5SPaul Mundt INTC_IRQ(SCIF7, 210), INTC_IRQ(SCIF7, 211),
1242825999eSPeter Griffin
1252825999eSPeter Griffin INTC_IRQ(DMAC0_DMINTA, 212), INTC_IRQ(DMAC4_DMINT4, 216),
1262825999eSPeter Griffin INTC_IRQ(DMAC5_DMINT5, 217), INTC_IRQ(DMAC6_DMINT6, 218),
1272825999eSPeter Griffin INTC_IRQ(DMAC7_DMINT7, 219),
1282825999eSPeter Griffin
129d55eedd5SPaul Mundt INTC_IRQ(RCAN0, 228), INTC_IRQ(RCAN0, 229),
130d55eedd5SPaul Mundt INTC_IRQ(RCAN0, 230),
131d55eedd5SPaul Mundt INTC_IRQ(RCAN0, 231), INTC_IRQ(RCAN0, 232),
1322825999eSPeter Griffin
133d55eedd5SPaul Mundt INTC_IRQ(RCAN1, 234), INTC_IRQ(RCAN1, 235),
134d55eedd5SPaul Mundt INTC_IRQ(RCAN1, 236),
135d55eedd5SPaul Mundt INTC_IRQ(RCAN1, 237), INTC_IRQ(RCAN1, 238),
1362825999eSPeter Griffin
1372825999eSPeter Griffin INTC_IRQ(SSI0_SSII, 244), INTC_IRQ(SSI1_SSII, 245),
1382825999eSPeter Griffin
139d55eedd5SPaul Mundt INTC_IRQ(TMR0, 246), INTC_IRQ(TMR0, 247),
140d55eedd5SPaul Mundt INTC_IRQ(TMR0, 248),
1412825999eSPeter Griffin
142d55eedd5SPaul Mundt INTC_IRQ(TMR1, 252), INTC_IRQ(TMR1, 253),
143d55eedd5SPaul Mundt INTC_IRQ(TMR1, 254),
1442825999eSPeter Griffin };
1452825999eSPeter Griffin
1462825999eSPeter Griffin static struct intc_group groups[] __initdata = {
1472825999eSPeter Griffin INTC_GROUP(PINT, PINT0, PINT1, PINT2, PINT3,
1482825999eSPeter Griffin PINT4, PINT5, PINT6, PINT7),
1492825999eSPeter Griffin };
1502825999eSPeter Griffin
1512825999eSPeter Griffin static struct intc_prio_reg prio_registers[] __initdata = {
1522825999eSPeter Griffin { 0xfffe9418, 0, 16, 4, /* IPR01 */ { IRQ0, IRQ1, IRQ2, IRQ3 } },
1532825999eSPeter Griffin { 0xfffe941a, 0, 16, 4, /* IPR02 */ { IRQ4, IRQ5, IRQ6, IRQ7 } },
1542825999eSPeter Griffin { 0xfffe9420, 0, 16, 4, /* IPR05 */ { PINT, 0, ADC_ADI, 0 } },
1552825999eSPeter Griffin { 0xfffe9800, 0, 16, 4, /* IPR06 */ { 0, MTU20_ABCD, MTU20_VEF, MTU21_AB } },
1562825999eSPeter Griffin { 0xfffe9802, 0, 16, 4, /* IPR07 */ { MTU21_VU, MTU22_AB, MTU22_VU, MTU23_ABCD } },
1572825999eSPeter Griffin { 0xfffe9804, 0, 16, 4, /* IPR08 */ { MTU2_TCI3V, MTU24_ABCD, MTU2_TCI4V, MTU25_UVW } },
1582825999eSPeter Griffin
1592825999eSPeter Griffin { 0xfffe9806, 0, 16, 4, /* IPR09 */ { RTC, WDT, IIC30, 0 } },
1602825999eSPeter Griffin { 0xfffe9808, 0, 16, 4, /* IPR10 */ { IIC31, IIC32, DMAC0_DMINT0, DMAC1_DMINT1 } },
1612825999eSPeter Griffin { 0xfffe980a, 0, 16, 4, /* IPR11 */ { DMAC2_DMINT2, DMAC3_DMINT3, SCIF0, SCIF1 } },
1622825999eSPeter Griffin { 0xfffe980c, 0, 16, 4, /* IPR12 */ { SCIF2, SCIF3, SCIF4, SCIF5 } },
1632825999eSPeter Griffin { 0xfffe980e, 0, 16, 4, /* IPR13 */ { SCIF6, SCIF7, DMAC0_DMINTA, DMAC4_DMINT4 } },
1642825999eSPeter Griffin { 0xfffe9810, 0, 16, 4, /* IPR14 */ { DMAC5_DMINT5, DMAC6_DMINT6, DMAC7_DMINT7, 0 } },
1652825999eSPeter Griffin { 0xfffe9812, 0, 16, 4, /* IPR15 */ { 0, RCAN0, RCAN1, 0 } },
1662825999eSPeter Griffin { 0xfffe9814, 0, 16, 4, /* IPR16 */ { SSI0_SSII, SSI1_SSII, TMR0, TMR1 } },
1672825999eSPeter Griffin };
1682825999eSPeter Griffin
1692825999eSPeter Griffin static struct intc_mask_reg mask_registers[] __initdata = {
1702825999eSPeter Griffin { 0xfffe9408, 0, 16, /* PINTER */
1712825999eSPeter Griffin { 0, 0, 0, 0, 0, 0, 0, 0,
1722825999eSPeter Griffin PINT7, PINT6, PINT5, PINT4, PINT3, PINT2, PINT1, PINT0 } },
1732825999eSPeter Griffin };
1742825999eSPeter Griffin
1752825999eSPeter Griffin static DECLARE_INTC_DESC(intc_desc, "sh7201", vectors, groups,
1762825999eSPeter Griffin mask_registers, prio_registers, NULL);
1772825999eSPeter Griffin
178be091d20SMagnus Damm static struct plat_sci_port scif0_platform_data = {
179c3fa400bSLaurent Pinchart .scscr = SCSCR_REIE,
1802825999eSPeter Griffin .type = PORT_SCIF,
181d850acf9SLaurent Pinchart };
182d850acf9SLaurent Pinchart
183d850acf9SLaurent Pinchart static struct resource scif0_resources[] = {
184d850acf9SLaurent Pinchart DEFINE_RES_MEM(0xfffe8000, 0x100),
185d850acf9SLaurent Pinchart DEFINE_RES_IRQ(180),
186be091d20SMagnus Damm };
187be091d20SMagnus Damm
188be091d20SMagnus Damm static struct platform_device scif0_device = {
189be091d20SMagnus Damm .name = "sh-sci",
190be091d20SMagnus Damm .id = 0,
191d850acf9SLaurent Pinchart .resource = scif0_resources,
192d850acf9SLaurent Pinchart .num_resources = ARRAY_SIZE(scif0_resources),
193be091d20SMagnus Damm .dev = {
194be091d20SMagnus Damm .platform_data = &scif0_platform_data,
195be091d20SMagnus Damm },
196be091d20SMagnus Damm };
197be091d20SMagnus Damm
198be091d20SMagnus Damm static struct plat_sci_port scif1_platform_data = {
199c3fa400bSLaurent Pinchart .scscr = SCSCR_REIE,
2002825999eSPeter Griffin .type = PORT_SCIF,
201d850acf9SLaurent Pinchart };
202d850acf9SLaurent Pinchart
203d850acf9SLaurent Pinchart static struct resource scif1_resources[] = {
204d850acf9SLaurent Pinchart DEFINE_RES_MEM(0xfffe8800, 0x100),
205d850acf9SLaurent Pinchart DEFINE_RES_IRQ(184),
206be091d20SMagnus Damm };
207be091d20SMagnus Damm
208be091d20SMagnus Damm static struct platform_device scif1_device = {
209be091d20SMagnus Damm .name = "sh-sci",
210be091d20SMagnus Damm .id = 1,
211d850acf9SLaurent Pinchart .resource = scif1_resources,
212d850acf9SLaurent Pinchart .num_resources = ARRAY_SIZE(scif1_resources),
213be091d20SMagnus Damm .dev = {
214be091d20SMagnus Damm .platform_data = &scif1_platform_data,
215be091d20SMagnus Damm },
216be091d20SMagnus Damm };
217be091d20SMagnus Damm
218be091d20SMagnus Damm static struct plat_sci_port scif2_platform_data = {
219c3fa400bSLaurent Pinchart .scscr = SCSCR_REIE,
2202825999eSPeter Griffin .type = PORT_SCIF,
221d850acf9SLaurent Pinchart };
222d850acf9SLaurent Pinchart
223d850acf9SLaurent Pinchart static struct resource scif2_resources[] = {
224d850acf9SLaurent Pinchart DEFINE_RES_MEM(0xfffe9000, 0x100),
225d850acf9SLaurent Pinchart DEFINE_RES_IRQ(188),
226be091d20SMagnus Damm };
227be091d20SMagnus Damm
228be091d20SMagnus Damm static struct platform_device scif2_device = {
229be091d20SMagnus Damm .name = "sh-sci",
230be091d20SMagnus Damm .id = 2,
231d850acf9SLaurent Pinchart .resource = scif2_resources,
232d850acf9SLaurent Pinchart .num_resources = ARRAY_SIZE(scif2_resources),
233be091d20SMagnus Damm .dev = {
234be091d20SMagnus Damm .platform_data = &scif2_platform_data,
235be091d20SMagnus Damm },
236be091d20SMagnus Damm };
237be091d20SMagnus Damm
238be091d20SMagnus Damm static struct plat_sci_port scif3_platform_data = {
239c3fa400bSLaurent Pinchart .scscr = SCSCR_REIE,
2402825999eSPeter Griffin .type = PORT_SCIF,
241d850acf9SLaurent Pinchart };
242d850acf9SLaurent Pinchart
243d850acf9SLaurent Pinchart static struct resource scif3_resources[] = {
244d850acf9SLaurent Pinchart DEFINE_RES_MEM(0xfffe9800, 0x100),
245d850acf9SLaurent Pinchart DEFINE_RES_IRQ(192),
246be091d20SMagnus Damm };
247be091d20SMagnus Damm
248be091d20SMagnus Damm static struct platform_device scif3_device = {
249be091d20SMagnus Damm .name = "sh-sci",
250be091d20SMagnus Damm .id = 3,
251d850acf9SLaurent Pinchart .resource = scif3_resources,
252d850acf9SLaurent Pinchart .num_resources = ARRAY_SIZE(scif3_resources),
253be091d20SMagnus Damm .dev = {
254be091d20SMagnus Damm .platform_data = &scif3_platform_data,
255be091d20SMagnus Damm },
256be091d20SMagnus Damm };
257be091d20SMagnus Damm
258be091d20SMagnus Damm static struct plat_sci_port scif4_platform_data = {
259c3fa400bSLaurent Pinchart .scscr = SCSCR_REIE,
2602825999eSPeter Griffin .type = PORT_SCIF,
261d850acf9SLaurent Pinchart };
262d850acf9SLaurent Pinchart
263d850acf9SLaurent Pinchart static struct resource scif4_resources[] = {
264d850acf9SLaurent Pinchart DEFINE_RES_MEM(0xfffea000, 0x100),
265d850acf9SLaurent Pinchart DEFINE_RES_IRQ(196),
266be091d20SMagnus Damm };
267be091d20SMagnus Damm
268be091d20SMagnus Damm static struct platform_device scif4_device = {
269be091d20SMagnus Damm .name = "sh-sci",
270be091d20SMagnus Damm .id = 4,
271d850acf9SLaurent Pinchart .resource = scif4_resources,
272d850acf9SLaurent Pinchart .num_resources = ARRAY_SIZE(scif4_resources),
273be091d20SMagnus Damm .dev = {
274be091d20SMagnus Damm .platform_data = &scif4_platform_data,
275be091d20SMagnus Damm },
276be091d20SMagnus Damm };
277be091d20SMagnus Damm
278be091d20SMagnus Damm static struct plat_sci_port scif5_platform_data = {
279c3fa400bSLaurent Pinchart .scscr = SCSCR_REIE,
2802825999eSPeter Griffin .type = PORT_SCIF,
281d850acf9SLaurent Pinchart };
282d850acf9SLaurent Pinchart
283d850acf9SLaurent Pinchart static struct resource scif5_resources[] = {
284d850acf9SLaurent Pinchart DEFINE_RES_MEM(0xfffea800, 0x100),
285d850acf9SLaurent Pinchart DEFINE_RES_IRQ(200),
286be091d20SMagnus Damm };
287be091d20SMagnus Damm
288be091d20SMagnus Damm static struct platform_device scif5_device = {
289be091d20SMagnus Damm .name = "sh-sci",
290be091d20SMagnus Damm .id = 5,
291d850acf9SLaurent Pinchart .resource = scif5_resources,
292d850acf9SLaurent Pinchart .num_resources = ARRAY_SIZE(scif5_resources),
293be091d20SMagnus Damm .dev = {
294be091d20SMagnus Damm .platform_data = &scif5_platform_data,
295be091d20SMagnus Damm },
296be091d20SMagnus Damm };
297be091d20SMagnus Damm
298be091d20SMagnus Damm static struct plat_sci_port scif6_platform_data = {
299c3fa400bSLaurent Pinchart .scscr = SCSCR_REIE,
3002825999eSPeter Griffin .type = PORT_SCIF,
301d850acf9SLaurent Pinchart };
302d850acf9SLaurent Pinchart
303d850acf9SLaurent Pinchart static struct resource scif6_resources[] = {
304d850acf9SLaurent Pinchart DEFINE_RES_MEM(0xfffeb000, 0x100),
305d850acf9SLaurent Pinchart DEFINE_RES_IRQ(204),
306be091d20SMagnus Damm };
307be091d20SMagnus Damm
308be091d20SMagnus Damm static struct platform_device scif6_device = {
309be091d20SMagnus Damm .name = "sh-sci",
310be091d20SMagnus Damm .id = 6,
311d850acf9SLaurent Pinchart .resource = scif6_resources,
312d850acf9SLaurent Pinchart .num_resources = ARRAY_SIZE(scif6_resources),
313be091d20SMagnus Damm .dev = {
314be091d20SMagnus Damm .platform_data = &scif6_platform_data,
315be091d20SMagnus Damm },
316be091d20SMagnus Damm };
317be091d20SMagnus Damm
318be091d20SMagnus Damm static struct plat_sci_port scif7_platform_data = {
319c3fa400bSLaurent Pinchart .scscr = SCSCR_REIE,
3202825999eSPeter Griffin .type = PORT_SCIF,
321d850acf9SLaurent Pinchart };
322d850acf9SLaurent Pinchart
323d850acf9SLaurent Pinchart static struct resource scif7_resources[] = {
324d850acf9SLaurent Pinchart DEFINE_RES_MEM(0xfffeb800, 0x100),
325d850acf9SLaurent Pinchart DEFINE_RES_IRQ(208),
3262825999eSPeter Griffin };
3272825999eSPeter Griffin
328be091d20SMagnus Damm static struct platform_device scif7_device = {
3292825999eSPeter Griffin .name = "sh-sci",
330be091d20SMagnus Damm .id = 7,
331d850acf9SLaurent Pinchart .resource = scif7_resources,
332d850acf9SLaurent Pinchart .num_resources = ARRAY_SIZE(scif7_resources),
3332825999eSPeter Griffin .dev = {
334be091d20SMagnus Damm .platform_data = &scif7_platform_data,
3352825999eSPeter Griffin },
3362825999eSPeter Griffin };
3372825999eSPeter Griffin
3382825999eSPeter Griffin static struct resource rtc_resources[] = {
3392825999eSPeter Griffin [0] = {
3402825999eSPeter Griffin .start = 0xffff0800,
3412825999eSPeter Griffin .end = 0xffff2000 + 0x58 - 1,
3422825999eSPeter Griffin .flags = IORESOURCE_IO,
3432825999eSPeter Griffin },
3442825999eSPeter Griffin [1] = {
345d55eedd5SPaul Mundt /* Shared Period/Carry/Alarm IRQ */
3462825999eSPeter Griffin .start = 152,
3472825999eSPeter Griffin .flags = IORESOURCE_IRQ,
3482825999eSPeter Griffin },
3492825999eSPeter Griffin };
3502825999eSPeter Griffin
3512825999eSPeter Griffin static struct platform_device rtc_device = {
3522825999eSPeter Griffin .name = "sh-rtc",
3532825999eSPeter Griffin .id = -1,
3542825999eSPeter Griffin .num_resources = ARRAY_SIZE(rtc_resources),
3552825999eSPeter Griffin .resource = rtc_resources,
3562825999eSPeter Griffin };
3572825999eSPeter Griffin
3585204601cSLaurent Pinchart static struct resource mtu2_resources[] = {
3595204601cSLaurent Pinchart DEFINE_RES_MEM(0xfffe4000, 0x400),
3605204601cSLaurent Pinchart DEFINE_RES_IRQ_NAMED(108, "tgi0a"),
3615204601cSLaurent Pinchart DEFINE_RES_IRQ_NAMED(116, "tgi1a"),
3625204601cSLaurent Pinchart DEFINE_RES_IRQ_NAMED(124, "tgi1b"),
363da107c6eSMagnus Damm };
364da107c6eSMagnus Damm
3655204601cSLaurent Pinchart static struct platform_device mtu2_device = {
3665204601cSLaurent Pinchart .name = "sh-mtu2",
3675204601cSLaurent Pinchart .id = -1,
3685204601cSLaurent Pinchart .resource = mtu2_resources,
3695204601cSLaurent Pinchart .num_resources = ARRAY_SIZE(mtu2_resources),
370da107c6eSMagnus Damm };
371da107c6eSMagnus Damm
3722825999eSPeter Griffin static struct platform_device *sh7201_devices[] __initdata = {
373be091d20SMagnus Damm &scif0_device,
374be091d20SMagnus Damm &scif1_device,
375be091d20SMagnus Damm &scif2_device,
376be091d20SMagnus Damm &scif3_device,
377be091d20SMagnus Damm &scif4_device,
378be091d20SMagnus Damm &scif5_device,
379be091d20SMagnus Damm &scif6_device,
380be091d20SMagnus Damm &scif7_device,
3812825999eSPeter Griffin &rtc_device,
3825204601cSLaurent Pinchart &mtu2_device,
3832825999eSPeter Griffin };
3842825999eSPeter Griffin
sh7201_devices_setup(void)3852825999eSPeter Griffin static int __init sh7201_devices_setup(void)
3862825999eSPeter Griffin {
3872825999eSPeter Griffin return platform_add_devices(sh7201_devices,
3882825999eSPeter Griffin ARRAY_SIZE(sh7201_devices));
3892825999eSPeter Griffin }
390ba9a6337SMagnus Damm arch_initcall(sh7201_devices_setup);
3912825999eSPeter Griffin
plat_irq_setup(void)3922825999eSPeter Griffin void __init plat_irq_setup(void)
3932825999eSPeter Griffin {
3942825999eSPeter Griffin register_intc_controller(&intc_desc);
3952825999eSPeter Griffin }
396da107c6eSMagnus Damm
397da107c6eSMagnus Damm static struct platform_device *sh7201_early_devices[] __initdata = {
398be091d20SMagnus Damm &scif0_device,
399be091d20SMagnus Damm &scif1_device,
400be091d20SMagnus Damm &scif2_device,
401be091d20SMagnus Damm &scif3_device,
402be091d20SMagnus Damm &scif4_device,
403be091d20SMagnus Damm &scif5_device,
404be091d20SMagnus Damm &scif6_device,
405be091d20SMagnus Damm &scif7_device,
4065204601cSLaurent Pinchart &mtu2_device,
407da107c6eSMagnus Damm };
408da107c6eSMagnus Damm
409da107c6eSMagnus Damm #define STBCR3 0xfffe0408
410da107c6eSMagnus Damm
plat_early_device_setup(void)411da107c6eSMagnus Damm void __init plat_early_device_setup(void)
412da107c6eSMagnus Damm {
413da107c6eSMagnus Damm /* enable MTU2 clock */
414da107c6eSMagnus Damm __raw_writeb(__raw_readb(STBCR3) & ~0x20, STBCR3);
415da107c6eSMagnus Damm
416*201e9109SBartosz Golaszewski sh_early_platform_add_devices(sh7201_early_devices,
417da107c6eSMagnus Damm ARRAY_SIZE(sh7201_early_devices));
418da107c6eSMagnus Damm }
419