aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorTero Kristo <t-kristo@ti.com>2014-07-02 04:47:42 -0400
committerPaul Walmsley <paul@pwsan.com>2014-07-15 16:09:06 -0400
commit512d91cbd990c67df16d0a7b3ff5d35055ac6b39 (patch)
treed9ebd1366f12859ab6184ffe8595c2649f186cff /arch/arm
parent5f84aeb6a194ed127d1beb61738577c15a60172b (diff)
ARM: OMAP2+: clock/dpll: convert bypass check to use clk_features
OMAP2 DPLL code for checking whether DPLL is in bypass mode now uses clk_features data provided during boot. This avoids the need to use cpu_is_X type checks runtime, and allows us to eventually move the clock code under the clock driver. Signed-off-by: Tero Kristo <t-kristo@ti.com> Reviewed-by: Mike Turquette <mturquette@linaro.org> Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-omap2/clkt_dpll.c25
-rw-r--r--arch/arm/mach-omap2/clock.c17
-rw-r--r--arch/arm/mach-omap2/clock.h1
3 files changed, 31 insertions, 12 deletions
diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c
index 098e0893a6a6..49333d055f54 100644
--- a/arch/arm/mach-omap2/clkt_dpll.c
+++ b/arch/arm/mach-omap2/clkt_dpll.c
@@ -184,18 +184,19 @@ static int _dpll_test_mult(int *m, int n, unsigned long *new_rate,
184 */ 184 */
185static int _omap2_dpll_is_in_bypass(u32 v) 185static int _omap2_dpll_is_in_bypass(u32 v)
186{ 186{
187 if (cpu_is_omap24xx()) { 187 u8 mask, val;
188 if (v == OMAP2XXX_EN_DPLL_LPBYPASS || 188
189 v == OMAP2XXX_EN_DPLL_FRBYPASS) 189 mask = ti_clk_features.dpll_bypass_vals;
190 return 1; 190
191 } else if (cpu_is_omap34xx()) { 191 /*
192 if (v == OMAP3XXX_EN_DPLL_LPBYPASS || 192 * Each set bit in the mask corresponds to a bypass value equal
193 v == OMAP3XXX_EN_DPLL_FRBYPASS) 193 * to the bitshift. Go through each set-bit in the mask and
194 return 1; 194 * compare against the given register value.
195 } else if (soc_is_am33xx() || cpu_is_omap44xx() || soc_is_am43xx()) { 195 */
196 if (v == OMAP4XXX_EN_DPLL_LPBYPASS || 196 while (mask) {
197 v == OMAP4XXX_EN_DPLL_FRBYPASS || 197 val = __ffs(mask);
198 v == OMAP4XXX_EN_DPLL_MNBYPASS) 198 mask ^= (1 << val);
199 if (v == val)
199 return 1; 200 return 1;
200 } 201 }
201 202
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 7efe66e3a029..e4384377d9f8 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -767,4 +767,21 @@ void __init ti_clk_init_features(void)
767 ti_clk_features.fint_min = OMAP3PLUS_DPLL_FINT_MIN; 767 ti_clk_features.fint_min = OMAP3PLUS_DPLL_FINT_MIN;
768 ti_clk_features.fint_max = OMAP3PLUS_DPLL_FINT_MAX; 768 ti_clk_features.fint_max = OMAP3PLUS_DPLL_FINT_MAX;
769 } 769 }
770
771 /* Bypass value setup for DPLLs */
772 if (cpu_is_omap24xx()) {
773 ti_clk_features.dpll_bypass_vals |=
774 (1 << OMAP2XXX_EN_DPLL_LPBYPASS) |
775 (1 << OMAP2XXX_EN_DPLL_FRBYPASS);
776 } else if (cpu_is_omap34xx()) {
777 ti_clk_features.dpll_bypass_vals |=
778 (1 << OMAP3XXX_EN_DPLL_LPBYPASS) |
779 (1 << OMAP3XXX_EN_DPLL_FRBYPASS);
780 } else if (soc_is_am33xx() || cpu_is_omap44xx() || soc_is_am43xx() ||
781 soc_is_omap54xx() || soc_is_dra7xx()) {
782 ti_clk_features.dpll_bypass_vals |=
783 (1 << OMAP4XXX_EN_DPLL_LPBYPASS) |
784 (1 << OMAP4XXX_EN_DPLL_FRBYPASS) |
785 (1 << OMAP4XXX_EN_DPLL_MNBYPASS);
786 }
770} 787}
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 02aa2e3ac036..7b2b099c6a83 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -232,6 +232,7 @@ struct ti_clk_features {
232 long fint_max; 232 long fint_max;
233 long fint_band1_max; 233 long fint_band1_max;
234 long fint_band2_min; 234 long fint_band2_min;
235 u8 dpll_bypass_vals;
235}; 236};
236extern struct ti_clk_features ti_clk_features; 237extern struct ti_clk_features ti_clk_features;
237 238