From patchwork Wed Feb 10 11:13:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 78395 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 o1ABKDOu029300 for ; Wed, 10 Feb 2010 11:20:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755167Ab0BJLUN (ORCPT ); Wed, 10 Feb 2010 06:20:13 -0500 Received: from mail-yx0-f200.google.com ([209.85.210.200]:64604 "EHLO mail-yx0-f200.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755101Ab0BJLUL (ORCPT ); Wed, 10 Feb 2010 06:20:11 -0500 Received: by yxe38 with SMTP id 38so5032629yxe.4 for ; Wed, 10 Feb 2010 03:20:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :subject; bh=jZBPZh5DFLaHnVDDTktdCDRFCg2OPygloWBm/89fbdI=; b=SqzYXFI0iOHSxLZ7kL2xwKMgR/kwfMW3HFpHuvzuAAu+oz2eDO18omqeojbAFXBZn1 e/Pyjb+eXdZq0/wXYmOdPtwDOW9CfzqfXFOPITZhQm3zwTzTJELoJ+Nf3fRaBhkN1/QS 2fvf9zDzwR65Fmr3O6Q+cKxdz7Ikr74GXq8HM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=NzFwy+cOG3zkYbyAulGdWSlCCYF4zMgVTs28TUuWji5nwkhjb74o1mZebfH/Ath1MR lxWoNffM5Qrb6Qc94sy9BGCERdEww9GjYpTzc2pLfuIkh+YKGVwzkI3JHMv7TpRdB+VY BL06uFcQlDRbQT5Pes2D5djQ5XFhKjkdBbPCo= Received: by 10.90.14.13 with SMTP id 13mr1384894agn.112.1265800810021; Wed, 10 Feb 2010 03:20:10 -0800 (PST) Received: from rxone.opensource.se (49.14.32.202.bf.2iij.net [202.32.14.49]) by mx.google.com with ESMTPS id 16sm747397gxk.15.2010.02.10.03.20.08 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 10 Feb 2010 03:20:09 -0800 (PST) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org Date: Wed, 10 Feb 2010 20:13:31 +0900 Message-Id: <20100210111331.11137.3162.sendpatchset@rxone.opensource.se> Subject: [PATCH] ARM: mach-shmobile: G3EVM USBHS support 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]); Wed, 10 Feb 2010 11:20:14 +0000 (UTC) --- 0010/arch/arm/mach-shmobile/board-g3evm.c +++ work/arch/arm/mach-shmobile/board-g3evm.c 2010-02-10 19:48:04.000000000 +0900 @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -86,9 +87,49 @@ static struct platform_device nor_flash_ .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, + .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 *g3evm_devices[] __initdata = { &nor_flash_device, + &usb_host_device, }; static struct map_desc g3evm_io_desc[] __initdata = { @@ -138,6 +179,23 @@ static void __init g3evm_init(void) gpio_request(GPIO_FN_SCIFA1_CTS, NULL); gpio_request(GPIO_FN_SCIFA1_RTS, NULL); + /* USBHS */ + gpio_request(GPIO_FN_VBUS0, 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 SYMSTPCR2 */ + __raw_writel(__raw_readl(0xe6158048) & ~(1 << 22), 0xe6158048); + + /* setup USB phy */ + __raw_writew(0x0300, 0xe605810a); /* USBCR1 */ + __raw_writew(0x00e0, 0xe60581c0); /* CPFCH */ + __raw_writew(0x6010, 0xe60581c6); /* CGPOSR */ + __raw_writew(0x8a0a, 0xe605810c); /* USBCR2 */ + sh7367_add_standard_devices(); platform_add_devices(g3evm_devices, ARRAY_SIZE(g3evm_devices)); --- 0001/arch/arm/mach-shmobile/clock-sh7367.c +++ work/arch/arm/mach-shmobile/clock-sh7367.c 2010-02-10 19:47:58.000000000 +0900 @@ -70,11 +70,18 @@ static struct clk r_clk = { .rate = 32768, }; +/* a static usb0 for now - enough to get r8a66597 working */ +static struct clk usb0_clk = { + .name = "usb0", +}; + static struct clk_lookup lookups[] = { { .clk = &peripheral_clk, }, { .clk = &r_clk, + }, { + .clk = &usb0_clk, } };