blob: a70d23b21788e99db83270818cd71939909d7be7 [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 Mundte7109a92007-08-08 15:27:55 +090017#include <asm/ilsel.h>
Paul Mundt94807a32007-08-08 15:22:04 +090018
19static struct resource heartbeat_resources[] = {
20 [0] = {
21 .start = 0xb8140020,
Paul Mundta1fd3062007-08-23 15:11:44 +090022 .end = 0xb8140020,
Paul Mundt94807a32007-08-08 15:22:04 +090023 .flags = IORESOURCE_MEM,
24 },
25};
26
27static struct platform_device heartbeat_device = {
28 .name = "heartbeat",
29 .id = -1,
30 .num_resources = ARRAY_SIZE(heartbeat_resources),
31 .resource = heartbeat_resources,
32};
33
Paul Mundte77eb362008-08-05 13:16:56 +090034static struct smc91x_platdata smc91x_info = {
35 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
36};
37
Paul Mundte7109a92007-08-08 15:27:55 +090038static struct resource smc91x_resources[] = {
39 [0] = {
40 .start = 0x18000300,
41 .end = 0x18000300 + 0x10 - 1,
42 .flags = IORESOURCE_MEM,
43 },
44 [1] = {
45 /* Filled in by ilsel */
46 .flags = IORESOURCE_IRQ,
47 },
48};
49
50static struct platform_device smc91x_device = {
51 .name = "smc91x",
52 .id = -1,
53 .resource = smc91x_resources,
54 .num_resources = ARRAY_SIZE(smc91x_resources),
Paul Mundte77eb362008-08-05 13:16:56 +090055 .dev = {
56 .platform_data = &smc91x_info,
57 },
Paul Mundte7109a92007-08-08 15:27:55 +090058};
59
60static struct resource r8a66597_usb_host_resources[] = {
61 [0] = {
62 .name = "r8a66597_hcd",
63 .start = 0x18040000,
64 .end = 0x18080000 - 1,
65 .flags = IORESOURCE_MEM,
66 },
67 [1] = {
68 .name = "r8a66597_hcd",
69 /* Filled in by ilsel */
70 .flags = IORESOURCE_IRQ,
71 },
72};
73
74static struct platform_device r8a66597_usb_host_device = {
75 .name = "r8a66597_hcd",
76 .id = -1,
77 .dev = {
78 .dma_mask = NULL, /* don't use dma */
79 .coherent_dma_mask = 0xffffffff,
80 },
81 .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources),
82 .resource = r8a66597_usb_host_resources,
83};
84
85static struct resource m66592_usb_peripheral_resources[] = {
86 [0] = {
87 .name = "m66592_udc",
88 .start = 0x18080000,
89 .end = 0x180c0000 - 1,
90 .flags = IORESOURCE_MEM,
91 },
92 [1] = {
93 .name = "m66592_udc",
94 /* Filled in by ilsel */
95 .flags = IORESOURCE_IRQ,
96 },
97};
98
99static struct platform_device m66592_usb_peripheral_device = {
100 .name = "m66592_udc",
101 .id = -1,
102 .dev = {
103 .dma_mask = NULL, /* don't use dma */
104 .coherent_dma_mask = 0xffffffff,
105 },
106 .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources),
107 .resource = m66592_usb_peripheral_resources,
108};
109
Paul Mundt94807a32007-08-08 15:22:04 +0900110static struct platform_device *x3proto_devices[] __initdata = {
111 &heartbeat_device,
Paul Mundte7109a92007-08-08 15:27:55 +0900112 &smc91x_device,
113 &r8a66597_usb_host_device,
114 &m66592_usb_peripheral_device,
Paul Mundt94807a32007-08-08 15:22:04 +0900115};
116
117static int __init x3proto_devices_setup(void)
118{
Paul Mundte7109a92007-08-08 15:27:55 +0900119 r8a66597_usb_host_resources[1].start =
120 r8a66597_usb_host_resources[1].end = ilsel_enable(ILSEL_USBH_I);
121
122 m66592_usb_peripheral_resources[1].start =
123 m66592_usb_peripheral_resources[1].end = ilsel_enable(ILSEL_USBP_I);
124
125 smc91x_resources[1].start =
126 smc91x_resources[1].end = ilsel_enable(ILSEL_LAN);
127
Paul Mundt94807a32007-08-08 15:22:04 +0900128 return platform_add_devices(x3proto_devices,
129 ARRAY_SIZE(x3proto_devices));
130}
131device_initcall(x3proto_devices_setup);
132
133static void __init x3proto_init_irq(void)
134{
135 plat_irq_setup_pins(IRQ_MODE_IRL3210);
136
137 /* Set ICR0.LVLMODE */
138 ctrl_outl(ctrl_inl(0xfe410000) | (1 << 21), 0xfe410000);
139}
140
141static struct sh_machine_vector mv_x3proto __initmv = {
142 .mv_name = "x3proto",
143 .mv_init_irq = x3proto_init_irq,
144};