Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
[pandora-kernel.git] / arch / sh / kernel / cpu / sh3 / setup-sh7709.c
1 /*
2  * SH7707/SH7709 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
15 static struct resource rtc_resources[] = {
16         [0] =   {
17                 .start  = 0xfffffec0,
18                 .end    = 0xfffffec0 + 0x1e,
19                 .flags  = IORESOURCE_IO,
20         },
21         [1] =   {
22                 .start  = 20,
23                 .flags  = IORESOURCE_IRQ,
24         },
25         [2] =   {
26                 .start  = 21,
27                 .flags  = IORESOURCE_IRQ,
28         },
29         [3] =   {
30                 .start  = 22,
31                 .flags  = IORESOURCE_IRQ,
32         },
33 };
34
35 static struct plat_sci_port sci_platform_data[] = {
36         {
37                 .mapbase        = 0xfffffe80,
38                 .flags          = UPF_BOOT_AUTOCONF,
39                 .type           = PORT_SCI,
40                 .irqs           = { 23, 24, 25, 0 },
41         }, {
42                 .mapbase        = 0xa4000150,
43                 .flags          = UPF_BOOT_AUTOCONF,
44                 .type           = PORT_SCIF,
45                 .irqs           = { 56, 57, 59, 58 },
46         }, {
47                 .mapbase        = 0xa4000140,
48                 .flags          = UPF_BOOT_AUTOCONF,
49                 .type           = PORT_IRDA,
50                 .irqs           = { 52, 53, 55, 54 },
51         }, {
52                 .flags = 0,
53         }
54 };
55
56 static struct platform_device sci_device = {
57         .name           = "sh-sci",
58         .id             = -1,
59         .dev            = {
60                 .platform_data  = sci_platform_data,
61         },
62 };
63
64 static struct platform_device rtc_device = {
65         .name           = "sh-rtc",
66         .id             = -1,
67         .num_resources  = ARRAY_SIZE(rtc_resources),
68         .resource       = rtc_resources,
69 };
70
71 static struct platform_device *sh7709_devices[] __initdata = {
72         &sci_device,
73         &rtc_device,
74 };
75
76 static int __init sh7709_devices_setup(void)
77 {
78         return platform_add_devices(sh7709_devices,
79                 ARRAY_SIZE(sh7709_devices));
80 }
81 __initcall(sh7709_devices_setup);
82
83 static struct ipr_data ipr_irq_table[] = {
84         { 16, 0, 12, 2 }, /* TMU TUNI0 */
85         { 17, 0, 8,  4 }, /* TMU TUNI1 */
86         { 18, 0, 4,  1 }, /* TMU TUNI1 */
87         { 19, 0, 4,  1 }, /* TMU TUNI1 */
88         { 20, 0, 0,  2 }, /* RTC CUI */
89         { 21, 0, 0,  2 }, /* RTC CUI */
90         { 22, 0, 0,  2 }, /* RTC CUI */
91
92         { 23, 1, 4,  3 }, /* SCI */
93         { 24, 1, 4,  3 }, /* SCI */
94         { 25, 1, 4,  3 }, /* SCI */
95         { 26, 1, 4,  3 }, /* SCI */
96         { 27, 1, 12, 3 }, /* WDT ITI */
97
98         { 32, 2, 0,  1 }, /* IRQ 0 */
99         { 33, 2, 4,  1 }, /* IRQ 1 */
100         { 34, 2, 8,  1 }, /* IRQ 2 APM */
101         { 35, 2, 12, 1 }, /* IRQ 3 TOUCHSCREEN */
102
103         { 36, 3, 0,  1 }, /* IRQ 4 */
104         { 37, 3, 4,  1 }, /* IRQ 5 */
105
106         { 48, 4, 12, 7 }, /* DMA */
107         { 49, 4, 12, 7 }, /* DMA */
108         { 50, 4, 12, 7 }, /* DMA */
109         { 51, 4, 12, 7 }, /* DMA */
110
111         { 52, 4, 8,  3 }, /* IRDA */
112         { 53, 4, 8,  3 }, /* IRDA */
113         { 54, 4, 8,  3 }, /* IRDA */
114         { 55, 4, 8,  3 }, /* IRDA */
115
116         { 56, 4, 4,  3 }, /* SCIF */
117         { 57, 4, 4,  3 }, /* SCIF */
118         { 58, 4, 4,  3 }, /* SCIF */
119         { 59, 4, 4,  3 }, /* SCIF */
120 };
121
122 static unsigned long ipr_offsets[] = {
123         0xfffffee2,     /* 0: IPRA */
124         0xfffffee4,     /* 1: IPRB */
125         0xa4000016,     /* 2: IPRC */
126         0xa4000018,     /* 3: IPRD */
127         0xa400001a,     /* 4: IPRE */
128 };
129
130 static struct ipr_desc ipr_irq_desc = {
131         .ipr_offsets    = ipr_offsets,
132         .nr_offsets     = ARRAY_SIZE(ipr_offsets),
133
134         .ipr_data       = ipr_irq_table,
135         .nr_irqs        = ARRAY_SIZE(ipr_irq_table),
136
137         .chip = {
138                 .name   = "IPR-sh7709",
139         },
140 };
141
142 void __init plat_irq_setup(void)
143 {
144         register_ipr_controller(&ipr_irq_desc);
145 }