Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
[linux/fpc-iii.git] / arch / sh / boards / mach-x3proto / setup.c
blob8913ae39a8025db3f789ccf2e75bd2094730d19e
1 /*
2 * arch/sh/boards/renesas/x3proto/setup.c
4 * Renesas SH-X3 Prototype Board Support.
6 * Copyright (C) 2007 - 2008 Paul Mundt
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.
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/kernel.h>
15 #include <linux/io.h>
16 #include <linux/smc91x.h>
17 #include <linux/irq.h>
18 #include <linux/interrupt.h>
19 #include <linux/usb/r8a66597.h>
20 #include <asm/ilsel.h>
22 static struct resource heartbeat_resources[] = {
23 [0] = {
24 .start = 0xb8140020,
25 .end = 0xb8140020,
26 .flags = IORESOURCE_MEM,
30 static struct platform_device heartbeat_device = {
31 .name = "heartbeat",
32 .id = -1,
33 .num_resources = ARRAY_SIZE(heartbeat_resources),
34 .resource = heartbeat_resources,
37 static struct smc91x_platdata smc91x_info = {
38 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
41 static struct resource smc91x_resources[] = {
42 [0] = {
43 .start = 0x18000300,
44 .end = 0x18000300 + 0x10 - 1,
45 .flags = IORESOURCE_MEM,
47 [1] = {
48 /* Filled in by ilsel */
49 .flags = IORESOURCE_IRQ,
53 static struct platform_device smc91x_device = {
54 .name = "smc91x",
55 .id = -1,
56 .resource = smc91x_resources,
57 .num_resources = ARRAY_SIZE(smc91x_resources),
58 .dev = {
59 .platform_data = &smc91x_info,
63 static struct r8a66597_platdata r8a66597_data = {
64 .xtal = R8A66597_PLATDATA_XTAL_12MHZ,
65 .vif = 1,
68 static struct resource r8a66597_usb_host_resources[] = {
69 [0] = {
70 .start = 0x18040000,
71 .end = 0x18080000 - 1,
72 .flags = IORESOURCE_MEM,
74 [1] = {
75 /* Filled in by ilsel */
76 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
80 static struct platform_device r8a66597_usb_host_device = {
81 .name = "r8a66597_hcd",
82 .id = -1,
83 .dev = {
84 .dma_mask = NULL, /* don't use dma */
85 .coherent_dma_mask = 0xffffffff,
86 .platform_data = &r8a66597_data,
88 .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources),
89 .resource = r8a66597_usb_host_resources,
92 static struct resource m66592_usb_peripheral_resources[] = {
93 [0] = {
94 .name = "m66592_udc",
95 .start = 0x18080000,
96 .end = 0x180c0000 - 1,
97 .flags = IORESOURCE_MEM,
99 [1] = {
100 .name = "m66592_udc",
101 /* Filled in by ilsel */
102 .flags = IORESOURCE_IRQ,
106 static struct platform_device m66592_usb_peripheral_device = {
107 .name = "m66592_udc",
108 .id = -1,
109 .dev = {
110 .dma_mask = NULL, /* don't use dma */
111 .coherent_dma_mask = 0xffffffff,
113 .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources),
114 .resource = m66592_usb_peripheral_resources,
117 static struct platform_device *x3proto_devices[] __initdata = {
118 &heartbeat_device,
119 &smc91x_device,
120 &r8a66597_usb_host_device,
121 &m66592_usb_peripheral_device,
124 static int __init x3proto_devices_setup(void)
126 r8a66597_usb_host_resources[1].start =
127 r8a66597_usb_host_resources[1].end = ilsel_enable(ILSEL_USBH_I);
129 m66592_usb_peripheral_resources[1].start =
130 m66592_usb_peripheral_resources[1].end = ilsel_enable(ILSEL_USBP_I);
132 smc91x_resources[1].start =
133 smc91x_resources[1].end = ilsel_enable(ILSEL_LAN);
135 return platform_add_devices(x3proto_devices,
136 ARRAY_SIZE(x3proto_devices));
138 device_initcall(x3proto_devices_setup);
140 static void __init x3proto_init_irq(void)
142 plat_irq_setup_pins(IRQ_MODE_IRL3210);
144 /* Set ICR0.LVLMODE */
145 ctrl_outl(ctrl_inl(0xfe410000) | (1 << 21), 0xfe410000);
148 static struct sh_machine_vector mv_x3proto __initmv = {
149 .mv_name = "x3proto",
150 .mv_init_irq = x3proto_init_irq,