aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--arch/arm/mach-omap2/clock.h1
-rw-r--r--arch/arm/mach-omap2/cm.h11
-rw-r--r--arch/arm/mach-omap2/prcm.c45
-rw-r--r--arch/arm/mach-omap2/prm.h12
4 files changed, 62 insertions, 7 deletions
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index d5980a9e09a4..f97948548f29 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -42,6 +42,7 @@ long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate);
42int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); 42int omap2_clksel_set_rate(struct clk *clk, unsigned long rate);
43u32 omap2_get_dpll_rate(struct clk *clk); 43u32 omap2_get_dpll_rate(struct clk *clk);
44int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name); 44int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name);
45void omap2_clk_prepare_for_reboot(void);
45 46
46extern u8 cpu_mask; 47extern u8 cpu_mask;
47 48
diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
index e2d404e69454..1dd873fcc2bd 100644
--- a/arch/arm/mach-omap2/cm.h
+++ b/arch/arm/mach-omap2/cm.h
@@ -99,6 +99,17 @@
99 99
100extern u32 cm_read_mod_reg(s16 module, u16 idx); 100extern u32 cm_read_mod_reg(s16 module, u16 idx);
101extern void cm_write_mod_reg(u32 val, s16 module, u16 idx); 101extern void cm_write_mod_reg(u32 val, s16 module, u16 idx);
102extern u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
103
104static inline u32 cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
105{
106 return cm_rmw_mod_reg_bits(bits, bits, module, idx);
107}
108
109static inline u32 cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
110{
111 return cm_rmw_mod_reg_bits(bits, 0x0, module, idx);
112}
102 113
103#endif 114#endif
104 115
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;
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
index e901fb99b237..bbf41fc8e9a9 100644
--- a/arch/arm/mach-omap2/prm.h
+++ b/arch/arm/mach-omap2/prm.h
@@ -168,6 +168,18 @@
168/* Power/reset management domain register get/set */ 168/* Power/reset management domain register get/set */
169extern u32 prm_read_mod_reg(s16 module, u16 idx); 169extern u32 prm_read_mod_reg(s16 module, u16 idx);
170extern void prm_write_mod_reg(u32 val, s16 module, u16 idx); 170extern void prm_write_mod_reg(u32 val, s16 module, u16 idx);
171extern u32 prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
172
173/* Read-modify-write bits in a PRM register (by domain) */
174static inline u32 prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
175{
176 return prm_rmw_mod_reg_bits(bits, bits, module, idx);
177}
178
179static inline u32 prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
180{
181 return prm_rmw_mod_reg_bits(bits, 0x0, module, idx);
182}
171 183
172#endif 184#endif
173 185