From patchwork Thu Sep 19 13:05: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: 2911361 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9CCCE9F1E3 for ; Thu, 19 Sep 2013 13:09:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0ED8820424 for ; Thu, 19 Sep 2013 13:09:02 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3757420413 for ; Thu, 19 Sep 2013 13:08:57 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VMdxH-0005AB-Bz; Thu, 19 Sep 2013 13:07:36 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VMdwt-0005Pq-Ku; Thu, 19 Sep 2013 13:07:11 +0000 Received: from arroyo.ext.ti.com ([192.94.94.40]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VMdw7-0005H8-O2 for linux-arm-kernel@lists.infradead.org; Thu, 19 Sep 2013 13:06:26 +0000 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id r8JD5xSN017146; Thu, 19 Sep 2013 08:06:00 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id r8JD5xad026706; Thu, 19 Sep 2013 08:05:59 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Thu, 19 Sep 2013 08:05:59 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id r8JD5jMe023592; Thu, 19 Sep 2013 08:05:57 -0500 From: Roger Quadros To: , , Subject: [RFC PATCH 04/15] phy: omap-pipe3: use generic clock names Date: Thu, 19 Sep 2013 16:05:32 +0300 Message-ID: <1379595943-14622-5-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1379595943-14622-1-git-send-email-rogerq@ti.com> References: <1379595943-14622-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-20130919_090623_951147_721D380E X-CRM114-Status: GOOD ( 11.54 ) X-Spam-Score: -4.0 (----) Cc: devicetree@vger.kernel.org, balajitk@ti.com, linux-kernel@vger.kernel.org, kishon@ti.com, linux-ide@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Roger Quadros X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,KHOP_BIG_TO_CC, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kishon Vijay Abraham I As this driver is no longer USB specific use generic clock names. [Roger Q] - Fix PLL_SD_SHIFT from 9 to 10 - As optclk and wkupclk may not be always required, don't bail out if they aren't available. Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Roger Quadros --- drivers/phy/phy-omap-pipe3.c | 71 +++++++++++++++++++++++------------------- 1 files changed, 39 insertions(+), 32 deletions(-) diff --git a/drivers/phy/phy-omap-pipe3.c b/drivers/phy/phy-omap-pipe3.c index 63de0f8..807ab8a 100644 --- a/drivers/phy/phy-omap-pipe3.c +++ b/drivers/phy/phy-omap-pipe3.c @@ -37,15 +37,15 @@ #define PLL_CONFIGURATION4 0x00000020 #define PLL_REGM_MASK 0x001FFE00 -#define PLL_REGM_SHIFT 0x9 +#define PLL_REGM_SHIFT 9 #define PLL_REGM_F_MASK 0x0003FFFF -#define PLL_REGM_F_SHIFT 0x0 +#define PLL_REGM_F_SHIFT 0 #define PLL_REGN_MASK 0x000001FE -#define PLL_REGN_SHIFT 0x1 +#define PLL_REGN_SHIFT 1 #define PLL_SELFREQDCO_MASK 0x0000000E -#define PLL_SELFREQDCO_SHIFT 0x1 +#define PLL_SELFREQDCO_SHIFT 1 #define PLL_SD_MASK 0x0003FC00 -#define PLL_SD_SHIFT 0x9 +#define PLL_SD_SHIFT 10 #define SET_PLL_GO 0x1 #define PLL_TICOPWDN 0x10000 #define PLL_LOCK 0x2 @@ -232,23 +232,21 @@ static int omap_pipe3_probe(struct platform_device *pdev) phy->dev = &pdev->dev; - phy->wkupclk = devm_clk_get(phy->dev, "usb_phy_cm_clk32k"); - if (IS_ERR(phy->wkupclk)) { - dev_err(&pdev->dev, "unable to get usb_phy_cm_clk32k\n"); - return PTR_ERR(phy->wkupclk); - } - clk_prepare(phy->wkupclk); + phy->wkupclk = devm_clk_get(phy->dev, "wkupclk"); + if (IS_ERR(phy->wkupclk)) + dev_dbg(&pdev->dev, "unable to get wkupclk\n"); + else + clk_prepare(phy->wkupclk); - phy->optclk = devm_clk_get(phy->dev, "usb_otg_ss_refclk960m"); - if (IS_ERR(phy->optclk)) { - dev_err(&pdev->dev, "unable to get usb_otg_ss_refclk960m\n"); - return PTR_ERR(phy->optclk); - } - clk_prepare(phy->optclk); + phy->optclk = devm_clk_get(phy->dev, "optclk"); + if (IS_ERR(phy->optclk)) + dev_dbg(&pdev->dev, "unable to get optclk\n"); + else + clk_prepare(phy->optclk); - phy->sys_clk = devm_clk_get(phy->dev, "sys_clkin"); + phy->sys_clk = devm_clk_get(phy->dev, "sysclk"); if (IS_ERR(phy->sys_clk)) { - pr_err("%s: unable to get sys_clkin\n", __func__); + dev_err(&pdev->dev, "unable to get sysclk\n"); return -EINVAL; } @@ -290,8 +288,10 @@ static int omap_pipe3_remove(struct platform_device *pdev) { struct omap_pipe3 *phy = platform_get_drvdata(pdev); - clk_unprepare(phy->wkupclk); - clk_unprepare(phy->optclk); + if (!IS_ERR(phy->wkupclk)) + clk_unprepare(phy->wkupclk); + if (!IS_ERR(phy->optclk)) + clk_unprepare(phy->optclk); if (!pm_runtime_suspended(&pdev->dev)) pm_runtime_put(&pdev->dev); pm_runtime_disable(&pdev->dev); @@ -305,8 +305,10 @@ static int omap_pipe3_runtime_suspend(struct device *dev) { struct omap_pipe3 *phy = dev_get_drvdata(dev); - clk_disable(phy->wkupclk); - clk_disable(phy->optclk); + if (!IS_ERR(phy->wkupclk)) + clk_disable(phy->wkupclk); + if (!IS_ERR(phy->optclk)) + clk_disable(phy->optclk); return 0; } @@ -316,22 +318,27 @@ static int omap_pipe3_runtime_resume(struct device *dev) u32 ret = 0; struct omap_pipe3 *phy = dev_get_drvdata(dev); - ret = clk_enable(phy->optclk); - if (ret) { - dev_err(phy->dev, "Failed to enable optclk %d\n", ret); - goto err1; + if (!IS_ERR(phy->optclk)) { + ret = clk_enable(phy->optclk); + if (ret) { + dev_err(phy->dev, "Failed to enable optclk %d\n", ret); + goto err1; + } } - ret = clk_enable(phy->wkupclk); - if (ret) { - dev_err(phy->dev, "Failed to enable wkupclk %d\n", ret); - goto err2; + if (!IS_ERR(phy->wkupclk)) { + ret = clk_enable(phy->wkupclk); + if (ret) { + dev_err(phy->dev, "Failed to enable wkupclk %d\n", ret); + goto err2; + } } return 0; err2: - clk_disable(phy->optclk); + if (!IS_ERR(phy->optclk)) + clk_disable(phy->optclk); err1: return ret;