diff options
author | Paul Walmsley <paul@pwsan.com> | 2008-08-19 04:08:40 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2008-08-19 04:08:40 -0400 |
commit | ad67ef6848a1608b0430003e11e7af1ce706e341 (patch) | |
tree | f55151e3cc4b4739f13a074af6e7f43e7e6be2d1 /arch/arm/mach-omap2/clock34xx.c | |
parent | 1fca25427482387689fa27594c992a961d98768f (diff) |
ARM: OMAP2: Powerdomain: Add base OMAP2/3 powerdomain code
This patch creates an interface to the powerdomain registers in the
PRM/CM modules on OMAP2/3. This interface is intended to be used by
PM code, e.g., pm.c; not by device drivers directly.
Each powerdomain will be defined in later patches as static
structures. Also defined are dependencies between powerdomains,
used for adding and removing PM_WKDEP and CM_SLEEPDEP bits. The
powerdomain structures are linked into a list at boot by
pwrdm_register(), similar to the OMAP clock code.
The patch adds a Kconfig option, CONFIG_OMAP_DEBUG_POWERDOMAIN, which
when enabled will emit verbose debug messages via pr_debug().
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/clock34xx.c')
-rw-r--r-- | arch/arm/mach-omap2/clock34xx.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c index 3ff74952f835..dff7a72fefc9 100644 --- a/arch/arm/mach-omap2/clock34xx.c +++ b/arch/arm/mach-omap2/clock34xx.c | |||
@@ -62,11 +62,14 @@ static void omap3_dpll_recalc(struct clk *clk) | |||
62 | static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits) | 62 | static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits) |
63 | { | 63 | { |
64 | const struct dpll_data *dd; | 64 | const struct dpll_data *dd; |
65 | u32 v; | ||
65 | 66 | ||
66 | dd = clk->dpll_data; | 67 | dd = clk->dpll_data; |
67 | 68 | ||
68 | cm_rmw_reg_bits(dd->enable_mask, clken_bits << __ffs(dd->enable_mask), | 69 | v = __raw_readl(dd->control_reg); |
69 | dd->control_reg); | 70 | v &= ~dd->enable_mask; |
71 | v |= clken_bits << __ffs(dd->enable_mask); | ||
72 | __raw_writel(v, dd->control_reg); | ||
70 | } | 73 | } |
71 | 74 | ||
72 | /* _omap3_wait_dpll_status: wait for a DPLL to enter a specific state */ | 75 | /* _omap3_wait_dpll_status: wait for a DPLL to enter a specific state */ |
@@ -82,7 +85,7 @@ static int _omap3_wait_dpll_status(struct clk *clk, u8 state) | |||
82 | state <<= dd->idlest_bit; | 85 | state <<= dd->idlest_bit; |
83 | idlest_mask = 1 << dd->idlest_bit; | 86 | idlest_mask = 1 << dd->idlest_bit; |
84 | 87 | ||
85 | while (((cm_read_reg(dd->idlest_reg) & idlest_mask) != state) && | 88 | while (((__raw_readl(dd->idlest_reg) & idlest_mask) != state) && |
86 | i < MAX_DPLL_WAIT_TRIES) { | 89 | i < MAX_DPLL_WAIT_TRIES) { |
87 | i++; | 90 | i++; |
88 | udelay(1); | 91 | udelay(1); |
@@ -285,7 +288,7 @@ static u32 omap3_dpll_autoidle_read(struct clk *clk) | |||
285 | 288 | ||
286 | dd = clk->dpll_data; | 289 | dd = clk->dpll_data; |
287 | 290 | ||
288 | v = cm_read_reg(dd->autoidle_reg); | 291 | v = __raw_readl(dd->autoidle_reg); |
289 | v &= dd->autoidle_mask; | 292 | v &= dd->autoidle_mask; |
290 | v >>= __ffs(dd->autoidle_mask); | 293 | v >>= __ffs(dd->autoidle_mask); |
291 | 294 | ||
@@ -304,6 +307,7 @@ static u32 omap3_dpll_autoidle_read(struct clk *clk) | |||
304 | static void omap3_dpll_allow_idle(struct clk *clk) | 307 | static void omap3_dpll_allow_idle(struct clk *clk) |
305 | { | 308 | { |
306 | const struct dpll_data *dd; | 309 | const struct dpll_data *dd; |
310 | u32 v; | ||
307 | 311 | ||
308 | if (!clk || !clk->dpll_data) | 312 | if (!clk || !clk->dpll_data) |
309 | return; | 313 | return; |
@@ -315,9 +319,10 @@ static void omap3_dpll_allow_idle(struct clk *clk) | |||
315 | * by writing 0x5 instead of 0x1. Add some mechanism to | 319 | * by writing 0x5 instead of 0x1. Add some mechanism to |
316 | * optionally enter this mode. | 320 | * optionally enter this mode. |
317 | */ | 321 | */ |
318 | cm_rmw_reg_bits(dd->autoidle_mask, | 322 | v = __raw_readl(dd->autoidle_reg); |
319 | DPLL_AUTOIDLE_LOW_POWER_STOP << __ffs(dd->autoidle_mask), | 323 | v &= ~dd->autoidle_mask; |
320 | dd->autoidle_reg); | 324 | v |= DPLL_AUTOIDLE_LOW_POWER_STOP << __ffs(dd->autoidle_mask); |
325 | __raw_writel(v, dd->autoidle_reg); | ||
321 | } | 326 | } |
322 | 327 | ||
323 | /** | 328 | /** |
@@ -329,15 +334,17 @@ static void omap3_dpll_allow_idle(struct clk *clk) | |||
329 | static void omap3_dpll_deny_idle(struct clk *clk) | 334 | static void omap3_dpll_deny_idle(struct clk *clk) |
330 | { | 335 | { |
331 | const struct dpll_data *dd; | 336 | const struct dpll_data *dd; |
337 | u32 v; | ||
332 | 338 | ||
333 | if (!clk || !clk->dpll_data) | 339 | if (!clk || !clk->dpll_data) |
334 | return; | 340 | return; |
335 | 341 | ||
336 | dd = clk->dpll_data; | 342 | dd = clk->dpll_data; |
337 | 343 | ||
338 | cm_rmw_reg_bits(dd->autoidle_mask, | 344 | v = __raw_readl(dd->autoidle_reg); |
339 | DPLL_AUTOIDLE_DISABLE << __ffs(dd->autoidle_mask), | 345 | v &= ~dd->autoidle_mask; |
340 | dd->autoidle_reg); | 346 | v |= DPLL_AUTOIDLE_DISABLE << __ffs(dd->autoidle_mask); |
347 | __raw_writel(v, dd->autoidle_reg); | ||
341 | } | 348 | } |
342 | 349 | ||
343 | /* Clock control for DPLL outputs */ | 350 | /* Clock control for DPLL outputs */ |