]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/sh/boards/mach-x3proto/setup.c
sh: mach-x3proto: Move the ilsel header to a better place.
[net-next-2.6.git] / arch / sh / boards / mach-x3proto / setup.c
CommitLineData
94807a33
PM
1/*
2 * arch/sh/boards/renesas/x3proto/setup.c
3 *
4 * Renesas SH-X3 Prototype Board Support.
5 *
e77eb364 6 * Copyright (C) 2007 - 2008 Paul Mundt
94807a33
PM
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>
e77eb364 16#include <linux/smc91x.h>
10f0fc17 17#include <linux/irq.h>
fcaf99d2
YS
18#include <linux/interrupt.h>
19#include <linux/usb/r8a66597.h>
2c59b0b7 20#include <linux/usb/m66592.h>
d39d0ed1 21#include <mach/ilsel.h>
3366e358 22#include <asm/smp-ops.h>
94807a33
PM
23
24static struct resource heartbeat_resources[] = {
25 [0] = {
26 .start = 0xb8140020,
a1fd306b 27 .end = 0xb8140020,
94807a33
PM
28 .flags = IORESOURCE_MEM,
29 },
30};
31
32static struct platform_device heartbeat_device = {
33 .name = "heartbeat",
34 .id = -1,
35 .num_resources = ARRAY_SIZE(heartbeat_resources),
36 .resource = heartbeat_resources,
37};
38
e77eb364
PM
39static struct smc91x_platdata smc91x_info = {
40 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
41};
42
e7109a96
PM
43static struct resource smc91x_resources[] = {
44 [0] = {
45 .start = 0x18000300,
46 .end = 0x18000300 + 0x10 - 1,
47 .flags = IORESOURCE_MEM,
48 },
49 [1] = {
50 /* Filled in by ilsel */
51 .flags = IORESOURCE_IRQ,
52 },
53};
54
55static struct platform_device smc91x_device = {
56 .name = "smc91x",
57 .id = -1,
58 .resource = smc91x_resources,
59 .num_resources = ARRAY_SIZE(smc91x_resources),
e77eb364
PM
60 .dev = {
61 .platform_data = &smc91x_info,
62 },
e7109a96
PM
63};
64
fcaf99d2
YS
65static struct r8a66597_platdata r8a66597_data = {
66 .xtal = R8A66597_PLATDATA_XTAL_12MHZ,
67 .vif = 1,
68};
69
e7109a96
PM
70static struct resource r8a66597_usb_host_resources[] = {
71 [0] = {
e7109a96
PM
72 .start = 0x18040000,
73 .end = 0x18080000 - 1,
74 .flags = IORESOURCE_MEM,
75 },
76 [1] = {
e7109a96 77 /* Filled in by ilsel */
fcaf99d2 78 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
e7109a96
PM
79 },
80};
81
82static struct platform_device r8a66597_usb_host_device = {
83 .name = "r8a66597_hcd",
84 .id = -1,
85 .dev = {
86 .dma_mask = NULL, /* don't use dma */
87 .coherent_dma_mask = 0xffffffff,
fcaf99d2 88 .platform_data = &r8a66597_data,
e7109a96
PM
89 },
90 .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources),
91 .resource = r8a66597_usb_host_resources,
92};
93
2c59b0b7
MD
94static struct m66592_platdata usbf_platdata = {
95 .xtal = M66592_PLATDATA_XTAL_24MHZ,
96 .vif = 1,
97};
98
e7109a96
PM
99static struct resource m66592_usb_peripheral_resources[] = {
100 [0] = {
101 .name = "m66592_udc",
102 .start = 0x18080000,
103 .end = 0x180c0000 - 1,
104 .flags = IORESOURCE_MEM,
105 },
106 [1] = {
107 .name = "m66592_udc",
108 /* Filled in by ilsel */
109 .flags = IORESOURCE_IRQ,
110 },
111};
112
113static struct platform_device m66592_usb_peripheral_device = {
114 .name = "m66592_udc",
115 .id = -1,
116 .dev = {
117 .dma_mask = NULL, /* don't use dma */
118 .coherent_dma_mask = 0xffffffff,
2c59b0b7 119 .platform_data = &usbf_platdata,
e7109a96
PM
120 },
121 .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources),
122 .resource = m66592_usb_peripheral_resources,
123};
124
94807a33
PM
125static struct platform_device *x3proto_devices[] __initdata = {
126 &heartbeat_device,
e7109a96
PM
127 &smc91x_device,
128 &r8a66597_usb_host_device,
129 &m66592_usb_peripheral_device,
94807a33
PM
130};
131
4bacd796
PM
132static void __init x3proto_init_irq(void)
133{
134 plat_irq_setup_pins(IRQ_MODE_IRL3210);
135
136 /* Set ICR0.LVLMODE */
137 __raw_writel(__raw_readl(0xfe410000) | (1 << 21), 0xfe410000);
138}
139
94807a33
PM
140static int __init x3proto_devices_setup(void)
141{
4bacd796
PM
142 /*
143 * IRLs are only needed for ILSEL mappings, so flip over the INTC
144 * pins at a later point to enable the GPIOs to settle.
145 */
146 x3proto_init_irq();
147
e7109a96
PM
148 r8a66597_usb_host_resources[1].start =
149 r8a66597_usb_host_resources[1].end = ilsel_enable(ILSEL_USBH_I);
150
151 m66592_usb_peripheral_resources[1].start =
152 m66592_usb_peripheral_resources[1].end = ilsel_enable(ILSEL_USBP_I);
153
154 smc91x_resources[1].start =
155 smc91x_resources[1].end = ilsel_enable(ILSEL_LAN);
156
94807a33
PM
157 return platform_add_devices(x3proto_devices,
158 ARRAY_SIZE(x3proto_devices));
159}
160device_initcall(x3proto_devices_setup);
161
3366e358
PM
162static void __init x3proto_setup(char **cmdline_p)
163{
164 register_smp_ops(&shx3_smp_ops);
165}
166
94807a33
PM
167static struct sh_machine_vector mv_x3proto __initmv = {
168 .mv_name = "x3proto",
3366e358 169 .mv_setup = x3proto_setup,
94807a33 170};