• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/arch/sh/boards/mach-x3proto/
1/*
2 * arch/sh/boards/renesas/x3proto/setup.c
3 *
4 * Renesas SH-X3 Prototype Board Support.
5 *
6 * Copyright (C) 2007 - 2008 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 <linux/smc91x.h>
17#include <linux/irq.h>
18#include <linux/interrupt.h>
19#include <linux/usb/r8a66597.h>
20#include <linux/usb/m66592.h>
21#include <asm/ilsel.h>
22#include <asm/smp-ops.h>
23
24static struct resource heartbeat_resources[] = {
25	[0] = {
26		.start	= 0xb8140020,
27		.end	= 0xb8140020,
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
39static struct smc91x_platdata smc91x_info = {
40	.flags	= SMC91X_USE_16BIT | SMC91X_NOWAIT,
41};
42
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),
60	.dev	= {
61		.platform_data = &smc91x_info,
62	},
63};
64
65static struct r8a66597_platdata r8a66597_data = {
66	.xtal = R8A66597_PLATDATA_XTAL_12MHZ,
67	.vif = 1,
68};
69
70static struct resource r8a66597_usb_host_resources[] = {
71	[0] = {
72		.start	= 0x18040000,
73		.end	= 0x18080000 - 1,
74		.flags	= IORESOURCE_MEM,
75	},
76	[1] = {
77		/* Filled in by ilsel */
78		.flags	= IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
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,
88		.platform_data		= &r8a66597_data,
89	},
90	.num_resources	= ARRAY_SIZE(r8a66597_usb_host_resources),
91	.resource	= r8a66597_usb_host_resources,
92};
93
94static struct m66592_platdata usbf_platdata = {
95	.xtal = M66592_PLATDATA_XTAL_24MHZ,
96	.vif = 1,
97};
98
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,
119		.platform_data		= &usbf_platdata,
120	},
121	.num_resources	= ARRAY_SIZE(m66592_usb_peripheral_resources),
122	.resource	= m66592_usb_peripheral_resources,
123};
124
125static struct platform_device *x3proto_devices[] __initdata = {
126	&heartbeat_device,
127	&smc91x_device,
128	&r8a66597_usb_host_device,
129	&m66592_usb_peripheral_device,
130};
131
132static int __init x3proto_devices_setup(void)
133{
134	r8a66597_usb_host_resources[1].start =
135		r8a66597_usb_host_resources[1].end = ilsel_enable(ILSEL_USBH_I);
136
137	m66592_usb_peripheral_resources[1].start =
138		m66592_usb_peripheral_resources[1].end = ilsel_enable(ILSEL_USBP_I);
139
140	smc91x_resources[1].start =
141		smc91x_resources[1].end = ilsel_enable(ILSEL_LAN);
142
143	return platform_add_devices(x3proto_devices,
144				    ARRAY_SIZE(x3proto_devices));
145}
146device_initcall(x3proto_devices_setup);
147
148static void __init x3proto_init_irq(void)
149{
150	plat_irq_setup_pins(IRQ_MODE_IRL3210);
151
152	/* Set ICR0.LVLMODE */
153	__raw_writel(__raw_readl(0xfe410000) | (1 << 21), 0xfe410000);
154}
155
156static void __init x3proto_setup(char **cmdline_p)
157{
158	register_smp_ops(&shx3_smp_ops);
159}
160
161static struct sh_machine_vector mv_x3proto __initmv = {
162	.mv_name		= "x3proto",
163	.mv_setup		= x3proto_setup,
164	.mv_init_irq		= x3proto_init_irq,
165};
166