diff options
Diffstat (limited to 'arch/arm/plat-omap/clock.c')
-rw-r--r-- | arch/arm/plat-omap/clock.c | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c index 4becbdd1935c..5261a0923691 100644 --- a/arch/arm/plat-omap/clock.c +++ b/arch/arm/plat-omap/clock.c | |||
@@ -173,7 +173,7 @@ EXPORT_SYMBOL(clk_get_parent); | |||
173 | * OMAP specific clock functions shared between omap1 and omap2 | 173 | * OMAP specific clock functions shared between omap1 and omap2 |
174 | *-------------------------------------------------------------------------*/ | 174 | *-------------------------------------------------------------------------*/ |
175 | 175 | ||
176 | unsigned int __initdata mpurate; | 176 | int __initdata mpurate; |
177 | 177 | ||
178 | /* | 178 | /* |
179 | * By default we use the rate set by the bootloader. | 179 | * By default we use the rate set by the bootloader. |
@@ -199,6 +199,17 @@ unsigned long followparent_recalc(struct clk *clk) | |||
199 | return clk->parent->rate; | 199 | return clk->parent->rate; |
200 | } | 200 | } |
201 | 201 | ||
202 | /* | ||
203 | * Used for clocks that have the same value as the parent clock, | ||
204 | * divided by some factor | ||
205 | */ | ||
206 | unsigned long omap_fixed_divisor_recalc(struct clk *clk) | ||
207 | { | ||
208 | WARN_ON(!clk->fixed_div); | ||
209 | |||
210 | return clk->parent->rate / clk->fixed_div; | ||
211 | } | ||
212 | |||
202 | void clk_reparent(struct clk *child, struct clk *parent) | 213 | void clk_reparent(struct clk *child, struct clk *parent) |
203 | { | 214 | { |
204 | list_del_init(&child->sibling); | 215 | list_del_init(&child->sibling); |
@@ -302,6 +313,33 @@ void clk_enable_init_clocks(void) | |||
302 | } | 313 | } |
303 | } | 314 | } |
304 | 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 | */ | ||
324 | struct 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 | |||
305 | /* | 343 | /* |
306 | * Low level helpers | 344 | * Low level helpers |
307 | */ | 345 | */ |
@@ -319,6 +357,16 @@ const struct clkops clkops_null = { | |||
319 | .disable = clkll_disable_null, | 357 | .disable = clkll_disable_null, |
320 | }; | 358 | }; |
321 | 359 | ||
360 | /* | ||
361 | * Dummy clock | ||
362 | * | ||
363 | * Used for clock aliases that are needed on some OMAPs, but not others | ||
364 | */ | ||
365 | struct clk dummy_ck = { | ||
366 | .name = "dummy", | ||
367 | .ops = &clkops_null, | ||
368 | }; | ||
369 | |||
322 | #ifdef CONFIG_CPU_FREQ | 370 | #ifdef CONFIG_CPU_FREQ |
323 | void clk_init_cpufreq_table(struct cpufreq_frequency_table **table) | 371 | void clk_init_cpufreq_table(struct cpufreq_frequency_table **table) |
324 | { | 372 | { |
@@ -397,8 +445,6 @@ static int clk_debugfs_register_one(struct clk *c) | |||
397 | char *p = s; | 445 | char *p = s; |
398 | 446 | ||
399 | p += sprintf(p, "%s", c->name); | 447 | p += sprintf(p, "%s", c->name); |
400 | if (c->id != 0) | ||
401 | sprintf(p, ":%d", c->id); | ||
402 | d = debugfs_create_dir(s, pa ? pa->dent : clk_debugfs_root); | 448 | d = debugfs_create_dir(s, pa ? pa->dent : clk_debugfs_root); |
403 | if (!d) | 449 | if (!d) |
404 | return -ENOMEM; | 450 | return -ENOMEM; |