aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards
diff options
context:
space:
mode:
authorKuninori Morimoto <morimoto.kuninori@renesas.com>2009-08-26 07:04:31 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-08-26 22:36:09 -0400
commit907050a33d3b6a9f37e2ceca764b60f8e3922466 (patch)
tree0fa7772db97ee69a354d77c93dfddbc548bad7d9 /arch/sh/boards
parent35a35408914bcd22dbaeea710ec1e711b673b59e (diff)
sh: Add USB support for EcoVec24
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards')
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c97
1 files changed, 97 insertions, 0 deletions
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 8c0c8453d089..7850818bb4e8 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -16,6 +16,7 @@
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/usb/r8a66597.h>
19#include <asm/heartbeat.h> 20#include <asm/heartbeat.h>
20#include <asm/sh_eth.h> 21#include <asm/sh_eth.h>
21#include <cpu/sh7724.h> 22#include <cpu/sh7724.h>
@@ -126,10 +127,96 @@ static struct platform_device sh_eth_device = {
126 .resource = sh_eth_resources, 127 .resource = sh_eth_resources,
127}; 128};
128 129
130/* USB0 host */
131void usb0_port_power(int port, int power)
132{
133 gpio_set_value(GPIO_PTB4, power);
134}
135
136static struct r8a66597_platdata usb0_host_data = {
137 .on_chip = 1,
138 .port_power = usb0_port_power,
139};
140
141static struct resource usb0_host_resources[] = {
142 [0] = {
143 .start = 0xa4d80000,
144 .end = 0xa4d80124 - 1,
145 .flags = IORESOURCE_MEM,
146 },
147 [1] = {
148 .start = 65,
149 .end = 65,
150 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
151 },
152};
153
154static struct platform_device usb0_host_device = {
155 .name = "r8a66597_hcd",
156 .id = 0,
157 .dev = {
158 .dma_mask = NULL, /* not use dma */
159 .coherent_dma_mask = 0xffffffff,
160 .platform_data = &usb0_host_data,
161 },
162 .num_resources = ARRAY_SIZE(usb0_host_resources),
163 .resource = usb0_host_resources,
164};
165
166/*
167 * USB1
168 *
169 * CN5 can use both host/function,
170 * and we can determine it by checking PTB[3]
171 *
172 * This time only USB1 host is supported.
173 */
174void usb1_port_power(int port, int power)
175{
176 if (!gpio_get_value(GPIO_PTB3)) {
177 printk(KERN_ERR "USB1 function is not supported\n");
178 return;
179 }
180
181 gpio_set_value(GPIO_PTB5, power);
182}
183
184static struct r8a66597_platdata usb1_host_data = {
185 .on_chip = 1,
186 .port_power = usb1_port_power,
187};
188
189static struct resource usb1_host_resources[] = {
190 [0] = {
191 .start = 0xa4d90000,
192 .end = 0xa4d90124 - 1,
193 .flags = IORESOURCE_MEM,
194 },
195 [1] = {
196 .start = 66,
197 .end = 66,
198 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
199 },
200};
201
202static struct platform_device usb1_host_device = {
203 .name = "r8a66597_hcd",
204 .id = 1,
205 .dev = {
206 .dma_mask = NULL, /* not use dma */
207 .coherent_dma_mask = 0xffffffff,
208 .platform_data = &usb1_host_data,
209 },
210 .num_resources = ARRAY_SIZE(usb1_host_resources),
211 .resource = usb1_host_resources,
212};
213
129static struct platform_device *ecovec_devices[] __initdata = { 214static struct platform_device *ecovec_devices[] __initdata = {
130 &heartbeat_device, 215 &heartbeat_device,
131 &nor_flash_device, 216 &nor_flash_device,
132 &sh_eth_device, 217 &sh_eth_device,
218 &usb0_host_device,
219 &usb1_host_device, /* USB1 host support */
133}; 220};
134 221
135static int __init devices_setup(void) 222static int __init devices_setup(void)
@@ -165,6 +252,16 @@ static int __init devices_setup(void)
165 gpio_request(GPIO_FN_MDC, NULL); 252 gpio_request(GPIO_FN_MDC, NULL);
166 gpio_request(GPIO_FN_LNKSTA, NULL); 253 gpio_request(GPIO_FN_LNKSTA, NULL);
167 254
255 /* enable USB */
256 gpio_request(GPIO_PTB3, NULL);
257 gpio_request(GPIO_PTB4, NULL);
258 gpio_request(GPIO_PTB5, NULL);
259 gpio_direction_input(GPIO_PTB3);
260 gpio_direction_output(GPIO_PTB4, 0);
261 gpio_direction_output(GPIO_PTB5, 0);
262 ctrl_outw(0x0600, 0xa40501d4);
263 ctrl_outw(0x0600, 0xa4050192);
264
168 return platform_add_devices(ecovec_devices, 265 return platform_add_devices(ecovec_devices,
169 ARRAY_SIZE(ecovec_devices)); 266 ARRAY_SIZE(ecovec_devices));
170} 267}