From patchwork Fri Jan 25 10:59:34 2013 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: 2043641 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 B1947DF223 for ; Fri, 25 Jan 2013 11:00:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932125Ab3AYK7r (ORCPT ); Fri, 25 Jan 2013 05:59:47 -0500 Received: from comal.ext.ti.com ([198.47.26.152]:43743 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754805Ab3AYK7n (ORCPT ); Fri, 25 Jan 2013 05:59:43 -0500 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id r0PAxaDM005501; Fri, 25 Jan 2013 04:59:37 -0600 Received: from DBDE70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id r0PAxZ7D002118; Fri, 25 Jan 2013 16:29:35 +0530 (IST) Received: from dbdp33.itg.ti.com (172.24.170.252) by dbde70.ent.ti.com (172.24.170.148) with Microsoft SMTP Server id 14.1.323.3; Fri, 25 Jan 2013 16:29:35 +0530 Received: from a0393678lt.apr.dhcp.ti.com (smtpvbd.itg.ti.com [172.24.170.250]) by dbdp33.itg.ti.com (8.13.8/8.13.8) with ESMTP id r0PAxYf9014992; Fri, 25 Jan 2013 16:29:35 +0530 From: Kishon Vijay Abraham I To: , , , , , , , , CC: , Subject: [PATCH v4 2/2] usb: phy: omap-usb2: enable 960Mhz clock for omap5 Date: Fri, 25 Jan 2013 16:29:34 +0530 Message-ID: <1359111574-6613-3-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1359111574-6613-1-git-send-email-kishon@ti.com> References: <1359111574-6613-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 for 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 --- drivers/usb/phy/omap-usb2.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/usb/phy/omap-usb2.c b/drivers/usb/phy/omap-usb2.c index 0cd88ac..844ab68 100644 --- a/drivers/usb/phy/omap-usb2.c +++ b/drivers/usb/phy/omap-usb2.c @@ -166,6 +166,12 @@ static int omap_usb2_probe(struct platform_device *pdev) } clk_prepare(phy->wkupclk); + phy->optclk = devm_clk_get(phy->dev, "usb_otg_ss_refclk960m"); + if (IS_ERR(phy->optclk)) + dev_vdbg(&pdev->dev, "unable to get refclk960m\n"); + else + clk_prepare(phy->optclk); + usb_add_phy_dev(&phy->phy); platform_set_drvdata(pdev, phy); @@ -180,6 +186,8 @@ static int omap_usb2_remove(struct platform_device *pdev) struct omap_usb *phy = platform_get_drvdata(pdev); clk_unprepare(phy->wkupclk); + if (!IS_ERR(phy->optclk)) + clk_unprepare(phy->optclk); usb_remove_phy(&phy->phy); return 0; @@ -193,6 +201,8 @@ static int omap_usb2_runtime_suspend(struct device *dev) struct omap_usb *phy = platform_get_drvdata(pdev); clk_disable(phy->wkupclk); + if (!IS_ERR(phy->optclk)) + clk_disable(phy->optclk); return 0; } @@ -204,9 +214,25 @@ 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); + goto err0; + } + + if (!IS_ERR(phy->optclk)) { + ret = clk_enable(phy->optclk); + if (ret < 0) { + dev_err(phy->dev, "Failed to enable optclk %d\n", ret); + goto err1; + } + } + + return 0; + +err1: + clk_disable(phy->wkupclk); +err0: return ret; }