All of lore.kernel.org
 help / color / mirror / Atom feed
From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] clk: add DT fixed-clock binding support
Date: Mon,  9 Apr 2012 15:25:01 -0500	[thread overview]
Message-ID: <1334003101-17274-5-git-send-email-robherring2@gmail.com> (raw)
In-Reply-To: <1334003101-17274-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(+), 0 deletions(-)

diff --git a/drivers/clk/clk-fixed-rate.c b/drivers/clk/clk-fixed-rate.c
index 90c79fb..72bd083 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
@@ -80,3 +81,25 @@ out:
 			(parent_name ? 1 : 0),
 			flags);
 }
+
+#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 0aab294..038d312 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -153,6 +153,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.5.4

WARNING: multiple messages have this Message-ID (diff)
From: Rob Herring <robherring2@gmail.com>
To: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	devicetree-discuss@lists.ozlabs.org
Cc: Thierry Reding <thierry.reding@avionic-design.de>,
	Mike Turquette <mturquette@linaro.org>,
	Sascha Hauer <kernel@pengutronix.de>,
	Grant Likely <grant.likely@secretlab.ca>,
	shawn.guo@linaro.org, Rob Herring <rob.herring@calxeda.com>
Subject: [PATCH 4/4] clk: add DT fixed-clock binding support
Date: Mon,  9 Apr 2012 15:25:01 -0500	[thread overview]
Message-ID: <1334003101-17274-5-git-send-email-robherring2@gmail.com> (raw)
In-Reply-To: <1334003101-17274-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(+), 0 deletions(-)

diff --git a/drivers/clk/clk-fixed-rate.c b/drivers/clk/clk-fixed-rate.c
index 90c79fb..72bd083 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
@@ -80,3 +81,25 @@ out:
 			(parent_name ? 1 : 0),
 			flags);
 }
+
+#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 0aab294..038d312 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -153,6 +153,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.5.4

  parent reply	other threads:[~2012-04-09 20:25 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-09 20:24 [PATCH 0/4] DT clock binding support Rob Herring
2012-04-09 20:24 ` Rob Herring
2012-04-09 20:24 ` Rob Herring
2012-04-09 20:24 ` [PATCH 1/4] clk: select CLKDEV_LOOKUP for COMMON_CLK Rob Herring
2012-04-09 20:24   ` Rob Herring
2012-04-09 20:24   ` Rob Herring
2012-04-15  3:18   ` Rob Herring
2012-04-15  3:18     ` Rob Herring
2012-04-17 22:13   ` Turquette, Mike
2012-04-17 22:13     ` Turquette, Mike
2012-04-18  7:07     ` Sascha Hauer
2012-04-18  7:07       ` Sascha Hauer
2012-04-19 14:59       ` Rob Herring
2012-04-19 14:59         ` Rob Herring
2012-04-19 14:59         ` Rob Herring
2012-04-19 20:01         ` Turquette, Mike
2012-04-19 20:01           ` Turquette, Mike
2012-04-09 20:24 ` [PATCH 2/4] clk: remove trailing whitespace from clk.h Rob Herring
2012-04-09 20:24   ` Rob Herring
2012-04-19 20:06   ` Turquette, Mike
2012-04-19 20:06     ` Turquette, Mike
2012-04-09 20:25 ` [PATCH 3/4] clk: add DT clock binding support Rob Herring
2012-04-09 20:25   ` Rob Herring
2012-04-10  2:19   ` Shawn Guo
2012-04-10  2:19     ` Shawn Guo
2012-04-10  2:19     ` Shawn Guo
2012-04-10  4:27   ` Fabio Estevam
2012-04-10  4:27     ` Fabio Estevam
2012-04-10  4:27     ` Fabio Estevam
2012-04-10 12:57     ` Rob Herring
2012-04-10 12:57       ` Rob Herring
2012-05-01 22:59   ` Mike Turquette
2012-05-01 22:59     ` Mike Turquette
2012-05-14 13:40     ` Rob Herring
2012-05-14 13:40       ` Rob Herring
2012-05-14 13:40       ` Rob Herring
2012-04-09 20:25 ` Rob Herring [this message]
2012-04-09 20:25   ` [PATCH 4/4] clk: add DT fixed-clock " 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=1334003101-17274-5-git-send-email-robherring2@gmail.com \
    --to=robherring2@gmail.com \
    --cc=linux-arm-kernel@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 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.