aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/prcm.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2008-07-03 05:24:44 -0400
committerTony Lindgren <tony@atomide.com>2008-07-03 05:24:44 -0400
commitff00fcc9ca8f18facbc3fcd779e85887e5a0d247 (patch)
treeb1270b8b3a748e3ff7a16551ba4831fff4a5d118 /arch/arm/mach-omap2/prcm.c
parenta58caad11301a5bdc2d7b76596ab5477221f7a9b (diff)
ARM: OMAP: Turn CM and PRM access into functions
Otherwise compiling in omap2 and omap3 will not work. Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/prcm.c')
-rw-r--r--arch/arm/mach-omap2/prcm.c45
1 files changed, 38 insertions, 7 deletions
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index 9584376d055a..fd92a80f38f2 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -28,10 +28,9 @@
28static void __iomem *prm_base; 28static void __iomem *prm_base;
29static void __iomem *cm_base; 29static void __iomem *cm_base;
30 30
31extern void omap2_clk_prepare_for_reboot(void);
32
33u32 omap_prcm_get_reset_sources(void) 31u32 omap_prcm_get_reset_sources(void)
34{ 32{
33 /* XXX This presumably needs modification for 34XX */
35 return prm_read_mod_reg(WKUP_MOD, RM_RSTST) & 0x7f; 34 return prm_read_mod_reg(WKUP_MOD, RM_RSTST) & 0x7f;
36} 35}
37EXPORT_SYMBOL(omap_prcm_get_reset_sources); 36EXPORT_SYMBOL(omap_prcm_get_reset_sources);
@@ -39,13 +38,17 @@ EXPORT_SYMBOL(omap_prcm_get_reset_sources);
39/* Resets clock rates and reboots the system. Only called from system.h */ 38/* Resets clock rates and reboots the system. Only called from system.h */
40void omap_prcm_arch_reset(char mode) 39void omap_prcm_arch_reset(char mode)
41{ 40{
42 u32 wkup; 41 s16 prcm_offs;
43 omap2_clk_prepare_for_reboot(); 42 omap2_clk_prepare_for_reboot();
44 43
45 if (cpu_is_omap24xx()) { 44 if (cpu_is_omap24xx())
46 wkup = prm_read_mod_reg(WKUP_MOD, RM_RSTCTRL) | OMAP_RST_DPLL3; 45 prcm_offs = WKUP_MOD;
47 prm_write_mod_reg(wkup, WKUP_MOD, RM_RSTCTRL); 46 else if (cpu_is_omap34xx())
48 } 47 prcm_offs = OMAP3430_GR_MOD;
48 else
49 WARN_ON(1);
50
51 prm_set_mod_reg_bits(OMAP_RST_DPLL3, prcm_offs, RM_RSTCTRL);
49} 52}
50 53
51static inline u32 __omap_prcm_read(void __iomem *base, s16 module, u16 reg) 54static inline u32 __omap_prcm_read(void __iomem *base, s16 module, u16 reg)
@@ -75,6 +78,20 @@ void prm_write_mod_reg(u32 val, s16 module, u16 idx)
75} 78}
76EXPORT_SYMBOL(prm_write_mod_reg); 79EXPORT_SYMBOL(prm_write_mod_reg);
77 80
81/* Read-modify-write a register in a PRM module. Caller must lock */
82u32 prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
83{
84 u32 v;
85
86 v = prm_read_mod_reg(module, idx);
87 v &= ~mask;
88 v |= bits;
89 prm_write_mod_reg(v, module, idx);
90
91 return v;
92}
93EXPORT_SYMBOL(prm_rmw_mod_reg_bits);
94
78/* Read a register in a CM module */ 95/* Read a register in a CM module */
79u32 cm_read_mod_reg(s16 module, u16 idx) 96u32 cm_read_mod_reg(s16 module, u16 idx)
80{ 97{
@@ -89,6 +106,20 @@ void cm_write_mod_reg(u32 val, s16 module, u16 idx)
89} 106}
90EXPORT_SYMBOL(cm_write_mod_reg); 107EXPORT_SYMBOL(cm_write_mod_reg);
91 108
109/* Read-modify-write a register in a CM module. Caller must lock */
110u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
111{
112 u32 v;
113
114 v = cm_read_mod_reg(module, idx);
115 v &= ~mask;
116 v |= bits;
117 cm_write_mod_reg(v, module, idx);
118
119 return v;
120}
121EXPORT_SYMBOL(cm_rmw_mod_reg_bits);
122
92void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals) 123void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
93{ 124{
94 prm_base = omap2_globals->prm; 125 prm_base = omap2_globals->prm;