OMAP4: clock: Add dummy clock nodes for interface clocks
[pandora-kernel.git] / arch / arm / plat-omap / clock.c
index e0f72f4..5261a09 100644 (file)
@@ -173,7 +173,7 @@ EXPORT_SYMBOL(clk_get_parent);
  * OMAP specific clock functions shared between omap1 and omap2
  *-------------------------------------------------------------------------*/
 
-unsigned int __initdata mpurate;
+int __initdata mpurate;
 
 /*
  * By default we use the rate set by the bootloader.
@@ -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
  */
@@ -330,6 +357,16 @@ const struct clkops clkops_null = {
        .disable        = clkll_disable_null,
 };
 
+/*
+ * Dummy clock
+ *
+ * Used for clock aliases that are needed on some OMAPs, but not others
+ */
+struct clk dummy_ck = {
+       .name   = "dummy",
+       .ops    = &clkops_null,
+};
+
 #ifdef CONFIG_CPU_FREQ
 void clk_init_cpufreq_table(struct cpufreq_frequency_table **table)
 {
@@ -402,14 +439,12 @@ static struct dentry *clk_debugfs_root;
 static int clk_debugfs_register_one(struct clk *c)
 {
        int err;
-       struct dentry *d, *child;
+       struct dentry *d, *child, *child_tmp;
        struct clk *pa = c->parent;
        char s[255];
        char *p = s;
 
        p += sprintf(p, "%s", c->name);
-       if (c->id != 0)
-               sprintf(p, ":%d", c->id);
        d = debugfs_create_dir(s, pa ? pa->dent : clk_debugfs_root);
        if (!d)
                return -ENOMEM;
@@ -434,7 +469,7 @@ static int clk_debugfs_register_one(struct clk *c)
 
 err_out:
        d = c->dent;
-       list_for_each_entry(child, &d->d_subdirs, d_u.d_child)
+       list_for_each_entry_safe(child, child_tmp, &d->d_subdirs, d_u.d_child)
                debugfs_remove(child);
        debugfs_remove(c->dent);
        return err;