summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/tegra2_clocks.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-tegra/tegra2_clocks.c')
-rw-r--r--arch/arm/mach-tegra/tegra2_clocks.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/arch/arm/mach-tegra/tegra2_clocks.c b/arch/arm/mach-tegra/tegra2_clocks.c
index a48baf9c8d35..15f3b75cbdee 100644
--- a/arch/arm/mach-tegra/tegra2_clocks.c
+++ b/arch/arm/mach-tegra/tegra2_clocks.c
@@ -1233,25 +1233,38 @@ static struct clk_ops tegra_audio_sync_clk_ops = {
};
/* call this function after pinmux configuration */
-static void tegra2_cdev_clk_set_parent(struct clk *c)
+static int tegra2_cdev_clk_set_parent(struct clk *c, struct clk *p)
{
const struct clk_mux_sel *mux = 0;
const struct clk_mux_sel *sel;
enum tegra_pingroup pg = TEGRA_PINGROUP_CDEV1;
int val;
- /* Get pinmux setting for cdev1 and cdev2 from APB_MISC register */
- if (!strcmp(c->name, "clk_dev2"))
- pg = TEGRA_PINGROUP_CDEV2;
+ if (p) {
+ for (sel = c->inputs; sel->input != NULL; sel++) {
+ if (sel->input == p) {
+ clk_reparent(c, p);
+ return 0;
+ }
+ }
+ }
+ else {
+ /* Get pinmux setting for cdev1 and cdev2 from APB_MISC reg */
+ if (!strcmp(c->name, "clk_dev2"))
+ pg = TEGRA_PINGROUP_CDEV2;
- val = tegra_pinmux_get_func(pg);
- for (sel = c->inputs; sel->input != NULL; sel++) {
- if (val == sel->value)
- mux = sel;
+ val = tegra_pinmux_get_func(pg);
+ for (sel = c->inputs; sel->input != NULL; sel++) {
+ if (val == sel->value) {
+ mux = sel;
+ BUG_ON(!mux);
+ clk_reparent(c, mux->input);
+ return 0;
+ }
+ }
}
- BUG_ON(!mux);
- c->parent = mux->input;
+ return -EINVAL;
}
/* cdev1 and cdev2 (dap_mclk1 and dap_mclk2) ops */
@@ -1276,7 +1289,7 @@ static int tegra2_cdev_clk_enable(struct clk *c)
{
if (!c->parent) {
/* Set parent from inputs */
- tegra2_cdev_clk_set_parent(c);
+ tegra2_cdev_clk_set_parent(c, NULL);
clk_enable(c->parent);
}
@@ -1295,6 +1308,7 @@ static struct clk_ops tegra_cdev_clk_ops = {
.init = &tegra2_cdev_clk_init,
.enable = &tegra2_cdev_clk_enable,
.disable = &tegra2_cdev_clk_disable,
+ .set_parent = &tegra2_cdev_clk_set_parent,
};
/* shared bus ops */