aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/prcm.c
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2010-12-21 17:30:55 -0500
committerPaul Walmsley <paul@pwsan.com>2010-12-21 22:01:55 -0500
commit59fb659b065f52fcc2deed293cfbfc58f890376c (patch)
tree17d41be36262ed960fb30df41acf80602ade6726 /arch/arm/mach-omap2/prcm.c
parentcdb54c4457d68994da7c2e16907adfbfc130060d (diff)
OMAP2/3: PRCM: split OMAP2/3-specific PRCM code into OMAP2/3-specific files
In preparation for adding OMAP4-specific PRCM accessor/mutator functions, split the existing OMAP2/3 PRCM code into OMAP2/3-specific files. Most of what was in mach-omap2/{cm,prm}.{c,h} has now been moved into mach-omap2/{cm,prm}2xxx_3xxx.{c,h}, since it was OMAP2xxx/3xxx-specific. This process also requires the #includes in each of these files to be changed to reference the new file name. As part of doing so, add some comments into plat-omap/sram.c and plat-omap/mcbsp.c, which use "sideways includes", to indicate that these users of the PRM/CM includes should not be doing so. Thanks to Felipe Contreras <felipe.contreras@gmail.com> for comments on this patch. Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Jarkko Nikula <jhnikula@gmail.com> Cc: Peter Ujfalusi <peter.ujfalusi@nokia.com> Cc: Liam Girdwood <lrg@slimlogic.co.uk> Cc: Omar Ramirez Luna <omar.ramirez@ti.com> Acked-by: Omar Ramirez Luna <omar.ramirez@ti.com> Cc: Felipe Contreras <felipe.contreras@gmail.com> Acked-by: Felipe Contreras <felipe.contreras@gmail.com> Cc: Greg Kroah-Hartman <greg@kroah.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Reviewed-by: Kevin Hilman <khilman@deeprootsystems.com> Tested-by: Kevin Hilman <khilman@deeprootsystems.com> Tested-by: Rajendra Nayak <rnayak@ti.com> Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/prcm.c')
-rw-r--r--arch/arm/mach-omap2/prcm.c88
1 files changed, 9 insertions, 79 deletions
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index aac8070fadcd..171c710c8221 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -29,16 +29,17 @@
29 29
30#include "clock.h" 30#include "clock.h"
31#include "clock2xxx.h" 31#include "clock2xxx.h"
32#include "cm.h" 32#include "cm2xxx_3xxx.h"
33#include "prm.h" 33#include "cm44xx.h"
34#include "prm2xxx_3xxx.h"
34#include "prm44xx.h" 35#include "prm44xx.h"
35#include "prm-regbits-24xx.h" 36#include "prm-regbits-24xx.h"
36#include "prm-regbits-44xx.h" 37#include "prm-regbits-44xx.h"
37#include "control.h" 38#include "control.h"
38 39
39static void __iomem *prm_base; 40void __iomem *prm_base;
40static void __iomem *cm_base; 41void __iomem *cm_base;
41static void __iomem *cm2_base; 42void __iomem *cm2_base;
42 43
43#define MAX_MODULE_ENABLE_WAIT 100000 44#define MAX_MODULE_ENABLE_WAIT 100000
44 45
@@ -158,56 +159,6 @@ void omap_prcm_arch_reset(char mode, const char *cmd)
158 prcm_offs, OMAP4_RM_RSTCTRL); 159 prcm_offs, OMAP4_RM_RSTCTRL);
159} 160}
160 161
161static inline u32 __omap_prcm_read(void __iomem *base, s16 module, u16 reg)
162{
163 BUG_ON(!base);
164 return __raw_readl(base + module + reg);
165}
166
167static inline void __omap_prcm_write(u32 value, void __iomem *base,
168 s16 module, u16 reg)
169{
170 BUG_ON(!base);
171 __raw_writel(value, base + module + reg);
172}
173
174/* Read a register in a PRM module */
175u32 prm_read_mod_reg(s16 module, u16 idx)
176{
177 return __omap_prcm_read(prm_base, module, idx);
178}
179
180/* Write into a register in a PRM module */
181void prm_write_mod_reg(u32 val, s16 module, u16 idx)
182{
183 __omap_prcm_write(val, prm_base, module, idx);
184}
185
186/* Read-modify-write a register in a PRM module. Caller must lock */
187u32 prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
188{
189 u32 v;
190
191 v = prm_read_mod_reg(module, idx);
192 v &= ~mask;
193 v |= bits;
194 prm_write_mod_reg(v, module, idx);
195
196 return v;
197}
198
199/* Read a PRM register, AND it, and shift the result down to bit 0 */
200u32 prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
201{
202 u32 v;
203
204 v = prm_read_mod_reg(domain, idx);
205 v &= mask;
206 v >>= __ffs(mask);
207
208 return v;
209}
210
211/* Read a PRM register, AND it, and shift the result down to bit 0 */ 162/* Read a PRM register, AND it, and shift the result down to bit 0 */
212u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask) 163u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask)
213{ 164{
@@ -232,30 +183,6 @@ u32 omap4_prm_rmw_reg_bits(u32 mask, u32 bits, void __iomem *reg)
232 183
233 return v; 184 return v;
234} 185}
235/* Read a register in a CM module */
236u32 cm_read_mod_reg(s16 module, u16 idx)
237{
238 return __omap_prcm_read(cm_base, module, idx);
239}
240
241/* Write into a register in a CM module */
242void cm_write_mod_reg(u32 val, s16 module, u16 idx)
243{
244 __omap_prcm_write(val, cm_base, module, idx);
245}
246
247/* Read-modify-write a register in a CM module. Caller must lock */
248u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
249{
250 u32 v;
251
252 v = cm_read_mod_reg(module, idx);
253 v &= ~mask;
254 v |= bits;
255 cm_write_mod_reg(v, module, idx);
256
257 return v;
258}
259 186
260/** 187/**
261 * omap2_cm_wait_idlest - wait for IDLEST bit to indicate module readiness 188 * omap2_cm_wait_idlest - wait for IDLEST bit to indicate module readiness
@@ -266,6 +193,9 @@ u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
266 * 193 *
267 * Returns 1 if the module indicated readiness in time, or 0 if it 194 * Returns 1 if the module indicated readiness in time, or 0 if it
268 * failed to enable in roughly MAX_MODULE_ENABLE_WAIT microseconds. 195 * failed to enable in roughly MAX_MODULE_ENABLE_WAIT microseconds.
196 *
197 * XXX This function is deprecated. It should be removed once the
198 * hwmod conversion is complete.
269 */ 199 */
270int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest, 200int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest,
271 const char *name) 201 const char *name)