1/*
2 * SH7722 Setup
3 *
4 *  Copyright (C) 2006  Paul Mundt
5 *
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#include <asm/sci.h>
14
15static struct plat_sci_port sci_platform_data[] = {
16	{
17		.mapbase	= 0xffe00000,
18		.flags		= UPF_BOOT_AUTOCONF,
19		.type		= PORT_SCIF,
20		.irqs		= { 80, 81, 83, 82 },
21	}, {
22		.flags = 0,
23	}
24};
25
26static struct platform_device sci_device = {
27	.name		= "sh-sci",
28	.id		= -1,
29	.dev		= {
30		.platform_data	= sci_platform_data,
31	},
32};
33
34static struct platform_device *sh7722_devices[] __initdata = {
35	&sci_device,
36};
37
38static int __init sh7722_devices_setup(void)
39{
40	return platform_add_devices(sh7722_devices,
41				    ARRAY_SIZE(sh7722_devices));
42}
43__initcall(sh7722_devices_setup);
44
45static struct ipr_data sh7722_ipr_map[] = {
46	/* IRQ, IPR-idx, shift, prio */
47	{ 16, 0, 12, 2 }, /* TMU0 */
48	{ 17, 0,  8, 2 }, /* TMU1 */
49	{ 80, 6, 12, 3 }, /* SCIF ERI */
50	{ 81, 6, 12, 3 }, /* SCIF RXI */
51	{ 82, 6, 12, 3 }, /* SCIF BRI */
52	{ 83, 6, 12, 3 }, /* SCIF TXI */
53};
54
55static unsigned long ipr_offsets[] = {
56	0xa4080000, /*  0: IPRA */
57	0xa4080004, /*  1: IPRB */
58	0xa4080008, /*  2: IPRC */
59	0xa408000c, /*  3: IPRD */
60	0xa4080010, /*  4: IPRE */
61	0xa4080014, /*  5: IPRF */
62	0xa4080018, /*  6: IPRG */
63	0xa408001c, /*  7: IPRH */
64	0xa4080020, /*  8: IPRI */
65	0xa4080024, /*  9: IPRJ */
66	0xa4080028, /* 10: IPRK */
67	0xa408002c, /* 11: IPRL */
68};
69
70unsigned int map_ipridx_to_addr(int idx)
71{
72	if (unlikely(idx >= ARRAY_SIZE(ipr_offsets)))
73		return 0;
74	return ipr_offsets[idx];
75}
76
77void __init init_IRQ_ipr(void)
78{
79	make_ipr_irq(sh7722_ipr_map, ARRAY_SIZE(sh7722_ipr_map));
80}
81