Skip to content

Commit e3ab601

Browse files
Tero KristoPaul Walmsley
authored andcommitted
ARM: OMAP3: clock: add support for dpll4_set_rate_and_parent
Expand the support of omap4 per-dpll to provide set_rate_and_parent. This is required for proper behavior of clk_change_rate with determine_rate support. Signed-off-by: Tero Kristo <t-kristo@ti.com> Signed-off-by: Paul Walmsley <paul@pwsan.com>
1 parent 83501ff commit e3ab601

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

arch/arm/mach-omap2/clock3xxx.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@
3838

3939
/* needed by omap3_core_dpll_m2_set_rate() */
4040
struct clk *sdrc_ick_p, *arm_fck_p;
41+
42+
/**
43+
* omap3_dpll4_set_rate - set rate for omap3 per-dpll
44+
* @hw: clock to change
45+
* @rate: target rate for clock
46+
* @parent_rate: rate of the parent clock
47+
*
48+
* Check if the current SoC supports the per-dpll reprogram operation
49+
* or not, and then do the rate change if supported. Returns -EINVAL
50+
* if not supported, 0 for success, and potential error codes from the
51+
* clock rate change.
52+
*/
4153
int omap3_dpll4_set_rate(struct clk_hw *hw, unsigned long rate,
4254
unsigned long parent_rate)
4355
{
@@ -54,6 +66,30 @@ int omap3_dpll4_set_rate(struct clk_hw *hw, unsigned long rate,
5466
return omap3_noncore_dpll_set_rate(hw, rate, parent_rate);
5567
}
5668

69+
/**
70+
* omap3_dpll4_set_rate_and_parent - set rate and parent for omap3 per-dpll
71+
* @hw: clock to change
72+
* @rate: target rate for clock
73+
* @parent_rate: rate of the parent clock
74+
* @index: parent index, 0 - reference clock, 1 - bypass clock
75+
*
76+
* Check if the current SoC support the per-dpll reprogram operation
77+
* or not, and then do the rate + parent change if supported. Returns
78+
* -EINVAL if not supported, 0 for success, and potential error codes
79+
* from the clock rate change.
80+
*/
81+
int omap3_dpll4_set_rate_and_parent(struct clk_hw *hw, unsigned long rate,
82+
unsigned long parent_rate, u8 index)
83+
{
84+
if (ti_clk_features.flags & TI_CLK_DPLL4_DENY_REPROGRAM) {
85+
pr_err("clock: DPLL4 cannot change rate due to silicon 'Limitation 2.5' on 3430ES1.\n");
86+
return -EINVAL;
87+
}
88+
89+
return omap3_noncore_dpll_set_rate_and_parent(hw, rate, parent_rate,
90+
index);
91+
}
92+
5793
void __init omap3_clk_lock_dpll5(void)
5894
{
5995
struct clk *dpll5_clk;

include/linux/clk/ti.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@ int omap2_clk_disable_autoidle_all(void);
291291
void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks);
292292
int omap3_dpll4_set_rate(struct clk_hw *clk, unsigned long rate,
293293
unsigned long parent_rate);
294+
int omap3_dpll4_set_rate_and_parent(struct clk_hw *hw, unsigned long rate,
295+
unsigned long parent_rate, u8 index);
294296
int omap2_dflt_clk_enable(struct clk_hw *hw);
295297
void omap2_dflt_clk_disable(struct clk_hw *hw);
296298
int omap2_dflt_clk_is_enabled(struct clk_hw *hw);

0 commit comments

Comments
 (0)