@@ -308,6 +308,16 @@ void clk_enable_init_clocks(void)
}
}
+static struct clk *_omap_clk_get_by_name(const char *name)
+{
+ struct clk *c;
+
+ list_for_each_entry(c, &clocks, node)
+ if (!strcmp(c->name, name))
+ return c;
+ return NULL;
+}
+
/**
* omap_clk_get_by_name - locate OMAP struct clk by its name
* @name: name of the struct clk to locate
@@ -318,21 +328,45 @@ void clk_enable_init_clocks(void)
*/
struct clk *omap_clk_get_by_name(const char *name)
{
- struct clk *c;
struct clk *ret = NULL;
mutex_lock(&clocks_mutex);
+ ret = _omap_clk_get_by_name(name);
+ mutex_unlock(&clocks_mutex);
+
+ return ret;
+}
+
+static inline void omap_init_dpll_data_clk_pts(struct dpll_data *dd)
+{
+ if (!dd->clk_ref && dd->clk_ref_name)
+ dd->clk_ref = _omap_clk_get_by_name(dd->clk_ref_name);
+ if (!dd->clk_bypass && dd->clk_bypass_name)
+ dd->clk_bypass =
_omap_clk_get_by_name(dd->clk_bypass_name);
+}
+
+static inline void omap_init_clksel_clk_pts(struct clksel *clks)
+{
+ if (!clks->parent && clks->parent_name)
+ clks->parent = _omap_clk_get_by_name(clks->parent_name);
+}
+
+void omap_init_clk_pts(void)
+{
+ struct clk *c;
+
+ mutex_lock(&clocks_mutex);
list_for_each_entry(c, &clocks, node) {
- if (!strcmp(c->name, name)) {
- ret = c;
- break;
- }
+ if (!c->parent && c->parent_name)
+ c->parent = _omap_clk_get_by_name(c->parent_name);
+ if (c->dpll_data)
+ omap_init_dpll_data_clk_pts(c->dpll_data);
+ if (c->clksel)
+ omap_init_clksel_clk_pts(c->clksel);
}
mutex_unlock(&clocks_mutex);
-
- return ret;
}
/*
b/arch/arm/plat-omap/include/plat/clock.h
@@ -85,6 +85,7 @@ struct clksel_rate {
/**
* struct clksel - available parent clocks, and a pointer to their
divisors
* @parent: struct clk * to a possible parent clock
+ * @parent_name: Name of the possible parent clock
* @rates: available divisors for this parent clock
*