sh: add enable()/disable()/set_rate() to div6 code
PATCH 1/1 sh: add enable()/disable()/set_rate() to div6 code
From: Magnus Damm <[email protected]>
This patch updates the div6 clock helper code to add support for enable(), disable() and set_rate() callbacks.
Needed by the camera clock enabling board code on Migo-R.
Signed-off-by Magnus Damm <[email protected]>
---
Tested on Migo-R with rewritten sh7722 clock framework.
arch/sh/include/asm/clock.h | 4 +++ arch/sh/kernel/cpu/clock-cpg.c | 44 ++++++++++++++++++++++++++++++++++++++++ arch/sh/kernel/cpu/clock.c | 19 +++++++++++++++++ 3 files changed, 67 insertions(+)
arch/sh/include/asm/clock.h +4 -0
@@ -119,6 +119,10 @@ long clk_rate_table_round(struct clk *clstruct cpufreq_frequency_table *freq_table, unsigned long rate); +int clk_rate_table_find (struct clk *clk, +struct cpufreq_frequency_table *freq_table, +unsigned long rate); +#define SH_CLK_MSTP32 (_name, _id, _parent, _enable_reg, \ _enable_bit, _flags) \ { \
arch/sh/kernel/cpu/clock-cpg.c +44 -0
53 lines not on this page · raw message
arch/sh/kernel/cpu/clock.c +19 -0
@@ -111,6 +111,25 @@ long clk_rate_table_round(struct clk *clreturn rate_best_fit; } +int clk_rate_table_find (struct clk *clk, +struct cpufreq_frequency_table *freq_table, +unsigned long rate) +{ +int i; + +for (i =0 ; freq_table[i].frequency !=CPUFREQ_TABLE_END ; i++) { +unsigned long freq = freq_table[i].frequency; + +if (freq =CPUFREQ_ENTRY_INVALID ) +continue ; + +if (freq = rate) +return i; + } + +return -ENOENT ; +} +/* Used for clocks that always have same value as the parent clock */ unsigned long followparent_recalc (struct clk *clk) {