From patchwork Wed Sep 19 11:30:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 1476851 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id A6B8ADF283 for ; Wed, 19 Sep 2012 11:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754612Ab2ISLa5 (ORCPT ); Wed, 19 Sep 2012 07:30:57 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:34366 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753175Ab2ISLay (ORCPT ); Wed, 19 Sep 2012 07:30:54 -0400 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id q8JBUfYH015757; Wed, 19 Sep 2012 06:30:41 -0500 Received: from DBDE71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8JBUaSN009710; Wed, 19 Sep 2012 17:00:40 +0530 (IST) Received: from dbdp32.itg.ti.com (172.24.170.251) by DBDE71.ent.ti.com (172.24.170.149) with Microsoft SMTP Server id 14.1.323.3; Wed, 19 Sep 2012 17:00:37 +0530 Received: from a0393678lt.apr.dhcp.ti.com (smtpvbd.itg.ti.com [172.24.170.250]) by dbdp32.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8JBUU3U005476; Wed, 19 Sep 2012 17:00:37 +0530 From: Kishon Vijay Abraham I To: , , , , , , , , , , , Subject: [PATCH 4/4] usb: phy: omap-usb2: enable 960Mhz clock for omap5 Date: Wed, 19 Sep 2012 17:00:29 +0530 Message-ID: <1348054229-27362-5-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1348054229-27362-1-git-send-email-kishon@ti.com> References: <1348054229-27362-1-git-send-email-kishon@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 "usb_otg_ss_refclk960m" is needed by usb2 phy present in omap5. For omap4, the clk_get of this clock will fail since it does not have this clock. Signed-off-by: Kishon Vijay Abraham I --- Documentation/devicetree/bindings/usb/usb-phy.txt | 3 +++ drivers/usb/phy/omap-usb2.c | 28 ++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt b/Documentation/devicetree/bindings/usb/usb-phy.txt index 7c5fd89..d5626de 100644 --- a/Documentation/devicetree/bindings/usb/usb-phy.txt +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt @@ -24,6 +24,9 @@ Required properties: add the address of control module phy power register until a driver for control module is added +Optional properties: + - has960mhzclk: should be added if the phy needs 960mhz clock + This is usually a subnode of ocp2scp to which it is connected. usb3phy@4a084400 { diff --git a/drivers/usb/phy/omap-usb2.c b/drivers/usb/phy/omap-usb2.c index d36c282..d6612ba 100644 --- a/drivers/usb/phy/omap-usb2.c +++ b/drivers/usb/phy/omap-usb2.c @@ -146,6 +146,7 @@ static int __devinit omap_usb2_probe(struct platform_device *pdev) struct omap_usb *phy; struct usb_otg *otg; struct resource *res; + struct device_node *np = pdev->dev.of_node; phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); if (!phy) { @@ -190,6 +191,15 @@ static int __devinit omap_usb2_probe(struct platform_device *pdev) } clk_prepare(phy->wkupclk); + if (of_property_read_bool(np, "has960mhzclk")) { + phy->optclk = devm_clk_get(phy->dev, "usb_otg_ss_refclk960m"); + if (IS_ERR(phy->optclk)) { + dev_err(&pdev->dev, "unable to get refclk960m\n"); + return PTR_ERR(phy->optclk); + } + clk_prepare(phy->optclk); + } + usb_add_phy(&phy->phy, USB_PHY_TYPE_USB2); platform_set_drvdata(pdev, phy); @@ -204,6 +214,7 @@ static int __devexit omap_usb2_remove(struct platform_device *pdev) struct omap_usb *phy = platform_get_drvdata(pdev); clk_unprepare(phy->wkupclk); + clk_unprepare(phy->optclk); usb_remove_phy(&phy->phy); return 0; @@ -217,6 +228,7 @@ static int omap_usb2_runtime_suspend(struct device *dev) struct omap_usb *phy = platform_get_drvdata(pdev); clk_disable(phy->wkupclk); + clk_disable(phy->optclk); return 0; } @@ -228,8 +240,22 @@ static int omap_usb2_runtime_resume(struct device *dev) struct omap_usb *phy = platform_get_drvdata(pdev); ret = clk_enable(phy->wkupclk); - if (ret < 0) + if (ret < 0) { dev_err(phy->dev, "Failed to enable wkupclk %d\n", ret); + return ret; + } + + if (phy->optclk) { + ret = clk_enable(phy->optclk); + if (ret) { + dev_err(phy->dev, "Failed to enable optclk %d\n", ret); + goto err; + } + } + + return 0; +err: + clk_disable(phy->wkupclk); return ret; }