From patchwork Fri Feb 12 08:11:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NISHIMOTO Hiroki X-Patchwork-Id: 78855 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1C89ZZM005765 for ; Fri, 12 Feb 2010 08:11:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752942Ab0BLILb (ORCPT ); Fri, 12 Feb 2010 03:11:31 -0500 Received: from mail.renesas.com ([202.234.163.13]:59304 "EHLO mail01.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752579Ab0BLILa (ORCPT ); Fri, 12 Feb 2010 03:11:30 -0500 X-AuditID: ac140384-0000000b000004f6-27-4b750d2f2ce4 Received: from guardian03.idc.renesas.com ([172.20.8.202]) by mail01.idc.renesas.com (sendmail) with ESMTP id o1C8BR8u013160; Fri, 12 Feb 2010 17:11:27 +0900 (JST) Received: (from root@localhost) by guardian03.idc.renesas.com with id o1C8BRqL017919; Fri, 12 Feb 2010 17:11:27 +0900 (JST) Received: from mta04.idc.renesas.com (localhost [127.0.0.1]) by mta04.idc.renesas.com with ESMTP id o1C8BPV3012541; Fri, 12 Feb 2010 17:11:25 +0900 (JST) Received: from [127.0.0.1] ([172.30.8.169]) by ims04.idc.renesas.com (Sendmail) with ESMTPA id <0KXP009OOYR2FR@ims04.idc.renesas.com>; Fri, 12 Feb 2010 17:11:26 +0900 (JST) Date: Fri, 12 Feb 2010 17:11:18 +0900 From: NISHIMOTO Hiroki Subject: [PATCH] ARM: mach-shmobile: G4EVM USBHS support To: linux-sh@vger.kernel.org, lethal@linux-sh.org Cc: Magnus Damm , Kuninori Morimoto Message-id: <4B750D26.2020400@renesas.com> MIME-version: 1.0 Content-type: text/plain; charset=ISO-2022-JP Content-transfer-encoding: 7bit User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) X-Brightmail-Tracker: AAAAAA== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 12 Feb 2010 08:11:35 +0000 (UTC) diff --git a/arch/arm/mach-shmobile/board-g4evm.c b/arch/arm/mach-shmobile/board-g4evm.c index ef4b0f5..5acd623 100644 --- a/arch/arm/mach-shmobile/board-g4evm.c +++ b/arch/arm/mach-shmobile/board-g4evm.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -86,9 +87,50 @@ static struct platform_device nor_flash_device = { .resource = nor_flash_resources, }; +/* USBHS */ +void usb_host_port_power(int port, int power) +{ + if (!power) /* only power-on supported for now */ + return; + + /* set VBOUT/PWEN and EXTLP0 in DVSTCTR */ + __raw_writew(__raw_readw(0xe6890008) | 0x600, 0xe6890008); +} + +static struct r8a66597_platdata usb_host_data = { + .on_chip = 1, + .port_power = usb_host_port_power, +}; + +static struct resource usb_host_resources[] = { + [0] = { + .name = "USBHS", + .start = 0xe6890000, + .end = 0xe68900e5, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = 65, + .end = 65, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device usb_host_device = { + .name = "r8a66597_hcd", + .id = 0, + .dev = { + .platform_data = &usb_host_data, + .dma_mask = NULL, + .coherent_dma_mask = 0xffffffff, + }, + .num_resources = ARRAY_SIZE(usb_host_resources), + .resource = usb_host_resources, +}; static struct platform_device *g4evm_devices[] __initdata = { &nor_flash_device, + &usb_host_device, }; static struct map_desc g4evm_io_desc[] __initdata = { @@ -137,6 +179,23 @@ static void __init g4evm_init(void) gpio_direction_output(GPIO_PORT113, 1); gpio_export(GPIO_PORT113, 1); + /* USBHS */ + gpio_request(GPIO_FN_VBUS_0, NULL); + gpio_request(GPIO_FN_PWEN, NULL); + gpio_request(GPIO_FN_OVCN, NULL); + gpio_request(GPIO_FN_OVCN2, NULL); + gpio_request(GPIO_FN_EXTLP, NULL); + gpio_request(GPIO_FN_IDIN, NULL); + + /* enable clock in SMSTPCR3 */ + __raw_writel(__raw_readl(0xe615013c) & ~(1 << 22), 0xe615013c); + + /* setup USB phy */ + __raw_writew(0x0200, 0xe605810a); /* USBCR1 */ + __raw_writew(0x00e0, 0xe60581c0); /* CPFCH */ + __raw_writew(0x6010, 0xe60581c6); /* CGPOSR */ + __raw_writew(0x8a0a, 0xe605810c); /* USBCR2 */ + sh7377_add_standard_devices(); platform_add_devices(g4evm_devices, ARRAY_SIZE(g4evm_devices));