1
2
3
4
5
6
7
8
9
10
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
23static struct resource heartbeat_resources[] = {
24 [0] = {
25 .start = 0xb8140020,
26 .end = 0xb8140020,
27 .flags = IORESOURCE_MEM,
28 },
29};
30
31static struct platform_device heartbeat_device = {
32 .name = "heartbeat",
33 .id = -1,
34 .num_resources = ARRAY_SIZE(heartbeat_resources),
35 .resource = heartbeat_resources,
36};
37
38static struct smc91x_platdata smc91x_info = {
39 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
40};
41
42static struct resource smc91x_resources[] = {
43 [0] = {
44 .start = 0x18000300,
45 .end = 0x18000300 + 0x10 - 1,
46 .flags = IORESOURCE_MEM,
47 },
48 [1] = {
49
50 .flags = IORESOURCE_IRQ,
51 },
52};
53
54static struct platform_device smc91x_device = {
55 .name = "smc91x",
56 .id = -1,
57 .resource = smc91x_resources,
58 .num_resources = ARRAY_SIZE(smc91x_resources),
59 .dev = {
60 .platform_data = &smc91x_info,
61 },
62};
63
64static struct r8a66597_platdata r8a66597_data = {
65 .xtal = R8A66597_PLATDATA_XTAL_12MHZ,
66 .vif = 1,
67};
68
69static struct resource r8a66597_usb_host_resources[] = {
70 [0] = {
71 .start = 0x18040000,
72 .end = 0x18080000 - 1,
73 .flags = IORESOURCE_MEM,
74 },
75 [1] = {
76
77 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
78 },
79};
80
81static struct platform_device r8a66597_usb_host_device = {
82 .name = "r8a66597_hcd",
83 .id = -1,
84 .dev = {
85 .dma_mask = NULL,
86 .coherent_dma_mask = 0xffffffff,
87 .platform_data = &r8a66597_data,
88 },
89 .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources),
90 .resource = r8a66597_usb_host_resources,
91};
92
93static struct m66592_platdata usbf_platdata = {
94 .xtal = M66592_PLATDATA_XTAL_24MHZ,
95 .vif = 1,
96};
97
98static struct resource m66592_usb_peripheral_resources[] = {
99 [0] = {
100 .name = "m66592_udc",
101 .start = 0x18080000,
102 .end = 0x180c0000 - 1,
103 .flags = IORESOURCE_MEM,
104 },
105 [1] = {
106 .name = "m66592_udc",
107
108 .flags = IORESOURCE_IRQ,
109 },
110};
111
112static struct platform_device m66592_usb_peripheral_device = {
113 .name = "m66592_udc",
114 .id = -1,
115 .dev = {
116 .dma_mask = NULL,
117 .coherent_dma_mask = 0xffffffff,
118 .platform_data = &usbf_platdata,
119 },
120 .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources),
121 .resource = m66592_usb_peripheral_resources,
122};
123
124static struct platform_device *x3proto_devices[] __initdata = {
125 &heartbeat_device,
126 &smc91x_device,
127 &r8a66597_usb_host_device,
128 &m66592_usb_peripheral_device,
129};
130
131static int __init x3proto_devices_setup(void)
132{
133 r8a66597_usb_host_resources[1].start =
134 r8a66597_usb_host_resources[1].end = ilsel_enable(ILSEL_USBH_I);
135
136 m66592_usb_peripheral_resources[1].start =
137 m66592_usb_peripheral_resources[1].end = ilsel_enable(ILSEL_USBP_I);
138
139 smc91x_resources[1].start =
140 smc91x_resources[1].end = ilsel_enable(ILSEL_LAN);
141
142 return platform_add_devices(x3proto_devices,
143 ARRAY_SIZE(x3proto_devices));
144}
145device_initcall(x3proto_devices_setup);
146
147static void __init x3proto_init_irq(void)
148{
149 plat_irq_setup_pins(IRQ_MODE_IRL3210);
150
151
152 ctrl_outl(ctrl_inl(0xfe410000) | (1 << 21), 0xfe410000);
153}
154
155static struct sh_machine_vector mv_x3proto __initmv = {
156 .mv_name = "x3proto",
157 .mv_init_irq = x3proto_init_irq,
158};
159