diff options
author | Ranjith Lohithakshan <ranjithl@ti.com> | 2010-02-24 14:05:55 -0500 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2010-02-24 14:05:55 -0500 |
commit | 3cc4a2fc2ed7727828f410ab092111cb56cefd61 (patch) | |
tree | 3f62ac0b73f2f4e886b6a8a70505c15cfde075a5 /arch/arm/mach-omap2/clock34xx.c | |
parent | 419cc97d3678f0fca5e60b3853dd9c1371f67805 (diff) |
AM35xx: Add clock support for new modules on AM35xx
This patch adds clock support for the following AM35xx modules
- Ethernet MAC
- CAN Controller (HECC)
- New MUSB OTG Controller with integrated Phy
- Video Processing Front End (VPFE)
- Additional UART (UART4)
Signed-off-by: Ranjith Lohithakshan <ranjithl@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/mach-omap2/clock34xx.c')
-rw-r--r-- | arch/arm/mach-omap2/clock34xx.c | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c index 49d93efc1911..0e4fdba7f20b 100644 --- a/arch/arm/mach-omap2/clock34xx.c +++ b/arch/arm/mach-omap2/clock34xx.c | |||
@@ -39,6 +39,16 @@ | |||
39 | */ | 39 | */ |
40 | #define DPLL5_FREQ_FOR_USBHOST 120000000 | 40 | #define DPLL5_FREQ_FOR_USBHOST 120000000 |
41 | 41 | ||
42 | /* | ||
43 | * In AM35xx IPSS, the {ICK,FCK} enable bits for modules are exported | ||
44 | * in the same register at a bit offset of 0x8. The EN_ACK for ICK is | ||
45 | * at an offset of 4 from ICK enable bit. | ||
46 | */ | ||
47 | #define AM35XX_IPSS_ICK_MASK 0xF | ||
48 | #define AM35XX_IPSS_ICK_EN_ACK_OFFSET 0x4 | ||
49 | #define AM35XX_IPSS_ICK_FCK_OFFSET 0x8 | ||
50 | #define AM35XX_IPSS_CLK_IDLEST_VAL 0 | ||
51 | |||
42 | /* needed by omap3_core_dpll_m2_set_rate() */ | 52 | /* needed by omap3_core_dpll_m2_set_rate() */ |
43 | struct clk *sdrc_ick_p, *arm_fck_p; | 53 | struct clk *sdrc_ick_p, *arm_fck_p; |
44 | 54 | ||
@@ -144,6 +154,89 @@ const struct clkops omap3_clkops_noncore_dpll_ops = { | |||
144 | .disable = omap3_noncore_dpll_disable, | 154 | .disable = omap3_noncore_dpll_disable, |
145 | }; | 155 | }; |
146 | 156 | ||
157 | /** | ||
158 | * am35xx_clk_find_idlest - return clock ACK info for AM35XX IPSS | ||
159 | * @clk: struct clk * being enabled | ||
160 | * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into | ||
161 | * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into | ||
162 | * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator | ||
163 | * | ||
164 | * The interface clocks on AM35xx IPSS reflects the clock idle status | ||
165 | * in the enable register itsel at a bit offset of 4 from the enable | ||
166 | * bit. A value of 1 indicates that clock is enabled. | ||
167 | */ | ||
168 | static void am35xx_clk_find_idlest(struct clk *clk, | ||
169 | void __iomem **idlest_reg, | ||
170 | u8 *idlest_bit, | ||
171 | u8 *idlest_val) | ||
172 | { | ||
173 | *idlest_reg = (__force void __iomem *)(clk->enable_reg); | ||
174 | *idlest_bit = clk->enable_bit + AM35XX_IPSS_ICK_EN_ACK_OFFSET; | ||
175 | *idlest_val = AM35XX_IPSS_CLK_IDLEST_VAL; | ||
176 | } | ||
177 | |||
178 | /** | ||
179 | * am35xx_clk_find_companion - find companion clock to @clk | ||
180 | * @clk: struct clk * to find the companion clock of | ||
181 | * @other_reg: void __iomem ** to return the companion clock CM_*CLKEN va in | ||
182 | * @other_bit: u8 ** to return the companion clock bit shift in | ||
183 | * | ||
184 | * Some clocks don't have companion clocks. For example, modules with | ||
185 | * only an interface clock (such as HECC) don't have a companion | ||
186 | * clock. Right now, this code relies on the hardware exporting a bit | ||
187 | * in the correct companion register that indicates that the | ||
188 | * nonexistent 'companion clock' is active. Future patches will | ||
189 | * associate this type of code with per-module data structures to | ||
190 | * avoid this issue, and remove the casts. No return value. | ||
191 | */ | ||
192 | static void am35xx_clk_find_companion(struct clk *clk, void __iomem **other_reg, | ||
193 | u8 *other_bit) | ||
194 | { | ||
195 | *other_reg = (__force void __iomem *)(clk->enable_reg); | ||
196 | if (clk->enable_bit & AM35XX_IPSS_ICK_MASK) | ||
197 | *other_bit = clk->enable_bit + AM35XX_IPSS_ICK_FCK_OFFSET; | ||
198 | else | ||
199 | *other_bit = clk->enable_bit - AM35XX_IPSS_ICK_FCK_OFFSET; | ||
200 | } | ||
201 | |||
202 | const struct clkops clkops_am35xx_ipss_module_wait = { | ||
203 | .enable = omap2_dflt_clk_enable, | ||
204 | .disable = omap2_dflt_clk_disable, | ||
205 | .find_idlest = am35xx_clk_find_idlest, | ||
206 | .find_companion = am35xx_clk_find_companion, | ||
207 | }; | ||
208 | |||
209 | /** | ||
210 | * am35xx_clk_ipss_find_idlest - return CM_IDLEST info for IPSS | ||
211 | * @clk: struct clk * being enabled | ||
212 | * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into | ||
213 | * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into | ||
214 | * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator | ||
215 | * | ||
216 | * The IPSS target CM_IDLEST bit is at a different shift from the | ||
217 | * CM_{I,F}CLKEN bit. Pass back the correct info via @idlest_reg | ||
218 | * and @idlest_bit. No return value. | ||
219 | */ | ||
220 | static void am35xx_clk_ipss_find_idlest(struct clk *clk, | ||
221 | void __iomem **idlest_reg, | ||
222 | u8 *idlest_bit, | ||
223 | u8 *idlest_val) | ||
224 | { | ||
225 | u32 r; | ||
226 | |||
227 | r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20); | ||
228 | *idlest_reg = (__force void __iomem *)r; | ||
229 | *idlest_bit = AM35XX_ST_IPSS_SHIFT; | ||
230 | *idlest_val = OMAP34XX_CM_IDLEST_VAL; | ||
231 | } | ||
232 | |||
233 | const struct clkops clkops_am35xx_ipss_wait = { | ||
234 | .enable = omap2_dflt_clk_enable, | ||
235 | .disable = omap2_dflt_clk_disable, | ||
236 | .find_idlest = am35xx_clk_ipss_find_idlest, | ||
237 | .find_companion = omap2_clk_dflt_find_companion, | ||
238 | }; | ||
239 | |||
147 | int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate) | 240 | int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate) |
148 | { | 241 | { |
149 | /* | 242 | /* |