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