From 28138e52be1a5293057957f49ad39ed3dca03b47 Mon Sep 17 00:00:00 2001 From: Paul Walmsley Date: Fri, 14 Sep 2012 23:18:20 -0600 Subject: [PATCH] --- yaml --- r: 342453 b: refs/heads/master c: 7a2bd1cc3926327c0393deb52e8300af75b1c9e1 h: refs/heads/master i: 342451: 3b84ee66e3784a6ea7a74d5aef95efd87c40d918 v: v3 --- [refs] | 2 +- trunk/arch/arm/mach-omap2/clkt2xxx_apll.c | 35 +++++++++++++++++++++++ trunk/arch/arm/mach-omap2/clock2xxx.h | 4 +++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index cc783aefb352..543d5ff287b4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ed1ebc4948fdfe4c68865e5543b4a68e5a55973b +refs/heads/master: 7a2bd1cc3926327c0393deb52e8300af75b1c9e1 diff --git a/trunk/arch/arm/mach-omap2/clkt2xxx_apll.c b/trunk/arch/arm/mach-omap2/clkt2xxx_apll.c index 1bd15275dbf9..76a958c6e5bc 100644 --- a/trunk/arch/arm/mach-omap2/clkt2xxx_apll.c +++ b/trunk/arch/arm/mach-omap2/clkt2xxx_apll.c @@ -38,6 +38,27 @@ /* Private functions */ +#ifdef CONFIG_COMMON_CLK +/** + * omap2xxx_clk_apll_locked - is the APLL locked? + * @hw: struct clk_hw * of the APLL to check + * + * If the APLL IP block referred to by @hw indicates that it's locked, + * return true; otherwise, return false. + */ +static bool omap2xxx_clk_apll_locked(struct clk_hw *hw) +{ + struct clk_hw_omap *clk = to_clk_hw_omap(hw); + u32 r, apll_mask; + + apll_mask = EN_APLL_LOCKED << clk->enable_bit; + + r = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN); + + return ((r & apll_mask) == apll_mask) ? true : false; +} +#endif + #ifdef CONFIG_COMMON_CLK int omap2_clk_apll96_enable(struct clk_hw *hw) #else @@ -110,6 +131,20 @@ static void _apll54_disable(struct clk *clk) omap2xxx_cm_apll54_disable(); } +#ifdef CONFIG_COMMON_CLK +unsigned long omap2_clk_apll54_recalc(struct clk_hw *hw, + unsigned long parent_rate) +{ + return (omap2xxx_clk_apll_locked(hw)) ? 54000000 : 0; +} + +unsigned long omap2_clk_apll96_recalc(struct clk_hw *hw, + unsigned long parent_rate) +{ + return (omap2xxx_clk_apll_locked(hw)) ? 96000000 : 0; +} +#endif + /* Public data */ #ifdef CONFIG_COMMON_CLK const struct clk_hw_omap_ops clkhwops_apll54 = { diff --git a/trunk/arch/arm/mach-omap2/clock2xxx.h b/trunk/arch/arm/mach-omap2/clock2xxx.h index 58581511d795..82147c49a8de 100644 --- a/trunk/arch/arm/mach-omap2/clock2xxx.h +++ b/trunk/arch/arm/mach-omap2/clock2xxx.h @@ -27,6 +27,10 @@ unsigned long omap2_dpllcore_recalc(struct clk_hw *hw, int omap2_reprogram_dpllcore(struct clk_hw *clk, unsigned long rate, unsigned long parent_rate); void omap2xxx_clkt_dpllcore_init(struct clk_hw *hw); +unsigned long omap2_clk_apll54_recalc(struct clk_hw *hw, + unsigned long parent_rate); +unsigned long omap2_clk_apll96_recalc(struct clk_hw *hw, + unsigned long parent_rate); #else unsigned long omap2_table_mpu_recalc(struct clk *clk); int omap2_select_table_rate(struct clk *clk, unsigned long rate);