aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/clock24xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/clock24xx.c')
-rw-r--r--arch/arm/mach-omap2/clock24xx.c60
1 files changed, 48 insertions, 12 deletions
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c
index e4cef333e291..bc5d3ac66611 100644
--- a/arch/arm/mach-omap2/clock24xx.c
+++ b/arch/arm/mach-omap2/clock24xx.c
@@ -30,6 +30,7 @@
30 30
31#include <mach/clock.h> 31#include <mach/clock.h>
32#include <mach/sram.h> 32#include <mach/sram.h>
33#include <mach/prcm.h>
33#include <asm/div64.h> 34#include <asm/div64.h>
34#include <asm/clkdev.h> 35#include <asm/clkdev.h>
35 36
@@ -43,6 +44,18 @@
43static const struct clkops clkops_oscck; 44static const struct clkops clkops_oscck;
44static const struct clkops clkops_fixed; 45static const struct clkops clkops_fixed;
45 46
47static void omap2430_clk_i2chs_find_idlest(struct clk *clk,
48 void __iomem **idlest_reg,
49 u8 *idlest_bit);
50
51/* 2430 I2CHS has non-standard IDLEST register */
52static const struct clkops clkops_omap2430_i2chs_wait = {
53 .enable = omap2_dflt_clk_enable,
54 .disable = omap2_dflt_clk_disable,
55 .find_idlest = omap2430_clk_i2chs_find_idlest,
56 .find_companion = omap2_clk_dflt_find_companion,
57};
58
46#include "clock24xx.h" 59#include "clock24xx.h"
47 60
48struct omap_clk { 61struct omap_clk {
@@ -233,11 +246,33 @@ static struct prcm_config *curr_prcm_set;
233static struct clk *vclk; 246static struct clk *vclk;
234static struct clk *sclk; 247static struct clk *sclk;
235 248
249static void __iomem *prcm_clksrc_ctrl;
250
236/*------------------------------------------------------------------------- 251/*-------------------------------------------------------------------------
237 * Omap24xx specific clock functions 252 * Omap24xx specific clock functions
238 *-------------------------------------------------------------------------*/ 253 *-------------------------------------------------------------------------*/
239 254
240/** 255/**
256 * omap2430_clk_i2chs_find_idlest - return CM_IDLEST info for 2430 I2CHS
257 * @clk: struct clk * being enabled
258 * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
259 * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
260 *
261 * OMAP2430 I2CHS CM_IDLEST bits are in CM_IDLEST1_CORE, but the
262 * CM_*CLKEN bits are in CM_{I,F}CLKEN2_CORE. This custom function
263 * passes back the correct CM_IDLEST register address for I2CHS
264 * modules. No return value.
265 */
266static void omap2430_clk_i2chs_find_idlest(struct clk *clk,
267 void __iomem **idlest_reg,
268 u8 *idlest_bit)
269{
270 *idlest_reg = OMAP_CM_REGADDR(CORE_MOD, CM_IDLEST);
271 *idlest_bit = clk->enable_bit;
272}
273
274
275/**
241 * omap2xxx_clk_get_core_rate - return the CORE_CLK rate 276 * omap2xxx_clk_get_core_rate - return the CORE_CLK rate
242 * @clk: pointer to the combined dpll_ck + core_ck (currently "dpll_ck") 277 * @clk: pointer to the combined dpll_ck + core_ck (currently "dpll_ck")
243 * 278 *
@@ -269,10 +304,9 @@ static int omap2_enable_osc_ck(struct clk *clk)
269{ 304{
270 u32 pcc; 305 u32 pcc;
271 306
272 pcc = __raw_readl(OMAP24XX_PRCM_CLKSRC_CTRL); 307 pcc = __raw_readl(prcm_clksrc_ctrl);
273 308
274 __raw_writel(pcc & ~OMAP_AUTOEXTCLKMODE_MASK, 309 __raw_writel(pcc & ~OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl);
275 OMAP24XX_PRCM_CLKSRC_CTRL);
276 310
277 return 0; 311 return 0;
278} 312}
@@ -281,10 +315,9 @@ static void omap2_disable_osc_ck(struct clk *clk)
281{ 315{
282 u32 pcc; 316 u32 pcc;
283 317
284 pcc = __raw_readl(OMAP24XX_PRCM_CLKSRC_CTRL); 318 pcc = __raw_readl(prcm_clksrc_ctrl);
285 319
286 __raw_writel(pcc | OMAP_AUTOEXTCLKMODE_MASK, 320 __raw_writel(pcc | OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl);
287 OMAP24XX_PRCM_CLKSRC_CTRL);
288} 321}
289 322
290static const struct clkops clkops_oscck = { 323static const struct clkops clkops_oscck = {
@@ -325,8 +358,8 @@ static int omap2_clk_fixed_enable(struct clk *clk)
325 else if (clk == &apll54_ck) 358 else if (clk == &apll54_ck)
326 cval = OMAP24XX_ST_54M_APLL; 359 cval = OMAP24XX_ST_54M_APLL;
327 360
328 omap2_wait_clock_ready(OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), cval, 361 omap2_cm_wait_idlest(OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), cval,
329 clk->name); 362 clk->name);
330 363
331 /* 364 /*
332 * REVISIT: Should we return an error code if omap2_wait_clock_ready() 365 * REVISIT: Should we return an error code if omap2_wait_clock_ready()
@@ -654,7 +687,7 @@ static u32 omap2_get_sysclkdiv(void)
654{ 687{
655 u32 div; 688 u32 div;
656 689
657 div = __raw_readl(OMAP24XX_PRCM_CLKSRC_CTRL); 690 div = __raw_readl(prcm_clksrc_ctrl);
658 div &= OMAP_SYSCLKDIV_MASK; 691 div &= OMAP_SYSCLKDIV_MASK;
659 div >>= OMAP_SYSCLKDIV_SHIFT; 692 div >>= OMAP_SYSCLKDIV_SHIFT;
660 693
@@ -714,15 +747,18 @@ int __init omap2_clk_init(void)
714 struct omap_clk *c; 747 struct omap_clk *c;
715 u32 clkrate; 748 u32 clkrate;
716 749
717 if (cpu_is_omap242x()) 750 if (cpu_is_omap242x()) {
751 prcm_clksrc_ctrl = OMAP2420_PRCM_CLKSRC_CTRL;
718 cpu_mask = RATE_IN_242X; 752 cpu_mask = RATE_IN_242X;
719 else if (cpu_is_omap2430()) 753 } else if (cpu_is_omap2430()) {
754 prcm_clksrc_ctrl = OMAP2430_PRCM_CLKSRC_CTRL;
720 cpu_mask = RATE_IN_243X; 755 cpu_mask = RATE_IN_243X;
756 }
721 757
722 clk_init(&omap2_clk_functions); 758 clk_init(&omap2_clk_functions);
723 759
724 for (c = omap24xx_clks; c < omap24xx_clks + ARRAY_SIZE(omap24xx_clks); c++) 760 for (c = omap24xx_clks; c < omap24xx_clks + ARRAY_SIZE(omap24xx_clks); c++)
725 clk_init_one(c->lk.clk); 761 clk_preinit(c->lk.clk);
726 762
727 osc_ck.rate = omap2_osc_clk_recalc(&osc_ck); 763 osc_ck.rate = omap2_osc_clk_recalc(&osc_ck);
728 propagate_rate(&osc_ck); 764 propagate_rate(&osc_ck);