xref: /openbmc/linux/arch/sh/kernel/cpu/sh2/setup-sh7619.c (revision 82ced6fd)
1 /*
2  * SH7619 Setup
3  *
4  *  Copyright (C) 2006  Yoshinori Sato
5  *  Copyright (C) 2009  Paul Mundt
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/serial.h>
14 #include <linux/serial_sci.h>
15 
16 enum {
17 	UNUSED = 0,
18 
19 	/* interrupt sources */
20 	IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
21 	WDT, EDMAC, CMT0, CMT1,
22 	SCIF0, SCIF1, SCIF2,
23 	HIF_HIFI, HIF_HIFBI,
24 	DMAC0, DMAC1, DMAC2, DMAC3,
25 	SIOF,
26 };
27 
28 static struct intc_vect vectors[] __initdata = {
29 	INTC_IRQ(IRQ0, 64), INTC_IRQ(IRQ1, 65),
30 	INTC_IRQ(IRQ2, 66), INTC_IRQ(IRQ3, 67),
31 	INTC_IRQ(IRQ4, 80), INTC_IRQ(IRQ5, 81),
32 	INTC_IRQ(IRQ6, 82), INTC_IRQ(IRQ7, 83),
33 	INTC_IRQ(WDT, 84), INTC_IRQ(EDMAC, 85),
34 	INTC_IRQ(CMT0, 86), INTC_IRQ(CMT1, 87),
35 	INTC_IRQ(SCIF0, 88), INTC_IRQ(SCIF0, 89),
36 	INTC_IRQ(SCIF0, 90), INTC_IRQ(SCIF0, 91),
37 	INTC_IRQ(SCIF1, 92), INTC_IRQ(SCIF1, 93),
38 	INTC_IRQ(SCIF1, 94), INTC_IRQ(SCIF1, 95),
39 	INTC_IRQ(SCIF2, 96), INTC_IRQ(SCIF2, 97),
40 	INTC_IRQ(SCIF2, 98), INTC_IRQ(SCIF2, 99),
41 	INTC_IRQ(HIF_HIFI, 100), INTC_IRQ(HIF_HIFBI, 101),
42 	INTC_IRQ(DMAC0, 104), INTC_IRQ(DMAC1, 105),
43 	INTC_IRQ(DMAC2, 106), INTC_IRQ(DMAC3, 107),
44 	INTC_IRQ(SIOF, 108),
45 };
46 
47 static struct intc_prio_reg prio_registers[] __initdata = {
48 	{ 0xf8140006, 0, 16, 4, /* IPRA */ { IRQ0, IRQ1, IRQ2, IRQ3 } },
49 	{ 0xf8140008, 0, 16, 4, /* IPRB */ { IRQ4, IRQ5, IRQ6, IRQ7 } },
50 	{ 0xf8080000, 0, 16, 4, /* IPRC */ { WDT, EDMAC, CMT0, CMT1 } },
51 	{ 0xf8080002, 0, 16, 4, /* IPRD */ { SCIF0, SCIF1, SCIF2 } },
52 	{ 0xf8080004, 0, 16, 4, /* IPRE */ { HIF_HIFI, HIF_HIFBI } },
53 	{ 0xf8080006, 0, 16, 4, /* IPRF */ { DMAC0, DMAC1, DMAC2, DMAC3 } },
54 	{ 0xf8080008, 0, 16, 4, /* IPRG */ { SIOF } },
55 };
56 
57 static DECLARE_INTC_DESC(intc_desc, "sh7619", vectors, NULL,
58 			 NULL, prio_registers, NULL);
59 
60 static struct plat_sci_port sci_platform_data[] = {
61 	{
62 		.mapbase	= 0xf8400000,
63 		.flags		= UPF_BOOT_AUTOCONF,
64 		.type		= PORT_SCIF,
65 		.irqs		= { 88, 88, 88, 88 },
66 	}, {
67 		.mapbase	= 0xf8410000,
68 		.flags		= UPF_BOOT_AUTOCONF,
69 		.type		= PORT_SCIF,
70 		.irqs		= { 92, 92, 92, 92 },
71 	}, {
72 		.mapbase	= 0xf8420000,
73 		.flags		= UPF_BOOT_AUTOCONF,
74 		.type		= PORT_SCIF,
75 		.irqs		= { 96, 96, 96, 96 },
76 	}, {
77 		.flags = 0,
78 	}
79 };
80 
81 static struct platform_device sci_device = {
82 	.name		= "sh-sci",
83 	.id		= -1,
84 	.dev		= {
85 		.platform_data	= sci_platform_data,
86 	},
87 };
88 
89 static struct resource eth_resources[] = {
90 	[0] = {
91 		.start = 0xfb000000,
92 		.end =   0xfb0001c8,
93 		.flags = IORESOURCE_MEM,
94 	},
95 	[1] = {
96 		.start = 85,
97 		.end = 85,
98 		.flags = IORESOURCE_IRQ,
99 	},
100 };
101 
102 static struct platform_device eth_device = {
103 	.name = "sh-eth",
104 	.id	= -1,
105 	.dev = {
106 		.platform_data = (void *)1,
107 	},
108 	.num_resources = ARRAY_SIZE(eth_resources),
109 	.resource = eth_resources,
110 };
111 
112 static struct platform_device *sh7619_devices[] __initdata = {
113 	&sci_device,
114 	&eth_device,
115 };
116 
117 static int __init sh7619_devices_setup(void)
118 {
119 	return platform_add_devices(sh7619_devices,
120 				    ARRAY_SIZE(sh7619_devices));
121 }
122 __initcall(sh7619_devices_setup);
123 
124 void __init plat_irq_setup(void)
125 {
126 	register_intc_controller(&intc_desc);
127 }
128