diff options
Diffstat (limited to 'arch/arm/mach-omap2/clkt2xxx_apll.c')
-rw-r--r-- | arch/arm/mach-omap2/clkt2xxx_apll.c | 62 |
1 files changed, 44 insertions, 18 deletions
diff --git a/arch/arm/mach-omap2/clkt2xxx_apll.c b/arch/arm/mach-omap2/clkt2xxx_apll.c index 8c5b13e7ee61..25b1feed480d 100644 --- a/arch/arm/mach-omap2/clkt2xxx_apll.c +++ b/arch/arm/mach-omap2/clkt2xxx_apll.c @@ -38,62 +38,88 @@ /* Private functions */ -static int _apll96_enable(struct clk *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; +} + +int omap2_clk_apll96_enable(struct clk_hw *hw) { return omap2xxx_cm_apll96_enable(); } -static int _apll54_enable(struct clk *clk) +int omap2_clk_apll54_enable(struct clk_hw *hw) { return omap2xxx_cm_apll54_enable(); } -static void _apll96_allow_idle(struct clk *clk) +static void _apll96_allow_idle(struct clk_hw_omap *clk) { omap2xxx_cm_set_apll96_auto_low_power_stop(); } -static void _apll96_deny_idle(struct clk *clk) +static void _apll96_deny_idle(struct clk_hw_omap *clk) { omap2xxx_cm_set_apll96_disable_autoidle(); } -static void _apll54_allow_idle(struct clk *clk) +static void _apll54_allow_idle(struct clk_hw_omap *clk) { omap2xxx_cm_set_apll54_auto_low_power_stop(); } -static void _apll54_deny_idle(struct clk *clk) +static void _apll54_deny_idle(struct clk_hw_omap *clk) { omap2xxx_cm_set_apll54_disable_autoidle(); } -static void _apll96_disable(struct clk *clk) +void omap2_clk_apll96_disable(struct clk_hw *hw) { omap2xxx_cm_apll96_disable(); } -static void _apll54_disable(struct clk *clk) +void omap2_clk_apll54_disable(struct clk_hw *hw) { omap2xxx_cm_apll54_disable(); } -/* Public data */ +unsigned long omap2_clk_apll54_recalc(struct clk_hw *hw, + unsigned long parent_rate) +{ + return (omap2xxx_clk_apll_locked(hw)) ? 54000000 : 0; +} -const struct clkops clkops_apll96 = { - .enable = _apll96_enable, - .disable = _apll96_disable, - .allow_idle = _apll96_allow_idle, - .deny_idle = _apll96_deny_idle, -}; +unsigned long omap2_clk_apll96_recalc(struct clk_hw *hw, + unsigned long parent_rate) +{ + return (omap2xxx_clk_apll_locked(hw)) ? 96000000 : 0; +} -const struct clkops clkops_apll54 = { - .enable = _apll54_enable, - .disable = _apll54_disable, +/* Public data */ +const struct clk_hw_omap_ops clkhwops_apll54 = { .allow_idle = _apll54_allow_idle, .deny_idle = _apll54_deny_idle, }; +const struct clk_hw_omap_ops clkhwops_apll96 = { + .allow_idle = _apll96_allow_idle, + .deny_idle = _apll96_deny_idle, +}; + /* Public functions */ u32 omap2xxx_get_apll_clkin(void) |