2 * arch/sh/boards/mach-x3proto/setup.c
4 * Renesas SH-X3 Prototype Board Support.
6 * Copyright (C) 2007 - 2010 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
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/kernel.h>
16 #include <linux/smc91x.h>
17 #include <linux/irq.h>
18 #include <linux/interrupt.h>
19 #include <linux/input.h>
20 #include <linux/usb/r8a66597.h>
21 #include <linux/usb/m66592.h>
22 #include <linux/gpio.h>
23 #include <linux/gpio_keys.h>
24 #include <mach/ilsel.h>
25 #include <mach/hardware.h>
26 #include <asm/smp-ops.h>
28 static struct resource heartbeat_resources
[] = {
32 .flags
= IORESOURCE_MEM
,
36 static struct platform_device heartbeat_device
= {
39 .num_resources
= ARRAY_SIZE(heartbeat_resources
),
40 .resource
= heartbeat_resources
,
43 static struct smc91x_platdata smc91x_info
= {
44 .flags
= SMC91X_USE_16BIT
| SMC91X_NOWAIT
,
47 static struct resource smc91x_resources
[] = {
50 .end
= 0x18000300 + 0x10 - 1,
51 .flags
= IORESOURCE_MEM
,
54 /* Filled in by ilsel */
55 .flags
= IORESOURCE_IRQ
,
59 static struct platform_device smc91x_device
= {
62 .resource
= smc91x_resources
,
63 .num_resources
= ARRAY_SIZE(smc91x_resources
),
65 .platform_data
= &smc91x_info
,
69 static struct r8a66597_platdata r8a66597_data
= {
70 .xtal
= R8A66597_PLATDATA_XTAL_12MHZ
,
74 static struct resource r8a66597_usb_host_resources
[] = {
77 .end
= 0x18080000 - 1,
78 .flags
= IORESOURCE_MEM
,
81 /* Filled in by ilsel */
82 .flags
= IORESOURCE_IRQ
| IRQF_TRIGGER_LOW
,
86 static struct platform_device r8a66597_usb_host_device
= {
87 .name
= "r8a66597_hcd",
90 .dma_mask
= NULL
, /* don't use dma */
91 .coherent_dma_mask
= 0xffffffff,
92 .platform_data
= &r8a66597_data
,
94 .num_resources
= ARRAY_SIZE(r8a66597_usb_host_resources
),
95 .resource
= r8a66597_usb_host_resources
,
98 static struct m66592_platdata usbf_platdata
= {
99 .xtal
= M66592_PLATDATA_XTAL_24MHZ
,
103 static struct resource m66592_usb_peripheral_resources
[] = {
105 .name
= "m66592_udc",
107 .end
= 0x180c0000 - 1,
108 .flags
= IORESOURCE_MEM
,
111 .name
= "m66592_udc",
112 /* Filled in by ilsel */
113 .flags
= IORESOURCE_IRQ
,
117 static struct platform_device m66592_usb_peripheral_device
= {
118 .name
= "m66592_udc",
121 .dma_mask
= NULL
, /* don't use dma */
122 .coherent_dma_mask
= 0xffffffff,
123 .platform_data
= &usbf_platdata
,
125 .num_resources
= ARRAY_SIZE(m66592_usb_peripheral_resources
),
126 .resource
= m66592_usb_peripheral_resources
,
129 static struct gpio_keys_button baseboard_buttons
[NR_BASEBOARD_GPIOS
] = {
142 .code
= KEY_KATAKANAHIRAGANA
,
146 .code
= KEY_SWITCHVIDEOMODE
,
199 static struct gpio_keys_platform_data baseboard_buttons_data
= {
200 .buttons
= baseboard_buttons
,
201 .nbuttons
= ARRAY_SIZE(baseboard_buttons
),
204 static struct platform_device baseboard_buttons_device
= {
208 .platform_data
= &baseboard_buttons_data
,
212 static struct platform_device
*x3proto_devices
[] __initdata
= {
215 &r8a66597_usb_host_device
,
216 &m66592_usb_peripheral_device
,
217 &baseboard_buttons_device
,
220 static void __init
x3proto_init_irq(void)
222 plat_irq_setup_pins(IRQ_MODE_IRL3210
);
224 /* Set ICR0.LVLMODE */
225 __raw_writel(__raw_readl(0xfe410000) | (1 << 21), 0xfe410000);
228 static int __init
x3proto_devices_setup(void)
233 * IRLs are only needed for ILSEL mappings, so flip over the INTC
234 * pins at a later point to enable the GPIOs to settle.
239 * Now that ILSELs are available, set up the baseboard GPIOs.
241 ret
= x3proto_gpio_setup();
246 * Propagate dynamic GPIOs for the baseboard button device.
248 for (i
= 0; i
< ARRAY_SIZE(baseboard_buttons
); i
++)
249 baseboard_buttons
[i
].gpio
= x3proto_gpio_chip
.base
+ i
;
251 r8a66597_usb_host_resources
[1].start
=
252 r8a66597_usb_host_resources
[1].end
= ilsel_enable(ILSEL_USBH_I
);
254 m66592_usb_peripheral_resources
[1].start
=
255 m66592_usb_peripheral_resources
[1].end
= ilsel_enable(ILSEL_USBP_I
);
257 smc91x_resources
[1].start
=
258 smc91x_resources
[1].end
= ilsel_enable(ILSEL_LAN
);
260 return platform_add_devices(x3proto_devices
,
261 ARRAY_SIZE(x3proto_devices
));
263 device_initcall(x3proto_devices_setup
);
265 static void __init
x3proto_setup(char **cmdline_p
)
267 register_smp_ops(&shx3_smp_ops
);
270 static struct sh_machine_vector mv_x3proto __initmv
= {
271 .mv_name
= "x3proto",
272 .mv_setup
= x3proto_setup
,