diff options
author | Mike Turquette <mturquette@ti.com> | 2011-07-08 19:26:26 -0700 |
---|---|---|
committer | Nishanth Menon <nm@ti.com> | 2011-07-10 23:20:27 -0700 |
commit | 83e4a5c8264f426cf50d305d657ad68f1b9b9bb3 (patch) | |
tree | 9fa814151fa614fab0f94aa66a8a4f6d3b14bc61 /arch/arm/mach-omap2/dpll44xx.c | |
parent | af9070caf38f05e65364d1e7a9829e153464432d (diff) | |
download | kernel_samsung_tuna-83e4a5c8264f426cf50d305d657ad68f1b9b9bb3.zip kernel_samsung_tuna-83e4a5c8264f426cf50d305d657ad68f1b9b9bb3.tar.gz kernel_samsung_tuna-83e4a5c8264f426cf50d305d657ad68f1b9b9bb3.tar.bz2 |
OMAP4: Clock: round_rate and recalc functions for DPLL_ABE
OMAP4 DPLL_ABE can enable a 4X multipler on top of the normal MN multipler
and divider. This is achieved by setting CM_CLKMODE_DPLL_ABE.DPLL_REGM4XEN
bit in CKGEN module of CM1. From the OMAP4 TRM:
Fdpll = Fref x 2 x (4 x M/(N+1)) in case REGM4XEN bit field is set (only
applicable to DPLL_ABE).
Add new round_rate() and recalc() functions for OMAP4, that check the
setting of REGM4XEN bit and handle this appropriately. The new functions
are a simple wrapper on top of the existing omap2_dpll_round_rate() and
omap2_dpll_get_rate() functions to handle the REGM4XEN bit.
The REGM4XEN bit is only implemented for the ABE DPLL on OMAP4 and so
only dpll_abe_ck uses omap4_dpll_regm4xen_round_rate() and
omap4_dpll_regm4xen_recalc() functions.
[rnayak@ti.com: resolved failing hunks]
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Mike Turquette <mturquette@ti.com>
Tested-by: Jon Hunter <jon-hunter@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/dpll44xx.c')
-rw-r--r-- | arch/arm/mach-omap2/dpll44xx.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/dpll44xx.c b/arch/arm/mach-omap2/dpll44xx.c index 2894764..6e26ba7 100644 --- a/arch/arm/mach-omap2/dpll44xx.c +++ b/arch/arm/mach-omap2/dpll44xx.c @@ -22,6 +22,7 @@ #include <mach/omap4-common.h> #include "clock.h" +#include "clock44xx.h" #include "cm.h" #include "cm1_44xx.h" #include "clock44xx.h" @@ -335,3 +336,48 @@ unsigned long omap4460_mpu_dpll_recalc(struct clk *clk) else return omap2_get_dpll_rate(clk->parent); } + +unsigned long omap4_dpll_regm4xen_recalc(struct clk *clk) +{ + u32 v; + unsigned long rate; + struct dpll_data *dd; + + if (!clk || !clk->dpll_data) + return -EINVAL; + + dd = clk->dpll_data; + + rate = omap2_get_dpll_rate(clk); + + /* regm4xen adds a multiplier of 4 to DPLL calculations */ + v = __raw_readl(dd->control_reg); + if (v & OMAP4430_DPLL_REGM4XEN_MASK) + rate *= OMAP4430_REGM4XEN_MULT; + + return rate; +} + +long omap4_dpll_regm4xen_round_rate(struct clk *clk, unsigned long target_rate) +{ + u32 v; + struct dpll_data *dd; + + if (!clk || !clk->dpll_data) + return -EINVAL; + + dd = clk->dpll_data; + + /* regm4xen adds a multiplier of 4 to DPLL calculations */ + v = __raw_readl(dd->control_reg) & OMAP4430_DPLL_REGM4XEN_MASK; + + if (v) + target_rate = target_rate / OMAP4430_REGM4XEN_MULT; + + omap2_dpll_round_rate(clk, target_rate); + + if (v) + clk->dpll_data->last_rounded_rate *= OMAP4430_REGM4XEN_MULT; + + return clk->dpll_data->last_rounded_rate; +} |