diff options
Diffstat (limited to 'arch/arm/mach-omap2/clock2xxx.c')
-rw-r--r-- | arch/arm/mach-omap2/clock2xxx.c | 86 |
1 files changed, 1 insertions, 85 deletions
diff --git a/arch/arm/mach-omap2/clock2xxx.c b/arch/arm/mach-omap2/clock2xxx.c index 11d6edb0b32f..88077e746966 100644 --- a/arch/arm/mach-omap2/clock2xxx.c +++ b/arch/arm/mach-omap2/clock2xxx.c | |||
@@ -44,16 +44,6 @@ | |||
44 | #include "cm.h" | 44 | #include "cm.h" |
45 | #include "cm-regbits-24xx.h" | 45 | #include "cm-regbits-24xx.h" |
46 | 46 | ||
47 | |||
48 | /* CM_CLKEN_PLL.EN_{54,96}M_PLL options (24XX) */ | ||
49 | #define EN_APLL_STOPPED 0 | ||
50 | #define EN_APLL_LOCKED 3 | ||
51 | |||
52 | /* CM_CLKSEL1_PLL.APLLS_CLKIN options (24XX) */ | ||
53 | #define APLLS_CLKIN_19_2MHZ 0 | ||
54 | #define APLLS_CLKIN_13MHZ 2 | ||
55 | #define APLLS_CLKIN_12MHZ 3 | ||
56 | |||
57 | struct clk *vclk, *sclk, *dclk; | 47 | struct clk *vclk, *sclk, *dclk; |
58 | 48 | ||
59 | void __iomem *prcm_clksrc_ctrl; | 49 | void __iomem *prcm_clksrc_ctrl; |
@@ -126,80 +116,6 @@ static void omap2_sys_clk_recalc(struct clk *clk) | |||
126 | } | 116 | } |
127 | #endif /* OLD_CK */ | 117 | #endif /* OLD_CK */ |
128 | 118 | ||
129 | /* Enable an APLL if off */ | ||
130 | static int omap2_clk_apll_enable(struct clk *clk, u32 status_mask) | ||
131 | { | ||
132 | u32 cval, apll_mask; | ||
133 | |||
134 | apll_mask = EN_APLL_LOCKED << clk->enable_bit; | ||
135 | |||
136 | cval = cm_read_mod_reg(PLL_MOD, CM_CLKEN); | ||
137 | |||
138 | if ((cval & apll_mask) == apll_mask) | ||
139 | return 0; /* apll already enabled */ | ||
140 | |||
141 | cval &= ~apll_mask; | ||
142 | cval |= apll_mask; | ||
143 | cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN); | ||
144 | |||
145 | omap2_cm_wait_idlest(OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), status_mask, | ||
146 | clk->name); | ||
147 | |||
148 | /* | ||
149 | * REVISIT: Should we return an error code if omap2_wait_clock_ready() | ||
150 | * fails? | ||
151 | */ | ||
152 | return 0; | ||
153 | } | ||
154 | |||
155 | static int omap2_clk_apll96_enable(struct clk *clk) | ||
156 | { | ||
157 | return omap2_clk_apll_enable(clk, OMAP24XX_ST_96M_APLL); | ||
158 | } | ||
159 | |||
160 | static int omap2_clk_apll54_enable(struct clk *clk) | ||
161 | { | ||
162 | return omap2_clk_apll_enable(clk, OMAP24XX_ST_54M_APLL); | ||
163 | } | ||
164 | |||
165 | /* Stop APLL */ | ||
166 | static void omap2_clk_apll_disable(struct clk *clk) | ||
167 | { | ||
168 | u32 cval; | ||
169 | |||
170 | cval = cm_read_mod_reg(PLL_MOD, CM_CLKEN); | ||
171 | cval &= ~(EN_APLL_LOCKED << clk->enable_bit); | ||
172 | cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN); | ||
173 | } | ||
174 | |||
175 | const struct clkops clkops_apll96 = { | ||
176 | .enable = omap2_clk_apll96_enable, | ||
177 | .disable = omap2_clk_apll_disable, | ||
178 | }; | ||
179 | |||
180 | const struct clkops clkops_apll54 = { | ||
181 | .enable = omap2_clk_apll54_enable, | ||
182 | .disable = omap2_clk_apll_disable, | ||
183 | }; | ||
184 | |||
185 | static u32 omap2_get_apll_clkin(void) | ||
186 | { | ||
187 | u32 aplls, srate = 0; | ||
188 | |||
189 | aplls = cm_read_mod_reg(PLL_MOD, CM_CLKSEL1); | ||
190 | aplls &= OMAP24XX_APLLS_CLKIN_MASK; | ||
191 | aplls >>= OMAP24XX_APLLS_CLKIN_SHIFT; | ||
192 | |||
193 | if (aplls == APLLS_CLKIN_19_2MHZ) | ||
194 | srate = 19200000; | ||
195 | else if (aplls == APLLS_CLKIN_13MHZ) | ||
196 | srate = 13000000; | ||
197 | else if (aplls == APLLS_CLKIN_12MHZ) | ||
198 | srate = 12000000; | ||
199 | |||
200 | return srate; | ||
201 | } | ||
202 | |||
203 | static u32 omap2_get_sysclkdiv(void) | 119 | static u32 omap2_get_sysclkdiv(void) |
204 | { | 120 | { |
205 | u32 div; | 121 | u32 div; |
@@ -213,7 +129,7 @@ static u32 omap2_get_sysclkdiv(void) | |||
213 | 129 | ||
214 | unsigned long omap2_osc_clk_recalc(struct clk *clk) | 130 | unsigned long omap2_osc_clk_recalc(struct clk *clk) |
215 | { | 131 | { |
216 | return omap2_get_apll_clkin() * omap2_get_sysclkdiv(); | 132 | return omap2xxx_get_apll_clkin() * omap2_get_sysclkdiv(); |
217 | } | 133 | } |
218 | 134 | ||
219 | unsigned long omap2_sys_clk_recalc(struct clk *clk) | 135 | unsigned long omap2_sys_clk_recalc(struct clk *clk) |