devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
To: balbi-l0cyMroinI0@public.gmane.org,
	bcousson-rdvid1DuHRBWk0Htik3J/w@public.gmane.org,
	tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org
Cc: balajitk-l0cyMroinI0@public.gmane.org,
	kishon-l0cyMroinI0@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-ide-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
Subject: [RFC PATCH 04/15] phy: omap-pipe3: use generic clock names
Date: Thu, 19 Sep 2013 16:05:32 +0300	[thread overview]
Message-ID: <1379595943-14622-5-git-send-email-rogerq@ti.com> (raw)
In-Reply-To: <1379595943-14622-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>

From: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>

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 <kishon-l0cyMroinI0@public.gmane.org>
Signed-off-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
---
 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;
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2013-09-19 13:05 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-19 13:05 [RFC PATCH 00/15] Add SATA support for TI OMAP5 and DRA7 SoCs Roger Quadros
2013-09-19 13:05 ` [RFC PATCH 01/15] phy: rename struct omap_control_usb to struct omap_control_phy Roger Quadros
     [not found]   ` <1379595943-14622-2-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2013-09-19 14:25     ` Daniel Mack
2013-09-19 13:05 ` [RFC PATCH 02/15] phy: omap-control: Update DT binding information Roger Quadros
2013-09-19 13:05 ` [RFC PATCH 03/15] ARM: dts: omap5: Add clocks to usb3_phy node Roger Quadros
     [not found] ` <1379595943-14622-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2013-09-19 13:05   ` Roger Quadros [this message]
2013-09-19 13:05   ` [RFC PATCH 08/15] ata: ahci_platform: Manage SATA PHY Roger Quadros
     [not found]     ` <1379595943-14622-9-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2013-09-22 16:58       ` Tejun Heo
2013-09-22 18:24         ` Sergei Shtylyov
2013-09-22 21:51           ` Tejun Heo
2013-09-23  7:37             ` Roger Quadros
     [not found]               ` <523FEFC2.801-l0cyMroinI0@public.gmane.org>
2013-09-23 12:59                 ` Sergei Shtylyov
2013-09-23 13:59                   ` Roger Quadros
2014-02-07 10:33                     ` Roger Quadros
2014-02-07 10:39                       ` Arnd Bergmann
2014-02-07 10:44                         ` Roger Quadros
     [not found]             ` <20130922215107.GD27616-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2013-09-23 12:53               ` Sergei Shtylyov
     [not found]                 ` <524039E0.2060205-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2013-09-25 12:16                   ` Bartlomiej Zolnierkiewicz
2013-09-22 18:22     ` Sergei Shtylyov
     [not found]       ` <523F3567.80303-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2013-09-22 21:48         ` Tejun Heo
2013-09-23 14:10           ` Sergei Shtylyov
2013-09-23 14:12             ` Tejun Heo
2013-09-23  7:42       ` Roger Quadros
2013-09-19 13:05 ` [RFC PATCH 05/15] phy: omap-pipe3: Add SATA DPLL support Roger Quadros
2013-09-19 13:05 ` [RFC PATCH 06/15] phy: omap-pipe3: update compatibility string and DT binding Roger Quadros
2013-09-19 13:05 ` [RFC PATCH 07/15] ARM: dts: omap5: Update usb3phy node Roger Quadros
2013-09-19 13:05 ` [RFC PATCH 09/15] ata: ti_sata: Add Texas Instruments SATA Wrapper driver Roger Quadros
2013-09-25 12:37   ` Bartlomiej Zolnierkiewicz
2013-09-25 12:49     ` Bartlomiej Zolnierkiewicz
2013-09-25 13:29       ` Roger Quadros
2013-09-19 13:22 ` [RFC PATCH 10/15] ARM: omap5: hwmod: Add ocp2scp3 and sata hwmods Roger Quadros
2013-09-19 13:23 ` [RFC PATCH 11/15] arm: omap5: hwmod: add missing ocp2scp hwmod data Roger Quadros
2013-09-19 13:23 ` [RFC PATCH 12/15] ARM: dts: omap5: add ocp2scp1 address resource Roger Quadros
     [not found]   ` <1379597019-15294-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2013-09-19 14:17     ` Sergei Shtylyov
     [not found]       ` <523B0782.7050501-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2013-09-20  9:22         ` Roger Quadros
2013-09-19 13:23 ` [RFC PATCH 13/15] arm: dts: omap5: add sata node Roger Quadros
2013-09-19 13:24 ` [RFC PATCH 14/15] ARM: DRA7: hwmod: Add ocp2scp3 and sata hwmods Roger Quadros
2013-09-19 13:24 ` [RFC PATCH 15/15] arm: dts: dra7: add sata node Roger Quadros
     [not found]   ` <1379597059-15405-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2013-09-19 14:11     ` Sergei Shtylyov
     [not found]       ` <523B05FD.7020200-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2013-09-20 10:19         ` Roger Quadros
2013-09-22 18:45           ` Sergei Shtylyov
2013-09-23  8:24             ` Roger Quadros

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1379595943-14622-5-git-send-email-rogerq@ti.com \
    --to=rogerq-l0cymroini0@public.gmane.org \
    --cc=balajitk-l0cyMroinI0@public.gmane.org \
    --cc=balbi-l0cyMroinI0@public.gmane.org \
    --cc=bcousson-rdvid1DuHRBWk0Htik3J/w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=kishon-l0cyMroinI0@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-ide-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).