From patchwork Tue Jan 19 13:14:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 73871 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0JDF9Mu023048 for ; Tue, 19 Jan 2010 13:15:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752697Ab0ASNPL (ORCPT ); Tue, 19 Jan 2010 08:15:11 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752884Ab0ASNPI (ORCPT ); Tue, 19 Jan 2010 08:15:08 -0500 Received: from smtp.nokia.com ([192.100.122.230]:54511 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752697Ab0ASNPA (ORCPT ); Tue, 19 Jan 2010 08:15:00 -0500 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx03.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o0JDEbDc029263; Tue, 19 Jan 2010 15:14:57 +0200 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 19 Jan 2010 15:14:53 +0200 Received: from mgw-da01.ext.nokia.com ([147.243.128.24]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Tue, 19 Jan 2010 15:14:53 +0200 Received: from localhost.localdomain (esdhcp04088.research.nokia.com [172.21.40.88]) by mgw-da01.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o0JDESMx002814; Tue, 19 Jan 2010 15:14:48 +0200 From: Felipe Balbi To: Tony Lindgren Cc: Linux OMAP Mailing List , felipe.balbi@nokia.com Subject: [PATCH/USB 13/16] usb: musb: Add 'extvbus' in musb_hdrc_platform_data Date: Tue, 19 Jan 2010 15:14:12 +0200 Message-Id: <1263906855-28341-14-git-send-email-felipe.balbi@nokia.com> X-Mailer: git-send-email 1.6.6.rc0 In-Reply-To: <1263906855-28341-1-git-send-email-felipe.balbi@nokia.com> References: <1263906855-28341-1-git-send-email-felipe.balbi@nokia.com> X-OriginalArrivalTime: 19 Jan 2010 13:14:53.0497 (UTC) FILETIME=[63679A90:01CA9909] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 4c8962f..074d380 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2031,6 +2031,7 @@ bad_config: /* host side needs more setup */ if (is_host_enabled(musb)) { struct usb_hcd *hcd = musb_to_hcd(musb); + u8 busctl; otg_set_host(musb->xceiv, &hcd->self); @@ -2038,6 +2039,13 @@ bad_config: hcd->self.otg_port = 1; musb->xceiv->host = &hcd->self; hcd->power_budget = 2 * (plat->power ? : 250); + + /* program PHY to use external vBus if required */ + if (plat->extvbus) { + busctl = musb_readb(musb->mregs, MUSB_ULPI_BUSCONTROL); + busctl |= MUSB_ULPI_USE_EXTVBUS; + musb_writeb(musb->mregs, MUSB_ULPI_BUSCONTROL, busctl); + } } /* For the host-only role, we can activate right away. diff --git a/drivers/usb/musb/musb_regs.h b/drivers/usb/musb/musb_regs.h index 473a94e..9a8621a 100644 --- a/drivers/usb/musb/musb_regs.h +++ b/drivers/usb/musb/musb_regs.h @@ -72,6 +72,10 @@ #define MUSB_DEVCTL_HR 0x02 #define MUSB_DEVCTL_SESSION 0x01 +/* MUSB ULPI VBUSCONTROL */ +#define MUSB_ULPI_USE_EXTVBUS 0x01 +#define MUSB_ULPI_USE_EXTVBUSIND 0x02 + /* TESTMODE */ #define MUSB_TEST_FORCE_HOST 0x80 #define MUSB_TEST_FIFO_ACCESS 0x40 @@ -246,6 +250,7 @@ /* REVISIT: vctrl/vstatus: optional vendor utmi+phy register at 0x68 */ #define MUSB_HWVERS 0x6C /* 8 bit */ +#define MUSB_ULPI_BUSCONTROL 0x70 /* 8 bit */ #define MUSB_EPINFO 0x78 /* 8 bit */ #define MUSB_RAMINFO 0x79 /* 8 bit */ diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h index d437556..4b7f8fa 100644 --- a/include/linux/usb/musb.h +++ b/include/linux/usb/musb.h @@ -76,6 +76,9 @@ struct musb_hdrc_platform_data { /* (HOST or OTG) msec/2 after VBUS on till power good */ u8 potpgt; + /* (HOST or OTG) program PHY for external Vbus */ + unsigned extvbus:1; + /* Power the device on or off */ int (*set_power)(int state);