diff options
Diffstat (limited to 'arch/arm/mach-mxs/clock.c')
-rw-r--r-- | arch/arm/mach-mxs/clock.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/arch/arm/mach-mxs/clock.c b/arch/arm/mach-mxs/clock.c index a7093c88e6a6..97a6f4acc6cc 100644 --- a/arch/arm/mach-mxs/clock.c +++ b/arch/arm/mach-mxs/clock.c | |||
@@ -74,10 +74,15 @@ static int __clk_enable(struct clk *clk) | |||
74 | return 0; | 74 | return 0; |
75 | } | 75 | } |
76 | 76 | ||
77 | /* This function increments the reference count on the clock and enables the | 77 | /* |
78 | * clock if not already enabled. The parent clock tree is recursively enabled | 78 | * The clk_enable/clk_disable could be called by drivers in atomic context, |
79 | * so they should not really hold mutex. Instead, clk_prepare/clk_unprepare | ||
80 | * can hold a mutex, as the pair will only be called in non-atomic context. | ||
81 | * Before migrating to common clk framework, we can have __clk_enable and | ||
82 | * __clk_disable called in clk_prepare/clk_unprepare with mutex held and | ||
83 | * leave clk_enable/clk_disable as the dummy functions. | ||
79 | */ | 84 | */ |
80 | int clk_enable(struct clk *clk) | 85 | int clk_prepare(struct clk *clk) |
81 | { | 86 | { |
82 | int ret = 0; | 87 | int ret = 0; |
83 | 88 | ||
@@ -90,13 +95,9 @@ int clk_enable(struct clk *clk) | |||
90 | 95 | ||
91 | return ret; | 96 | return ret; |
92 | } | 97 | } |
93 | EXPORT_SYMBOL(clk_enable); | 98 | EXPORT_SYMBOL(clk_prepare); |
94 | 99 | ||
95 | /* This function decrements the reference count on the clock and disables | 100 | void clk_unprepare(struct clk *clk) |
96 | * the clock when reference count is 0. The parent clock tree is | ||
97 | * recursively disabled | ||
98 | */ | ||
99 | void clk_disable(struct clk *clk) | ||
100 | { | 101 | { |
101 | if (clk == NULL || IS_ERR(clk)) | 102 | if (clk == NULL || IS_ERR(clk)) |
102 | return; | 103 | return; |
@@ -105,6 +106,18 @@ void clk_disable(struct clk *clk) | |||
105 | __clk_disable(clk); | 106 | __clk_disable(clk); |
106 | mutex_unlock(&clocks_mutex); | 107 | mutex_unlock(&clocks_mutex); |
107 | } | 108 | } |
109 | EXPORT_SYMBOL(clk_unprepare); | ||
110 | |||
111 | int clk_enable(struct clk *clk) | ||
112 | { | ||
113 | return 0; | ||
114 | } | ||
115 | EXPORT_SYMBOL(clk_enable); | ||
116 | |||
117 | void clk_disable(struct clk *clk) | ||
118 | { | ||
119 | /* nothing to do */ | ||
120 | } | ||
108 | EXPORT_SYMBOL(clk_disable); | 121 | EXPORT_SYMBOL(clk_disable); |
109 | 122 | ||
110 | /* Retrieve the *current* clock rate. If the clock itself | 123 | /* Retrieve the *current* clock rate. If the clock itself |
@@ -166,7 +179,7 @@ int clk_set_parent(struct clk *clk, struct clk *parent) | |||
166 | return ret; | 179 | return ret; |
167 | 180 | ||
168 | if (clk->usecount) | 181 | if (clk->usecount) |
169 | clk_enable(parent); | 182 | clk_prepare_enable(parent); |
170 | 183 | ||
171 | mutex_lock(&clocks_mutex); | 184 | mutex_lock(&clocks_mutex); |
172 | ret = clk->set_parent(clk, parent); | 185 | ret = clk->set_parent(clk, parent); |