From patchwork Fri Aug 28 18:33:33 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 44546 Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7SIXpLw011192 for ; Fri, 28 Aug 2009 18:33:52 GMT Received: from dlep34.itg.ti.com ([157.170.170.115]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id n7SIWNGv005616; Fri, 28 Aug 2009 13:32:29 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id n7SIWNQO005751; Fri, 28 Aug 2009 13:32:23 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 0680480627; Fri, 28 Aug 2009 13:32:23 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id ACCFD80626 for ; Fri, 28 Aug 2009 13:32:21 -0500 (CDT) Received: from neches.ext.ti.com (localhost [127.0.0.1]) by dflp53.itg.ti.com (8.13.8/8.13.8) with ESMTP id n7SIWL5E015755 for ; Fri, 28 Aug 2009 13:32:21 -0500 (CDT) Received: from mail66-tx2-R.bigfish.com (mail-tx2.bigfish.com [65.55.88.112]) by neches.ext.ti.com (8.13.7/8.13.7) with ESMTP id n7SIWFMt015301 for ; Fri, 28 Aug 2009 13:32:20 -0500 Received: from mail66-tx2 (localhost.localdomain [127.0.0.1]) by mail66-tx2-R.bigfish.com (Postfix) with ESMTP id 94C0E10C8844 for ; Fri, 28 Aug 2009 18:32:14 +0000 (UTC) X-SpamScore: 0 X-BigFish: vps0(zzzz1202hzzz2dh6bh62h) X-Spam-TCS-SCL: 1:0 X-FB-SS: 5, X-MS-Exchange-Organization-Antispam-Report: OrigIP: 63.81.120.155; Service: EHS Received: by mail66-tx2 (MessageSwitch) id 1251484331295803_22200; Fri, 28 Aug 2009 18:32:11 +0000 (UCT) Received: from imap.sh.mvista.com (unknown [63.81.120.155]) by mail66-tx2.bigfish.com (Postfix) with ESMTP id 13C701538104 for ; Fri, 28 Aug 2009 18:31:53 +0000 (UTC) Received: from wasted.dev.rtsoft.ru (unknown [10.150.0.9]) by imap.sh.mvista.com (Postfix) with ESMTP id 7FFD63EC9; Fri, 28 Aug 2009 11:31:49 -0700 (PDT) From: Sergei Shtylyov Organization: MontaVista Software Inc. To: davinci-linux-open-source@linux.davincidsp.com Date: Fri, 28 Aug 2009 22:33:33 +0400 User-Agent: KMail/1.5 MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200908282233.33435.sshtylyov@ru.mvista.com> Cc: linux-usb@vger.kernel.org Subject: [PATCH 3/3] DA830 EVM: MUSB platform code X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.4 Precedence: list List-Id: davinci-linux-open-source.linux.davincidsp.com List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com Properly set up the OTG mode thru the CFGCHIP2 register, enable the USB0_DRVVBUS pin, and finally register the MUSB platform device. Signed-off-by: Sergei Shtylyov --- The patch is against the recent DaVinci tree plus the OHCI platform patches that I posted a week ago... arch/arm/mach-davinci/board-da830-evm.c | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+) Index: linux-davinci/arch/arm/mach-davinci/board-da830-evm.c =================================================================== --- linux-davinci.orig/arch/arm/mach-davinci/board-da830-evm.c +++ linux-davinci/arch/arm/mach-davinci/board-da830-evm.c @@ -142,8 +142,37 @@ static __init void da830_evm_usb_init(vo cfgchip2 &= ~CFGCHIP2_USB1PHYCLKMUX; cfgchip2 |= CFGCHIP2_USB2PHYCLKMUX; + /* + * We have to override VBUS/ID signals when MUSB is configured into the + * host-only mode -- ID pin will float if no cable is connected, so the + * controller won't be able to drive VBUS thinking that it's a B-device. + * Otherwise, we want to use the OTG mode and enable VBUS comparators. + */ + cfgchip2 &= ~CFGCHIP2_OTGMODE; +#ifdef CONFIG_USB_MUSB_HOST + cfgchip2 |= CFGCHIP2_FORCE_HOST; +#else + cfgchip2 |= CFGCHIP2_SESENDEN | CFGCHIP2_VBDTCTEN; +#endif + __raw_writel(cfgchip2, IO_ADDRESS(DA8XX_CFGCHIP2_REG)); + /* USB_REFCLKIN is not used. */ + ret = davinci_cfg_reg(DA830_USB0_DRVVBUS); + if (ret) + pr_warning("%s: USB 2.0 PinMux setup failed: %d\n", + __func__, ret); + else { + /* + * TPS2065 switch @ 5V supplies 1 A (sustains 1.5 A), + * with the power on to power good time of 3 ms. + */ + ret = da8xx_register_usb20(1000, 3); + if (ret) + pr_warning("%s: USB 2.0 registration failed: %d\n", + __func__, ret); + } + ret = da8xx_pinmux_setup(da830_evm_usb11_pins); if (ret) { pr_warning("%s: USB 1.1 PinMux setup failed: %d\n",