From patchwork Thu Jan 10 16:51:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 1961361 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 430DD3FC85 for ; Thu, 10 Jan 2013 17:00:57 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TtLQe-0007iu-EJ; Thu, 10 Jan 2013 16:56:33 +0000 Received: from bear.ext.ti.com ([192.94.94.41]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TtLMM-0005ar-Um for linux-arm-kernel@lists.infradead.org; Thu, 10 Jan 2013 16:52:09 +0000 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r0AGq4jv018396; Thu, 10 Jan 2013 10:52:04 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r0AGq3eP030228; Thu, 10 Jan 2013 10:52:04 -0600 Received: from dlelxv22.itg.ti.com (172.17.1.197) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Thu, 10 Jan 2013 10:52:03 -0600 Received: from rockdesk.itg.ti.com (h113-58.vpn.ti.com [172.24.113.58]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r0AGpYIA023935; Thu, 10 Jan 2013 10:52:01 -0600 From: Roger Quadros To: Subject: [PATCH 12/14] ARM: OMAP2+: omap4panda: Adapt HUB power to regulator framework Date: Thu, 10 Jan 2013 18:51:32 +0200 Message-ID: <1357836694-30788-13-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1357836694-30788-1-git-send-email-rogerq@ti.com> References: <1357836694-30788-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130110_115207_221837_EE7E889E X-CRM114-Status: GOOD ( 14.92 ) X-Spam-Score: -7.6 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.94.94.41 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: sameo@linux.intel.com, tony@atomide.com, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, kishon@ti.com, linux-arm-kernel@lists.infradead.org, rogerq@ti.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org We model the HUB_POWER GPIO as a fixed regulator device. This regulator is then used as "vcc" supply for the USB PHY device and is managed by the PHY driver. Signed-off-by: Roger Quadros --- arch/arm/mach-omap2/board-omap4panda.c | 38 +++++++++++++++++++++++++++---- 1 files changed, 33 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index 350c4db..a4831cc 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c @@ -132,12 +132,45 @@ static struct platform_device btwilink_device = { .id = -1, }; +/* Regulator for USB HUB supply */ +static struct regulator_consumer_supply hub_power_supplies[] = { +/* Link PHY device to USB HUB supply so it gets enabled in the PHY driver */ + REGULATOR_SUPPLY("vcc", "nop_usb_xceiv.0"), +}; + +static struct regulator_init_data hub_power_data = { + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + }, + .consumer_supplies = hub_power_supplies, + .num_consumer_supplies = ARRAY_SIZE(hub_power_supplies), +}; + +static struct fixed_voltage_config hub_power_config = { + .supply_name = "vhub", + .microvolts = 3300000, + .gpio = GPIO_HUB_POWER, + .startup_delay = 70000, /* 70msec */ + .enable_high = 1, + .enabled_at_boot = 0, + .init_data = &hub_power_data, +}; + +static struct platform_device hub_power_device = { + .name = "reg-fixed-voltage", + .id = 2, + .dev = { + .platform_data = &hub_power_config, + }, +}; + static struct platform_device *panda_devices[] __initdata = { &leds_gpio, &wl1271_device, &panda_abe_audio, &panda_hdmi_audio_codec, &btwilink_device, + &hub_power_device, }; static struct nop_usb_xceiv_platform_data phy_pdata0 = { @@ -164,7 +197,6 @@ static struct usbhs_omap_platform_data usbhs_bdata __initdata = { }; static struct gpio panda_ehci_gpios[] __initdata = { - { GPIO_HUB_POWER, GPIOF_OUT_INIT_LOW, "hub_power" }, { GPIO_HUB_NRESET, GPIOF_OUT_INIT_LOW, "hub_nreset" }, }; @@ -180,7 +212,6 @@ static void __init omap4_ehci_init(void) return; } - gpio_export(GPIO_HUB_POWER, 0); gpio_export(GPIO_HUB_NRESET, 0); gpio_set_value(GPIO_HUB_NRESET, 1); @@ -190,9 +221,6 @@ static void __init omap4_ehci_init(void) pr_err("Failed to add main_clk alias to auxclk3_ck\n"); usbhs_init(&usbhs_bdata); - - /* enable power to hub */ - gpio_set_value(GPIO_HUB_POWER, 1); } static struct omap_musb_board_data musb_board_data = {