aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/cm2xxx.c
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2012-10-21 03:01:11 -0400
committerPaul Walmsley <paul@pwsan.com>2012-10-21 03:01:11 -0400
commit4bd5259e53accda0fe295d3b25da348f4d5f4b09 (patch)
tree6ddacb5a75a8eda93916eaa917775ac36b561b81 /arch/arm/mach-omap2/cm2xxx.c
parentff4ae5d9319b86f940e410e92659c50f9879ff46 (diff)
ARM: OMAP2/3: clockdomain/PRM/CM: move the low-level clockdomain functions into PRM/CM
Move the low-level SoC-specific clockdomain control functions into cm*.c and prm*.c. For example, OMAP2xxx low-level clockdomain functions go into cm2xxx.c. Then remove the unnecessary clockdomain*xxx*.c files. The objective is to centralize low-level CM and PRM register accesses into the cm*.[ch] and prm*.[ch] files, and then to export an OMAP SoC-independent API to higher-level OMAP power management code. Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Rajendra Nayak <rnayak@ti.com> Cc: Vaibhav Hiremath <hvaibhav@ti.com> Acked-by: Rajendra Nayak <rnayak@ti.com> Reviewed-by: Russ Dill <Russ.Dill@ti.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/cm2xxx.c')
-rw-r--r--arch/arm/mach-omap2/cm2xxx.c89
1 files changed, 88 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/cm2xxx.c b/arch/arm/mach-omap2/cm2xxx.c
index 051349370711..64165013daf9 100644
--- a/arch/arm/mach-omap2/cm2xxx.c
+++ b/arch/arm/mach-omap2/cm2xxx.c
@@ -2,8 +2,9 @@
2 * OMAP2xxx CM module functions 2 * OMAP2xxx CM module functions
3 * 3 *
4 * Copyright (C) 2009 Nokia Corporation 4 * Copyright (C) 2009 Nokia Corporation
5 * Copyright (C) 2012 Texas Instruments, Inc. 5 * Copyright (C) 2008-2010, 2012 Texas Instruments, Inc.
6 * Paul Walmsley 6 * Paul Walmsley
7 * Rajendra Nayak <rnayak@ti.com>
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
@@ -20,9 +21,11 @@
20#include "soc.h" 21#include "soc.h"
21#include "iomap.h" 22#include "iomap.h"
22#include "common.h" 23#include "common.h"
24#include "prm2xxx.h"
23#include "cm.h" 25#include "cm.h"
24#include "cm2xxx.h" 26#include "cm2xxx.h"
25#include "cm-regbits-24xx.h" 27#include "cm-regbits-24xx.h"
28#include "clockdomain.h"
26 29
27/* CM_AUTOIDLE_PLL.AUTO_* bit values for DPLLs */ 30/* CM_AUTOIDLE_PLL.AUTO_* bit values for DPLLs */
28#define DPLL_AUTOIDLE_DISABLE 0x0 31#define DPLL_AUTOIDLE_DISABLE 0x0
@@ -166,3 +169,87 @@ int omap2xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
166 169
167 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY; 170 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
168} 171}
172
173/* Clockdomain low-level functions */
174
175static void omap2xxx_clkdm_allow_idle(struct clockdomain *clkdm)
176{
177 if (atomic_read(&clkdm->usecount) > 0)
178 _clkdm_add_autodeps(clkdm);
179
180 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
181 clkdm->clktrctrl_mask);
182}
183
184static void omap2xxx_clkdm_deny_idle(struct clockdomain *clkdm)
185{
186 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
187 clkdm->clktrctrl_mask);
188
189 if (atomic_read(&clkdm->usecount) > 0)
190 _clkdm_del_autodeps(clkdm);
191}
192
193static int omap2xxx_clkdm_clk_enable(struct clockdomain *clkdm)
194{
195 bool hwsup = false;
196
197 if (!clkdm->clktrctrl_mask)
198 return 0;
199
200 hwsup = omap2xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
201 clkdm->clktrctrl_mask);
202
203 if (hwsup) {
204 /* Disable HW transitions when we are changing deps */
205 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
206 clkdm->clktrctrl_mask);
207 _clkdm_add_autodeps(clkdm);
208 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
209 clkdm->clktrctrl_mask);
210 } else {
211 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
212 omap2xxx_clkdm_wakeup(clkdm);
213 }
214
215 return 0;
216}
217
218static int omap2xxx_clkdm_clk_disable(struct clockdomain *clkdm)
219{
220 bool hwsup = false;
221
222 if (!clkdm->clktrctrl_mask)
223 return 0;
224
225 hwsup = omap2xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
226 clkdm->clktrctrl_mask);
227
228 if (hwsup) {
229 /* Disable HW transitions when we are changing deps */
230 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
231 clkdm->clktrctrl_mask);
232 _clkdm_del_autodeps(clkdm);
233 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
234 clkdm->clktrctrl_mask);
235 } else {
236 if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
237 omap2xxx_clkdm_sleep(clkdm);
238 }
239
240 return 0;
241}
242
243struct clkdm_ops omap2_clkdm_operations = {
244 .clkdm_add_wkdep = omap2_clkdm_add_wkdep,
245 .clkdm_del_wkdep = omap2_clkdm_del_wkdep,
246 .clkdm_read_wkdep = omap2_clkdm_read_wkdep,
247 .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
248 .clkdm_sleep = omap2xxx_clkdm_sleep,
249 .clkdm_wakeup = omap2xxx_clkdm_wakeup,
250 .clkdm_allow_idle = omap2xxx_clkdm_allow_idle,
251 .clkdm_deny_idle = omap2xxx_clkdm_deny_idle,
252 .clkdm_clk_enable = omap2xxx_clkdm_clk_enable,
253 .clkdm_clk_disable = omap2xxx_clkdm_clk_disable,
254};
255