Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: jeremy.kerr@canonical.com (Jeremy Kerr)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC,PATCH 2/7] arm: generic support for fixed-rate clocks
Date: Fri, 08 Jan 2010 10:44:12 +1100	[thread overview]
Message-ID: <1262907852.736710.514100290928.2.gpush@pororo> (raw)
In-Reply-To: <1262907852.736281.78480196040.1.gpush@pororo>

Since we have a few fixed rate clocks, define a simple clk_fixed
with a single rate property.

Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>

---
 arch/arm/common/clk.c      |    8 ++++++++
 arch/arm/include/asm/clk.h |   13 +++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/arch/arm/common/clk.c b/arch/arm/common/clk.c
index 0357d02..699bb28 100644
--- a/arch/arm/common/clk.c
+++ b/arch/arm/common/clk.c
@@ -76,3 +76,11 @@ struct clk *clk_get_parent(struct clk *clk)
 	return ERR_PTR(-ENOSYS);
 }
 EXPORT_SYMBOL(clk_get_parent);
+
+#define to_clk_fixed(clk) (container_of(clk, struct clk_fixed, clk))
+
+unsigned long clk_fixed_get_rate(struct clk *clk)
+{
+	return to_clk_fixed(clk)->rate;
+}
+EXPORT_SYMBOL(clk_fixed_get_rate);
diff --git a/arch/arm/include/asm/clk.h b/arch/arm/include/asm/clk.h
index 87fcfae..1547fa5 100644
--- a/arch/arm/include/asm/clk.h
+++ b/arch/arm/include/asm/clk.h
@@ -28,6 +28,19 @@ struct clk {
        struct clk*     (*get_parent)(struct clk *);
 };
 
+/* Simple fixed-rate clock */
+struct clk_fixed {
+	struct clk	clk;
+	unsigned long	rate;
+};
+
+extern unsigned long clk_fixed_get_rate(struct clk *clk);
+
+#define DEFINE_CLK_FIXED(r) { \
+	.clk = { .get_rate = clk_fixed_get_rate }, \
+	.rate = (r) \
+};
+
 #else /* CONFIG_HAVE_COMMON_STRUCT_CLK */
 
 struct clk;

  parent reply	other threads:[~2010-01-07 23:44 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-07 23:44 [RFC,PATCH 1/7] arm: add a common struct clk Jeremy Kerr
2010-01-07 23:44 ` [RFC,PATCH 7/7] arm/icst307: remove icst307_ps_to_vco Jeremy Kerr
2010-01-07 23:44 ` [RFC,PATCH 3/7] arm/versatile: use generic struct clk Jeremy Kerr
2010-01-07 23:44 ` [RFC,PATCH 5/7] arm/realview: " Jeremy Kerr
2010-01-07 23:44 ` [RFC, PATCH 6/7] arm/icst307: use common struct clk, unify realview and versatile clocks Jeremy Kerr
2010-01-08  1:11   ` H Hartley Sweeten
2010-01-08  1:35     ` Jeremy Kerr
2010-01-07 23:44 ` [RFC,PATCH 4/7] arm/versatile: remove oscoff from clk_versatile Jeremy Kerr
2010-01-07 23:44 ` Jeremy Kerr [this message]
2010-01-08  0:30 ` [RFC,PATCH 1/7] arm: add a common struct clk H Hartley Sweeten
2010-01-08  1:20   ` Jeremy Kerr
2010-01-08  3:26     ` Jeremy Kerr
2010-01-08  9:42       ` Russell King - ARM Linux
2010-01-08 10:01         ` Benjamin Herrenschmidt
2010-01-08 11:18           ` Russell King - ARM Linux
2010-01-08 11:45             ` Benjamin Herrenschmidt
2010-01-08 12:59               ` Russell King - ARM Linux
2010-01-08 19:45                 ` Benjamin Herrenschmidt
2010-01-11  3:37         ` Jeremy Kerr
2010-01-12  8:00           ` Francesco VIRLINZI
2010-01-12  8:50             ` Benjamin Herrenschmidt
2010-01-08 16:25       ` H Hartley Sweeten
2010-01-08 19:33         ` Benjamin Herrenschmidt
2010-01-08  1:17 ` Benjamin Herrenschmidt
2010-01-08  1:38   ` Jeremy Kerr
2010-01-11  5:38     ` Jeremy Kerr
2010-01-11 10:46       ` Mark Brown
2010-01-11 19:48         ` Benjamin Herrenschmidt

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=1262907852.736710.514100290928.2.gpush@pororo \
    --to=jeremy.kerr@canonical.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox