From patchwork Thu Jan 10 16:51:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 1961371 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 5F598DF264 for ; Thu, 10 Jan 2013 17:01:54 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TtLRB-00083U-Bt; Thu, 10 Jan 2013 16:57:06 +0000 Received: from comal.ext.ti.com ([198.47.26.152]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TtLMO-0005bZ-KG for linux-arm-kernel@lists.infradead.org; Thu, 10 Jan 2013 16:52:10 +0000 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id r0AGq61k008831; Thu, 10 Jan 2013 10:52:06 -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 r0AGq6ur030310; Thu, 10 Jan 2013 10:52:06 -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:05 -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 r0AGpYIB023935; Thu, 10 Jan 2013 10:52:04 -0600 From: Roger Quadros To: Subject: [PATCH 13/14] ARM: OMAP2+: omap4panda: Adapt HUB reset to regulator framework Date: Thu, 10 Jan 2013 18:51:33 +0200 Message-ID: <1357836694-30788-14-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_115208_863200_0F879534 X-CRM114-Status: GOOD ( 15.33 ) 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 [198.47.26.152 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_RESET GPIO as a fixed regulator device. This regulator is then used as "reset" 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 | 48 ++++++++++++++++++++++---------- 1 files changed, 33 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index a4831cc..fd2f907 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c @@ -132,6 +132,38 @@ static struct platform_device btwilink_device = { .id = -1, }; +/* Regulator for USB HUB/PHY reset */ +static struct regulator_consumer_supply hub_reset_supplies[] = { +/* Link PHY device to reset supply so it gets used in the PHY driver */ + REGULATOR_SUPPLY("reset", "nop_usb_xceiv.0"), +}; + +static struct regulator_init_data hub_reset_data = { + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + }, + .consumer_supplies = hub_reset_supplies, + .num_consumer_supplies = ARRAY_SIZE(hub_reset_supplies), +}; + +static struct fixed_voltage_config hub_reset_config = { + .supply_name = "hub_reset", + .microvolts = 3300000, + .gpio = GPIO_HUB_NRESET, + .startup_delay = 70000, /* 70msec */ + .enable_high = 1, + .enabled_at_boot = 0, /* keep in RESET */ + .init_data = &hub_reset_data, +}; + +static struct platform_device hub_reset_device = { + .name = "reg-fixed-voltage", + .id = 3, + .dev = { + .platform_data = &hub_reset_config, + }, +}; + /* 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 */ @@ -171,6 +203,7 @@ static struct platform_device *panda_devices[] __initdata = { &panda_hdmi_audio_codec, &btwilink_device, &hub_power_device, + &hub_reset_device, }; static struct nop_usb_xceiv_platform_data phy_pdata0 = { @@ -196,25 +229,10 @@ static struct usbhs_omap_platform_data usbhs_bdata __initdata = { .phy_config[0] = &phy_config0, }; -static struct gpio panda_ehci_gpios[] __initdata = { - { GPIO_HUB_NRESET, GPIOF_OUT_INIT_LOW, "hub_nreset" }, -}; - static void __init omap4_ehci_init(void) { int ret; - /* disable the power to the usb hub prior to init and reset phy+hub */ - ret = gpio_request_array(panda_ehci_gpios, - ARRAY_SIZE(panda_ehci_gpios)); - if (ret) { - pr_err("Unable to initialize EHCI power/reset\n"); - return; - } - - gpio_export(GPIO_HUB_NRESET, 0); - gpio_set_value(GPIO_HUB_NRESET, 1); - /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */ ret = clk_add_alias("main_clk", "nop_usb_xceiv.0", "auxclk3_ck", NULL); if (ret)