blob: 8913ae39a8025db3f789ccf2e75bd2094730d19e [file] [log] [blame]
Paul Mundt94807a32007-08-08 15:22:04 +09001/*
2 * arch/sh/boards/renesas/x3proto/setup.c
3 *
4 * Renesas SH-X3 Prototype Board Support.
5 *
Paul Mundte77eb362008-08-05 13:16:56 +09006 * Copyright (C) 2007 - 2008 Paul Mundt
Paul Mundt94807a32007-08-08 15:22:04 +09007 *
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>
Paul Mundte77eb362008-08-05 13:16:56 +090016#include <linux/smc91x.h>
Paul Mundt10f0fc12009-01-07 17:45:02 +090017#include <linux/irq.h>
Yoshihiro Shimodafcaf99d2009-05-26 09:33:08 +000018#include <linux/interrupt.h>
19#include <linux/usb/r8a66597.h>
Paul Mundte7109a92007-08-08 15:27:55 +090020#include <asm/ilsel.h>
Paul Mundt94807a32007-08-08 15:22:04 +090021
22static struct resource heartbeat_resources[] = {
23 [0] = {
24 .start = 0xb8140020,
Paul Mundta1fd3062007-08-23 15:11:44 +090025 .end = 0xb8140020,
Paul Mundt94807a32007-08-08 15:22:04 +090026 .flags = IORESOURCE_MEM,
27 },
28};
29
30static struct platform_device heartbeat_device = {
31 .name = "heartbeat",
32 .id = -1,
33 .num_resources = ARRAY_SIZE(heartbeat_resources),
34 .resource = heartbeat_resources,
35};
36
Paul Mundte77eb362008-08-05 13:16:56 +090037static struct smc91x_platdata smc91x_info = {
38 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
39};
40
Paul Mundte7109a92007-08-08 15:27:55 +090041static struct resource smc91x_resources[] = {
42 [0] = {
43 .start = 0x18000300,
44 .end = 0x18000300 + 0x10 - 1,
45 .flags = IORESOURCE_MEM,
46 },
47 [1] = {
48 /* Filled in by ilsel */
49 .flags = IORESOURCE_IRQ,
50 },
51};
52
53static struct platform_device smc91x_device = {
54 .name = "smc91x",
55 .id = -1,
56 .resource = smc91x_resources,
57 .num_resources = ARRAY_SIZE(smc91x_resources),
Paul Mundte77eb362008-08-05 13:16:56 +090058 .dev = {
59 .platform_data = &smc91x_info,
60 },
Paul Mundte7109a92007-08-08 15:27:55 +090061};
62
Yoshihiro Shimodafcaf99d2009-05-26 09:33:08 +000063static struct r8a66597_platdata r8a66597_data = {
64 .xtal = R8A66597_PLATDATA_XTAL_12MHZ,
65 .vif = 1,
66};
67
Paul Mundte7109a92007-08-08 15:27:55 +090068static struct resource r8a66597_usb_host_resources[] = {
69 [0] = {
Paul Mundte7109a92007-08-08 15:27:55 +090070 .start = 0x18040000,
71 .end = 0x18080000 - 1,
72 .flags = IORESOURCE_MEM,
73 },
74 [1] = {
Paul Mundte7109a92007-08-08 15:27:55 +090075 /* Filled in by ilsel */
Yoshihiro Shimodafcaf99d2009-05-26 09:33:08 +000076 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
Paul Mundte7109a92007-08-08 15:27:55 +090077 },
78};
79
80static 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,
Yoshihiro Shimodafcaf99d2009-05-26 09:33:08 +000086 .platform_data = &r8a66597_data,
Paul Mundte7109a92007-08-08 15:27:55 +090087 },
88 .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources),
89 .resource = r8a66597_usb_host_resources,
90};
91
92static struct resource m66592_usb_peripheral_resources[] = {
93 [0] = {
94 .name = "m66592_udc",
95 .start = 0x18080000,
96 .end = 0x180c0000 - 1,
97 .flags = IORESOURCE_MEM,
98 },
99 [1] = {
100 .name = "m66592_udc",
101 /* Filled in by ilsel */
102 .flags = IORESOURCE_IRQ,
103 },
104};
105
106static 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,
112 },
113 .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources),
114 .resource = m66592_usb_peripheral_resources,
115};
116
Paul Mundt94807a32007-08-08 15:22:04 +0900117static struct platform_device *x3proto_devices[] __initdata = {
118 &heartbeat_device,
Paul Mundte7109a92007-08-08 15:27:55 +0900119 &smc91x_device,
120 &r8a66597_usb_host_device,
121 &m66592_usb_peripheral_device,
Paul Mundt94807a32007-08-08 15:22:04 +0900122};
123
124static int __init x3proto_devices_setup(void)
125{
Paul Mundte7109a92007-08-08 15:27:55 +0900126 r8a66597_usb_host_resources[1].start =
127 r8a66597_usb_host_resources[1].end = ilsel_enable(ILSEL_USBH_I);
128
129 m66592_usb_peripheral_resources[1].start =
130 m66592_usb_peripheral_resources[1].end = ilsel_enable(ILSEL_USBP_I);
131
132 smc91x_resources[1].start =
133 smc91x_resources[1].end = ilsel_enable(ILSEL_LAN);
134
Paul Mundt94807a32007-08-08 15:22:04 +0900135 return platform_add_devices(x3proto_devices,
136 ARRAY_SIZE(x3proto_devices));
137}
138device_initcall(x3proto_devices_setup);
139
140static void __init x3proto_init_irq(void)
141{
142 plat_irq_setup_pins(IRQ_MODE_IRL3210);
143
144 /* Set ICR0.LVLMODE */
145 ctrl_outl(ctrl_inl(0xfe410000) | (1 << 21), 0xfe410000);
146}
147
148static struct sh_machine_vector mv_x3proto __initmv = {
149 .mv_name = "x3proto",
150 .mv_init_irq = x3proto_init_irq,
151};