Merge master.kernel.org:/pub/scm/linux/kernel/git/herbert/crypto-2.6
[linux-drm-fsl-dcu.git] / arch / sh / kernel / cpu / sh3 / setup-sh7705.c
1 /*
2  * SH7705 Setup
3  *
4  *  Copyright (C) 2006  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/serial.h>
14 #include <asm/sci.h>
15
16 static struct plat_sci_port sci_platform_data[] = {
17         {
18                 .mapbase        = 0xa4410000,
19                 .flags          = UPF_BOOT_AUTOCONF,
20                 .type           = PORT_SCIF,
21                 .irqs           = { 56, 57, 59 },
22         }, {
23                 .mapbase        = 0xa4400000,
24                 .flags          = UPF_BOOT_AUTOCONF,
25                 .type           = PORT_SCIF,
26                 .irqs           = { 52, 53, 55 },
27         }, {
28                 .flags = 0,
29         }
30 };
31
32 static struct platform_device sci_device = {
33         .name           = "sh-sci",
34         .id             = -1,
35         .dev            = {
36                 .platform_data  = sci_platform_data,
37         },
38 };
39
40 static struct platform_device *sh7705_devices[] __initdata = {
41         &sci_device,
42 };
43
44 static int __init sh7705_devices_setup(void)
45 {
46         return platform_add_devices(sh7705_devices,
47                                     ARRAY_SIZE(sh7705_devices));
48 }
49 __initcall(sh7705_devices_setup);
50
51 static struct ipr_data sh7705_ipr_map[] = {
52         /* IRQ, IPR-idx, shift, priority */
53         { 16, 0, 12, 2 }, /* TMU0 TUNI*/
54         { 17, 0,  8, 2 }, /* TMU1 TUNI */
55         { 18, 0,  4, 2 }, /* TMU2 TUNI */
56         { 27, 1, 12, 2 }, /* WDT ITI */
57         { 20, 0,  0, 2 }, /* RTC ATI (alarm) */
58         { 21, 0,  0, 2 }, /* RTC PRI (period) */
59         { 22, 0,  0, 2 }, /* RTC CUI (carry) */
60         { 48, 4, 12, 7 }, /* DMAC DMTE0 */
61         { 49, 4, 12, 7 }, /* DMAC DMTE1 */
62         { 50, 4, 12, 7 }, /* DMAC DMTE2 */
63         { 51, 4, 12, 7 }, /* DMAC DMTE3 */
64         { 52, 4,  8, 3 }, /* SCIF0 ERI */
65         { 53, 4,  8, 3 }, /* SCIF0 RXI */
66         { 55, 4,  8, 3 }, /* SCIF0 TXI */
67         { 56, 4,  4, 3 }, /* SCIF1 ERI */
68         { 57, 4,  4, 3 }, /* SCIF1 RXI */
69         { 59, 4,  4, 3 }, /* SCIF1 TXI */
70 };
71
72 static unsigned long ipr_offsets[] = {
73         0xFFFFFEE2      /* 0: IPRA */
74 ,       0xFFFFFEE4      /* 1: IPRB */
75 ,       0xA4000016      /* 2: IPRC */
76 ,       0xA4000018      /* 3: IPRD */
77 ,       0xA400001A      /* 4: IPRE */
78 ,       0xA4080000      /* 5: IPRF */
79 ,       0xA4080002      /* 6: IPRG */
80 ,       0xA4080004      /* 7: IPRH */
81 };
82
83 /* given the IPR index return the address of the IPR register */
84 unsigned int map_ipridx_to_addr(int idx)
85 {
86         if (idx >= ARRAY_SIZE(ipr_offsets))
87                 return 0;
88         return ipr_offsets[idx];
89 }
90
91 void __init init_IRQ_ipr()
92 {
93         make_ipr_irq(sh7705_ipr_map, ARRAY_SIZE(sh7705_ipr_map));
94 }