mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/1] designware: add clock support
Date: Sun,  7 Oct 2012 15:03:03 +0200	[thread overview]
Message-ID: <1349614983-12495-1-git-send-email-plagnioj@jcrosoft.com> (raw)

allow the driver to request it's clock and enable it

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/net/designware.c |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index ec51825..1cbcd5a 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -32,8 +32,10 @@
 #include <asm/mmu.h>
 #include <net/designware.h>
 #include <linux/phy.h>
-#include "designware.h"
+#include <linux/clk.h>
+#include <linux/err.h>
 
+#include "designware.h"
 
 struct dw_eth_dev {
 	struct eth_device netdev;
@@ -390,6 +392,8 @@ static int dwc_ether_probe(struct device_d *dev)
 	struct mii_bus *miibus;
 	void __iomem *base;
 	struct dwc_ether_platform_data *pdata = dev->platform_data;
+	struct clk *clk;
+	int ret;
 
 	if (!pdata) {
 		printf("dwc_ether: no platform_data\n");
@@ -427,6 +431,20 @@ static int dwc_ether_probe(struct device_d *dev)
 	miibus->write = dwc_ether_mii_write;
 	miibus->priv = priv;
 
+	clk = clk_get(dev, NULL);
+	if (IS_ERR(clk)) {
+		ret = PTR_ERR(clk);
+		dev_err(dev, "no clk ret = %d\n", ret);
+		return ret;
+	}
+
+	ret = clk_enable(clk);
+	if (ret) {
+		dev_err(dev, "can not enable clk ret = %d\n", ret);
+		clk_put(clk);
+		return ret;
+	}
+
 	mdiobus_register(miibus);
 	eth_register(edev);
 	return 0;
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2012-10-07 13:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-07 13:03 Jean-Christophe PLAGNIOL-VILLARD [this message]
2012-10-08  9:03 ` Johannes Stezenbach
2012-10-08  9:27   ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-08 10:00     ` Johannes Stezenbach
2012-10-10  9:03 ` Sascha Hauer
2012-10-10  9:06   ` Jean-Christophe PLAGNIOL-VILLARD

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=1349614983-12495-1-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.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