blob: d0fd77b672614b1acfb793b9a158dbeb3f00d20b [file] [log] [blame]
Paul Walmsley0fd0c212011-02-25 15:49:53 -07001/*
2 * OMAP2-specific DPLL control functions
3 *
4 * Copyright (C) 2011 Nokia Corporation
5 * Paul Walmsley
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/kernel.h>
13#include <linux/errno.h>
14#include <linux/clk.h>
15#include <linux/io.h>
16
Paul Walmsley0fd0c212011-02-25 15:49:53 -070017#include "clock.h"
Paul Walmsleyff4ae5d2012-10-21 01:01:11 -060018#include "cm2xxx.h"
Paul Walmsley0fd0c212011-02-25 15:49:53 -070019#include "cm-regbits-24xx.h"
20
21/* Private functions */
22
23/**
24 * _allow_idle - enable DPLL autoidle bits
25 * @clk: struct clk * of the DPLL to operate on
26 *
27 * Enable DPLL automatic idle control. The DPLL will enter low-power
28 * stop when its downstream clocks are gated. No return value.
29 * REVISIT: DPLL can optionally enter low-power bypass by writing 0x1
30 * instead. Add some mechanism to optionally enter this mode.
31 */
Rajendra Nayaked1ebc42012-04-27 15:59:32 +053032#ifdef CONFIG_COMMON_CLK
33static void _allow_idle(struct clk_hw_omap *clk)
34#else
Paul Walmsley0fd0c212011-02-25 15:49:53 -070035static void _allow_idle(struct clk *clk)
Rajendra Nayaked1ebc42012-04-27 15:59:32 +053036#endif
Paul Walmsley0fd0c212011-02-25 15:49:53 -070037{
38 if (!clk || !clk->dpll_data)
39 return;
40
41 omap2xxx_cm_set_dpll_auto_low_power_stop();
42}
43
44/**
45 * _deny_idle - prevent DPLL from automatically idling
46 * @clk: struct clk * of the DPLL to operate on
47 *
48 * Disable DPLL automatic idle control. No return value.
49 */
Rajendra Nayaked1ebc42012-04-27 15:59:32 +053050#ifdef CONFIG_COMMON_CLK
51static void _deny_idle(struct clk_hw_omap *clk)
52#else
Paul Walmsley0fd0c212011-02-25 15:49:53 -070053static void _deny_idle(struct clk *clk)
Rajendra Nayaked1ebc42012-04-27 15:59:32 +053054#endif
Paul Walmsley0fd0c212011-02-25 15:49:53 -070055{
56 if (!clk || !clk->dpll_data)
57 return;
58
59 omap2xxx_cm_set_dpll_disable_autoidle();
60}
61
62
63/* Public data */
Rajendra Nayaked1ebc42012-04-27 15:59:32 +053064#ifdef CONFIG_COMMON_CLK
65const struct clk_hw_omap_ops clkhwops_omap2xxx_dpll = {
66 .allow_idle = _allow_idle,
67 .deny_idle = _deny_idle,
68};
69#else
Paul Walmsley0fd0c212011-02-25 15:49:53 -070070const struct clkops clkops_omap2xxx_dpll_ops = {
71 .allow_idle = _allow_idle,
72 .deny_idle = _deny_idle,
73};
Rajendra Nayaked1ebc42012-04-27 15:59:32 +053074#endif
Paul Walmsley0fd0c212011-02-25 15:49:53 -070075