All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robherring2@gmail.com>
To: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	devicetree-discuss@lists.ozlabs.org
Cc: Grant Likely <grant.likely@secretlab.ca>,
	mturquette@linaro.org, sboyd@codeaurora.org,
	skannan@codeaurora.org, shawn.guo@linaro.org,
	s.hauer@pengutronix.de, Rob Herring <rob.herring@calxeda.com>
Subject: [PATCH v3 2/4] clk: add DT fixed-clock binding support
Date: Tue, 12 Jun 2012 09:41:49 -0500	[thread overview]
Message-ID: <1339512111-11172-3-git-send-email-robherring2@gmail.com> (raw)
In-Reply-To: <1339512111-11172-1-git-send-email-robherring2@gmail.com>

From: Grant Likely <grant.likely@secretlab.ca>

Add support for DT "fixed-clock" binding to the common fixed rate clock
support.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
[Rob Herring] Rework and move into common clock infrastructure
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 drivers/clk/clk-fixed-rate.c |   23 +++++++++++++++++++++++
 include/linux/clk-provider.h |    2 ++
 2 files changed, 25 insertions(+)

diff --git a/drivers/clk/clk-fixed-rate.c b/drivers/clk/clk-fixed-rate.c
index cbd2462..94493f1 100644
--- a/drivers/clk/clk-fixed-rate.c
+++ b/drivers/clk/clk-fixed-rate.c
@@ -14,6 +14,7 @@
 #include <linux/slab.h>
 #include <linux/io.h>
 #include <linux/err.h>
+#include <linux/of.h>
 
 /*
  * DOC: basic fixed-rate clock that cannot gate
@@ -79,3 +80,25 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
 
 	return clk;
 }
+
+#ifdef CONFIG_OF
+/**
+ * of_fixed_clk_setup() - Setup function for simple fixed rate clock
+ */
+void __init of_fixed_clk_setup(struct device_node *node)
+{
+	struct clk *clk;
+	const char *clk_name = node->name;
+	u32 rate;
+
+	if (of_property_read_u32(node, "clock-frequency", &rate))
+		return;
+
+	of_property_read_string(node, "clock-output-names", &clk_name);
+
+	clk = clk_register_fixed_rate(NULL, clk_name, NULL, CLK_IS_ROOT, rate);
+	if (clk)
+		of_clk_add_provider(node, of_clk_src_simple_get, clk);
+}
+EXPORT_SYMBOL_GPL(of_fixed_clk_setup);
+#endif
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index acfef45..b97f61e 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -171,6 +171,8 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
 		const char *parent_name, unsigned long flags,
 		unsigned long fixed_rate);
 
+void of_fixed_clk_setup(struct device_node *np);
+
 /**
  * struct clk_gate - gating clock
  *
-- 
1.7.9.5


WARNING: multiple messages have this Message-ID (diff)
From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 2/4] clk: add DT fixed-clock binding support
Date: Tue, 12 Jun 2012 09:41:49 -0500	[thread overview]
Message-ID: <1339512111-11172-3-git-send-email-robherring2@gmail.com> (raw)
In-Reply-To: <1339512111-11172-1-git-send-email-robherring2@gmail.com>

From: Grant Likely <grant.likely@secretlab.ca>

Add support for DT "fixed-clock" binding to the common fixed rate clock
support.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
[Rob Herring] Rework and move into common clock infrastructure
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 drivers/clk/clk-fixed-rate.c |   23 +++++++++++++++++++++++
 include/linux/clk-provider.h |    2 ++
 2 files changed, 25 insertions(+)

diff --git a/drivers/clk/clk-fixed-rate.c b/drivers/clk/clk-fixed-rate.c
index cbd2462..94493f1 100644
--- a/drivers/clk/clk-fixed-rate.c
+++ b/drivers/clk/clk-fixed-rate.c
@@ -14,6 +14,7 @@
 #include <linux/slab.h>
 #include <linux/io.h>
 #include <linux/err.h>
+#include <linux/of.h>
 
 /*
  * DOC: basic fixed-rate clock that cannot gate
@@ -79,3 +80,25 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
 
 	return clk;
 }
+
+#ifdef CONFIG_OF
+/**
+ * of_fixed_clk_setup() - Setup function for simple fixed rate clock
+ */
+void __init of_fixed_clk_setup(struct device_node *node)
+{
+	struct clk *clk;
+	const char *clk_name = node->name;
+	u32 rate;
+
+	if (of_property_read_u32(node, "clock-frequency", &rate))
+		return;
+
+	of_property_read_string(node, "clock-output-names", &clk_name);
+
+	clk = clk_register_fixed_rate(NULL, clk_name, NULL, CLK_IS_ROOT, rate);
+	if (clk)
+		of_clk_add_provider(node, of_clk_src_simple_get, clk);
+}
+EXPORT_SYMBOL_GPL(of_fixed_clk_setup);
+#endif
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index acfef45..b97f61e 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -171,6 +171,8 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
 		const char *parent_name, unsigned long flags,
 		unsigned long fixed_rate);
 
+void of_fixed_clk_setup(struct device_node *np);
+
 /**
  * struct clk_gate - gating clock
  *
-- 
1.7.9.5

  parent reply	other threads:[~2012-06-12 14:42 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-12 14:41 [PATCH v3 0/4] DT clock bindings Rob Herring
2012-06-12 14:41 ` Rob Herring
2012-06-12 14:41 ` [PATCH v3 1/4] clk: add DT clock binding support Rob Herring
2012-06-12 14:41   ` Rob Herring
2012-06-15  3:17   ` Shawn Guo
2012-06-15  3:17     ` Shawn Guo
2012-06-15  3:17     ` Shawn Guo
2012-06-15  4:32     ` Rob Herring
2012-06-15  4:32       ` Rob Herring
2012-07-01 22:13   ` [PATCH v6] " Rob Herring
2012-07-01 22:13     ` Rob Herring
2012-07-01 22:13     ` Rob Herring
2012-06-12 14:41 ` Rob Herring [this message]
2012-06-12 14:41   ` [PATCH v3 2/4] clk: add DT fixed-clock " Rob Herring
2012-06-12 14:41 ` [PATCH v3 3/4] dt: add clock binding doc to primecell bindings Rob Herring
2012-06-12 14:41   ` Rob Herring
2012-06-22 13:55   ` Ben Dooks
2012-06-22 14:23     ` Russell King - ARM Linux
2012-06-12 14:41 ` [PATCH v3 4/4] clk: add highbank clock support Rob Herring
2012-06-12 14:41   ` Rob Herring
2012-06-12 15:47 ` [PATCH v3 0/4] DT clock bindings Mike Turquette
2012-06-12 15:47   ` Mike Turquette
2012-06-12 16:23   ` Rob Herring
2012-06-12 16:23     ` Rob Herring
2012-06-14  8:49     ` Shawn Guo
2012-06-14  8:49       ` Shawn Guo
2012-06-14  8:49       ` Shawn Guo
2012-06-13 15:26 ` Peter De Schrijver
2012-06-13 15:26   ` Peter De Schrijver
2012-06-13 15:26   ` Peter De Schrijver
2012-06-13 18:09   ` Rob Herring
2012-06-13 18:09     ` Rob Herring
2012-06-13 18:09     ` Rob Herring
2012-06-15  8:39 ` Shawn Guo
2012-06-15  8:39   ` Shawn Guo
2012-06-15  8:39   ` Shawn Guo
2012-06-15 15:40   ` Stephen Warren
2012-06-15 15:40     ` Stephen Warren
2012-06-15 21:07   ` Rob Herring
2012-06-15 21:07     ` Rob Herring
2012-06-15 21:07     ` Rob Herring
2012-06-21  7:27 ` Chris Ball
2012-06-21  7:27   ` Chris Ball
2012-06-21  7:30   ` [PATCH 01/02] clk: Refactor of_clk_* into a new clk-of.c Chris Ball
2012-06-21  7:30     ` Chris Ball
2012-06-21  7:32   ` [PATCH 02/02] clk: clk-of: Use alloc_bootmem() instead of kzalloc() Chris Ball
2012-06-21  7:32     ` Chris Ball
2012-06-21 12:18     ` Paul Mundt
2012-06-21 12:18       ` Paul Mundt
2012-06-21 15:00   ` [PATCH v3 0/4] DT clock bindings Rob Herring
2012-06-21 15:00     ` Rob Herring
2012-06-21 17:54     ` Mike Turquette
2012-06-21 17:54       ` Mike Turquette
2012-06-27 12:54       ` Rob Herring
2012-06-27 12:54         ` Rob Herring
2012-07-03  1:30         ` Turquette, Mike
2012-07-03  1:30           ` Turquette, Mike
2012-07-03  2:37           ` Rob Herring
2012-07-03  2:37             ` Rob Herring

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=1339512111-11172-3-git-send-email-robherring2@gmail.com \
    --to=robherring2@gmail.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@linaro.org \
    --cc=rob.herring@calxeda.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sboyd@codeaurora.org \
    --cc=shawn.guo@linaro.org \
    --cc=skannan@codeaurora.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.