aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/clock.c
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2010-02-23 00:09:29 -0500
committerPaul Walmsley <paul@pwsan.com>2010-02-24 14:29:43 -0500
commit74be8427431b4bbff4a6506f64fb30bb61e781a7 (patch)
treea85920bfaef2cc98366c731e2deebb66feb5cda2 /arch/arm/plat-omap/clock.c
parente8d373779e17b3d108b49019fc83102fdd1523e1 (diff)
OMAP clock: add omap_clk_get_by_name() for use by OMAP hwmod core code
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>
Diffstat (limited to 'arch/arm/plat-omap/clock.c')
-rw-r--r--arch/arm/plat-omap/clock.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index f244b172f9e1..6cc13e7fd897 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)
313 } 313 }
314} 314}
315 315
316/**
317 * omap_clk_get_by_name - locate OMAP struct clk by its name
318 * @name: name of the struct clk to locate
319 *
320 * Locate an OMAP struct clk by its name. Assumes that struct clk
321 * names are unique. Returns NULL if not found or a pointer to the
322 * struct clk if found.
323 */
324struct clk *omap_clk_get_by_name(const char *name)
325{
326 struct clk *c;
327 struct clk *ret = NULL;
328
329 mutex_lock(&clocks_mutex);
330
331 list_for_each_entry(c, &clocks, node) {
332 if (!strcmp(c->name, name)) {
333 ret = c;
334 break;
335 }
336 }
337
338 mutex_unlock(&clocks_mutex);
339
340 return ret;
341}
342
316/* 343/*
317 * Low level helpers 344 * Low level helpers
318 */ 345 */