aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/dpll3xxx.c
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2010-01-26 22:13:11 -0500
committerPaul Walmsley <paul@pwsan.com>2010-01-29 12:14:22 -0500
commit60c3f65191d077dc4f69fca8eca39fb47f72d8b0 (patch)
tree10ffc764b064993a5d3c9aa973b844fea1c83240 /arch/arm/mach-omap2/dpll3xxx.c
parentfeec1277a5c599ebca6217bc6bb9f6410e84793b (diff)
OMAP3 DPLL: reorganize static functions
Move all static functions up to the top of the file to match the practice in other OMAP clock code. Make omap3_noncore_dpll_program() static (noted by sparse) and prepend an underscore to the function name to mark that it is file-local. Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/mach-omap2/dpll3xxx.c')
-rw-r--r--arch/arm/mach-omap2/dpll3xxx.c113
1 files changed, 58 insertions, 55 deletions
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c
index f6055b493294..2b559fc64855 100644
--- a/arch/arm/mach-omap2/dpll3xxx.c
+++ b/arch/arm/mach-omap2/dpll3xxx.c
@@ -44,17 +44,7 @@
44 44
45#define MAX_DPLL_WAIT_TRIES 1000000 45#define MAX_DPLL_WAIT_TRIES 1000000
46 46
47 47/* Private functions */
48/**
49 * omap3_dpll_recalc - recalculate DPLL rate
50 * @clk: DPLL struct clk
51 *
52 * Recalculate and propagate the DPLL rate.
53 */
54unsigned long omap3_dpll_recalc(struct clk *clk)
55{
56 return omap2_get_dpll_rate(clk);
57}
58 48
59/* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */ 49/* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */
60static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits) 50static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits)
@@ -136,8 +126,6 @@ static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n)
136 return f; 126 return f;
137} 127}
138 128
139/* Non-CORE DPLL (e.g., DPLLs that do not control SDRC) clock functions */
140
141/* 129/*
142 * _omap3_noncore_dpll_lock - instruct a DPLL to lock and wait for readiness 130 * _omap3_noncore_dpll_lock - instruct a DPLL to lock and wait for readiness
143 * @clk: pointer to a DPLL struct clk 131 * @clk: pointer to a DPLL struct clk
@@ -237,6 +225,63 @@ static int _omap3_noncore_dpll_stop(struct clk *clk)
237 return 0; 225 return 0;
238} 226}
239 227
228/*
229 * _omap3_noncore_dpll_program - set non-core DPLL M,N values directly
230 * @clk: struct clk * of DPLL to set
231 * @m: DPLL multiplier to set
232 * @n: DPLL divider to set
233 * @freqsel: FREQSEL value to set
234 *
235 * Program the DPLL with the supplied M, N values, and wait for the DPLL to
236 * lock.. Returns -EINVAL upon error, or 0 upon success.
237 */
238static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel)
239{
240 struct dpll_data *dd = clk->dpll_data;
241 u32 v;
242
243 /* 3430 ES2 TRM: 4.7.6.9 DPLL Programming Sequence */
244 _omap3_noncore_dpll_bypass(clk);
245
246 /* Set jitter correction */
247 if (!cpu_is_omap44xx()) {
248 v = __raw_readl(dd->control_reg);
249 v &= ~dd->freqsel_mask;
250 v |= freqsel << __ffs(dd->freqsel_mask);
251 __raw_writel(v, dd->control_reg);
252 }
253
254 /* Set DPLL multiplier, divider */
255 v = __raw_readl(dd->mult_div1_reg);
256 v &= ~(dd->mult_mask | dd->div1_mask);
257 v |= m << __ffs(dd->mult_mask);
258 v |= (n - 1) << __ffs(dd->div1_mask);
259 __raw_writel(v, dd->mult_div1_reg);
260
261 /* We let the clock framework set the other output dividers later */
262
263 /* REVISIT: Set ramp-up delay? */
264
265 _omap3_noncore_dpll_lock(clk);
266
267 return 0;
268}
269
270/* Public functions */
271
272/**
273 * omap3_dpll_recalc - recalculate DPLL rate
274 * @clk: DPLL struct clk
275 *
276 * Recalculate and propagate the DPLL rate.
277 */
278unsigned long omap3_dpll_recalc(struct clk *clk)
279{
280 return omap2_get_dpll_rate(clk);
281}
282
283/* Non-CORE DPLL (e.g., DPLLs that do not control SDRC) clock functions */
284
240/** 285/**
241 * omap3_noncore_dpll_enable - instruct a DPLL to enter bypass or lock mode 286 * omap3_noncore_dpll_enable - instruct a DPLL to enter bypass or lock mode
242 * @clk: pointer to a DPLL struct clk 287 * @clk: pointer to a DPLL struct clk
@@ -292,48 +337,6 @@ void omap3_noncore_dpll_disable(struct clk *clk)
292 337
293/* Non-CORE DPLL rate set code */ 338/* Non-CORE DPLL rate set code */
294 339
295/*
296 * omap3_noncore_dpll_program - set non-core DPLL M,N values directly
297 * @clk: struct clk * of DPLL to set
298 * @m: DPLL multiplier to set
299 * @n: DPLL divider to set
300 * @freqsel: FREQSEL value to set
301 *
302 * Program the DPLL with the supplied M, N values, and wait for the DPLL to
303 * lock.. Returns -EINVAL upon error, or 0 upon success.
304 */
305int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel)
306{
307 struct dpll_data *dd = clk->dpll_data;
308 u32 v;
309
310 /* 3430 ES2 TRM: 4.7.6.9 DPLL Programming Sequence */
311 _omap3_noncore_dpll_bypass(clk);
312
313 /* Set jitter correction */
314 if (!cpu_is_omap44xx()) {
315 v = __raw_readl(dd->control_reg);
316 v &= ~dd->freqsel_mask;
317 v |= freqsel << __ffs(dd->freqsel_mask);
318 __raw_writel(v, dd->control_reg);
319 }
320
321 /* Set DPLL multiplier, divider */
322 v = __raw_readl(dd->mult_div1_reg);
323 v &= ~(dd->mult_mask | dd->div1_mask);
324 v |= m << __ffs(dd->mult_mask);
325 v |= (n - 1) << __ffs(dd->div1_mask);
326 __raw_writel(v, dd->mult_div1_reg);
327
328 /* We let the clock framework set the other output dividers later */
329
330 /* REVISIT: Set ramp-up delay? */
331
332 _omap3_noncore_dpll_lock(clk);
333
334 return 0;
335}
336
337/** 340/**
338 * omap3_noncore_dpll_set_rate - set non-core DPLL rate 341 * omap3_noncore_dpll_set_rate - set non-core DPLL rate
339 * @clk: struct clk * of DPLL to set 342 * @clk: struct clk * of DPLL to set