linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kishon Vijay Abraham I <kishon@ti.com>
To: <grant.likely@secretlab.ca>, <rob.herring@calxeda.com>,
	<rob@landley.net>, <linux@arm.linux.org.uk>, <kishon@ti.com>,
	<balbi@ti.com>, <linux-usb@vger.kernel.org>,
	<linux-omap@vger.kernel.org>,
	<devicetree-discuss@lists.ozlabs.org>,
	<linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>
Subject: [PATCH 4/4] usb: phy: omap-usb2: enable 960Mhz clock for omap5
Date: Wed, 19 Sep 2012 17:00:29 +0530	[thread overview]
Message-ID: <1348054229-27362-5-git-send-email-kishon@ti.com> (raw)
In-Reply-To: <1348054229-27362-1-git-send-email-kishon@ti.com>

"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 <kishon@ti.com>
---
 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;
 }
-- 
1.7.9.5


  parent reply	other threads:[~2012-09-19 11:30 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-19 11:30 [PATCH 0/4] usb: phy: add usb3 phy driver Kishon Vijay Abraham I
2012-09-19 11:30 ` [PATCH 1/4] usb: phy: add a new driver for usb3 phy Kishon Vijay Abraham I
2012-09-19 14:41   ` Marc Kleine-Budde
2012-09-21  6:08     ` ABRAHAM, KISHON VIJAY
2012-10-11  0:59   ` Tony Lindgren
2012-10-12  9:08     ` kishon
2012-10-12 15:03       ` Tony Lindgren
2012-09-19 11:30 ` [PATCH 2/4] usb: dwc3: Fix gadget pullup in SS mode Kishon Vijay Abraham I
2012-09-19 11:53   ` Felipe Balbi
     [not found]     ` <CAEgRx2zOVn0zV39-cuPuj4n4HRgQmywy_NY4KTe0qEgeC+NEkw@mail.gmail.com>
2012-09-19 16:04       ` Felipe Balbi
     [not found]         ` <CAEgRx2yXStORBknr2hoMcobMO8wFGuKr4bvzZwEQHQQcHVH76Q@mail.gmail.com>
2012-09-19 17:24           ` Felipe Balbi
2012-09-19 17:29             ` Felipe Balbi
2012-09-19 11:30 ` [PATCH 3/4] usb: phy: omap-usb3: Decrease the number of transitions to recovery Kishon Vijay Abraham I
2012-09-19 11:55   ` Felipe Balbi
2012-09-19 11:30 ` Kishon Vijay Abraham I [this message]
2012-09-19 11:56   ` [PATCH 4/4] usb: phy: omap-usb2: enable 960Mhz clock for omap5 Felipe Balbi
2012-09-19 14:45     ` Marc Kleine-Budde
2012-09-19 14:42       ` Felipe Balbi
2012-09-19 14:50         ` Marc Kleine-Budde
2012-09-26  5:40     ` ABRAHAM, KISHON VIJAY
2012-09-26 18:27       ` Felipe Balbi
2012-09-27  5:13         ` ABRAHAM, KISHON VIJAY
2012-09-27  5:13           ` Felipe Balbi

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=1348054229-27362-5-git-send-email-kishon@ti.com \
    --to=kishon@ti.com \
    --cc=balbi@ti.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=rob.herring@calxeda.com \
    --cc=rob@landley.net \
    /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).