Merge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-pull
[linux-2.6] / arch / sh / boards / mach-x3proto / setup.c
1 /*
2  * arch/sh/boards/renesas/x3proto/setup.c
3  *
4  * Renesas SH-X3 Prototype Board Support.
5  *
6  * Copyright (C) 2007 Paul Mundt
7  *
8  * This file is subject to the terms and conditions of the GNU General Public
9  * License.  See the file "COPYING" in the main directory of this archive
10  * for more details.
11  */
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/kernel.h>
15 #include <linux/io.h>
16 #include <asm/ilsel.h>
17
18 static struct resource heartbeat_resources[] = {
19         [0] = {
20                 .start  = 0xb8140020,
21                 .end    = 0xb8140020,
22                 .flags  = IORESOURCE_MEM,
23         },
24 };
25
26 static struct platform_device heartbeat_device = {
27         .name           = "heartbeat",
28         .id             = -1,
29         .num_resources  = ARRAY_SIZE(heartbeat_resources),
30         .resource       = heartbeat_resources,
31 };
32
33 static struct resource smc91x_resources[] = {
34         [0] = {
35                 .start          = 0x18000300,
36                 .end            = 0x18000300 + 0x10 - 1,
37                 .flags          = IORESOURCE_MEM,
38         },
39         [1] = {
40                 /* Filled in by ilsel */
41                 .flags          = IORESOURCE_IRQ,
42         },
43 };
44
45 static struct platform_device smc91x_device = {
46         .name           = "smc91x",
47         .id             = -1,
48         .resource       = smc91x_resources,
49         .num_resources  = ARRAY_SIZE(smc91x_resources),
50 };
51
52 static struct resource r8a66597_usb_host_resources[] = {
53         [0] = {
54                 .name   = "r8a66597_hcd",
55                 .start  = 0x18040000,
56                 .end    = 0x18080000 - 1,
57                 .flags  = IORESOURCE_MEM,
58         },
59         [1] = {
60                 .name   = "r8a66597_hcd",
61                 /* Filled in by ilsel */
62                 .flags  = IORESOURCE_IRQ,
63         },
64 };
65
66 static struct platform_device r8a66597_usb_host_device = {
67         .name           = "r8a66597_hcd",
68         .id             = -1,
69         .dev = {
70                 .dma_mask               = NULL,         /* don't use dma */
71                 .coherent_dma_mask      = 0xffffffff,
72         },
73         .num_resources  = ARRAY_SIZE(r8a66597_usb_host_resources),
74         .resource       = r8a66597_usb_host_resources,
75 };
76
77 static struct resource m66592_usb_peripheral_resources[] = {
78         [0] = {
79                 .name   = "m66592_udc",
80                 .start  = 0x18080000,
81                 .end    = 0x180c0000 - 1,
82                 .flags  = IORESOURCE_MEM,
83         },
84         [1] = {
85                 .name   = "m66592_udc",
86                 /* Filled in by ilsel */
87                 .flags  = IORESOURCE_IRQ,
88         },
89 };
90
91 static struct platform_device m66592_usb_peripheral_device = {
92         .name           = "m66592_udc",
93         .id             = -1,
94         .dev = {
95                 .dma_mask               = NULL,         /* don't use dma */
96                 .coherent_dma_mask      = 0xffffffff,
97         },
98         .num_resources  = ARRAY_SIZE(m66592_usb_peripheral_resources),
99         .resource       = m66592_usb_peripheral_resources,
100 };
101
102 static struct platform_device *x3proto_devices[] __initdata = {
103         &heartbeat_device,
104         &smc91x_device,
105         &r8a66597_usb_host_device,
106         &m66592_usb_peripheral_device,
107 };
108
109 static int __init x3proto_devices_setup(void)
110 {
111         r8a66597_usb_host_resources[1].start =
112                 r8a66597_usb_host_resources[1].end = ilsel_enable(ILSEL_USBH_I);
113
114         m66592_usb_peripheral_resources[1].start =
115                 m66592_usb_peripheral_resources[1].end = ilsel_enable(ILSEL_USBP_I);
116
117         smc91x_resources[1].start =
118                 smc91x_resources[1].end = ilsel_enable(ILSEL_LAN);
119
120         return platform_add_devices(x3proto_devices,
121                                     ARRAY_SIZE(x3proto_devices));
122 }
123 device_initcall(x3proto_devices_setup);
124
125 static void __init x3proto_init_irq(void)
126 {
127         plat_irq_setup_pins(IRQ_MODE_IRL3210);
128
129         /* Set ICR0.LVLMODE */
130         ctrl_outl(ctrl_inl(0xfe410000) | (1 << 21), 0xfe410000);
131 }
132
133 static struct sh_machine_vector mv_x3proto __initmv = {
134         .mv_name                = "x3proto",
135         .mv_init_irq            = x3proto_init_irq,
136 };