From patchwork Tue Jul 3 06:32:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuyuki Kobayashi X-Patchwork-Id: 1149351 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 9CCDFDFF7E for ; Tue, 3 Jul 2012 06:33:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933435Ab2GCGdQ (ORCPT ); Tue, 3 Jul 2012 02:33:16 -0400 Received: from vrgw9.firstserver.ne.jp ([164.46.1.107]:56097 "EHLO vrgw9.firstserver.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932754Ab2GCGdP (ORCPT ); Tue, 3 Jul 2012 02:33:15 -0400 Received: from fvrsp10.firstserver.ne.jp (fvrsp10.firstserver.ne.jp [203.183.0.4]) by vrgw9.firstserver.ne.jp (8.13.8/8.13.8/FirstServer) with ESMTP id q636X2s4024082; Tue, 3 Jul 2012 15:33:02 +0900 (envelope-from koba@kmckk.co.jp) Received: from 203.137.25.97 (203.137.25.97) by fvrsp10.firstserver.ne.jp (F-Secure/virusgw_smtp/407/fvrsp10.firstserver.ne.jp); Tue, 03 Jul 2012 15:33:02 +0900 (JST) X-Virus-Status: clean(F-Secure/virusgw_smtp/407/fvrsp10.firstserver.ne.jp) Received: from [192.168.1.110] (58-188-103-12f2.kns1.eonet.ne.jp [58.188.103.12]) (authenticated (0 bits)) by mail.kmckk.co.jp (8.14.3/8.11.3) with ESMTP id q636Ww0A012764; Tue, 3 Jul 2012 15:32:59 +0900 Message-ID: <4FF2921A.2080803@kmckk.co.jp> Date: Tue, 03 Jul 2012 15:32:58 +0900 From: Tetsuyuki Kobayashi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: linux-sh@vger.kernel.org CC: rjw@sisk.pl, magnus.damm@gmail.com, kuninori.morimoto.gx@renesas.com, horms@verge.net.au Subject: [RFC][PATCH] ARM: shmobile: kzm9g: add r8a66597_udc support Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Add r8a66597_udc support for CN6 connector on KZM-A9-GT board. r8a66597 USB controller can not use host mode and peripheral mode at the same time. At default r8a66597_udc is disabled. To use r8a66597_udc define USE_R8A66597_UDC. Signed-off-by: Tetsuyuki Kobayashi --- Hello, This is an experimental patch to test if r8a66597_udc works or not. I think that using r8a66597_udc is very rare because usually r8a66597_hcd is used and they can not use at the same time. So this patch is really for test and I add this patch code is all inside #ifdef USE_R8A66597_UDC. My question, this kind of test code should not merge to mainline? Or, the define USE_R8A66597_UDC should be change to CONFIG_R8A66597_UDC or so, and it to Kconfig? arch/arm/mach-shmobile/board-kzm9g.c | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c index 7d4ee5c..af3e110 100644 --- a/arch/arm/mach-shmobile/board-kzm9g.c +++ b/arch/arm/mach-shmobile/board-kzm9g.c @@ -131,6 +131,37 @@ static struct platform_device usb_host_device = { .resource = usb_resources, }; +#ifdef USE_R8A66597_UDC +static struct r8a66597_platdata usb1_gadget_data = { + .on_chip = 0, + .xtal = R8A66597_PLATDATA_XTAL_48MHZ, +}; + +static struct resource usb1_gadget_resources[] = { + [0] = { + .start = 0x10010000, + .end = 0x1001ffff - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = intcs_evt2irq(0x220), /* IRQ1 */ + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device usb1_gadget_device = { + .name = "r8a66597_udc", + .id = 1, /* USB1 */ + .dev = { + .dma_mask = NULL, /* not use dma */ + .coherent_dma_mask = 0xffffffff, + .platform_data = &usb1_gadget_data, + }, + .num_resources = ARRAY_SIZE(usb1_gadget_resources), + .resource = usb1_gadget_resources, +}; +#endif + /* USB Func CN17 */ struct usbhs_private { unsigned int phy; @@ -577,8 +608,17 @@ static struct i2c_board_info i2c3_devices[] = { static struct platform_device *kzm_devices[] __initdata = { &smsc_device, +#ifdef USE_R8A66597_UDC + /* + * Do not enable usb_host_device because r8a66597_udc and r8a66597_hcd + * can not use at the same time. + * Also, do not enable usbhs_device for simplify. + */ + &usb1_gadget_device, +#else &usb_host_device, &usbhs_device, +#endif &lcdc_device, &mmc_device, &sdhi0_device,