From patchwork Tue Nov 17 15:09:53 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kumar Gupta X-Patchwork-Id: 60679 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 nAHFDrcm023848 for ; Tue, 17 Nov 2009 15:13:53 GMT Received: from dlep35.itg.ti.com ([157.170.170.118]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id nAHFBEfB005257 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 17 Nov 2009 09:11:15 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep35.itg.ti.com (8.13.7/8.13.7) with ESMTP id nAHFBEmI002538; Tue, 17 Nov 2009 09:11:14 -0600 (CST) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id E50018072D; Tue, 17 Nov 2009 09:10:48 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dbdp31.itg.ti.com (dbdp31.itg.ti.com [172.24.170.98]) by linux.omap.com (Postfix) with ESMTP id E7B6D8062A for ; Tue, 17 Nov 2009 09:10:03 -0600 (CST) Received: from psplinux050.india.ti.com (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id nAHF9w1t027840; Tue, 17 Nov 2009 20:39:59 +0530 (IST) Received: from psplinux050.india.ti.com (localhost [127.0.0.1]) by psplinux050.india.ti.com (8.13.1/8.13.1) with ESMTP id nAHF9w9S024398; Tue, 17 Nov 2009 20:39:58 +0530 Received: (from a0393629@localhost) by psplinux050.india.ti.com (8.13.1/8.13.1/Submit) id nAHF9wA3024395; Tue, 17 Nov 2009 20:39:58 +0530 From: Ajay Kumar Gupta To: linux-usb@vger.kernel.org Subject: [PATCH 5/8] musb: Add 'extvbus' in musb_hdrc_board_data Date: Tue, 17 Nov 2009 20:39:53 +0530 Message-Id: <1258470596-24321-6-git-send-email-ajay.gupta@ti.com> X-Mailer: git-send-email 1.6.2.4 In-Reply-To: <1258470596-24321-5-git-send-email-ajay.gupta@ti.com> References: <1258470596-24321-1-git-send-email-ajay.gupta@ti.com> <1258470596-24321-2-git-send-email-ajay.gupta@ti.com> <1258470596-24321-3-git-send-email-ajay.gupta@ti.com> <1258470596-24321-4-git-send-email-ajay.gupta@ti.com> <1258470596-24321-5-git-send-email-ajay.gupta@ti.com> Cc: davinci-linux-open-source@linux.davincidsp.com, cooloney@kernel.org, felipe.balbi@nokia.com, linux-omap@vger.kernel.org, gadiyar@ti.com X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 818ccda..c0a6760 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2027,15 +2027,25 @@ 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); if (is_otg_enabled(musb)) hcd->self.otg_port = 1; musb->xceiv->host = &hcd->self; - if (plat->board_data) + if (plat->board_data) { hcd->power_budget = 2 * (plat->board_data->power ? : 250); + /* program PHY to use external vBus if required */ + if (plat->board_data->extvbus) { + busctl = musb_readb(musb->mregs, + MUSB_ULPI_BUSCONTROL); + busctl |= 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 cc1d71b..a0314df 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 +/* ULPI VBUSCONTROL */ +#define ULPI_USE_EXTVBUS 0x01 +#define 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 6e1426c..45fd7d1 100644 --- a/include/linux/usb/musb.h +++ b/include/linux/usb/musb.h @@ -33,7 +33,8 @@ struct musb_hdrc_board_data { u8 power; /* (HOST or OTG) msec/2 after VBUS on till power good */ u8 potpgt; - + /* flag to program PHY to use external Vbus */ + unsigned extvbus:1; }; struct musb_hdrc_config {