diff options
author | Paul Walmsley <paul@pwsan.com> | 2010-01-26 22:12:57 -0500 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2010-01-26 22:12:57 -0500 |
commit | e9b98f6040f5a7a04d659759d83ea28d9c528800 (patch) | |
tree | 904811708c1e70cb26eb5e680e3974087085954f /arch | |
parent | ced825293ac34d4f250775c40f13cc6330653309 (diff) |
OMAP clock: make the fixed divisor clock code available for all OMAPs
One of the OMAP1 clocks can use the fixed divisor recalculation code
introduced in the OMAP2 clock code, so rename the
omap2_fixed_divisor_recalc() function to omap_fixed_divisor_recalc()
and make it available to all OMAPs. A followup patch converts the OMAP1
clock.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap2/clock.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clock.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clock2xxx_data.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clock34xx_data.c | 6 | ||||
-rw-r--r-- | arch/arm/plat-omap/clock.c | 11 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/clock.h | 3 |
6 files changed, 18 insertions, 18 deletions
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index 759c72a48f7f..7565f8e40a0e 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c | |||
@@ -300,17 +300,6 @@ u32 omap2_get_dpll_rate(struct clk *clk) | |||
300 | return dpll_clk; | 300 | return dpll_clk; |
301 | } | 301 | } |
302 | 302 | ||
303 | /* | ||
304 | * Used for clocks that have the same value as the parent clock, | ||
305 | * divided by some factor | ||
306 | */ | ||
307 | unsigned long omap2_fixed_divisor_recalc(struct clk *clk) | ||
308 | { | ||
309 | WARN_ON(!clk->fixed_div); | ||
310 | |||
311 | return clk->parent->rate / clk->fixed_div; | ||
312 | } | ||
313 | |||
314 | /** | 303 | /** |
315 | * omap2_clk_dflt_find_companion - find companion clock to @clk | 304 | * omap2_clk_dflt_find_companion - find companion clock to @clk |
316 | * @clk: struct clk * to find the companion clock of | 305 | * @clk: struct clk * to find the companion clock of |
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h index 93c48df3b5b1..0d70dc09370b 100644 --- a/arch/arm/mach-omap2/clock.h +++ b/arch/arm/mach-omap2/clock.h | |||
@@ -78,7 +78,6 @@ u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, | |||
78 | u32 *new_div); | 78 | u32 *new_div); |
79 | u32 omap2_clksel_to_divisor(struct clk *clk, u32 field_val); | 79 | u32 omap2_clksel_to_divisor(struct clk *clk, u32 field_val); |
80 | u32 omap2_divisor_to_clksel(struct clk *clk, u32 div); | 80 | u32 omap2_divisor_to_clksel(struct clk *clk, u32 div); |
81 | unsigned long omap2_fixed_divisor_recalc(struct clk *clk); | ||
82 | long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate); | 81 | long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate); |
83 | int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); | 82 | int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); |
84 | u32 omap2_get_dpll_rate(struct clk *clk); | 83 | u32 omap2_get_dpll_rate(struct clk *clk); |
diff --git a/arch/arm/mach-omap2/clock2xxx_data.c b/arch/arm/mach-omap2/clock2xxx_data.c index 97dc7cf7751d..402115fa9c12 100644 --- a/arch/arm/mach-omap2/clock2xxx_data.c +++ b/arch/arm/mach-omap2/clock2xxx_data.c | |||
@@ -261,7 +261,7 @@ static struct clk func_12m_ck = { | |||
261 | .parent = &func_48m_ck, | 261 | .parent = &func_48m_ck, |
262 | .fixed_div = 4, | 262 | .fixed_div = 4, |
263 | .clkdm_name = "wkup_clkdm", | 263 | .clkdm_name = "wkup_clkdm", |
264 | .recalc = &omap2_fixed_divisor_recalc, | 264 | .recalc = &omap_fixed_divisor_recalc, |
265 | }; | 265 | }; |
266 | 266 | ||
267 | /* Secure timer, only available in secure mode */ | 267 | /* Secure timer, only available in secure mode */ |
@@ -557,7 +557,7 @@ static struct clk iva1_mpu_int_ifck = { | |||
557 | .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN), | 557 | .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN), |
558 | .enable_bit = OMAP2420_EN_IVA_MPU_SHIFT, | 558 | .enable_bit = OMAP2420_EN_IVA_MPU_SHIFT, |
559 | .fixed_div = 2, | 559 | .fixed_div = 2, |
560 | .recalc = &omap2_fixed_divisor_recalc, | 560 | .recalc = &omap_fixed_divisor_recalc, |
561 | }; | 561 | }; |
562 | 562 | ||
563 | /* | 563 | /* |
diff --git a/arch/arm/mach-omap2/clock34xx_data.c b/arch/arm/mach-omap2/clock34xx_data.c index cbb421a45763..9e7f68a8fca2 100644 --- a/arch/arm/mach-omap2/clock34xx_data.c +++ b/arch/arm/mach-omap2/clock34xx_data.c | |||
@@ -735,7 +735,7 @@ static struct clk omap_12m_fck = { | |||
735 | .ops = &clkops_null, | 735 | .ops = &clkops_null, |
736 | .parent = &omap_48m_fck, | 736 | .parent = &omap_48m_fck, |
737 | .fixed_div = 4, | 737 | .fixed_div = 4, |
738 | .recalc = &omap2_fixed_divisor_recalc, | 738 | .recalc = &omap_fixed_divisor_recalc, |
739 | }; | 739 | }; |
740 | 740 | ||
741 | /* This virstual clock is the source for dpll4_m4x2_ck */ | 741 | /* This virstual clock is the source for dpll4_m4x2_ck */ |
@@ -1588,7 +1588,7 @@ static struct clk ssi_sst_fck_3430es1 = { | |||
1588 | .ops = &clkops_null, | 1588 | .ops = &clkops_null, |
1589 | .parent = &ssi_ssr_fck_3430es1, | 1589 | .parent = &ssi_ssr_fck_3430es1, |
1590 | .fixed_div = 2, | 1590 | .fixed_div = 2, |
1591 | .recalc = &omap2_fixed_divisor_recalc, | 1591 | .recalc = &omap_fixed_divisor_recalc, |
1592 | }; | 1592 | }; |
1593 | 1593 | ||
1594 | static struct clk ssi_sst_fck_3430es2 = { | 1594 | static struct clk ssi_sst_fck_3430es2 = { |
@@ -1596,7 +1596,7 @@ static struct clk ssi_sst_fck_3430es2 = { | |||
1596 | .ops = &clkops_null, | 1596 | .ops = &clkops_null, |
1597 | .parent = &ssi_ssr_fck_3430es2, | 1597 | .parent = &ssi_ssr_fck_3430es2, |
1598 | .fixed_div = 2, | 1598 | .fixed_div = 2, |
1599 | .recalc = &omap2_fixed_divisor_recalc, | 1599 | .recalc = &omap_fixed_divisor_recalc, |
1600 | }; | 1600 | }; |
1601 | 1601 | ||
1602 | 1602 | ||
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c index d9f8c844c385..e0f72f48b8b1 100644 --- a/arch/arm/plat-omap/clock.c +++ b/arch/arm/plat-omap/clock.c | |||
@@ -199,6 +199,17 @@ unsigned long followparent_recalc(struct clk *clk) | |||
199 | return clk->parent->rate; | 199 | return clk->parent->rate; |
200 | } | 200 | } |
201 | 201 | ||
202 | /* | ||
203 | * Used for clocks that have the same value as the parent clock, | ||
204 | * divided by some factor | ||
205 | */ | ||
206 | unsigned long omap_fixed_divisor_recalc(struct clk *clk) | ||
207 | { | ||
208 | WARN_ON(!clk->fixed_div); | ||
209 | |||
210 | return clk->parent->rate / clk->fixed_div; | ||
211 | } | ||
212 | |||
202 | void clk_reparent(struct clk *child, struct clk *parent) | 213 | void clk_reparent(struct clk *child, struct clk *parent) |
203 | { | 214 | { |
204 | list_del_init(&child->sibling); | 215 | list_del_init(&child->sibling); |
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h index 94fe2a0ce40a..896cedc923a7 100644 --- a/arch/arm/plat-omap/include/plat/clock.h +++ b/arch/arm/plat-omap/include/plat/clock.h | |||
@@ -88,9 +88,9 @@ struct clk { | |||
88 | void (*init)(struct clk *); | 88 | void (*init)(struct clk *); |
89 | __u8 enable_bit; | 89 | __u8 enable_bit; |
90 | __s8 usecount; | 90 | __s8 usecount; |
91 | u8 fixed_div; | ||
91 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \ | 92 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \ |
92 | defined(CONFIG_ARCH_OMAP4) | 93 | defined(CONFIG_ARCH_OMAP4) |
93 | u8 fixed_div; | ||
94 | void __iomem *clksel_reg; | 94 | void __iomem *clksel_reg; |
95 | u32 clksel_mask; | 95 | u32 clksel_mask; |
96 | const struct clksel *clksel; | 96 | const struct clksel *clksel; |
@@ -134,6 +134,7 @@ extern void propagate_rate(struct clk *clk); | |||
134 | extern void recalculate_root_clocks(void); | 134 | extern void recalculate_root_clocks(void); |
135 | extern unsigned long followparent_recalc(struct clk *clk); | 135 | extern unsigned long followparent_recalc(struct clk *clk); |
136 | extern void clk_enable_init_clocks(void); | 136 | extern void clk_enable_init_clocks(void); |
137 | unsigned long omap_fixed_divisor_recalc(struct clk *clk); | ||
137 | #ifdef CONFIG_CPU_FREQ | 138 | #ifdef CONFIG_CPU_FREQ |
138 | extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table); | 139 | extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table); |
139 | extern void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table); | 140 | extern void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table); |