aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-omap2/clkt_dpll.c60
1 files changed, 32 insertions, 28 deletions
diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c
index 05168c98b3d9..098e0893a6a6 100644
--- a/arch/arm/mach-omap2/clkt_dpll.c
+++ b/arch/arm/mach-omap2/clkt_dpll.c
@@ -175,6 +175,33 @@ static int _dpll_test_mult(int *m, int n, unsigned long *new_rate,
175 return r; 175 return r;
176} 176}
177 177
178/**
179 * _omap2_dpll_is_in_bypass - check if DPLL is in bypass mode or not
180 * @v: bitfield value of the DPLL enable
181 *
182 * Checks given DPLL enable bitfield to see whether the DPLL is in bypass
183 * mode or not. Returns 1 if the DPLL is in bypass, 0 otherwise.
184 */
185static int _omap2_dpll_is_in_bypass(u32 v)
186{
187 if (cpu_is_omap24xx()) {
188 if (v == OMAP2XXX_EN_DPLL_LPBYPASS ||
189 v == OMAP2XXX_EN_DPLL_FRBYPASS)
190 return 1;
191 } else if (cpu_is_omap34xx()) {
192 if (v == OMAP3XXX_EN_DPLL_LPBYPASS ||
193 v == OMAP3XXX_EN_DPLL_FRBYPASS)
194 return 1;
195 } else if (soc_is_am33xx() || cpu_is_omap44xx() || soc_is_am43xx()) {
196 if (v == OMAP4XXX_EN_DPLL_LPBYPASS ||
197 v == OMAP4XXX_EN_DPLL_FRBYPASS ||
198 v == OMAP4XXX_EN_DPLL_MNBYPASS)
199 return 1;
200 }
201
202 return 0;
203}
204
178/* Public functions */ 205/* Public functions */
179u8 omap2_init_dpll_parent(struct clk_hw *hw) 206u8 omap2_init_dpll_parent(struct clk_hw *hw)
180{ 207{
@@ -191,20 +218,9 @@ u8 omap2_init_dpll_parent(struct clk_hw *hw)
191 v >>= __ffs(dd->enable_mask); 218 v >>= __ffs(dd->enable_mask);
192 219
193 /* Reparent the struct clk in case the dpll is in bypass */ 220 /* Reparent the struct clk in case the dpll is in bypass */
194 if (cpu_is_omap24xx()) { 221 if (_omap2_dpll_is_in_bypass(v))
195 if (v == OMAP2XXX_EN_DPLL_LPBYPASS || 222 return 1;
196 v == OMAP2XXX_EN_DPLL_FRBYPASS) 223
197 return 1;
198 } else if (cpu_is_omap34xx()) {
199 if (v == OMAP3XXX_EN_DPLL_LPBYPASS ||
200 v == OMAP3XXX_EN_DPLL_FRBYPASS)
201 return 1;
202 } else if (soc_is_am33xx() || cpu_is_omap44xx() || soc_is_am43xx()) {
203 if (v == OMAP4XXX_EN_DPLL_LPBYPASS ||
204 v == OMAP4XXX_EN_DPLL_FRBYPASS ||
205 v == OMAP4XXX_EN_DPLL_MNBYPASS)
206 return 1;
207 }
208 return 0; 224 return 0;
209} 225}
210 226
@@ -237,20 +253,8 @@ unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk)
237 v &= dd->enable_mask; 253 v &= dd->enable_mask;
238 v >>= __ffs(dd->enable_mask); 254 v >>= __ffs(dd->enable_mask);
239 255
240 if (cpu_is_omap24xx()) { 256 if (_omap2_dpll_is_in_bypass(v))
241 if (v == OMAP2XXX_EN_DPLL_LPBYPASS || 257 return __clk_get_rate(dd->clk_bypass);
242 v == OMAP2XXX_EN_DPLL_FRBYPASS)
243 return __clk_get_rate(dd->clk_bypass);
244 } else if (cpu_is_omap34xx()) {
245 if (v == OMAP3XXX_EN_DPLL_LPBYPASS ||
246 v == OMAP3XXX_EN_DPLL_FRBYPASS)
247 return __clk_get_rate(dd->clk_bypass);
248 } else if (soc_is_am33xx() || cpu_is_omap44xx() || soc_is_am43xx()) {
249 if (v == OMAP4XXX_EN_DPLL_LPBYPASS ||
250 v == OMAP4XXX_EN_DPLL_FRBYPASS ||
251 v == OMAP4XXX_EN_DPLL_MNBYPASS)
252 return __clk_get_rate(dd->clk_bypass);
253 }
254 258
255 v = omap2_clk_readl(clk, dd->mult_div1_reg); 259 v = omap2_clk_readl(clk, dd->mult_div1_reg);
256 dpll_mult = v & dd->mult_mask; 260 dpll_mult = v & dd->mult_mask;