diff options
author | David Lechner <david@lechnology.com> | 2016-03-24 19:51:30 -0400 |
---|---|---|
committer | Sekhar Nori <nsekhar@ti.com> | 2016-04-14 06:01:48 -0400 |
commit | 8a9d088f66f84d7317b4adc64d3d3114f1ee8583 (patch) | |
tree | 6b868ee939265ca6306f929785ff73ada3078bdf | |
parent | 86cad16087a8cdad88c1ac124afde4de01500c21 (diff) |
ARM: davinci: clk: add set_parent callback for mux clocks
Introduce a set_parent callback that will be used for mux clocks, such as
the USB PHY muxes and the async3 clock domain mux.
Signed-off-by: David Lechner <david@lechnology.com>
[nsekhar@ti.com: checkpatch fixes]
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
-rw-r--r-- | arch/arm/mach-davinci/clock.c | 19 | ||||
-rw-r--r-- | arch/arm/mach-davinci/clock.h | 1 |
2 files changed, 19 insertions, 1 deletions
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c index 3424eac6b588..34b4f9fda35d 100644 --- a/arch/arm/mach-davinci/clock.c +++ b/arch/arm/mach-davinci/clock.c | |||
@@ -195,6 +195,14 @@ int clk_set_parent(struct clk *clk, struct clk *parent) | |||
195 | return -EINVAL; | 195 | return -EINVAL; |
196 | 196 | ||
197 | mutex_lock(&clocks_mutex); | 197 | mutex_lock(&clocks_mutex); |
198 | if (clk->set_parent) { | ||
199 | int ret = clk->set_parent(clk, parent); | ||
200 | |||
201 | if (ret) { | ||
202 | mutex_unlock(&clocks_mutex); | ||
203 | return ret; | ||
204 | } | ||
205 | } | ||
198 | clk->parent = parent; | 206 | clk->parent = parent; |
199 | list_del_init(&clk->childnode); | 207 | list_del_init(&clk->childnode); |
200 | list_add(&clk->childnode, &clk->parent->children); | 208 | list_add(&clk->childnode, &clk->parent->children); |
@@ -224,8 +232,17 @@ int clk_register(struct clk *clk) | |||
224 | 232 | ||
225 | mutex_lock(&clocks_mutex); | 233 | mutex_lock(&clocks_mutex); |
226 | list_add_tail(&clk->node, &clocks); | 234 | list_add_tail(&clk->node, &clocks); |
227 | if (clk->parent) | 235 | if (clk->parent) { |
236 | if (clk->set_parent) { | ||
237 | int ret = clk->set_parent(clk, clk->parent); | ||
238 | |||
239 | if (ret) { | ||
240 | mutex_unlock(&clocks_mutex); | ||
241 | return ret; | ||
242 | } | ||
243 | } | ||
228 | list_add_tail(&clk->childnode, &clk->parent->children); | 244 | list_add_tail(&clk->childnode, &clk->parent->children); |
245 | } | ||
229 | mutex_unlock(&clocks_mutex); | 246 | mutex_unlock(&clocks_mutex); |
230 | 247 | ||
231 | /* If rate is already set, use it */ | 248 | /* If rate is already set, use it */ |
diff --git a/arch/arm/mach-davinci/clock.h b/arch/arm/mach-davinci/clock.h index 1e4e836173a1..e2a5437a1aee 100644 --- a/arch/arm/mach-davinci/clock.h +++ b/arch/arm/mach-davinci/clock.h | |||
@@ -106,6 +106,7 @@ struct clk { | |||
106 | int (*reset) (struct clk *clk, bool reset); | 106 | int (*reset) (struct clk *clk, bool reset); |
107 | void (*clk_enable) (struct clk *clk); | 107 | void (*clk_enable) (struct clk *clk); |
108 | void (*clk_disable) (struct clk *clk); | 108 | void (*clk_disable) (struct clk *clk); |
109 | int (*set_parent) (struct clk *clk, struct clk *parent); | ||
109 | }; | 110 | }; |
110 | 111 | ||
111 | /* Clock flags: SoC-specific flags start at BIT(16) */ | 112 | /* Clock flags: SoC-specific flags start at BIT(16) */ |