Commit 435699db authored by Paul Walmsley's avatar Paul Walmsley

OMAP2+ clock: clean up clkt_clksel.c

This patch cleans up arch/arm/mach-omap2/clkt_clksel.c.  It:

- makes several functions static that are not called outside the file;

- adds documentation;

- makes some code paths easier to read (hopefully), by breaking up
  compound statements and removing redundant checks;

- converts some pr_err()s that indicate clock tree data problems into WARN()s,
  so they are more likely to be noticed;

- and moves omap2_clk_round_rate() back into mach-omap2/clock.c, its proper
  home, since it is not clksel-specific.
Signed-off-by: default avatarPaul Walmsley <paul@pwsan.com>
parent d74b4949
This diff is collapsed.
...@@ -334,6 +334,15 @@ int omap2_clk_enable(struct clk *clk) ...@@ -334,6 +334,15 @@ int omap2_clk_enable(struct clk *clk)
return ret; return ret;
} }
/* Given a clock and a rate apply a clock specific rounding function */
long omap2_clk_round_rate(struct clk *clk, unsigned long rate)
{
if (clk->round_rate)
return clk->round_rate(clk, rate);
return clk->rate;
}
/* Set the clock rate for a clock source */ /* Set the clock rate for a clock source */
int omap2_clk_set_rate(struct clk *clk, unsigned long rate) int omap2_clk_set_rate(struct clk *clk, unsigned long rate)
{ {
......
...@@ -73,19 +73,20 @@ void omap2_clk_disable_unused(struct clk *clk); ...@@ -73,19 +73,20 @@ void omap2_clk_disable_unused(struct clk *clk);
#define omap2_clk_disable_unused NULL #define omap2_clk_disable_unused NULL
#endif #endif
unsigned long omap2_clksel_recalc(struct clk *clk);
void omap2_init_clk_clkdm(struct clk *clk); void omap2_init_clk_clkdm(struct clk *clk);
void omap2_init_clksel_parent(struct clk *clk);
u32 omap2_clksel_get_divisor(struct clk *clk); /* clkt_clksel.c public functions */
u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate,
u32 *new_div); u32 *new_div);
u32 omap2_clksel_to_divisor(struct clk *clk, u32 field_val); void omap2_init_clksel_parent(struct clk *clk);
u32 omap2_divisor_to_clksel(struct clk *clk, u32 div); unsigned long omap2_clksel_recalc(struct clk *clk);
long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate); long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate);
int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); int omap2_clksel_set_rate(struct clk *clk, unsigned long rate);
int omap2_clksel_set_parent(struct clk *clk, struct clk *new_parent); int omap2_clksel_set_parent(struct clk *clk, struct clk *new_parent);
u32 omap2_get_dpll_rate(struct clk *clk); u32 omap2_get_dpll_rate(struct clk *clk);
void omap2_init_dpll_parent(struct clk *clk); void omap2_init_dpll_parent(struct clk *clk);
int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name); int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name);
......
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