diff options
author | Tony Lindgren <tony@atomide.com> | 2008-07-03 05:24:44 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2008-07-03 05:24:44 -0400 |
commit | ff00fcc9ca8f18facbc3fcd779e85887e5a0d247 (patch) | |
tree | b1270b8b3a748e3ff7a16551ba4831fff4a5d118 | |
parent | a58caad11301a5bdc2d7b76596ab5477221f7a9b (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.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-omap2/cm.h | 11 | ||||
-rw-r--r-- | arch/arm/mach-omap2/prcm.c | 45 | ||||
-rw-r--r-- | arch/arm/mach-omap2/prm.h | 12 |
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); | |||
42 | int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); | 42 | int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); |
43 | u32 omap2_get_dpll_rate(struct clk *clk); | 43 | u32 omap2_get_dpll_rate(struct clk *clk); |
44 | int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name); | 44 | int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name); |
45 | void omap2_clk_prepare_for_reboot(void); | ||
45 | 46 | ||
46 | extern u8 cpu_mask; | 47 | extern 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 | ||
100 | extern u32 cm_read_mod_reg(s16 module, u16 idx); | 100 | extern u32 cm_read_mod_reg(s16 module, u16 idx); |
101 | extern void cm_write_mod_reg(u32 val, s16 module, u16 idx); | 101 | extern void cm_write_mod_reg(u32 val, s16 module, u16 idx); |
102 | extern u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx); | ||
103 | |||
104 | static 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 | |||
109 | static 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 @@ | |||
28 | static void __iomem *prm_base; | 28 | static void __iomem *prm_base; |
29 | static void __iomem *cm_base; | 29 | static void __iomem *cm_base; |
30 | 30 | ||
31 | extern void omap2_clk_prepare_for_reboot(void); | ||
32 | |||
33 | u32 omap_prcm_get_reset_sources(void) | 31 | u32 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 | } |
37 | EXPORT_SYMBOL(omap_prcm_get_reset_sources); | 36 | EXPORT_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 */ |
40 | void omap_prcm_arch_reset(char mode) | 39 | void 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 | ||
51 | static inline u32 __omap_prcm_read(void __iomem *base, s16 module, u16 reg) | 54 | static 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 | } |
76 | EXPORT_SYMBOL(prm_write_mod_reg); | 79 | EXPORT_SYMBOL(prm_write_mod_reg); |
77 | 80 | ||
81 | /* Read-modify-write a register in a PRM module. Caller must lock */ | ||
82 | u32 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 | } | ||
93 | EXPORT_SYMBOL(prm_rmw_mod_reg_bits); | ||
94 | |||
78 | /* Read a register in a CM module */ | 95 | /* Read a register in a CM module */ |
79 | u32 cm_read_mod_reg(s16 module, u16 idx) | 96 | u32 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 | } |
90 | EXPORT_SYMBOL(cm_write_mod_reg); | 107 | EXPORT_SYMBOL(cm_write_mod_reg); |
91 | 108 | ||
109 | /* Read-modify-write a register in a CM module. Caller must lock */ | ||
110 | u32 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 | } | ||
121 | EXPORT_SYMBOL(cm_rmw_mod_reg_bits); | ||
122 | |||
92 | void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals) | 123 | void __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 */ |
169 | extern u32 prm_read_mod_reg(s16 module, u16 idx); | 169 | extern u32 prm_read_mod_reg(s16 module, u16 idx); |
170 | extern void prm_write_mod_reg(u32 val, s16 module, u16 idx); | 170 | extern void prm_write_mod_reg(u32 val, s16 module, u16 idx); |
171 | extern 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) */ | ||
174 | static 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 | |||
179 | static 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 | ||