2 * OMAP4-specific DPLL control functions
4 * Copyright (C) 2011 Texas Instruments, Inc.
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.
12 #include <linux/kernel.h>
13 #include <linux/errno.h>
14 #include <linux/clk.h>
16 #include <linux/bitops.h>
19 #include <plat/clock.h>
22 #include "cm-regbits-44xx.h"
24 /* Supported only on OMAP4 */
25 int omap4_dpllmx_gatectrl_read(struct clk
*clk
)
30 if (!clk
|| !clk
->clksel_reg
|| !cpu_is_omap44xx())
33 mask
= clk
->flags
& CLOCK_CLKOUTX2
?
34 OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK
:
35 OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK
;
37 v
= __raw_readl(clk
->clksel_reg
);
44 void omap4_dpllmx_allow_gatectrl(struct clk
*clk
)
49 if (!clk
|| !clk
->clksel_reg
|| !cpu_is_omap44xx())
52 mask
= clk
->flags
& CLOCK_CLKOUTX2
?
53 OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK
:
54 OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK
;
56 v
= __raw_readl(clk
->clksel_reg
);
57 /* Clear the bit to allow gatectrl */
59 __raw_writel(v
, clk
->clksel_reg
);
62 void omap4_dpllmx_deny_gatectrl(struct clk
*clk
)
67 if (!clk
|| !clk
->clksel_reg
|| !cpu_is_omap44xx())
70 mask
= clk
->flags
& CLOCK_CLKOUTX2
?
71 OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK
:
72 OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK
;
74 v
= __raw_readl(clk
->clksel_reg
);
75 /* Set the bit to deny gatectrl */
77 __raw_writel(v
, clk
->clksel_reg
);
80 const struct clkops clkops_omap4_dpllmx_ops
= {
81 .allow_idle
= omap4_dpllmx_allow_gatectrl
,
82 .deny_idle
= omap4_dpllmx_deny_gatectrl
,