From patchwork Fri Oct 30 19:52:04 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 56690 Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9UJrbsa017138 for ; Fri, 30 Oct 2009 19:53:38 GMT Received: from dlep35.itg.ti.com ([157.170.170.118]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id n9UJqOXU014566 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 30 Oct 2009 14:52:25 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep35.itg.ti.com (8.13.7/8.13.7) with ESMTP id n9UJqLKC006383; Fri, 30 Oct 2009 14:52:23 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id DD62D80627; Fri, 30 Oct 2009 13:52:21 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id 6313080626 for ; Fri, 30 Oct 2009 13:52:21 -0600 (CST) Received: from white.ext.ti.com (localhost [127.0.0.1]) by dflp52.itg.ti.com (8.13.7/8.13.7) with ESMTP id n9UJqKXV025959 for ; Fri, 30 Oct 2009 14:52:20 -0500 (CDT) Received: from mail109-tx2-R.bigfish.com (mail-tx2.bigfish.com [65.55.88.113]) by white.ext.ti.com (8.13.7/8.13.7) with ESMTP id n9UJqKlQ012671 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Fri, 30 Oct 2009 14:52:20 -0500 Received: from mail109-tx2 (localhost.localdomain [127.0.0.1]) by mail109-tx2-R.bigfish.com (Postfix) with ESMTP id D621CCE8653 for ; Fri, 30 Oct 2009 19:52:19 +0000 (UTC) X-SpamScore: 7 X-BigFish: vps7(zzzz1202hzzz2dh6bh259o61h) X-Spam-TCS-SCL: 0:0 X-MS-Exchange-Organization-Antispam-Report: OrigIP: 206.112.117.35; Service: EHS Received: by mail109-tx2 (MessageSwitch) id 1256932330865837_13781; Fri, 30 Oct 2009 19:52:10 +0000 (UCT) Received: from TX2EHSMHS028.bigfish.com (unknown [10.9.14.247]) by mail109-tx2.bigfish.com (Postfix) with ESMTP id C6BFD1790060 for ; Fri, 30 Oct 2009 19:52:10 +0000 (UTC) Received: from imap.sh.mvista.com (206.112.117.35) by TX2EHSMHS028.bigfish.com (10.9.99.128) with Microsoft SMTP Server id 14.0.482.32; Fri, 30 Oct 2009 19:52:09 +0000 Received: from wasted.dev.rtsoft.ru (unknown [10.150.0.9]) by imap.sh.mvista.com (Postfix) with SMTP id BB0123EFD; Fri, 30 Oct 2009 12:52:07 -0700 (PDT) From: Sergei Shtylyov Organization: MontaVista Software Inc. To: davinci-linux-open-source@linux.davincidsp.com Date: Fri, 30 Oct 2009 23:52:04 +0400 User-Agent: KMail/1.5 MIME-Version: 1.0 Content-Disposition: inline Message-ID: <200910302252.04282.sshtylyov@ru.mvista.com> X-Reverse-DNS: unknown Cc: linux-usb@vger.kernel.org Subject: [PATCH v2 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 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 @@ -178,8 +178,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, DA8XX_SYSCFG_VIRT(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",