aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/board-ap4evb.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2010-04-13 02:16:32 -0400
committerPaul Mundt <lethal@linux-sh.org>2010-04-15 00:04:33 -0400
commitfb54d268329846aa13b2bc44a64d90e9b7131192 (patch)
treeb010d9bc0f89325a91b9e2dbf04c26cad470bd48 /arch/arm/mach-shmobile/board-ap4evb.c
parent0fff9ec116f2073553cd9b1d1afdc503cf10ef60 (diff)
ARM: mach-shmobile: ap4evb: Add USB host support
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/arm/mach-shmobile/board-ap4evb.c')
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index e7602945a6a5..d3b8ca5d4041 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -33,6 +33,7 @@
33#include <linux/gpio.h> 33#include <linux/gpio.h>
34#include <linux/input.h> 34#include <linux/input.h>
35#include <linux/input/sh_keysc.h> 35#include <linux/input/sh_keysc.h>
36#include <linux/usb/r8a66597.h>
36#include <mach/common.h> 37#include <mach/common.h>
37#include <mach/sh7372.h> 38#include <mach/sh7372.h>
38#include <asm/mach-types.h> 39#include <asm/mach-types.h>
@@ -94,6 +95,15 @@
94 * OFF | KEY / IrDA / IRQ | IRQ | 95 * OFF | KEY / IrDA / IRQ | IRQ |
95 */ 96 */
96 97
98/*
99 * USB
100 *
101 * J7 : 1-2 MAX3355E VBUS
102 * 2-3 DC 5.0V
103 *
104 * S39: bit2: off
105 */
106
97/* MTD */ 107/* MTD */
98static struct mtd_partition nor_flash_partitions[] = { 108static struct mtd_partition nor_flash_partitions[] = {
99 { 109 {
@@ -233,11 +243,53 @@ static struct platform_device sdhi0_device = {
233 .id = 0, 243 .id = 0,
234}; 244};
235 245
246/* USB1 */
247void usb1_host_port_power(int port, int power)
248{
249 if (!power) /* only power-on supported for now */
250 return;
251
252 /* set VBOUT/PWEN and EXTLP1 in DVSTCTR */
253 __raw_writew(__raw_readw(0xE68B0008) | 0x600, 0xE68B0008);
254}
255
256static struct r8a66597_platdata usb1_host_data = {
257 .on_chip = 1,
258 .port_power = usb1_host_port_power,
259};
260
261static struct resource usb1_host_resources[] = {
262 [0] = {
263 .name = "USBHS",
264 .start = 0xE68B0000,
265 .end = 0xE68B00E6 - 1,
266 .flags = IORESOURCE_MEM,
267 },
268 [1] = {
269 .start = 215,
270 .end = 215,
271 .flags = IORESOURCE_IRQ,
272 },
273};
274
275static struct platform_device usb1_host_device = {
276 .name = "r8a66597_hcd",
277 .id = 1,
278 .dev = {
279 .dma_mask = NULL, /* not use dma */
280 .coherent_dma_mask = 0xffffffff,
281 .platform_data = &usb1_host_data,
282 },
283 .num_resources = ARRAY_SIZE(usb1_host_resources),
284 .resource = usb1_host_resources,
285};
286
236static struct platform_device *ap4evb_devices[] __initdata = { 287static struct platform_device *ap4evb_devices[] __initdata = {
237 &nor_flash_device, 288 &nor_flash_device,
238 &smc911x_device, 289 &smc911x_device,
239 &keysc_device, 290 &keysc_device,
240 &sdhi0_device, 291 &sdhi0_device,
292 &usb1_host_device,
241}; 293};
242 294
243/* TouchScreen (Needs SW3 set to OFF) */ 295/* TouchScreen (Needs SW3 set to OFF) */
@@ -351,6 +403,17 @@ static void __init ap4evb_init(void)
351 i2c_register_board_info(1, i2c1_devices, 403 i2c_register_board_info(1, i2c1_devices,
352 ARRAY_SIZE(i2c1_devices)); 404 ARRAY_SIZE(i2c1_devices));
353 405
406 /* USB enable */
407 gpio_request(GPIO_FN_VBUS0_1, NULL);
408 gpio_request(GPIO_FN_IDIN_1_18, NULL);
409 gpio_request(GPIO_FN_PWEN_1_115, NULL);
410 gpio_request(GPIO_FN_OVCN_1_114, NULL);
411 gpio_request(GPIO_FN_EXTLP_1, NULL);
412 gpio_request(GPIO_FN_OVCN2_1, NULL);
413
414 /* setup USB phy */
415 __raw_writew(0x8a0a, 0xE6058130); /* USBCR2 */
416
354 sh7372_add_standard_devices(); 417 sh7372_add_standard_devices();
355 418
356 platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices)); 419 platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices));