blob: efe4cb9f8a77d27edc8fe632b25aafd2acb19e1f [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>
Magnus Damm2c59b0b2009-07-22 14:41:35 +000020#include <linux/usb/m66592.h>
Paul Mundte7109a92007-08-08 15:27:55 +090021#include <asm/ilsel.h>
Paul Mundt94807a32007-08-08 15:22:04 +090022
23static struct resource heartbeat_resources[] = {
24 [0] = {
25 .start = 0xb8140020,
Paul Mundta1fd3062007-08-23 15:11:44 +090026 .end = 0xb8140020,
Paul Mundt94807a32007-08-08 15:22:04 +090027 .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
Paul Mundte77eb362008-08-05 13:16:56 +090038static struct smc91x_platdata smc91x_info = {
39 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
40};
41
Paul Mundte7109a92007-08-08 15:27:55 +090042static struct resource smc91x_resources[] = {
43 [0] = {
44 .start = 0x18000300,
45 .end = 0x18000300 + 0x10 - 1,
46 .flags = IORESOURCE_MEM,
47 },
48 [1] = {
49 /* Filled in by ilsel */
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),
Paul Mundte77eb362008-08-05 13:16:56 +090059 .dev = {
60 .platform_data = &smc91x_info,
61 },
Paul Mundte7109a92007-08-08 15:27:55 +090062};
63
Yoshihiro Shimodafcaf99d2009-05-26 09:33:08 +000064static struct r8a66597_platdata r8a66597_data = {
65 .xtal = R8A66597_PLATDATA_XTAL_12MHZ,
66 .vif = 1,
67};
68
Paul Mundte7109a92007-08-08 15:27:55 +090069static struct resource r8a66597_usb_host_resources[] = {
70 [0] = {
Paul Mundte7109a92007-08-08 15:27:55 +090071 .start = 0x18040000,
72 .end = 0x18080000 - 1,
73 .flags = IORESOURCE_MEM,
74 },
75 [1] = {
Paul Mundte7109a92007-08-08 15:27:55 +090076 /* Filled in by ilsel */
Yoshihiro Shimodafcaf99d2009-05-26 09:33:08 +000077 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
Paul Mundte7109a92007-08-08 15:27:55 +090078 },
79};
80
81static struct platform_device r8a66597_usb_host_device = {
82 .name = "r8a66597_hcd",
83 .id = -1,
84 .dev = {
85 .dma_mask = NULL, /* don't use dma */
86 .coherent_dma_mask = 0xffffffff,
Yoshihiro Shimodafcaf99d2009-05-26 09:33:08 +000087 .platform_data = &r8a66597_data,
Paul Mundte7109a92007-08-08 15:27:55 +090088 },
89 .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources),
90 .resource = r8a66597_usb_host_resources,
91};
92
Magnus Damm2c59b0b2009-07-22 14:41:35 +000093static struct m66592_platdata usbf_platdata = {
94 .xtal = M66592_PLATDATA_XTAL_24MHZ,
95 .vif = 1,
96};
97
Paul Mundte7109a92007-08-08 15:27:55 +090098static 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 /* Filled in by ilsel */
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, /* don't use dma */
117 .coherent_dma_mask = 0xffffffff,
Magnus Damm2c59b0b2009-07-22 14:41:35 +0000118 .platform_data = &usbf_platdata,
Paul Mundte7109a92007-08-08 15:27:55 +0900119 },
120 .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources),
121 .resource = m66592_usb_peripheral_resources,
122};
123
Paul Mundt94807a32007-08-08 15:22:04 +0900124static struct platform_device *x3proto_devices[] __initdata = {
125 &heartbeat_device,
Paul Mundte7109a92007-08-08 15:27:55 +0900126 &smc91x_device,
127 &r8a66597_usb_host_device,
128 &m66592_usb_peripheral_device,
Paul Mundt94807a32007-08-08 15:22:04 +0900129};
130
131static int __init x3proto_devices_setup(void)
132{
Paul Mundte7109a92007-08-08 15:27:55 +0900133 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
Paul Mundt94807a32007-08-08 15:22:04 +0900142 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 /* Set ICR0.LVLMODE */
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};