From: paul@pwsan.com (Paul Walmsley)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 02/11] OMAP clock: add omap_clk_get_by_name() for use by OMAP hwmod core code
Date: Mon, 22 Feb 2010 21:50:44 -0700 [thread overview]
Message-ID: <20100223045040.18888.90405.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100223044915.18888.83242.stgit@localhost.localdomain>
The OMAP hwmod core code is intended to use SoC IP block description
structures that are autogenerated from TI's OMAP hardware database.
Currently the hwmod code uses clkdev device + connection addressing to
identify clocks. This causes problems in the hwmod autogeneration
process, since the TI hardware database doesn't use platform_device or
clkdev addressing; it uses a single clock signal name string, which
tends to bear some resemblance to what is used in the OMAP TRMs. This
patch adds a non-exported function to the OMAP clock code,
omap_clk_get_by_name(). A subsequent patch will convert the hwmod
code to use this function.
This function is for use only by core code, and practically, no other
code outside the hwmod code should need it. Device driver code in the
kernel must not use this function, which is why it is not exported.
Drivers should use the appropriate clock alias provided by the clkdev
data structures, so driver code can be completely SoC-independent.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Beno?t Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
---
arch/arm/plat-omap/clock.c | 27 +++++++++++++++++++++++++++
arch/arm/plat-omap/include/plat/clock.h | 1 +
2 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index f244b17..6cc13e7 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -313,6 +313,33 @@ void clk_enable_init_clocks(void)
}
}
+/**
+ * omap_clk_get_by_name - locate OMAP struct clk by its name
+ * @name: name of the struct clk to locate
+ *
+ * Locate an OMAP struct clk by its name. Assumes that struct clk
+ * names are unique. Returns NULL if not found or a pointer to the
+ * struct clk if found.
+ */
+struct clk *omap_clk_get_by_name(const char *name)
+{
+ struct clk *c;
+ struct clk *ret = NULL;
+
+ mutex_lock(&clocks_mutex);
+
+ list_for_each_entry(c, &clocks, node) {
+ if (!strcmp(c->name, name)) {
+ ret = c;
+ break;
+ }
+ }
+
+ mutex_unlock(&clocks_mutex);
+
+ return ret;
+}
+
/*
* Low level helpers
*/
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h
index 5e1c035..6a32ac1 100644
--- a/arch/arm/plat-omap/include/plat/clock.h
+++ b/arch/arm/plat-omap/include/plat/clock.h
@@ -184,6 +184,7 @@ unsigned long omap_fixed_divisor_recalc(struct clk *clk);
extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
extern void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table);
#endif
+extern struct clk *omap_clk_get_by_name(const char *name);
extern const struct clkops clkops_null;
next prev parent reply other threads:[~2010-02-23 4:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-23 4:50 [PATCH 00/11] OMAP clock/hwmod: final set of 2.6.34 patches Paul Walmsley
2010-02-23 4:50 ` [PATCH 01/11] OMAP3: clock: add capability to change rate of dpll4_m5_ck_3630 Paul Walmsley
2010-02-23 4:50 ` Paul Walmsley [this message]
2010-02-23 4:50 ` [PATCH 03/11] OMAP hwmod: convert hwmod to use hardware clock names rather than clkdev dev+con Paul Walmsley
2010-02-23 4:50 ` [PATCH 04/11] OMAP hwmod: convert header files with static allocations into C files Paul Walmsley
2010-02-23 4:50 ` [PATCH 05/11] OMAP hwmod: add hwmod class support Paul Walmsley
2010-02-23 4:50 ` [PATCH 06/11] OMAP clockdomain: if no autodeps exist, don't try to add or remove them Paul Walmsley
2010-02-23 4:50 ` [PATCH 07/11] OMAP2/3 clock: combine OMAP2 & 3 boot-time MPU rate change code Paul Walmsley
2010-02-23 4:50 ` [PATCH 08/11] OMAP2+ clock: revise omap2_clk_{disable,enable}() Paul Walmsley
2010-02-23 4:50 ` [PATCH 09/11] OMAP4: clock: Rename leaf clock nodes to end with a _ick or _fck Paul Walmsley
2010-02-23 4:50 ` [PATCH 10/11] OMAP4: clock: Add dummy clock nodes for interface clocks Paul Walmsley
2010-02-23 4:50 ` [PATCH 11/11] OMAP4: clock: Remove clock hacks from timer-gp.c Paul Walmsley
2010-02-24 5:05 ` [PATCH 00/11] OMAP clock/hwmod: final set of 2.6.34 patches Shilimkar, Santosh
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=20100223045040.18888.90405.stgit@localhost.localdomain \
--to=paul@pwsan.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;
as well as URLs for NNTP newsgroup(s).