aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-msm/clock.c
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2011-02-23 12:37:42 -0500
committerDavid Brown <davidb@codeaurora.org>2011-02-28 15:40:17 -0500
commitbd32344a6baa8baac9c2b3e9c6c649cc4ed53920 (patch)
tree0b272cc0ea1e7dae1d86fd5ea43de78264000eac /arch/arm/mach-msm/clock.c
parent2a52220c89e02423aa23e6b9fb6dc0c706465a82 (diff)
msm: clock: Migrate to clkdev
Migrating to clkdev has several advantages: * Less code in mach-msm/clock.c * A more robust clk_get() implementation * clk_add_alias() support * clk_get_sys() support In general, this will help board authors setup clock aliases and break the dependency on device pointers in the clock tables. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: David Brown <davidb@codeaurora.org>
Diffstat (limited to 'arch/arm/mach-msm/clock.c')
-rw-r--r--arch/arm/mach-msm/clock.c39
1 files changed, 10 insertions, 29 deletions
diff --git a/arch/arm/mach-msm/clock.c b/arch/arm/mach-msm/clock.c
index e00f6a040ad5..22a537669624 100644
--- a/arch/arm/mach-msm/clock.c
+++ b/arch/arm/mach-msm/clock.c
@@ -19,6 +19,11 @@
19#include <linux/err.h> 19#include <linux/err.h>
20#include <linux/spinlock.h> 20#include <linux/spinlock.h>
21#include <linux/pm_qos_params.h> 21#include <linux/pm_qos_params.h>
22#include <linux/mutex.h>
23#include <linux/clk.h>
24#include <linux/string.h>
25#include <linux/module.h>
26#include <linux/clkdev.h>
22 27
23#include "clock.h" 28#include "clock.h"
24 29
@@ -29,32 +34,6 @@ static LIST_HEAD(clocks);
29/* 34/*
30 * Standard clock functions defined in include/linux/clk.h 35 * Standard clock functions defined in include/linux/clk.h
31 */ 36 */
32struct clk *clk_get(struct device *dev, const char *id)
33{
34 struct clk *clk;
35
36 mutex_lock(&clocks_mutex);
37
38 list_for_each_entry(clk, &clocks, list)
39 if (!strcmp(id, clk->name) && clk->dev == dev)
40 goto found_it;
41
42 list_for_each_entry(clk, &clocks, list)
43 if (!strcmp(id, clk->name) && clk->dev == NULL)
44 goto found_it;
45
46 clk = ERR_PTR(-ENOENT);
47found_it:
48 mutex_unlock(&clocks_mutex);
49 return clk;
50}
51EXPORT_SYMBOL(clk_get);
52
53void clk_put(struct clk *clk)
54{
55}
56EXPORT_SYMBOL(clk_put);
57
58int clk_enable(struct clk *clk) 37int clk_enable(struct clk *clk)
59{ 38{
60 unsigned long flags; 39 unsigned long flags;
@@ -157,13 +136,15 @@ EXPORT_SYMBOL(clk_set_flags);
157 */ 136 */
158static struct clk *ebi1_clk; 137static struct clk *ebi1_clk;
159 138
160void __init msm_clock_init(struct clk *clock_tbl, unsigned num_clocks) 139void __init msm_clock_init(struct clk_lookup *clock_tbl, unsigned num_clocks)
161{ 140{
162 unsigned n; 141 unsigned n;
163 142
164 mutex_lock(&clocks_mutex); 143 mutex_lock(&clocks_mutex);
165 for (n = 0; n < num_clocks; n++) 144 for (n = 0; n < num_clocks; n++) {
166 list_add_tail(&clock_tbl[n].list, &clocks); 145 clkdev_add(&clock_tbl[n]);
146 list_add_tail(&clock_tbl[n].clk->list, &clocks);
147 }
167 mutex_unlock(&clocks_mutex); 148 mutex_unlock(&clocks_mutex);
168 149
169 ebi1_clk = clk_get(NULL, "ebi1_clk"); 150 ebi1_clk = clk_get(NULL, "ebi1_clk");