Commit d80d71fa authored by Paul Walmsley's avatar Paul Walmsley Committed by Tony Lindgren

omap2 clock: generalize initial clock rate setup: recalculate_root_clocks()

Add a new clock framework function, recalculate_root_clocks(), that
recalculates all root clocks (i.e., clocks with no parent clock).
Call this function in omap2_clk_arch_init(), rather than manually
propagating specific clocks.  Add propagate_rate() recalcs to func_32k_ck
and osc_ck.
Signed-off-by: default avatarPaul Walmsley <paul@pwsan.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent d2bf1991
...@@ -1179,8 +1179,7 @@ static int __init omap2_clk_arch_init(void) ...@@ -1179,8 +1179,7 @@ static int __init omap2_clk_arch_init(void)
if (omap2_select_table_rate(&virt_prcm_set, mpurate)) if (omap2_select_table_rate(&virt_prcm_set, mpurate))
printk(KERN_ERR "Could not find matching MPU rate\n"); printk(KERN_ERR "Could not find matching MPU rate\n");
propagate_rate(&osc_ck); /* update main root fast */ recalculate_root_clocks();
propagate_rate(&func_32k_ck); /* update main root slow */
printk(KERN_INFO "Switched to new clocking rate (Crystal/DPLL/MPU): " printk(KERN_INFO "Switched to new clocking rate (Crystal/DPLL/MPU): "
"%ld.%01ld/%ld/%ld MHz\n", "%ld.%01ld/%ld/%ld MHz\n",
...@@ -1231,8 +1230,7 @@ int __init omap2_clk_init(void) ...@@ -1231,8 +1230,7 @@ int __init omap2_clk_init(void)
} }
curr_prcm_set = prcm; curr_prcm_set = prcm;
propagate_rate(&osc_ck); /* update main root fast */ recalculate_root_clocks();
propagate_rate(&func_32k_ck); /* update main root slow */
printk(KERN_INFO "Clocking rate (Crystal/DPLL/MPU): " printk(KERN_INFO "Clocking rate (Crystal/DPLL/MPU): "
"%ld.%01ld/%ld/%ld MHz\n", "%ld.%01ld/%ld/%ld MHz\n",
......
...@@ -592,7 +592,8 @@ static struct clk func_32k_ck = { ...@@ -592,7 +592,8 @@ static struct clk func_32k_ck = {
.name = "func_32k_ck", .name = "func_32k_ck",
.rate = 32000, .rate = 32000,
.flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X |
RATE_FIXED | ALWAYS_ENABLED, RATE_FIXED | ALWAYS_ENABLED | RATE_PROPAGATES,
.recalc = &propagate_rate,
}; };
/* Typical 12/13MHz in standalone mode, will be 26Mhz in chassis mode */ /* Typical 12/13MHz in standalone mode, will be 26Mhz in chassis mode */
...@@ -601,6 +602,7 @@ static struct clk osc_ck = { /* (*12, *13, 19.2, *26, 38.4)MHz */ ...@@ -601,6 +602,7 @@ static struct clk osc_ck = { /* (*12, *13, 19.2, *26, 38.4)MHz */
.rate = 26000000, /* fixed up in clock init */ .rate = 26000000, /* fixed up in clock init */
.flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X |
RATE_FIXED | RATE_PROPAGATES, RATE_FIXED | RATE_PROPAGATES,
.recalc = &propagate_rate,
}; };
/* With out modem likely 12MHz, with modem likely 13MHz */ /* With out modem likely 12MHz, with modem likely 13MHz */
......
...@@ -312,6 +312,23 @@ void propagate_rate(struct clk * tclk) ...@@ -312,6 +312,23 @@ void propagate_rate(struct clk * tclk)
} }
} }
/**
* recalculate_root_clocks - recalculate and propagate all root clocks
*
* Recalculates all root clocks (clocks with no parent), which if the
* clock's .recalc is set correctly, should also propagate their rates.
* Called at init.
*/
void recalculate_root_clocks(void)
{
struct clk *clkp;
list_for_each_entry(clkp, &clocks, node) {
if (unlikely(!clkp->parent) && likely((u32)clkp->recalc))
clkp->recalc(clkp);
}
}
int clk_register(struct clk *clk) int clk_register(struct clk *clk)
{ {
if (clk == NULL || IS_ERR(clk)) if (clk == NULL || IS_ERR(clk))
......
...@@ -57,6 +57,7 @@ extern int clk_init(struct clk_functions * custom_clocks); ...@@ -57,6 +57,7 @@ extern int clk_init(struct clk_functions * custom_clocks);
extern int clk_register(struct clk *clk); extern int clk_register(struct clk *clk);
extern void clk_unregister(struct clk *clk); extern void clk_unregister(struct clk *clk);
extern void propagate_rate(struct clk *clk); extern void propagate_rate(struct clk *clk);
extern void recalculate_root_clocks(void);
extern void followparent_recalc(struct clk * clk); extern void followparent_recalc(struct clk * clk);
extern void clk_allow_idle(struct clk *clk); extern void clk_allow_idle(struct clk *clk);
extern void clk_deny_idle(struct clk *clk); extern void clk_deny_idle(struct clk *clk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment