OMAP clock: add omap_clk_get_by_name() for use by OMAP hwmod core code
authorPaul Walmsley <paul@pwsan.com>
Tue, 23 Feb 2010 05:09:29 +0000 (22:09 -0700)
committerPaul Walmsley <paul@pwsan.com>
Wed, 24 Feb 2010 19:29:43 +0000 (12:29 -0700)
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
arch/arm/plat-omap/include/plat/clock.h

index f244b172f9e11a2594f83f77645b0f421aba7d14..6cc13e7fd89787f86eeb42ac6c33baf1fb1c5508 100644 (file)
@@ -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
  */
index de078afc65dfaf03afe365428d0beddf30718262..9b4701f1498499f1a2bbeb9b4168531b47f1c9cc 100644 (file)
@@ -182,6 +182,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;
 
This page took 0.036781 seconds and 5 git commands to generate.