From patchwork Thu Nov 15 14:34:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 1749731 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 942FF3FC8A for ; Thu, 15 Nov 2012 14:34:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1768039Ab2KOOee (ORCPT ); Thu, 15 Nov 2012 09:34:34 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:48189 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1768033Ab2KOOec (ORCPT ); Thu, 15 Nov 2012 09:34:32 -0500 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id qAFEYVoO017365; Thu, 15 Nov 2012 08:34:31 -0600 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id qAFEYVIk008939; Thu, 15 Nov 2012 08:34:31 -0600 Received: from dlelxv22.itg.ti.com (172.17.1.197) by dfle72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.1.323.3; Thu, 15 Nov 2012 08:34:31 -0600 Received: from rockdesk.emea.dhcp.ti.com (rockdesk.emea.dhcp.ti.com [137.167.41.174]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id qAFEYE1O020391; Thu, 15 Nov 2012 08:34:30 -0600 From: Roger Quadros To: CC: , , , Subject: [PATCH 11/16] mfd: omap-usb-host: Manage HSIC clocks for HSIC mode Date: Thu, 15 Nov 2012 16:34:09 +0200 Message-ID: <1352990054-14680-12-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1352990054-14680-1-git-send-email-rogerq@ti.com> References: <1352990054-14680-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Enable the optional HSIC clocks (60MHz and 480MHz) for the ports that are configured in HSIC mode. Signed-off-by: Roger Quadros --- drivers/mfd/omap-usb-host.c | 56 +++++++++++++++++++++++++++++++++++++++++- 1 files changed, 54 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 0d39bd7..e5ba193 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c @@ -88,6 +88,8 @@ struct usbhs_port { struct clk *utmi_clk; + struct clk *hsic60m_clk; + struct clk *hsic480m_clk; }; struct usbhs_hcd_omap { @@ -300,6 +302,26 @@ static int usbhs_runtime_resume(struct device *dev) } } } + + /* Enable HSIC clocks if required */ + if (is_ehci_hsic_mode(pdata->port_mode[i])) { + if (omap->port[i].hsic60m_clk) { + r = clk_enable(omap->port[i].hsic60m_clk); + if (r) { + dev_err(dev, + "%s: Can't enable port %d hsic60m clk : %d\n", + __func__, i, r); + } + } + if (omap->port[i].hsic480m_clk) { + r = clk_enable(omap->port[i].hsic480m_clk); + if (r) { + dev_err(dev, + "%s: Can't enable port %d hsic480m clk : %d\n", + __func__, i, r); + } + } + } } spin_unlock_irqrestore(&omap->lock, flags); @@ -323,6 +345,14 @@ static int usbhs_runtime_suspend(struct device *dev) if (omap->port[i].utmi_clk) clk_disable(omap->port[i].utmi_clk); } + + if (is_ehci_hsic_mode(pdata->port_mode[i])) { + if (omap->port[i].hsic60m_clk) + clk_disable(omap->port[i].hsic60m_clk); + + if (omap->port[i].hsic480m_clk) + clk_disable(omap->port[i].hsic480m_clk); + } } if (omap->ehci_logic_fck && !IS_ERR(omap->ehci_logic_fck)) @@ -575,6 +605,7 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev) for (i = 0; i < omap->nports; i++) { struct clk *pclk; char utmi_clk[] = "usb_host_hs_utmi_px_clk"; + char hsic_clk[] = "usb_host_hs_hsic480m_px_clk"; /* clock names are indexed from 1*/ sprintf(utmi_clk, "usb_host_hs_utmi_p%d_clk", i + 1); @@ -590,6 +621,21 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev) else omap->port[i].utmi_clk = pclk; + sprintf(hsic_clk, "usb_host_hs_hsic480m_p%d_clk", i + 1); + pclk = clk_get(dev, hsic_clk); + if (IS_ERR(pclk)) + dev_err(dev, "Failed to get clock : %s : %ld\n", + hsic_clk, PTR_ERR(pclk)); + else + omap->port[i].hsic480m_clk = pclk; + + sprintf(hsic_clk, "usb_host_hs_hsic60m_p%d_clk", i + 1); + pclk = clk_get(dev, hsic_clk); + if (IS_ERR(pclk)) + dev_err(dev, "Failed to get clock : %s : %ld\n", + hsic_clk, PTR_ERR(pclk)); + else + omap->port[i].hsic60m_clk = pclk; } if (is_ehci_phy_mode(pdata->port_mode[0])) { @@ -637,8 +683,11 @@ err_alloc: omap_usbhs_deinit(&pdev->dev); iounmap(omap->uhh_base); - for (i = 0; i < omap->nports; i++) + for (i = 0; i < omap->nports; i++) { clk_put(omap->port[i].utmi_clk); + clk_put(omap->port[i].hsic60m_clk); + clk_put(omap->port[i].hsic480m_clk); + } clk_put(omap->init_60m_fclk); @@ -673,8 +722,11 @@ static int __devexit usbhs_omap_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); iounmap(omap->uhh_base); - for (i = 0; i < omap->nports; i++) + for (i = 0; i < omap->nports; i++) { clk_put(omap->port[i].utmi_clk); + clk_put(omap->port[i].hsic60m_clk); + clk_put(omap->port[i].hsic480m_clk); + } clk_put(omap->init_60m_fclk); clk_put(omap->xclk60mhsp2_ck);