xref: /openbmc/linux/arch/sh/kernel/cpu/sh2/setup-sh7619.c (revision 5dece2bbda728fbf6a70e48be782c24c427072b0)
19d4436a6SYoshinori Sato /*
29d4436a6SYoshinori Sato  * SH7619 Setup
39d4436a6SYoshinori Sato  *
49d4436a6SYoshinori Sato  *  Copyright (C) 2006  Yoshinori Sato
5*5dece2bbSPaul Mundt  *  Copyright (C) 2009  Paul Mundt
69d4436a6SYoshinori Sato  *
79d4436a6SYoshinori Sato  * This file is subject to the terms and conditions of the GNU General Public
89d4436a6SYoshinori Sato  * License.  See the file "COPYING" in the main directory of this archive
99d4436a6SYoshinori Sato  * for more details.
109d4436a6SYoshinori Sato  */
119d4436a6SYoshinori Sato #include <linux/platform_device.h>
129d4436a6SYoshinori Sato #include <linux/init.h>
139d4436a6SYoshinori Sato #include <linux/serial.h>
1496de1a8fSPaul Mundt #include <linux/serial_sci.h>
159d4436a6SYoshinori Sato 
160dc3fc04SMagnus Damm enum {
170dc3fc04SMagnus Damm 	UNUSED = 0,
180dc3fc04SMagnus Damm 
190dc3fc04SMagnus Damm 	/* interrupt sources */
200dc3fc04SMagnus Damm 	IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
210dc3fc04SMagnus Damm 	WDT, EDMAC, CMT0, CMT1,
22*5dece2bbSPaul Mundt 	SCIF0, SCIF1, SCIF2,
230dc3fc04SMagnus Damm 	HIF_HIFI, HIF_HIFBI,
240dc3fc04SMagnus Damm 	DMAC0, DMAC1, DMAC2, DMAC3,
250dc3fc04SMagnus Damm 	SIOF,
260dc3fc04SMagnus Damm };
270dc3fc04SMagnus Damm 
280dc3fc04SMagnus Damm static struct intc_vect vectors[] __initdata = {
290dc3fc04SMagnus Damm 	INTC_IRQ(IRQ0, 64), INTC_IRQ(IRQ1, 65),
300dc3fc04SMagnus Damm 	INTC_IRQ(IRQ2, 66), INTC_IRQ(IRQ3, 67),
310dc3fc04SMagnus Damm 	INTC_IRQ(IRQ4, 80), INTC_IRQ(IRQ5, 81),
320dc3fc04SMagnus Damm 	INTC_IRQ(IRQ6, 82), INTC_IRQ(IRQ7, 83),
330dc3fc04SMagnus Damm 	INTC_IRQ(WDT, 84), INTC_IRQ(EDMAC, 85),
340dc3fc04SMagnus Damm 	INTC_IRQ(CMT0, 86), INTC_IRQ(CMT1, 87),
35*5dece2bbSPaul Mundt 	INTC_IRQ(SCIF0, 88), INTC_IRQ(SCIF0, 89),
36*5dece2bbSPaul Mundt 	INTC_IRQ(SCIF0, 90), INTC_IRQ(SCIF0, 91),
37*5dece2bbSPaul Mundt 	INTC_IRQ(SCIF1, 92), INTC_IRQ(SCIF1, 93),
38*5dece2bbSPaul Mundt 	INTC_IRQ(SCIF1, 94), INTC_IRQ(SCIF1, 95),
39*5dece2bbSPaul Mundt 	INTC_IRQ(SCIF2, 96), INTC_IRQ(SCIF2, 97),
40*5dece2bbSPaul Mundt 	INTC_IRQ(SCIF2, 98), INTC_IRQ(SCIF2, 99),
410dc3fc04SMagnus Damm 	INTC_IRQ(HIF_HIFI, 100), INTC_IRQ(HIF_HIFBI, 101),
420dc3fc04SMagnus Damm 	INTC_IRQ(DMAC0, 104), INTC_IRQ(DMAC1, 105),
430dc3fc04SMagnus Damm 	INTC_IRQ(DMAC2, 106), INTC_IRQ(DMAC3, 107),
440dc3fc04SMagnus Damm 	INTC_IRQ(SIOF, 108),
450dc3fc04SMagnus Damm };
460dc3fc04SMagnus Damm 
470dc3fc04SMagnus Damm static struct intc_prio_reg prio_registers[] __initdata = {
480dc3fc04SMagnus Damm 	{ 0xf8140006, 0, 16, 4, /* IPRA */ { IRQ0, IRQ1, IRQ2, IRQ3 } },
490dc3fc04SMagnus Damm 	{ 0xf8140008, 0, 16, 4, /* IPRB */ { IRQ4, IRQ5, IRQ6, IRQ7 } },
500dc3fc04SMagnus Damm 	{ 0xf8080000, 0, 16, 4, /* IPRC */ { WDT, EDMAC, CMT0, CMT1 } },
510dc3fc04SMagnus Damm 	{ 0xf8080002, 0, 16, 4, /* IPRD */ { SCIF0, SCIF1, SCIF2 } },
520dc3fc04SMagnus Damm 	{ 0xf8080004, 0, 16, 4, /* IPRE */ { HIF_HIFI, HIF_HIFBI } },
530dc3fc04SMagnus Damm 	{ 0xf8080006, 0, 16, 4, /* IPRF */ { DMAC0, DMAC1, DMAC2, DMAC3 } },
540dc3fc04SMagnus Damm 	{ 0xf8080008, 0, 16, 4, /* IPRG */ { SIOF } },
550dc3fc04SMagnus Damm };
560dc3fc04SMagnus Damm 
57*5dece2bbSPaul Mundt static DECLARE_INTC_DESC(intc_desc, "sh7619", vectors, NULL,
587f3edee8SMagnus Damm 			 NULL, prio_registers, NULL);
590dc3fc04SMagnus Damm 
609d4436a6SYoshinori Sato static struct plat_sci_port sci_platform_data[] = {
619d4436a6SYoshinori Sato 	{
629d4436a6SYoshinori Sato 		.mapbase	= 0xf8400000,
639d4436a6SYoshinori Sato 		.flags		= UPF_BOOT_AUTOCONF,
649d4436a6SYoshinori Sato 		.type		= PORT_SCIF,
65*5dece2bbSPaul Mundt 		.irqs		= { 88, 88, 88, 88 },
669d4436a6SYoshinori Sato 	}, {
679d4436a6SYoshinori Sato 		.mapbase	= 0xf8410000,
689d4436a6SYoshinori Sato 		.flags		= UPF_BOOT_AUTOCONF,
699d4436a6SYoshinori Sato 		.type		= PORT_SCIF,
70*5dece2bbSPaul Mundt 		.irqs		= { 92, 92, 92, 92 },
719d4436a6SYoshinori Sato 	}, {
729d4436a6SYoshinori Sato 		.mapbase	= 0xf8420000,
739d4436a6SYoshinori Sato 		.flags		= UPF_BOOT_AUTOCONF,
749d4436a6SYoshinori Sato 		.type		= PORT_SCIF,
75*5dece2bbSPaul Mundt 		.irqs		= { 96, 96, 96, 96 },
769d4436a6SYoshinori Sato 	}, {
779d4436a6SYoshinori Sato 		.flags = 0,
789d4436a6SYoshinori Sato 	}
799d4436a6SYoshinori Sato };
809d4436a6SYoshinori Sato 
819d4436a6SYoshinori Sato static struct platform_device sci_device = {
829d4436a6SYoshinori Sato 	.name		= "sh-sci",
839d4436a6SYoshinori Sato 	.id		= -1,
849d4436a6SYoshinori Sato 	.dev		= {
859d4436a6SYoshinori Sato 		.platform_data	= sci_platform_data,
869d4436a6SYoshinori Sato 	},
879d4436a6SYoshinori Sato };
889d4436a6SYoshinori Sato 
89d88a3ea6SYoshinori Sato static struct resource eth_resources[] = {
90d88a3ea6SYoshinori Sato 	[0] = {
91d88a3ea6SYoshinori Sato 		.start = 0xfb000000,
92d88a3ea6SYoshinori Sato 		.end =   0xfb0001c8,
93d88a3ea6SYoshinori Sato 		.flags = IORESOURCE_MEM,
94d88a3ea6SYoshinori Sato 	},
95d88a3ea6SYoshinori Sato 	[1] = {
96d88a3ea6SYoshinori Sato 		.start = 85,
97d88a3ea6SYoshinori Sato 		.end = 85,
98d88a3ea6SYoshinori Sato 		.flags = IORESOURCE_IRQ,
99d88a3ea6SYoshinori Sato 	},
100d88a3ea6SYoshinori Sato };
101d88a3ea6SYoshinori Sato 
102d88a3ea6SYoshinori Sato static struct platform_device eth_device = {
103d88a3ea6SYoshinori Sato 	.name = "sh-eth",
104d88a3ea6SYoshinori Sato 	.id	= -1,
105d88a3ea6SYoshinori Sato 	.dev = {
106d88a3ea6SYoshinori Sato 		.platform_data = (void *)1,
107d88a3ea6SYoshinori Sato 	},
108d88a3ea6SYoshinori Sato 	.num_resources = ARRAY_SIZE(eth_resources),
109d88a3ea6SYoshinori Sato 	.resource = eth_resources,
110d88a3ea6SYoshinori Sato };
111d88a3ea6SYoshinori Sato 
1129d4436a6SYoshinori Sato static struct platform_device *sh7619_devices[] __initdata = {
1139d4436a6SYoshinori Sato 	&sci_device,
114d88a3ea6SYoshinori Sato 	&eth_device,
1159d4436a6SYoshinori Sato };
1169d4436a6SYoshinori Sato 
1179d4436a6SYoshinori Sato static int __init sh7619_devices_setup(void)
1189d4436a6SYoshinori Sato {
1199d4436a6SYoshinori Sato 	return platform_add_devices(sh7619_devices,
1209d4436a6SYoshinori Sato 				    ARRAY_SIZE(sh7619_devices));
1219d4436a6SYoshinori Sato }
1229d4436a6SYoshinori Sato __initcall(sh7619_devices_setup);
123780a1568SYoshinori Sato 
12490015c89SMagnus Damm void __init plat_irq_setup(void)
125780a1568SYoshinori Sato {
1260dc3fc04SMagnus Damm 	register_intc_controller(&intc_desc);
127780a1568SYoshinori Sato }
128