xref: /openbmc/linux/arch/sh/kernel/cpu/sh3/setup-sh7705.c (revision b627b4ed)
1 /*
2  * SH7705 Setup
3  *
4  *  Copyright (C) 2006 - 2009  Paul Mundt
5  *  Copyright (C) 2007  Nobuhiro Iwamatsu
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>
13 #include <linux/irq.h>
14 #include <linux/serial.h>
15 #include <linux/serial_sci.h>
16 #include <asm/rtc.h>
17 
18 enum {
19 	UNUSED = 0,
20 
21 	/* interrupt sources */
22 	IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5,
23 	PINT07, PINT815,
24 
25 	DMAC, SCIF0, SCIF2, ADC_ADI, USB,
26 
27 	TPU0, TPU1, TPU2, TPU3,
28 	TMU0, TMU1, TMU2,
29 
30 	RTC, WDT, REF_RCMI,
31 };
32 
33 static struct intc_vect vectors[] __initdata = {
34 	/* IRQ0->5 are handled in setup-sh3.c */
35 	INTC_VECT(PINT07, 0x700), INTC_VECT(PINT815, 0x720),
36 	INTC_VECT(DMAC, 0x800), INTC_VECT(DMAC, 0x820),
37 	INTC_VECT(DMAC, 0x840), INTC_VECT(DMAC, 0x860),
38 	INTC_VECT(SCIF0, 0x880), INTC_VECT(SCIF0, 0x8a0),
39 	INTC_VECT(SCIF0, 0x8e0),
40 	INTC_VECT(SCIF2, 0x900), INTC_VECT(SCIF2, 0x920),
41 	INTC_VECT(SCIF2, 0x960),
42 	INTC_VECT(ADC_ADI, 0x980),
43 	INTC_VECT(USB, 0xa20), INTC_VECT(USB, 0xa40),
44 	INTC_VECT(TPU0, 0xc00), INTC_VECT(TPU1, 0xc20),
45 	INTC_VECT(TPU2, 0xc80), INTC_VECT(TPU3, 0xca0),
46 	INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
47 	INTC_VECT(TMU2, 0x440), INTC_VECT(TMU2, 0x460),
48 	INTC_VECT(RTC, 0x480), INTC_VECT(RTC, 0x4a0),
49 	INTC_VECT(RTC, 0x4c0),
50 	INTC_VECT(WDT, 0x560),
51 	INTC_VECT(REF_RCMI, 0x580),
52 };
53 
54 static struct intc_prio_reg prio_registers[] __initdata = {
55 	{ 0xfffffee2, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, RTC } },
56 	{ 0xfffffee4, 0, 16, 4, /* IPRB */ { WDT, REF_RCMI, 0, 0 } },
57 	{ 0xa4000016, 0, 16, 4, /* IPRC */ { IRQ3, IRQ2, IRQ1, IRQ0 } },
58 	{ 0xa4000018, 0, 16, 4, /* IPRD */ { PINT07, PINT815, IRQ5, IRQ4 } },
59 	{ 0xa400001a, 0, 16, 4, /* IPRE */ { DMAC, SCIF0, SCIF2, ADC_ADI } },
60 	{ 0xa4080000, 0, 16, 4, /* IPRF */ { 0, 0, USB } },
61 	{ 0xa4080002, 0, 16, 4, /* IPRG */ { TPU0, TPU1 } },
62 	{ 0xa4080004, 0, 16, 4, /* IPRH */ { TPU2, TPU3 } },
63 
64 };
65 
66 static DECLARE_INTC_DESC(intc_desc, "sh7705", vectors, NULL,
67 			 NULL, prio_registers, NULL);
68 
69 static struct plat_sci_port sci_platform_data[] = {
70 	{
71 		.mapbase	= 0xa4410000,
72 		.flags		= UPF_BOOT_AUTOCONF,
73 		.type		= PORT_SCIF,
74 		.irqs		= { 56, 56, 56 },
75 	}, {
76 		.mapbase	= 0xa4400000,
77 		.flags		= UPF_BOOT_AUTOCONF,
78 		.type		= PORT_SCIF,
79 		.irqs		= { 52, 52, 52 },
80 	}, {
81 		.flags = 0,
82 	}
83 };
84 
85 static struct platform_device sci_device = {
86 	.name		= "sh-sci",
87 	.id		= -1,
88 	.dev		= {
89 		.platform_data	= sci_platform_data,
90 	},
91 };
92 
93 static struct resource rtc_resources[] = {
94 	[0] =	{
95 		.start	= 0xfffffec0,
96 		.end	= 0xfffffec0 + 0x1e,
97 		.flags  = IORESOURCE_IO,
98 	},
99 	[1] =	{
100 		.start  = 20,
101 		.flags	= IORESOURCE_IRQ,
102 	},
103 };
104 
105 static struct sh_rtc_platform_info rtc_info = {
106 	.capabilities	= RTC_CAP_4_DIGIT_YEAR,
107 };
108 
109 static struct platform_device rtc_device = {
110 	.name		= "sh-rtc",
111 	.id		= -1,
112 	.num_resources	= ARRAY_SIZE(rtc_resources),
113 	.resource	= rtc_resources,
114 	.dev		= {
115 		.platform_data = &rtc_info,
116 	},
117 };
118 
119 static struct platform_device *sh7705_devices[] __initdata = {
120 	&sci_device,
121 	&rtc_device,
122 };
123 
124 static int __init sh7705_devices_setup(void)
125 {
126 	return platform_add_devices(sh7705_devices,
127 				    ARRAY_SIZE(sh7705_devices));
128 }
129 __initcall(sh7705_devices_setup);
130 
131 void __init plat_irq_setup(void)
132 {
133 	register_intc_controller(&intc_desc);
134 	plat_irq_setup_sh3();
135 }
136